CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
IsolatedParticlesGeneratedJets Class Reference

#include <Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.cc>

Inheritance diagram for IsolatedParticlesGeneratedJets:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 IsolatedParticlesGeneratedJets (const edm::ParameterSet &)
 
 ~IsolatedParticlesGeneratedJets () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void bookHistograms ()
 
void clearTreeVectors ()
 
void endJob () override
 

Private Attributes

const bool debug_
 
std::vector< double > * t_gjetE
 
std::vector< double > * t_gjetEta
 
std::vector< int > * t_gjetN
 
std::vector< double > * t_gjetPhi
 
std::vector< double > * t_gjetPt
 
std::vector< std::vector< double > > * t_jetTrkCharge
 
std::vector< std::vector< double > > * t_jetTrkEta
 
std::vector< std::vector< double > > * t_jetTrkP
 
std::vector< std::vector< double > > * t_jetTrkPdg
 
std::vector< std::vector< double > > * t_jetTrkPhi
 
std::vector< std::vector< double > > * t_jetTrkPt
 
const edm::EDGetTokenT< reco::GenJetCollectiontok_jets_
 
const edm::EDGetTokenT< reco::GenParticleCollectiontok_parts_
 
TTree * tree_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Studies properties of jets at generator level in context of isolated particles

Implementation: <Notes on="" implementation>="">

Definition at line 49 of file IsolatedParticlesGeneratedJets.cc.

Constructor & Destructor Documentation

IsolatedParticlesGeneratedJets::IsolatedParticlesGeneratedJets ( const edm::ParameterSet iConfig)
explicit

Definition at line 82 of file IsolatedParticlesGeneratedJets.cc.

References TFileService::kSharedResource.

82  :
83  debug_(iConfig.getUntrackedParameter<bool>("Debug",false)),
84  tok_jets_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("JetSource"))),
85  tok_parts_(consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("ParticleSource"))) {
86 
87  usesResource(TFileService::kSharedResource);
88 
89 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::GenJetCollection > tok_jets_
const edm::EDGetTokenT< reco::GenParticleCollection > tok_parts_
IsolatedParticlesGeneratedJets::~IsolatedParticlesGeneratedJets ( )
inlineoverride

Definition at line 53 of file IsolatedParticlesGeneratedJets.cc.

References analyze(), beginJob(), and fillDescriptions().

53 { }

Member Function Documentation

void IsolatedParticlesGeneratedJets::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 99 of file IsolatedParticlesGeneratedJets.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, clearTreeVectors(), edm::EDConsumerBase::consumesCollector(), debug_, reco::LeafCandidate::energy(), PVValHelper::eta, reco::LeafCandidate::eta(), ttbarCategorization_cff::genJets, GenHFHadronMatcher_cfi::genParticles, edm::Event::getByToken(), JetMatchingTools::getGenParticles(), AlCaHLTBitMon_ParallelJobs::p, common_cff::pdgId, phi, reco::LeafCandidate::phi(), EnergyCorrector::pt, reco::LeafCandidate::pt(), t_gjetE, t_gjetEta, t_gjetN, t_gjetPhi, t_gjetPt, t_jetTrkCharge, t_jetTrkEta, t_jetTrkP, t_jetTrkPdg, t_jetTrkPhi, t_jetTrkPt, tok_jets_, tok_parts_, and tree_.

Referenced by ~IsolatedParticlesGeneratedJets().

99  {
100 
101  //using namespace edm;
103 
104  //=== genJet information
106  iEvent.getByToken(tok_jets_, genJets);
107 
108  //=== genJet information
110  iEvent.getByToken(tok_parts_, genParticles);
111 
112  JetMatchingTools jetMatching (iEvent, consumesCollector());
113  std::vector <std::vector <const reco::GenParticle*> > genJetConstituents (genJets->size());
114 
115  int njets = 0;
116  for (unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
117  const reco::GenJet& genJet = (*genJets)[iGenJet];
118 
119  double genJetE = genJet.energy();
120  double genJetPt = genJet.pt();
121  double genJetEta = genJet.eta();
122  double genJetPhi = genJet.phi();
123 
124  if( genJetPt> 30.0 && std::abs(genJetEta)<3.0 ) {
125 
126  njets++;
127 
128  std::vector <const reco::GenParticle*> genJetConstituents = jetMatching.getGenParticles ((*genJets) [iGenJet]);
129  std::vector<double> v_trkP, v_trkPt, v_trkEta, v_trkPhi, v_trkPdg, v_trkCharge;
130 
131  if (debug_)
132  edm::LogVerbatim("IsoTrack") << "Jet(pt,Eta,Phi) " << genJetPt << " "
133  << genJetEta << " " << genJetPhi;
134  for(unsigned int ic=0; ic<genJetConstituents.size(); ic++) {
135 
136  if (debug_)
137  edm::LogVerbatim("IsoTrack") << "p,pt,eta,phi "
138  << genJetConstituents[ic]->p() << " "
139  << genJetConstituents[ic]->pt() << " "
140  << genJetConstituents[ic]->eta() << " "
141  << genJetConstituents[ic]->phi();
142 
143  v_trkP.push_back(genJetConstituents[ic]->p());
144  v_trkPt.push_back(genJetConstituents[ic]->pt());
145  v_trkEta.push_back(genJetConstituents[ic]->eta());
146  v_trkPhi.push_back(genJetConstituents[ic]->phi());
147  v_trkPdg.push_back(genJetConstituents[ic]->pdgId());
148  v_trkCharge.push_back(genJetConstituents[ic]->charge());
149 
150  } //loop over genjet constituents
151 
152  t_gjetE ->push_back(genJetE );
153  t_gjetPt ->push_back(genJetPt );
154  t_gjetEta ->push_back(genJetEta);
155  t_gjetPhi ->push_back(genJetPhi);
156 
157  t_jetTrkP ->push_back(v_trkP );
158  t_jetTrkPt ->push_back(v_trkPt );
159  t_jetTrkEta ->push_back(v_trkEta);
160  t_jetTrkPhi ->push_back(v_trkPhi);
161  t_jetTrkPdg ->push_back(v_trkPdg);
162  t_jetTrkCharge ->push_back(v_trkCharge);
163 
164  } // if jetPt>30
165 
166  } //loop over genjets
167 
168  t_gjetN->push_back(njets);
169 
170  if (debug_) {
171  unsigned int indx = 0;
172  reco::GenParticleCollection::const_iterator ig = genParticles->begin();
173  for (; ig!= genParticles->end(); ++ig,++indx) {
174  edm::LogVerbatim("IsoTrack") << "Track " << indx << " Status "
175  << ig->status() << " charge "
176  << ig->charge() << " pdgId " << ig->pdgId()
177  << " mass " << ig->mass() << " P "
178  << ig->momentum() << " E " << ig->energy()
179  << " Origin " << ig->vertex();
180  }
181  }
182 
183  tree_->Fill();
184 }
std::vector< std::vector< double > > * t_jetTrkEta
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
double pt() const final
transverse momentum
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
double energy() const final
energy
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Jets made from MC generator particles.
Definition: GenJet.h:25
const edm::EDGetTokenT< reco::GenJetCollection > tok_jets_
std::vector< std::vector< double > > * t_jetTrkPt
std::vector< std::vector< double > > * t_jetTrkCharge
const edm::EDGetTokenT< reco::GenParticleCollection > tok_parts_
std::vector< std::vector< double > > * t_jetTrkP
double phi() const final
momentum azimuthal angle
void IsolatedParticlesGeneratedJets::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 186 of file IsolatedParticlesGeneratedJets.cc.

References bookHistograms().

Referenced by ~IsolatedParticlesGeneratedJets().

186  {
187 
188  bookHistograms();
189 }
void IsolatedParticlesGeneratedJets::bookHistograms ( )
private

Definition at line 206 of file IsolatedParticlesGeneratedJets.cc.

References DEFINE_FWK_MODULE, TFileService::make(), t_gjetE, t_gjetEta, t_gjetN, t_gjetPhi, t_gjetPt, t_jetTrkCharge, t_jetTrkEta, t_jetTrkP, t_jetTrkPdg, t_jetTrkPhi, t_jetTrkPt, and tree_.

Referenced by beginJob(), and endJob().

206  {
207 
209  tree_ = fs->make<TTree>("tree", "tree");
210 
211  t_gjetN = new std::vector<int> ();
212  t_gjetE = new std::vector<double>();
213  t_gjetPt = new std::vector<double>();
214  t_gjetEta = new std::vector<double>();
215  t_gjetPhi = new std::vector<double>();
216 
217  t_jetTrkP = new std::vector<std::vector<double> >();
218  t_jetTrkPt = new std::vector<std::vector<double> >();
219  t_jetTrkEta = new std::vector<std::vector<double> >();
220  t_jetTrkPhi = new std::vector<std::vector<double> >();
221  t_jetTrkPdg = new std::vector<std::vector<double> >();
222  t_jetTrkCharge = new std::vector<std::vector<double> >();
223 
224  tree_->Branch("t_gjetN", "std::vector<int>", &t_gjetN);
225  tree_->Branch("t_gjetE", "std::vector<double>", &t_gjetE);
226  tree_->Branch("t_gjetPt", "std::vector<double>", &t_gjetPt);
227  tree_->Branch("t_gjetEta", "std::vector<double>", &t_gjetEta);
228  tree_->Branch("t_gjetPhi", "std::vector<double>", &t_gjetPhi);
229 
230  tree_->Branch("t_jetTrkP", "std::vector<vector<double> >", &t_jetTrkP);
231  tree_->Branch("t_jetTrkPt", "std::vector<vector<double> >", &t_jetTrkPt);
232  tree_->Branch("t_jetTrkEta", "std::vector<vector<double> >", &t_jetTrkEta);
233  tree_->Branch("t_jetTrkPhi", "std::vector<vector<double> >", &t_jetTrkPhi);
234  tree_->Branch("t_jetTrkPdg", "std::vector<vector<double> >", &t_jetTrkPdg);
235  tree_->Branch("t_jetTrkCharge", "std::vector<vector<double> >", &t_jetTrkCharge);
236 
237 }
std::vector< std::vector< double > > * t_jetTrkEta
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
std::vector< std::vector< double > > * t_jetTrkPt
std::vector< std::vector< double > > * t_jetTrkCharge
std::vector< std::vector< double > > * t_jetTrkP
void IsolatedParticlesGeneratedJets::clearTreeVectors ( )
private

Definition at line 191 of file IsolatedParticlesGeneratedJets.cc.

References t_gjetE, t_gjetEta, t_gjetN, t_gjetPhi, t_gjetPt, t_jetTrkCharge, t_jetTrkEta, t_jetTrkP, t_jetTrkPdg, t_jetTrkPhi, and t_jetTrkPt.

Referenced by analyze(), and endJob().

191  {
192  t_gjetN ->clear();
193  t_gjetE ->clear();
194  t_gjetPt ->clear();
195  t_gjetEta ->clear();
196  t_gjetPhi ->clear();
197 
198  t_jetTrkP ->clear();
199  t_jetTrkPt ->clear();
200  t_jetTrkEta ->clear();
201  t_jetTrkPhi ->clear();
202  t_jetTrkPdg ->clear();
203  t_jetTrkCharge ->clear();
204 }
std::vector< std::vector< double > > * t_jetTrkEta
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
std::vector< std::vector< double > > * t_jetTrkPt
std::vector< std::vector< double > > * t_jetTrkCharge
std::vector< std::vector< double > > * t_jetTrkP
void IsolatedParticlesGeneratedJets::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 60 of file IsolatedParticlesGeneratedJets.cc.

References bookHistograms(), and clearTreeVectors().

Referenced by o2olib.O2ORunMgr::executeJob().

60 { }
void IsolatedParticlesGeneratedJets::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 91 of file IsolatedParticlesGeneratedJets.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and edm::ParameterSetDescription::addUntracked().

Referenced by ~IsolatedParticlesGeneratedJets().

91  {
93  desc.addUntracked<bool>("Debug",true);
94  desc.add<edm::InputTag>("JetSource",edm::InputTag("ak5GenJets"));
95  desc.add<edm::InputTag>("ParticleSource",edm::InputTag("genParticles"));
96  descriptions.add("isolatedParticlesGeneratedJets",desc);
97 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

const bool IsolatedParticlesGeneratedJets::debug_
private

Definition at line 65 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze().

std::vector<double>* IsolatedParticlesGeneratedJets::t_gjetE
private

Definition at line 72 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector<double> * IsolatedParticlesGeneratedJets::t_gjetEta
private

Definition at line 72 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector<int>* IsolatedParticlesGeneratedJets::t_gjetN
private

Definition at line 71 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector<double> * IsolatedParticlesGeneratedJets::t_gjetPhi
private

Definition at line 72 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector<double> * IsolatedParticlesGeneratedJets::t_gjetPt
private

Definition at line 72 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkCharge
private

Definition at line 78 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkEta
private

Definition at line 75 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkP
private

Definition at line 73 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkPdg
private

Definition at line 77 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkPhi
private

Definition at line 76 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkPt
private

Definition at line 74 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), bookHistograms(), and clearTreeVectors().

const edm::EDGetTokenT<reco::GenJetCollection> IsolatedParticlesGeneratedJets::tok_jets_
private

Definition at line 68 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze().

const edm::EDGetTokenT<reco::GenParticleCollection> IsolatedParticlesGeneratedJets::tok_parts_
private

Definition at line 69 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze().

TTree* IsolatedParticlesGeneratedJets::tree_
private

Definition at line 66 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), and bookHistograms().