ATLAS Offline Software
MissingMassProb.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 probability calculation of the MissingMassCalculator
6 // author Michael Huebner <michael.huebner@no.spam.cern.ch>
7 
8 // Local include(s):
11 #include <cmath>
12 
13 using namespace DiTauMassTools;
14 using ROOT::Math::PtEtaPhiMVector;
16 
17 // The wrapper functions make use of the ignore template defined in HelperFunctions.h.
18 // This is to avoid warnings during compilation.
19 // All wrapper functions need to have the same structure such that they can be
20 // handled within the probList vectors and the "user" from the Calculator only
21 // has to call Prob->apply() to have a common handling of all probability calculations.
22 
23 double MissingMassProb::MetProbabilityWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
24  ignore(tau_type1);
25  ignore(tau_type2);
26  ignore(tauvec1);
27  ignore(tauvec2);
28  ignore(nuvec1);
29  ignore(nuvec2);
30  return prob->MetProbability(preparedInput, 1.,1.,1.,1.);
31 }
32 
33 double MissingMassProb::mEtAndTauProbabilityWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
34  ignore(tau_type1);
35  ignore(tau_type2);
36  ignore(tauvec1);
37  ignore(tauvec2);
38  ignore(nuvec1);
39  ignore(nuvec2);
40  return prob->mEtAndTauProbability(preparedInput);
41 }
42 
43 double MissingMassProb::dTheta3d_probabilityFastWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
44  double Prob = 1.;
45  if (tau_type1>=0) {
46  PtEtaPhiMVector totalTau1;
47  totalTau1+=tauvec1;
48  totalTau1+=nuvec1;
49  const double tau1_tmpp = totalTau1.P();
50  const double angle1 = Angle(nuvec1,tauvec1);
51  Prob*=prob->dTheta3d_probabilityFast(preparedInput, tau_type1, angle1, tau1_tmpp);
52  }
53  if (tau_type2>=0) {
54  PtEtaPhiMVector totalTau2;
55  totalTau2+=tauvec2;
56  totalTau2+=nuvec2;
57  const double tau2_tmpp = totalTau2.P();
58  const double angle2 = Angle(nuvec2,tauvec2);
59  Prob*=prob->dTheta3d_probabilityFast(preparedInput, tau_type2, angle2, tau2_tmpp);
60  }
61  return Prob;
62 }
63 
64 double MissingMassProb::TauProbabilityWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
65  if( prob->GetUseHT() || (preparedInput.m_tauTypes==TauTypes::hh) ) {
66  return prob->TauProbability(preparedInput, tau_type1, tauvec1, nuvec1, tau_type2, tauvec2, nuvec2, preparedInput.m_MetVec.R()); // customized prob for Njet25=0
67  } else {
68  return prob->TauProbability(preparedInput, tau_type1, tauvec1, nuvec1, tau_type2, tauvec2, nuvec2);
69  }
70 }
71 
72 double MissingMassProb::MnuProbabilityWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
73  ignore(tauvec1);
74  ignore(tauvec2);
75  if(prob->GetUseMnuProbability()==1){
76  if(preparedInput.m_tauTypes==TauTypes::ll) return prob->MnuProbability(preparedInput, nuvec1.M())*prob->MnuProbability(preparedInput, nuvec2.M()); // lep-lep
77  else if(tau_type1==8 && (tau_type2>=0 && tau_type2<=5)) return prob->MnuProbability(preparedInput, nuvec1.M()); // lep-had: tau1==lepton
78  else if((tau_type1>=0 && tau_type1<=5) && tau_type2==8) return prob->MnuProbability(preparedInput, nuvec2.M()); // lep-had: tau2==lepton
79  else {
80  Warning("DiTauMassTools", "something went really wrong in MNuProb...");
81  return 1.;
82  }
83  } else {
84  return 1.;
85  }
86 }
87 
88 double MissingMassProb::dTheta3d_probabilityNewWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
89  ignore(preparedInput);
90  double Prob = 1.;
91  if (tau_type1>=0) {
92  PtEtaPhiMVector totalTau1;
93  totalTau1+=tauvec1;
94  totalTau1+=nuvec1;
95  const double angle1 = Angle(nuvec1,tauvec1);
96  double prob_tmp = 1e-10;
97  if (angle1!=0.) prob_tmp=prob->GetFormulaAngle1()->Eval(angle1);
98  if (prob_tmp<=0.) prob_tmp=1e-10;
99  Prob*=prob_tmp;
100  }
101  if (tau_type2>=0) {
102  PtEtaPhiMVector totalTau2;
103  totalTau2+=tauvec2;
104  totalTau2+=nuvec2;
105  const double angle2 = Angle(nuvec2,tauvec2);
106  double prob_tmp = 1e-10;
107  if (angle2!=0.) prob_tmp=prob->GetFormulaAngle2()->Eval(angle2);
108  if (prob_tmp<=0.) prob_tmp=1e-10;
109  Prob*=prob_tmp;
110  }
111  // very rare cases where parametrisation flips
112  if (std::isnan(Prob)) Prob = 0.;
113  return Prob;
114 }
115 
116 double MissingMassProb::TauProbabilityNewWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
117  ignore(preparedInput);
118  ignore(tau_type1);
119  ignore(tau_type2);
120  double Prob = 1.;
121  double R1 = nuvec1.P()/tauvec1.P();
122  double R2 = nuvec2.P()/tauvec2.P();
123  Prob*=prob->GetFormulaRatio1()->Eval(R1);
124  Prob*=prob->GetFormulaRatio2()->Eval(R2);
125  // not observed, just a protection
126  if (std::isnan(Prob)) Prob = 0.;
127  return Prob;
128 }
129 
130 double MissingMassProb::MnuProbabilityNewWrapper( MissingMassProb* prob, MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2 ){
131  ignore(tauvec1);
132  ignore(tauvec2);
133  double Prob = 1.;
134  if(prob->GetUseMnuProbability()==1){
135  if(preparedInput.m_tauTypes==TauTypes::ll) Prob*=(prob->GetFormulaNuMass()->Eval(nuvec1.M())*prob->GetFormulaNuMass()->Eval(nuvec2.M()));
136  else if(tau_type1==8 && (tau_type2>=0 && tau_type2<=5)) Prob*=prob->GetFormulaNuMass()->Eval(nuvec1.M());
137  else if((tau_type1>=0 && tau_type1<=5) && tau_type2==8) Prob*=prob->GetFormulaNuMass()->Eval(nuvec2.M());
138  else {
139  Warning("DiTauMassTools", "something went really wrong in MNuProb...");
140  }
141  }
142  // not observed, just a protection
143  if (std::isnan(Prob)) Prob = 0.;
144  return Prob;
145 }
146 
148  if (m_paramVectorNuMass.size() > 0){
149  for(int i=0; i<m_formulaNuMass->GetNpar(); i++){
150  m_formulaNuMass->SetParameter(i, m_paramVectorNuMass[0]->GetParameter(i));
151  }
152  }
153 }
154 
155 void MissingMassProb::setParamAngle(const PtEtaPhiMVector& tauvec, int tau, int tautype) {
156  double Pt_tau = tauvec.Pt();
157  int type = tautype;
158  if (tautype > 4 && tautype < 8) type = 4;
159  if (tautype <= 5){
160  if (m_paramVectorAngle.size() > 0){
161  for(int i=0; i<=3; i++){
162  double par = m_paramVectorAngle[i+(type)*4]->Eval(Pt_tau);
163  if (tau==1){
164  m_formulaAngle1->SetParameter(i, par);
165  } else {
166  m_formulaAngle2->SetParameter(i, par);
167  }
168  }
169  }
170  } else {
171  if (m_paramVectorAngleLep.size() > 0){
172  for(int i=0; i<=3; i++){
173  double par = m_paramVectorAngleLep[i]->Eval(Pt_tau);
174  if (tau==1){
175  m_formulaAngle1->SetParameter(i, par);
176  } else {
177  m_formulaAngle2->SetParameter(i, par);
178  }
179  }
180  }
181  }
182 }
183 
184 void MissingMassProb::setParamRatio(int tau, int tautype) {
185  int type = tautype;
186  if(tautype > 4 && tautype < 8) type = 4;
187  if (tautype <= 5){
188  if(tau==1){
190  for(int i=0; i<m_formulaRatio1->GetNpar(); i++){
191  m_formulaRatio1->SetParameter(i, m_paramVectorRatio[5*(tau-1)+type]->GetParameter(i));
192  }
193  } else {
195  for(int i=0; i<m_formulaRatio2->GetNpar(); i++){
196  m_formulaRatio2->SetParameter(i, m_paramVectorRatio[5*(tau-1)+type]->GetParameter(i));
197  }
198  }
199  } else {
200  if(tau==1){
202  for(int i=0; i<m_formulaRatio1->GetNpar(); i++){
203  m_formulaRatio1->SetParameter(i, m_paramVectorRatioLep[0]->GetParameter(i));
204  }
205  } else {
207  for(int i=0; i<m_formulaRatio2->GetNpar(); i++){
208  m_formulaRatio2->SetParameter(i, m_paramVectorRatioLep[0]->GetParameter(i));
209  }
210  }
211  }
212 }
213 
214 // Default Constructor
215 MissingMassProb::MissingMassProb(MMCCalibrationSet::e aset, const std::string& paramFilePath) {
216  m_mmcCalibrationSet = aset;
217  m_allowUseHT = false;
218  m_UseHT = false;
219 
220  m_fParams = NULL;
221  if (!paramFilePath.empty()){
222  std::string total_path = "DiTauMassTools/"+paramFilePath;
223  m_fParams = TFile::Open( (const char*) PathResolverFindCalibFile(total_path).c_str() ,"READ");
224  }
225  if (aset == MMCCalibrationSet::MMC2019) {
226  m_probListConstant.push_back( std::bind(&mEtAndTauProbabilityWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
227  m_probListOneTau.push_back( std::bind(&dTheta3d_probabilityNewWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
228  m_probListTwoTau.push_back( std::bind(&TauProbabilityNewWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
229  m_probListTwoTau.push_back( std::bind(&MnuProbabilityNewWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
230  if (m_fParams){
232  }
233  }
234  else {
235  m_probListConstant.push_back( std::bind(&mEtAndTauProbabilityWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
236  m_probListOneTau.push_back( std::bind(&dTheta3d_probabilityFastWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
237  m_probListTwoTau.push_back( std::bind(&TauProbabilityWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
238  m_probListTwoTau.push_back( std::bind(&MnuProbabilityWrapper, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
239  }
240 
241  if (m_fParams) if (m_fParams->IsOpen()) m_fParams->Close();
242 
244  // [tau_type][parLG][par]
245  // leptonic tau
246  //-par[0]
247  s_fit_param[0][0][0][0]=-9.82013E-1;
248  s_fit_param[0][0][0][1]=9.09874E-1;
249  s_fit_param[0][0][0][2]=0.0;
250  s_fit_param[0][0][0][3]=0.0;
251  //-par[1]
252  s_fit_param[0][0][1][0]=9.96303E1;
253  s_fit_param[0][0][1][1]=1.68873E1;
254  s_fit_param[0][0][1][2]=3.23798E-2;
255  s_fit_param[0][0][1][3]=0.0;
256  //-par[2]
257  s_fit_param[0][0][2][0]=0.0;
258  s_fit_param[0][0][2][1]=0.0;
259  s_fit_param[0][0][2][2]=0.0;
260  s_fit_param[0][0][2][3]=0.3; // fit value is 2.8898E-1, I use 0.3
261  //-par[3]
262  s_fit_param[0][0][3][0]=9.70055E1;
263  s_fit_param[0][0][3][1]=6.46175E1;
264  s_fit_param[0][0][3][2]=3.20679E-2;
265  s_fit_param[0][0][3][3]=0.0;
266  //-par[4]
267  s_fit_param[0][0][4][0]=1.56865;
268  s_fit_param[0][0][4][1]=2.28336E-1;
269  s_fit_param[0][0][4][2]=1.09396E-1;
270  s_fit_param[0][0][4][3]=1.99975E-3;
271  //-par[5]
272  s_fit_param[0][0][5][0]=0.0;
273  s_fit_param[0][0][5][1]=0.0;
274  s_fit_param[0][0][5][2]=0.0;
275  s_fit_param[0][0][5][3]=0.66;
276  //-----------------------------------------------------------------
277  // 1-prong hadronic tau
278  //-par[0]
279  s_fit_param[0][1][0][0]=-2.42674;
280  s_fit_param[0][1][0][1]=7.69124E-1;
281  s_fit_param[0][1][0][2]=0.0;
282  s_fit_param[0][1][0][3]=0.0;
283  //-par[1]
284  s_fit_param[0][1][1][0]=9.52747E1;
285  s_fit_param[0][1][1][1]=1.26319E1;
286  s_fit_param[0][1][1][2]=3.09643E-2;
287  s_fit_param[0][1][1][3]=0.0;
288  //-par[2]
289  s_fit_param[0][1][2][0]=1.71302E1;
290  s_fit_param[0][1][2][1]=3.00455E1;
291  s_fit_param[0][1][2][2]=7.49445E-2;
292  s_fit_param[0][1][2][3]=0.0;
293  //-par[3]
294  s_fit_param[0][1][3][0]=1.06137E2;
295  s_fit_param[0][1][3][1]=6.01548E1;
296  s_fit_param[0][1][3][2]=3.50867E-2;
297  s_fit_param[0][1][3][3]=0.0;
298  //-par[4]
299  s_fit_param[0][1][4][0]=4.26079E-1;
300  s_fit_param[0][1][4][1]=1.76978E-1;
301  s_fit_param[0][1][4][2]=1.43419;
302  s_fit_param[0][1][4][3]=0.0;
303  //-par[5]
304  s_fit_param[0][1][5][0]=0.0;
305  s_fit_param[0][1][5][1]=0.0;
306  s_fit_param[0][1][5][2]=0.0;
307  s_fit_param[0][1][5][3]=0.4;
308  //-----------------------------------------------------------------
309  // 3-prong hadronic tau
310  //-par[0]
311  s_fit_param[0][2][0][0]=-2.43533;
312  s_fit_param[0][2][0][1]=6.12947E-1;
313  s_fit_param[0][2][0][2]=0.0;
314  s_fit_param[0][2][0][3]=0.0;
315  //-par[1]
316  s_fit_param[0][2][1][0]=9.54202;
317  s_fit_param[0][2][1][1]=2.80011E-1;
318  s_fit_param[0][2][1][2]=2.49782E-1;
319  s_fit_param[0][2][1][3]=0.0;
320  //-par[2]
321  s_fit_param[0][2][2][0]=1.61325E1;
322  s_fit_param[0][2][2][1]=1.74892E1;
323  s_fit_param[0][2][2][2]=7.05797E-2;
324  s_fit_param[0][2][2][3]=0.0;
325  //-par[3]
326  s_fit_param[0][2][3][0]=1.17093E2;
327  s_fit_param[0][2][3][1]=4.70000E1;
328  s_fit_param[0][2][3][2]=3.87085E-2;
329  s_fit_param[0][2][3][3]=0.0;
330  //-par[4]
331  s_fit_param[0][2][4][0]=4.16557E-1;
332  s_fit_param[0][2][4][1]=1.58902E-1;
333  s_fit_param[0][2][4][2]=1.53516;
334  s_fit_param[0][2][4][3]=0.0;
335  //-par[5]
336  s_fit_param[0][2][5][0]=0.0;
337  s_fit_param[0][2][5][1]=0.0;
338  s_fit_param[0][2][5][2]=0.0;
339  s_fit_param[0][2][5][3]=0.95;
340 
341 
343  // [tau_type][parLG][par]
344  // leptonic tau
345  //-par[0]
346  s_fit_param[1][0][0][0]=-9.82013E-1;
347  s_fit_param[1][0][0][1]=9.09874E-1;
348  s_fit_param[1][0][0][2]=0.0;
349  s_fit_param[1][0][0][3]=0.0;
350  s_fit_param[1][0][0][4]=0.0;
351  //-par[1]
352  s_fit_param[1][0][1][0]=9.96303E1;
353  s_fit_param[1][0][1][1]=1.68873E1;
354  s_fit_param[1][0][1][2]=3.23798E-2;
355  s_fit_param[1][0][1][3]=0.0;
356  s_fit_param[1][0][1][4]=0.0;
357  //-par[2]
358  s_fit_param[1][0][2][0]=0.0;
359  s_fit_param[1][0][2][1]=0.0;
360  s_fit_param[1][0][2][2]=0.0;
361  s_fit_param[1][0][2][3]=0.3; // fit value is 2.8898E-1, I use 0.3
362  s_fit_param[1][0][2][4]=0.0;
363  //-par[3]
364  s_fit_param[1][0][3][0]=9.70055E1;
365  s_fit_param[1][0][3][1]=6.46175E1;
366  s_fit_param[1][0][3][2]=3.20679E-2;
367  s_fit_param[1][0][3][3]=0.0;
368  s_fit_param[1][0][3][4]=0.0;
369  //-par[4]
370  s_fit_param[1][0][4][0]=1.56865;
371  s_fit_param[1][0][4][1]=2.28336E-1;
372  s_fit_param[1][0][4][2]=1.09396E-1;
373  s_fit_param[1][0][4][3]=1.99975E-3;
374  s_fit_param[1][0][4][4]=0.0;
375  //-par[5]
376  s_fit_param[1][0][5][0]=0.0;
377  s_fit_param[1][0][5][1]=0.0;
378  s_fit_param[1][0][5][2]=0.0;
379  s_fit_param[1][0][5][3]=0.66;
380  s_fit_param[1][0][5][4]=0.0;
381  //-----------------------------------------------------------------
382  //-----------------------
383  // Only hadronic tau's were re-parametrized in MC12. The parameterization now
384  // goes to P(tau)=1 TeV.
385  //-----------------------------------------------------------------
386  // 1-prong hadronic tau
387  //---par[0]
388  s_fit_param[1][1][0][0]=0.7568;
389  s_fit_param[1][1][0][1]=-0.0001469;
390  s_fit_param[1][1][0][2]=5.413E-7;
391  s_fit_param[1][1][0][3]=-6.754E-10;
392  s_fit_param[1][1][0][4]=2.269E-13;
393  //---par[1]
394  s_fit_param[1][1][1][0]=-0.0288208;
395  s_fit_param[1][1][1][1]=0.134174;
396  s_fit_param[1][1][1][2]=-142.588;
397  s_fit_param[1][1][1][3]=-0.00035606;
398  s_fit_param[1][1][1][4]=-6.94567E-20;
399  //---par[2]
400  s_fit_param[1][1][2][0]=-0.00468927;
401  s_fit_param[1][1][2][1]=0.0378737;
402  s_fit_param[1][1][2][2]=-260.284;
403  s_fit_param[1][1][2][3]=0.00241158;
404  s_fit_param[1][1][2][4]=-6.01766E-7;
405  //---par[3]
406  s_fit_param[1][1][3][0]=-0.170424;
407  s_fit_param[1][1][3][1]=0.135764;
408  s_fit_param[1][1][3][2]=-50.2361;
409  s_fit_param[1][1][3][3]=0.00735544;
410  s_fit_param[1][1][3][4]=-7.34073E-6;
411  //---par[4]
412  s_fit_param[1][1][4][0]=-0.0081364;
413  s_fit_param[1][1][4][1]=0.0391428;
414  s_fit_param[1][1][4][2]=-141.936;
415  s_fit_param[1][1][4][3]=0.0035034;
416  s_fit_param[1][1][4][4]=-1.21956E-6;
417  //-par[5]
418  s_fit_param[1][1][5][0]=0.0;
419  s_fit_param[1][1][5][1]=0.0;
420  s_fit_param[1][1][5][2]=0.0;
421  s_fit_param[1][1][5][3]=0.624*0.00125; // multiplied by a bin size
422  s_fit_param[1][1][5][4]=0.0;
423  //-----------------------------------------------------------------
424  // 3-prong hadronic tau
425  //---par[0]
426  s_fit_param[1][2][0][0]=0.7562;
427  s_fit_param[1][2][0][1]=-1.168E-5;
428  s_fit_param[1][2][0][2]=0.0;
429  s_fit_param[1][2][0][3]=0.0;
430  s_fit_param[1][2][0][4]=0.0;
431  //---par[1]
432  s_fit_param[1][2][1][0]=-0.0420458;
433  s_fit_param[1][2][1][1]=0.15917;
434  s_fit_param[1][2][1][2]=-80.3259;
435  s_fit_param[1][2][1][3]=0.000125729;
436  s_fit_param[1][2][1][4]=-2.43945E-18;
437  //---par[2]
438  s_fit_param[1][2][2][0]=-0.0216898;
439  s_fit_param[1][2][2][1]=0.0243497;
440  s_fit_param[1][2][2][2]=-63.8273;
441  s_fit_param[1][2][2][3]=0.0148339;
442  s_fit_param[1][2][2][4]=-4.45351E-6;
443  //---par[3]
444  s_fit_param[1][2][3][0]=-0.0879411;
445  s_fit_param[1][2][3][1]=0.110092;
446  s_fit_param[1][2][3][2]=-75.4901;
447  s_fit_param[1][2][3][3]=0.0116915;
448  s_fit_param[1][2][3][4]=-1E-5;
449  //---par[4]
450  s_fit_param[1][2][4][0]=-0.0118324;
451  s_fit_param[1][2][4][1]=0.0280538;
452  s_fit_param[1][2][4][2]=-85.127;
453  s_fit_param[1][2][4][3]=0.00724948;
454  s_fit_param[1][2][4][4]=-2.38792E-6;
455  //-par[5]
456  s_fit_param[1][2][5][0]=0.0;
457  s_fit_param[1][2][5][1]=0.0;
458  s_fit_param[1][2][5][2]=0.0;
459  s_fit_param[1][2][5][3]=0.6167*0.00125; // multiplied by a bin size
460  s_fit_param[1][2][5][4]=0.0;
461 
462  // TER parameterization, for now based on p1130, to be checked and updated with new tag
463  // [tau_type][eta_bin][parameter]
464  // for 1-prongs
465  s_ter_sigma_par[0][0][0]=0.311717;
466  s_ter_sigma_par[0][0][1]=0.0221615;
467  s_ter_sigma_par[0][0][2]=0.859698;
468  s_ter_sigma_par[0][1][0]=0.290019;
469  s_ter_sigma_par[0][1][1]=0.0225794;
470  s_ter_sigma_par[0][1][2]=0.883407;
471  s_ter_sigma_par[0][2][0]=0.352312;
472  s_ter_sigma_par[0][2][1]=0.0196381;
473  s_ter_sigma_par[0][2][2]=0.629708;
474  s_ter_sigma_par[0][3][0]=0.342059;
475  s_ter_sigma_par[0][3][1]=0.0275107;
476  s_ter_sigma_par[0][3][2]=0.48065;
477  s_ter_sigma_par[0][4][0]=0.481564;
478  s_ter_sigma_par[0][4][1]=0.0197219;
479  s_ter_sigma_par[0][4][2]=0.0571714;
480  s_ter_sigma_par[0][5][0]=0.41264;
481  s_ter_sigma_par[0][5][1]=0.0233964;
482  s_ter_sigma_par[0][5][2]=0.515674;
483  s_ter_sigma_par[0][6][0]=0.20112;
484  s_ter_sigma_par[0][6][1]=0.0339914;
485  s_ter_sigma_par[0][6][2]=0.944524;
486  s_ter_sigma_par[0][7][0]=0.0892094;
487  s_ter_sigma_par[0][7][1]=0.0210225;
488  s_ter_sigma_par[0][7][2]=1.34014;
489  s_ter_sigma_par[0][8][0]=0.175554;
490  s_ter_sigma_par[0][8][1]=0.0210968;
491  s_ter_sigma_par[0][8][2]=0.813925;
492  s_ter_sigma_par[0][9][0]=0.0;
493  s_ter_sigma_par[0][9][1]=0.0340279;
494  s_ter_sigma_par[0][9][2]=1.30856;
495  // for 3-prongs
496  s_ter_sigma_par[1][0][0]=0.303356;
497  s_ter_sigma_par[1][0][1]=0.0299807;
498  s_ter_sigma_par[1][0][2]=1.25388;
499  s_ter_sigma_par[1][1][0]=0.358106;
500  s_ter_sigma_par[1][1][1]=0.0229604;
501  s_ter_sigma_par[1][1][2]=1.02222;
502  s_ter_sigma_par[1][2][0]=0.328643;
503  s_ter_sigma_par[1][2][1]=0.025684;
504  s_ter_sigma_par[1][2][2]=1.02594;
505  s_ter_sigma_par[1][3][0]=0.497332;
506  s_ter_sigma_par[1][3][1]=0.0215113;
507  s_ter_sigma_par[1][3][2]=0.30055;
508  s_ter_sigma_par[1][4][0]=0.4493;
509  s_ter_sigma_par[1][4][1]=0.0280311;
510  s_ter_sigma_par[1][4][2]=0.285793;
511  s_ter_sigma_par[1][5][0]=0.427811;
512  s_ter_sigma_par[1][5][1]=0.0316536;
513  s_ter_sigma_par[1][5][2]=0.457286;
514  s_ter_sigma_par[1][6][0]=0.165288;
515  s_ter_sigma_par[1][6][1]=0.0376361;
516  s_ter_sigma_par[1][6][2]=1.3913;
517  s_ter_sigma_par[1][7][0]=0.289798;
518  s_ter_sigma_par[1][7][1]=0.0140801;
519  s_ter_sigma_par[1][7][2]=0.83603;
520  s_ter_sigma_par[1][8][0]=0.186823;
521  s_ter_sigma_par[1][8][1]=0.0213053;
522  s_ter_sigma_par[1][8][2]=0.968934;
523  s_ter_sigma_par[1][9][0]=0.301673;
524  s_ter_sigma_par[1][9][1]=0.0145606;
525  s_ter_sigma_par[1][9][2]=0.514022;
526 
527 
528 }
529 
530 // Default Destructor
532 }
533 
534 double MissingMassProb::apply(MissingMassInput& preparedInput, const int & tau_type1, const int & tau_type2, const PtEtaPhiMVector & tauvec1, const PtEtaPhiMVector & tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector & nuvec2, bool constant, bool oneTau, bool twoTau) {
535  double prob = 1.;
536  if (constant == true) {
537  for (auto& f: m_probListConstant) {
538  prob*=f(preparedInput, tau_type1, tau_type2, tauvec1, tauvec2, nuvec1, nuvec2);
539  }
540  } else if (oneTau == true) {
541  for (auto& f: m_probListOneTau) {
542  prob*=f(preparedInput, tau_type1, tau_type2, tauvec1, tauvec2, nuvec1, nuvec2);
543  }
544  } else if (twoTau == true) {
545  for (auto& f: m_probListTwoTau) {
546  prob*=f(preparedInput, tau_type1, tau_type2, tauvec1, tauvec2, nuvec1, nuvec2);
547  }
548  }
549  return prob;
550 }
551 
552 
553 double MissingMassProb::MetProbability(MissingMassInput& preparedInput, const double & met1,const double & met2,const double & MetSigma1,const double & MetSigma2) {
554 
555 
556  double metprob;
557  if(MetSigma1>1.0 && MetSigma2>1.0) // it doesn't make sense if MET resolution sigma is <1 GeV
558  {
559  //SpeedUp
560  metprob=exp(-0.5*(met1*met1/(MetSigma1*MetSigma1)+met2*met2/(MetSigma2*MetSigma2)))/(MetSigma1*MetSigma2*2*TMath::Pi());
561  }
562  else
563  {
564  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "MissingMassCalculator::MetProbability: either MetSigma1 or MetSigma2 are <1 GeV--- too low, returning prob=1");
565  metprob=1.;
566  }
567 
568 
569  return metprob;
570 
571 
572 }
573 
575 {
576  double proba=1.;
577  double metprob;
578 
579  // deltaMEt is the difference between the neutrino sum and the MEt (or -HT if useHT),
580  //corrected possibly from tau E scanning
581 
582  double deltaMetX=preparedInput.m_metVec.X()-preparedInput.m_inputMEtX;
583  double deltaMetY=preparedInput.m_metVec.Y()-preparedInput.m_inputMEtY;
584 
585  // possibly correct for subtract tau scanning here
586  // const double met_smearL=(deltaMetVec.X()*m_metCovPhiCos+deltaMetVec.Y()*m_metCovPhiSin;
587  // const double met_smearP=-deltaMetVec.X()*m_metCovPhiSin+deltaMetVec.Y()*m_metCovPhiCos;
588 
589  // rotate into error ellipse axis
590  const double met_smearL=deltaMetX*cos(preparedInput.m_METcovphi)+deltaMetY*sin(preparedInput.m_METcovphi);
591  const double met_smearP=-deltaMetX*sin(preparedInput.m_METcovphi)+deltaMetY*cos(preparedInput.m_METcovphi);
592 
593 
594  if (m_UseHT)
595  {
596  if ( preparedInput.m_tauTypes==TauTypes::hh ) {
597 
598  metprob=MHtProbabilityHH(preparedInput, met_smearL,met_smearP,preparedInput.m_inputMEtT,preparedInput.m_MEtT,preparedInput.m_htOffset); // for had-had
599  }
600  else {
601  metprob=MHtProbability(preparedInput, met_smearL,met_smearP,preparedInput.m_inputMEtT,preparedInput.m_MEtT,preparedInput.m_htOffset); // for lep-had Winter 2012 analysis
602  }
603  }
604  else {
605  metprob=MetProbability(preparedInput, met_smearL,met_smearP,preparedInput.m_METsigmaL,preparedInput.m_METsigmaP);
606  }
607 
608  proba=metprob;
609 
610  return proba;
611 }
612 
613 //------------------- simple TauProbability for LFV
614 double MissingMassProb::TauProbabilityLFV(MissingMassInput& preparedInput, const int & type1, const PtEtaPhiMVector & vis1, const PtEtaPhiMVector & nu1)
615 {
616  double prob=1.0;
617  if(m_fUseTauProbability==0) return prob; // don't apply TauProbability
618  double prob1=1.0;
619  const double mtau=1.777;
620  const double R1=nu1.E()/vis1.E();
621  //--- dealing with 1st tau
622  double m1=nu1.M();
623  double m2=vis1.M();
624  double E1=0.5*(mtau*mtau+m1*m1-m2*m2)/mtau;
625  double E2=mtau-E1;
626  if(E1<=m1 || E1>=mtau)
627  {
628  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::TauProbability: bad E1, returning 0 ");
629  return 0.0;
630  }
631  if(E2<=m2 || E2>=mtau)
632  {
633  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::TauProbability: bad E2, returning 0 ");
634  return 0.0;
635  }
636  preparedInput.m_tlv_tmp.SetPxPyPzE(0.,0.,0.,0.);
637  preparedInput.m_tlv_tmp+=nu1;
638  preparedInput.m_tlv_tmp+=vis1;
639  // double p=(nu1+vis1).P();
640  double p=preparedInput.m_tlv_tmp.P();
641  double V=p/sqrt(p*p+mtau*mtau);
642  double p0;
643  if(type1==8) p0=sqrt(E2*E2-m2*m2); // leptonic tau
644  else p0=E1; // hadronic tau
645  prob1=0.5*mtau/(p0*V*pow(R1+1.0,2));
646  // avoid too large values
647  prob=std::min(prob1,1.);
648  return prob;
649 }
650 
651 double MissingMassProb::TauProbability(MissingMassInput& preparedInput, const int & type1, const PtEtaPhiMVector & vis1, const PtEtaPhiMVector & nu1,
652  const int & type2, const PtEtaPhiMVector & vis2, const PtEtaPhiMVector & nu2)
653 {
654  double prob=1.0;
655  if(m_fUseTauProbability==0) return prob; // don't apply TauProbability
656  double prob1=1.0;
657  double prob2=1.0;
658  const double mtau=1.777;
659  const double R1=nu1.E()/vis1.E();
660  const double R2=nu2.E()/vis2.E();
661  //--- dealing with 1st tau
662  double m1=nu1.M();
663  double m2=vis1.M();
664  double E1=0.5*(mtau*mtau+m1*m1-m2*m2)/mtau;
665  double E2=mtau-E1;
666  if(E1<=m1 || E1>=mtau)
667  {
668  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::TauProbability: bad E1, returning 0 ");
669  return 0.0;
670  }
671  if(E2<=m2 || E2>=mtau)
672  {
673  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::TauProbability: bad E2, returning 0 ");
674  return 0.0;
675  }
676  preparedInput.m_tlv_tmp.SetPxPyPzE(0.,0.,0.,0.);
677  preparedInput.m_tlv_tmp+=nu1;
678  preparedInput.m_tlv_tmp+=vis1;
679  // double p=(nu1+vis1).P();
680  double p=preparedInput.m_tlv_tmp.P();
681  double V=p/sqrt(p*p+mtau*mtau);
682  double p0;
683  if(type1==8) p0=sqrt(E2*E2-m2*m2); // leptonic tau
684  else p0=E1; // hadronic tau
685  prob1=0.5*mtau/(p0*V*pow(R1+1.0,2));
686  // avoid too large values
687  prob1=std::min(prob1,1.);
688 
689 
690  //--- dealing with 2nd tau
691  m1=nu2.M();
692  m2=vis2.M();
693  E1=0.5*(mtau*mtau+m1*m1-m2*m2)/mtau;
694  E2=mtau-E1;
695  if(E1<=m1 || E1>=mtau)
696  {
697  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::TauProbability: bad E1, returning 0 ");
698  return 0.0;
699  }
700  if(E2<=m2 || E2>=mtau)
701  {
702  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::TauProbability: bad E2, returning 0 ");
703  return 0.0;
704  }
705  preparedInput.m_tlv_tmp.SetPxPyPzE(0.,0.,0.,0.);
706  preparedInput.m_tlv_tmp+=nu2;
707  preparedInput.m_tlv_tmp+=vis2;
708  // p=(nu2+vis2).P();
709  p=preparedInput.m_tlv_tmp.P();
710 
711 
712  V=p/sqrt(p*p+mtau*mtau);
713  if(type2==8) p0=sqrt(E2*E2-m2*m2); // leptonic tau
714  else p0=E1; // hadronic tau
715  prob2=0.5*mtau/(p0*V*pow(R2+1.0,2));
716  // avoid too large values
717  prob2=std::min(prob2,1.);
718  prob=prob1*prob2;
719  return prob;
720 }
721 
722 
723 // --------- Updated version of TauProbability for lep-had events with Njet25=0, takes into account Winter-2012 analysis cuts
724 double MissingMassProb::TauProbability(MissingMassInput& preparedInput, const int & type1, const PtEtaPhiMVector & vis1, const PtEtaPhiMVector & nu1,
725  const int & type2, const PtEtaPhiMVector & vis2, const PtEtaPhiMVector & nu2, const double & detmet) {
726  double prob=1.0;
727 
728  if(m_fUseTauProbability==0) return prob; // don't apply TauProbability
729 
730  if(m_UseHT)
731  {
732  if(detmet<20.0) // low MET Njet=0 category
733  {
734  const double R1=nu1.P()/vis1.P();
735  const double R2=nu2.P()/vis2.P();
736  const double lep_p1[4]={0.417,0.64,0.52,0.678};
737  const double lep_p2[4]={0.23,0.17,0.315,0.319};
738  const double lep_p3[4]={0.18,0.33,0.41,0.299};
739  const double lep_p4[4]={0.033,0.109,0.129,0.096};
740  const double lep_p5[4]={0.145,0.107,0.259,0.304};
741  int ind=3;
742  int indT=3;
743  const double n_1pr[4]={-0.15,-0.13,-0.25,-0.114};
744  const double s_1pr[4]={0.40,0.54,0.62,0.57};
745  const double n_3pr[4]={-1.08,-1.57,-0.46,-0.39};
746  const double s_3pr[4]={0.53,0.85,0.61,0.53};
747  double Ptau=0.0;
748  double Plep=0.0;
749  if(type1>=0 && type1<=5)
750  {
751  Ptau=(nu1+vis1).P();
752  Plep=(nu2+vis2).P();
753  }
754  if(type2>=0 && type2<=5)
755  {
756  Ptau=(nu2+vis2).P();
757  Plep=(nu1+vis1).P();
758  }
759  if(Plep<50.0 && Plep>=45.0) ind=2;
760  if(Plep<45.0 && Plep>=40.0) ind=1;
761  if(Plep<40.0) ind=0;
762  if(Ptau<50.0 && Ptau>=45.0) indT=2;
763  if(Ptau<45.0 && Ptau>=40.0) indT=1;
764  if(Ptau<40.0) indT=0;
765  if(type1==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R1,lep_p1[ind],lep_p2[ind])+TMath::Landau(R1,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
766  if(type2==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R2,lep_p1[ind],lep_p2[ind])+TMath::Landau(R2,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
767 
768  if(type1>=0 && type1<=2) prob=prob*TMath::Gaus(R1,n_1pr[indT],s_1pr[indT]);
769  if(type2>=0 && type2<=2) prob=prob*TMath::Gaus(R2,n_1pr[indT],s_1pr[indT]);
770  if(type1>=3 && type1<=5) prob=prob*TMath::Gaus(R1,n_3pr[indT],s_3pr[indT]);
771  if(type2>=3 && type2<=5) prob=prob*TMath::Gaus(R2,n_3pr[indT],s_3pr[indT]);
772 
773  }
774  else // high MET Njet=0 category
775  {
776  const double R1=nu1.P()/vis1.P();
777  const double R2=nu2.P()/vis2.P();
778  const double lep_p1[4]={0.441,0.64,0.79,0.8692};
779  const double lep_p2[4]={0.218,0.28,0.29,0.3304};
780  const double lep_p3[4]={0.256,0.33,0.395,0.4105};
781  const double lep_p4[4]={0.048,0.072,0.148,0.1335};
782  const double lep_p5[4]={0.25,0.68,0.10,0.2872};
783  int ind=3;
784  const double p_1prong=-3.706;
785  const double p_3prong=-5.845;
786  double Ptau=0.0;
787  double Plep=0.0;
788  if(type1>=0 && type1<=5)
789  {
790  Ptau=(nu1+vis1).P();
791  Plep=(nu2+vis2).P();
792  }
793  if(type2>=0 && type2<=5)
794  {
795  Ptau=(nu2+vis2).P();
796  Plep=(nu1+vis1).P();
797  }
798  if(Plep<50.0 && Plep>=45.0) ind=2;
799  if(Plep<45.0 && Plep>=40.0) ind=1;
800  if(Plep<40.0) ind=0;
801  const double scale1prong=Ptau>45.0 ? 1.0 : -1.019/((Ptau*0.0074-0.059)*p_1prong);
802  const double scale3prong=Ptau>40.0 ? 1.0 : -1.24/((Ptau*0.0062-0.033)*p_3prong);
803  if(type1==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R1,lep_p1[ind],lep_p2[ind])+TMath::Landau(R1,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
804  if(type2==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R2,lep_p1[ind],lep_p2[ind])+TMath::Landau(R2,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
805 
806  if(type1>=0 && type1<=2) prob=prob*exp(p_1prong*R1*scale1prong)*std::abs(p_1prong*scale1prong)*0.02; // introduced normalization to account for sharpening of probability at low E(tau)
807  if(type2>=0 && type2<=2) prob=prob*exp(p_1prong*R2*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
808  if(type1>=3 && type1<=5) prob=prob*exp(p_3prong*R1*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
809  if(type2>=3 && type2<=5) prob=prob*exp(p_3prong*R2*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
810  }
811  }
812  //----------------- had-had channel ---------------------------------------
813  if( preparedInput.m_tauTypes==TauTypes::hh )
814  {
815 
816  if(m_UseHT) // Events with no jets
817  {
818 
819  const double R[2]={nu1.P()/vis1.P(),nu2.P()/vis2.P()};
820  const double E[2]={(nu1+vis1).E(),(nu2+vis2).E()};
821  const int tau_type[2]={type1,type2};
822  int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
823  int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
824 
825  double par_1p[2][6]; // P(tau)-scaling; lead, sub-lead
826  double par_3p[2][6]; // P(tau)-scaling; lead, sub-lead
827 
828  par_1p[0][0]=0.1273; par_1p[0][1]=-0.2479; par_1p[0][2]=1.0; par_1p[0][3]=-43.16; par_1p[0][4]=0.0; par_1p[0][5]=0.0;
829  par_1p[1][0]=0.3736; par_1p[1][1]=-1.441; par_1p[1][2]=1.0; par_1p[1][3]=-29.82; par_1p[1][4]=0.0; par_1p[1][5]=0.0;
830  par_3p[0][0]=0.1167; par_3p[0][1]=-0.1388; par_3p[0][2]=1.0; par_3p[0][3]=-44.77; par_3p[0][4]=0.0; par_3p[0][5]=0.0;
831  par_3p[1][0]=0.3056; par_3p[1][1]=-2.18; par_3p[1][2]=1.0; par_3p[1][3]=-19.09; par_3p[1][4]=0.0; par_3p[1][5]=0.0;
832  // parameters for sub-leading tau
833  const double C1p=0.062;
834  const double C3p=0.052;
835  const double G1p=1.055;
836  const double G3p=1.093;
837  // Probability for leading tau
838 
839  if( tau_type[order1]>=0 && tau_type[order1]<=2 ) // 1-prong
840  {
841  //double x=std::min(300.,std::max(E[order1],45.0));
842  // 50 to be safe. TO be finalised.
843  // double x=std::min(300.,std::max(E[order1],50.0));
844  double x=std::min(E[order1],300.0);
845  const double slope=par_1p[0][0]+par_1p[0][1]/(par_1p[0][2]*x+par_1p[0][3])+par_1p[0][4]*x > 0.01 ?
846  par_1p[0][0]+par_1p[0][1]/(par_1p[0][2]*x+par_1p[0][3])+par_1p[0][4]*x : 0.01;
847  prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
848  }
849  if( tau_type[order1]>=3 && tau_type[order1]<=5 ) // 3-prong
850  {
851  //double x=std::min(300.,std::max(E[order1],45.0));
852  // double x=std::min(300.,std::max(E[order1],50.0));
853  double x=std::min(E[order1],300.0);
854  const double slope=par_3p[0][0]+par_3p[0][1]/(par_3p[0][2]*x+par_3p[0][3])+par_3p[0][4]*x > 0.01 ?
855  par_3p[0][0]+par_3p[0][1]/(par_3p[0][2]*x+par_3p[0][3])+par_3p[0][4]*x : 0.01;
856  prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
857  }
858  // Probability for sub-leading tau
859  if( tau_type[order2]>=0 && tau_type[order2]<=2 ) // 1-prong
860  {
861  const double par[4]={0.1147,-0.09675,-35.0,3.711E-11};
862  double x=std::min(300.,std::max(E[order2],30.0));
863  // double x=std::min(300.,std::max(E[order2],50.0));
864  const double sigma=G1p*(par_1p[1][0]+par_1p[1][1]/(par_1p[1][2]*x+par_1p[1][3])+par_1p[1][4]*x+par_1p[1][5]*x*x) > 0.01 ?
865  G1p*(par_1p[1][0]+par_1p[1][1]/(par_1p[1][2]*x+par_1p[1][3])+par_1p[1][4]*x+par_1p[1][5]*x*x) : 0.01;
866  if(x<36.0) x=36.0;
867  const double mean=par[0]+par[1]/(x+par[2])+par[3]*pow(x,4);
868  prob=prob*C1p*TMath::Gaus(R[order2],mean,sigma);
869  }
870  if( tau_type[order2]>=3 && tau_type[order2]<=5 ) // 3-prong
871  {
872  double x=std::min(300.,std::max(E[order2],20.0));
873  // double x=std::min(300.,std::max(E[order2],50.0));
874  const double sigma=G3p*(par_3p[1][0]+par_3p[1][1]/(par_3p[1][2]*x+par_3p[1][3])+par_3p[1][4]*x+par_3p[1][5]*x*x) > 0.01 ?
875  G3p*(par_3p[1][0]+par_3p[1][1]/(par_3p[1][2]*x+par_3p[1][3])+par_3p[1][4]*x+par_3p[1][5]*x*x) : 0.01;
876  const double par[4]={0.2302,-2.012,-36.08,-0.000373};
877  if(x<37.0) x=37.0;
878  const double mean=par[0]+par[1]/(x+par[2])+par[3]*x;
879  prob=prob*C3p*TMath::Gaus(R[order2],mean,sigma);
880  }
881  }
882  if(!m_UseHT) // Events with jets
883  {
884  const double R1=nu1.P()/vis1.P();
885  const double R2=nu2.P()/vis2.P();
886  const double E1=(nu1+vis1).E();
887  const double E2=(nu2+vis2).E();
888  int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
889  int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
890  const double slope_1p[2]={-3.185,-2.052}; // lead, sub-lead
891  const double slope_3p[2]={-3.876,-2.853}; // lead, sub-lead
892  double par_1p[2][3]; // scaling below 100 GeV; lead, sub-lead
893  double par_3p[2][3]; // scaling below 100 GeV; lead, sub-lead
894  par_1p[0][0]=-0.3745; par_1p[0][1]=0.01417; par_1p[0][2]=-7.285E-5; // [0][i] is always adjusted to match slope at 100 GeV
895  par_1p[1][0]=-0.3683; par_1p[1][1]=0.01807; par_1p[1][2]=-9.514E-5;
896  par_3p[0][0]=-0.3055; par_3p[0][1]=0.01149; par_3p[0][2]=-5.855E-5;
897  par_3p[1][0]=-0.3410; par_3p[1][1]=0.01638; par_3p[1][2]=-9.465E-5;
898  double scale1;
899  double scale2;
900  if(type1>=0 && type1<=2) // 1-prong
901  {
902  scale1=E1>100.0 ? 1.0 : 1.0/std::abs((par_1p[order1][0]+par_1p[order1][1]*E1+par_1p[order1][2]*E1*E1)*slope_1p[order1]);
903  if(scale1<1.0) scale1=1.0;
904  if(scale1>100.0) scale1=100.0;
905  prob=prob*std::abs(slope_1p[order1])*scale1*exp(slope_1p[order1]*scale1*R1)*0.04;
906  }
907  if(type1>=3 && type1<=5) // 3-prong
908  {
909  scale1=E1>100.0 ? 1.0 : 1.0/std::abs((par_3p[order1][0]+par_3p[order1][1]*E1+par_3p[order1][2]*E1*E1)*slope_3p[order1]);
910  if(scale1<1.0) scale1=1.0;
911  if(scale1>100.0) scale1=100.0;
912  prob=prob*std::abs(slope_3p[order1])*scale1*exp(slope_3p[order1]*scale1*R1)*0.04;
913  }
914  if(type2>=0 && type2<=2) // 1-prong
915  {
916  scale2=E2>100.0 ? 1.0 : 1.0/std::abs((par_1p[order2][0]+par_1p[order2][1]*E2+par_1p[order2][2]*E2*E2)*slope_1p[order2]);
917  if(scale2<1.0) scale2=1.0;
918  if(scale2>100.0) scale2=100.0;
919  prob=prob*std::abs(slope_1p[order2])*scale2*exp(slope_1p[order2]*scale2*R2)*0.04;
920  }
921  if(type2>=3 && type2<=5) // 3-prong
922  {
923  scale2=E2>100.0 ? 1.0 : 1.0/std::abs((par_3p[order2][0]+par_3p[order2][1]*E2+par_3p[order2][2]*E2*E2)*slope_3p[order2]);
924  if(scale2<1.0) scale2=1.0;
925  if(scale2>100.0) scale2=100.0;
926  prob=prob*std::abs(slope_3p[order2])*scale2*exp(slope_3p[order2]*scale2*R2)*0.04;
927 
928  }
929  }
930 
931  }
932  // prob=std::min(prob,1.); // Sasha commented out this line, it was introduced by David. Have to ask about its purpose.
933 
934  return prob;
935 }
936 
937 
938 // returns Mnu probability according pol6 parameterization
939 double MissingMassProb::MnuProbability(MissingMassInput& preparedInput, double mnu, double binsize)
940 {
941  double prob=1.0;
942  double norm=4851900.0;
943  double p[7];
944  p[0]=-288.6/norm; p[1]=6.217E4/(2.0*norm); p[2]=2.122E4/(3.0*norm); p[3]=-9.067E4/(4.0*norm);
945  p[4]=1.433E5/(5.0*norm); p[5]=-1.229E5/(6.0*norm); p[6]=3.434E4/(7.0*norm);
946  double int1=0.0;
947  double int2=0.0;
948  double x1= mnu+0.5*binsize < 1.777-0.113 ? mnu+0.5*binsize : 1.777-0.113;
949  double x2= mnu-0.5*binsize > 0.0 ? mnu-0.5*binsize : 0.0;
950  for(int i=0; i<7; i++)
951  {
952  int1=p[i]*pow(x1,i+1)+int1;
953  int2=p[i]*pow(x2,i+1)+int2;
954  }
955  prob=int1-int2;
956  if(prob<0.0)
957  {
958  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::MnuProbability: negative probability!!! ");
959  return 0.0;
960  }
961  if(prob>1.0)
962  {
963  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::MnuProbability: probability > 1!!! ");
964  return 1.0;
965  }
966  return prob;
967 }
968 
969 // returns Mnu probability according pol6 parameterization
970 double MissingMassProb::MnuProbability(MissingMassInput& preparedInput, double mnu)
971 {
972  if(m_fUseMnuProbability==0) return 1.0;
973  double prob=1.0;
974  const double norm=4851900.0;
975  double p[7];
976  p[0]=-288.6; p[1]=6.217E4; p[2]=2.122E4; p[3]=-9.067E4;
977  p[4]=1.433E5; p[5]=-1.229E5; p[6]=3.434E4;
978  double int1=0.0;
979  for(int i=0; i<7; i++)
980  {
981  int1+=p[i]*pow(mnu,i);
982  }
983  prob=int1/norm;
984  if(prob<0.0)
985  {
986  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::MnuProbability: negative probability!!! ");
987  return 0.0;
988  }
989  if(prob>1.0)
990  {
991  if(preparedInput.m_fUseVerbose==1) Warning("DiTauMassTools", "Warning in MissingMassCalculator::MnuProbability: probability > 1!!! ");
992  return 1.0;
993  }
994  return prob;
995 }
996 
997 double MissingMassProb::MHtProbability(MissingMassInput& preparedInput, const double & d_mhtX, const double & d_mhtY, const double & mht,
998  const double & trueMetGuess, const double & mht_offset) {
999  // all param except trueMetguess unchanged in one event. So can cache agaisnt this one.
1000  //disable cache if (trueMetGuess==trueMetGuesscache) return mhtprobcache;
1001  double mhtprob;
1002  // if(MHtSigma1>0.0 && MHtSigma2>0.0 && MHtGaussFr>0.0)
1003 
1004  // if RANDOMNONUNIF MET already follow the double gaussian parameterisation. So weight should not include it to avoid double counting
1005  // formula to be checked IMHO the two gaussian should be correlated
1006  mhtprob=exp(-0.5*pow(d_mhtX/preparedInput.m_MHtSigma1,2))+preparedInput.m_MHtGaussFr*exp(-0.5*pow(d_mhtX/preparedInput.m_MHtSigma2,2));
1007  mhtprob*=(exp(-0.5*pow(d_mhtY/preparedInput.m_MHtSigma1,2))+preparedInput.m_MHtGaussFr*exp(-0.5*pow(d_mhtY/preparedInput.m_MHtSigma2,2)));
1008 
1009  const double n_arg=(mht-trueMetGuess-mht_offset)/preparedInput.m_MHtSigma1;
1010  mhtprob*=exp(-0.25*pow(n_arg,2)); // assuming sqrt(2)*sigma
1011  return mhtprob;
1012 }
1013 
1014 double MissingMassProb::MHtProbabilityHH(MissingMassInput& preparedInput, const double & d_mhtX, const double & d_mhtY, const double & mht,
1015  const double & trueMetGuess, const double & mht_offset) {
1016  double prob=1.0;
1017 
1018  // updated for final cuts, May 21 2012
1019  // should be merged
1020  prob=prob*(0.0256*TMath::Gaus(d_mhtX,0.0,preparedInput.m_MHtSigma1)+0.01754*TMath::Gaus(d_mhtX,0.0,preparedInput.m_MHtSigma2));
1021  prob=prob*(0.0256*TMath::Gaus(d_mhtY,0.0,preparedInput.m_MHtSigma1)+0.01754*TMath::Gaus(d_mhtY,0.0,preparedInput.m_MHtSigma2));
1022  const double n_arg=(mht-trueMetGuess-mht_offset)/5.7; // this sigma is different from MHtSigma1; actually it depends on dPhi
1023  prob=prob*exp(-0.5*pow(n_arg,2))/(5.7*sqrt(2.0*TMath::Pi())); // assuming sigma from above line
1024 
1025  return prob;
1026 }
1027 
1028 //SpeedUp static instantation
1029 // first index is the calibration set : 0: MMC2011, 1:MMC2012
1030 // second index is the decay 0 : lepton, 1 : 1 prong, 2 3 prong
1031 thread_local double MissingMassProb::s_fit_param[2][3][6][5];
1032 // first parameter: 0- for 1-prong; 1- for 3-prong
1033 thread_local double MissingMassProb::s_ter_sigma_par[2][10][3];
1034 
1035 // returns dTheta3D probability based on ATLAS parameterization
1036 double MissingMassProb::dTheta3d_probabilityFast(MissingMassInput& preparedInput, const int & tau_type,const double & dTheta3d,const double & P_tau) {
1037  double prob=1.0E-10;
1038  int tau_code; // 0: l, 1:1-prong, 2:3-prong
1039  if(tau_type==8) tau_code = 0;
1040  else if(tau_type>=0 && tau_type<=2) tau_code = 1;
1041  else if(tau_type>=3 && tau_type<=5) tau_code = 2;
1042  else if(tau_type==6) return prob;
1043  else
1044  {
1045  Warning("DiTauMassTools", "---- WARNING in MissingMassCalculator::dTheta3d_probabilityFast() ----");
1046  Warning("DiTauMassTools", "%s", ("..... wrong tau_type="+std::to_string(tau_type)).c_str());
1047  Warning("DiTauMassTools", "%s", ("..... returning prob="+std::to_string(prob)).c_str());
1048  Warning("DiTauMassTools", "____________________________________________________________");
1049  return prob;
1050  }
1051 
1052 
1053  double myDelThetaParam[6];
1054 
1055  for (int i=0;i<6;++i)
1056  {
1061  myDelThetaParam[i]=dTheta3Dparam(i,tau_code,P_tau,s_fit_param[1][tau_code][i]);
1062  }
1063  double dTheta3dVal=dTheta3d;
1064 
1065  if (tau_type==8) prob=myDelThetaLepFunc(&dTheta3dVal, myDelThetaParam);
1066  else prob=myDelThetaHadFunc(&dTheta3dVal, myDelThetaParam);
1067 
1068  if (false)
1069  {
1070 
1071  if( preparedInput.m_fUseVerbose==1 && (prob>1.0 || prob<0.0))
1072  {
1073  Warning("DiTauMassTools", "---- WARNING in MissingMassCalculator::dTheta3d_probabilityFast() ----");
1074  Warning("DiTauMassTools", "%s", ("..... wrong probability="+std::to_string(prob)).c_str());
1075  Warning("DiTauMassTools", "%s", ("..... debugging: tau_type="+std::to_string(tau_type)+"dTheta3d="+std::to_string(dTheta3d)+" P_tau="+std::to_string(P_tau)).c_str());
1076  Warning("DiTauMassTools", "____________________________________________________________");
1077  prob=1.0E-10;
1078  }
1079  }
1080 
1081  return prob;
1082 }
1083 
1084 // dTheta probability density function for hadronic taus
1085 double MissingMassProb::myDelThetaHadFunc(double *x, double *par)
1086 {
1087  double fitval=1.0E-10;
1088  if(x[0]>TMath::Pi() || x[0]<0.0) return fitval;
1089  const double arg=x[0];
1090  const double arg_L=arg;
1091  const double mean=par[1];
1092  const double sigmaG=par[2];
1093  const double mpv=par[3];
1094  const double sigmaL=par[4];
1095 
1100  const double norm=sqrt(2.0*TMath::Pi());
1101  const double g1=TMath::Gaus(arg,mean,sigmaG)/norm;
1102  const double g2=TMath::Landau(arg_L,mpv,sigmaL)/norm;
1103  fitval=par[0]*g1/sigmaG+par[5]*g2/sigmaL;
1104  }
1105 
1106  if(fitval<0.0) return 0.0;
1107  return fitval;
1108 }
1109 
1110 // dTheta probability density function for leptonic taus
1111 double MissingMassProb::myDelThetaLepFunc(double *x, double *par)
1112 {
1113  double fitval=1.0E-10;
1114  if(x[0]>TMath::Pi() || x[0]<0.0) return fitval;
1115  double arg=x[0]/par[1];
1116 
1117  double normL=par[5];
1118  if(normL<0.0) normL=0.0;
1119 
1120  if(arg<1) arg=sqrt(std::abs(arg));
1121  else arg=arg*arg;
1122  const double arg_L=x[0];
1123  const double mean=1.0;
1124  const double sigmaG=par[2];
1125  const double mpv=par[3];
1126  const double sigmaL=par[4];
1127  const double g1=normL*TMath::Gaus(arg,mean,sigmaG);
1128  const double g2=TMath::Landau(arg_L,mpv,sigmaL);
1129  fitval=par[0]*(g1+g2)/(1.0+normL);
1130  if(fitval<0.0) return 0.0;
1131  return fitval;
1132 }
1133 
1134 // returns parameters for dTheta3D pdf
1135 double MissingMassProb::dTheta3Dparam(const int & parInd, const int & tau_type, const double & P_tau, const double *par) {
1136  //tau_type 0: l, 1:1-prong, 3:3-prong
1137  if(P_tau<0.0) return 0.0;
1138 
1139 
1140  if(parInd==0) {
1145  return (par[0]+par[1]*P_tau+par[2]*pow(P_tau,2)+par[3]*pow(P_tau,3)+par[4]*pow(P_tau,4))*0.00125;
1146  }
1147  }
1148  else { // parInd==0
1153  if(tau_type==0) return par[0]*(exp(-par[1]*P_tau)+par[2]/P_tau)+par[3]+par[4]*P_tau;
1154  else return par[0]*(exp(-par[1]*sqrt(P_tau))+par[2]/P_tau)+par[3]+par[4]*P_tau;
1155  }
1156  }
1157  return 0.;
1158 }
1159 
1161  // compute MET resolution (eventually use HT)
1162  if(preparedInput.m_METsigmaP<0.1 || preparedInput.m_METsigmaL<0.1)
1163  {
1165  {
1166  if(preparedInput.m_fUseVerbose==1) { Info("DiTauMassTools", "Attempting to set LFV MMC settings"); }
1167  double mT1 = mT(preparedInput.m_vistau1,preparedInput.m_MetVec);
1168  double mT2 = mT(preparedInput.m_vistau2,preparedInput.m_MetVec);
1169  int sr_switch = 0;
1170  if(preparedInput.m_vistau1.M()<0.12 && preparedInput.m_vistau2.M()<0.12) // lep-lep case
1171  {
1172  if(preparedInput.m_LFVmode==0) // e+tau(->mu) case
1173  {
1174  if(preparedInput.m_vistau1.M()<0.05 && preparedInput.m_vistau2.M()>0.05)
1175  {
1176  if(mT1>mT2) sr_switch = 0; // SR1
1177  else sr_switch = 1; // SR2
1178  }
1179  else
1180  {
1181  if(mT1>mT2) sr_switch = 1; // SR2
1182  else sr_switch = 0; // SR1
1183  }
1184  }
1185  if(preparedInput.m_LFVmode==1) // mu+tau(->e) case
1186  {
1187  if(preparedInput.m_vistau1.M()>0.05 && preparedInput.m_vistau2.M()<0.05)
1188  {
1189  if(mT1>mT2) sr_switch = 0; // SR1
1190  else sr_switch = 1; // SR2
1191  }
1192  else
1193  {
1194  if(mT1>mT2) sr_switch = 1; // SR2
1195  else sr_switch = 0; // SR1
1196  }
1197  }
1198  }
1199  if((preparedInput.m_vistau1.M()<0.12 && preparedInput.m_vistau2.M()>0.12) || (preparedInput.m_vistau2.M()<0.12 && preparedInput.m_vistau1.M()>0.12)) // lep-had case
1200  {
1201  if(preparedInput.m_vistau1.M()<0.12 && preparedInput.m_vistau2.M()>0.12)
1202  {
1203  if(mT1>mT2) sr_switch = 0; // SR1
1204  else sr_switch = 1; // SR2
1205  }
1206  else
1207  {
1208  if(mT1>mT2) sr_switch = 1; // SR2
1209  else sr_switch = 0; // SR1
1210  }
1211  }
1212 
1213  m_UseHT = false;
1214  if(preparedInput.m_Njet25==0) // 0-jet
1215  {
1216  double sigmaSyst = 0.10; // 10% systematics for now (be conservative)
1217  double METresScale;
1218  double METoffset;
1219  if(sr_switch==0)
1220  {
1221  METresScale = 0.41*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1222  METoffset = 7.36*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1223  }
1224  else
1225  {
1226  METresScale = 0.34*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1227  METoffset = 6.61*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1228  }
1229  if(preparedInput.m_fUseVerbose==1) {
1230  Info("DiTauMassTools", "%s", ("SumEt = "+std::to_string(preparedInput.m_SumEt)).c_str());
1231  Info("DiTauMassTools", "%s", ("METoffset = "+std::to_string(METoffset)).c_str());
1232  Info("DiTauMassTools", "%s", ("METresScale = "+std::to_string(METresScale)).c_str());
1233  }
1234 
1235  double sigma = preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1236  preparedInput.m_METsigmaP = sigma;
1237  preparedInput.m_METsigmaL = sigma;
1238  if(preparedInput.m_fUseVerbose==1) {
1239  Info("DiTauMassTools", "%s", ("=> METsigmaP = "+std::to_string(preparedInput.m_METsigmaP)).c_str());
1240  Info("DiTauMassTools", "%s", ("=> METsigmaL = "+std::to_string(preparedInput.m_METsigmaL)).c_str());
1241  }
1242  }
1243  if(preparedInput.m_Njet25>0) // Inclusive 1-jet
1244  {
1245  double sigmaSyst = 0.10; // 10% systematics for now (be conservative)
1246  double sigma = 0.;
1247  double METresScale;
1248  double METoffset;
1249  if(sr_switch==0)
1250  {
1251  METresScale = 0.38*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1252  METoffset = 7.96*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1253  }
1254  else
1255  {
1256  METresScale = 0.39*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1257  METoffset = 6.61*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1258  }
1259 
1260  // MET resolution can't be perfect in presence of other objects (i.e., electrons, jets, taus), so assume minSumEt = 5.0 for now
1261  sigma = preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1262  preparedInput.m_METsigmaP = sigma;
1263  preparedInput.m_METsigmaL = sigma;
1264  } // Njet25>0
1265  }
1266  else //LFV
1267  {
1268  //DRDRMERGE end addition
1269 
1270  if(preparedInput.m_METScanScheme==1) // default for Winter 2012 and further
1271  {
1272  //LEP-HAD
1273  if ( preparedInput.m_tauTypes==TauTypes::lh ) // lephad case
1274  {
1275  //0-jet
1276  if(preparedInput.m_Njet25==0)//0-jet
1277  {
1278  // placeholder for 2019 tune
1281  if(preparedInput.m_MetVec.R()<20.0) // 0-jet low MET case
1282  {
1283  if(std::abs(preparedInput.m_DelPhiTT)>2.95 && m_allowUseHT) // use mHt only if dPhi(lep-tau)>2.95
1284  {
1285  m_UseHT = true;
1286  // giving priority to external settings
1287  if(preparedInput.m_MHtSigma1<0.0) preparedInput.m_MHtSigma1 = 4.822;
1288  if(preparedInput.m_MHtSigma2<0.0) preparedInput.m_MHtSigma2 = 10.31;
1289  if(preparedInput.m_MHtGaussFr<0.0) preparedInput.m_MHtGaussFr = 6.34E-5;
1290  }
1291  else
1292  {
1293  m_UseHT = false;
1294  double sigmaSyst = 0.10; // 10% systematics for now (be conservative)
1295  double METresScale = 0.32*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1296  double METoffset = 5.38*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1297  double sigma = preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1298  preparedInput.m_METsigmaP = sigma;
1299  preparedInput.m_METsigmaL = sigma;
1300  }
1301  }
1302  else // 0-jet high MET case
1303  {
1304  if(std::abs(preparedInput.m_DelPhiTT)>2.8 && m_allowUseHT) // use mHt only if dPhi(lep-tau)>2.8
1305  {
1306  m_UseHT = true;
1307  // giving priority to external settings
1308  if(preparedInput.m_MHtSigma1<0.0) preparedInput.m_MHtSigma1 = 7.5;
1309  if(preparedInput.m_MHtSigma2<0.0) preparedInput.m_MHtSigma2 = 13.51;
1310  if(preparedInput.m_MHtGaussFr<0.0) preparedInput.m_MHtGaussFr = 6.81E-4;
1311  preparedInput.m_METsigmaP = preparedInput.m_MHtSigma2; // sigma of 2nd Gaussian for missing Ht resolution
1312  preparedInput.m_METsigmaL = preparedInput.m_MHtSigma2;
1313  }
1314  else
1315  {
1316  m_UseHT = false;
1317  double sigmaSyst = 0.10; // 10% systematics for now (be conservative)
1318  double METresScale = 0.87*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1319  double METoffset = 4.16*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1320  double sigma = preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1321  preparedInput.m_METsigmaP = sigma;
1322  preparedInput.m_METsigmaL = sigma;
1323  }
1324  } // high MET
1325  } // MMC2016MC15C or MMC2019
1326  // 2015 high-mass tune; avergare MET resolution for Mh=600,1000 mass points
1328  {
1329  m_UseHT = false;
1330  double sigmaSyst = 0.10; // 10% systematics for now (be conservative)
1331  double METresScale = 0.65*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1332  double METoffset = 5.0*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1333  double sigma = preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1334  preparedInput.m_METsigmaP = sigma;
1335  preparedInput.m_METsigmaL = sigma;
1336  } // MMC2015HIGHMASS
1337  } // 0 jet
1338  //1-jet
1339  else if(preparedInput.m_Njet25>0) // Inclusive 1-jet and VBF lep-had categories for Winter 2012
1340  {
1341  double sigmaSyst=0.10; // 10% systematics for now (be conservative)
1342  double sigma=0.;
1343  // 2015 high-mass tune; average MET resolution for Mh=400,600 mass points (they look consistent);
1345  {
1346  double METresScale=0.86*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1347  double METoffset=3.0*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1348  // MET resolution can't be perfect in presence of other objects (i.e., electrons, jets, taus), so assume minSumEt=5.0 for now
1349  sigma= preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1350  }
1351  //2016 mc15c or 2019
1354  {
1355  double x = preparedInput.m_DelPhiTT;
1356  double dphi_scale = x > 0.3 ? 0.9429 - 0.059*x + 0.054*x*x : 0.728;
1357  double METoffset = 1.875*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1358  double METresScale1 = 8.914*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1359  double METresScale2 = -8.53*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1360 
1361 
1362  sigma = preparedInput.m_SumEt > 80.0 ? METoffset + METresScale1*TMath::Log(sqrt(preparedInput.m_SumEt)+METresScale2) : 5.0;
1363  sigma = sigma * dphi_scale;
1364  }
1365  //
1366 
1367  preparedInput.m_METsigmaP=sigma;
1368  preparedInput.m_METsigmaL=sigma;
1369  } // Njet25>0
1370 
1371  } // lep-had
1372 
1373  //HAD-HAD
1374  else if(preparedInput.m_tauTypes==TauTypes::hh) // had-had events
1375  {
1376  if(preparedInput.m_Njet25==0 && m_mmcCalibrationSet==MMCCalibrationSet::MMC2015HIGHMASS) //0-jet high mass hadhad
1377  {
1378  // 2015 high-mass tune; average of all mass points
1379  // double METresScale=-1.;
1380  // double METoffset=-1.;
1381  double sigmaSyst=0.10; // 10% systematics for now (be conservative)
1382 
1383  double METresScale=0.9*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1384  double METoffset=-1.8*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1385  double sigma= preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : std::abs(METoffset);
1386  preparedInput.m_METsigmaP=sigma;
1387  preparedInput.m_METsigmaL=sigma;
1388 
1389  }
1390  else if(preparedInput.m_Njet25==0 &&
1393  {
1394  double sigmaSyst=0.10; // 10% systematics for now (be conservative)
1395  double x = preparedInput.m_DelPhiTT;
1396  double dphi_scale = x > 2.5 ? 11.0796 - 4.61236*x + 0.423617*x*x : 2.;
1397  double METoffset = -8.51013*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1398  double METresScale1 = 8.54378*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1399  double METresScale2 = -3.97146*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1400  double sigma= preparedInput.m_SumEt>80.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.m_SumEt)+METresScale2) : 5.;
1401  sigma = sigma*dphi_scale;
1402 
1403  preparedInput.m_METsigmaP=sigma;
1404  preparedInput.m_METsigmaL=sigma;
1405 
1406  }
1407  else if(preparedInput.m_Njet25==0 && m_allowUseHT) // 0-jet high MET had-had category for Winter 2012
1408  {
1409 
1410  m_UseHT=true; // uncomment this line to enable HT also for HH (crucial)
1411  // updated for final cuts, may 21 2012
1412  if(preparedInput.m_MHtSigma1<0.0) preparedInput.m_MHtSigma1=5.972;
1413  if(preparedInput.m_MHtSigma2<0.0) preparedInput.m_MHtSigma2=13.85;
1414  // if(MHtGaussFr<0.0) MHtGaussFr=0.4767; // don't directly use 2nd fraction
1415  }
1416  //1-jet
1417  else // Inclusive 1-jet and VBF categories
1418  {
1419  double METresScale=-1.;
1420  double METoffset=-1.;
1421  double sigmaSyst=0.10; // 10% systematics for now (be conservative)
1422 
1423  // previous value in trunk
1425  // 2015 high-mass tune; average of all mass points
1426  METresScale = 1.1*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1427  METoffset = -5.0*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1428  }
1429  // MET resolution can't be perfect in presence of other objects (i.e., electrons, jets, taus), so assume minSumEt=5.0 for now
1430  double sigma = preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : std::abs(METoffset);
1431 
1434  double x = preparedInput.m_DelPhiTT;
1435  double dphi_scale = x > 0.6 ? 1.42047 - 0.666644*x + 0.199986*x*x : 1.02;
1436  METoffset = 1.19769*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1437  double METresScale1 = 5.61687*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1438  double METresScale2 = -4.2076*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1439  sigma= preparedInput.m_SumEt>115.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.m_SumEt)+METresScale2) : 12.1;
1440  sigma = sigma*dphi_scale;
1441  } //for hh 2016 mc15c
1442 
1443  preparedInput.m_METsigmaP = sigma;
1444  preparedInput.m_METsigmaL = sigma;
1445 
1446  }// 1 jet
1447  } // had-had
1448  //LEP-LEP
1449  else if(preparedInput.m_tauTypes==TauTypes::ll) // setup for LEP-LEP channel
1450  {
1451  if(m_mmcCalibrationSet==MMCCalibrationSet::MMC2015HIGHMASS) // placeholder for 2015 high-mass tune; for now it is the same as 2012
1452  {
1453  m_UseHT = false;
1454  double sigmaSyst = 0.10; // 10% systematics for now (be conservative)
1455  double METresScale = -1.0;
1456  double METoffset = -1.0;
1457  double sigma = 5.0;
1458  // tune is based on cuts for Run-1 paper analysis
1459  if(preparedInput.m_Njet25==0)
1460  {
1461  // use tune for emebedding
1462  METresScale=-0.4307*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1463  METoffset=7.06*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1464  double METresScale2=0.07693*(1.0+preparedInput.m_METresSyst*sigmaSyst); // quadratic term
1465  // this is a tune for Higgs125
1466  // METresScale=-0.5355*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1467  // METoffset=11.5*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1468  // double METresScale2=0.07196*(1.0+preparedInput.m_METresSyst*sigmaSyst); // quadratic term
1469  sigma= preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt)+METresScale2*preparedInput.m_SumEt : METoffset;
1470  }
1471  if(preparedInput.m_Njet25>0)
1472  {
1473  // use tune for embedding
1474  METresScale=0.8149*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1475  METoffset=5.343*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1476  // this is a tune for Higgs125
1477  // METresScale=0.599*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1478  // METoffset=8.223*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1479  sigma= preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt) : METoffset;
1480  }
1481  preparedInput.m_METsigmaP = sigma;
1482  preparedInput.m_METsigmaL = sigma;
1483  } // end of MMC2015HIGHMASS
1484 
1487  // 2016 MC15c + 2019 leplep
1488  {
1489  m_UseHT=false;
1490  double sigmaSyst=0.10; // 10% systematics for now (be conservative)
1491  double METresScale=-1.0;
1492  double METoffset=-1.0;
1493  double sigma=5.0;
1494  double min_sigma = 2.0;
1495  // tune is based on cuts for Run-1 paper analysis
1496  if(preparedInput.m_Njet25==0)
1497  {
1498  // Madgraph Ztautau MET param
1499  METoffset = 4.22581*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1500  METresScale = 0.03818*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1501  double METresScale2= 0.12623;
1502  sigma= preparedInput.m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.m_SumEt)+METresScale2*preparedInput.m_SumEt : min_sigma;
1503  if (m_fUseDphiLL) {
1504  double p0 = 2.60131;
1505  double p1const = 1.22427;
1506  double p2quad = -1.71261;
1507  double DphiLL = std::abs(Phi_mpi_pi(preparedInput.m_vistau1.Phi()-preparedInput.m_vistau2.Phi()));
1508  sigma *= (DphiLL < p0) ? p1const : p1const+
1509  p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1510  }
1511  if (sigma < min_sigma) sigma = min_sigma;
1512  }
1513  if(preparedInput.m_Njet25>0)
1514  {
1515  // Madgraph Ztautau MET param
1516  METoffset = 5.42506*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1517  METresScale = 5.36760*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1518  double METoffset2 = -4.86808*(1.0+preparedInput.m_METresSyst*sigmaSyst);
1519  if (preparedInput.m_SumEt > 0.0) {
1520  double x = sqrt(preparedInput.m_SumEt);
1521  sigma = (x+METoffset2 > 1) ? METoffset+METresScale*log(x+METoffset2) : METoffset;
1522  } else {
1523  sigma = METoffset;
1524  }
1525  if (m_fUseDphiLL) {
1526  double p0 = 2.24786;
1527  double p1const = 0.908597;
1528  double p2quad = 0.544577;
1529  double DphiLL = std::abs(Phi_mpi_pi(preparedInput.m_vistau1.Phi()-preparedInput.m_vistau2.Phi()));
1530  sigma *= (DphiLL < p0) ? p1const : p1const+
1531  p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1532  }
1533  if (sigma < min_sigma) sigma = min_sigma;
1534  }
1535  preparedInput.m_METsigmaP=sigma;
1536  preparedInput.m_METsigmaL=sigma;
1537  }//2016 mc15c
1538 
1539  } // lep-lep
1540 
1541  } //preparedInput.METScanScheme
1542 
1543  if(preparedInput.m_METScanScheme==0) // old scheme with JER
1544  {
1545  if(preparedInput.m_dataType==0 || preparedInput.m_dataType==1) preparedInput.SetMetScanParamsUE(preparedInput.m_SumEt,preparedInput.m_METcovphi,preparedInput.m_dataType);
1546  else preparedInput.SetMetScanParamsUE(preparedInput.m_SumEt,preparedInput.m_METcovphi,0);
1547  }
1548  }
1549  } // end else LFV
1550 
1551  return;
1552 }
DiTauMassTools::MissingMassProb::m_paramVectorAngle
std::vector< TF1 * > m_paramVectorAngle
Definition: MissingMassProb.h:110
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
MissingMassProb.h
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
DiTauMassTools::MissingMassProb::setParamAngle
void setParamAngle(const PtEtaPhiMVector &tauvec, int tau, int tautype)
Definition: MissingMassProb.cxx:155
DiTauMassTools::TauTypes::lh
@ lh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
DiTauMassTools::MissingMassProb::m_allowUseHT
bool m_allowUseHT
Definition: MissingMassProb.h:120
DiTauMassTools::MissingMassProb::MetProbabilityWrapper
static double MetProbabilityWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:23
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
scale2
#define scale2
Definition: JetAttributeHisto.cxx:42
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
DiTauMassTools::MMCCalibrationSet::MMC2015HIGHMASS
@ MMC2015HIGHMASS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::TauTypes::hh
@ hh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
DiTauMassTools::MissingMassProb::m_fUseTauProbability
bool m_fUseTauProbability
Definition: MissingMassProb.h:122
DiTauMassTools::MissingMassProb::m_mmcCalibrationSet
MMCCalibrationSet::e m_mmcCalibrationSet
Definition: MissingMassProb.h:118
DiTauMassTools::MissingMassInput::m_METsigmaP
double m_METsigmaP
Definition: MissingMassInput.h:62
DiTauMassTools::MissingMassProb::m_formulaAngle1
TF1 * m_formulaAngle1
Definition: MissingMassProb.h:101
DiTauMassTools::MissingMassInput::m_METScanScheme
int m_METScanScheme
Definition: MissingMassInput.h:74
DiTauMassTools::MissingMassProb::m_formulaAngle2
TF1 * m_formulaAngle2
Definition: MissingMassProb.h:102
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
DiTauMassTools::MissingMassInput::SetMetScanParamsUE
void SetMetScanParamsUE(double sumEt, double phi_scan=0.0, int data_code=0)
Definition: MissingMassInput.cxx:89
DMTest::P
P_v1 P
Definition: P.h:23
DiTauMassTools::MissingMassInput::m_MHtGaussFr
double m_MHtGaussFr
Definition: MissingMassInput.h:70
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
DiTauMassTools::MissingMassInput::m_metVec
XYVector m_metVec
Definition: MissingMassInput.h:79
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
DiTauMassTools::MissingMassProb::MET
void MET(MissingMassInput &preparedInput)
Definition: MissingMassProb.cxx:1160
DiTauMassTools::MissingMassInput::m_inputMEtT
double m_inputMEtT
Definition: MissingMassInput.h:81
DiTauMassTools::MissingMassInput::m_MHtSigma1
double m_MHtSigma1
Definition: MissingMassInput.h:68
DiTauMassTools::MissingMassInput::m_METsigmaL
double m_METsigmaL
Definition: MissingMassInput.h:63
DiTauMassTools::MissingMassProb::m_fUseDphiLL
bool m_fUseDphiLL
Definition: MissingMassProb.h:124
DiTauMassTools::MissingMassInput::m_vistau1
PtEtaPhiMVector m_vistau1
Definition: MissingMassInput.h:54
DiTauMassTools::MissingMassProb::MissingMassProb
MissingMassProb(MMCCalibrationSet::e aset, const std::string &paramFilePath)
Definition: MissingMassProb.cxx:215
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
DiTauMassTools::MissingMassProb::m_UseHT
bool m_UseHT
Definition: MissingMassProb.h:121
DiTauMassTools::MissingMassProb::m_fParams
TFile * m_fParams
Definition: MissingMassProb.h:117
DiTauMassTools::MissingMassProb::m_formulaNuMass
TF1 * m_formulaNuMass
Definition: MissingMassProb.h:109
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
covarianceTool.prob
prob
Definition: covarianceTool.py:678
Phi_mpi_pi
__HOSTDEV__ double Phi_mpi_pi(double)
Definition: GeoRegion.cxx:7
DiTauMassTools::MissingMassProb::s_fit_param
static thread_local double s_fit_param[2][3][6][5]
Definition: MissingMassProb.h:97
x
#define x
DiTauMassTools::MMCCalibrationSet::LFVMMC2012
@ LFVMMC2012
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::MissingMassProb::TauProbabilityWrapper
static double TauProbabilityWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:64
DiTauMassTools::MissingMassProb::dTheta3Dparam
double dTheta3Dparam(const int &parInd, const int &tau_type, const double &P_tau, const double *par)
Definition: MissingMassProb.cxx:1135
DiTauMassTools::MissingMassInput::m_METcovphi
double m_METcovphi
Definition: MissingMassInput.h:61
DiTauMassTools::MissingMassProb::s_ter_sigma_par
static thread_local double s_ter_sigma_par[2][10][3]
Definition: MissingMassProb.h:98
DiTauMassTools::MissingMassInput::m_tauTypes
TauTypes::e m_tauTypes
Definition: MissingMassInput.h:85
DiTauMassTools::MissingMassProb::apply
double apply(MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2, bool constant=false, bool oneTau=false, bool twoTau=false)
Definition: MissingMassProb.cxx:534
DiTauMassTools::MissingMassInput::m_Njet25
int m_Njet25
Definition: MissingMassInput.h:66
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
DiTauMassTools::MissingMassProb::mEtAndTauProbabilityWrapper
static double mEtAndTauProbabilityWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:33
DiTauMassTools
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:24
DiTauMassTools::MissingMassProb::myDelThetaHadFunc
double myDelThetaHadFunc(double *x, double *par)
Definition: MissingMassProb.cxx:1085
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
python.changerun.m1
m1
Definition: changerun.py:32
DiTauMassTools::MissingMassInput::m_htOffset
double m_htOffset
Definition: MissingMassInput.h:83
DiTauMassTools::MissingMassInput::m_SumEt
double m_SumEt
Definition: MissingMassInput.h:64
fitman.g1
g1
Definition: fitman.py:619
DiTauMassTools::MissingMassProb::MnuProbability
double MnuProbability(MissingMassInput &preparedInput, double mnu, double binsize)
Definition: MissingMassProb.cxx:939
lumiFormat.i
int i
Definition: lumiFormat.py:85
DiTauMassTools::readInParams
void readInParams(TDirectory *dir, MMCCalibrationSet::e aset, std::vector< TF1 * > &lep_numass, std::vector< TF1 * > &lep_angle, std::vector< TF1 * > &lep_ratio, std::vector< TF1 * > &had_angle, std::vector< TF1 * > &had_ratio)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:173
DiTauMassTools::MissingMassInput::m_MHtSigma2
double m_MHtSigma2
Definition: MissingMassInput.h:69
DiTauMassTools::MissingMassProb::dTheta3d_probabilityFastWrapper
static double dTheta3d_probabilityFastWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:43
DiTauMassTools::MissingMassProb::m_formulaRatioHad1
TF1 * m_formulaRatioHad1
Definition: MissingMassProb.h:107
DiTauMassTools::MissingMassInput::m_MEtT
double m_MEtT
Definition: MissingMassInput.h:82
DiTauMassTools::MissingMassProb::dTheta3d_probabilityNewWrapper
static double dTheta3d_probabilityNewWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:88
DiTauMassTools::MMCCalibrationSet::MMC2019
@ MMC2019
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::mT
double mT(const VectorType &vec, const XYVector &met_vec)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:72
DiTauMassTools::MissingMassProb::dTheta3d_probabilityFast
double dTheta3d_probabilityFast(MissingMassInput &preparedInput, const int &tau_type, const double &dTheta3d, const double &P_tau)
Definition: MissingMassProb.cxx:1036
DiTauMassTools::MissingMassProb::m_formulaRatioLep2
TF1 * m_formulaRatioLep2
Definition: MissingMassProb.h:106
hist_file_dump.f
f
Definition: hist_file_dump.py:135
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
DiTauMassTools::MMCCalibrationSet::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
dumpNswErrorDb.constant
def constant
Definition: dumpNswErrorDb.py:22
DiTauMassTools::MissingMassInput::m_dataType
int m_dataType
Definition: MissingMassInput.h:60
DiTauMassTools::MissingMassInput::m_fUseVerbose
bool m_fUseVerbose
Definition: MissingMassInput.h:78
DiTauMassTools::MissingMassProb::setParamRatio
void setParamRatio(int tau, int tautype)
Definition: MissingMassProb.cxx:184
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
DiTauMassTools::MissingMassProb::m_paramVectorRatio
std::vector< TF1 * > m_paramVectorRatio
Definition: MissingMassProb.h:112
DiTauMassTools::MissingMassInput::m_tlv_tmp
PtEtaPhiMVector m_tlv_tmp
Definition: MissingMassInput.h:80
DiTauMassTools::MissingMassProb::m_paramVectorRatioLep
std::vector< TF1 * > m_paramVectorRatioLep
Definition: MissingMassProb.h:113
DiTauMassTools::MissingMassInput::m_MetVec
XYVector m_MetVec
Definition: MissingMassInput.h:53
fitman.g2
g2
Definition: fitman.py:624
PathResolver.h
DiTauMassTools::MissingMassProb::m_probListConstant
std::list< std::function< double(MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)> > m_probListConstant
Definition: MissingMassProb.h:92
DiTauMassTools::MissingMassProb::m_formulaRatioLep1
TF1 * m_formulaRatioLep1
Definition: MissingMassProb.h:105
DiTauMassTools::MissingMassProb::MetProbability
double MetProbability(MissingMassInput &preparedInput, const double &met1, const double &met2, const double &MetSigma1, const double &MetSigma2)
Definition: MissingMassProb.cxx:553
DiTauMassTools::MissingMassInput::m_DelPhiTT
double m_DelPhiTT
Definition: MissingMassInput.h:67
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
DiTauMassTools::MissingMassProb::MHtProbabilityHH
double MHtProbabilityHH(MissingMassInput &preparedInput, const double &d_mhtX, const double &d_mhtY, const double &mht, const double &trueMetGuess, const double &mht_offset)
Definition: MissingMassProb.cxx:1014
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
DiTauMassTools::MissingMassProb::m_formulaRatio1
TF1 * m_formulaRatio1
Definition: MissingMassProb.h:103
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
DiTauMassTools::MissingMassProb::TauProbabilityNewWrapper
static double TauProbabilityNewWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:116
DiTauMassTools::MissingMassInput::m_vistau2
PtEtaPhiMVector m_vistau2
Definition: MissingMassInput.h:55
DiTauMassTools::MissingMassProb::m_formulaRatioHad2
TF1 * m_formulaRatioHad2
Definition: MissingMassProb.h:108
DiTauMassTools::MissingMassProb
Definition: MissingMassProb.h:28
DiTauMassTools::MissingMassProb::m_fUseMnuProbability
bool m_fUseMnuProbability
Definition: MissingMassProb.h:123
DiTauMassTools::MissingMassProb::setParamNuMass
void setParamNuMass()
Definition: MissingMassProb.cxx:147
DiTauMassTools::MissingMassProb::m_probListTwoTau
std::list< std::function< double(MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)> > m_probListTwoTau
Definition: MissingMassProb.h:94
DiTauMassTools::MissingMassProb::myDelThetaLepFunc
double myDelThetaLepFunc(double *x, double *par)
Definition: MissingMassProb.cxx:1111
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DiTauMassTools::MissingMassProb::TauProbabilityLFV
double TauProbabilityLFV(MissingMassInput &preparedInput, const int &type1, const PtEtaPhiMVector &vis1, const PtEtaPhiMVector &nu1)
Definition: MissingMassProb.cxx:614
DiTauMassTools::MissingMassInput::m_inputMEtX
double m_inputMEtX
Definition: MissingMassInput.h:81
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
DiTauMassTools::MissingMassInput
Definition: MissingMassInput.h:21
DiTauMassTools::MMCCalibrationSet::MMC2016MC15C
@ MMC2016MC15C
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::MissingMassProb::m_paramVectorAngleLep
std::vector< TF1 * > m_paramVectorAngleLep
Definition: MissingMassProb.h:111
DiTauMassTools::MissingMassInput::m_METresSyst
int m_METresSyst
Definition: MissingMassInput.h:75
DiTauMassTools::MissingMassProb::TauProbability
double TauProbability(MissingMassInput &preparedInput, const int &type1, const PtEtaPhiMVector &vis1, const PtEtaPhiMVector &nu1, const int &type2, const PtEtaPhiMVector &vis2, const PtEtaPhiMVector &nu2)
Definition: MissingMassProb.cxx:651
DiTauMassTools::MissingMassProb::m_probListOneTau
std::list< std::function< double(MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)> > m_probListOneTau
Definition: MissingMassProb.h:93
DiTauMassTools::MissingMassProb::MnuProbabilityNewWrapper
static double MnuProbabilityNewWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:130
scale1
#define scale1
Definition: JetAttributeHisto.cxx:41
DiTauMassTools::MissingMassProb::MHtProbability
double MHtProbability(MissingMassInput &preparedInput, const double &d_mhtX, const double &d_mhtY, const double &mht, const double &trueMetGuess, const double &mht_offset)
Definition: MissingMassProb.cxx:997
DiTauMassTools::MMCCalibrationSet::UPGRADE
@ UPGRADE
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
DiTauMassTools::MissingMassProb::MnuProbabilityWrapper
static double MnuProbabilityWrapper(MissingMassProb *prob, MissingMassInput &preparedInput, const int &tau_type1, const int &tau_type2, const PtEtaPhiMVector &tauvec1, const PtEtaPhiMVector &tauvec2, const PtEtaPhiMVector nuvec1, const PtEtaPhiMVector &nuvec2)
Definition: MissingMassProb.cxx:72
DiTauMassTools::Angle
double Angle(const VectorType1 &vec1, const VectorType2 &vec2)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:61
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
DiTauMassTools::MissingMassInput::m_inputMEtY
double m_inputMEtY
Definition: MissingMassInput.h:81
DiTauMassTools::MissingMassProb::m_formulaRatio2
TF1 * m_formulaRatio2
Definition: MissingMassProb.h:104
DiTauMassTools::MissingMassInput::m_LFVmode
int m_LFVmode
Definition: MissingMassInput.h:84
DiTauMassTools::MissingMassProb::~MissingMassProb
~MissingMassProb()
Definition: MissingMassProb.cxx:531
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
TRTCalib_cfilter.p0
p0
Definition: TRTCalib_cfilter.py:129
DiTauMassTools::MissingMassProb::m_paramVectorNuMass
std::vector< TF1 * > m_paramVectorNuMass
Definition: MissingMassProb.h:114
DiTauMassTools::TauTypes::ll
@ ll
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
DiTauMassTools::MissingMassProb::mEtAndTauProbability
double mEtAndTauProbability(MissingMassInput &preparedInput)
Definition: MissingMassProb.cxx:574