using namespace std;
#include "hrichevtfiltersim.h"
#include "hlinearcategory.h"
#include "hevent.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hrichdetector.h"
#include "hcategory.h"
#include "hiterator.h"
#include "hades.h"
#include "richdef.h"
#include "hmdcdef.h"
#include "hmdcseg.h"
#include "hhitmatchsim.h"
#include "hhitmatchheadersim.h"
#include <iostream>
#include <iomanip>
ClassImp(HRichEvtFilterSim)
HRichEvtFilterSim::HRichEvtFilterSim(const Text_t *name,const Text_t *title) :
HReconstructor(name,title)
{
}
HRichEvtFilterSim::HRichEvtFilterSim()
{
}
HRichEvtFilterSim::~HRichEvtFilterSim(void) {
}
Bool_t HRichEvtFilterSim::init() {
if (gHades) {
HEvent *event=gHades->getCurrentEvent();
HRuntimeDb *rtdb=gHades->getRuntimeDb();
HSpectrometer *spec=gHades->getSetup();
if (event && rtdb) {
HDetector *mdc = spec->getDetector("Mdc");
if (mdc) {
fMdcSeg=event->getCategory(catMdcSeg);
if (!fMdcSeg) {
Error("init","No MDC segment category defined");
return kFALSE;
}
else fMdcSegIter=(HIterator *)fMdcSeg->MakeIterator();
}
HDetector *rich = spec->getDetector("Rich");
if (rich) {
pHitRichCat=gHades->getCurrentEvent()->getCategory(catRichHit);
if (!pHitRichCat) Error("HRichEvtFilterSim","init():no Rich Hit cat");
fRichIter = (HIterator*) pHitRichCat->MakeIterator();
pHitMatchCat=event->getCategory(catMatchHit);
if (!pHitMatchCat) {
pHitMatchCat=rich->buildCategory(catMatchHit);
if (!pHitMatchCat) {
Error("init","No HIT MATCH category defined");
return kFALSE;
}
else event->addCategory(catMatchHit, pHitMatchCat, "Rich");
}
pIterMatchHit = (HIterator*)getHitMatchCat()->MakeIterator("native");
pHitMatchHeaderCat=event->getCategory(catMatchHitHeader);
pIterMatchHitHeader = (HIterator*)getHitMatchHeaderCat()
->MakeIterator("native");
}
}
}
resetCounters();
return kTRUE;
}
Bool_t HRichEvtFilterSim::finalize() {
cout<<"Number of rejected evts: "<<nCounterNbRejectedEvts<<endl;
cout<<"Number of remaining evts: "<<nCntProcessedEvents-nCounterNbRejectedEvts<<endl;
cout<<"Percentage of rejected evts: "<<(((Float_t)nCounterNbRejectedEvts)/((Float_t)nCntProcessedEvents))*100<<"%"<<endl;
return kTRUE;
}
Int_t HRichEvtFilterSim::execute()
{
nCntProcessedEvents++;
Int_t kReturnValue=0;
if (isFilteredEvt(1) || isFilteredEvt(2))
{
nCounterNbRejectedEvts++;
kReturnValue = kSkipEvent;
}
else if (isSkipNextTask(0)) kReturnValue = 1;
return kReturnValue;
}
void HRichEvtFilterSim::resetCounters()
{
nCntProcessedEvents=0;
nCounterNbRejectedEvts=0;
}
Bool_t HRichEvtFilterSim::isFilteredEvt(Int_t swt)
{
Bool_t kSwitch=kFALSE;
switch (swt)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
default:
{
Error("isFilteredEvt","no valid filter function");
kSwitch=kFALSE;
}
}
return kSwitch;
}
Bool_t HRichEvtFilterSim::isSkipNextTask(Int_t swt)
{
Bool_t kSwitch=kFALSE;
switch (swt)
{
case 0:
break;
default:
kSwitch=kFALSE;
}
return kSwitch;
}
Last change: Sat May 22 13:08:49 2010
Last generated: 2010-05-22 13:08
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.