ATLAS Offline Software
MissingMassOutput.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Class handling the output of the MissingMassCalculator
6 // author Michael Huebner <michael.huebner@no.spam.cern.ch>
7 
8 // Local include(s):
10 
11 using namespace DiTauMassTools;
12 using ROOT::Math::PtEtaPhiMVector;
13 using ROOT::Math::XYVector;
14 
15 // Default Constructor
17 }
18 
19 // Default Desctructor
21 }
22 
23 //------- clearing output
24 void MissingMassOutput::ClearOutput(bool fUseVerbose) {
25 
26  if(fUseVerbose == 1){ Info("DiTauMassTools", "MissingMassCalculator::ClearOutput()"); }
27  m_FitStatus=0;
28 
29  for (int imeth=0; imeth<MMCFitMethod::MAX; ++imeth)
30  {
31  if(fUseVerbose == 1){ Info("DiTauMassTools", "%s", ("MissingMassCalculator::ClearOutput(): clearing for method "+std::to_string(imeth)).c_str()); }
32  m_FitSignificance[imeth] = -1.0;
33  m_FittedMass[imeth] = 0.0;
34  m_nuvec1[imeth].SetPxPyPzE(0.0,0.0,0.0,0.0);
35  m_objvec1[imeth].SetPxPyPzE(0.0,0.0,0.0,0.0);
36  m_nuvec2[imeth].SetPxPyPzE(0.0,0.0,0.0,0.0);
37  m_objvec2[imeth].SetPxPyPzE(0.0,0.0,0.0,0.0);
38  m_totalvec[imeth].SetPxPyPzE(0.0,0.0,0.0,0.0);
39  m_FittedMetVec[imeth].SetXY(0.0,0.0);
40  }
41 
42  m_RMS2MPV = 0.0;
43 
44  return;
45 }
46 
47 
48 // return fit status
50  return m_FitStatus;
51 }
52 
53 // returns fit significance
54 double MissingMassOutput::GetFitSignificance(int fitcode) const {
55  double signif = -1.0;
56  if (fitcode<0 || fitcode >= MMCFitMethod::MAX) {
57  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetFitSignificance ERROR ! fitcode="+std::to_string(fitcode)
58  +". Should be between 0 and "+std::to_string(MMCFitMethod::MAX-1)).c_str());
59  } else {
60  signif = m_FitSignificance[fitcode];
61  }
62 
63  return signif;
64 }
65 
66 // returns RMS/MPV according to histogram method
68  return m_RMS2MPV;
69 }
70 
71 // returns fitted Mass
72 double MissingMassOutput::GetFittedMass(int fitcode) const {
73  // 0 best parameter space
74  // 1 best mass
75  // best nu from hist
76  double mass = 0.0;
77  if (fitcode<0 || fitcode >= MMCFitMethod::MAX) {
78  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetFittedMass ERROR ! fitcode="+std::to_string(fitcode)
79  +". Should be between 0 and "+std::to_string(MMCFitMethod::MAX-1)).c_str());
80  } else {
81  mass = m_FittedMass[fitcode];
82  }
83 
84  return mass;
85 }
86 
87 // returns upper error on fitted Mass
88 double MissingMassOutput::GetFittedMassErrorUp(int fitcode) const {
89  // 0 best parameter space
90  // 1 best mass
91  // best nu from hist
92  double massUpperError = 0.0;
93  if (fitcode<0 || fitcode >= MMCFitMethod::MAX) {
94  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetFittedMass ERROR ! fitcode="+std::to_string(fitcode)
95  +". Should be between 0 and "+std::to_string(MMCFitMethod::MAX-1)).c_str());
96  } else {
97  massUpperError = m_FittedMassUpperError[fitcode];
98  }
99 
100  return massUpperError;
101 }
102 
103 // returns upper error on fitted Mass
104 double MissingMassOutput::GetFittedMassErrorLow(int fitcode) const {
105  // 0 best parameter space
106  // 1 best mass
107  // best nu from hist
108  double massLowerError = 0.0;
109  if (fitcode<0 || fitcode >= MMCFitMethod::MAX) {
110  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetFittedMass ERROR ! fitcode="+std::to_string(fitcode)
111  +". Should be between 0 and "+std::to_string(MMCFitMethod::MAX-1)).c_str());
112  } else {
113  massLowerError = m_FittedMassLowerError[fitcode];
114  }
115 
116  return massLowerError;
117 }
118 
120 {
121  return m_NTrials;
122 }
123 
125 {
126  return m_NSuccesses;
127 }
128 
130 {
131  return m_NSolutions;
132 }
133 
134 // sum of weights of all solutions
136 {
137  return m_SumW;
138 }
139 
140 // average RMS of solutions in one event
142 {
143  return m_AveSolRMS;
144 }
145 
146 std::shared_ptr<TH1F> MissingMassOutput::GetMassHistogram() const
147 {
148  return m_hMfit_all;
149 }
150 
151 std::shared_ptr<TH1F> MissingMassOutput::GetMassHistogramNoWeight() const
152 {
153  return m_hMfit_allNoWeight;
154 }
155 
156 // returns neutrino 4-vec
157 PtEtaPhiMVector MissingMassOutput::GetNeutrino4vec(int fitcode, int ind) const
158 {
159  PtEtaPhiMVector vec(0.0,0.0,0.0,0.0);
160  if (fitcode!=MMCFitMethod::MAXW && fitcode!=MMCFitMethod::MLNU3P )
161  {
162  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetNeutrino4Vec ERROR ! fitcode="+std::to_string(fitcode)
163  +". Should be either "+std::to_string(MMCFitMethod::MAXW)+" or "+std::to_string(MMCFitMethod::MLNU3P)).c_str());
164  }
165  else if (m_FitStatus>0)
166  {
167  if(ind==0) vec = m_nuvec1[fitcode];
168  else if(ind==1) vec = m_nuvec2[fitcode];
169  }
170  return vec;
171 }
172 
173 // returns neutrino 4-vec
174 PtEtaPhiMVector MissingMassOutput::GetTau4vec(int fitcode, int ind) const
175 {
176  PtEtaPhiMVector vec(0.0,0.0,0.0,0.0);
177  if (fitcode!=MMCFitMethod::MAXW && fitcode!=MMCFitMethod::MLNU3P )
178  {
179  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetTau4vec ERROR ! fitcode="+std::to_string(fitcode)
180  +". Should be either "+std::to_string(MMCFitMethod::MAXW)+" or "+std::to_string(MMCFitMethod::MLNU3P)).c_str());
181  }
182  else if (m_FitStatus>0)
183  {
184  if(ind==0) vec = m_objvec1[fitcode];
185  else if(ind==1) vec = m_objvec2[fitcode];
186  }
187  return vec;
188 }
189 
190 // returns 4-vec for resonance
191 PtEtaPhiMVector MissingMassOutput::GetResonanceVec(int fitcode) const {
192  PtEtaPhiMVector vec(0.0,0.0,0.0,0.0);
193  if (fitcode!=MMCFitMethod::MAXW && fitcode!=MMCFitMethod::MLNU3P )
194  {
195  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetResonanceVec ERROR ! fitcode="+std::to_string(fitcode)
196  +". Should be either "+std::to_string(MMCFitMethod::MAXW)+" or "+std::to_string(MMCFitMethod::MLNU3P)).c_str());
197  }
198  else if (m_FitStatus>0)
199  {
200  vec = m_objvec1[fitcode]+m_objvec2[fitcode];
201  }
202 
203  return vec;
204 }
205 
206 // returns 2-vec for fitted MET
207 XYVector MissingMassOutput::GetFittedMetVec(int fitcode) const {
208  XYVector vec(0.0,0.0);
209  if (fitcode!=MMCFitMethod::MAXW && fitcode!=MMCFitMethod::MLNU3P )
210  {
211  Error("DiTauMassTools", "%s", ("MissingMassCalculator::GetFittedMetVec ERROR ! fitcode="+std::to_string(fitcode)
212  +". Should be either "+std::to_string(MMCFitMethod::MAXW)+" or "+std::to_string(MMCFitMethod::MLNU3P)).c_str());
213  }
214  else if (m_FitStatus>0)
215  {
216  vec=m_FittedMetVec[fitcode];
217  }
218 
219  return vec;
220 }
DiTauMassTools::MissingMassOutput::GetFitSignificance
double GetFitSignificance(int fitcode) const
Definition: MissingMassOutput.cxx:54
DiTauMassTools::MMCFitMethod::MAX
@ MAX
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
DiTauMassTools::MissingMassOutput::m_FittedMass
double m_FittedMass[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:55
DiTauMassTools::MissingMassOutput::GetMassHistogram
std::shared_ptr< TH1F > GetMassHistogram() const
Definition: MissingMassOutput.cxx:146
DiTauMassTools::MissingMassOutput::~MissingMassOutput
~MissingMassOutput()
Definition: MissingMassOutput.cxx:20
DiTauMassTools::MissingMassOutput::m_FitSignificance
double m_FitSignificance[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:54
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
DiTauMassTools::MissingMassOutput::m_FittedMassLowerError
double m_FittedMassLowerError[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:57
DiTauMassTools::MissingMassOutput::m_hMfit_all
std::shared_ptr< TH1F > m_hMfit_all
Definition: MissingMassOutput.h:65
DiTauMassTools::MissingMassOutput::GetNTrials
int GetNTrials() const
Definition: MissingMassOutput.cxx:119
DiTauMassTools::MissingMassOutput::GetFittedMassErrorLow
double GetFittedMassErrorLow(int fitcode) const
Definition: MissingMassOutput.cxx:104
DiTauMassTools::MissingMassOutput::m_hMfit_allNoWeight
std::shared_ptr< TH1F > m_hMfit_allNoWeight
Definition: MissingMassOutput.h:66
DiTauMassTools::MissingMassOutput::GetSumW
double GetSumW() const
Definition: MissingMassOutput.cxx:135
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
DiTauMassTools
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:24
DiTauMassTools::MissingMassOutput::GetFittedMetVec
XYVector GetFittedMetVec(int fitcode) const
Definition: MissingMassOutput.cxx:207
DiTauMassTools::MissingMassOutput::GetNSuccesses
int GetNSuccesses() const
Definition: MissingMassOutput.cxx:124
DiTauMassTools::MissingMassOutput::GetNeutrino4vec
PtEtaPhiMVector GetNeutrino4vec(int fitcode, int ind) const
Definition: MissingMassOutput.cxx:157
DiTauMassTools::MissingMassOutput::GetAveSolRMS
double GetAveSolRMS() const
Definition: MissingMassOutput.cxx:141
DiTauMassTools::MissingMassOutput::GetNSolutions
int GetNSolutions() const
Definition: MissingMassOutput.cxx:129
DiTauMassTools::MissingMassOutput::GetRms2Mpv
double GetRms2Mpv() const
Definition: MissingMassOutput.cxx:67
DiTauMassTools::MissingMassOutput::ClearOutput
void ClearOutput(bool fUseVerbose)
Definition: MissingMassOutput.cxx:24
DiTauMassTools::MissingMassOutput::GetTau4vec
PtEtaPhiMVector GetTau4vec(int fitcode, int ind) const
Definition: MissingMassOutput.cxx:174
DiTauMassTools::MissingMassOutput::m_NSolutions
int m_NSolutions
Definition: MissingMassOutput.h:69
DiTauMassTools::MissingMassOutput::GetFittedMass
double GetFittedMass(int fitcode) const
Definition: MissingMassOutput.cxx:72
DiTauMassTools::MissingMassOutput::m_objvec2
PtEtaPhiMVector m_objvec2[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:61
DiTauMassTools::MissingMassOutput::m_RMS2MPV
double m_RMS2MPV
Definition: MissingMassOutput.h:64
DiTauMassTools::MissingMassOutput::GetMassHistogramNoWeight
std::shared_ptr< TH1F > GetMassHistogramNoWeight() const
Definition: MissingMassOutput.cxx:151
DiTauMassTools::MissingMassOutput::m_objvec1
PtEtaPhiMVector m_objvec1[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:59
DiTauMassTools::MissingMassOutput::GetFittedMassErrorUp
double GetFittedMassErrorUp(int fitcode) const
Definition: MissingMassOutput.cxx:88
DiTauMassTools::MissingMassOutput::m_NSuccesses
int m_NSuccesses
Definition: MissingMassOutput.h:68
DiTauMassTools::MissingMassOutput::m_FittedMassUpperError
double m_FittedMassUpperError[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:56
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
DiTauMassTools::MissingMassOutput::GetFitStatus
int GetFitStatus() const
Definition: MissingMassOutput.cxx:49
DiTauMassTools::MissingMassOutput::m_AveSolRMS
double m_AveSolRMS
Definition: MissingMassOutput.h:71
DiTauMassTools::MissingMassOutput::MissingMassOutput
MissingMassOutput()
Definition: MissingMassOutput.cxx:16
DiTauMassTools::MissingMassOutput::m_nuvec1
PtEtaPhiMVector m_nuvec1[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:58
DiTauMassTools::MissingMassOutput::m_FittedMetVec
XYVector m_FittedMetVec[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:63
DiTauMassTools::MissingMassOutput::m_nuvec2
PtEtaPhiMVector m_nuvec2[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:60
DiTauMassTools::MissingMassOutput::m_NTrials
int m_NTrials
Definition: MissingMassOutput.h:67
DiTauMassTools::MMCFitMethod::MAXW
@ MAXW
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
DiTauMassTools::MissingMassOutput::m_FitStatus
int m_FitStatus
Definition: MissingMassOutput.h:53
DiTauMassTools::MMCFitMethod::MLNU3P
@ MLNU3P
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
DiTauMassTools::MissingMassOutput::m_totalvec
PtEtaPhiMVector m_totalvec[MMCFitMethod::MAX]
Definition: MissingMassOutput.h:62
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
DiTauMassTools::MissingMassOutput::m_SumW
double m_SumW
Definition: MissingMassOutput.h:70
MissingMassOutput.h
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
DiTauMassTools::MissingMassOutput::GetResonanceVec
PtEtaPhiMVector GetResonanceVec(int fitcode) const
Definition: MissingMassOutput.cxx:191