Changeset 2785
- Timestamp:
- 01/13/04 15:46:33 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MArrivalTime.cc
r2756 r2785 55 55 } 56 56 57 // Sets every pixel arrival time to -1 58 void MArrivalTime::CleanArray(const MGeomCam &geom) 59 { 60 fData.Set(geom.GetNumPixels()); 61 fData.Reset(-1.0); 62 } 63 57 64 // 58 65 // Calculates the arrival time for each pixel … … 62 69 // 63 70 64 void MArrivalTime::Calc(const MRawEvtData &evt, const MGeomCam &geom) 65 { 66 const Int_t n = geom.GetNumPixels(); 67 68 fData.Set(n); 69 fData.Reset(); 70 71 MRawEvtPixelIter pixel((MRawEvtData*)&evt); 72 73 while ( pixel.Next() ) 74 { 75 const UInt_t idx = pixel.GetPixelId(); 76 77 //If pixel has saturated and hasn't lo gains we return -1 78 79 if (pixel.GetMaxHiGainSample() == 0xff) 80 { 81 if (!pixel.HasLoGain()) 82 { 83 fData[idx]=-1.0; 84 } 85 else //Calculate time using Lo Gains 86 { 87 Byte_t *ptr = pixel.GetLoGainSamples(); 88 89 Int_t nSlice = evt.GetNumLoGainSamples(); 71 void MArrivalTime::Calc(const Byte_t *fadcSamples, const Short_t nSlice, 72 const Short_t idx, const MGeomCam &geom) 73 { 74 90 75 //Some casts are needed because TSpline5 constructor accepts only Double_t values 91 Double_t ptr2[nSlice]; 92 for (Int_t i = 0; i < nSlice; i++) 93 ptr2[i]=(Double_t)ptr[i]; 94 TSpline5 *spline = new TSpline5("spline",(Double_t) 0,(Double_t)(nSlice - 1),ptr2,nSlice); 76 Double_t ptr[nSlice]; 77 78 for (Int_t i = 0; i < nSlice; i++) 79 ptr[i]=(Double_t)fadcSamples[i]; 80 81 TSpline5 *spline = new TSpline5("spline",(Double_t) 0, 82 (Double_t)(nSlice - 1),ptr,nSlice); 95 83 //Now find the maximum evaluating the spline function at every 1/10 time slice 96 Double_t abscissa=0.0; 97 Double_t maxAb=0.0; 98 Double_t maxOrd=0.0; 99 Double_t swap; 100 while (abscissa <= nSlice - 1) 101 { 102 swap=spline->Eval(abscissa); 103 if (swap > maxOrd) 104 { 105 maxOrd = swap; 106 maxAb = abscissa; 107 } 108 abscissa += 0.1; 109 } 110 fData[idx]=maxAb; 111 } 84 Double_t abscissa=0.0; 85 Double_t maxAb=0.0; 86 Double_t maxOrd=0.0; 87 Double_t swap; 88 while (abscissa <= nSlice - 1) 89 { 90 swap=spline->Eval(abscissa); 91 if (swap > maxOrd) 92 { 93 maxOrd = swap; 94 maxAb = abscissa; 112 95 } 113 else //Calculate time using Hi Gains 114 { 115 Byte_t *ptr = pixel.GetHiGainSamples(); 116 117 Int_t nSlice = evt.GetNumHiGainSamples(); 118 //Some casts are needed because TSpline5 constructor accepts only Double_t values 119 Double_t ptr2[nSlice]; 120 for (Int_t i = 0; i < nSlice; i++) 121 ptr2[i]=(Double_t)ptr[i]; 122 TSpline5 *spline = new TSpline5("spline",(Double_t) 0,(Double_t)(nSlice - 1),ptr2,nSlice); 123 //Now find the maximum evaluating the spline function at every 1/10 time slice 124 Double_t abscissa=0.0; 125 Double_t maxAb=0.0; 126 Double_t maxOrd=0.0; 127 Double_t swap; 128 while (abscissa <= nSlice - 1) 129 { 130 swap=spline->Eval(abscissa); 131 if (swap > maxOrd) 132 { 133 maxOrd = swap; 134 maxAb = abscissa; 135 } 136 abscissa += 0.1; 137 } 138 fData[idx]=maxAb; 139 } 140 } 96 abscissa += 0.1; 97 } 98 fData[idx]=maxAb; 141 99 } 142 100 … … 157 115 158 116 fData2.Set(n); 159 fData2.Reset(-1 );117 fData2.Reset(-1.0); 160 118 fData3.Set(n); 161 fData3.Reset(-1 );119 fData3.Reset(-1.0); 162 120 fData4.Set(n); 163 fData4.Reset(-1 );121 fData4.Reset(-1.0); 164 122 fData5.Set(n); 165 fData5.Reset(-1 );123 fData5.Reset(-1.0); 166 124 167 125 MRawEvtPixelIter pixel((MRawEvtData*)&evt); … … 181 139 } 182 140 // End of fakeData preparation 183 141 *fLog << warn << "fin qui bene" << endl; 184 142 // Max dimension of cluster 185 143 Short_t dimCluster; -
trunk/MagicSoft/Mars/manalysis/MArrivalTime.h
r2756 r2785 38 38 UInt_t GetNumPixels() const { return fData.GetSize(); } 39 39 40 void C alc(const MRawEvtData &evt, const MGeomCam &geom); // Calculates arrival times40 void CleanArray(const MGeomCam &geom); //Sets every arr time to -1 41 41 42 void MArrivalTime::EvalClusters(const MRawEvtData &evt, const MGeomCam &geom); 42 void Calc(const Byte_t *fadcSamples, const Short_t nSlice, 43 const Short_t idx, const MGeomCam &geom); // Calculates arrival times 43 44 44 void MArrivalTime::CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom, 45 void EvalClusters(const MRawEvtData &evt, const MGeomCam &geom); 46 47 void CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom, 45 48 Short_t idx, Short_t *dimCluster); 46 49 -
trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.cc
r2752 r2785 129 129 MRawEvtPixelIter pixel(fRawEvt); 130 130 131 fArrTime->Calc((const MRawEvtData&) *fRawEvt,(const MGeomCam&) *fGeom); 131 // Every pixel is set to -1 132 fArrTime->CleanArray((const MGeomCam&) *fGeom); 133 134 while (pixel.Next()) 135 { 136 const UInt_t idx = pixel.GetPixelId(); 137 // If pixel is saturated we use LoGains 138 if (pixel.GetMaxHiGainSample() == 0xff && pixel.HasLoGain()) 139 { 140 const Byte_t *ptr = pixel.GetLoGainSamples(); 141 const Short_t nSlice = fRawEvt->GetNumLoGainSamples(); 142 fArrTime->Calc(ptr, nSlice, idx, (const MGeomCam&) *fGeom); 143 } 144 // Use HiGains 145 else 146 { 147 const Byte_t *ptr = pixel.GetHiGainSamples(); 148 const Short_t nSlice = fRawEvt->GetNumHiGainSamples(); 149 fArrTime->Calc(ptr, nSlice, idx, (const MGeomCam&) *fGeom); 150 } 151 // If pixel is saturated and hasn't lo gains we do nothing, it's value remains -1 152 } 153 132 154 fArrTime->SetReadyToSave(); 133 155 134 while (pixel.Next()){;}135 136 156 return kTRUE; 137 157 }
Note:
See TracChangeset
for help on using the changeset viewer.