ATLAS Offline Software
MissingEtTruth.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: MissingEtTruth.cxx
8 PACKAGE: offline/Reconstruction/MissingETEvent
9 
10 AUTHORS: P. Loch, S. Resconi
11 CREATED: Oct 2004
12 
13 PURPOSE:
14 ********************************************************************/
18 
19 #include "CLHEP/Vector/LorentzVector.h"
20 #include "CLHEP/Units/SystemOfUnits.h"
22 
23 
25 {
26  this->setup();
27 }
28 
30  : MissingET(MissingET::Truth,aRegion)
31 {
32  this->setup();
33 }
34 
36  MissingEtRegions* aRegion)
37  : MissingET(aSource,aRegion)
38 {
39  this->setup();
40 }
41 
43 {
44  this->setup();
45 }
46 
48 {
49 
50  double weight = 1.;
51  double exp = (Part)->momentum().px();
52  double eyp = (Part)->momentum().py();
53  double etp = (Part)->momentum().perp();
54  double etap = (Part)->momentum().pseudoRapidity();
55  int idp = (Part)->pdg_id();
56 
57  TruthIndex thePart = NotValid;
58 
59  if ( ! MC::isSimInteracting(Part) ) // if IsGenNonInteracting returns true
60  {
61  thePart = NonInt; // all NON interacting particles (neutrinos + SUSY particles)
62  m_exTruth[NonInt] += exp;
63  m_eyTruth[NonInt] += eyp;
64  m_etSumTruth[NonInt] += etp;
65 
66  } else {
67  if (abs(idp) != 13) // all interacting particles and NO muons
68  {
69  if( fabs(etap) <= 5.) {
70  // update the global sums and eta regions in eta <= 5
71  this->add(exp, eyp, etp, etap, weight);
72  m_exTruth[Int] -= exp;
73  m_eyTruth[Int] -= eyp;
74  m_etSumTruth[Int] += etp;
75  //thePart = Int;
76  }
77  if( fabs(etap) <= etaFull) thePart = IntCentral;
78  if( fabs(etap) > etaFull && fabs(etap) <= 5.) thePart = IntFwd;
79  if( fabs(etap) > 5.) thePart = IntOutCover;
80  } else {
81  //if (etp > 6000. && fabs(etap) <= 2.5) // select "measurable" muons
82  //{
83  thePart = Muons; // all muons
84  //}
85  }
86 
87  if (thePart != NotValid) { // Can be == if etap is a nan !! Fixed by Scott Snyder
88  m_exTruth[(size_t)thePart] -= exp;
89  m_eyTruth[(size_t)thePart] -= eyp;
90  m_etSumTruth[(size_t)thePart] += etp;
91  }
92 
93  }
94 
95 
96 
97 }
98 
99 
100 //set methods
101 
103  double theEx)
104 {
105  if ( theTruth < Size ) m_exTruth[(size_t)theTruth] = theEx;
106 }
107 
108 
110  double theEy)
111 {
112  if ( theTruth < Size ) m_eyTruth[(size_t)theTruth] = theEy;
113 }
114 
115 
117  double theEtSum)
118 {
119  if ( theTruth < Size ) m_etSumTruth[(size_t)theTruth] = theEtSum;
120 
121 }
122 
123 
124 void MissingEtTruth::setExTruthVec(std::vector<double>&& exTruthVec)
125 {
126  assert (exTruthVec.size() == Size);
127  m_exTruth = std::move (exTruthVec);
128 }
129 
130 
131 void MissingEtTruth::setEyTruthVec(std::vector<double>&& eyTruthVec)
132 {
133  assert (eyTruthVec.size() == Size);
134  m_eyTruth = std::move (eyTruthVec);
135 }
136 
137 
138 void MissingEtTruth::setEtSumTruthVec(std::vector<double>&& etSumTruthVec)
139 {
140  assert (etSumTruthVec.size() == Size);
141  m_etSumTruth = std::move (etSumTruthVec);
142 }
143 
144 
145 // get methods
146 
148 {
149  return m_exTruth[theTruth] ;
150 }
151 
153 {
154  return m_eyTruth[theTruth] ;
155 }
156 
158 {
159  return m_etSumTruth[theTruth] ;
160 }
161 
162 
163 const std::vector<double>& MissingEtTruth::exTruthVec() const
164 {
165  return m_exTruth;
166 }
167 
168 
169 const std::vector<double>& MissingEtTruth::eyTruthVec() const
170 {
171  return m_eyTruth;
172 }
173 
174 
175 const std::vector<double>& MissingEtTruth::etSumTruthVec() const
176 {
177  return m_etSumTruth;
178 }
179 
180 
182 {
183  // initialize data members
184 
185  m_exTruth.resize(MissingEtTruth::Size,0.);
186  m_eyTruth.resize(MissingEtTruth::Size,0.);
188 }
189 
MissingEtTruth::NotValid
@ NotValid
Definition: MissingEtTruth.h:60
MissingEtRegions
Definition: MissingEtRegions.h:22
MissingET.h
MissingEtTruth::addPart
void addPart(HepMC::ConstGenParticlePtr aPart, double etaFull)
Definition: MissingEtTruth.cxx:47
MissingEtTruth::setEyTruth
void setEyTruth(TruthIndex aTruth, double theEy)
Definition: MissingEtTruth.cxx:109
MissingEtTruth::exTruth
double exTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:147
MissingEtTruth::exTruthVec
const std::vector< double > & exTruthVec() const
Definition: MissingEtTruth.cxx:163
MissingEtTruth::Int
@ Int
Definition: MissingEtTruth.h:51
MissingET::Source
Source
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:38
MissingEtTruth::IntOutCover
@ IntOutCover
Definition: MissingEtTruth.h:57
MissingEtTruth::setup
void setup()
Definition: MissingEtTruth.cxx:181
MissingEtTruth::m_eyTruth
std::vector< double > m_eyTruth
Definition: MissingEtTruth.h:87
MissingEtTruth::IntCentral
@ IntCentral
Definition: MissingEtTruth.h:53
MissingEtTruth::TruthIndex
TruthIndex
Definition: MissingEtTruth.h:41
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
MissingEtTruth::setEtSumTruthVec
void setEtSumTruthVec(std::vector< double > &&etSumCaloVec)
Definition: MissingEtTruth.cxx:138
MissingEtTruth::NonInt
@ NonInt
Definition: MissingEtTruth.h:52
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
egammaParameters::etap
@ etap
pointing eta reconstructed from the cluster (first and second sampling)
Definition: egammaParamDefs.h:274
MissingEtTruth::m_etSumTruth
std::vector< double > m_etSumTruth
Definition: MissingEtTruth.h:88
MissingEtTruth::~MissingEtTruth
virtual ~MissingEtTruth()
Definition: MissingEtTruth.cxx:42
Truth
Definition: ITruthClassificationTool.h:16
MissingEtTruth::m_exTruth
std::vector< double > m_exTruth
Definition: MissingEtTruth.h:86
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
MissingEtTruth::etSumTruthVec
const std::vector< double > & etSumTruthVec() const
Definition: MissingEtTruth.cxx:175
MissingEtTruth::eyTruthVec
const std::vector< double > & eyTruthVec() const
Definition: MissingEtTruth.cxx:169
MissingEtTruth::MissingEtTruth
MissingEtTruth()
Definition: MissingEtTruth.cxx:24
MissingEtTruth::Size
@ Size
Definition: MissingEtTruth.h:59
MissingEtTruth::eyTruth
double eyTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:152
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
MissingEtRegions.h
MissingEtTruth.h
MissingEtTruth::IntFwd
@ IntFwd
Definition: MissingEtTruth.h:55
MissingEtTruth::setExTruthVec
void setExTruthVec(std::vector< double > &&exCaloVec)
Definition: MissingEtTruth.cxx:124
MissingET::add
virtual void add(double theEx, double theEy, double theEt, double theEta, double weight)
Definition: MissingET.cxx:127
MissingEtTruth::setEyTruthVec
void setEyTruthVec(std::vector< double > &&exCaloVec)
Definition: MissingEtTruth.cxx:131
MissingET
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:23
DetType::Part
Part
Definition: DetType.h:14
MC::isSimInteracting
bool isSimInteracting(const T &p)
Identify if the particle could interact with the detector during the simulation, e....
Definition: HepMCHelpers.h:42
MissingEtTruth::Muons
@ Muons
Definition: MissingEtTruth.h:58
MissingEtTruth::setEtSumTruth
void setEtSumTruth(TruthIndex aTruth, double theEtSum)
Definition: MissingEtTruth.cxx:116
MissingEtTruth::etSumTruth
double etSumTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:157
HepMCHelpers.h
MissingEtTruth::setExTruth
void setExTruth(TruthIndex aTruth, double theEx)
Definition: MissingEtTruth.cxx:102