ROOT logo
#ifndef __HPARTICLEBOOKER_H__
#define __HPARTICLEBOOKER_H__


#include "hparticlecand.h"

#include <vector>
#include <map>

using namespace std;

class HParticleBooker;
class HTofHit;
class HTofCluster;
class HRpcCluster;
class HShowerHit;
class HEmcCluster;
class HMdcSeg;
class HRichHit;

class HTofHitSim;
class HTofClusterSim;
class HRpcClusterSim;
class HShowerHitSim;
class HEmcClusterSim;
class HMdcSegSim;
class HRichHitSim;
class HParticleCandSim;

class HCategory;

R__EXTERN HParticleBooker *gParticleBooker;

class HParticleBooker : public TObject
{

private:

    //-------------------------------------------------------
    // indices user in candidates
    map<Int_t, vector<HParticleCand*> > mTofHittoCand;       //!  TOF hit     lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mTofClsttoCand;      //!  TOF cluster lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mRpcClsttoCand;      //!  RPC cluster lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mShowertoCand;       //!  SHOWER hit  lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mEmctoCand;          //!  EMC cluster lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mInnerMdctoCand;     //!  inner Seg   lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mOuterMdctoCand;     //!  outer Seg   lookup   detector hit ind -> list of candidates using this hit
    map<Int_t, vector<HParticleCand*> > mRichtoCand;         //!  RICH hit    lookup   detector hit ind -> list of candidates using this hit


    //-------------------------------------------------------
    // indices user in candidates
    vector<Int_t> vTofHitInd;       //!
    vector<Int_t> vTofClstInd;      //!
    vector<Int_t> vRpcClstInd;      //!
    vector<Int_t> vShowerInd;       //!
    vector<Int_t> vEmcInd;          //!
    vector<Int_t> vInnerMdcInd;     //!
    vector<Int_t> vOuterMdcInd;     //!
    vector<Int_t> vRichInd;         //!
    //-------------------------------------------------------

    //-------------------------------------------------------
    // objects user in candidates
    vector<HTofHit*>     vTofHit;   //!
    vector<HTofCluster*> vTofClst;  //!
    vector<HRpcCluster*> vRpcClst;  //!
    vector<HShowerHit*>  vShower;   //!
    vector<HEmcCluster*> vEmc;      //!
    vector<HMdcSeg*>     vInnerMdc; //!
    vector<HMdcSeg*>     vOuterMdc; //!
    vector<HRichHit*>    vRich;     //!
    //-------------------------------------------------------

    //-------------------------------------------------------
    // all objects in event
    vector<HTofHit*>     vTofHitAll;   //!
    vector<HTofCluster*> vTofClstAll;  //!
    vector<HRpcCluster*> vRpcClstAll;  //!
    vector<HShowerHit*>  vShowerAll;   //!
    vector<HEmcCluster*> vEmcAll;      //!
    vector<HMdcSeg*>     vInnerMdcAll; //!
    vector<HMdcSeg*>     vOuterMdcAll; //!
    vector<HRichHit*>    vRichAll;     //!
    //-------------------------------------------------------


    //-------------------------------------------------------
    // SIMULATION INFO
    //-------------------------------------------------------


    //-------------------------------------------------------
    map<Int_t, vector<HParticleCandSim*> > mTracktoCand;       //!  Geant Track lookup   geant track (assigned track)  -> list of candidates using this track
    map<Int_t, vector<HParticleCandSim*> > mTracktoAnyCand;    //!  Geant Track lookup   geant track (in any detector) -> list of candidates using this track
    map<Int_t, vector<HTofHitSim*> >       mTracktoTofHit;     //!  Geant Track lookup   geant track -> list of TofHits using this track
    map<Int_t, vector<HTofClusterSim*> >   mTracktoTofCluster; //!  Geant Track lookup   geant track -> list of TofCluster using this track
    map<Int_t, vector<HRpcClusterSim*> >   mTracktoRpcCluster; //!  Geant Track lookup   geant track -> list of RpcCluster using this track
    map<Int_t, vector<HShowerHitSim*> >    mTracktoShowerHit;  //!  Geant Track lookup   geant track -> list of ShowerHit using this track
    map<Int_t, vector<HEmcClusterSim*> >   mTracktoEmcCluster; //!  Geant Track lookup   geant track -> list of EmcCluster using this track
    map<Int_t, vector<HMdcSegSim*> >       mTracktoInnerMdc;   //!  Geant Track lookup   geant track -> list of inner MdcSeg using this track
    map<Int_t, vector<HMdcSegSim*> >       mTracktoOuterMdc;   //!  Geant Track lookup   geant track -> list of outer MdcSeg using this track
    map<Int_t, vector<HRichHitSim*> >      mTracktoRichHit;    //!  Geant Track lookup   geant track -> list of RichHit using this track

    map<Int_t, vector<Int_t> > mTracktoCandInd;       //!  Geant Track lookup   geant track (assigned track)  -> list of candidates indices using this track
    map<Int_t, vector<Int_t> > mTracktoAnyCandInd;    //!  Geant Track lookup   geant track (in any detector) -> list of candidates indicesusing this track
    map<Int_t, vector<Int_t> > mTracktoTofHitInd;     //!  Geant Track lookup   geant track -> list of TofHits indices using this track
    map<Int_t, vector<Int_t> > mTracktoTofClusterInd; //!  Geant Track lookup   geant track -> list of TofCluster indices using this track
    map<Int_t, vector<Int_t> > mTracktoRpcClusterInd; //!  Geant Track lookup   geant track -> list of RpcCluster indices using this track
    map<Int_t, vector<Int_t> > mTracktoShowerHitInd;  //!  Geant Track lookup   geant track -> list of ShowerHit indices using this track
    map<Int_t, vector<Int_t> > mTracktoEmcClusterInd; //!  Geant Track lookup   geant track -> list of EmcCluster indices using this track
    map<Int_t, vector<Int_t> > mTracktoInnerMdcInd;   //!  Geant Track lookup   geant track -> list of inner MdcSeg indices using this track
    map<Int_t, vector<Int_t> > mTracktoOuterMdcInd;   //!  Geant Track lookup   geant track -> list of outer MdcSeg indices using this track
    map<Int_t, vector<Int_t> > mTracktoRichHitInd;    //!  Geant Track lookup   geant track -> list of RichHit using indices this track
    //-------------------------------------------------------

    //-------------------------------------------------------
    // helpers
    HCategory* richhitCat;           //!
    HCategory* tofhitCat;            //!
    HCategory* tofclstCat;           //!
    HCategory* rpcclstCat;           //!
    HCategory* showerhitCat;         //!
    HCategory* emcclusterCat;        //!
    HCategory* mdcsegCat;            //!
    HCategory* candCat;              //!

    //-------------------------------------------------------
   void bookHits(HParticleCand* cand1);

public:

    HParticleBooker();
    ~HParticleBooker();



    void  nextEvent();

    vector<Int_t>& getTofHitIndices()    { return  vTofHitInd; }
    vector<Int_t>& getTofClstIndices()   { return  vTofClstInd; }
    vector<Int_t>& getRpcClstIndices()   { return  vRpcClstInd; }
    vector<Int_t>& getShowerIndices()    { return  vShowerInd; }
    vector<Int_t>& getEmcIndices()       { return  vEmcInd; }
    vector<Int_t>& getInnerMdcIndices()  { return  vInnerMdcInd; }
    vector<Int_t>& getOuterMdcIndices()  { return  vOuterMdcInd; }
    vector<Int_t>& getRichIndices()      { return  vRichInd; }


    map<Int_t, vector<HParticleCand*> >& getTofHitMap()   { return  mTofHittoCand; }
    map<Int_t, vector<HParticleCand*> >& getTofClstMap()  { return  mTofClsttoCand; }
    map<Int_t, vector<HParticleCand*> >& getRpcClstMap()  { return  mRpcClsttoCand; }
    map<Int_t, vector<HParticleCand*> >& getShowerHitMap(){ return  mShowertoCand; }
    map<Int_t, vector<HParticleCand*> >& getEmcClusterMap(){ return  mEmctoCand; }
    map<Int_t, vector<HParticleCand*> >& getInnerMdcMap() { return  mInnerMdctoCand; }
    map<Int_t, vector<HParticleCand*> >& getOuterMdcMap() { return  mOuterMdctoCand; }
    map<Int_t, vector<HParticleCand*> >& getRichMap()     { return  mRichtoCand; }


    Int_t getCandidatesForTofHit    (Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForTofCluster(Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForRpcCluster(Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForShower    (Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForEmc       (Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForInnerMdc  (Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForOuterMdc  (Int_t index,vector<HParticleCand*>& cands);
    Int_t getCandidatesForRich      (Int_t index,vector<HParticleCand*>& cands);

    Int_t getCandidatesAnyDetectorForTrack(Int_t track,vector<HParticleCandSim*>& cands);
    Int_t getCandidatesForTrack           (Int_t track,vector<HParticleCandSim*>& cands);
    Int_t getTofHitForTrack               (Int_t track,vector<HTofHitSim*>&       cands);
    Int_t getTofClusterForTrack           (Int_t track,vector<HTofClusterSim*>&   cands);
    Int_t getRpcClusterForTrack           (Int_t track,vector<HRpcClusterSim*>&   cands);
    Int_t getShowerHitForTrack            (Int_t track,vector<HShowerHitSim*>&    cands);
    Int_t getEmcClusterForTrack           (Int_t track,vector<HEmcClusterSim*>&   cands);
    Int_t getInnerMdcSegForTrack          (Int_t track,vector<HMdcSegSim*>&       cands);
    Int_t getOuterMdcSegForTrack          (Int_t track,vector<HMdcSegSim*>&       cands);
    Int_t getRichHitForTrack              (Int_t track,vector<HRichHitSim*>&      cands);

    Int_t getCandidatesIndAnyDetectorForTrack(Int_t track,vector<Int_t>& cands);
    Int_t getCandidatesIndForTrack           (Int_t track,vector<Int_t>& cands);
    Int_t getTofHitIndForTrack               (Int_t track,vector<Int_t>& cands);
    Int_t getTofClusterIndForTrack           (Int_t track,vector<Int_t>& cands);
    Int_t getRpcClusterIndForTrack           (Int_t track,vector<Int_t>& cands);
    Int_t getShowerHitIndForTrack            (Int_t track,vector<Int_t>& cands);
    Int_t getEmcClusterIndForTrack           (Int_t track,vector<Int_t>& cands);
    Int_t getInnerMdcSegIndForTrack          (Int_t track,vector<Int_t>& cands);
    Int_t getOuterMdcSegIndForTrack          (Int_t track,vector<Int_t>& cands);
    Int_t getRichHitIndForTrack              (Int_t track,vector<Int_t>& cands);


    vector<HTofHit*>&     getTofHits     () { return vTofHit;  }
    vector<HTofCluster*>& getTofClusters () { return vTofClst; }
    vector<HRpcCluster*>& getRpcClusters () { return vRpcClst; }
    vector<HShowerHit*>&  getShowerHits  () { return vShower;  }
    vector<HEmcCluster*>& getEmcClusters () { return vEmc;  }
    vector<HMdcSeg*>&     getInnerMdcSegs() { return vInnerMdc;}
    vector<HMdcSeg*>&     getOuterMdcSegs() { return vOuterMdc;}
    vector<HRichHit*>&    getRichHits    () { return vRich;    }

    vector<HTofHit*>&     getAllTofHits     () { return vTofHitAll;  }
    vector<HTofCluster*>& getAllTofClusters () { return vTofClstAll; }
    vector<HRpcCluster*>& getAllRpcClusters () { return vRpcClstAll; }
    vector<HShowerHit*>&  getAllShowerHits  () { return vShowerAll;  }
    vector<HEmcCluster*>& getAllEmcClusters () { return vEmcAll;  }
    vector<HMdcSeg*>&     getAllInnerMdcSegs() { return vInnerMdcAll;}
    vector<HMdcSeg*>&     getAllOuterMdcSegs() { return vOuterMdcAll;}
    vector<HRichHit*>&    getAllRichHits    () { return vRichAll;    }

    Int_t getSameRich    (HParticleCand* cand,vector<HParticleCand*>& candidates,UInt_t flag=0,Bool_t isReference=kTRUE);
    Int_t getSameInnerMdc(HParticleCand* cand,vector<HParticleCand*>& candidates,UInt_t flag=0,Bool_t isReference=kTRUE);
    Int_t getSameOuterMdc(HParticleCand* cand,vector<HParticleCand*>& candidates,UInt_t flag=0,Bool_t isReference=kTRUE);
    Int_t getSameMeta    (HParticleCand* cand,vector<HParticleCand*>& candidates,UInt_t flag=0,Bool_t isReference=kTRUE);
    Int_t getSameAny     (HParticleCand* cand,vector<HParticleCand*>& candidates,UInt_t flag=0,UInt_t detswitch=0,Bool_t isReference=kTRUE);

    ClassDef(HParticleBooker,0)

};


#endif
 hparticlebooker.h:1
 hparticlebooker.h:2
 hparticlebooker.h:3
 hparticlebooker.h:4
 hparticlebooker.h:5
 hparticlebooker.h:6
 hparticlebooker.h:7
 hparticlebooker.h:8
 hparticlebooker.h:9
 hparticlebooker.h:10
 hparticlebooker.h:11
 hparticlebooker.h:12
 hparticlebooker.h:13
 hparticlebooker.h:14
 hparticlebooker.h:15
 hparticlebooker.h:16
 hparticlebooker.h:17
 hparticlebooker.h:18
 hparticlebooker.h:19
 hparticlebooker.h:20
 hparticlebooker.h:21
 hparticlebooker.h:22
 hparticlebooker.h:23
 hparticlebooker.h:24
 hparticlebooker.h:25
 hparticlebooker.h:26
 hparticlebooker.h:27
 hparticlebooker.h:28
 hparticlebooker.h:29
 hparticlebooker.h:30
 hparticlebooker.h:31
 hparticlebooker.h:32
 hparticlebooker.h:33
 hparticlebooker.h:34
 hparticlebooker.h:35
 hparticlebooker.h:36
 hparticlebooker.h:37
 hparticlebooker.h:38
 hparticlebooker.h:39
 hparticlebooker.h:40
 hparticlebooker.h:41
 hparticlebooker.h:42
 hparticlebooker.h:43
 hparticlebooker.h:44
 hparticlebooker.h:45
 hparticlebooker.h:46
 hparticlebooker.h:47
 hparticlebooker.h:48
 hparticlebooker.h:49
 hparticlebooker.h:50
 hparticlebooker.h:51
 hparticlebooker.h:52
 hparticlebooker.h:53
 hparticlebooker.h:54
 hparticlebooker.h:55
 hparticlebooker.h:56
 hparticlebooker.h:57
 hparticlebooker.h:58
 hparticlebooker.h:59
 hparticlebooker.h:60
 hparticlebooker.h:61
 hparticlebooker.h:62
 hparticlebooker.h:63
 hparticlebooker.h:64
 hparticlebooker.h:65
 hparticlebooker.h:66
 hparticlebooker.h:67
 hparticlebooker.h:68
 hparticlebooker.h:69
 hparticlebooker.h:70
 hparticlebooker.h:71
 hparticlebooker.h:72
 hparticlebooker.h:73
 hparticlebooker.h:74
 hparticlebooker.h:75
 hparticlebooker.h:76
 hparticlebooker.h:77
 hparticlebooker.h:78
 hparticlebooker.h:79
 hparticlebooker.h:80
 hparticlebooker.h:81
 hparticlebooker.h:82
 hparticlebooker.h:83
 hparticlebooker.h:84
 hparticlebooker.h:85
 hparticlebooker.h:86
 hparticlebooker.h:87
 hparticlebooker.h:88
 hparticlebooker.h:89
 hparticlebooker.h:90
 hparticlebooker.h:91
 hparticlebooker.h:92
 hparticlebooker.h:93
 hparticlebooker.h:94
 hparticlebooker.h:95
 hparticlebooker.h:96
 hparticlebooker.h:97
 hparticlebooker.h:98
 hparticlebooker.h:99
 hparticlebooker.h:100
 hparticlebooker.h:101
 hparticlebooker.h:102
 hparticlebooker.h:103
 hparticlebooker.h:104
 hparticlebooker.h:105
 hparticlebooker.h:106
 hparticlebooker.h:107
 hparticlebooker.h:108
 hparticlebooker.h:109
 hparticlebooker.h:110
 hparticlebooker.h:111
 hparticlebooker.h:112
 hparticlebooker.h:113
 hparticlebooker.h:114
 hparticlebooker.h:115
 hparticlebooker.h:116
 hparticlebooker.h:117
 hparticlebooker.h:118
 hparticlebooker.h:119
 hparticlebooker.h:120
 hparticlebooker.h:121
 hparticlebooker.h:122
 hparticlebooker.h:123
 hparticlebooker.h:124
 hparticlebooker.h:125
 hparticlebooker.h:126
 hparticlebooker.h:127
 hparticlebooker.h:128
 hparticlebooker.h:129
 hparticlebooker.h:130
 hparticlebooker.h:131
 hparticlebooker.h:132
 hparticlebooker.h:133
 hparticlebooker.h:134
 hparticlebooker.h:135
 hparticlebooker.h:136
 hparticlebooker.h:137
 hparticlebooker.h:138
 hparticlebooker.h:139
 hparticlebooker.h:140
 hparticlebooker.h:141
 hparticlebooker.h:142
 hparticlebooker.h:143
 hparticlebooker.h:144
 hparticlebooker.h:145
 hparticlebooker.h:146
 hparticlebooker.h:147
 hparticlebooker.h:148
 hparticlebooker.h:149
 hparticlebooker.h:150
 hparticlebooker.h:151
 hparticlebooker.h:152
 hparticlebooker.h:153
 hparticlebooker.h:154
 hparticlebooker.h:155
 hparticlebooker.h:156
 hparticlebooker.h:157
 hparticlebooker.h:158
 hparticlebooker.h:159
 hparticlebooker.h:160
 hparticlebooker.h:161
 hparticlebooker.h:162
 hparticlebooker.h:163
 hparticlebooker.h:164
 hparticlebooker.h:165
 hparticlebooker.h:166
 hparticlebooker.h:167
 hparticlebooker.h:168
 hparticlebooker.h:169
 hparticlebooker.h:170
 hparticlebooker.h:171
 hparticlebooker.h:172
 hparticlebooker.h:173
 hparticlebooker.h:174
 hparticlebooker.h:175
 hparticlebooker.h:176
 hparticlebooker.h:177
 hparticlebooker.h:178
 hparticlebooker.h:179
 hparticlebooker.h:180
 hparticlebooker.h:181
 hparticlebooker.h:182
 hparticlebooker.h:183
 hparticlebooker.h:184
 hparticlebooker.h:185
 hparticlebooker.h:186
 hparticlebooker.h:187
 hparticlebooker.h:188
 hparticlebooker.h:189
 hparticlebooker.h:190
 hparticlebooker.h:191
 hparticlebooker.h:192
 hparticlebooker.h:193
 hparticlebooker.h:194
 hparticlebooker.h:195
 hparticlebooker.h:196
 hparticlebooker.h:197
 hparticlebooker.h:198
 hparticlebooker.h:199
 hparticlebooker.h:200
 hparticlebooker.h:201
 hparticlebooker.h:202
 hparticlebooker.h:203
 hparticlebooker.h:204
 hparticlebooker.h:205
 hparticlebooker.h:206
 hparticlebooker.h:207
 hparticlebooker.h:208
 hparticlebooker.h:209
 hparticlebooker.h:210
 hparticlebooker.h:211
 hparticlebooker.h:212
 hparticlebooker.h:213
 hparticlebooker.h:214
 hparticlebooker.h:215
 hparticlebooker.h:216
 hparticlebooker.h:217
 hparticlebooker.h:218
 hparticlebooker.h:219
 hparticlebooker.h:220
 hparticlebooker.h:221