Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:19

0001 // ----------------------------------------------------------------------------
0002 // 'ReadLambdaJetTree.h'
0003 // Derek Anderson
0004 // 02.19.2024
0005 //
0006 // SCorrelatorQAMaker plugin to read lambda-tagged jet
0007 // trees and draw plots and calculate the total no.
0008 // of lambdas.
0009 // ----------------------------------------------------------------------------
0010 
0011 #ifndef SCORRELATORQAMAKER_SREADLAMBDAJETTREE_H
0012 #define SCORRELATORQAMAKER_SREADLAMBDAJETTREE_H
0013 
0014 // c++ utilities
0015 #include <cmath>
0016 #include <string>
0017 #include <vector>
0018 #include <cassert>
0019 #include <utility>
0020 #include <iostream>
0021 // root libraries
0022 #include <TH1.h>
0023 #include <TH2.h>
0024 #include <TMath.h>
0025 #include <TFile.h>
0026 #include <TTree.h>
0027 #include <TCanvas.h>
0028 // plugin definitions
0029 #include "SBaseQAPlugin.h"
0030 #include "SReadLambdaJetTreeConfig.h"
0031 #include "SReadLambdaJetTreeHistDef.h"
0032 
0033 // make common namespaces implicit
0034 using namespace std;
0035 
0036 
0037 
0038 namespace SColdQcdCorrelatorAnalysis {
0039 
0040   // SReadLambdaJetTree definition --------------------------------------------
0041 
0042   class SReadLambdaJetTree : public SBaseQAPlugin<SReadLambdaJetTreeConfig> {
0043 
0044     public:
0045 
0046       // histogram accessors
0047       enum Evt {
0048         NJet, 
0049         NTagJet,
0050         NLeadJet,
0051         NMultiJet,
0052         NLam,
0053         NLamJet,
0054         NLeadLam
0055       };
0056       enum Type {
0057         Lam,
0058         LLam,
0059         MLJetLam,
0060         Jet,
0061         LJet,
0062         LLJet,
0063         MLJet,
0064         HJet
0065       };
0066       enum Var {
0067         Eta,
0068         Ene,
0069         Pt,
0070         DPhi,
0071         DEta,
0072         Dr,
0073         Z,
0074         NL,
0075         NC,
0076         RLC
0077       };
0078       enum Mod {
0079         VsEta,
0080         VsEne,
0081         VsPt,
0082         VsDPhi,
0083         VsDEta
0084       };
0085 
0086       // ctor/dtor
0087       SReadLambdaJetTree()  {};
0088       ~SReadLambdaJetTree() {};
0089 
0090       // public methods
0091       void Init();
0092       void Analyze();
0093       void End();
0094 
0095       // plugin-specific setters
0096       void SetHistDef(SReadLambdaJetTreeHistDef& def) {m_hist = def;}
0097 
0098     private:
0099 
0100       // internal methods
0101       void   InitInput();
0102       void   InitTree();
0103       void   InitHists();
0104       void   DoAnalysis();
0105       void   SetHistogramStyles();
0106       void   SaveOutput();
0107       void   CloseInput();
0108       void   FillHist1D(const int type, Hist hist);
0109       void   FillHist2D(const int type, Hist hist, VsVar vs);
0110       bool   IsGoodJet(const double pt, const double eta);
0111       bool   IsGoodLambda(const double pt, const double eta);
0112       bool   IsLeadingLambda(const double z);
0113       bool   IsAssociatedLambda(const int idLam, const int idJet);
0114       double GetDeltaPhi(const double phiA, const double phiB);
0115       double GetDeltaEta(const double etaA, const double etaB);
0116 
0117       // inputs
0118       TFile* m_fInput = NULL;
0119       TTree* m_tInput = NULL;
0120 
0121       // histograms
0122       vector<TH1D*>                 vecHistEvt;
0123       vector<vector<TH1D*>>         vecHist1D;
0124       vector<vector<vector<TH2D*>>> vecHist2D;
0125 
0126       // histogram definitions
0127       SReadLambdaJetTreeHistDef m_hist;
0128 
0129       // event-level input leaves
0130       int    m_evtNJets;
0131       int    m_evtNLambdas;
0132       int    m_evtNTaggedJets;
0133       int    m_evtNChrgPars;
0134       int    m_evtNNeuPars;
0135       double m_evtSumEPar;
0136       double m_evtVtxX;
0137       double m_evtVtxY;
0138       double m_evtVtxZ;
0139       // parton input leaves
0140       int    m_partonA_ID;
0141       int    m_partonB_ID;
0142       double m_partonA_Px;
0143       double m_partonA_Py;
0144       double m_partonA_Pz;
0145       double m_partonA_E;
0146       double m_partonB_Px;
0147       double m_partonB_Py;
0148       double m_partonB_Pz;
0149       double m_partonB_E;
0150       // lambda input leaves
0151       vector<int>*    m_lambdaID      = NULL;
0152       vector<int>*    m_lambdaPID     = NULL;
0153       vector<int>*    m_lambdaJetID   = NULL;
0154       vector<int>*    m_lambdaEmbedID = NULL;
0155       vector<double>* m_lambdaZ       = NULL;
0156       vector<double>* m_lambdaDr      = NULL;
0157       vector<double>* m_lambdaEnergy  = NULL;
0158       vector<double>* m_lambdaPt      = NULL;
0159       vector<double>* m_lambdaEta     = NULL;
0160       vector<double>* m_lambdaPhi     = NULL;
0161       // jet input leaves
0162       vector<bool>*     m_jetHasLambda = NULL;
0163       vector<uint64_t>* m_jetNCst      = NULL;
0164       vector<uint64_t>* m_jetID        = NULL;
0165       vector<double>*   m_jetE         = NULL;
0166       vector<double>*   m_jetPt        = NULL;
0167       vector<double>*   m_jetEta       = NULL;
0168       vector<double>*   m_jetPhi       = NULL;
0169       // constituent input leaves
0170       vector<vector<int>>*    m_cstID      = NULL;
0171       vector<vector<int>>*    m_cstPID     = NULL;
0172       vector<vector<int>>*    m_cstJetID   = NULL;
0173       vector<vector<int>>*    m_cstEmbedID = NULL;
0174       vector<vector<double>>* m_cstZ       = NULL;
0175       vector<vector<double>>* m_cstDr      = NULL;
0176       vector<vector<double>>* m_cstEnergy  = NULL;
0177       vector<vector<double>>* m_cstPt      = NULL;
0178       vector<vector<double>>* m_cstEta     = NULL;
0179       vector<vector<double>>* m_cstPhi     = NULL;
0180 
0181       // intput branches
0182       TBranch* m_brEvtNJets       = NULL;
0183       TBranch* m_brEvtNLambdas    = NULL;
0184       TBranch* m_brEvtNTaggedJets = NULL;
0185       TBranch* m_brEvtNChrgPars   = NULL;
0186       TBranch* m_brEvtNNeuPars    = NULL;
0187       TBranch* m_brEvtSumEPar     = NULL;
0188       TBranch* m_brEvtVtxX        = NULL;
0189       TBranch* m_brEvtVtxY        = NULL;
0190       TBranch* m_brEvtVtxZ        = NULL;
0191       TBranch* m_brPartonA_ID     = NULL;
0192       TBranch* m_brPartonB_ID     = NULL;
0193       TBranch* m_brPartonA_Px     = NULL;
0194       TBranch* m_brPartonA_Py     = NULL;
0195       TBranch* m_brPartonA_Pz     = NULL;
0196       TBranch* m_brPartonA_E      = NULL;
0197       TBranch* m_brPartonB_Px     = NULL;
0198       TBranch* m_brPartonB_Py     = NULL;
0199       TBranch* m_brPartonB_Pz     = NULL;
0200       TBranch* m_brPartonB_E      = NULL;
0201       TBranch* m_brLambdaID       = NULL;
0202       TBranch* m_brLambdaPID      = NULL;
0203       TBranch* m_brLambdaJetID    = NULL;
0204       TBranch* m_brLambdaEmbedID  = NULL;
0205       TBranch* m_brLambdaZ        = NULL;
0206       TBranch* m_brLambdaDr       = NULL;
0207       TBranch* m_brLambdaEnergy   = NULL;
0208       TBranch* m_brLambdaPt       = NULL;
0209       TBranch* m_brLambdaEta      = NULL;
0210       TBranch* m_brLambdaPhi      = NULL;
0211       TBranch* m_brJetHasLambda   = NULL;
0212       TBranch* m_brJetNCst        = NULL;
0213       TBranch* m_brJetID          = NULL;
0214       TBranch* m_brJetE           = NULL;
0215       TBranch* m_brJetPt          = NULL;
0216       TBranch* m_brJetEta         = NULL;
0217       TBranch* m_brJetPhi         = NULL;
0218       TBranch* m_brCstID          = NULL;
0219       TBranch* m_brCstPID         = NULL;
0220       TBranch* m_brCstJetID       = NULL;
0221       TBranch* m_brCstEmbedID     = NULL;
0222       TBranch* m_brCstZ           = NULL;
0223       TBranch* m_brCstDr          = NULL;
0224       TBranch* m_brCstEnergy      = NULL;
0225       TBranch* m_brCstPt          = NULL;
0226       TBranch* m_brCstEta         = NULL;
0227       TBranch* m_brCstPhi         = NULL;
0228 
0229       // class-wide constants
0230       struct Const {
0231         double minDPhi;
0232         double maxDPhi;
0233       } m_const = {
0234         -1.*TMath::Pi(),
0235         TMath::Pi()
0236       }; 
0237 
0238   };  // end SReadLambdaJetTree
0239 
0240 }  // end SColdQcdCorrelatorAnalysis namespace
0241 
0242 #endif
0243 
0244 // end ------------------------------------------------------------------------