All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
ErrorFlow.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: ErrorFlow.h
5  *
6  * Description: The ErrorFlow processor computes jet-specific energy uncertainty
7  * by summing up the uncertainty of individual particles clustered
8  * in a jet object.
9  * The processor updates the covariance matrix of the jet object with
10  * the computed energy uncertainty and creates a ROOT tree with
11  * breanches for PFO multiplicities and various terms contributing to
12  * the total jet energy uncertainty.
13  *
14  * Version: 1.0
15  * Created: 08/20/2015 03:22:32 PM
16  * Revision: none
17  * Compiler: gcc
18  *
19  * Author: Aliakbar Ebrahimi (aliakbar.ebrahimi@desy.de),
20  * Organization: DESY
21  *
22  * =====================================================================================
23  */
24 
25 #ifndef ERRORFLOW_H
26 #define ERRORFLOW_H 1
27 
28 /* ##### HEADER FILE INCLUDES ################################################### */
29 #include "marlin/Processor.h"
30 #include "lcio.h"
31 #include <string>
32 
33 #include <TTree.h>
34 #include <EVENT/ReconstructedParticle.h>
35 
36 using namespace lcio ;
37 using namespace marlin ;
38 
39 /*
40  * =====================================================================================
41  * Class: ErrorFlow
42  * Description:
43  * =====================================================================================
44  */
45 class ErrorFlow : public Processor
46 {
47 public:
48  /* ==================== LIFECYCLE ======================================= */
49  virtual Processor* newProcessor() { return new ErrorFlow; }
50  ErrorFlow (); /* constructor */
51 
52  /** Called at the begin of the job before anything is read.
53  * Use to initialize the processor, e.g. book histograms.
54  */
55  virtual void init() ;
56 
57  /** Called for every run.
58  */
59  virtual void processRunHeader( LCRunHeader* run ) ;
60 
61  /** Called after data processing for clean up.
62  */
63  virtual void end() ;
64 
65  /* ==================== ACCESSORS ======================================= */
66 
67  /* ==================== MUTATORS ======================================= */
68  void resetVariables();
69 
70  /* ==================== OPERATORS ======================================= */
71  /* Computes confusion terms for a jet */
72  double * getRelativeConfusion( double jetEnergy,
73  double chargedHadronsEnergy,
74  double photonsEnergy,
75  double neutralHadronsEnergy,
76  double relConfTerms[]
77  );
78 
79  /** Called for every event - the working horse.
80  */
81  virtual void processEvent( LCEvent * evt ) ;
82 
83  virtual void check( LCEvent * evt ) ;
84 
85 protected:
86  /* ==================== METHODS ======================================= */
87  // Computes energy uncertainty SQUARED for photons
88  double getPhotonSigmaESqr ( double t_phEnergy );
89  // Computes energy uncertainty SQUARED for neutral hadrons
90  double getNeuHadSigmaESqr ( double t_neuHadEnergy );
91 
92  // Compute total momentum from 3-momentum
93  double getTotalMomentum ( const double * t_threeMomentum );
94 
95  /* ==================== DATA MEMBERS ======================================= */
96 
97  /** Input collection name.
98  */
99  std::string p_inputJetCollection {};
100  std::string p_outputJetCollection {};
101  std::string p_inputMCTruth {};
102 
103  // Semi-leptonic correction
104  bool p_semiLepCorrection {}; /* Add semi-leptonic energy resolution to the covariance matrix */
105  bool p_confusionterm {}; /* Add uncertainty due to confusion to the covariance matrix */
106  bool p_propagateConfusiontoMomentumComp {}; /* Propagate uncertainty due to confusion to the Momentum components */
107  double p_semiLepSigmaCorrFactor {}; /* A correction factor to be multiplied by total lepton energy to get semi-leptonic uncertainty */
108  double p_CovMatFactorPhotons {}; /* A correction factor to be multiplied to angular uncertainties of photons */
109  double p_CovMatFactorNeutralHadrons {}; /* A correction factor to be multiplied to angular uncertainties of Neutral Hadrons */
110 
111  // Confusion scale factor
112  double p_scaleConf {}; /* A factor to use to scale confusion term */
113 
114  // Calorimeter resolution parameters
115  double p_aECAL {}; /* Stochastic term coefficient in ECAL resolution */
116  double p_cECAL {}; /* Constant term coefficinet in ECAL resolution */
117  double p_aHCAL {}; /* Stochastic term coefficient in HCAL resolution */
118  double p_cHCAL {}; /* Constant term coefficient in HCAL resolution */
119 
120  // Confusion scale factor
121  bool p_storeTree {}; /* Enable/disable storing in a ROOT tree */
122  bool p_useFullCovMatNeut {}; /* Enable/disable using full CovMat for neutral PFOs */
123 
124  // Counters for PFOs
125  int numChargedPFOs {}; /* Number of charged PFOs in a jet */
126  int numPhotons {}; /* Number of photons in a jet */
127  int numNeutralPFOs {}; /* Number of charged PFOs in a jet */
128 
129  // Energy of PFOs
130  double eChargedPFOs {}; /* Total energy of charged PFOs in a jet */
131  double ePhotons {}; /* Total energy of photons in a jet */
132  double eNeutralPFOs {}; /* Total energy of neutral PFOs in a jet */
133  double eJetTotal {}; /* Sum of energy of all PFOs */
134  double eLeptonsTotal {}; /* Sum of energy of all leptons in a jet */
135 
136  // Resolution
137  double absDetResSquared {}; /* Total absolute detector resolution */
138  double relConfCharged {}; /* Relative confusion term for charged PFOs */
139  double relConfPhotons {}; /* Relative confusion term for photons */
140  double relConfNeutral {}; /* Relative confusion term for neutral PFOs */
141  double relConfSquared {}; /* Total relative confusion squared */
142  double absConfSquared {}; /* Total absolute confusion squared */
143  double absSemiLepResSquared {}; /* Total absolute semi-leptonic resolution */
144 
145  int p_nRun {};
146  int p_nEvt {};
147 
148 private:
149  /* ==================== METHODS ======================================= */
150 
151  /* ==================== DATA MEMBERS ======================================= */
152  std::shared_ptr<TTree> tree {};
153  ReconstructedParticleVec::size_type nPFOs {};
154 }; /* ----- end of class ErrorFlow ----- */
155 
156 #endif
virtual Processor * newProcessor()
Definition: ErrorFlow.h:49