All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
TruthVertexFinder.hh
Go to the documentation of this file.
1 #ifndef TruthVertexFinder_h
2 #define TruthVertexFinder_h 1
3 #include <stdlib.h>
4 #include <iostream>
5 #include <vector>
6 #include <iomanip>
7 #include <EVENT/LCCollection.h>
8 #include <IMPL/LCCollectionVec.h>
9 #include <EVENT/MCParticle.h>
10 #include <EVENT/Vertex.h>
11 #include "marlin/VerbosityLevels.h"
12 #include "streamlog/streamlog.h"
13 #include "marlin/Processor.h"
14 #include "lcio.h"
15 
16 // ----- include for verbosity dependend logging ---------
17 #include <string>
18 #include <TFile.h>
19 #include <TTree.h>
20 #include <map>
21 
22 #include "ConstantStorage.hh"
23 #include "MathOperator.hh"
24 #include "MCOperator.hh"
25 #include "VertexMCOperator.hh"
26 #include "MyVertex.hh"
27 using namespace lcio ;
28 using namespace marlin ;
29 
30 
31 namespace TTbarAnalysis
32 {
33  ////////////////////////////////////////////////////////
34  /// This processor is designed to extruct a secondary///
35  /// vertices from collection of generated particles, ///
36  /// by using a PDG type and daughter/parent relation ///
37  /// relations. ///
38  /// TruthVertexFinder has two main outputs: ///
39  /// EGProngs - MCParticle type with parameters ///
40  /// MCVertex - Vertex type with particles ///
41  /// For more info and usage please see doc/ folder ///
42  ////////////////////////////////////////////////////////
43  /// Author: BILOKIN Sviatoslav, PhD student ///
44  /// POESCHL Roman, Supervisor ///
45  /// RICHARD Francois, Supervisor ///
46  /// designed: 2015-2017 ///
47  ////////////////////////////////////////////////////////
48  class TruthVertexFinder : public Processor
49  {
50 
51  public:
52 
53  TruthVertexFinder(const TruthVertexFinder&) = delete;
54  TruthVertexFinder& operator=(const TruthVertexFinder&) = delete;
55 
56  virtual Processor* newProcessor() { return new TruthVertexFinder ; }
57 
58 
60 
61  virtual void init() ;
62  virtual void processRunHeader( LCRunHeader* run ) ;
63  virtual void processEvent( LCEvent * evt ) ;
64  virtual void check( LCEvent * evt ) ;
65  virtual void end() ;
66  /////////////////CUSTOM///////////////////////////
67  void PrintParticle(MCParticle * particle);
68  void PrintChain(std::vector< MCParticle * > * chain);
69 
70  void WriteVertexCollection(LCEvent * evt, std::vector< Vertex * > * bvertexes, std::vector< Vertex * > * bbarvertexes);
71  void Write(std::vector< EVENT::Vertex * > * vertices, int & number);
72  void Write(MCOperator & opera,DecayChain * chain, std::vector< Vertex * > * bvertexes);
73  void AddProngs( VertexMCOperator & vertexOperator, MCOperator & opera, DecayChain * chain, std::vector< Vertex * > * vertices, std::vector<int> & parameters, IMPL::LCCollectionVec * col = NULL);
74  void Write(const std::vector< MCParticle * > particle , int v);
75  double getMissingPt(const std::vector< MCParticle * > & bdaugthers, const std::vector< MCParticle * > & cdaughters, Vertex * vertex);
76  void WriteQuarksCollection(LCEvent * evt, std::vector< MCParticle * > & quarks);
77  void WriteMisReco(std::vector< MCParticle * > * particles);
78  void GetAsymmetry(std::vector< MCParticle * > & particles);
79  void ClearVariables();
80  protected:
81 
82  // Input/output collection names
83 
84  std::string _colName{} ;
85  std::string _outputcolName{};
86  std::string _outputquarkcolName{};
87  std::string _outputBStarName{};
88  std::string _outputProngsName{};
89  std::string _colRelName{};
90  std::string _outputBbarStarName{};
91 
92  // Parameters
93 
94  std::vector<PDGTYPE> _pdgs{};
95  IntVec inputPdg{};
96  int _tagParameter{};
97  int _initialQuarkPDGparameter{};
98  float _aParameter{};
99  float _bParameter{};
100  int _writeBonlyParameter{};
101  int _writeROOTparameter{};
102 
103  // Root variables
104  TFile * _hfile{};
105  TTree * _hTree{};
106  TTree * _hVertexTree{};
107  TTree * _hTrackTree{};
108  TTree * _hBStarTree{};
109  TTree * _hMisRecoTree{};
110  std::string _hfilename{};
111 
112  // Inner variables
113  int _tag{};
114  int _numberOfB0{};
115  float _firstVertexDistance[2]{};
116  float _secondVertexDistance[2]{};
117  int _totalBcharge{};
118  int _ccharge{};
119  int _cbarcharge{};
120  int _bcharge{};
121  int _bbarcharge{};
122  float _baccuracy{};
123  float _bbaraccuracy{};
124  float _bIPdistance{};
125  float _bbarIPdistance{};
126  float _btracks{};
127  float _bbartracks{};
128  float _ctracks{};
129  float _cbartracks{};
130  float _bdistance{};
131  float _bbardistance{};
132  float _bmomentum{};
133  float _bbarmomentum{};
134  float _cmomentum{};
135  float _cbarmomentum{};
136  float _caccuracy{};
137  float _cbaraccuracy{};
138  int _bnumber{};
139  int _bbarnumber{};
140  int _cnumber{};
141  int _cbarnumber{};
142  int _btotalnumber{};
143  int _bbartotalnumber{};
144  int _bnumber_f{};
145  int _bbarnumber_f{};
146  int _cnumber_f{};
147  int _cbarnumber_f{};
148  float _bptmiss{};
149  float _bbarptmiss{};
150  float _cosquark{};
151  float _cosantiquark{};
152 
153 
154  static const int MAXV = 15;
155  int _numberOfVertexes{};
156  float _distanceFromIP[MAXV]{};
157  float _coordinates[MAXV][3]{};
158  int _PDG[MAXV]{};
159  int _generation[MAXV]{};
160  int _charge[MAXV]{};
161  int _numberOfParticles[MAXV]{};
162  float _energyOfParticles[MAXV][MAXV]{};
163  float _momentumOfParticles[MAXV][MAXV]{};
164  float _massOfParticles[MAXV][MAXV]{};
165  int _interactionOfParticles[MAXV][MAXV]{};
166 
167  float _bptrack[MAXV]{};
168  float _betatrack[MAXV]{};
169  float _boffsettrack[MAXV]{};
170  float _bbarptrack[MAXV]{};
171  float _bbaretatrack[MAXV]{};
172  float _bbaroffsettrack[MAXV]{};
173  float _cptrack[MAXV]{};
174  float _cetatrack[MAXV]{};
175  float _coffsettrack[MAXV]{};
176  float _cbarptrack[MAXV]{};
177  float _cbaretatrack[MAXV]{};
178  float _cbaroffsettrack[MAXV]{};
179 
180  static const int MAXVV = 30;
181  int _misreconumber{};
182  float _misrecotheta[MAXVV]{};
183  float _misrecocostheta[MAXVV]{};
184  float _misrecomomentum[MAXVV]{};
185  float _misrecopt[MAXVV]{};
186 
187  int _bstarnumber{};
188  float _bstarmomentum[MAXV]{};
189  float _bstaroffset[MAXV]{};
190  double ip[3]{};
191  int _nRun{} ;
192  int _nEvt{} ;
193  } ;
194 } /* TTbarAnalysis */
195 #endif
virtual Processor * newProcessor()
std::vector< LCCollection * > LCCollectionVec
Definition: SiStripClus.h:55
This processor is designed to extruct a secondary/// vertices from collection of generated particles...