Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MBDStudy.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MBDStudy.h
1 #ifndef __MBDSTUDY_H__
2 #define __MBDSTUDY_H__
3 
4 #include <fun4all/SubsysReco.h>
5 #include <string>
6 #include <map>
7 #include <TFile.h>
8 
9 //Forward declerations
10 class PHCompositeNode;
11 class PHG4HitContainer;
13 class EventHeader;
14 class MbdOut;
15 class TFile;
16 class TTree;
17 class TDatabasePDG;
18 class TRandom3;
19 class TH1;
20 class TH2;
21 class TF1;
22 class TCanvas;
23 
24 
25 //Brief: basic ntuple and histogram creation for sim evaluation
26 class MBDStudy: public SubsysReco
27 {
28 public:
29 
30  //Default constructor
31  MBDStudy(const std::string &name="MBDStudy");
32 
33  //Initialization, called for initialization
34  int Init(PHCompositeNode *);
35 
36  //Initialization at start of every run
37  int InitRun(PHCompositeNode *);
38 
39  //Process Event, called for each event
41 
42  //End, write and close files
43  int End(PHCompositeNode *);
44 
45  //Change output filename
46  void set_savefile(const char *f) { _savefname = f; }
47 
48  void set_tres(const Float_t tr) { _tres = tr; }
49 
50 private:
51 
52  //
53  void CheckDST(PHCompositeNode *topNode);
54 
55  //output filename
57  TFile* _savefile;
58 
59  int nprocessed{0}; // num events processed
60 
61  //Output
62  TTree* _tree;
63  Int_t f_evt;
64  Float_t f_bimp; // impact parameter
65  Int_t f_ncoll; // number n-n collisions
66  Int_t f_npart; // number participants
67  Float_t f_vx; // true x vertex of collision point
68  Float_t f_vy; // true y vertex
69  Float_t f_vz; // true z vertex
70  Float_t f_vt; // true start time
71  Short_t f_mbdn[2]; // num hits for each arm (north and south)
72  Float_t f_mbdq[2]; // total charge (currently npe) in each arm
73  Float_t f_mbdt[2]; // time in arm
74  Float_t f_mbdte[2]; // earliest hit time in arm
75  Float_t f_mbdz; // z-vertex
76  Float_t f_mbdt0; // start time
77 
78  TH1* h_mbdq[128]; // q in each tube
79  TH1* h_mbdqtot[2]; // total q in mbd arms
80  TH2* h2_mbdqtot; // north q vs south q
81  TH1* h_ztrue; // true z-vertex
82  TH1* h_tdiff; // time diff between estimated and real time
83  TH2* h2_tdiff_ch; // time diff by channel
84 
85  TCanvas *c_mbdt; // Canvas to
86  TH1 *hevt_mbdt[2]; // time in each mbd, per event
87  TF1 *gaussian;
88 
89  std::map<int,int> _pids; // PIDs of tracks in the MBD
90 
91  //
92  TDatabasePDG* _pdg;
93  TRandom3* _rndm;
94  Float_t _tres; // time resolution of one channel
95 
96  //Get all the nodes
97  void GetNodes(PHCompositeNode *);
98 
99  //Node pointers
103 
104 };
105 
106 #endif //* __MBDSTUDY_H__ *//