CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
AnalysisRootpleProducerOnlyMC Class Reference

#include <AnalysisRootpleProducerOnlyMC.h>

Inheritance diagram for AnalysisRootpleProducerOnlyMC:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 AnalysisRootpleProducerOnlyMC (const edm::ParameterSet &)
 
virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
void fillChargedJet (float, float, float, float)
 
void fillEventInfo (int)
 
void fillInclusiveJet (float, float, float, float)
 
void fillMCParticles (float, float, float, float)
 
void store ()
 
virtual ~AnalysisRootpleProducerOnlyMC ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

TTree * AnalysisTree
 
edm::Handle< std::vector
< reco::GenParticle > > 
CandHandleMC
 
TClonesArray * ChargedJet
 
edm::Handle
< reco::GenJetCollection
ChgGenJetsHandle
 
edm::InputTag chgGenPartCollName
 
edm::InputTag chgJetCollName
 
float EtaCJ [NCJMAX]
 
float EtaEHJ [NEHJMAX]
 
float EtaIJ [NIJMAX]
 
float EtaMC [NMCPMAX]
 
float EtaTJ [NTJMAX]
 
float EtaTK [NTKMAX]
 
int EventKind
 
edm::Handle< edm::HepMCProductEvtHandle
 
edm::Service< TFileServicefs
 
edm::InputTag genJetCollName
 
edm::Handle
< reco::GenJetCollection
GenJetsHandle
 
TClonesArray * InclusiveJet
 
edm::InputTag mcEvent
 
float MomentumCJ [NCJMAX]
 
float MomentumEHJ [NEHJMAX]
 
float MomentumIJ [NIJMAX]
 
float MomentumMC [NMCPMAX]
 
float MomentumTJ [NTJMAX]
 
float MomentumTK [NTKMAX]
 
TClonesArray * MonteCarlo
 
int NumberCaloJet
 
int NumberChargedJet
 
int NumberInclusiveJet
 
int NumberMCParticles
 
int NumberTracks
 
int NumberTracksJet
 
float PhiCJ [NCJMAX]
 
float PhiEHJ [NEHJMAX]
 
float PhiIJ [NIJMAX]
 
float PhiMC [NMCPMAX]
 
float PhiTJ [NTJMAX]
 
float PhiTK [NTKMAX]
 
float piG
 
float TransverseMomentumCJ [NCJMAX]
 
float TransverseMomentumEHJ [NEHJMAX]
 
float TransverseMomentumIJ [NIJMAX]
 
float TransverseMomentumMC [NMCPMAX]
 
float TransverseMomentumTJ [NTJMAX]
 
float TransverseMomentumTK [NTKMAX]
 

Static Private Attributes

static const int NCJMAX = 10000
 
static const int NEHJMAX = 10000
 
static const int NIJMAX = 10000
 
static const int NMCPMAX = 10000
 
static const int NTJMAX = 10000
 
static const int NTKMAX = 10000
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 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

Definition at line 31 of file AnalysisRootpleProducerOnlyMC.h.

Constructor & Destructor Documentation

AnalysisRootpleProducerOnlyMC::AnalysisRootpleProducerOnlyMC ( const edm::ParameterSet pset)
explicit

Definition at line 68 of file AnalysisRootpleProducerOnlyMC.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

69 {
70  mcEvent = pset.getUntrackedParameter<InputTag>("MCEvent",std::string(""));
71  genJetCollName = pset.getUntrackedParameter<InputTag>("GenJetCollectionName",std::string(""));
72  chgJetCollName = pset.getUntrackedParameter<InputTag>("ChgGenJetCollectionName",std::string(""));
73  chgGenPartCollName = pset.getUntrackedParameter<InputTag>("ChgGenPartCollectionName",std::string(""));
74 
75  piG = acos(-1.);
79 }
T getUntrackedParameter(std::string const &, T const &) const
virtual AnalysisRootpleProducerOnlyMC::~AnalysisRootpleProducerOnlyMC ( )
inlinevirtual

Definition at line 37 of file AnalysisRootpleProducerOnlyMC.h.

37 {}

Member Function Documentation

void AnalysisRootpleProducerOnlyMC::analyze ( const edm::Event e,
const edm::EventSetup  
)
virtual

Implements edm::EDAnalyzer.

Definition at line 129 of file AnalysisRootpleProducerOnlyMC.cc.

References edm::Event::getByLabel().

130 {
131 
132  e.getByLabel( mcEvent , EvtHandle ) ;
136 
137  const HepMC::GenEvent* Evt = EvtHandle->GetEvent() ;
138 
139  EventKind = Evt->signal_process_id();
140 
141  std::vector<math::XYZTLorentzVector> GenPart;
142  std::vector<GenJet> ChgGenJetContainer;
143  std::vector<GenJet> GenJetContainer;
144 
145  GenPart.clear();
146  ChgGenJetContainer.clear();
147  GenJetContainer.clear();
148 
149  ChargedJet->Clear();
150  InclusiveJet->Clear();
151  MonteCarlo->Clear();
152 
153  if (ChgGenJetsHandle->size()){
154 
155  for ( GenJetCollection::const_iterator it(ChgGenJetsHandle->begin()), itEnd(ChgGenJetsHandle->end());
156  it!=itEnd; ++it)
157  {
158  ChgGenJetContainer.push_back(*it);
159  }
160 
161  std::stable_sort(ChgGenJetContainer.begin(),ChgGenJetContainer.end(),GenJetSort());
162 
163  std::vector<GenJet>::const_iterator it(ChgGenJetContainer.begin()), itEnd(ChgGenJetContainer.end());
164  for ( int iChargedJet(0); it != itEnd; ++it, ++iChargedJet)
165  {
166  fillChargedJet(it->p(),it->pt(),it->eta(),it->phi());
167  new((*ChargedJet)[iChargedJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
168  }
169  }
170 
171  if (GenJetsHandle->size()){
172 
173  for ( GenJetCollection::const_iterator it(GenJetsHandle->begin()), itEnd(GenJetsHandle->end());
174  it!=itEnd; ++it )
175  {
176  GenJetContainer.push_back(*it);
177  }
178 
179  std::stable_sort(GenJetContainer.begin(),GenJetContainer.end(),GenJetSort());
180 
181  std::vector<GenJet>::const_iterator it(GenJetContainer.begin()), itEnd(GenJetContainer.end());
182  for ( int iInclusiveJet(0); it != itEnd; ++it, ++iInclusiveJet)
183  {
184  fillInclusiveJet(it->p(),it->pt(),it->eta(),it->phi());
185  new((*InclusiveJet)[iInclusiveJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
186  }
187  }
188 
189  if (CandHandleMC->size()){
190 
191  for (vector<GenParticle>::const_iterator it(CandHandleMC->begin()), itEnd(CandHandleMC->end());
192  it != itEnd;it++)
193  {
194  GenPart.push_back(it->p4());
195  }
196 
197  std::stable_sort(GenPart.begin(),GenPart.end(),GreaterPt());
198 
199  std::vector<math::XYZTLorentzVector>::const_iterator it(GenPart.begin()), itEnd(GenPart.end());
200  for( int iMonteCarlo(0); it != itEnd; ++it, ++iMonteCarlo )
201  {
202  fillMCParticles(it->P(),it->Pt(),it->Eta(),it->Phi());
203  new((*MonteCarlo)[iMonteCarlo]) TLorentzVector(it->Px(), it->Py(), it->Pz(), it->E());
204  }
205  }
206 
207  store();
208 }
void fillMCParticles(float, float, float, float)
void fillChargedJet(float, float, float, float)
edm::Handle< std::vector< reco::GenParticle > > CandHandleMC
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
edm::Handle< reco::GenJetCollection > GenJetsHandle
edm::Handle< reco::GenJetCollection > ChgGenJetsHandle
edm::Handle< edm::HepMCProduct > EvtHandle
void fillInclusiveJet(float, float, float, float)
void AnalysisRootpleProducerOnlyMC::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.cc.

83 {
84  // use TFileService for output to root file
85  AnalysisTree = fs->make<TTree>("AnalysisTree","MBUE Analysis Tree ");
86 
87  // process type
88  AnalysisTree->Branch("EventKind",&EventKind,"EventKind/I");
89 
90  // store p, pt, eta, phi for particles and jets
91 
92  // GenParticles at hadron level
93  AnalysisTree->Branch("NumberMCParticles",&NumberMCParticles,"NumberMCParticles/I");
94  AnalysisTree->Branch("MomentumMC",MomentumMC,"MomentumMC[NumberMCParticles]/F");
95  AnalysisTree->Branch("TransverseMomentumMC",TransverseMomentumMC,"TransverseMomentumMC[NumberMCParticles]/F");
96  AnalysisTree->Branch("EtaMC",EtaMC,"EtaMC[NumberMCParticles]/F");
97  AnalysisTree->Branch("PhiMC",PhiMC,"PhiMC[NumberMCParticles]/F");
98 
99  // GenJets
100  AnalysisTree->Branch("NumberInclusiveJet",&NumberInclusiveJet,"NumberInclusiveJet/I");
101  AnalysisTree->Branch("MomentumIJ",MomentumIJ,"MomentumIJ[NumberInclusiveJet]/F");
102  AnalysisTree->Branch("TrasverseMomentumIJ",TransverseMomentumIJ,"TransverseMomentumIJ[NumberInclusiveJet]/F");
103  AnalysisTree->Branch("EtaIJ",EtaIJ,"EtaIJ[NumberInclusiveJet]/F");
104  AnalysisTree->Branch("PhiIJ",PhiIJ,"PhiIJ[NumberInclusiveJet]/F");
105 
106  // jets from charged GenParticles
107  AnalysisTree->Branch("NumberChargedJet",&NumberChargedJet,"NumberChargedJet/I");
108  AnalysisTree->Branch("MomentumCJ",MomentumCJ,"MomentumCJ[NumberChargedJet]/F");
109  AnalysisTree->Branch("TrasverseMomentumCJ",TransverseMomentumCJ,"TransverseMomentumCJ[NumberChargedJet]/F");
110  AnalysisTree->Branch("EtaCJ",EtaCJ,"EtaCJ[NumberChargedJet]/F");
111  AnalysisTree->Branch("PhiCJ",PhiCJ,"PhiCJ[NumberChargedJet]/F");
112 
113 
114  // alternative storage method:
115  // save TClonesArrays of TLorentzVectors
116  // i.e. store 4-vectors of particles and jets
117 
118  MonteCarlo = new TClonesArray("TLorentzVector", 10000);
119  AnalysisTree->Branch("MonteCarlo", "TClonesArray", &MonteCarlo, 128000, 0);
120 
121  InclusiveJet = new TClonesArray("TLorentzVector", 10000);
122  AnalysisTree->Branch("InclusiveJet", "TClonesArray", &InclusiveJet, 128000, 0);
123 
124  ChargedJet = new TClonesArray("TLorentzVector", 10000);
125  AnalysisTree->Branch("ChargedJet", "TClonesArray", &ChargedJet, 128000, 0);
126 }
T * make() const
make new ROOT object
void AnalysisRootpleProducerOnlyMC::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 210 of file AnalysisRootpleProducerOnlyMC.cc.

211 {
212 }
void AnalysisRootpleProducerOnlyMC::fillChargedJet ( float  p,
float  pt,
float  eta,
float  phi 
)
void AnalysisRootpleProducerOnlyMC::fillEventInfo ( int  e)
void AnalysisRootpleProducerOnlyMC::fillInclusiveJet ( float  p,
float  pt,
float  eta,
float  phi 
)
void AnalysisRootpleProducerOnlyMC::fillMCParticles ( float  p,
float  pt,
float  eta,
float  phi 
)
void AnalysisRootpleProducerOnlyMC::store ( )

Member Data Documentation

TTree* AnalysisRootpleProducerOnlyMC::AnalysisTree
private

Definition at line 66 of file AnalysisRootpleProducerOnlyMC.h.

edm::Handle< std::vector<reco::GenParticle> > AnalysisRootpleProducerOnlyMC::CandHandleMC
private

Definition at line 57 of file AnalysisRootpleProducerOnlyMC.h.

TClonesArray* AnalysisRootpleProducerOnlyMC::ChargedJet
private

Definition at line 86 of file AnalysisRootpleProducerOnlyMC.h.

edm::Handle< reco::GenJetCollection > AnalysisRootpleProducerOnlyMC::ChgGenJetsHandle
private

Definition at line 59 of file AnalysisRootpleProducerOnlyMC.h.

edm::InputTag AnalysisRootpleProducerOnlyMC::chgGenPartCollName
private

Definition at line 54 of file AnalysisRootpleProducerOnlyMC.h.

edm::InputTag AnalysisRootpleProducerOnlyMC::chgJetCollName
private

Definition at line 53 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::EtaCJ[NCJMAX]
private

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::EtaEHJ[NEHJMAX]
private

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::EtaIJ[NIJMAX]
private

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::EtaMC[NMCPMAX]
private

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::EtaTJ[NTJMAX]
private

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::EtaTK[NTKMAX]
private

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::EventKind
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

edm::Handle< edm::HepMCProduct > AnalysisRootpleProducerOnlyMC::EvtHandle
private

Definition at line 56 of file AnalysisRootpleProducerOnlyMC.h.

edm::Service<TFileService> AnalysisRootpleProducerOnlyMC::fs
private

Definition at line 64 of file AnalysisRootpleProducerOnlyMC.h.

edm::InputTag AnalysisRootpleProducerOnlyMC::genJetCollName
private

Definition at line 52 of file AnalysisRootpleProducerOnlyMC.h.

edm::Handle< reco::GenJetCollection > AnalysisRootpleProducerOnlyMC::GenJetsHandle
private

Definition at line 58 of file AnalysisRootpleProducerOnlyMC.h.

TClonesArray* AnalysisRootpleProducerOnlyMC::InclusiveJet
private

Definition at line 85 of file AnalysisRootpleProducerOnlyMC.h.

edm::InputTag AnalysisRootpleProducerOnlyMC::mcEvent
private

Definition at line 51 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::MomentumCJ[NCJMAX]
private

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::MomentumEHJ[NEHJMAX]
private

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::MomentumIJ[NIJMAX]
private

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::MomentumMC[NMCPMAX]
private

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::MomentumTJ[NTJMAX]
private

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::MomentumTK[NTKMAX]
private

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.

TClonesArray* AnalysisRootpleProducerOnlyMC::MonteCarlo
private

Definition at line 84 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NCJMAX = 10000
staticprivate

Definition at line 71 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NEHJMAX = 10000
staticprivate

Definition at line 73 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NIJMAX = 10000
staticprivate

Definition at line 70 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NMCPMAX = 10000
staticprivate

Definition at line 68 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NTJMAX = 10000
staticprivate

Definition at line 72 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NTKMAX = 10000
staticprivate

Definition at line 69 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::NumberCaloJet
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::NumberChargedJet
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::NumberInclusiveJet
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::NumberMCParticles
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::NumberTracks
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

int AnalysisRootpleProducerOnlyMC::NumberTracksJet
private

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::PhiCJ[NCJMAX]
private

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::PhiEHJ[NEHJMAX]
private

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::PhiIJ[NIJMAX]
private

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::PhiMC[NMCPMAX]
private

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::PhiTJ[NTJMAX]
private

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::PhiTK[NTKMAX]
private

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::piG
private

Definition at line 62 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::TransverseMomentumCJ[NCJMAX]
private

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::TransverseMomentumEHJ[NEHJMAX]
private

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::TransverseMomentumIJ[NIJMAX]
private

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::TransverseMomentumMC[NMCPMAX]
private

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::TransverseMomentumTJ[NTJMAX]
private

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

float AnalysisRootpleProducerOnlyMC::TransverseMomentumTK[NTKMAX]
private

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.