Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:14:33

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef ANA_PPG09_MOD_H
0004 #define ANA_PPG09_MOD_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <string>
0009 #include <vector>
0010 
0011 //#include <calotrigger/TriggerAnalyzer.h>
0012 
0013 class PHCompositeNode;
0014 class TH1D;
0015 class TH2D;
0016 class Gl1Packet;
0017 
0018 class Ana_PPG09_Mod : public SubsysReco
0019 {
0020 public:
0021 
0022   Ana_PPG09_Mod(
0023         const std::string &recojetname = "Ana_PPG09_Mod",
0024         const std::string &outputfilename = "PlaceHolder.root");
0025 
0026   ~Ana_PPG09_Mod() override;
0027 
0028   int Init(PHCompositeNode *topNode) override;
0029   int process_event(PHCompositeNode *topNode) override;
0030   int ResetEvent(PHCompositeNode *topNode) override;
0031   int End(PHCompositeNode *topNode) override;
0032   int Reset(PHCompositeNode * /*topNode*/) override;
0033   void setRunnumber(int run) {m_runnumber = run;}
0034   
0035 private:
0036 
0037   void initializePrescaleInformationFromDB(int runnumber);
0038   
0039   int getEventPrescale(float leadJetPt, std::vector<int> trigs);
0040   bool isTrigEfficient(int trigIndex, float leadJetPt);
0041   
0042   //TriggerAnalyzer *triggeranalyzer{nullptr};
0043   //Gl1Packet *gl1Packet{nullptr};
0044   std::string m_recoJetName;
0045   std::string m_outputFileName;
0046 
0047   double NComp_Cut = 1;
0048   double Lead_RPt_Cut = -999;
0049   double All_RPt_Cut = 5;
0050   double ZVtx_Cut = 30;
0051 
0052   static const int nTrigs = 8;
0053   
0054   //Jet Info
0055   TH3F *h_Eta_Phi_Pt_[nTrigs];
0056 
0057   TH1D *h_EventCount;
0058   TH1F *h_theJetSpectrum;
0059 
0060   //Caloriemter Tower Info
0061   TH3F *h_EMCal_Raw_Eta_Phi_E_[nTrigs];
0062   TH3F *h_iHCal_Raw_Eta_Phi_E_[nTrigs];
0063   TH3F *h_oHCal_Raw_Eta_Phi_E_[nTrigs];
0064   TH3F *h_EMCal_CS_Eta_Phi_E_[nTrigs];
0065   TH3F *h_iHCal_CS_Eta_Phi_E_[nTrigs];
0066   TH3F *h_oHCal_CS_Eta_Phi_E_[nTrigs];
0067   TH3F *h_EMCal_C_Eta_Phi_E_[nTrigs];
0068   TH3F *h_EMCal_CR_Eta_Phi_E_[nTrigs];
0069   TH3F *h_iHCal_C_Eta_Phi_E_[nTrigs];
0070   TH3F *h_oHCal_C_Eta_Phi_E_[nTrigs];
0071   TH3F *h_EMCal_Jet_Eta_Phi_E_[nTrigs];
0072   TH3F *h_iHCal_Jet_Eta_Phi_E_[nTrigs];
0073   TH3F *h_oHCal_Jet_Eta_Phi_E_[nTrigs];
0074 
0075   //Event Info
0076   TH2D *h_nJetsAboveThresh;
0077   TH1D *h_ZVtx_[nTrigs];
0078   TH3F *h_oHCal_TE_Sub_Eta_Phi_E_[nTrigs];
0079   TH3F *h_iHCal_TE_Sub_Eta_Phi_E_[nTrigs];
0080   TH3F *h_EMCal_TE_Sub_Eta_Phi_E_[nTrigs];
0081 
0082   int m_event = 0;
0083   int m_runnumber = 0;
0084 
0085   std::vector<std::string> trigNames = {
0086     "MBD N&S >= 1",
0087     "MBD N&S >= 1, vtx < 10 cm",
0088     "Jet 8 GeV + MBD NS >= 1",
0089     "Jet 10 GeV + MBD NS >= 1",
0090     "Jet 12 GeV + MBD NS >= 1",
0091     "Jet 8 GeV, MBD N&S >= 1, vtx < 10 cm",
0092     "Jet 10 GeV, MBD N&S >= 1, vtx < 10 cm",
0093     "Jet 12 GeV, MBD N&S >= 1, vtx < 10 cm"};
0094 
0095   
0096   std::vector<int> trigIndices = {10,12,17,18,19,33,34,35};
0097   std::map <int, int> trigToVecIndex{{trigIndices[0],0}, {trigIndices[1],1}, {trigIndices[2],2}, {trigIndices[3],3}, {trigIndices[4],4}, {trigIndices[5],5}, {trigIndices[6],6},{trigIndices[7],7}};
0098 
0099   std::vector<int> scaleDowns {};
0100   std::vector<int> liveCounts {};
0101   float jetBins[9] = {7,10,15,20,25,30,40,60,80};
0102   int nJetBins = 8;
0103   float trigCutOffs[nTrigs] = {1, 1, 16, 18,20, 16, 18, 20};
0104 };
0105 
0106 //jet eta cut stuff
0107 float radius_OH = 225.87;
0108  float mineta_OH = -1.1;
0109  float maxeta_OH = 1.1;
0110  float minz_OH = -301.683;
0111  float maxz_OH = 301.683;
0112 
0113  float radius_IH = 127.503;
0114  float mineta_IH = -1.1;
0115  float maxeta_IH = 1.1;
0116  float minz_IH = -170.299;
0117  float maxz_IH = 170.299;
0118 
0119  float radius_EM = 93.5;
0120  float mineta_EM = -1.13381;
0121  float maxeta_EM = 1.13381;
0122  float minz_EM = -130.23;
0123  float maxz_EM = 130.23;
0124 
0125 float get_ohcal_mineta_zcorrected(float zvertex) {
0126   float z = minz_OH - zvertex;
0127   float eta_zcorrected = asinh(z / (float)radius_OH);
0128   return eta_zcorrected;
0129 }
0130 
0131 float get_ohcal_maxeta_zcorrected(float zvertex) {
0132   float z = maxz_OH - zvertex;
0133   float eta_zcorrected = asinh(z / (float)radius_OH);
0134   return eta_zcorrected;
0135 }
0136 
0137 float get_ihcal_mineta_zcorrected(float zvertex) {
0138   float z = minz_IH - zvertex;
0139   float eta_zcorrected = asinh(z / (float)radius_IH);
0140   return eta_zcorrected;
0141 }
0142 
0143 float get_ihcal_maxeta_zcorrected(float zvertex) {
0144   float z = maxz_IH - zvertex;
0145   float eta_zcorrected = asinh(z / (float)radius_IH);
0146   return eta_zcorrected;
0147 }
0148 
0149 float get_emcal_mineta_zcorrected(float zvertex) {
0150   float z = minz_EM - zvertex;
0151   float eta_zcorrected = asinh(z / (float)radius_EM);
0152   return eta_zcorrected;
0153 }
0154 
0155 float get_emcal_maxeta_zcorrected(float zvertex) {
0156   float z = maxz_EM - zvertex;
0157   float eta_zcorrected = asinh(z / (float)radius_EM);
0158   return eta_zcorrected;
0159 }
0160 
0161 bool check_bad_jet_eta(float jet_eta, float zertex, float jet_radius) {
0162   float emcal_mineta = get_emcal_mineta_zcorrected(zertex);
0163   float emcal_maxeta = get_emcal_maxeta_zcorrected(zertex);
0164   float ihcal_mineta = get_ihcal_mineta_zcorrected(zertex);
0165   float ihcal_maxeta = get_ihcal_maxeta_zcorrected(zertex);
0166   float ohcal_mineta = get_ohcal_mineta_zcorrected(zertex);
0167   float ohcal_maxeta = get_ohcal_maxeta_zcorrected(zertex);
0168   float minlimit = emcal_mineta;
0169   if (ihcal_mineta > minlimit) minlimit = ihcal_mineta;
0170   if (ohcal_mineta > minlimit) minlimit = ohcal_mineta;
0171   float maxlimit = emcal_maxeta;
0172   if (ihcal_maxeta < maxlimit) maxlimit = ihcal_maxeta;
0173   if (ohcal_maxeta < maxlimit) maxlimit = ohcal_maxeta;
0174   minlimit += jet_radius;
0175   maxlimit -= jet_radius;
0176   return jet_eta < minlimit || jet_eta > maxlimit;
0177 }
0178 
0179 #endif // ANA_PPG09_MOD_H