Main Page
Namespaces
Classes
Package Documentation
PhysicsTools
JetMCAlgos
plugins
GenJetBCEnergyRatio.cc
Go to the documentation of this file.
1
//
2
// Plugin to store B and C ratio for a GenJet in the event
3
// Author: Attilio
4
// Date: 05.10.2007
5
//
6
7
//=======================================================================
8
9
// user include files
10
#include "
FWCore/Framework/interface/global/EDProducer.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.h
"
13
#include "
FWCore/Utilities/interface/InputTag.h
"
14
15
#include "
FWCore/Framework/interface/Event.h
"
16
#include "
FWCore/Framework/interface/EventSetup.h
"
17
#include "
FWCore/Framework/interface/MakerMacros.h
"
18
#include "
FWCore/Framework/interface/ESHandle.h
"
19
#include "
FWCore/Framework/interface/makeRefToBaseProdFrom.h
"
20
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
21
22
#include "
DataFormats/JetReco/interface/Jet.h
"
23
#include "
DataFormats/JetReco/interface/GenJetCollection.h
"
24
#include "
SimDataFormats/JetMatching/interface/JetFlavour.h
"
25
26
#include "
DataFormats/Common/interface/Ref.h
"
27
#include "
DataFormats/Candidate/interface/Candidate.h
"
28
#include "
DataFormats/Candidate/interface/CandidateFwd.h
"
29
#include "
DataFormats/JetReco/interface/JetFloatAssociation.h
"
30
#include "
DataFormats/Math/interface/Point3D.h
"
31
#include "
DataFormats/Math/interface/LorentzVector.h
"
32
33
#include "
DataFormats/JetReco/interface/GenJet.h
"
34
#include "
PhysicsTools/JetMCUtils/interface/JetMCTag.h
"
35
#include "
PhysicsTools/JetMCUtils/interface/CandMCTag.h
"
36
37
#include <memory>
38
#include <string>
39
#include <iostream>
40
#include <vector>
41
#include <Math/VectorUtil.h>
42
#include <TMath.h>
43
44
using namespace
std
;
45
using namespace
reco
;
46
using namespace
edm
;
47
using namespace
ROOT::Math::VectorUtil
;
48
using namespace
JetMCTagUtils
;
49
using namespace
CandMCTagUtils
;
50
51
class
GenJetBCEnergyRatio
:
public
edm::global::EDProducer
<>
52
{
53
public
:
54
GenJetBCEnergyRatio
(
const
edm::ParameterSet
& );
55
~
GenJetBCEnergyRatio
()
override
;
56
57
typedef
reco::JetFloatAssociation::Container
JetBCEnergyRatioCollection
;
58
59
private
:
60
void
produce(
StreamID
,
edm::Event
&,
const
edm::EventSetup
& )
const override
;
61
edm::EDGetTokenT< View <Jet>
>
m_genjetsSrcToken
;
62
63
};
64
65
//=========================================================================
66
67
GenJetBCEnergyRatio::GenJetBCEnergyRatio
(
const
edm::ParameterSet
& iConfig )
68
{
69
produces<JetBCEnergyRatioCollection>(
"bRatioCollection"
);
70
produces<JetBCEnergyRatioCollection>(
"cRatioCollection"
);
71
m_genjetsSrcToken = consumes< View <Jet> >(iConfig.
getParameter
<
edm::InputTag
>(
"genJets"
));
72
}
73
74
//=========================================================================
75
76
GenJetBCEnergyRatio::~GenJetBCEnergyRatio
()
77
{
78
}
79
80
// ------------ method called to produce the data ------------
81
82
void
GenJetBCEnergyRatio::produce
(
StreamID
,
Event
&
iEvent
,
const
EventSetup
& iEs )
const
83
{
84
Handle< View <Jet>
> genjets;
85
iEvent.
getByToken
(m_genjetsSrcToken, genjets);
86
87
typedef
edm::RefToBase<reco::Jet>
JetRef
;
88
89
JetBCEnergyRatioCollection
* jtc1;
90
JetBCEnergyRatioCollection
* jtc2;
91
92
if
(!genjets.
product
()->empty()) {
93
const
JetRef
jj
= genjets->refAt(0);
94
jtc1 =
new
JetBCEnergyRatioCollection
(
edm::makeRefToBaseProdFrom
(jj, iEvent));
95
jtc2 =
new
JetBCEnergyRatioCollection
(
edm::makeRefToBaseProdFrom
(jj, iEvent));
96
}
else
{
97
jtc1 =
new
JetBCEnergyRatioCollection
();
98
jtc2 =
new
JetBCEnergyRatioCollection
();
99
}
100
101
std::unique_ptr<JetBCEnergyRatioCollection> bRatioColl(jtc1);
102
std::unique_ptr<JetBCEnergyRatioCollection> cRatioColl(jtc2);
103
104
for
(
size_t
j = 0; j != genjets->size(); ++j ) {
105
106
float
bRatio =
EnergyRatioFromBHadrons
( (*genjets)[j] );
107
float
cRatio =
EnergyRatioFromCHadrons
( (*genjets)[j] );
108
109
const
JetRef & aJet = genjets->refAt(j) ;
110
111
JetFloatAssociation::setValue
(*bRatioColl, aJet, bRatio);
112
JetFloatAssociation::setValue
(*cRatioColl, aJet, cRatio);
113
114
}
115
116
117
iEvent.
put
(
std::move
(bRatioColl),
"bRatioCollection"
);
118
iEvent.
put
(
std::move
(cRatioColl),
"cRatioCollection"
);
119
120
}
121
122
//define this as a plug-in
123
DEFINE_FWK_MODULE
(
GenJetBCEnergyRatio
);
124
JetMCTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
makeRefToBaseProdFrom.h
EDProducer.h
MessageLogger.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:136
JetFloatAssociation.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:519
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
edm::StreamID
Definition:
StreamID.h:30
Event.h
GenJetBCEnergyRatio
Definition:
GenJetBCEnergyRatio.cc:51
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:47
EventSetup.h
CandMCTag.h
JetFlavour.h
JetMCTagUtils
Definition:
JetMCTag.h:7
std
Definition:
JetResolutionObject.h:76
edm::EDGetTokenT
Definition:
EDGetToken.h:32
reco::JetExtendedAssociation::setValue
bool setValue(Container &, const reco::JetBaseRef &, const JetExtendedData &)
associate jet with value. Returns false and associate nothing if jet is already associated ...
Definition:
JetExtendedAssociation.cc:44
Point3D.h
edm::RefToBase< reco::Jet >
ParameterSetfwd.h
ParameterSet.h
Candidate.h
GenJetBCEnergyRatio::~GenJetBCEnergyRatio
~GenJetBCEnergyRatio() override
Definition:
GenJetBCEnergyRatio.cc:76
l1t::JetRef
edm::Ref< JetBxCollection > JetRef
Definition:
Jet.h:13
iEvent
int iEvent
Definition:
GenABIO.cc:230
JetMCTagUtils::EnergyRatioFromBHadrons
double EnergyRatioFromBHadrons(const reco::Candidate &c)
Definition:
JetMCTag.cc:12
GenJetCollection.h
ESHandle.h
VectorUtil
edm::EventSetup
Definition:
EventSetup.h:48
Jet.h
edm::global::EDProducer
Definition:
EDProducer.h:32
LorentzVector.h
GenJetBCEnergyRatio::GenJetBCEnergyRatio
GenJetBCEnergyRatio(const edm::ParameterSet &)
Definition:
GenJetBCEnergyRatio.cc:67
edm::AssociationVector< reco::JetRefBaseProd, Values >
GenJetBCEnergyRatio::m_genjetsSrcToken
edm::EDGetTokenT< View< Jet > > m_genjetsSrcToken
Definition:
GenJetBCEnergyRatio.cc:61
edm::Handle::product
T const * product() const
Definition:
Handle.h:81
Ref.h
findQualityFiles.jj
string jj
Definition:
findQualityFiles.py:186
edm::makeRefToBaseProdFrom
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
Definition:
makeRefToBaseProdFrom.h:34
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:43
edm
HLT enums.
Definition:
AlignableModifier.h:17
edm::InputTag
Definition:
InputTag.h:15
InputTag.h
JetMCTagUtils::EnergyRatioFromCHadrons
double EnergyRatioFromCHadrons(const reco::Candidate &c)
Definition:
JetMCTag.cc:26
edm::ParameterSet
Definition:
ParameterSet.h:36
CandidateFwd.h
edm::Event
Definition:
Event.h:69
CandMCTagUtils
Definition:
CandMCTag.h:6
eostools.move
def move(src, dest)
Definition:
eostools.py:510
GenJetBCEnergyRatio::produce
void produce(StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
GenJetBCEnergyRatio.cc:82
GenJet.h
GenJetBCEnergyRatio::JetBCEnergyRatioCollection
reco::JetFloatAssociation::Container JetBCEnergyRatioCollection
Definition:
GenJetBCEnergyRatio.cc:57
Generated for CMSSW Reference Manual by
1.8.11