Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:11:07

0001 #ifndef __MBDLASER_H__
0002 #define __MBDLASER_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 EventHeader;
0012 class MbdOut;
0013 class MbdPmtContainer;
0014 class TFile;
0015 class TTree;
0016 class TDatabasePDG;
0017 class TRandom3;
0018 class TH1;
0019 class TH2;
0020 class TGraphErrors;
0021 class TF1;
0022 class TCanvas;
0023 
0024 
0025 //Brief: basic TTree and histogram creation for sim evaluation
0026 class MbdLaser: public SubsysReco
0027 {
0028 public: 
0029 
0030   //Default constructor
0031   MbdLaser(const std::string &name="MbdLaser");
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_run(const int r) { f_run = r; }
0049 
0050 private:
0051 
0052   //
0053   void LaserDST(PHCompositeNode *topNode);
0054 
0055   int  Getpeaktime(TH1 *h);
0056 
0057   //output filename
0058   std::string _savefname;
0059   TFile* _savefile{ nullptr };
0060    
0061   //input file (abdul)
0062  // std::string _file;
0063  // TFile* _file;
0064   int nprocessed{0};     // num events processed
0065 
0066   //Output
0067   TTree* _tree{ nullptr };
0068   Int_t    f_run;
0069   Int_t    f_evt{ 0 };
0070   Int_t    f_ch;
0071   Float_t  f_qmean;
0072   Float_t  f_qmerr;
0073   Float_t  f_tmean;
0074   Float_t  f_tmerr;
0075 
0076 
0077   Float_t  f_mbdq[2]; // total charge (currently npe) in each arm
0078   Float_t  f_mbdt[2]; // time in arm
0079   Float_t  f_mbdte[2]; // earliest hit time in arm
0080   Float_t  f_mbdt0;   // start time
0081 
0082   TH1 *h_mbdq[128];   // q in each tube
0083   TH1* h_mbdt[128];  //  t in ecah tube 
0084 
0085   TH2* h2_mbdbtt;    // Timne vs ch
0086   TH2* h2_mbdbq;    // charge vs ch 
0087 
0088   TGraphErrors *g_mbdq[128];   // q in each tube
0089   TGraphErrors *g_mbdt[128];   // t in each tube
0090 
0091  
0092   TCanvas *c_mbdt;    // Canvas to 
0093   TH1 *hevt_mbdt[2];  // time in each mbd, per event
0094  
0095   //
0096   TRandom3*     _rndm;
0097 
0098   //Get all the nodes
0099   void GetNodes(PHCompositeNode *);
0100   
0101   //Node pointers
0102   EventHeader* _evtheader;
0103   MbdOut* _mbdout;
0104   MbdPmtContainer* _mbdpmts;
0105  // MbdPmtHit*  _mbdpmthit;
0106 
0107 };
0108 
0109 #endif //* __MBDLASER_H__ *//
0110 
0111