Changeset 4368 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 06/30/04 17:55:26 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r4340 r4368 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MExtractor 27 // MExtractor 28 // ========== 28 29 // 29 30 // Base class for the signal extractors, used the functions … … 38 39 // - fSqrtLoGainSamples 39 40 // 41 // The signal extractor classes can be setup from an environmental 42 // setup file. For more information see ReadEnv and MEvtLoop::ReadEnv 43 // 40 44 // Input Containers: 41 45 // MRawEvtData … … 71 75 72 76 const Byte_t MExtractor::fgSaturationLimit = 254; 77 73 78 // -------------------------------------------------------------------------- 74 79 // … … 88 93 fSaturationLimit(fgSaturationLimit) 89 94 { 90 91 95 fName = name ? name : "MExtractor"; 92 96 fTitle = title ? title : "Base class for signal extractors"; … … 99 103 void MExtractor::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast) 100 104 { 101 102 fHiGainFirst = hifirst; 103 fHiGainLast = hilast; 104 105 fLoGainFirst = lofirst; 106 fLoGainLast = lolast; 107 108 } 109 105 fHiGainFirst = hifirst; 106 fHiGainLast = hilast; 107 108 fLoGainFirst = lofirst; 109 fLoGainLast = lolast; 110 } 110 111 111 112 // -------------------------------------------------------------------------- … … 123 124 Int_t MExtractor::PreProcess(MParList *pList) 124 125 { 125 126 126 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData")); 127 127 if (!fRawEvt) … … 178 178 Bool_t MExtractor::ReInit(MParList *pList) 179 179 { 180 181 Int_t lastdesired = (Int_t)(fLoGainLast); 182 Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1; 183 184 if (lastavailable < 0) 185 *fLog << warn << GetDescriptor() 186 << ": WARNING: Number of available Low-Gain Slices is smaller than or equal zero!" << endl; 187 180 Int_t lastdesired = (Int_t)(fLoGainLast); 181 Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1; 182 183 if (lastavailable < 0) 184 *fLog << warn << GetDescriptor() << " - WARNING: Number of available Low-Gain Slices is smaller than or equal zero!" << endl; 185 186 if (lastdesired > lastavailable) 187 { 188 const Int_t diff = lastdesired - lastavailable; 189 190 *fLog << endl; 191 *fLog << warn << GetDescriptor() << ": Selected Lo Gain FADC Window ["; 192 *fLog << Form("%2i,%2i", (int)fLoGainFirst, lastdesired); 193 *fLog << "] ranges out of the available limits: [0," << Form("%2i", lastavailable) << "]" << endl; 194 *fLog << GetDescriptor() << ": Will reduce the upper edge to " << (int)(fLoGainLast - diff) << endl; 195 SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast-diff); 196 } 197 198 lastdesired = (Int_t)fHiGainLast; 199 lastavailable = (Int_t)fRunHeader->GetNumSamplesHiGain()-1; 200 201 if (lastavailable < 0) 202 { 203 *fLog << err << GetDescriptor(); 204 *fLog << " - ERROR: Number of available High-Gain Slices is smaller than or equal zero!" << endl; 205 return kFALSE; 206 } 207 188 208 if (lastdesired > lastavailable) 189 209 { 190 210 const Int_t diff = lastdesired - lastavailable; 191 *fLog << endl; 192 *fLog << warn << GetDescriptor() 193 << Form("%s%2i%s%2i%s%2i%s",": Selected Lo Gain FADC Window [", 194 (int)fLoGainFirst,",",lastdesired, 195 "] ranges out of the available limits: [0,",lastavailable,"].") << endl; 196 *fLog << GetDescriptor() << ": Will reduce the upper edge to " << (int)(fLoGainLast - diff) << endl; 197 SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast-diff); 198 } 199 200 lastdesired = (Int_t)fHiGainLast; 201 lastavailable = (Int_t)fRunHeader->GetNumSamplesHiGain()-1; 202 203 if (lastavailable < 0) 204 { 205 *fLog << err << GetDescriptor() 206 << ": ERROR: Number of available High-Gain Slices is smaller than or equal zero!" << endl; 207 return kFALSE; 208 } 209 210 if (lastdesired > lastavailable) 211 { 212 const Int_t diff = lastdesired - lastavailable; 211 213 212 *fLog << endl; 214 *fLog << warn << GetDescriptor() 215 << Form("%s%2i%s%2i%s%2i%s",": Selected Hi Gain FADC Window [",216 (int)fHiGainFirst,",",lastdesired,217 "] ranges out of the available limits: [0,",lastavailable,"].") << endl;218 *fLog << warn << GetDescriptor()219 << Form("%s%2i%s",": Will use ",diff," samples from the Low-Gain for the High-Gain extraction")220 << endl; 213 *fLog << warn << GetDescriptor() << ": Selected Hi Gain FADC Window ["; 214 *fLog << Form("%2i,%2i%s%2i%s", (int)fHiGainFirst,",",lastdesired); 215 *fLog << "] ranges out of the available limits: [0," << Form("%2i", lastavailable) << "]" << endl; 216 *fLog << warn << GetDescriptor() << ": Will use "; 217 *fLog << Form("%2i", diff) << " samples from the Low-Gain for the High-Gain extraction"; 218 *fLog << endl; 219 221 220 fHiGainLast -= diff; 222 221 fHiLoLast = diff; 223 222 } 224 223 225 224 return kTRUE; 226 }227 228 229 230 void MExtractor::FindSignalHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Byte_t &sat) const231 {232 return;233 }234 235 void MExtractor::FindSignalLoGain(Byte_t *firstused, Float_t &sum, Byte_t &sat) const236 {237 return;238 225 } 239 226 … … 245 232 Int_t MExtractor::Process() 246 233 { 247 248 234 MRawEvtPixelIter pixel(fRawEvt); 249 235 fSignals->Clear(); … … 290 276 void MExtractor::StreamPrimitive(ofstream &out) const 291 277 { 292 293 278 out << " " << ClassName() << " " << GetUniqueName() << "(\""; 294 279 out << "\"" << fName << "\", \"" << fTitle << "\");" << endl; 295 280 296 281 if (fSaturationLimit!=fgSaturationLimit) 297 282 { 298 283 out << " " << GetUniqueName() << ".SetSaturationLimit("; 299 284 out << (int)fSaturationLimit << ");" << endl; 300 285 } 301 286 302 287 out << " " << GetUniqueName() << ".SetRange("; … … 308 293 } 309 294 295 // -------------------------------------------------------------------------- 296 // 297 // Read the setup from a TEnv, eg: 298 // MJPedestal.MExtractor.HiGainFirst: 5 299 // MJPedestal.MExtractor.LoGainFirst: 5 300 // MJPedestal.MExtractor.HiGainLast: 10 301 // MJPedestal.MExtractor.LoGainLast: 10 302 // MJPedestal.MExtractor.SaturationLimit: 88 303 // 304 Bool_t MExtractor::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 305 { 306 Byte_t hf = fHiGainFirst; 307 Byte_t lf = fLoGainFirst; 308 Byte_t hl = fHiGainLast; 309 Byte_t ll = fLoGainLast; 310 311 if (IsEnvDefined(env, prefix, "HiGainFirst", print)) 312 hf = GetEnvValue(env, prefix, "HiGainFirst", hf); 313 if (IsEnvDefined(env, prefix, "LoGainFirst", print)) 314 lf = GetEnvValue(env, prefix, "LoGainFirst", lf); 315 316 if (IsEnvDefined(env, prefix, "HiGainLast", print)) 317 hl = GetEnvValue(env, prefix, "HiGainLast", hl); 318 if (IsEnvDefined(env, prefix, "LoGainLast", print)) 319 ll = GetEnvValue(env, prefix, "LoGainLast", ll); 320 321 SetRange(hf, hl, lf, ll); 322 323 if (IsEnvDefined(env, prefix, "SaturationLimit", print)) 324 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", fSaturationLimit)); 325 326 return kTRUE; 327 } -
trunk/MagicSoft/Mars/msignal/MExtractor.h
r4339 r4368 47 47 Byte_t fSaturationLimit; 48 48 49 virtual void FindSignalHiGain(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const ;50 virtual void FindSignalLoGain(Byte_t *firstused, Float_t &sum, Byte_t &sat) const ;49 virtual void FindSignalHiGain(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const { } 50 virtual void FindSignalLoGain(Byte_t *firstused, Float_t &sum, Byte_t &sat) const { } 51 51 52 virtual Int_t PreProcess(MParList *pList); 53 virtual Bool_t ReInit(MParList *pList); 54 virtual Int_t Process(); 55 virtual void StreamPrimitive(ofstream &out) const; 52 Int_t PreProcess(MParList *pList); 53 Bool_t ReInit(MParList *pList); 54 Int_t Process(); 55 void StreamPrimitive(ofstream &out) const; 56 Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 56 57 57 58 public: 58 59 59 MExtractor(const char *name=NULL, const char *title=NULL); 60 60 61 Byte_t GetHiGainFirst() const 62 Byte_t GetHiGainLast () const 63 Byte_t GetLoGainFirst() const 64 Byte_t GetLoGainLast () const 65 Float_t GetNumHiGainSamples() const 66 Float_t GetNumLoGainSamples() const 61 Byte_t GetHiGainFirst() const { return fHiGainFirst; } 62 Byte_t GetHiGainLast () const { return fHiGainLast ; } 63 Byte_t GetLoGainFirst() const { return fLoGainFirst; } 64 Byte_t GetLoGainLast () const { return fLoGainLast ; } 65 Float_t GetNumHiGainSamples() const { return fNumHiGainSamples; } 66 Float_t GetNumLoGainSamples() const { return fNumLoGainSamples; } 67 67 68 68 virtual void SetRange (Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
Note:
See TracChangeset
for help on using the changeset viewer.