EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicEventAssembler.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicEventAssembler.h
1 //
2 // AYK (ayk@bnl.gov), 2014/07/08
3 //
4 // Basically a task filling out EicRcTrack, EicRcVertex, etc
5 // arrays and do all dirty work to collect the necessary info;
6 //
7 
8 #include <TClonesArray.h>
9 #include <TBranch.h>
10 
11 #include <FairTask.h>
12 
13 #include <EicRcEvent.h>
14 #include <EicDetName.h>
15 #include <EicEventGenerator.h>
16 
17 #ifndef _EIC_EVENT_ASSEMBLER_
18 #define _EIC_EVENT_ASSEMBLER_
19 
20 #define _PND_MC_BRANCH_ "MCTrack"
21 #define _PND_RC_TRACK_BRANCH_ "PidChargedCand"
22 
23 #define _EIC_RC_TREE_ "EicRcTree"
24 #define _EIC_RC_BRANCH_ "EicRcEvent"
25 
27 
28 class EicCalorimeterHub: public TObject {
29  friend class EicEventAssembler;
30 
31  public:
33  double a = 0.0, double b = 0.0):
34  mName(0), mType(type), mClusters(0), mA(a), mB(b) {
35  if (name) mName = new EicDetName(name);
36  };
38 
39  double EnergyErrorEstimate(double energy) {
40  return mA/sqrt(energy) + mB;
41  };
42 
43  private:
44  CalorimeterType mType; // either EmCal or HCal
45 
46  EicDetName *mName; // detector name in all spellings
47 
48  TClonesArray *mClusters; // input array of reconstructed calorimeter clusters
49 
50  Double_t mA; // a/sqrt(E) term in energy resolution formula
51  Double_t mB; // constant term
52 
54 };
55 
56 class EicEventAssembler: public FairTask {
57  public:
60 
61  InitStatus Init();
62 
63  void Exec(Option_t* opt);
64 
65  void FinishTask();
66 
67  // Yes, prefer to have two separate user calls;
68  int AddEmCal(const char *name);
69  int AddHCal (const char *name);
70 
71  private:
73  TClonesArray *mPndMCTracks, *mPndPidChargedCand;
74 
77 
79  Bool_t mPersistency;
80 
82  TBranch *mEicRcEventBranch;
83 
84  std::vector<EicCalorimeterHub*> mCalorimeters; // vector of registered calorimeters
85 
86  int AddCalorimeterCore(const char *name, CalorimeterType type);
87 
90  void ReAssignMomentumValue();
91  void AssignScatteredLepton();
92 
94 };
95 
96 #endif