All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
TrueJet.h
Go to the documentation of this file.
1 #ifndef TrueJet_h
2 #define TrueJet_h 1
3 
4 #include "marlin/Processor.h"
5 #include "lcio.h"
6 #include <EVENT/LCCollection.h>
7 #include <EVENT/MCParticle.h>
8 #include <EVENT/ReconstructedParticle.h>
9 #include <EVENT/LCRelation.h>
10 #include <UTIL/LCRelationNavigator.h>
11 #include "IMPL/LCCollectionVec.h"
12 #include <IMPL/ReconstructedParticleImpl.h>
13 #include <IMPL/ParticleIDImpl.h>
14 #include <string>
15 
16 
17 using namespace lcio ;
18 using namespace marlin ;
19 
20 
21 /** Example processor for marlin.
22  *
23  * If compiled with MARLIN_USE_AIDA
24  * it creates a histogram (cloud) of the MCParticle energies.
25  *
26  * <h4>Input - Prerequisites</h4>
27  * Needs the collection of MCParticles.
28  *
29  * <h4>Output</h4>
30  * A histogram.
31  *
32  * @param CollectionName Name of the MCParticle collection
33  *
34  * @author F. Gaede, DESY
35  * @version $Id: TrueJet.h,v 1.4 2005-10-11 12:57:39 gaede Exp $
36  */
37 
38 class TrueJet : public Processor {
39 
40  public:
41 
42  virtual Processor* newProcessor() { return new TrueJet ; }
43 
44 
45  TrueJet() ;
46 
47  TrueJet& operator=(const TrueJet&) = delete ;
48  TrueJet(const TrueJet&) = delete ;
49 
50  /** Called at the begin of the job before anything is read.
51  * Use to initialize the processor, e.g. book histograms.
52  */
53  virtual void init() ;
54 
55  /** Called for every run.
56  */
57  virtual void processRunHeader( LCRunHeader* run ) ;
58 
59  /** Called for every event - the working horse.
60  */
61  virtual void processEvent( LCEvent * evt ) ;
62 
63 
64  virtual void check( LCEvent * evt) ;
65 
66 
67  /** Called after data processing for clean up.
68  */
69  virtual void end() ;
70 
71  void readback( LCEvent * evt);
72 
73 
74  protected:
75 
76  /** Input collection name.
77  */
78  std::string _MCParticleColllectionName{};
79  std::string _recoParticleCollectionName{};
80  std::string _recoMCTruthLink{};
81  /** ouput collection names. The corresponding collections are filled from the internal data structues at the end of processEvent */
82  std::string _trueJetCollectionName{};
83  std::string _finalColourNeutralCollectionName{};
84  std::string _initialColourNeutralCollectionName{};
85  std::string _trueJetPFOLink{};
86  std::string _trueJetMCParticleLink{};
87  std::string _finalElementonLink{};
88  std::string _initialElementonLink{};
89  std::string _finalColourNeutralLink{};
90  std::string _initialColourNeutralLink{};
91  int _nRun{};
92  int _nEvt{};
93 
94 
95 private:
96 
97  void getPyjets(LCCollection* mcpcol);
98  void stdhep_reader_bug_workaround( int line94 );
99  void true_lepton();
100  void cluster();
101  void string();
102  void assign_jet(int jet1,int jet2,int this_fafp);
103  void first_parton(int this_partic,int this_jet,int& first_partic,int& last_94_parent,int& nfsr,int& info,int& info2);
104  int flavour(int k2) ;
105  void isr() ;
106  void photon();
107  void grouping() ;
108  LCEvent * evt{};
109 
110  // The information in the MCParticleCollection, recast into "pyjets"
111  // format. This is the structure the processor works with internally.
112  // Note that line-numbering starts at 1, not 0
113 
114  // getting from one to the other:
115  // mcp_pyjets[k_py]=mcp gets the MCParticle corresponding to a pythia-line
116  // i_py= mcp->ext<MCPpyjet>() gets the pythia-line of an MCParticle.
117 
118  double p[4001][6]{}; // p,E and M - direct copy from the MCParticle
119  int k[4001][9]{}; // status, pid, and history information:
120  // 1:status , 2:pdg, 3:(first) mother, 4&5 first and last daugther,
121  // 6: last mother, 7&8; colour&anti-colour code
122 
123  // history codes (3,4,5,6) refers to the line (first index) of p and k.
124  // The first and last daugther codes always indicate a consecutive
125  // set of lines with the same mother, while between the first and last mother
126  // lines, there can be lines *not* having the daughter in question, so
127  // a loop-n-check between thes two is always needed!
128 
129  // status codes: 0:created in simulation, 1: stable, 11:decaying,
130  // 21:documentation. Any of these +30: particle is overlay
131 
132  // pdg: either the particle pdg code, or one of Pythia's internal
133  // codes: 91; cluster, i.e. a hadron created *during* the parton-shower
134  // 92: string, i.e. the object that is the parent of all hadrons at the
135  // end of the parton-shower. It's direct parent is a group of lines,
136  // starting and ending with quarks, with a number of colour-conected
137  // gluons inbetween. 94: a many-to-many object used to allow to redistribute
138  // four-momentum between it's components (total 4-mom conserved)
139 
140  // Note than k is *not* a direct copy of the information in the MCParticle.
141  // In particular, many idiosyncarcies are corrected for - mostly concerning
142  // 94 objects. Also the (inaptly named) colour-code is sometimes also used
143  // for leptons, to indicate how these should be grouped, in case the generator
144  // information contains hints of this.
145 
146  int nlund{}; // number of entries in this event
147  MCParticleVec mcp_pyjets{}; // Cross-reference
148 
149  // final results of the processor at particle level:
150 
151  int jet[4001]{}; // Jet number of the particle
152  int companion[4001]{}; // Associated jet (i.e. the jet that creates a colour-neutral
153  // object together with the jet this particle belongs to)
154 
155  int current_jet{};
156  int first_line{};
157 
158  // final results of the processor at jet level:
159  // TYPE jets_summary_t
160  int njet{}; // number of jets found
161  int n_djb{}; // number of initial di-jets (=colour neutrals)
162  int n_dje{}; // number of final di-jets (=colour neutrals), If there are no gluon-splitting in the P.S.
163  // n_djb = n_dje.
164  int nstr{}; // number of strings
165  int n_hard_lepton{};// number of hard (ME) leptons
166  int nboson{}; // number of bosons (normally gluons) yielding ffbar pairs *during* the P.S.
167  int nclu{}; // number of "clusters", i.e. hadrons created *during* the P.S. They have two quark parents,
168  // so even if there is only one hadron created (usually, but not always the case), there will be
169  // an empty jet.
170  int nisr{}; // number of ISRs
171  int nphot{}; // number of M.E. photons (not counting ISR)
172  int n_mixed{}; // number of "mixed" jets - jets with final particles from different true jets. should be 0
173  int n_jetless{}; // number of jets with no assigned identy. should be 0
174  int n_2jet_clu{}; // number of clusters actually giving two non empty jets (see above)
175  int n_0_E_jets{}; // number of empty (zero energy) jets - typically from clusters (see above)
176  int n_beam_jet{}; // number of beam (overlay) jets. Either 1 or 0 (is there was no overlay at all in the event)
177 
178 
179  // TYPE jet_t // Index in the following is the jet-number, and when the variable refers to a particle,
180  // the line in pyjets is implied
181 
182  int fafp_last[26]{}; // fafp = fermion-antifermion pair. _last is the last created = the first if there was no gluon splitting
183  // or from a W from eg a top decay
184  int elementon[26]{}; // I just invented that word (collective for quarks, leptons and elementary bosons)
185  // The elemeton is the particle directly before the final hadrons or leptons
186  // for hadrons, it would be the two last-generation quarks, for leptons usually simply the
187  // initial leptons.
188  int boson[26]{}; // boson (gluons) inside the P.S. giving qqbars
189  int fafp_boson[26]{}; // fafp of the boson creating this jet.
190  int fafp[26]{}; // first fafp of the jet = either fafp_last (jet not from boson) or fafp_boson (jet from boson)
191  int nfsr[26]{}; // number of FSR photons
192  int type[26]{}; // type of the jet: 1:string, 2:lepton, 3:cluster, 4:ISR, 5:overlay, 6:ME photon
193  int group[26][26]{}; // group this jet belongs to.
194  int dijet_begining[26]{}; // the initial di-jet of the jet. the fafp:s of all jets in this group is the initial fafp ie.
195  // ie the fermion anti-fermion pair the boson directly decayed to. A colour singlet.
196  int dijet_end[26]{}; // idem for the final di-jet (could be the same as the initial, or could be gluon/W induced)
197  double tmom[26][3]{}; // true momentum
198  double tE[26]{}; // true energy.
199 
200  //TYPE dijet_t (begin)
201  int jets_begin[26][26]{}; // list of jets the initial colour singlet gives rise to
202 
203  //TYPE dijet_t (end)
204  int jets_end[26][26]{}; // list of jets the final colour singlet gives rise to
205 
206  bool _whiz1 = false ;
207  bool _top_event = false ;
208  bool _higgs_to_glue_glue = false ;
209 } ;
210 
211 #endif
212 
213 
214 
Example processor for marlin.
Definition: TrueJet.h:38
virtual Processor * newProcessor()
Definition: TrueJet.h:42
static const float k