All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
TJjetsPFOAnalysisProcessor.h
Go to the documentation of this file.
1 #ifndef TJjetsPFOAnalysisProcessor_h
2 #define TJjetsPFOAnalysisProcessor_h 1
3 
4 #include "marlin/Processor.h"
5 #include "StandardIncludes.h"
6 #include "TrueJet_Parser.h"
7 
8 // // TrueJet_Parser can link generator level color singlets (quarks,gluons)
9 // // to the jet particles they produced, thereby allowing comparison of
10 // // correct jet with own clustered one.
11 // #include "Adjusted_TrueJet_Parser.h"
12 
13 
14 class TJjetsPFOAnalysisProcessor : public Processor , public TrueJet_Parser {
15  public:
16  virtual Processor* newProcessor() { return new TJjetsPFOAnalysisProcessor ; }
17 
19 
20  // These two lines avoid frequent compiler warnings when using -Weffc++
23 
24  /** Called at the begin of the job before anything is read.
25  * Use to initialize the processor, e.g. book histograms.
26  */
27  void init() ;
28 
29  /** Called for every run.
30  */
31  void processRunHeader( LCRunHeader* run ) ;
32 
33  /** Called for every event - the working horse.
34  */
35  void processEvent( LCEvent * event ) ;
36 
37  /** For TrueJet_Parser -> see its documentation
38  */
39  std::string get_recoMCTruthLink(){ return _recoMCTruthLink ; } ;
40 
41  void check( LCEvent * event ) ;
42 
43 
44  /** Called after data processing for clean up.
45  */
46  void end() ;
47 
48  protected:
49  /** Definitions using typedef
50  */
51  typedef std::pair< MCParticleVec, ReconstructedParticleVec > JetContentPair;
52  typedef std::vector< JetContentPair* > JetVec;
53  typedef std::vector<const ReconstructedParticle *> ParticleVector;
54  typedef std::vector<const MCParticle*> MCParticleVector;
55  typedef std::set<EVENT::MCParticle*> MCParticleList;
56  typedef std::set<EVENT::MCParticle*> MCParticleSet;
57  typedef std::vector<std::string> StringVector;
58  typedef std::vector<LCRelationNavigator*> LCRelationNavigatorVec;
59 
61 
62  /** Input collection name.
63  */
64  std::string _colAllPFOs{};
65  std::string _colMC{};
66 
67  // Input collections for TrueJet
68  std::string _recoMCTruthLink{};
69 
70 
71  /** Output File specifics
72  */
73  TFile* _otfile{};
74  TTree* _datatrain{};
75 
76 
77  std::string _rootfilename{};
78 
79  template <class Object> bool areDisjointVectors( const std::vector<Object> &v1, const std::vector<Object> &v2 ) const;
80  template <class Object> std::vector<Object> turnVectorOfConstToVector( const std::vector<const Object> &v ) const;
81  void makeNTuple() ;
82  void findTrueJetParticles( LCEvent* event );
83  bool hasSomeParentsInMCList( EVENT::MCParticle *pMCParticle, MCParticleList &mcs) const;
84 
85  /** PFOAnalysis stuff
86  */
87 
88  void Clear();
89 
90  /**
91  * @brief Extract lcio collections
92  *
93  * @param event the lc event
94  */
95  void ExtractCollections(JetContentPair* jet_content);
96 
97  /**
98  * @brief Apply pfo selection rules, starting with root particles
99  *
100  * @param pMCParticle the address of a mc particle (initially call this recursive function with a top-level, root particle)
101  * @param mcPfoCandidates to collect the list of mc pfo candidates
102  */
103  void ApplyPfoSelectionRules(EVENT::MCParticle *pMCParticle, MCParticleList &mcPfoCandidates) const;
104 
105  /**
106  * @brief Make quark variables
107  *
108  * @param event the lc event
109  */
110  void MakeQuarkVariables(JetContentPair* jet_content);
111 
112  /**
113  * @brief Perform pfo analysis
114  */
115  void PerformPfoAnalysis();
116 
117  /**
118  * @brief Sort mc pfo targets by decreasing energy
119  *
120  * @param pLhs the address of the first mc pfo target
121  * @param pRhs the address of the second mc pfo target
122  */
123  static bool SortPfoTargetsByEnergy(const EVENT::MCParticle *const pLhs, const EVENT::MCParticle *const pRhs);
124 
125  int m_nRun{}; ///<
126  int m_nEvt{}; ///<
127  int m_nJet{}; ///<
128 
129  int m_jetInitElPDG{}; ///<
130  int m_jetFinElPDG{}; ///<
131 
132  int m_nRunSum{}; ///<
133  int m_nEvtSum{}; ///<
134 
135  std::string m_inputPfoCollection{}; ///<
136  std::string m_mcParticleCollection{}; ///<
137 
138  int m_printing{}; ///<
139  std::string m_rootFile{}; ///<
140 
142 
146 
149 
150  int m_nPfosTotal{}; ///<
152  int m_nPfosPhotons{}; ///<
153  int m_nPfosTracks{}; ///<
154  float m_pfoEnergyTotal{}; ///<
156  float m_pfoEnergyPhotons{}; ///<
157 
158  float m_pfoEnergyTracks{}; ///<
159  float m_pfoECalToEmEnergy{}; ///<
160  float m_pfoECalToHadEnergy{}; ///<
161  float m_pfoHCalToEmEnergy{}; ///<
162  float m_pfoHCalToHadEnergy{}; ///<
163  float m_pfoMuonToEnergy{}; ///<
164  float m_pfoOtherEnergy{}; ///<
165 
166  float m_pfoMassTotal{}; ///<
167 
168  typedef std::vector<float> FloatVector;
174 
180 
181  typedef std::vector<int> IntVector;
184 
185  int m_nPfoTargetsTotal{}; ///<
189 
194 
195  float m_mcEnergyENu{}; ///<
196  float m_mcEnergyFwd{}; ///<
197  float m_eQQ{}; ///<
198  float m_eQ1{}; ///<
199  float m_eQ2{}; ///<
200  float m_costQQ{}; ///<
201  float m_costQ1{}; ///<
202  float m_costQ2{}; ///<
203  float m_mQQ{}; ///<
204  float m_thrust{}; ///<
205  int m_qPdg{}; ///<
206 
207  TFile *m_pTFile{}; ///<
208  TTree *m_pTTree{}; ///<
209  TH1F *m_hPfoEnergySum{}; ///<
210  TH1F *m_hPfoEnergySumL7A{}; ///<
211 
212 } ;
213 
214 // Include other headers with definition of template functions at end
215 #include "VectorHelper.h"
216 #endif
TJjetsPFOAnalysisProcessor & operator=(const TJjetsPFOAnalysisProcessor &)=delete
void ApplyPfoSelectionRules(EVENT::MCParticle *pMCParticle, MCParticleList &mcPfoCandidates) const
Apply pfo selection rules, starting with root particles.
bool areDisjointVectors(const std::vector< Object > &v1, const std::vector< Object > &v2) const
Definition: VectorHelper.h:5
std::set< EVENT::MCParticle * > MCParticleList
void MakeQuarkVariables(JetContentPair *jet_content)
Make quark variables.
void end()
Called after data processing for clean up.
std::vector< Object > turnVectorOfConstToVector(const std::vector< const Object > &v) const
std::vector< LCRelationNavigator * > LCRelationNavigatorVec
std::vector< std::string > StringVector
std::string _colAllPFOs
Input collection name.
TFile * _otfile
Output File specifics.
std::string get_recoMCTruthLink()
For TrueJet_Parser -&gt; see its documentation.
std::set< EVENT::MCParticle * > MCParticleSet
void init()
Called at the begin of the job before anything is read.
std::vector< const MCParticle * > MCParticleVector
void processRunHeader(LCRunHeader *run)
Called for every run.
void findTrueJetParticles(LCEvent *event)
void PerformPfoAnalysis()
Perform pfo analysis.
void ExtractCollections(JetContentPair *jet_content)
Extract lcio collections.
void Clear()
PFOAnalysis stuff.
std::vector< JetContentPair * > JetVec
static bool SortPfoTargetsByEnergy(const EVENT::MCParticle *const pLhs, const EVENT::MCParticle *const pRhs)
Sort mc pfo targets by decreasing energy.
bool hasSomeParentsInMCList(EVENT::MCParticle *pMCParticle, MCParticleList &mcs) const
std::pair< MCParticleVec, ReconstructedParticleVec > JetContentPair
Definitions using typedef.
std::vector< const ReconstructedParticle * > ParticleVector
void processEvent(LCEvent *event)
Called for every event - the working horse.