ROOT logo
#ifndef __HPARTICLEEVTINFOFILLER_H__
#define __HPARTICLEEVTINFOFILLER_H__

#include "hreconstructor.h"
#include "hparticlerunningmean.h"

#include <cmath>

class TIterator;
class HCategory;
class HLocation;

class HMdcLookupGeom;
class HMdcCalParRaw;
class HParticleCand;
//-----------------------------------------------------------------------------
class HParticleEvtInfoFiller : public HReconstructor
{
private:
    HLocation zeroLoc;

    // iterators to the input categories
    TIterator *pWallHitIter;
    TIterator *pRichHitIter;
    TIterator *pRichClusIter;
    TIterator *pMdcClusIter;
    TIterator *pMdcSegIter;
    TIterator *pTofHitIter;
    TIterator *pRpcClusterIter;
    TIterator *pRpcHitIter;
    TIterator *pEmcClusIter;
    TIterator *pShowerHitIter;
    TIterator *pParticleCandIter;

    // output category
    HCategory *pParticleEvtInfoCat;
    HCategory *pWallEventPlaneCat;

    TString beamtime;
    HMdcLookupGeom*  lookupMdcGeom;
    HMdcCalParRaw*  calparMdc;

    // cuts used during filling
    Float_t ftimeTofCut;           // default 35
    Float_t ftimeRpcCut;           // default 25
    Float_t fprimary_mindist;      // default 10
    Float_t fvertexzCut ;          // default -65 (apr12) -200 /jul14+aug14
    Float_t fMetaPILEUPCut ;       // default 60 ns
    Int_t   fMetaNPILEUPCut ;      // number of meta hits <0 || > fMetaPILEUPCut
    Float_t fMdcPILEUPCut[4] ;     // default t1 > 200 (inner) > 400 (outer)
    Float_t fMdcPILEUPNCut ;       // number of wires in cut region  (7 pion beam 35 apr12)
    Float_t fMeanMult;             // mean mult of all candidates
    Float_t fMeanMIPSMult;         // mean mult of all mips candidates (beta>fMeanMIPSbetaCut)
    Float_t fMeanLEPMult;          // mean mult of all lep candidates (beta:mom inside wedge cut + richqa <2)
    Float_t fSigmaMult;            // sigma mult of all candidates
    Float_t fSigmaMIPSMult;        // sigma mult of all mips candidates (beta>fMeanMIPSbetaCut)
    Float_t fSigmaLEPMult;         // sigma mult of all lep candidates (beta:mom inside wedge cut + richqa <2)
    Int_t   fminEvts;              // min number of events
    Int_t   fmaxEvts;              // min number of events
    Int_t   fminLEPEvts;           // min number of events
    Int_t   fmaxLEPEvts;           // min number of events
    Float_t fMeanMIPSBetaCut;      // MIPS selection
    Float_t fMeanLEPBetaCut;       // lep selection
    Float_t fMeanLEPMomCut;        // lep selection
    Float_t fMeanLEPRichQACut;     // lep selection
    Int_t   ftriggerBit;           // trigger for physics
    Int_t   fMinStartCorrFlag;     // corr flag from hparticlestart2hitf
    Float_t fSecToAll;             // av sect per evt
    Int_t   fMinMult;              // minimum allow mult per evt
    Int_t   fMaxFacToMean;         // cutoff for big values larger mean*fMaxFacToMean
    Int_t   fFlashEventCut;        // cut for number of "flash" wires in one segement at least
    Int_t   fDeltaElEventCut;      // cut for number of "deltaElectron" wires in one segment at least


    //------------------------------------------------------------------
    // event pileup rejection
    // no veto ----------------------------
    Float_t fvetoMin ;
    Float_t fvetoMax ;
    // startMetacorrelation ---------------
    Float_t fminStartMeta ;    // [ns] min start time to look for correlation
    Float_t fmaxStartMeta ;   // [ns] min start time to look for correlation
    Int_t     fthreshMeta ;     // min number of meta hist needed
    Float_t   fwindowMeta ;     // [ns] integration window
    Float_t   foffsetMeta ;     // [ns] sfift fastest particle to zero
    // startVetoCorrelation ---------------
    Float_t fminStartVeto ;    // [ns] min start time to look for correlation
    Float_t fmaxStartVeto ;   // [ns] min start time to look for correlation
    Float_t   fwindowVeto ;    // [ns] +- matching window
    //------------------------------------------------------------------

    //------------------------------------------------------------------
    // running mean mult
    HParticleRunningMeanI meanALL;
    HParticleRunningMeanI meanMIPS;
    HParticleRunningMeanI meanLEP;
    HParticleRunningMeanI meanALLSec [6];
    HParticleRunningMeanI meanMIPSSec[6];
    HParticleRunningMeanI meanLEPSec [6];
    //------------------------------------------------------------------



    Bool_t isLepton(HParticleCand* cand);
    void clearMembers(void);

public:
    HParticleEvtInfoFiller(const Text_t* name="EvtInfoFiller",const Text_t* title="EvtInfoFiller",TString beamtime="apr12");
    ~HParticleEvtInfoFiller();

    void setTofCut       (Float_t rpccutoff,Float_t tofcutoff) { ftimeTofCut = tofcutoff; ftimeRpcCut = rpccutoff;}
    void setVertexCut    (Float_t z,Float_t mindist)           { fvertexzCut = z ; fprimary_mindist =mindist;}
    void setMetaPileUpCut(Float_t tof,Int_t n)                 { fMetaPILEUPCut = tof ;fMetaNPILEUPCut = n;}
    void setMdcPileupCut (Float_t t0,Float_t t1,Float_t t2,Float_t t3,Int_t n){fMdcPILEUPCut[0]=t0;fMdcPILEUPCut[1]=t1;fMdcPILEUPCut[2]=t2;fMdcPILEUPCut[3]=t3;fMdcPILEUPNCut=n; }
    void setMeanMult     (Float_t mean,Float_t meanmips,Float_t sigmean,Float_t sigmeanmips,Float_t betacut,Int_t minEvt,Int_t maxEvt) { fMeanMult = mean; fMeanMIPSMult = meanmips; fSigmaMult = sigmean; fSigmaMIPSMult = sigmeanmips; fMeanMIPSBetaCut = betacut; fminEvts=minEvt; fmaxEvts=maxEvt; }
    void setMeanLepMult  (Float_t mean,Float_t sigma,Float_t betacut,Float_t momcut,Float_t richcut, Int_t minEvt,Int_t maxEvt) { fMeanLEPMult = mean;fSigmaLEPMult=sigma; fMeanLEPBetaCut = betacut; fMeanLEPMomCut = momcut; fMeanLEPRichQACut =richcut; fminLEPEvts=minEvt; fmaxLEPEvts=maxEvt; }
    void setNoVETOCut    (Float_t min=-15,Float_t max=15) { fvetoMin = min; fvetoMax = max; }
    void setSTARTVETOCUT (Float_t mintstart=15,Float_t maxstart=350,Float_t window=1.) { fminStartVeto = mintstart ; fmaxStartVeto = maxstart; fwindowVeto = window; }
    void setSTARTMETACUT (Float_t mintstart=80,Float_t maxstart=350,Float_t window=5., Float_t offset = 7.) { fminStartMeta = mintstart ; fmaxStartMeta = maxstart; fwindowMeta = window; foffsetMeta = offset; }
    void setFlashEventCut(Int_t cut) { fFlashEventCut   = cut; }
    void setDeltaElectCut(Int_t cut) { fDeltaElEventCut = cut; }
    
    // all Hydra reconstuructor classes must have this
    virtual Bool_t init    (void);
    virtual Bool_t finalize(void);
    virtual Int_t  execute (void);
    virtual Bool_t reinit  (void) { return kTRUE; }


    ClassDef(HParticleEvtInfoFiller, 0)
};

#endif // __HPARTICLEEVTINFOFILLER_H__

 hparticleevtinfofiller.h:1
 hparticleevtinfofiller.h:2
 hparticleevtinfofiller.h:3
 hparticleevtinfofiller.h:4
 hparticleevtinfofiller.h:5
 hparticleevtinfofiller.h:6
 hparticleevtinfofiller.h:7
 hparticleevtinfofiller.h:8
 hparticleevtinfofiller.h:9
 hparticleevtinfofiller.h:10
 hparticleevtinfofiller.h:11
 hparticleevtinfofiller.h:12
 hparticleevtinfofiller.h:13
 hparticleevtinfofiller.h:14
 hparticleevtinfofiller.h:15
 hparticleevtinfofiller.h:16
 hparticleevtinfofiller.h:17
 hparticleevtinfofiller.h:18
 hparticleevtinfofiller.h:19
 hparticleevtinfofiller.h:20
 hparticleevtinfofiller.h:21
 hparticleevtinfofiller.h:22
 hparticleevtinfofiller.h:23
 hparticleevtinfofiller.h:24
 hparticleevtinfofiller.h:25
 hparticleevtinfofiller.h:26
 hparticleevtinfofiller.h:27
 hparticleevtinfofiller.h:28
 hparticleevtinfofiller.h:29
 hparticleevtinfofiller.h:30
 hparticleevtinfofiller.h:31
 hparticleevtinfofiller.h:32
 hparticleevtinfofiller.h:33
 hparticleevtinfofiller.h:34
 hparticleevtinfofiller.h:35
 hparticleevtinfofiller.h:36
 hparticleevtinfofiller.h:37
 hparticleevtinfofiller.h:38
 hparticleevtinfofiller.h:39
 hparticleevtinfofiller.h:40
 hparticleevtinfofiller.h:41
 hparticleevtinfofiller.h:42
 hparticleevtinfofiller.h:43
 hparticleevtinfofiller.h:44
 hparticleevtinfofiller.h:45
 hparticleevtinfofiller.h:46
 hparticleevtinfofiller.h:47
 hparticleevtinfofiller.h:48
 hparticleevtinfofiller.h:49
 hparticleevtinfofiller.h:50
 hparticleevtinfofiller.h:51
 hparticleevtinfofiller.h:52
 hparticleevtinfofiller.h:53
 hparticleevtinfofiller.h:54
 hparticleevtinfofiller.h:55
 hparticleevtinfofiller.h:56
 hparticleevtinfofiller.h:57
 hparticleevtinfofiller.h:58
 hparticleevtinfofiller.h:59
 hparticleevtinfofiller.h:60
 hparticleevtinfofiller.h:61
 hparticleevtinfofiller.h:62
 hparticleevtinfofiller.h:63
 hparticleevtinfofiller.h:64
 hparticleevtinfofiller.h:65
 hparticleevtinfofiller.h:66
 hparticleevtinfofiller.h:67
 hparticleevtinfofiller.h:68
 hparticleevtinfofiller.h:69
 hparticleevtinfofiller.h:70
 hparticleevtinfofiller.h:71
 hparticleevtinfofiller.h:72
 hparticleevtinfofiller.h:73
 hparticleevtinfofiller.h:74
 hparticleevtinfofiller.h:75
 hparticleevtinfofiller.h:76
 hparticleevtinfofiller.h:77
 hparticleevtinfofiller.h:78
 hparticleevtinfofiller.h:79
 hparticleevtinfofiller.h:80
 hparticleevtinfofiller.h:81
 hparticleevtinfofiller.h:82
 hparticleevtinfofiller.h:83
 hparticleevtinfofiller.h:84
 hparticleevtinfofiller.h:85
 hparticleevtinfofiller.h:86
 hparticleevtinfofiller.h:87
 hparticleevtinfofiller.h:88
 hparticleevtinfofiller.h:89
 hparticleevtinfofiller.h:90
 hparticleevtinfofiller.h:91
 hparticleevtinfofiller.h:92
 hparticleevtinfofiller.h:93
 hparticleevtinfofiller.h:94
 hparticleevtinfofiller.h:95
 hparticleevtinfofiller.h:96
 hparticleevtinfofiller.h:97
 hparticleevtinfofiller.h:98
 hparticleevtinfofiller.h:99
 hparticleevtinfofiller.h:100
 hparticleevtinfofiller.h:101
 hparticleevtinfofiller.h:102
 hparticleevtinfofiller.h:103
 hparticleevtinfofiller.h:104
 hparticleevtinfofiller.h:105
 hparticleevtinfofiller.h:106
 hparticleevtinfofiller.h:107
 hparticleevtinfofiller.h:108
 hparticleevtinfofiller.h:109
 hparticleevtinfofiller.h:110
 hparticleevtinfofiller.h:111
 hparticleevtinfofiller.h:112
 hparticleevtinfofiller.h:113
 hparticleevtinfofiller.h:114
 hparticleevtinfofiller.h:115
 hparticleevtinfofiller.h:116
 hparticleevtinfofiller.h:117
 hparticleevtinfofiller.h:118
 hparticleevtinfofiller.h:119
 hparticleevtinfofiller.h:120
 hparticleevtinfofiller.h:121
 hparticleevtinfofiller.h:122
 hparticleevtinfofiller.h:123
 hparticleevtinfofiller.h:124
 hparticleevtinfofiller.h:125
 hparticleevtinfofiller.h:126
 hparticleevtinfofiller.h:127
 hparticleevtinfofiller.h:128
 hparticleevtinfofiller.h:129
 hparticleevtinfofiller.h:130
 hparticleevtinfofiller.h:131
 hparticleevtinfofiller.h:132
 hparticleevtinfofiller.h:133
 hparticleevtinfofiller.h:134