Changeset 3112 for trunk/MagicSoft/Mars/mfilter/MFCosmics.cc
- Timestamp:
- 02/12/04 11:34:32 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfilter/MFCosmics.cc
r3105 r3112 48 48 // 49 49 // Output Containers: 50 // -/- 50 51 // 51 52 ////////////////////////////////////////////////////////////////////////////// … … 77 78 fRawEvt(NULL), fMaxEmptyPixels(230) 78 79 { 79 80 80 fName = name ? name : "MFCosmics"; 81 81 fTitle = title ? title : "Filter to reject cosmics"; … … 91 91 Int_t MFCosmics::PreProcess(MParList *pList) 92 92 { 93 94 93 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData"); 95 94 if (!fRawEvt) 96 95 { 97 *fLog << err << dbginf <<"MRawEvtData not found... aborting." << endl;96 *fLog << err << "MRawEvtData not found... aborting." << endl; 98 97 return kFALSE; 99 98 } … … 101 100 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam"); 102 101 if (!fPedestals) 103 104 *fLog << err << dbginf << "Cannot find MPedestalCam ... aborting" << endl;102 { 103 *fLog << err << "MPedestalCam not found... aborting." << endl; 105 104 return kFALSE; 106 105 } 107 106 108 107 fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 109 108 if (!fSignals) 110 111 *fLog << err << dbginf << "Cannot find MExtractedSignalCam ... aborting" << endl;109 { 110 *fLog << err << "MExtractedSignalCam not found... aborting." << endl; 112 111 return kFALSE; 113 112 } 114 113 115 114 memset(fCut, 0, sizeof(fCut)); … … 124 123 // - MExtractedSignalCam 125 124 // 126 Bool_t MFCosmics::ReInit(MParList *pList ) 127 { 128 125 Bool_t MFCosmics::ReInit(MParList *pList) 126 { 129 127 fSqrtHiGainSamples = TMath::Sqrt((Float_t) fSignals->GetNumUsedHiGainFADCSlices()); 130 128 … … 140 138 Int_t MFCosmics::Process() 141 139 { 142 143 fResult = CosmicsRejection(); 144 145 fCut[fResult ? 0 : 1]++; 146 return kTRUE; 140 fResult = CosmicsRejection(); 141 142 fCut[fResult ? 0 : 1]++; 143 return kTRUE; 147 144 } 148 145 … … 158 155 // the outer pixels have some defect). 159 156 // 160 Bool_t MFCosmics::CosmicsRejection() 161 { 162 163 MRawEvtPixelIter pixel(fRawEvt); 164 165 Int_t cosmicpix = 0; 166 167 // 168 // Create a first loop to sort out the cosmics ... 169 // 170 while (pixel.Next()) 171 { 172 173 const UInt_t idx = pixel.GetPixelId(); 174 175 MExtractedSignalPix &sig = (*fSignals)[idx]; 176 MPedestalPix &ped = (*fPedestals)[idx]; 177 const Float_t pedrms = ped.GetPedestalRms()*fSqrtHiGainSamples; 178 const Float_t sumhi = sig.GetExtractedSignalHiGain(); 179 180 // 181 // We consider a pixel as presumably due to cosmics 182 // if its sum of FADC slices is lower than 3 pedestal RMS 183 // 184 if (sumhi < 3.*pedrms ) 185 cosmicpix++; 186 } 187 188 189 // 190 // If the camera contains more than fMaxEmptyPixels 191 // presumed pixels due to cosmics, then the event is discarted. 192 // 193 if (cosmicpix > fMaxEmptyPixels) 194 return kTRUE; 195 196 return kFALSE; 157 Bool_t MFCosmics::CosmicsRejection() const 158 { 159 MRawEvtPixelIter pixel(fRawEvt); 160 161 Int_t cosmicpix = 0; 162 163 // 164 // Create a first loop to sort out the cosmics ... 165 // 166 while (pixel.Next()) 167 { 168 const UInt_t idx = pixel.GetPixelId(); 169 170 MExtractedSignalPix &sig = (*fSignals)[idx]; 171 MPedestalPix &ped = (*fPedestals)[idx]; 172 173 const Float_t pedrms = ped.GetPedestalRms()*fSqrtHiGainSamples; 174 const Float_t sumhi = sig.GetExtractedSignalHiGain(); 175 176 // 177 // We consider a pixel as presumably due to cosmics 178 // if its sum of FADC slices is lower than 3 pedestal RMS 179 // 180 if (sumhi < 3.*pedrms ) 181 cosmicpix++; 182 } 183 184 // 185 // If the camera contains more than fMaxEmptyPixels 186 // presumed pixels due to cosmics, then the event is discarted. 187 // 188 return cosmicpix > fMaxEmptyPixels; 197 189 } 198 190 199 191 Int_t MFCosmics::PostProcess() 200 192 { 201 202 if (GetNumExecutions()==0) 203 return kTRUE; 204 205 *fLog << inf << endl; 206 *fLog << GetDescriptor() << " execution statistics:" << endl; 207 *fLog << dec << setfill(' '); 208 209 *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ; 210 *fLog << (int)(fCut[1]*100/GetNumExecutions()) ; 211 *fLog << "%) Evts skipped due to: Cosmics Rejection applied " ; 212 *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels << ")" << endl; 213 214 *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ; 215 *fLog << (int)(fCut[0]*100/GetNumExecutions()) ; 216 *fLog << "%) Evts survived the cosmics rejection!" << endl; 217 *fLog << endl; 218 219 return kTRUE; 220 } 221 193 if (GetNumExecutions()==0) 194 return kTRUE; 195 196 *fLog << inf << endl; 197 *fLog << GetDescriptor() << " execution statistics:" << endl; 198 *fLog << dec << setfill(' '); 199 200 *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ; 201 *fLog << (int)(fCut[1]*100/GetNumExecutions()) ; 202 *fLog << "%) Evts skipped due to: Cosmics Rejection applied " ; 203 *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels << ")" << endl; 204 205 *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ; 206 *fLog << (int)(fCut[0]*100/GetNumExecutions()) ; 207 *fLog << "%) Evts survived the cosmics rejection!" << endl; 208 *fLog << endl; 209 210 return kTRUE; 211 } 212
Note:
See TracChangeset
for help on using the changeset viewer.