Changeset 7043 for trunk/MagicSoft/Mars/mfilter
- Timestamp:
- 05/17/05 12:08:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mfilter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfilter/MFCosmics.cc
r5803 r7043 17 17 ! 18 18 ! Author(s): Markus Gaug 02/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-2005 21 22 ! 22 23 ! … … 33 34 // the outer pixels have some defect). 34 35 // 36 // In the PostProcess we... 37 // a) check the ratio of events which were accepted against 38 // fMinAcceptedFraction. 39 // b) check the ratio of events which were rejected against 40 // fMaxExcludedFraction. 41 // 35 42 // Input Containers: 36 43 // MRawEvtData 37 44 // MPedestalCam 45 // MBadPixelsCam 38 46 // MExtractedSignalCam 39 47 // … … 55 63 #include "MPedestalPix.h" 56 64 65 #include "MBadPixelsCam.h" 66 #include "MBadPixelsPix.h" 67 57 68 #include "MExtractedSignalCam.h" 58 69 #include "MExtractedSignalPix.h" … … 69 80 // 70 81 MFCosmics::MFCosmics(const char *name, const char *title) 71 : fPedestals(NULL), fSignals(NULL), fRawEvt(NULL), 72 fNamePedestalCam(fgNamePedestalCam), fMaxEmptyPixels(0.2) 82 : fPedestals(NULL), fSignals(NULL), fBadPixels(NULL), fRawEvt(NULL), 83 fNamePedestalCam(fgNamePedestalCam), fMaxEmptyPixels(0.2), 84 fMinAcceptedFraction(0), fMaxExcludedFraction(1) 73 85 { 74 86 fName = name ? name : "MFCosmics"; … … 99 111 } 100 112 113 fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam"); 114 if (!fBadPixels) 115 { 116 *fLog << err << "MBadPixelsCam not found... aborting." << endl; 117 return kFALSE; 118 } 119 101 120 fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 102 121 if (!fSignals) … … 133 152 { 134 153 fResult = CosmicsRejection(); 135 136 154 fCut[fResult ? 0 : 1]++; 155 137 156 return kTRUE; 138 157 } … … 163 182 const UInt_t idx = pixel.GetPixelId(); 164 183 165 MExtractedSignalPix &sig = (*fSignals)[idx]; 166 MPedestalPix &ped = (*fPedestals)[idx]; 184 if ((*fBadPixels)[idx].IsUnsuitable()) 185 continue; 186 187 const MExtractedSignalPix &sig = (*fSignals)[idx]; 188 const MPedestalPix &ped = (*fPedestals)[idx]; 167 189 168 190 const Float_t pedrms = ped.GetPedestalRms()*fSqrtHiGainSamples; … … 186 208 } 187 209 210 // --------------------------------------------------------- 211 // 212 // In the PostProcess we... 213 // a) check the ratio of events which were accepted against 214 // fMinAcceptedFraction. 215 // b) check the ratio of events which were rejected against 216 // fMaxExcludedFraction. 217 // 218 // return failure (kFALSE) if condition is not fullfilled. 219 // 188 220 Int_t MFCosmics::PostProcess() 189 221 { 190 if (GetNumExecutions()==0) 222 const UInt_t n = GetNumExecutions(); 223 if (n==0) 191 224 return kTRUE; 192 225 … … 196 229 197 230 *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ; 198 *fLog << (int)(fCut[0]*100/ GetNumExecutions());231 *fLog << (int)(fCut[0]*100/n); 199 232 *fLog << "%) Detected cosmics " ; 200 233 *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels*100 << "%)" << endl; 201 234 202 235 *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ; 203 *fLog << (int)(fCut[1]*100/ GetNumExecutions());236 *fLog << (int)(fCut[1]*100/n); 204 237 *fLog << "%) No cosmics!" << endl; 205 238 *fLog << endl; 206 239 207 return kTRUE; 208 } 209 240 const Float_t min = fMinAcceptedFraction*n; 241 const Float_t max = fMaxExcludedFraction*n; 242 if (fCut[0]<min) 243 { 244 *fLog << err << "ERROR - Fraction of accepted events " << min*100; 245 *fLog << "% underrun " << fMinAcceptedFraction*100 << "%... abort." << endl; 246 return kFALSE; 247 } 248 if (fCut[1]>max) 249 { 250 *fLog << err << "ERROR - Fraction of excluded events " << max*100; 251 *fLog << "% exceeded " << fMaxExcludedFraction*100 << "%... abort." << endl; 252 return kFALSE; 253 } 254 255 return kTRUE; 256 } 257 258 // -------------------------------------------------------------------------- 259 // 260 // Read the setup from a TEnv, eg: 261 // MFCosmics.MaxEmptyPixels: 0.2 262 // MFCosmics.MaxExcludedFraction: 1 263 // MFCosmics.MinAcceptedFraction: 0 264 // 265 Int_t MFCosmics::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 266 { 267 Bool_t rc = kFALSE; 268 if (IsEnvDefined(env, prefix, "MaxEmptyPixels", print)) 269 { 270 rc = kTRUE; 271 SetMaxEmptyPixels(GetEnvValue(env, prefix, "MaxEmptyPixels", fMaxEmptyPixels)); 272 } 273 if (IsEnvDefined(env, prefix, "MaxExcludedFraction", print)) 274 { 275 rc = kTRUE; 276 SetMaxExcludedFraction(GetEnvValue(env, prefix, "MaxExcludedFraction", fMaxExcludedFraction)); 277 } 278 if (IsEnvDefined(env, prefix, "MinAcceptedFraction", print)) 279 { 280 rc = kTRUE; 281 fMinAcceptedFraction = GetEnvValue(env, prefix, "MinAcceptedFraction", fMinAcceptedFraction); 282 } 283 return rc; 284 } -
trunk/MagicSoft/Mars/mfilter/MFCosmics.h
r5803 r7043 9 9 10 10 class MPedestalCam; 11 class MBadPixelsCam; 11 12 class MExtractedSignalCam; 12 13 … … 18 19 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 19 20 MExtractedSignalCam *fSignals; // Calibration events of all pixels in the camera 21 MBadPixelsCam *fBadPixels; // Bad pixel used for exclusions 20 22 21 23 MRawEvtData *fRawEvt; // raw event data (time slices) … … 29 31 Float_t fSqrtHiGainSamples; // Square root of the number of used Hi-Gain Samples 30 32 33 Float_t fMinAcceptedFraction; // return error if exceeded 34 Float_t fMaxExcludedFraction; // return error if exceeded 35 36 // MFCosmics 37 Bool_t CosmicsRejection() const; 38 39 // MTask 31 40 Bool_t ReInit(MParList *pList); 32 41 Int_t PreProcess(MParList *pList); 33 42 Int_t Process(); 34 43 Int_t PostProcess(); 44 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 35 45 36 Bool_t CosmicsRejection() const; 37 46 // MFilter 38 47 Bool_t IsExpressionTrue() const { return fResult; } 39 48 … … 44 53 Float_t GetMaxEmptyPixels() const { return fMaxEmptyPixels; } 45 54 46 void SetNamePedestalCam(const char *name) { fNamePedestalCam = name; } 55 void SetMaxExcludedFraction(const Float_t n) { fMaxExcludedFraction = n; } 56 void SetMinAcceptedFraction(const Float_t n) { fMinAcceptedFraction = n; } 57 58 void SetNamePedestalCam(const char *name) { fNamePedestalCam = name; } 47 59 48 60 ClassDef(MFCosmics, 0) // Filter to perform a cosmics rejection -
trunk/MagicSoft/Mars/mfilter/Makefile
r6897 r7043 11 11 #------------------------------------------------------------------------------ 12 12 13 INCLUDES = -I. -I../mbase -I../mfbase -I../mraw -I../mmc -I../mdata \ 14 -I../manalysis -I../mfileio -I../mgeom -I../mimage \ 15 -I../mhbase -I../mmain -I../mgui -I../msignal -I../mpointing \ 16 -I../mpedestal 13 INCLUDES = -I. -I../mbase -I../mfbase -I../mraw -I../mdata \ 14 -I../mfileio -I../mgeom -I../mimage -I../mgui \ 15 -I../mhbase -I../msignal -I../mpedestal -I../mbadpixels 17 16 18 17 CINT = Filter
Note:
See TracChangeset
for help on using the changeset viewer.