Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __BBCSTUDY_H__
0002 #define __BBCSTUDY_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 MbdPmtContainer;
0016 class MbdGeom;
0017 class TFile;
0018 class TTree;
0019 class TDatabasePDG;
0020 class TRandom3;
0021 class TH1;
0022 class TH2;
0023 class TF1;
0024 class TCanvas;
0025 
0026 
0027 //Brief: basic TTree and histogram creation for sim evaluation
0028 class BBCStudy: public SubsysReco
0029 {
0030 public: 
0031 
0032   //Default constructor
0033   BBCStudy(const std::string &name="BBCStudy");
0034 
0035   //Initialization, called for initialization
0036   int Init(PHCompositeNode *);
0037 
0038   //Initialization at start of every run
0039   int InitRun(PHCompositeNode *);
0040 
0041   //Process Event, called for each event
0042   int process_event(PHCompositeNode *);
0043 
0044   //End, write and close files
0045   int End(PHCompositeNode *);
0046 
0047   //Change output filename
0048   void set_savefile(const char *f) { _savefname = f; }
0049 
0050   void set_tres(const Float_t tr) { _tres = tr; }
0051 
0052 private:
0053 
0054   //
0055   void CheckDST(PHCompositeNode *topNode);
0056 
0057   //output filename
0058   std::string _savefname;
0059   TFile* _savefile;
0060    
0061   int nprocessed{0};     // num events processed
0062 
0063   //Output
0064   TTree* _tree;
0065   Int_t    f_evt;
0066   Float_t  f_bimp;    // impact parameter
0067   Int_t    f_ncoll;   // number n-n collisions
0068   Int_t    f_npart;   // number participants
0069   Float_t  f_vx;      // true x vertex of collision point
0070   Float_t  f_vy;      // true y vertex
0071   Float_t  f_vz;      // true z vertex
0072   Float_t  f_vt;       // true start time
0073   Short_t  f_bbcn[2]; // num hits for each arm (north and south)
0074   Float_t  f_bbcq[2]; // total charge (currently npe) in each arm
0075   Float_t  f_bbct[2]; // time in arm
0076   Float_t  f_bbcte[2]; // earliest hit time in arm
0077   Float_t  f_bbcz;    // z-vertex
0078   Float_t  f_bbct0;   // start time
0079 
0080   TH1* h_bbcq[128];   // q in each tube
0081   TH1* h_bbcqtot[2];  // total q in bbc arms
0082   TH2* h2_bbcqtot;    // north q vs south q
0083   TH1* h_ztrue;       // true z-vertex
0084   TH1* h_tdiff;       // time diff between estimated and real time
0085   TH2* h2_tdiff_ch;   // time diff by channel
0086 
0087   TCanvas *c_bbct;    // Canvas to 
0088   TH1 *hevt_bbct[2];  // time in each bbc, per event
0089   TF1 *gaussian;
0090 
0091   std::map<int,int> _pids;  // PIDs of tracks in the BBC
0092 
0093   //
0094   TDatabasePDG* _pdg;
0095   TRandom3*     _rndm;
0096   Float_t       _tres;    // time resolution of one channel
0097 
0098   //Get all the nodes
0099   void GetNodes(PHCompositeNode *);
0100   
0101   //Node pointers
0102   PHG4TruthInfoContainer* _truth_container;
0103   PHG4HitContainer* _bbchits;
0104   EventHeader* _evtheader;
0105   MbdOut* _bbcout;
0106   MbdPmtContainer* _bbcpmts;
0107   MbdGeom* _bbcgeom;
0108 
0109 };
0110 
0111 #endif //* __BBCSTUDY_H__ *//