Changeset 1425 for trunk/MagicSoft
- Timestamp:
- 07/22/02 17:32:22 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1423 r1425 1 1 -*-*- END -*-*- 2 3 2002/07/22: Abelardo Moralejo 4 5 * manalysis/MCerPhotCalc2.[h,cc]: 6 -added procedure SetWeights. 7 8 * macros/MagicHillas.C: 9 -added example on how to use MCerPhotCalc2 2 10 3 11 2002/07/22: Thomas Bretz -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.cc
r1404 r1425 28 28 // // 29 29 // This is a task which calculates the number of photons from the FADC // 30 // time slices. It weights the each slice according to the fraction // 31 // of signal which, in average, falls within it. This average has been // 32 // determined over a run (about 1000 triggers, 0 deg z.a. gammas). // 30 // time slices. It weights the each slice according to the numbers in // 31 // the array fWeight. The default values (see end of this file) are // 32 // the fraction of signal which, in average, falls within each slice. // 33 // This averages have been determined over a run (about 1000 triggers, // 34 // 0 deg z.a. gammas). // 33 35 // // 34 36 // Input Containers: // 35 // MRaw EvtData, MPedestalCam//37 // MRawRunHeader, MRawEvtData, MPedestalCam // 36 38 // // 37 39 // Output Containers: // … … 65 67 { 66 68 fName = name ? name : "MCerPhotCalc2"; 67 fTitle = title ? title : "Task to calculate Cerenkov photonsfrom raw data";69 fTitle = title ? title : "Task to calculate pixel signal from raw data"; 68 70 69 71 AddToBranchList("MRawEvtData.fHiGainPixId"); … … 71 73 AddToBranchList("MRawEvtData.fHiGainFadcSamples"); 72 74 AddToBranchList("MRawEvtData.fLoGainFadcSamples"); 73 74 fSumQuadWeights = fSumWeights = 0.;75 for (Int_t i = 0; i < 15; i++)76 {77 fSumQuadWeights += fWeight[i]*fWeight[i];78 fSumWeights += fWeight[i];79 }80 fSumQuadWeights = sqrt(fSumQuadWeights);81 82 75 } 83 76 … … 120 113 return kFALSE; 121 114 115 // Calculate quadratic sum of weights: 116 fSumQuadWeights = 0.; 117 for (Int_t i = 0; i < 15; i++) 118 fSumQuadWeights += fWeight[i]*fWeight[i]; 119 120 fSumQuadWeights = sqrt(fSumQuadWeights); 121 122 122 return kTRUE; 123 123 } … … 138 138 } 139 139 140 if (fRunHeader->GetNumSamplesHiGain() != 15) 141 { 142 *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from expected (15)... aborting." << endl; 143 return kFALSE; 144 } 145 140 146 if (runheader->GetRunType() != kRTMonteCarlo) 141 147 return kTRUE; … … 165 171 MRawEvtPixelIter pixel(fRawEvt); 166 172 167 Float_t ADCBins[15];173 Float_t BinSignal[15]; 168 174 169 175 while (pixel.Next()) … … 187 193 188 194 Float_t nphot = 0.; 189 for(Int_t i = 0; i<15;i++) 195 196 for(Int_t i = 0; i<15; i++) 190 197 { 191 ADCBins[i] = (Float_t) *(ptr+i);192 nphot += ADCBins[i] * fWeight[i];198 BinSignal[i] = (Float_t) ptr[i] - mean; 199 nphot += BinSignal[i] * fWeight[i]; 193 200 } 194 195 //196 // We check that the pixel is not empty, if it is empty197 // we won't substract the pedestal. Empty means that it has198 // 0 signal in all the slices.199 //200 if (nphot!=0)201 nphot -= mean*fSumWeights;202 201 203 202 Float_t nphoterr = ped.GetSigma()* fSumQuadWeights; … … 213 212 } 214 213 215 Float_t MCerPhotCalc2::fWeight[15] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.}; 214 // Default weights: 215 Float_t MCerPhotCalc2::fWeight[] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.}; -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.h
r1404 r1425 25 25 MRawEvtData *fRawEvt; // raw event data (time slices) 26 26 MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation 27 MRawRunHeader *fRunHeader; // 27 MRawRunHeader *fRunHeader; // RunHeader information 28 28 29 29 Bool_t fEnableFix; // fix for a bug in files from older camera versions (<=40) 30 30 31 Float_t fSumQuadWeights, fSumWeights;32 static Float_t fWeight[15];31 static Float_t fWeight[15]; // Weights for adding up the ADC slices 32 Float_t fSumQuadWeights; 33 33 34 34 public: … … 37 37 Bool_t PreProcess(MParList *pList); 38 38 Bool_t Process(); 39 Bool_t ReInit(MParList *pList); 39 40 40 Bool_t ReInit(MParList *pList);41 void SetWeights(Float_t *w) {memcpy(fWeight,w,15*sizeof(Float_t));} 41 42 42 43 ClassDef(MCerPhotCalc2, 0) // Task to calculate cerenkov photons from raw data 43 44 }; 44 45 45 46 46 47 #endif
Note:
See TracChangeset
for help on using the changeset viewer.