Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef CEMCRECO_H
0004 #define CEMCRECO_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <HepMC/SimpleVector.h> 
0008 #include <vector>
0009 //TopNode
0010 class PHCompositeNode;
0011 //histos and stuff
0012 class TH1F;
0013 class TH3F;
0014 class TH2F;
0015 class TH2I;
0016 class TString;
0017 //emcal stuff
0018 class RawClusterContainer;
0019 class RawCluster;
0020 class RawTowerGeomContainer;
0021 class RawTowerContainer; 
0022 class RawTower;
0023 //tracking for iso cone
0024 class SvtxTrackMap;
0025 //vertex info
0026 class GlobalVertexMap;
0027 class GlobalVertex;
0028 //Fun4all
0029 class Fun4AllHistoManager;
0030 class TFile;
0031 class PHG4TruthInfoContainer;
0032 class PHG4Particle;
0033 class PHG4VtxPoint;
0034 class CaloEvalStack;
0035 //class std::vector;
0036 //class FourVector;
0037 
0038 const int nEtaBins = 5;
0039 
0040 
0041 class cemcReco : public SubsysReco
0042 {
0043  public:
0044 
0045   cemcReco(const std::string &name, const std::string &outName);
0046 
0047   ~cemcReco() override;
0048 
0049   /** Called during initialization.
0050       Typically this is where you can book histograms, and e.g.
0051       register them to Fun4AllServer (so they can be output to file
0052       using Fun4AllServer::dumpHistos() method).
0053    */
0054   int Init(PHCompositeNode *topNode) override;
0055 
0056   /** Called for first event when run number is known.
0057       Typically this is where you may want to fetch data from
0058       database, because you know the run number. A place
0059       to book histograms which have to know the run number.
0060    */
0061   int InitRun(PHCompositeNode *topNode) override;
0062 
0063   /** Called for each event.
0064       This is where you do the real work.
0065    */
0066   int process_event(PHCompositeNode *topNode) override;
0067 
0068   /// Clean up internals after each event.
0069   int ResetEvent(PHCompositeNode *topNode) override;
0070 
0071   /// Called at the end of each run.
0072   int EndRun(const int runnumber) override;
0073 
0074   /// Called at the end of all processing.
0075   int End(PHCompositeNode *topNode) override;
0076 
0077   /// Reset
0078   int Reset(PHCompositeNode * /*topNode*/) override;
0079 
0080   void Print(const std::string &what = "ALL") const override;
0081 
0082  private:
0083   //counters, etc.
0084   int nEvent;
0085   std::string Outfile;
0086   
0087   //functors
0088   float calculateTSP(RawCluster *cluster, RawClusterContainer *cluster_container, RawTowerContainer *towerContainer, RawTowerGeomContainer *towerGeo, GlobalVertex *vtx);
0089   float coneSum(RawCluster *cluster, RawClusterContainer *cluster_container, SvtxTrackMap *trackmap, float coneradius, GlobalVertex *vtx);
0090   void letsSumw2();
0091   float getpT(PHG4Particle *particle);
0092   float FindTruthPhoton(float cluster_eta, float cluster_phi, float cluster_energy, PHG4TruthInfoContainer* particle);
0093   float getEta(PHG4Particle *particle);
0094   float getPhi(PHG4Particle *particle);
0095   bool compareVertices(HepMC::FourVector hepMCvtx, PHG4VtxPoint *g4vtx );
0096   bool checkBarcode(int motherBarcode, std::vector<int> &motherBarcodes);
0097   bool checkBarcode(int motherBarcode, std::vector<PHG4Particle*> &motherBarcodes);
0098 
0099   int getEtaBin(float eta);
0100 
0101   //this thing
0102   CaloEvalStack *caloevalstack;
0103   
0104   //RawTower *getMaxTower(RawCluster *cluster);
0105   //histos
0106   TH3F *ePi0InvMassEcut[2][nEtaBins];
0107   TH1F *photonE;
0108   TH1F *clusterDisp;
0109   TH2F *clusterChi2;
0110   TH2F *clusterProbPhoton;
0111   TH1F *isoPhoE;
0112   TH2F *isoPhoChi2;
0113   TH2F *isoPhoProb;
0114   TH3F *deltaR_E_invMass;
0115   TH3F *asym_E_invMass;
0116   TH2F *tsp_E;
0117   TH2F *tsp_E_iso;
0118   TH1F *truth_pi0_E[nEtaBins];
0119   TH1F *truth_eta_E;
0120   TH1F *truth_dpho_E;
0121   TH1F *pi0E_truth_reco;
0122   TH2F *deltaR_E_truth_pi0;
0123   TH3F *invMass_eta;
0124   TH3F *dPhoChi2;
0125   TH3F *dPhoProb;
0126   TH3F *pi0Chi2;
0127   TH3F *pi0Prob;
0128   TH3F *etaChi2;
0129   TH3F *etaProb;
0130   TH3F *electronChi2;
0131   TH3F *electronProb; 
0132   TH3F *hadronChi2;
0133   TH3F *hadronProb;
0134   TH2F *etaFrac;
0135   TH2F *pi0Frac;
0136   TH3F *unmatchedLocale;
0137   TH1F *unmatchedE;
0138   TH3F *invMassPhoPi0;
0139   TH3F *invMassEPhi;
0140   //TH2F *deltaR_truth_eta;
0141   
0142   TH2F *eFrac_dr_primary;
0143   TH2F *eFrac_dr_secondary;
0144   
0145   TH2F *asym_E_truth_pi0;
0146   //TH2F *asym_E_truth_eta;
0147   
0148   //Histogram manager
0149   Fun4AllHistoManager *hm = nullptr;
0150   
0151   //output file
0152   TFile *out;
0153   //values
0154   const float pi = 3.1415926;
0155   float trackErrorCount;
0156 };
0157 
0158 #endif // CEMCRECO_H