Changeset 8364 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 03/04/07 14:01:14 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r8358 r8364 17 17 ! 18 18 ! Author(s): Markus Gaug, 04/2004 <mailto:markus@ifae.es> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 19 ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de> 20 ! 21 ! Copyright: MAGIC Software Development, 2000-2007 21 22 ! 22 23 ! … … 74 75 // - Byte_t fHiLoLast; // Number of slices in fLoGainSamples counted for the High-Gain signal 75 76 // 77 // Class Version 8: 78 // ---------------- 79 // - Byte_t fSaturationLimit; 80 // + Uint_t fSaturationLimit; 81 // 76 82 // 77 83 // Input Containers: … … 108 114 using namespace std; 109 115 110 const Byte_t MExtractor::fgSaturationLimit = 245;116 const UInt_t MExtractor::fgSaturationLimit = 245; 111 117 const TString MExtractor::fgNamePedestalCam = "MPedestalCam"; 112 118 const TString MExtractor::fgNameSignalCam = "MExtractedSignalCam"; … … 255 261 if (numl==0) 256 262 { 257 *fLog << inf << "No lo-gains... resetting lo-gain range and saturation limit." << endl;263 *fLog << inf << "No lo-gains... resetting lo-gain range"; 258 264 fLoGainFirst=0; 259 265 fLoGainLast =0; 260 fSaturationLimit=0xff; 266 if (fSaturationLimit>0xff) 267 { 268 *fLog << " and saturation limit"; 269 fSaturationLimit=0xff; 270 } 271 *fLog << "." << endl; 261 272 } 262 273 … … 443 454 if (IsEnvDefined(env, prefix, "SaturationLimit", print)) 444 455 { 445 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", fSaturationLimit));456 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", (Int_t)fSaturationLimit)); 446 457 rc = kTRUE; 447 458 } -
trunk/MagicSoft/Mars/msignal/MExtractor.h
r8358 r8364 32 32 33 33 protected: 34 static const Byte_t fgSaturationLimit; //! Default for fSaturationLimit (now set to: 254)34 static const UInt_t fgSaturationLimit; //! Default for fSaturationLimit (now set to: 254) 35 35 static const TString fgNamePedestalCam; //! "MPedestalCam" 36 36 static const TString fgNameSignalCam; //! "MExtractedSignalCam" … … 59 59 Float_t fSqrtLoGainSamples; // Sqrt. nr. Low Gain FADC slices used to extract the signal 60 60 61 Byte_t fSaturationLimit; // Highest FADC slice value until being declared saturated61 UInt_t fSaturationLimit; // Highest FADC slice value until being declared saturated 62 62 63 63 TString fNamePedestalCam; // Name of the 'MPedestalCam' container … … 94 94 Float_t GetResolutionPerPheHiGain() const { return fResolutionPerPheHiGain; } 95 95 Float_t GetResolutionPerPheLoGain() const { return fResolutionPerPheLoGain; } 96 Byte_t GetSaturationLimit() const { return fSaturationLimit; }96 UInt_t GetSaturationLimit() const { return fSaturationLimit; } 97 97 98 98 Bool_t HasLoGain() const { return fLoGainFirst>0 || fLoGainLast>0; } … … 106 106 107 107 void SetOffsetLoGain ( const Float_t f=fgOffsetLoGain ) { fOffsetLoGain = f; } 108 void SetSaturationLimit ( const Byte_t lim=fgSaturationLimit ) { fSaturationLimit = lim; }108 void SetSaturationLimit ( const UInt_t lim=fgSaturationLimit ) { fSaturationLimit = lim; } 109 109 void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; } 110 110 void SetNameSignalCam ( const char *name=fgNameSignalCam.Data() ) { fNameSignalCam = name; } … … 122 122 void Print(Option_t *o="") const; //*MENU* 123 123 124 ClassDef(MExtractor, 7) // Signal Extractor Base Class124 ClassDef(MExtractor, 8) // Signal Extractor Base Class 125 125 }; 126 126 -
trunk/MagicSoft/Mars/msignal/MSignalCalc.cc
r8357 r8364 46 46 47 47 #include "MRawRunHeader.h" 48 #include "MRawEvtData.h" // MRawEvtData::GetNumPixels49 48 #include "MSignalCam.h" 50 49 #include "MPedestalPix.h" 51 50 #include "MPedestalCam.h" 52 51 #include "MRawEvtPixelIter.h" 52 #include "MPedestalSubtractedEvt.h" 53 53 54 54 ClassImp(MSignalCalc); … … 66 66 fName = name ? name : "MSignalCalc"; 67 67 fTitle = title ? title : "Task to calculate Cerenkov photons from raw data"; 68 69 AddToBranchList("MRawEvtData.fHiGainPixId");70 AddToBranchList("MRawEvtData.fLoGainPixId");71 AddToBranchList("MRawEvtData.fHiGainFadcSamples");72 AddToBranchList("MRawEvtData.fLoGainFadcSamples");73 68 } 74 69 … … 95 90 } 96 91 97 fRawEvt = (M RawEvtData*)pList->FindObject("MRawEvtData");92 fRawEvt = (MPedestalSubtractedEvt*)pList->FindObject("MPedestalSubtractedEvt"); 98 93 if (!fRawEvt) 99 94 { 100 *fLog << dbginf << "M RawEvtDatanot found... aborting." << endl;95 *fLog << dbginf << "MPedestalSubtractedEvt not found... aborting." << endl; 101 96 return kFALSE; 102 97 } … … 130 125 // pixel in the MSignalCam container. 131 126 // 127 #include <TSystem.h> 132 128 Int_t MSignalCalc::Process() 133 129 { 134 MRawEvtPixelIter pixel(fRawEvt); 135 136 while (pixel.Next()) 130 const Int_t npix = fRawEvt->GetNumPixels(); 131 const Int_t nhi = fRunHeader->GetNumSamplesHiGain(); 132 const Int_t nlo = fRunHeader->GetNumSamplesLoGain(); 133 134 for (int i=0; i<npix; i++) 137 135 { 138 Byte_t *ptr = pixel.GetHiGainSamples(); 139 Byte_t *max = ptr+pixel.GetIdxMaxHiGainSample(); 140 Byte_t *end = ptr+fRunHeader->GetNumSamplesHiGain(); 136 Byte_t *raw = fRawEvt->GetSamplesRaw(i); 137 138 Byte_t *ptr = raw; 139 Byte_t *max = ptr+fRawEvt->GetMax(i, 0, nhi); 140 Byte_t *end = ptr+nhi; 141 141 Byte_t *first = max-fBefore; 142 142 Byte_t *last = max+fAfter; … … 144 144 ULong_t sumb = 0; // sum background 145 145 ULong_t sqb = 0; // sum sqares background 146 ULong_t sumsb = 0; // sum signal+background146 //ULong_t sumsb = 0; // sum signal+background 147 147 ULong_t sqsb = 0; // sum sqares signal+background 148 148 … … 168 168 else 169 169 { 170 sumsb += *ptr;170 //sumsb += *ptr; 171 171 sqsb += *ptr* *ptr; 172 172 nsb++; … … 175 175 } 176 176 177 if ( sat==0 && ishi)177 if (nlo>0 && sat==0 && ishi) 178 178 { 179 179 // Area: x9 180 ptr = pixel.GetLoGainSamples();181 end = ptr+ fRunHeader->GetNumSamplesLoGain();180 ptr = raw+nhi; 181 end = ptr+nlo; 182 182 183 183 sumb = 0; // sum background … … 187 187 while (ptr<end) 188 188 { 189 // Background already ca lced from hi-gains!189 // Background already caced from hi-gains! 190 190 sumb += *ptr; 191 191 sqb += *ptr* *ptr; … … 195 195 } 196 196 197 if ( sat>1 && !ishi)197 if (nlo>0 && sat>1 && !ishi) 198 198 { 199 199 // Area: x9 200 ptr = pixel.GetLoGainSamples();201 max = ptr+ pixel.GetIdxMaxLoGainSample();200 ptr = raw+nhi; 201 max = ptr+fRawEvt->GetMax(i, nhi, nhi+nlo); 202 202 203 203 if (*max>250) … … 207 207 } 208 208 209 end = ptr+ fRunHeader->GetNumSamplesLoGain();209 end = ptr+nlo; 210 210 first = max-fBefore; 211 211 last = max+fAfter; 212 212 213 sumsb = 0; // sum signal+background214 sqsb = 0; // sum sqares signal+background215 //sumb = 0; // sum background213 //sumsb = 0; // sum signal+background 214 //sqsb = 0; // sum sqares signal+background 215 sumb = 0; // sum background 216 216 //sqb = 0; // sum sqares background 217 217 … … 230 230 else 231 231 { 232 sumsb += *ptr;232 //sumsb += *ptr; 233 233 sqsb += *ptr* *ptr; 234 234 nsb++; … … 238 238 } 239 239 240 Float_t b = (float)sumb/nb; // background241 Float_t sb = (float)sumsb/nsb; // signal+background242 243 Float_t msb = (float)sqb/nb; // mean square background240 Float_t b = nb==0 ? 0 : (float)sumb/nb; // background 241 //Float_t sb = (float)sumsb/nsb; // signal+background 242 243 Float_t msb = nb==0 ? 0 : (float)sqb/nb; // mean square background 244 244 //Float_t mssb = (float)sqsb/nsb; // mean square signal+background 245 245 … … 247 247 //Float_t sigsb = sqrt(mssb-sb*sb); // sigma signal+background 248 248 249 Float_t s = sb-b; // signal249 //Float_t s = sb-b; // signal 250 250 //Float_t sqs = sqsb-nsb*b; // sum squares signal 251 251 … … 253 253 //Float_t sigs = sqrt(mss-s*s); // sigma signal 254 254 255 if (sat>1) 256 s *= 11.3; 257 258 Int_t idx = pixel.GetPixelId(); 255 //if (sat>1) 256 // s *= 11.3; 257 259 258 //fCerPhotEvt->AddPixel(idx, s, sigs); 260 259 … … 262 261 // MMcPedestalCopy and MMcPedestalNSBAdd 263 262 if (fPedestals) 264 (*fPedestals)[i dx].Set(b, sigb);263 (*fPedestals)[i].Set(b, sigb); 265 264 } 266 265 -
trunk/MagicSoft/Mars/msignal/MSignalCalc.h
r8357 r8364 6 6 #endif 7 7 8 class MRawEvtData;9 8 class MPedestalCam; 10 9 class MSignalCam; 11 10 class MRawRunHeader; 11 class MPedestalSubtractedEvt; 12 12 13 13 class MSignalCalc : public MTask 14 14 { 15 15 private: 16 M PedestalCam *fPedestals; // Pedestals of all pixels in the camera17 M RawEvtData*fRawEvt; // raw event data (time slices)18 MSignalCam *fCerPhotEvt; // Cerenkov Photon Event used for calculation19 M RawRunHeader *fRunHeader; // RunHeader information16 MRawRunHeader *fRunHeader; // RunHeader information 17 MPedestalSubtractedEvt *fRawEvt; // raw event data (time slices) 18 MSignalCam *fCerPhotEvt; // Cerenkov Photon Event used for calculation 19 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 20 20 21 21 Byte_t fBefore;
Note:
See TracChangeset
for help on using the changeset viewer.