ATLAS Offline Software
Loading...
Searching...
No Matches
MissingMassCalculator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6------ MissingMassCalculator
7------ Author: Aliaksandr Pranko (appranko@lbl.gov)
8------ Code developers: David Rousseau (rousseau@lal.in2p3.fr), Dimitris Varouchas (Dimitris.Varouchas@cern.ch)
9MissingMassCalculator is designed to reconstruct mass in
10events where two particles decay into states with missing ET.
11*/
12#ifndef MissingMassCalculator_h
13#define MissingMassCalculator_h
14
15
16
17#if !defined (__CINT__) || defined (__MAKECINT__)
21#include <TRandom2.h>
22#include <TH1.h>
23#include <TGraph.h>
24#include <Math/Vector4D.h> //typedef for Math::PtEtaPhiMVector
25
26#include <memory>
27#include <string>
28#include <vector>
29
30class TF1;
31namespace DiTauMassTools{
32 class MissingMassProb;
33 class MissingET;
34}
35
36#endif
37
38
39namespace DiTauMassTools{
40 using ROOT::Math::PtEtaPhiMVector;
41
43
44 public:
45
46 private:
47
48 //---------------- structures
49 struct DitauStuff {
50 double Mditau_best{}; // best fitted M(ditau)
51 double Sign_best{}; // best significance of M(ditau) fit
52 PtEtaPhiMVector nutau1; // fitted 4-vec for neutrino from tau-1
53 PtEtaPhiMVector nutau2; // fitted 4-vec for neutrino from tau-2
54 PtEtaPhiMVector vistau1; // fitted 4-vec for visible tau-1
55 PtEtaPhiMVector vistau2; // fitted 4-vec for visible tau-2
56 double RMSoverMPV{};
57 };
58
59 TRandom2 m_randomGen;
60
62
63 bool m_fUseEfficiencyRecovery{}; // switch to turn ON/OFF re-fit in order to recover efficiency
64 bool m_fUseFloatStopping{}; // switch to turn ON/OFF floating stopping criterion
68
72 int m_rmsStop{};
73 double m_meanbinStop{};
74
75 // these are temporary vectors. Declared globally to avoid construction/destruction
76 std::vector<PtEtaPhiMVector> m_nuvecsol1;
77 std::vector<PtEtaPhiMVector> m_nuvecsol2;
78
79 std::vector<PtEtaPhiMVector> m_tauvecsol1;
80 std::vector<PtEtaPhiMVector> m_tauvecsol2;
81 std::vector<double> m_tauvecprob1;
82 std::vector<double> m_tauvecprob2;
83
84 std::vector<PtEtaPhiMVector> m_nuvec1_tmp;
85 std::vector<PtEtaPhiMVector> m_nuvec2_tmp;
86
87 PtEtaPhiMVector m_tautau_tmp;
88
90
93 double m_nsigma_METscan_lfv_lh{}, m_beamEnergy{}; // number of sigmas for MET-scan
94
96
97 double m_prob_tmp{};
98
100 double m_mtautauSum{};
101
103 int m_seed{};
104 // data member for the spaceWalker approach
105
106 int m_iter0{};
112 int m_nosol1{};
113 int m_nosol2{};
115 bool m_switch1{};
116 bool m_switch2{};
117
119
125
129
133
134 double m_mTau{},m_mTau2{};
136 double m_eTau1{}, m_eTau2{};
137 double m_eTau10{}, m_eTau20{};
146
152 std::vector<double> m_probFinalSolOldVec;
153 std::vector<double> m_mtautauFinalSolOldVec;
154 std::vector<PtEtaPhiMVector> m_nu1FinalSolOldVec;
155 std::vector<PtEtaPhiMVector> m_nu2FinalSolOldVec;
156
157 int m_nsol{};
158 std::vector<double> m_probFinalSolVec;
159 std::vector<double> m_mtautauFinalSolVec;
160 std::vector<PtEtaPhiMVector> m_nu1FinalSolVec;
161 std::vector<PtEtaPhiMVector> m_nu2FinalSolVec;
162
163
166 double m_walkWeight{};
168
170
171 PtEtaPhiMVector m_tauVec1,m_tauVec2;
177 double m_tauVec1E{};
178 double m_tauVec2E{};
179 double m_m2Nu1{};
180 double m_m2Nu2{};
181 double m_ET2v1{};
182 double m_ET2v2{};
183 double m_E2v1{};
184 double m_E2v2{};
185 double m_Ev2{};
186 double m_Ev1{};
187 double m_Mvis{},m_Meff{};
188
189 //--- define histograms for histogram method
190 //--- upper limits need to be revisied in the future!!! It may be not enough for some analyses
191 std::shared_ptr<TH1F> m_fMfit_all;
192 std::shared_ptr<TH1F> m_fMEtP_all;
193 std::shared_ptr<TH1F> m_fMEtL_all;
194 std::shared_ptr<TH1F> m_fMnu1_all;
195 std::shared_ptr<TH1F> m_fMnu2_all;
196 std::shared_ptr<TH1F> m_fPhi1_all;
197 std::shared_ptr<TH1F> m_fPhi2_all;
198 std::shared_ptr<TGraph> m_fMfit_allGraph;
199 std::shared_ptr<TH1F> m_fMfit_allNoWeight;
200
201 std::shared_ptr<TH1F> m_fPXfit1;
202 std::shared_ptr<TH1F> m_fPYfit1;
203 std::shared_ptr<TH1F> m_fPZfit1;
204 std::shared_ptr<TH1F> m_fPXfit2;
205 std::shared_ptr<TH1F> m_fPYfit2;
206 std::shared_ptr<TH1F> m_fPZfit2;
207
208 // these histograms are used for the floating stopping criterion
209 std::shared_ptr<TH1F> m_fMmass_split1;
210 std::shared_ptr<TH1F> m_fMEtP_split1;
211 std::shared_ptr<TH1F> m_fMEtL_split1;
212 std::shared_ptr<TH1F> m_fMnu1_split1;
213 std::shared_ptr<TH1F> m_fMnu2_split1;
214 std::shared_ptr<TH1F> m_fPhi1_split1;
215 std::shared_ptr<TH1F> m_fPhi2_split1;
216 std::shared_ptr<TH1F> m_fMmass_split2;
217 std::shared_ptr<TH1F> m_fMEtP_split2;
218 std::shared_ptr<TH1F> m_fMEtL_split2;
219 std::shared_ptr<TH1F> m_fMnu1_split2;
220 std::shared_ptr<TH1F> m_fMnu2_split2;
221 std::shared_ptr<TH1F> m_fPhi1_split2;
222 std::shared_ptr<TH1F> m_fPhi2_split2;
223
225
226 TH1F* m_fPhi1{};
227 TH1F* m_fPhi2{};
228 TH1F* m_fMnu1{};
229 TH1F* m_fMnu2{};
230 TH1F* m_fMetx{};
231 TH1F* m_fMety{};
232 TH1F* m_fTheta3D{};
233 TH1F* m_fTauProb{};
234
235 // for intermediate calc
236 PtEtaPhiMVector m_TLVdummy;
237
238 //---------------- protected variables
239 DitauStuff m_fDitauStuffFit; // results based on fit method
240 DitauStuff m_fDitauStuffHisto; // results based on histo method
241
242 int m_niter_fit1{}; // number of iterations for dR-dPhi scan
243 int m_niter_fit2{}; // number of iterations for MET-scan
244 int m_niter_fit3{}; // number of iterations for Mnu-scan
245 int m_NiterRandom{}; // number of random iterations (for lh, multiply or divide by 10 for ll and hh)
248 int m_RndmSeedAltering{}; // reset seed (not necessary by default)
249
250 double m_dRmax_tau{}; // maximum dR(nu-visTau)
251
252 double m_MnuScanRange{}; // range of M(nunu) scan; M(nunu) range can be affected by selection cuts
253
254
255 //---------------- protected functions
256 void ClearDitauStuff(DitauStuff &fStuff);
257 void DoOutputInfo();
258 void PrintOtherInput();
259 void PrintResults();
260
261 inline int NuPsolutionV3(const double & mNu1, const double & mNu2, const double & phi1, const double & phi2,
262 int & nsol1, int & nsol2);
263
264 inline int NuPsolutionLFV(const XYVector & met_vec, const PtEtaPhiMVector & tau,
265 const double & m_nu, std::vector<PtEtaPhiMVector> &nu_vec);
266
267
268 protected:
269 inline int CheckSolutions(PtEtaPhiMVector nu_vec, PtEtaPhiMVector vis_vec, int decayType);
270 inline int TailCleanUp(const PtEtaPhiMVector & vis1, const PtEtaPhiMVector & nu1,
271 const PtEtaPhiMVector & vis2, const PtEtaPhiMVector & nu2,
272 const double & mmc_mass, const double & vis_mass, const double & eff_mass, const double & dphiTT);
273
274
275 inline int refineSolutions ( const double & M_nu1, const double & M_nu2,
276 const int nsol1, const int nsol2,
277 const double & Mvis, const double & Meff);
278
279
280
281 inline void handleSolutions();
282
283 inline double MassScale(int method, double mass, const int & tau_type1, const int & tau_type2);
284
285
286 // factor out parameter space walking and probablity computing
287 inline int DitauMassCalculatorV9walk();
288
289
290 // Calculates mass of lep+tau system in LFV X->lep+tau decays
291 // It is based on DitauMassCalculatorV9, not optimized for speed yet, simple phase-space scan
292 inline int DitauMassCalculatorV9lfv(bool refit);
293
294
295
296 // only compute probability
297 inline int probCalculatorV9fast(
298 const double & phi1, const double & phi2,
299 const double & M_nu1, const double & M_nu2);
300
301 // initialize the walker
302 inline void SpaceWalkerInit();
303
304 //walk the walker
305 inline bool SpaceWalkerWalk();
306
307 inline bool precomputeCache();
308
309
310 inline bool checkMEtInRange () ;
311 inline bool checkAllParamInRange () ;
312
313 //----------------------------------------------
314 //
315 // ------------ Public methods ---------------
316 //
317 //______________________________________________
318
319public:
320
322
323 MissingMassCalculator(MMCCalibrationSet::e aset, std::string paramFilePath) ;
324
327
331
332 int RunMissingMassCalculator( const xAOD::IParticle* part1, const xAOD::IParticle* part2, const xAOD::MissingET* met, const int& njets );
333
334 bool MassCollinear(const xAOD::IParticle *p0, const xAOD::IParticle *p1,
335 const xAOD::MissingET *met, // met
336 const bool kMMCsynchronize, // mmc sychronization
337 double &mass, double &xp1, double &xp2);
338
339
340 //-------- Set Input Parameters
341 void FinalizeSettings(const xAOD::IParticle* part1, const xAOD::IParticle* part2, const xAOD::MissingET* met, const int& njets );
342 void SetNiterFit1(const int val) { m_niter_fit1=val; } // number of iterations per loop in dPhi loop
343 void SetNiterFit2(const int val) { m_niter_fit2=val; } // number of iterations per loop in MET loop
344 void SetNiterFit3(const int val) { m_niter_fit3=val; } // number of iterations per loop in Mnu loop
345 void SetNiterRandom(const int val) { m_NiterRandom=val; } // number of random iterations
346 void SetNsucStop(const int val) { m_NsucStop=val; } // Arrest criteria for Nsuccesses
347 void SetRMSStop(const int val) { m_RMSStop=val;}
348 void SetMeanbinStop(const double val) {m_meanbinStop=val;}
349 void SetRndmSeedAltering(const int val) { m_RndmSeedAltering=val; } // number of iterations per loop in Mnu loop
350 void SetEventNumber(const int eventNumber) { m_eventNumber = eventNumber; }
351
352 void SetMnuScanRange(const double val) { m_MnuScanRange=val; }
353
354 void SetProposalTryMEt(const double val) {m_proposalTryMEt=val; }
355 void SetProposalTryPhi(const double val) {m_ProposalTryPhi=val;}
356 void SetProposalTryMnu(const double val) {m_ProposalTryMnu=val;}
357
360
361 int GetNiterFit1() const { return m_niter_fit1; } // number of iterations per loop in dPhi loop
362 int GetNiterFit2() const { return m_niter_fit2; } // number of iterations per loop in MET loop
363 int GetNiterFit3() const { return m_niter_fit3; } // number of iterations per loop in Mnu loop
364 int GetNiterRandom() const { return m_niterRandomLocal; } // number of random iterations
365
366 int GetNsucStop() const { return m_NsucStop; } // Arrest criteria for NSuc
367 int GetRMSStop() const { return m_RMSStop; }
368 double GetMeanbinStop() const { return m_meanbinStop;}
369 int GetRndmSeedAltering() const { return m_RndmSeedAltering; } // number of iterations per loop in Mnu loop
370
374 int GetMarkovNAccept() const { return m_markovNAccept; }
376 double GetProposalTryMEt() const {return m_proposalTryMEt;}
377 double GetProposalTryPhi() const {return m_ProposalTryPhi;}
378 double GetProposalTryMnu() const {return m_ProposalTryMnu;}
379
380 void SetNsigmaMETscan_ll(const double val) { m_nsigma_METscan_ll=val; } // number of sigma's for MET-scan in ll events
381 void SetNsigmaMETscan_lh(const double val) { m_nsigma_METscan_lh=val; } // number of sigma's for MET-scan in lh events
382 void SetNsigmaMETscan_hh(const double val) { m_nsigma_METscan_hh=val; } // number of sigma's for MET-scan in hh events
383 void SetNsigmaMETscan(const double val) { m_nsigma_METscan=val; } // number of sigma's for MET-scan
384
385 void SetUseFloatStopping(const bool val); // switch for floating stopping criterion
388 void SetFloatStoppingComp(const double val) { m_fUseFloatStoppingComp = val;}
389 void SetBeamEnergy(const double val) { m_beamEnergy=val; }
390 void SetLFVLeplepRefit(const bool val) { m_lfvLeplepRefit=val; }
391 void SaveLlhHisto(const bool val);
392
393 double GetmMaxError() const {return m_PrintmMaxError;}
394 double GetmMeanError() const { return m_PrintmMeanError;}
396
397 int GetNNoSol() const {return m_markovNRejectNoSol;}
399 int GetNSol() const {return m_markovNAccept;}
400
401
402 //-------- Get results;
403 Double_t maxFitting(Double_t *x, Double_t *par);
404
405 // compute maximum from histo
406 double maxFromHist(TH1F *theHist, std::vector<double> & histInfo, const MaxHistStrategy::e maxHistStrategy=MaxHistStrategy::FIT,const int winHalfWidth=2,bool debug=false);
407 double maxFromHist(const std::shared_ptr<TH1F>& theHist, std::vector<double> & histInfo, const MaxHistStrategy::e maxHistStrategy=MaxHistStrategy::FIT,const int winHalfWidth=2,bool debug=false) {
408 return maxFromHist(theHist.get(), histInfo, maxHistStrategy, winHalfWidth, debug);
409 }
410
411 XYVector metvec_tmp;
412 inline double dTheta3DLimit(const int & tau_type, const int & limit_code,const double & P_tau);
413
414};
415} // namespace DiTauMassTools
416
417#endif
const bool debug
Athena::TPCnvVers::Old Athena::TPCnvVers::Old MissingET
Definition RecTPCnv.cxx:64
#define x
int TailCleanUp(const PtEtaPhiMVector &vis1, const PtEtaPhiMVector &nu1, const PtEtaPhiMVector &vis2, const PtEtaPhiMVector &nu2, const double &mmc_mass, const double &vis_mass, const double &eff_mass, const double &dphiTT)
double maxFromHist(TH1F *theHist, std::vector< double > &histInfo, const MaxHistStrategy::e maxHistStrategy=MaxHistStrategy::FIT, const int winHalfWidth=2, bool debug=false)
bool MassCollinear(const xAOD::IParticle *p0, const xAOD::IParticle *p1, const xAOD::MissingET *met, const bool kMMCsynchronize, double &mass, double &xp1, double &xp2)
int probCalculatorV9fast(const double &phi1, const double &phi2, const double &M_nu1, const double &M_nu2)
void FinalizeSettings(const xAOD::IParticle *part1, const xAOD::IParticle *part2, const xAOD::MissingET *met, const int &njets)
std::vector< PtEtaPhiMVector > m_nu2FinalSolOldVec
int refineSolutions(const double &M_nu1, const double &M_nu2, const int nsol1, const int nsol2, const double &Mvis, const double &Meff)
MissingMassCalculator(MMCCalibrationSet::e aset, std::string paramFilePath)
MissingMassCalculator & operator=(const MissingMassCalculator &)=delete
int CheckSolutions(PtEtaPhiMVector nu_vec, PtEtaPhiMVector vis_vec, int decayType)
std::vector< PtEtaPhiMVector > m_nu1FinalSolOldVec
std::vector< PtEtaPhiMVector > m_tauvecsol1
std::vector< PtEtaPhiMVector > m_nuvec1_tmp
std::vector< PtEtaPhiMVector > m_nuvecsol1
std::vector< PtEtaPhiMVector > m_nuvec2_tmp
std::vector< PtEtaPhiMVector > m_nuvecsol2
std::vector< PtEtaPhiMVector > m_nu2FinalSolVec
Double_t maxFitting(Double_t *x, Double_t *par)
int NuPsolutionV3(const double &mNu1, const double &mNu2, const double &phi1, const double &phi2, int &nsol1, int &nsol2)
double MassScale(int method, double mass, const int &tau_type1, const int &tau_type2)
double dTheta3DLimit(const int &tau_type, const int &limit_code, const double &P_tau)
int NuPsolutionLFV(const XYVector &met_vec, const PtEtaPhiMVector &tau, const double &m_nu, std::vector< PtEtaPhiMVector > &nu_vec)
std::vector< PtEtaPhiMVector > m_tauvecsol2
std::vector< PtEtaPhiMVector > m_nu1FinalSolVec
MissingMassCalculator(const MissingMassCalculator &)=delete
int RunMissingMassCalculator(const xAOD::IParticle *part1, const xAOD::IParticle *part2, const xAOD::MissingET *met, const int &njets)
double maxFromHist(const std::shared_ptr< TH1F > &theHist, std::vector< double > &histInfo, const MaxHistStrategy::e maxHistStrategy=MaxHistStrategy::FIT, const int winHalfWidth=2, bool debug=false)
Class providing the definition of the 4-vector interface.
Definition part1.py:1
Definition part2.py:1
MissingET_v1 MissingET
Version control by type defintion.