21 NumberMCParticles = 0;
22 NumberInclusiveJet = 0;
29 MomentumMC[NumberMCParticles] =
p;
30 TransverseMomentumMC[NumberMCParticles] =
pt;
31 EtaMC[NumberMCParticles] =
eta;
32 PhiMC[NumberMCParticles] = phi;
37 MomentumIJ[NumberInclusiveJet] =
p;
38 TransverseMomentumIJ[NumberInclusiveJet] =
pt;
39 EtaIJ[NumberInclusiveJet] =
eta;
40 PhiIJ[NumberInclusiveJet] = phi;
45 MomentumCJ[NumberChargedJet] =
p;
46 TransverseMomentumCJ[NumberChargedJet] =
pt;
47 EtaCJ[NumberChargedJet] =
eta;
48 PhiCJ[NumberChargedJet] = phi;
56 chgJetCollToken = consumes<reco::GenJetCollection>(
58 chgGenPartCollToken = consumes<std::vector<reco::GenParticle> >(
62 NumberMCParticles = 0;
63 NumberInclusiveJet = 0;
69 AnalysisTree = fs->make<TTree>(
"AnalysisTree",
"MBUE Analysis Tree ");
72 AnalysisTree->Branch(
"EventKind", &EventKind,
"EventKind/I");
77 AnalysisTree->Branch(
"NumberMCParticles", &NumberMCParticles,
"NumberMCParticles/I");
78 AnalysisTree->Branch(
"MomentumMC", MomentumMC,
"MomentumMC[NumberMCParticles]/F");
79 AnalysisTree->Branch(
"TransverseMomentumMC", TransverseMomentumMC,
"TransverseMomentumMC[NumberMCParticles]/F");
80 AnalysisTree->Branch(
"EtaMC", EtaMC,
"EtaMC[NumberMCParticles]/F");
81 AnalysisTree->Branch(
"PhiMC", PhiMC,
"PhiMC[NumberMCParticles]/F");
84 AnalysisTree->Branch(
"NumberInclusiveJet", &NumberInclusiveJet,
"NumberInclusiveJet/I");
85 AnalysisTree->Branch(
"MomentumIJ", MomentumIJ,
"MomentumIJ[NumberInclusiveJet]/F");
86 AnalysisTree->Branch(
"TrasverseMomentumIJ", TransverseMomentumIJ,
"TransverseMomentumIJ[NumberInclusiveJet]/F");
87 AnalysisTree->Branch(
"EtaIJ", EtaIJ,
"EtaIJ[NumberInclusiveJet]/F");
88 AnalysisTree->Branch(
"PhiIJ", PhiIJ,
"PhiIJ[NumberInclusiveJet]/F");
91 AnalysisTree->Branch(
"NumberChargedJet", &NumberChargedJet,
"NumberChargedJet/I");
92 AnalysisTree->Branch(
"MomentumCJ", MomentumCJ,
"MomentumCJ[NumberChargedJet]/F");
93 AnalysisTree->Branch(
"TrasverseMomentumCJ", TransverseMomentumCJ,
"TransverseMomentumCJ[NumberChargedJet]/F");
94 AnalysisTree->Branch(
"EtaCJ", EtaCJ,
"EtaCJ[NumberChargedJet]/F");
95 AnalysisTree->Branch(
"PhiCJ", PhiCJ,
"PhiCJ[NumberChargedJet]/F");
101 MonteCarlo =
new TClonesArray(
"TLorentzVector", 10000);
102 AnalysisTree->Branch(
"MonteCarlo",
"TClonesArray", &
MonteCarlo, 128000, 0);
104 InclusiveJet =
new TClonesArray(
"TLorentzVector", 10000);
105 AnalysisTree->Branch(
"InclusiveJet",
"TClonesArray", &InclusiveJet, 128000, 0);
107 ChargedJet =
new TClonesArray(
"TLorentzVector", 10000);
108 AnalysisTree->Branch(
"ChargedJet",
"TClonesArray", &ChargedJet, 128000, 0);
113 e.
getByToken(chgGenPartCollToken, CandHandleMC);
114 e.
getByToken(chgJetCollToken, ChgGenJetsHandle);
119 EventKind = Evt->signal_process_id();
121 std::vector<math::XYZTLorentzVector>
GenPart;
122 std::vector<GenJet> ChgGenJetContainer;
123 std::vector<GenJet> GenJetContainer;
126 ChgGenJetContainer.clear();
127 GenJetContainer.clear();
130 InclusiveJet->Clear();
133 if (!ChgGenJetsHandle->empty()) {
134 for (GenJetCollection::const_iterator it(ChgGenJetsHandle->begin()), itEnd(ChgGenJetsHandle->end()); it != itEnd;
136 ChgGenJetContainer.push_back(*it);
139 std::stable_sort(ChgGenJetContainer.begin(), ChgGenJetContainer.end(),
GenJetSort());
141 std::vector<GenJet>::const_iterator it(ChgGenJetContainer.begin()), itEnd(ChgGenJetContainer.end());
142 for (
int iChargedJet(0); it != itEnd; ++it, ++iChargedJet) {
143 fillChargedJet(it->p(), it->pt(), it->eta(), it->phi());
144 new ((*ChargedJet)[iChargedJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
148 if (!GenJetsHandle->empty()) {
149 for (GenJetCollection::const_iterator it(GenJetsHandle->begin()), itEnd(GenJetsHandle->end()); it != itEnd; ++it) {
150 GenJetContainer.push_back(*it);
153 std::stable_sort(GenJetContainer.begin(), GenJetContainer.end(),
GenJetSort());
155 std::vector<GenJet>::const_iterator it(GenJetContainer.begin()), itEnd(GenJetContainer.end());
156 for (
int iInclusiveJet(0); it != itEnd; ++it, ++iInclusiveJet) {
157 fillInclusiveJet(it->p(), it->pt(), it->eta(), it->phi());
158 new ((*InclusiveJet)[iInclusiveJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
162 if (!CandHandleMC->empty()) {
163 for (vector<GenParticle>::const_iterator it(CandHandleMC->begin()), itEnd(CandHandleMC->end()); it != itEnd; it++) {
164 GenPart.push_back(it->p4());
167 std::stable_sort(GenPart.begin(), GenPart.end(),
GreaterPt());
169 std::vector<math::XYZTLorentzVector>::const_iterator it(GenPart.begin()), itEnd(GenPart.end());
170 for (
int iMonteCarlo(0); it != itEnd; ++it, ++iMonteCarlo) {
171 fillMCParticles(it->P(), it->Pt(), it->Eta(), it->Phi());
172 new ((*MonteCarlo)[iMonteCarlo]) TLorentzVector(it->Px(), it->Py(), it->Pz(), it->E());
void fillMCParticles(float, float, float, float)
T getUntrackedParameter(std::string const &, T const &) const
void fillChargedJet(float, float, float, float)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double pt() const final
transverse momentum
bool operator()(const math::XYZTLorentzVector &a, const math::XYZTLorentzVector &b)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
AnalysisRootpleProducerOnlyMC(const edm::ParameterSet &)
Jets made from MC generator particles.
bool operator()(const GenJet &a, const GenJet &b)
void analyze(const edm::Event &, const edm::EventSetup &) override
void fillInclusiveJet(float, float, float, float)