Changeset 6858 for trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc
- Timestamp:
- 03/18/05 18:07:46 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc
r6489 r6858 57 57 // 58 58 // WARNING: Using trigger type kAllPattern resets the BIT(21) bit 59 // of all pixels in M CerPhotEvt59 // of all pixels in MSignalCam 60 60 // 61 61 // 62 62 // Input: 63 // MCerPhotEvt 64 // MArrivalTime 63 // MSignalCam 65 64 // MGeomCam 66 65 // … … 76 75 #include "MGeomCam.h" 77 76 78 #include "M CerPhotEvt.h"79 #include "MArrivalTime.h"77 #include "MSignalCam.h" 78 //#include "MArrivalTime.h" 80 79 81 80 ClassImp(MFSoftwareTrigger); … … 88 87 // 89 88 MFSoftwareTrigger::MFSoftwareTrigger(const char *name, const char *title) 90 : fCam(NULL), fEvt(NULL), fT me(NULL), fThreshold(5),89 : fCam(NULL), fEvt(NULL), fThreshold(5), 91 90 fTimeWindow(0.5), fNumNeighbors(4), fType(kSinglePixelNeighbors) 92 91 { … … 112 111 { 113 112 // Try to get the pixel information of a pixel with this index 114 M CerPhotPix *pix = fEvt->GetPixById(idx);113 MSignalPix *pix = fEvt->GetPixById(idx); 115 114 116 115 // If a pixel with this index is not existing... do nothing. … … 133 132 return 0; 134 133 135 const Float_t tm1 = fTme ? (*fTme)[idx] : 0;136 if ( fTme &&TMath::Abs(tm1-tm0)>fTimeWindow)134 const Float_t tm1 = pix->GetArrivalTime(); 135 if (TMath::Abs(tm1-tm0)>fTimeWindow) 137 136 return 0; 138 137 … … 157 156 { 158 157 // Try to get the pixel information of a pixel with this index 159 M CerPhotPix *pix = fEvt->GetPixById(idx);158 MSignalPix *pix = fEvt->GetPixById(idx); 160 159 161 160 // If a pixel with this index is not existing... do nothing. … … 210 209 ResetBits(kWasChecked); 211 210 211 const UInt_t npixevt = fEvt->GetNumPixels(); 212 for (UInt_t idx=0; idx<npixevt; idx++) 213 { 214 const MSignalPix &pix = (*fEvt)[idx]; 215 if (!pix.IsPixelUsed()) 216 continue; 217 218 // Check if trigger condition is fullfilled for this pixel 219 if (CountPixels(idx, pix.GetArrivalTime()) >= fNumNeighbors) 220 return kTRUE; 221 } 222 223 /* 212 224 // Reset bit 213 M CerPhotPix *pix=0;225 MSignalPix *pix=0; 214 226 215 227 // We could loop over all indices which looks more straight 216 228 // forward but should be a lot slower (assuming zero supression) 217 229 TIter Next(*fEvt); 218 while ((pix=static_cast<M CerPhotPix*>(Next())))230 while ((pix=static_cast<MSignalPix*>(Next()))) 219 231 { 220 232 // Check if trigger condition is fullfilled for this pixel … … 223 235 return kTRUE; 224 236 } 225 237 */ 226 238 return kFALSE; 227 239 } … … 230 242 { 231 243 // Try to get the pixel information of a pixel with this index 232 M CerPhotPix *pix = fEvt->GetPixById(idx);244 MSignalPix *pix = fEvt->GetPixById(idx); 233 245 234 246 // If a pixel with this index is not existing... do nothing. … … 283 295 { 284 296 // Reset bit 285 M CerPhotPix *pix=0;297 MSignalPix *pix=0; 286 298 287 299 // We could loop over all indices which looks more straight 288 300 // forward but should be a lot slower (assuming zero supression) 289 301 TIter Next(*fEvt); 290 while ((pix=static_cast<M CerPhotPix*>(Next())))302 while ((pix=static_cast<MSignalPix*>(Next()))) 291 303 { 292 304 ResetBits(kWasChecked|kIsCoincident); … … 302 314 */ 303 315 304 Bool_t MFSoftwareTrigger::CheckPixel(const MCerPhotPix &pix) const 305 { 316 const MSignalPix *MFSoftwareTrigger::CheckPixel(Int_t i) const 317 { 318 const MSignalPix &pix = (*fEvt)[i]; 319 306 320 if (!pix.IsPixelUsed()) 307 return kFALSE;308 309 if (pix.GetNumPhotons()*fCam->GetPixRatio( pix.GetPixId())<fThreshold)310 return kFALSE;311 312 if ((*fCam)[ pix.GetPixId()].IsInOutermostRing())313 return kFALSE;314 315 return kTRUE;321 return NULL; 322 323 if (pix.GetNumPhotons()*fCam->GetPixRatio(i)<fThreshold) 324 return NULL; 325 326 if ((*fCam)[i].IsInOutermostRing()) 327 return NULL; 328 329 return &pix; 316 330 } 317 331 … … 326 340 for (Int_t i=0; i<entries; i++) 327 341 { 328 const M CerPhotPix &pix0 = (*fEvt)[i];329 if (! CheckPixel(pix0))342 const MSignalPix *pix0 = CheckPixel(i); 343 if (!pix0) 330 344 continue; 331 345 332 346 Int_t num = 1; 333 347 334 const MGeomPix &gpix = (*fCam)[ pix0.GetPixId()];348 const MGeomPix &gpix = (*fCam)[i]; 335 349 336 350 const Int_t nneighbors = gpix.GetNumNeighbors(); … … 338 352 { 339 353 const Int_t idx1 = gpix.GetNeighbor(n); 340 if (!CheckPixel(*fEvt->GetPixById(idx1))) 354 355 const MSignalPix *pix1 = CheckPixel(idx1); 356 if (!pix1) 341 357 continue; 342 358 343 if (fTme) 344 { 345 const Float_t t0 = (*fTme)[pix0.GetPixId()]; 346 const Float_t t1 = (*fTme)[idx1]; 347 348 if (TMath::Abs(t0-t1)>fTimeWindow) 349 continue; 350 } 359 const Float_t t0 = pix0->GetArrivalTime(); 360 const Float_t t1 = pix1->GetArrivalTime(); 361 362 if (TMath::Abs(t0-t1)>fTimeWindow) 363 continue; 351 364 352 365 if (++num==fNumNeighbors) … … 359 372 // -------------------------------------------------------------------------- 360 373 // 361 // Request pointer to M CerPhotEvtand MGeomCam from paremeter list374 // Request pointer to MSignalCam and MGeomCam from paremeter list 362 375 // 363 376 Int_t MFSoftwareTrigger::PreProcess(MParList *pList) 364 377 { 365 fEvt = (M CerPhotEvt*)pList->FindObject("MCerPhotEvt");378 fEvt = (MSignalCam*)pList->FindObject("MSignalCam"); 366 379 if (!fEvt) 367 380 { 368 *fLog << err << "M CerPhotEvtnot found... aborting." << endl;381 *fLog << err << "MSignalCam not found... aborting." << endl; 369 382 return kFALSE; 370 383 } … … 375 388 *fLog << err << "MGeomCam not found... aborting." << endl; 376 389 return kFALSE; 377 }378 379 fTme = 0;380 if (fTimeWindow>0)381 {382 fTme = (MArrivalTime*)pList->FindObject("MArrivalTime");383 if (!fTme)384 {385 *fLog << err << "MArrivalTime not found... aborting." << endl;386 return kFALSE;387 }388 390 } 389 391
Note:
See TracChangeset
for help on using the changeset viewer.