Loading [MathJax]/extensions/tex2jax.js
JHUGen MELA  JHUGen v7.5.6, MELA v2.4.2
Matrix element calculations as used in JHUGen.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SuperDijetMela.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cassert>
3 #include "MELAStreamHelpers.hh"
4 #include "MELACandidate.h"
5 #include "SuperDijetMela.h"
6 
7 
8 using namespace std;
12 
13 
15 sqrts(sqrts_),
16 verbosity(verbosity_)
17 {
18  Build();
19 }
21 sqrts(other.sqrts),
22 verbosity(other.verbosity)
23 {
24  Build();
25 }
27  for (auto it=ResolutionModelMap.begin(); it!=ResolutionModelMap.end(); it++) delete it->second;
28 }
29 
33 }
34 
36  // Setup file path
37  const string MELAPKGPATH = TVar::GetMELAPath();
38  TString path = TString(MELAPKGPATH.c_str()) + "data/resolution_mJJ_recoVStrue_";
39  TString prodName;
40  switch (prod){
41  case TVar::Had_ZH:
42  prodName = "ZH";
43  break;
44  case TVar::Had_WH:
45  prodName = "WH";
46  break;
47  default:
48  MELAout << "SuperDijetMela::SetupResolutionModel: Production " << TVar::ProductionName(prod) << " is unknown." << endl;
49  return;
50  }
51  sqrts = floor(sqrts); // interim solution until 13.6 TeV production is ready
52 
53  path += prodName;
54  path += Form("_%.0fTeV%s", sqrts, ".root");
55 
56  TString appendName = Form("mJJReso_%.0fTeV", sqrts);
57  MELADifermionResolutionModel* model = new MELADifermionResolutionModel(prod, sqrts, path, appendName);
58  if (model->isValid()){
59  int iprod = (int)prod;
60  ResolutionModelMap[iprod] = model;
61  }
62  else MELAerr << "SuperDijetMela::SetupResolutionModel: Model MELADifermionResolutionModel(" << TVar::ProductionName(prod) << ", " << sqrts << ", " << path << ", " << appendName << ") cannot be built." << endl;
63 }
64 float SuperDijetMela::GetConvBW(TVar::Production prod, MELACandidate* cand, bool useTrueBW){
65  float result=-1;
66  int iprod = (int)prod;
67  if (cand!=0){
68  float mJJval=-1;
69  bool modelExists = (ResolutionModelMap.find(iprod)!=ResolutionModelMap.end());
70  int AssociationVCompatibility=0;
71 
72  if (modelExists || useTrueBW){
73  // Get a simple event record, safest way to handle jet mass corrections
74  int nRequested_AssociatedJets=0;
75  int partIncCode=TVar::kNoAssociated; // Just to avoid warnings
76  if (prod == TVar::Had_ZH || prod == TVar::Had_WH){ // Only use associated partons
77  partIncCode=TVar::kUseAssociated_Jets;
78  nRequested_AssociatedJets=2;
79  }
80  if (prod==TVar::Had_WH) AssociationVCompatibility=24;
81  else if (prod==TVar::Had_ZH) AssociationVCompatibility=23;
82  simple_event_record mela_event;
83  mela_event.AssociationCode=partIncCode;
84  mela_event.AssociationVCompatibility=AssociationVCompatibility;
85  mela_event.nRequested_AssociatedJets=nRequested_AssociatedJets;
87  cand,
88  mela_event,
89  verbosity
90  );
91 
92  vector<TLorentzVector> pJets;
93  const SimpleParticleCollection_t& pAssociated = mela_event.pAssociated;
94  for (auto& part : pAssociated){
95  if (PDGHelpers::isAJet(part.first)) pJets.push_back(part.second);
96  if (pJets.size()==2) break;
97  }
98  if (pJets.size()==2) mJJval = (pJets[0] + pJets[1]).M();
99  }
100 
101  if (useTrueBW){
102  float truePoleMass=-1;
103  float truePoleWidth=-1;
104 
105  if (AssociationVCompatibility!=0){
106  truePoleMass=TUtil::GetMass(AssociationVCompatibility);
107  truePoleWidth=TUtil::GetDecayWidth(AssociationVCompatibility);
108  if (mJJval>=0.) result = 1./(pow(pow(mJJval, 2)-pow(truePoleMass, 2), 2) + pow(truePoleMass*truePoleWidth, 2));
109  }
110 
112  << "SuperDijetMela::GetConvBW[idV=" << AssociationVCompatibility << "]::"
113  << "sqrt(s) = " << mJJval
114  << ", true (m,Gamma) = ( " << truePoleMass << " , " << truePoleWidth << " )"
115  << ", ideal BW = " << result
116  << endl;
117  }
118  else if (modelExists){
119  result = ResolutionModelMap[iprod]->getVal(mJJval);
121  << "SuperDijetMela::GetConvBW[" << TVar::ProductionName(prod) << "]::"
122  << "sqrt(s) = " << mJJval
123  << ", reco BW = " << result
124  << endl;
125  }
126  else{
128  << "SuperDijetMela::GetConvBW:: No method for " << TVar::ProductionName(prod) << " is known. "
129  << "sqrt(s) = " << mJJval
130  << ", return value = " << result
131  << endl;
132  }
133  }
134  return result;
135 }
SuperDijetMela::ResolutionModelMap
std::unordered_map< int, MELADifermionResolutionModel * > ResolutionModelMap
Definition: SuperDijetMela.h:13
TVar::VerbosityLevel
VerbosityLevel
Definition: TVar.hh:47
TVar::kNoAssociated
@ kNoAssociated
Definition: TVar.hh:30
TVar::simple_event_record::nRequested_AssociatedJets
int nRequested_AssociatedJets
Definition: TVar.hh:229
SuperDijetMela
Definition: SuperDijetMela.h:8
TVar::ProductionName
TString ProductionName(TVar::Production temp)
Definition: TVar.cc:64
SuperDijetMela::~SuperDijetMela
~SuperDijetMela()
Definition: SuperDijetMela.cc:26
TVar::kUseAssociated_Jets
@ kUseAssociated_Jets
Definition: TVar.hh:33
MELADifermionResolutionModel
Definition: MELADifermionResolutionModel.h:8
TVar::simple_event_record::AssociationVCompatibility
int AssociationVCompatibility
Definition: TVar.hh:228
MELAStreamHelpers::MELAout
MELAOutputStreamer MELAout
SuperDijetMela::SuperDijetMela
SuperDijetMela(float sqrts_, TVar::VerbosityLevel verbosity_)
Definition: SuperDijetMela.cc:14
TVar::simple_event_record::AssociationCode
int AssociationCode
Definition: TVar.hh:227
SuperDijetMela.h
TVar::GetMELAPath
std::string GetMELAPath()
Definition: TVar.cc:122
SuperDijetMela::Build
void Build()
Definition: SuperDijetMela.cc:30
TUtil::GetDecayWidth
double GetDecayWidth(int ipart)
Definition: TUtil.cc:1619
SuperDijetMela::sqrts
float sqrts
Definition: SuperDijetMela.h:10
TVar::Had_ZH
@ Had_ZH
Definition: TVar.hh:75
TUtil::GetMass
double GetMass(int ipart)
Definition: TUtil.cc:1582
MELAStreamHelpers::MELAerr
MELAOutputStreamer MELAerr
MELADifermionResolutionModel::isValid
bool isValid()
Definition: MELADifermionResolutionModel.h:22
MELACandidate.h
SuperDijetMela::verbosity
TVar::VerbosityLevel verbosity
Definition: SuperDijetMela.h:11
TVar::simple_event_record::pAssociated
SimpleParticleCollection_t pAssociated
Definition: TVar.hh:238
MELACandidate
Definition: MELACandidate.h:7
TVar::DEBUG
@ DEBUG
Definition: TVar.hh:51
MELAStreamHelpers.hh
SimpleParticleCollection_t
std::vector< SimpleParticle_t > SimpleParticleCollection_t
Definition: TVar.hh:25
TVar::Had_WH
@ Had_WH
Definition: TVar.hh:76
sqrts
double sqrts
Definition: TMCFM.hh:290
TVar::Production
Production
Definition: TVar.hh:61
TVar::simple_event_record
Definition: TVar.hh:226
SuperDijetMela::SetupResolutionModel
void SetupResolutionModel(TVar::Production prod)
Definition: SuperDijetMela.cc:35
TUtil::GetBoostedParticleVectors
void GetBoostedParticleVectors(MELACandidate *melaCand, TVar::simple_event_record &mela_event, TVar::VerbosityLevel verbosity=TVar::DEBUG)
Definition: TUtil.cc:8212
PDGHelpers::isAJet
bool isAJet(const int id)
Definition: PDGHelpers.cc:18
SuperDijetMela::GetConvBW
float GetConvBW(TVar::Production prod, MELACandidate *cand, bool useTrueBW)
Definition: SuperDijetMela.cc:64