// $Id: htimelvl1evtfilter.cc,v 1.4 2009-07-15 11:35:01 halo Exp $ // Last update by Filip Krizek: 24/11/06 // using namespace std; #include "htimelvl1evtfilter.h" #include "hades.h" #include "hcategory.h" #include "hdetector.h" #include "hevent.h" #include "hiterator.h" #include "hlinearcategory.h" #include "hmatrixcategory.h" #include "hspectrometer.h" #include "htofhitsim.h" #include "tofdef.h" #include "TRandom.h" #include #include ClassImp(HTimeLvl1EvtFilter) HTimeLvl1EvtFilter::HTimeLvl1EvtFilter(const Text_t *name,const Text_t *title,TString opt,Int_t m,Float_t timecut, Float_t MultSmearing) : HReconstructor(name,title) { filterOption=opt; nMult=m; fTimeCut=timecut; fMultSmearing=MultSmearing; } HTimeLvl1EvtFilter::HTimeLvl1EvtFilter() { } HTimeLvl1EvtFilter::~HTimeLvl1EvtFilter(void) { } Bool_t HTimeLvl1EvtFilter::init() { if (gHades) { HEvent *event=gHades->getCurrentEvent(); HRuntimeDb *rtdb=gHades->getRuntimeDb(); HSpectrometer *spec=gHades->getSetup(); if (event && rtdb) { if (filterOption.Contains("tofmult")) { HDetector *tof=spec->getDetector("Tof"); if (tof) { // TOF fTofHits=event->getCategory(catTofHit); if (!fTofHits) { Error("init","No TOF input"); return kFALSE; } } fTofIter=(HIterator *)fTofHits->MakeIterator(); } } } resetCounters(); return kTRUE; } Bool_t HTimeLvl1EvtFilter::finalize() { cout<<"Number of rejected evts: "<MakeIterator(); HTofHit *pTof = 0; fTofIter->Reset(); while((pTof = (HTofHit *)fTofIter->Next())) { tof=pTof->getTof(); if(tof < fTimeCut) nTH++; } random_mult=gRandom->Gaus(0,fMultSmearing); // cout<<"TOF Mult: "<= (nMult+random_mult)){ r=kTRUE; } return r; }