Skip to content

Commit b178c0c

Browse files
MELAProducer: first working version
1 parent bce4cb2 commit b178c0c

File tree

7 files changed

+91
-22
lines changed

7 files changed

+91
-22
lines changed

Diff for: data/ArtusConfigs/Run2CPStudies/Includes/settingsMadGraphReweighting.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"MadGraphParamCard" : {
33
"nick" : {
4-
"GluGlu":"$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/ggh/Cards/param_card_cp.dat",
5-
"VBF":"$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/vbf/Cards/param_card_cp.dat"
4+
"GluGlu" : "$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/ggh/Cards/param_card_cp.dat",
5+
"VBF" : "$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/vbf/Cards/param_card_cp.dat"
66
}
77
},
88
"MadGraphParamCardSample" : {
99
"nick" : {
10-
"GluGlu":"$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/ggh/Cards/param_card_default.dat",
11-
"VBF":"$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/vbf/Cards/param_card_default.dat"
10+
"GluGlu" : "$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/ggh/Cards/param_card_default.dat",
11+
"VBF" : "$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/vbf/Cards/param_card_default.dat"
1212
}
1313
},
1414
"MadGraphMixingAnglesOverPiHalf" : {
@@ -46,9 +46,14 @@
4646
},
4747
"MadGraphProcessDirectories" : {
4848
"nick" : {
49-
"GluGlu" :"$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/ggh/SubProcesses/",
49+
"GluGlu" : "$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/ggh/SubProcesses/",
5050
"VBF" : "$CMSSW_BASE/src/CMSAachen3B/MadGraphReweighting/data/vbf/SubProcesses/"
51-
51+
}
52+
},
53+
"MELAHiggsProductionMode" : {
54+
"nick" : {
55+
"GluGlu" : "ggh",
56+
"VBF" : "vbf"
5257
}
5358
}
5459
}

Diff for: interface/HttEnumTypes.h

+13
Original file line numberDiff line numberDiff line change
@@ -195,5 +195,18 @@ class HttEnumTypes : public KappaEnumTypes {
195195
else return KMETUncertainty::NoShift;
196196
LOG(FATAL) << "You need to specify an implemented MET uncertainty in your config.";
197197
};
198+
199+
enum class MELAHiggsProductionMode : int
200+
{
201+
UNDEFINED = 0,
202+
GGH = 1,
203+
VBF = 2
204+
};
205+
static MELAHiggsProductionMode ToMELAHiggsProductionMode(std::string const& melaHiggsProductionMode)
206+
{
207+
if (melaHiggsProductionMode == "ggh") return MELAHiggsProductionMode::GGH;
208+
else if (melaHiggsProductionMode == "vbf") return MELAHiggsProductionMode::VBF;
209+
else return MELAHiggsProductionMode::UNDEFINED;
210+
};
198211
};
199212

Diff for: interface/HttMetadata.h

-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ class HttMetadata : public KappaMetadata
1212
HttMetadata();
1313
virtual ~HttMetadata();
1414

15-
Mela* m_mela = nullptr; // Fortran code behind this class should not be initialised multiple times
1615
};
1716

Diff for: interface/HttSettings.h

+2
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ class HttSettings: public KappaSettings {
393393
IMPL_SETTING(std::string,MadGraphProcessDirectories);
394394
IMPL_SETTING(bool, MadGraphSortingHeavyBQuark);
395395

396+
IMPL_SETTING(std::string, MELAHiggsProductionMode);
397+
396398
// settting for TopPtReweightingProducer
397399
IMPL_SETTING(std::string, TopPtReweightingStrategy)
398400
};

Diff for: interface/Producers/MELAProducer.h

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#pragma once
33

44
#include "HiggsAnalysis/KITHiggsToTauTau/interface/HttTypes.h"
5+
#include "HiggsAnalysis/KITHiggsToTauTau/interface/HttEnumTypes.h"
56

67
// https://github.com/cms-analysis/HiggsAnalysis-ZZMatrixElement/tree/v2.1.1/MELA
78
// https://twiki.cern.ch/twiki/bin/viewauth/CMS/MELAProject
@@ -20,5 +21,10 @@ class MELAProducer: public ProducerBase<HttTypes>
2021
virtual void Produce(event_type const& event, product_type& product,
2122
setting_type const& settings, metadata_type const& metadata) const override;
2223

24+
private:
25+
HttEnumTypes::MELAHiggsProductionMode m_higgsProductionMode = HttEnumTypes::MELAHiggsProductionMode::UNDEFINED;
26+
27+
std::unique_ptr<Mela> m_mela;
28+
2329
};
2430

Diff for: src/HttMetadata.cc

-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@ HttMetadata::HttMetadata() : KappaMetadata()
77

88
HttMetadata::~HttMetadata()
99
{
10-
if (m_mela)
11-
{
12-
delete m_mela;
13-
}
1410
}
1511

Diff for: src/Producers/MELAProducer.cc

+59-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include "Artus/Utility/interface/DefaultValues.h"
55
#include "Artus/Utility/interface/Utility.h"
66

7+
#include <boost/algorithm/string.hpp>
8+
#include <boost/algorithm/string/trim.hpp>
9+
710

811
std::string MELAProducer::GetProducerId() const
912
{
@@ -14,12 +17,11 @@ void MELAProducer::Init(setting_type const& settings, metadata_type& metadata)
1417
{
1518
ProducerBase<HttTypes>::Init(settings, metadata);
1619

20+
m_higgsProductionMode = HttEnumTypes::ToMELAHiggsProductionMode(boost::algorithm::to_lower_copy(boost::algorithm::trim_copy(settings.GetMELAHiggsProductionMode())));
21+
1722
// https://github.com/cms-analysis/HiggsAnalysis-ZZMatrixElement/blob/v2.1.1/MELA/interface/Mela.h
1823
// https://github.com/cms-analysis/HiggsAnalysis-ZZMatrixElement/blob/v2.1.1/MELA/interface/TVar.hh
19-
if (metadata.m_mela == nullptr)
20-
{
21-
metadata.m_mela = new Mela(13.0, 125.0, TVar::SILENT);
22-
}
24+
m_mela = std::unique_ptr<Mela>(new Mela(13.0, 125.0, TVar::SILENT));
2325
}
2426

2527

@@ -30,7 +32,7 @@ void MELAProducer::Produce(event_type const& event, product_type& product,
3032
{
3133
SimpleParticleCollection_t daughters; // Higgs boson or two tau leptons
3234
SimpleParticleCollection_t associated; // additional reconstructed jets
33-
SimpleParticleCollection_t mothers; // incoming partons in case of gen level mode
35+
//SimpleParticleCollection_t mothers; // incoming partons in case of gen level mode
3436

3537
TLorentzVector higgsLV = Utility::ConvertPtEtaPhiMLorentzVector<RMFLV, TLorentzVector>(*product.m_svfitResults.fittedHiggsLV);
3638
daughters.emplace_back(DefaultValues::pdgIdH, higgsLV);
@@ -44,14 +46,60 @@ void MELAProducer::Produce(event_type const& event, product_type& product,
4446
}
4547
}
4648

47-
metadata.m_mela->setInputEvent(&daughters, &associated, &mothers, false);
49+
m_mela->setInputEvent(&daughters, &associated, nullptr /*&mothers*/, false);
50+
51+
// CP even
52+
if (m_higgsProductionMode == HttEnumTypes::MELAHiggsProductionMode::GGH)
53+
{
54+
m_mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::JJQCD);
55+
}
56+
else if (m_higgsProductionMode == HttEnumTypes::MELAHiggsProductionMode::VBF)
57+
{
58+
m_mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::JJVBF);
59+
}
60+
float probCPEven = 0.0;
61+
m_mela->computeProdP(probCPEven, false);
62+
63+
// CP odd
64+
if (m_higgsProductionMode == HttEnumTypes::MELAHiggsProductionMode::GGH)
65+
{
66+
m_mela->setProcess(TVar::H0minus, TVar::JHUGen, TVar::JJQCD);
67+
}
68+
else if (m_higgsProductionMode == HttEnumTypes::MELAHiggsProductionMode::VBF)
69+
{
70+
m_mela->setProcess(TVar::H0minus, TVar::JHUGen, TVar::JJVBF);
71+
}
72+
float probCPOdd = 0.0;
73+
m_mela->computeProdP(probCPOdd, false);
74+
75+
// CP mixing (maximum)
76+
if (m_higgsProductionMode == HttEnumTypes::MELAHiggsProductionMode::GGH)
77+
{
78+
m_mela->setProcess(TVar::SelfDefine_spin0, TVar::JHUGen, TVar::JJQCD);
79+
m_mela->selfDHggcoupl[0][gHIGGS_GG_2][0] = 1; // a1
80+
m_mela->selfDHggcoupl[0][gHIGGS_GG_4][0] = 1; // a3
81+
}
82+
else if (m_higgsProductionMode == HttEnumTypes::MELAHiggsProductionMode::VBF)
83+
{
84+
m_mela->setProcess(TVar::SelfDefine_spin0, TVar::JHUGen, TVar::JJVBF);
85+
m_mela->selfDHzzcoupl[0][gHIGGS_VV_1][0] = 1; // a1
86+
m_mela->selfDHzzcoupl[0][gHIGGS_VV_4][0] = 0.297979; // a3
87+
}
88+
float probCPMix = 0.0;
89+
m_mela->computeProdP(probCPMix, false);
90+
91+
LOG(WARNING) << "probabilities: " << probCPEven << ", " << probCPOdd << ", " << probCPMix;
4892

49-
metadata.m_mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::ZZGG); // TODO
50-
float result = 0.0;
51-
metadata.m_mela->computeProdP(result, true);
52-
LOG(INFO) << "production matrix element: " << result;
93+
float discriminatorD0minus = DefaultValues::UndefinedFloat;
94+
float discriminatorDCP = DefaultValues::UndefinedFloat;
95+
if ((probCPEven + probCPOdd) != 0.0)
96+
{
97+
discriminatorD0minus = probCPEven / (probCPEven + probCPOdd) if ;
98+
discriminatorDCP = (probCPMix - probCPEven - probCPOdd) / (probCPEven + probCPOdd);
99+
}
100+
LOG(WARNING) << "discriminators: " << discriminatorD0minus << ", " << discriminatorDCP;
53101

54-
metadata.m_mela->resetInputEvent();
102+
m_mela->resetInputEvent();
55103
}
56104
}
57105

0 commit comments

Comments
 (0)