Changeset 3212
- Timestamp:
- 02/17/04 09:48:21 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3211 r3212 13 13 * macros/spline.C 14 14 - changed according to the MCubicSpline new constructors 15 16 * manalysis/MArrivalTimeCalc.[h,cc] 17 - changed to use the MCubicSpline class intead of the TSpline class 18 - warning: now the arrival time is again the maximum of the spline, 19 soon it will be changed to half maximum 15 20 16 21 -
trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.cc
r3032 r3212 41 41 #include "MArrivalTimeCalc.h" 42 42 43 #include <TSpline.h>43 #include "MCubicSpline.h" 44 44 45 45 #include "MLog.h" … … 61 61 // Default constructor. 62 62 // 63 // Initialize step size by default to 0.03 time slices == 100 ps.64 63 // 65 MArrivalTimeCalc::MArrivalTimeCalc(const char *name, const char *title) 66 : fStepSize(0.03) 64 MArrivalTimeCalc::MArrivalTimeCalc(const char *name, const char *title) 67 65 { 68 66 … … 132 130 133 131 const UInt_t idx = pixel.GetPixelId(); 134 Float_t max= 0.;132 Float_t time = 0.; 135 133 136 134 … … 142 140 143 141 const Short_t nslices = fRawEvt->GetNumLoGainSamples(); 144 max= Calc(pixel.GetLoGainSamples(),nslices);142 time = Calc(pixel.GetLoGainSamples(),nslices); 145 143 } 146 144 … … 153 151 154 152 const Short_t nslices = fRawEvt->GetNumHiGainSamples(); 155 max= Calc(pixel.GetHiGainSamples(),nslices);153 time = Calc(pixel.GetHiGainSamples(),nslices); 156 154 } 157 155 … … 159 157 // If pixel is saturated and hasn't lo gains we do nothing, it's value remains -1 160 158 // 161 fArrTime->SetTime(idx, max);159 fArrTime->SetTime(idx,time); 162 160 163 161 } … … 172 170 // Calculates the arrival time for each pixel 173 171 // Possible Methods 174 // Case 1: Spline5 (From TSpline5 Root Class)172 // Case 1: MCubicSpline (3rd order spline) 175 173 // 176 174 Float_t MArrivalTimeCalc::Calc(const Byte_t *fadcSamples, const Short_t nslices) … … 178 176 179 177 // 180 // Initialize a double pointer with filled FADC slices178 // Initialize the spline 181 179 // 182 Double_t ptr[nslices];180 MCubicSpline *spline = new MCubicSpline(fadcSamples); 183 181 184 182 // 185 // Initialize the spline183 // Now find the maximum 186 184 // 187 for (Int_t i=0; i<nslices; i++) 188 ptr[i]=(Double_t)fadcSamples[i]; 189 190 TSpline5 spline("spline",0.,(Double_t)(nslices - 1),ptr,nslices); 191 192 // 193 // Now find the half maximum (!) 194 // evaluating the spline function at every fStepSize time slice 195 // 196 Double_t abscissa=0; 197 Double_t maxAb =0; 198 Double_t maxOrd =0; 199 200 while (abscissa <= nslices - 1) 201 { 202 const Double_t swap = spline.Eval(abscissa); 203 204 if (swap > maxOrd) 205 { 206 maxOrd = swap; 207 maxAb = abscissa; 208 } 209 // make step size a bit bigger first 210 abscissa += fStepSize; 211 // abscissa += fStepSize; 212 } 213 214 // 215 // another (much smaller) loop to move back from the maximum 216 // 217 Double_t halfMaxAb = 0; 218 219 abscissa = maxAb; 220 221 while (abscissa > 0) 222 { 223 224 const Double_t swap = spline.Eval(abscissa); 225 226 if (swap < maxOrd/2.) 227 { 228 halfMaxAb = abscissa; 229 break; 230 } 231 232 abscissa -= fStepSize; 233 } 234 235 236 // return (Float_t)maxAb; 237 return (Float_t)halfMaxAb; 185 return (Float_t)spline->EvalAbMax(); 238 186 } 239 187 -
trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.h
r2921 r3212 24 24 25 25 Float_t Calc(const Byte_t *fadcSamples, const Short_t nslices); 26 27 Float_t fStepSize; // The step size to evaluate the time 28 26 29 27 public: 30 28 MArrivalTimeCalc(const char *name=NULL, const char *title=NULL); 31 29 ~MArrivalTimeCalc(){} 32 33 void SetStepSize(Float_t s) { fStepSize = s; } 34 30 35 31 ClassDef(MArrivalTimeCalc, 0) // Task to calculate Arrival Times from raw data 36 32 };
Note:
See TracChangeset
for help on using the changeset viewer.