Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:11:31

0001 #ifndef __MBDSTUDY_H__
0002 #define __MBDSTUDY_H__
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <string>
0006 #include <map>
0007 #include <TFile.h>
0008 
0009 //Forward declerations
0010 class PHCompositeNode;
0011 class PHG4HitContainer;
0012 class PHG4TruthInfoContainer;
0013 class EventHeader;
0014 class MbdOut;
0015 class TFile;
0016 class TTree;
0017 class TDatabasePDG;
0018 class TRandom3;
0019 class TH1;
0020 class TH2;
0021 class TF1;
0022 class TCanvas;
0023 
0024 
0025 //Brief: basic ntuple and histogram creation for sim evaluation
0026 class MBDStudy: public SubsysReco
0027 {
0028 public: 
0029 
0030   //Default constructor
0031   MBDStudy(const std::string &name="MBDStudy");
0032 
0033   //Initialization, called for initialization
0034   int Init(PHCompositeNode *);
0035 
0036   //Initialization at start of every run
0037   int InitRun(PHCompositeNode *);
0038 
0039   //Process Event, called for each event
0040   int process_event(PHCompositeNode *);
0041 
0042   //End, write and close files
0043   int End(PHCompositeNode *);
0044 
0045   //Change output filename
0046   void set_savefile(const char *f) { _savefname = f; }
0047 
0048   void set_tres(const Float_t tr) { _tres = tr; }
0049 
0050 private:
0051 
0052   //
0053   void CheckDST(PHCompositeNode *topNode);
0054 
0055   //output filename
0056   std::string _savefname;
0057   TFile* _savefile;
0058    
0059   int nprocessed{0};     // num events processed
0060 
0061   //Output
0062   TTree* _tree;
0063   Int_t    f_evt;
0064   Float_t  f_bimp;    // impact parameter
0065   Int_t    f_ncoll;   // number n-n collisions
0066   Int_t    f_npart;   // number participants
0067   Float_t  f_vx;      // true x vertex of collision point
0068   Float_t  f_vy;      // true y vertex
0069   Float_t  f_vz;      // true z vertex
0070   Float_t  f_vt;       // true start time
0071   Short_t  f_mbdn[2]; // num hits for each arm (north and south)
0072   Float_t  f_mbdq[2]; // total charge (currently npe) in each arm
0073   Float_t  f_mbdt[2]; // time in arm
0074   Float_t  f_mbdte[2]; // earliest hit time in arm
0075   Float_t  f_mbdz;    // z-vertex
0076   Float_t  f_mbdt0;   // start time
0077 
0078   TH1* h_mbdq[128];   // q in each tube
0079   TH1* h_mbdqtot[2];  // total q in mbd arms
0080   TH2* h2_mbdqtot;    // north q vs south q
0081   TH1* h_ztrue;       // true z-vertex
0082   TH1* h_tdiff;       // time diff between estimated and real time
0083   TH2* h2_tdiff_ch;   // time diff by channel
0084 
0085   TCanvas *c_mbdt;    // Canvas to 
0086   TH1 *hevt_mbdt[2];  // time in each mbd, per event
0087   TF1 *gaussian;
0088 
0089   std::map<int,int> _pids;  // PIDs of tracks in the MBD
0090 
0091   //
0092   TDatabasePDG* _pdg;
0093   TRandom3*     _rndm;
0094   Float_t       _tres;    // time resolution of one channel
0095 
0096   //Get all the nodes
0097   void GetNodes(PHCompositeNode *);
0098   
0099   //Node pointers
0100   PHG4TruthInfoContainer* _truth_container;
0101   PHG4HitContainer* _mbdhits;
0102   EventHeader* _evtheader;
0103 
0104 };
0105 
0106 #endif //* __MBDSTUDY_H__ *//