Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __BBCCHECK_H__
0002 #define __BBCCHECK_H__
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <string>
0006 #include <vector>
0007 #include <map>
0008 #include <TFile.h>
0009 
0010 //Forward declerations
0011 class PHCompositeNode;
0012 class EventHeader;
0013 class MbdOut;
0014 class MbdPmtContainer;
0015 class Gl1Packet;
0016 class TFile;
0017 class TTree;
0018 class TDatabasePDG;
0019 class TRandom3;
0020 class TH1;
0021 class TH2;
0022 class TGraphErrors;
0023 class TF1;
0024 class TCanvas;
0025 
0026 
0027 //Brief: basic TTree and histogram creation for sim evaluation
0028 class BbcCheck: public SubsysReco
0029 {
0030 public: 
0031 
0032   //Default constructor
0033   BbcCheck(const std::string &name="BbcCheck");
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_run(const int r) { f_run = r; }
0051 
0052 private:
0053 
0054   //
0055   void CheckDST(PHCompositeNode *topNode);
0056 
0057   int  Getpeaktime(TH1 *h);
0058   void process_gl1( PHCompositeNode *topNode );
0059   void process_zdc( PHCompositeNode *topNode );
0060   void process_emcal( PHCompositeNode *topNode );
0061   void process_ohcal( PHCompositeNode *topNode );
0062   void process_ihcal( PHCompositeNode *topNode );
0063 
0064   //output filename
0065   std::string _savefname;
0066   TFile* _savefile;
0067    
0068   int nprocessed{0};     // num events processed
0069 
0070   //Output
0071   TTree* _tree{ nullptr };
0072   TTree* _tree2{ nullptr };  // for event by event info
0073   Int_t    f_run;
0074   Int_t    f_evt;
0075   Short_t  f_cross;
0076   Int_t    f_ch;
0077   Float_t  f_qmean;
0078   Float_t  f_qmerr;
0079 
0080   ULong64_t f_rtrig{0};
0081   ULong64_t f_ltrig{0};
0082   ULong64_t f_strig{0};
0083 
0084   Float_t  f_bimp;    // impact parameter
0085   Int_t    f_ncoll;   // number n-n collisions
0086   Int_t    f_npart;   // number participants
0087   Float_t  f_vx;      // true x vertex of collision point
0088   Float_t  f_vy;      // true y vertex
0089   Float_t  f_vz;      // true z vertex
0090   Float_t  f_vt;       // true start time
0091   Short_t  f_bbcn[2];  // num hits for each arm (north and south)
0092   Float_t  f_bbcq[2];  // total charge (currently npe) in each arm
0093   Float_t  f_bbct[2];  // time in arm
0094   Float_t  f_bbcte[2]; // earliest hit time in arm
0095   Float_t  f_bz;       // z-vertex
0096   Float_t  f_bbct0;    // start time
0097 
0098   TH1 *h_bbcq[128];   // q in each tube
0099   TGraphErrors *g_bbcq[128];   // q in each tube
0100   TH1 *h_bbcqtot[2];  // total q in bbc arms
0101   TH1 *h_bbcqsum;     // total q in bbc arms
0102   TH2 *h2_bbcqsum;    // north q vs south q
0103 
0104   TH1 *h2_bbcqtot_bz[2];  // total q in bbc arms, vs bz
0105   TH2 *h2_bbcqsum_bz;    // north q vs south q, vs bz
0106 
0107   TH1 *h_emcale;
0108   TH1 *h_emcaltimecut;
0109   TH1 *h_ohcale;
0110   TH1 *h_ohcaltimecut;
0111   TH1 *h_ihcale;
0112   TH1 *h_ihcaltimecut;
0113   TH1 *h_zdce;
0114   TH1 *h_zdcse{nullptr};
0115   TH1 *h_zdcne{nullptr};
0116   TH1 *h_zdctimecut;
0117   TH1 *h_bz;
0118   TH1 *h_bztrig[5]; // 5 MBDNS triggers
0119   TH2 *h2_tt;
0120   TH2 *h2_tq;
0121   TH2 *h2_slew[128];
0122   TH1 *h_cross;
0123 
0124   std::vector<uint64_t> mbdtrigbits;
0125 
0126   TCanvas *c_bbct;    // Canvas to 
0127   TH1 *hevt_bbct[2];  // time in each bbc, per event
0128   TF1 *gaussian;
0129 
0130   TH1 *h_bpmt_bad;
0131 
0132   std::map<int,int> _pids;  // PIDs of tracks in the BBC
0133 
0134   //
0135   TRandom3*     _rndm;
0136   Float_t       _tres;    // time resolution of one channel
0137 
0138   //Get all the nodes
0139   void GetNodes(PHCompositeNode *);
0140   
0141   //Node pointers
0142   EventHeader* _evtheader;
0143   MbdOut* _mbdout;
0144   MbdPmtContainer* _mbdpmts;
0145   Gl1Packet* _gl1raw;
0146 
0147 };
0148 
0149 #endif //* __BBCCHECK_H__ *//