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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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::IsolatedParticlesGeneratedJets ( const edm::ParameterSet iConfig)
explicit

Definition at line 80 of file IsolatedParticlesGeneratedJets.cc.

References TFileService::kSharedResource.

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

◆ ~IsolatedParticlesGeneratedJets()

IsolatedParticlesGeneratedJets::~IsolatedParticlesGeneratedJets ( )
inlineoverride

Definition at line 52 of file IsolatedParticlesGeneratedJets.cc.

52 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 95 of file IsolatedParticlesGeneratedJets.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, clearTreeVectors(), edm::EDConsumerBase::consumesCollector(), debug_, reco::LeafCandidate::energy(), PVValHelper::eta, reco::LeafCandidate::eta(), L1CaloJetHTTProducer_cfi::genJets, AJJGenJetFilter_cfi::genParticles, iEvent, generator_cfi::jetMatching, BTaggingMonitoring_cff::njets, AlCaHLTBitMon_ParallelJobs::p, EgammaValidation_cff::pdgId, phi, reco::LeafCandidate::phi(), DiDispStaMuonMonitor_cfi::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_.

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

◆ beginJob()

void IsolatedParticlesGeneratedJets::beginJob ( )
overrideprivatevirtual

◆ bookHistograms()

void IsolatedParticlesGeneratedJets::bookHistograms ( )
private

Definition at line 190 of file IsolatedParticlesGeneratedJets.cc.

References compareTotals::fs, 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().

190  {
192  tree_ = fs->make<TTree>("tree", "tree");
193 
194  t_gjetN = new std::vector<int>();
195  t_gjetE = new std::vector<double>();
196  t_gjetPt = new std::vector<double>();
197  t_gjetEta = new std::vector<double>();
198  t_gjetPhi = new std::vector<double>();
199 
200  t_jetTrkP = new std::vector<std::vector<double> >();
201  t_jetTrkPt = new std::vector<std::vector<double> >();
202  t_jetTrkEta = new std::vector<std::vector<double> >();
203  t_jetTrkPhi = new std::vector<std::vector<double> >();
204  t_jetTrkPdg = new std::vector<std::vector<double> >();
205  t_jetTrkCharge = new std::vector<std::vector<double> >();
206 
207  tree_->Branch("t_gjetN", "std::vector<int>", &t_gjetN);
208  tree_->Branch("t_gjetE", "std::vector<double>", &t_gjetE);
209  tree_->Branch("t_gjetPt", "std::vector<double>", &t_gjetPt);
210  tree_->Branch("t_gjetEta", "std::vector<double>", &t_gjetEta);
211  tree_->Branch("t_gjetPhi", "std::vector<double>", &t_gjetPhi);
212 
213  tree_->Branch("t_jetTrkP", "std::vector<vector<double> >", &t_jetTrkP);
214  tree_->Branch("t_jetTrkPt", "std::vector<vector<double> >", &t_jetTrkPt);
215  tree_->Branch("t_jetTrkEta", "std::vector<vector<double> >", &t_jetTrkEta);
216  tree_->Branch("t_jetTrkPhi", "std::vector<vector<double> >", &t_jetTrkPhi);
217  tree_->Branch("t_jetTrkPdg", "std::vector<vector<double> >", &t_jetTrkPdg);
218  tree_->Branch("t_jetTrkCharge", "std::vector<vector<double> >", &t_jetTrkCharge);
219 }
std::vector< std::vector< double > > * t_jetTrkEta
std::vector< std::vector< double > > * t_jetTrkCharge
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
std::vector< std::vector< double > > * t_jetTrkP
std::vector< std::vector< double > > * t_jetTrkPt

◆ clearTreeVectors()

void IsolatedParticlesGeneratedJets::clearTreeVectors ( )
private

Definition at line 175 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().

175  {
176  t_gjetN->clear();
177  t_gjetE->clear();
178  t_gjetPt->clear();
179  t_gjetEta->clear();
180  t_gjetPhi->clear();
181 
182  t_jetTrkP->clear();
183  t_jetTrkPt->clear();
184  t_jetTrkEta->clear();
185  t_jetTrkPhi->clear();
186  t_jetTrkPdg->clear();
187  t_jetTrkCharge->clear();
188 }
std::vector< std::vector< double > > * t_jetTrkEta
std::vector< std::vector< double > > * t_jetTrkCharge
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
std::vector< std::vector< double > > * t_jetTrkP
std::vector< std::vector< double > > * t_jetTrkPt

◆ endJob()

void IsolatedParticlesGeneratedJets::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 59 of file IsolatedParticlesGeneratedJets.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

59 {}

◆ fillDescriptions()

void IsolatedParticlesGeneratedJets::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 87 of file IsolatedParticlesGeneratedJets.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_2022v12_cff::InputTag.

87  {
89  desc.addUntracked<bool>("Debug", true);
90  desc.add<edm::InputTag>("JetSource", edm::InputTag("ak5GenJets"));
91  desc.add<edm::InputTag>("ParticleSource", edm::InputTag("genParticles"));
92  descriptions.add("isolatedParticlesGeneratedJets", desc);
93 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ debug_

const bool IsolatedParticlesGeneratedJets::debug_
private

Definition at line 64 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze().

◆ t_gjetE

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

Definition at line 71 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_gjetEta

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

Definition at line 71 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_gjetN

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

Definition at line 70 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_gjetPhi

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

Definition at line 71 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_gjetPt

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

Definition at line 71 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_jetTrkCharge

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

Definition at line 77 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_jetTrkEta

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

Definition at line 74 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_jetTrkP

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

Definition at line 72 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_jetTrkPdg

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

Definition at line 76 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_jetTrkPhi

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

Definition at line 75 of file IsolatedParticlesGeneratedJets.cc.

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

◆ t_jetTrkPt

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

Definition at line 73 of file IsolatedParticlesGeneratedJets.cc.

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

◆ tok_jets_

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

Definition at line 67 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze().

◆ tok_parts_

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

Definition at line 68 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze().

◆ tree_

TTree* IsolatedParticlesGeneratedJets::tree_
private

Definition at line 65 of file IsolatedParticlesGeneratedJets.cc.

Referenced by analyze(), and bookHistograms().