Changeset 1715 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 01/19/03 14:52:29 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
r1552 r1715 16 16 ! 17 17 ! 18 ! Author(s): Abelardo Moralejo 7/2002 (moralejo@pd.infn.it) 19 ! 20 ! Copyright: MAGIC Software Development, 2002 18 ! Author(s): Abelardo Moralejo 7/2002 <mailto:moralejo@pd.infn.it> 19 ! Author(s): Thomas Bretz 2002 <mailto:tbretz@astro.uni-wuerzburg.de> 20 ! 21 ! Copyright: MAGIC Software Development, 2002-2003 21 22 ! 22 23 ! … … 24 25 25 26 ////////////////////////////////////////////////////////////////////////////// 26 // //27 // MCerPhotCalc //28 // //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 numbers in //31 // the array fWeight (default: all slices added up with weight 1). 32 // //33 // Input Containers: //34 // MRawRunHeader, MRawEvtData, MPedestalCam //35 // //36 // Output Containers: //37 // MCerPhotEvt //38 // //27 // 28 // MCerPhotCalc 29 // 30 // This is a task which calculates the number of photons from the FADC 31 // time slices. It weights the each slice according to the numbers in 32 // the array fWeight (default: all slices added up with weight 1). 33 // 34 // Input Containers: 35 // MRawRunHeader, MRawEvtData, MPedestalCam 36 // 37 // Output Containers: 38 // MCerPhotEvt 39 // 39 40 ////////////////////////////////////////////////////////////////////////////// 40 41 41 #include "MCerPhotCalc.h" 42 42 … … 103 103 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 104 104 if (!fPedestals) 105 { 106 *fLog << dbginf << "MPedestalCam not found... aborting." << endl; 107 return kFALSE; 108 } 105 return kFALSE; 109 106 110 107 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); … … 115 112 fSumQuadWeights = 0.; 116 113 for (Int_t i = 0; i < fWeight.GetSize(); i++) 117 fSumQuadWeights += fWeight[i]*fWeight[i];114 fSumQuadWeights += fWeight[i]*fWeight[i]; 118 115 119 116 fSumQuadWeights = sqrt(fSumQuadWeights); … … 171 168 MRawEvtPixelIter pixel(fRawEvt); 172 169 173 TArrayF BinSignal(fWeight.GetSize());170 TArrayF binsignal(fWeight.GetSize()); 174 171 175 172 while (pixel.Next()) 176 177 173 { 174 const UInt_t pixid = pixel.GetPixelId(); 178 175 const MPedestalPix &ped = (*fPedestals)[pixid]; 179 176 … … 187 184 } 188 185 189 // Mean pedestal: 190 Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean(); 191 192 Byte_t *ptr = pixel.GetHiGainSamples(); 193 194 Float_t nphot = 0.; 195 Float_t nphoterr = 0.; 196 197 // Calculate pixel signal unless it has all FADC slices empty: 198 199 if (pixel.GetSumHiGainSamples()>0) 200 { 201 for(Int_t i = 0; i<fWeight.GetSize(); i++) 202 { 203 BinSignal[i] = (Float_t) ptr[i] - mean; 204 nphot += BinSignal[i] * fWeight[i]; 205 } 206 nphoterr = ped.GetSigma()* fSumQuadWeights; 207 } 186 // 187 // Mean pedestal: 188 // 189 const Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean(); 190 191 // 192 // Calculate pixel signal unless it has all FADC slices empty: 193 // 194 const Byte_t *ptr = pixel.GetHiGainSamples(); 195 196 Float_t nphot = 0; 197 Float_t nphoterr = 0; 198 199 if (pixel.GetSumHiGainSamples()>0) 200 { 201 for (Int_t i=0; i<fWeight.GetSize(); i++) 202 { 203 binsignal[i] = ptr[i] - mean; 204 nphot += binsignal[i] * fWeight[i]; 205 } 206 nphoterr = ped.GetSigma() * fSumQuadWeights; 207 } 208 208 209 209 fCerPhotEvt->AddPixel(pixid, nphot, nphoterr); 210 210 211 211 // FIXME! Handling of Lo Gains is missing! 212 212 } 213 213 214 214 fCerPhotEvt->SetReadyToSave(); … … 217 217 } 218 218 219 // -------------------------------------------------------------------------- 219 220 // 220 221 // Set default values for the number of slices and weights: 221 222 // 222 223 223 void MCerPhotCalc::SetDefaultWeights() 224 224 { 225 const Float_t dummy[15] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,}; 226 227 fWeight.Set(15,dummy); 228 return; 229 } 230 231 232 233 225 const Float_t dummy[15] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; 226 fWeight.Set(15, dummy); 227 } -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
r1546 r1715 10 10 // // 11 11 ///////////////////////////////////////////////////////////////////////////// 12 #ifndef ROOT_TArrayF 13 #include <TArrayF.h> 14 #endif 12 15 13 16 #ifndef MARS_MTask … … 15 18 #endif 16 19 17 #include <TArrayF.h>18 19 20 class MRawEvtData; 20 21 class MPedestalCam; 21 22 class MCerPhotEvt; 22 23 class MRawRunHeader; 23 class TArrayF;24 24 25 25 class MCerPhotCalc : public MTask … … 44 44 Bool_t ReInit(MParList *pList); 45 45 46 void SetWeights(TArrayF w) {fWeight.Set(w.GetSize(),w.GetArray());} 46 // FIXME: The array size should be checked! 47 void SetWeights(const TArrayF &w) { fWeight = w; } 47 48 48 49 ClassDef(MCerPhotCalc, 0) // Task to calculate cerenkov photons from raw data -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r1574 r1715 158 158 return -5.; 159 159 160 const UInt_t n = geom->GetNumPixels(); 161 160 162 Float_t minval = (*this)[0].GetNumPhotons(); 161 163 … … 164 166 const MCerPhotPix &pix = (*this)[i]; 165 167 168 const UInt_t id = pix.GetPixId(); 169 if (id>=n) 170 continue; 171 166 172 Float_t testval = pix.GetNumPhotons(); 167 173 168 174 if (geom) 169 testval *= geom->GetPixRatio( pix.GetPixId());175 testval *= geom->GetPixRatio(id); 170 176 171 177 if (testval < minval) … … 187 193 return 50.; 188 194 195 const UInt_t n = geom->GetNumPixels(); 196 189 197 Float_t maxval = (*this)[0].GetNumPhotons(); 190 198 … … 193 201 const MCerPhotPix &pix = (*this)[i]; 194 202 203 const UInt_t id = pix.GetPixId(); 204 if (id>=n) 205 continue; 206 195 207 Float_t testval = pix.GetNumPhotons(); 196 197 208 if (geom) 198 testval *= geom->GetPixRatio( pix.GetPixId());209 testval *= geom->GetPixRatio(id); 199 210 200 211 if (testval > maxval) … … 322 333 return NULL; 323 334 } 335 336 /* 337 // -------------------------------------------------------------------------- 338 // 339 // Use this function to sum photons in events together. 340 // 341 Bool_t MCerPhotEvt::AddEvent(const MCerPhotEvt &evt) 342 { 343 if (evt.fNumPixels<=0) 344 { 345 *fLog << "Warning - Event to be added has no pixels." << endl; 346 return kFALSE; 347 } 348 if (fNumPixels<=0) 349 { 350 *fLog << "Warning - Event to add pixels to has no pixels." << endl; 351 return kFALSE; 352 } 353 354 for (UInt_t i=0; i<evt.fNumPixels; i++) 355 { 356 const UInt_t id = evt[i].GetPixId(); 357 358 MCerPhotPix *pix2 = GetPixById(id); 359 if (!pix2) 360 { 361 *fLog << "Error - Pixel#" << dec << id << " does not exist in this event!" << endl; 362 return kFALSE; 363 } 364 365 pix2->AddNumPhotons(evt[i].GetNumPhotons()); 366 } 367 return kTRUE; 368 } 369 */ -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r1574 r1715 30 30 } 31 31 32 //Bool_t AddEvent(const MCerPhotEvt &evt); 32 33 33 34 Bool_t IsPixelExisting(Int_t id) const; -
trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h
r1503 r1715 41 41 void Set(Float_t np, Float_t ep) { fPhot = np; fErrPhot = ep; } 42 42 43 void AddNumPhotons(Float_t f) { fPhot += f; } 44 43 45 void Print(Option_t *opt = NULL) const; 44 46
Note:
See TracChangeset
for help on using the changeset viewer.