CMS 3D CMS Logo

HTTTopJetProducer.cc
Go to the documentation of this file.
4 #include "HTTTopJetProducer.h"
5 
6 #include <memory>
7 
8 using namespace edm;
9 using namespace cms;
10 using namespace reco;
11 using namespace std;
12 
13 HTTTopJetProducer::HTTTopJetProducer(edm::ParameterSet const& conf)
14  : FastjetJetProducer(conf),
15  optimalR_(false),
16  qJets_(false),
17  minFatjetPt_(200.),
18  minSubjetPt_(20.),
19  minCandPt_(200.),
20  maxFatjetAbsEta_(2.5),
21  subjetMass_(30.),
22  muCut_(0.8),
23  filtR_(0.3),
24  filtN_(5),
25  mode_(0),
26  minCandMass_(150.),
27  maxCandMass_(200.),
28  massRatioWidth_(15),
29  minM23Cut_(0.35),
30  minM13Cut_(0.2),
31  maxM13Cut_(1.3),
32  maxR_(1.5),
33  minR_(0.5),
34  rejectMinR_(false),
35  verbose_(false) {
36  // Read in all the options from the configuration
37  optimalR_ = conf.getParameter<bool>("optimalR");
38  qJets_ = conf.getParameter<bool>("qJets");
39  minFatjetPt_ = conf.getParameter<double>("minFatjetPt");
40  minSubjetPt_ = conf.getParameter<double>("minSubjetPt");
41  minCandPt_ = conf.getParameter<double>("minCandPt");
42  maxFatjetAbsEta_ = conf.getParameter<double>("maxFatjetAbsEta");
43  subjetMass_ = conf.getParameter<double>("subjetMass");
44  muCut_ = conf.getParameter<double>("muCut");
45  filtR_ = conf.getParameter<double>("filtR");
46  filtN_ = conf.getParameter<int>("filtN");
47  mode_ = conf.getParameter<int>("mode");
48  minCandMass_ = conf.getParameter<double>("minCandMass");
49  maxCandMass_ = conf.getParameter<double>("maxCandMass");
50  massRatioWidth_ = conf.getParameter<double>("massRatioWidth");
51  minM23Cut_ = conf.getParameter<double>("minM23Cut");
52  minM13Cut_ = conf.getParameter<double>("minM13Cut");
53  maxM13Cut_ = conf.getParameter<double>("maxM13Cut");
54  maxR_ = conf.getParameter<double>("maxR");
55  minR_ = conf.getParameter<double>("minR");
56  rejectMinR_ = conf.getParameter<bool>("rejectMinR");
57  verbose_ = conf.getParameter<bool>("verbose");
58 
59  // Create the tagger-wrapper
60  produces<HTTTopJetTagInfoCollection>();
61 
62  // Signal to the VirtualJetProducer that we have to add HTT information
64 
65  fjHEPTopTagger_ = std::unique_ptr<fastjet::HEPTopTaggerV2>(new fastjet::HEPTopTaggerV2(optimalR_,
66  qJets_,
68  minCandPt_,
70  muCut_,
71  filtR_,
72  filtN_,
73  mode_,
77  minM23Cut_,
78  minM13Cut_,
79  maxM13Cut_,
80  rejectMinR_));
81 }
82 
84  if (qJets_) {
86  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
87  fjHEPTopTagger_->set_rng(engine);
88  }
89 
91 }
92 
94  if (!doAreaFastjet_ && !doRhoFastjet_) {
95  fjClusterSeq_ = std::make_shared<fastjet::ClusterSequence>(fjInputs_, *fjJetDefinition_);
96  } else if (voronoiRfact_ <= 0) {
98  ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_));
99  } else {
101  new fastjet::ClusterSequenceVoronoiArea(fjInputs_, *fjJetDefinition_, fastjet::VoronoiAreaSpec(voronoiRfact_)));
102  }
103 
104  //Run the jet clustering
105  vector<fastjet::PseudoJet> inclusiveJets = fjClusterSeq_->inclusive_jets(minFatjetPt_);
106 
107  if (verbose_)
108  cout << "Getting central jets" << endl;
109  // Find the transient central jets
110  vector<fastjet::PseudoJet> centralJets;
111  for (unsigned int i = 0; i < inclusiveJets.size(); i++) {
112  if (inclusiveJets[i].perp() > minFatjetPt_ && fabs(inclusiveJets[i].rapidity()) < maxFatjetAbsEta_) {
113  centralJets.push_back(inclusiveJets[i]);
114  }
115  }
116 
117  fastjet::HEPTopTaggerV2& HEPTagger = *fjHEPTopTagger_;
118 
119  vector<fastjet::PseudoJet>::iterator jetIt = centralJets.begin(), centralJetsEnd = centralJets.end();
120  if (verbose_)
121  cout << "Loop over jets" << endl;
122  for (; jetIt != centralJetsEnd; ++jetIt) {
123  if (verbose_)
124  cout << "CMS FJ jet pt: " << (*jetIt).perp() << endl;
125 
126  fastjet::PseudoJet taggedJet;
127 
128  taggedJet = HEPTagger.result(*jetIt);
129 
130  if (taggedJet != 0) {
131  fjJets_.push_back(taggedJet);
132  }
133  }
134 }
135 
137  const edm::EventSetup& iSetup,
139  // Set up output list
140  auto tagInfos = std::make_unique<HTTTopJetTagInfoCollection>();
141 
142  // Loop over jets
143  for (size_t ij = 0; ij != fjJets_.size(); ij++) {
144  HTTTopJetProperties properties;
146 
147  // Black magic:
148  // In the standard CA treatment the RefToBase is made from the handle directly
149  // Since we only have a OrphanHandle (the JetCollection is created by this process)
150  // we have to take the detour via the Ref
152  edm::RefToBase<reco::Jet> rtb(ref);
153 
154  fastjet::HEPTopTaggerV2Structure* s = (fastjet::HEPTopTaggerV2Structure*)fjJets_[ij].structure_non_const_ptr();
155 
156  properties.fjMass = s->fj_mass();
157  properties.fjPt = s->fj_pt();
158  properties.fjEta = s->fj_eta();
159  properties.fjPhi = s->fj_phi();
160 
161  properties.topMass = s->top_mass();
162  properties.unfilteredMass = s->unfiltered_mass();
163  properties.prunedMass = s->pruned_mass();
164  properties.fRec = s->fRec();
165  properties.massRatioPassed = s->mass_ratio_passed();
166 
167  properties.ropt = s->ropt();
168  properties.roptCalc = s->roptCalc();
169  properties.ptForRoptCalc = s->ptForRoptCalc();
170 
171  properties.tau1Unfiltered = s->Tau1Unfiltered();
172  properties.tau2Unfiltered = s->Tau2Unfiltered();
173  properties.tau3Unfiltered = s->Tau3Unfiltered();
174  properties.tau1Filtered = s->Tau1Filtered();
175  properties.tau2Filtered = s->Tau2Filtered();
176  properties.tau3Filtered = s->Tau3Filtered();
177  properties.qWeight = s->qweight();
178  properties.qEpsilon = s->qepsilon();
179  properties.qSigmaM = s->qsigmaM();
180 
181  tagInfo.insert(rtb, properties);
182  tagInfos->push_back(tagInfo);
183  }
184 
185  iEvent.put(std::move(tagInfos));
186 };
187 
190 
191  desc.add<bool>("optimalR", true);
192  desc.add<bool>("qJets", false);
193  desc.add<double>("minFatjetPt", 200.);
194  desc.add<double>("minSubjetPt", 0.);
195  desc.add<double>("minCandPt", 0.);
196  desc.add<double>("maxFatjetAbsEta", 99.);
197  desc.add<double>("subjetMass", 30.);
198  desc.add<double>("filtR", 0.3);
199  desc.add<int>("filtN", 5);
200  desc.add<int>("mode", 4);
201  desc.add<double>("minCandMass", 0.);
202  desc.add<double>("maxCandMass", 999999.);
203  desc.add<double>("massRatioWidth", 999999.);
204  desc.add<double>("minM23Cut", 0.);
205  desc.add<double>("minM13Cut", 0.);
206  desc.add<double>("maxM13Cut", 999999.);
207  desc.add<double>("maxR", 1.5);
208  desc.add<double>("minR", 0.5);
209  desc.add<bool>("rejectMinR", false);
210  desc.add<bool>("verbose", false);
211 
212  desc.add<int>("algorithm", 1); // where is it needed?
213 
217  desc.add<std::string>("jetCollInstanceName", "SubJets");
219 
220  descriptions.add("HTTTopJetProducer", desc);
221 }
222 
223 //define this as a plug-in
cms::HTTTopJetProducer::muCut_
double muCut_
Definition: HTTTopJetProducer.h:105
reco::HTTTopJetProperties
Definition: HTTTopJetTagInfo.h:21
cms::HTTTopJetProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: HTTTopJetProducer.cc:83
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
HLT_2018_cff.tagInfos
tagInfos
Definition: HLT_2018_cff.py:51519
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
reco::HTTTopJetProperties::prunedMass
double prunedMass
Definition: HTTTopJetTagInfo.h:52
funct::false
false
Definition: Factorize.h:34
cms::HTTTopJetProducer::subjetMass_
double subjetMass_
Definition: HTTTopJetProducer.h:104
reco::HTTTopJetTagInfo
Definition: HTTTopJetTagInfo.h:69
VirtualJetProducer::ClusterSequencePtr
std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
Definition: VirtualJetProducer.h:73
edm
HLT enums.
Definition: AlignableModifier.h:19
cms::HTTTopJetProducer::filtR_
double filtR_
Definition: HTTTopJetProducer.h:107
cms::HTTTopJetProducer::mode_
int mode_
Definition: HTTTopJetProducer.h:117
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::HTTTopJetProducer::maxFatjetAbsEta_
double maxFatjetAbsEta_
Definition: HTTTopJetProducer.h:102
cms::HTTTopJetProducer::massRatioWidth_
double massRatioWidth_
Definition: HTTTopJetProducer.h:123
BasicJetCollection.h
cms::HTTTopJetProducer::minM13Cut_
double minM13Cut_
Definition: HTTTopJetProducer.h:125
reco::HTTTopJetProperties::qWeight
double qWeight
Definition: HTTTopJetTagInfo.h:64
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::HTTTopJetProperties::fRec
double fRec
Definition: HTTTopJetTagInfo.h:53
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
VirtualJetProducer::voronoiRfact_
double voronoiRfact_
Definition: VirtualJetProducer.h:170
VirtualJetProducer::fjClusterSeq_
ClusterSequencePtr fjClusterSeq_
Definition: VirtualJetProducer.h:185
cms::HTTTopJetProducer
Definition: HTTTopJetProducer.h:73
edm::Ref
Definition: AssociativeIterator.h:58
reco::HTTTopJetProperties::qEpsilon
double qEpsilon
Definition: HTTTopJetTagInfo.h:65
cms::HTTTopJetProducer::minR_
double minR_
Definition: HTTTopJetProducer.h:129
cms::HTTTopJetProducer::minSubjetPt_
double minSubjetPt_
Definition: HTTTopJetProducer.h:99
MakerMacros.h
cms::HTTTopJetProducer::fjHEPTopTagger_
std::unique_ptr< fastjet::HEPTopTaggerV2 > fjHEPTopTagger_
Definition: HTTTopJetProducer.h:90
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
cms::HTTTopJetProducer::qJets_
bool qJets_
Definition: HTTTopJetProducer.h:96
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HTTTopJetProducer.h
reco::HTTTopJetProperties::qSigmaM
double qSigmaM
Definition: HTTTopJetTagInfo.h:66
VirtualJetProducer::fromHTTTopJetProducer_
bool fromHTTTopJetProducer_
Definition: VirtualJetProducer.h:208
reco::HTTTopJetProperties::tau3Filtered
double tau3Filtered
Definition: HTTTopJetTagInfo.h:63
cms::HTTTopJetProducer::maxM13Cut_
double maxM13Cut_
Definition: HTTTopJetProducer.h:126
reco::HTTTopJetProperties::ropt
double ropt
Definition: HTTTopJetTagInfo.h:55
cms::HTTTopJetProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HTTTopJetProducer.cc:188
cms::HTTTopJetProducer::maxCandMass_
double maxCandMass_
Definition: HTTTopJetProducer.h:121
FastjetJetProducer::fillDescriptionsFromFastJetProducer
static void fillDescriptionsFromFastJetProducer(edm::ParameterSetDescription &desc)
Definition: FastjetJetProducer.cc:481
VirtualJetProducer::doRhoFastjet_
bool doRhoFastjet_
Definition: VirtualJetProducer.h:167
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::HTTTopJetProperties::tau2Filtered
double tau2Filtered
Definition: HTTTopJetTagInfo.h:62
edm::ParameterSet
Definition: ParameterSet.h:36
cms::HTTTopJetProducer::minCandMass_
double minCandMass_
Definition: HTTTopJetProducer.h:120
cms::HTTTopJetProducer::rejectMinR_
bool rejectMinR_
Definition: HTTTopJetProducer.h:131
cms::HTTTopJetProducer::optimalR_
bool optimalR_
Definition: HTTTopJetProducer.h:95
reco::HTTTopJetProperties::tau2Unfiltered
double tau2Unfiltered
Definition: HTTTopJetTagInfo.h:59
cms::HTTTopJetProducer::verbose_
bool verbose_
Definition: HTTTopJetProducer.h:134
edm::Service< edm::RandomNumberGenerator >
FastjetJetProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: FastjetJetProducer.cc:176
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::HTTTopJetProperties::roptCalc
double roptCalc
Definition: HTTTopJetTagInfo.h:56
edm::EventSetup
Definition: EventSetup.h:57
VirtualJetProducer::fjAreaDefinition_
AreaDefinitionPtr fjAreaDefinition_
Definition: VirtualJetProducer.h:189
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
reco::HTTTopJetProperties::topMass
double topMass
Definition: HTTTopJetTagInfo.h:50
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
cms::HTTTopJetProducer::minFatjetPt_
double minFatjetPt_
Definition: HTTTopJetProducer.h:98
reco::HTTTopJetProperties::tau1Unfiltered
double tau1Unfiltered
Definition: HTTTopJetTagInfo.h:58
reco::HTTTopJetProperties::tau1Filtered
double tau1Filtered
Definition: HTTTopJetTagInfo.h:61
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
reco::HTTTopJetProperties::massRatioPassed
double massRatioPassed
Definition: HTTTopJetTagInfo.h:54
cms::HTTTopJetProducer::minM23Cut_
double minM23Cut_
Definition: HTTTopJetProducer.h:124
VirtualJetProducer::doAreaFastjet_
bool doAreaFastjet_
Definition: VirtualJetProducer.h:163
cms::HTTTopJetProducer::filtN_
int filtN_
Definition: HTTTopJetProducer.h:108
VirtualJetProducer::fjJets_
std::vector< fastjet::PseudoJet > fjJets_
Definition: VirtualJetProducer.h:192
VirtualJetProducer::fjJetDefinition_
JetDefPtr fjJetDefinition_
Definition: VirtualJetProducer.h:186
cms::HTTTopJetProducer::minCandPt_
double minCandPt_
Definition: HTTTopJetProducer.h:100
edm::RefToBase< reco::Jet >
reco::HTTTopJetProperties::unfilteredMass
double unfilteredMass
Definition: HTTTopJetTagInfo.h:51
dumpRecoGeometry_cfg.tagInfo
tagInfo
Definition: dumpRecoGeometry_cfg.py:194
cms::HTTTopJetProducer::maxR_
double maxR_
Definition: HTTTopJetProducer.h:128
reco::HTTTopJetProperties::fjPt
double fjPt
Definition: HTTTopJetTagInfo.h:46
reco::HTTTopJetProperties::fjEta
double fjEta
Definition: HTTTopJetTagInfo.h:48
cms::HTTTopJetProducer::addHTTTopJetTagInfoCollection
void addHTTTopJetTagInfoCollection(edm::Event &iEvent, const edm::EventSetup &iSetup, edm::OrphanHandle< reco::BasicJetCollection > &oh) override
Definition: HTTTopJetProducer.cc:136
reco::HTTTopJetProperties::fjPhi
double fjPhi
Definition: HTTTopJetTagInfo.h:49
VirtualJetProducer::fjInputs_
std::vector< fastjet::PseudoJet > fjInputs_
Definition: VirtualJetProducer.h:191
edm::Event
Definition: Event.h:73
FastjetJetProducer
Definition: FastjetJetProducer.h:41
reco::HTTTopJetProperties::tau3Unfiltered
double tau3Unfiltered
Definition: HTTTopJetTagInfo.h:60
VirtualJetProducer::fillDescriptionsFromVirtualJetProducer
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)
Definition: VirtualJetProducer.cc:1016
HTTTopJetTagInfo.h
reco::HTTTopJetProperties::fjMass
double fjMass
Definition: HTTTopJetTagInfo.h:47
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
cms::HTTTopJetProducer::runAlgorithm
void runAlgorithm(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: HTTTopJetProducer.cc:93
reco::HTTTopJetProperties::ptForRoptCalc
double ptForRoptCalc
Definition: HTTTopJetTagInfo.h:57