32 NumberMCParticles = 0;
34 NumberInclusiveJet = 0;
43 MomentumMC[NumberMCParticles] =
p;
44 TransverseMomentumMC[NumberMCParticles] =
pt;
45 EtaMC[NumberMCParticles] =
eta;
46 PhiMC[NumberMCParticles] = phi;
51 MomentumTK[NumberTracks] =
p;
52 TransverseMomentumTK[NumberTracks] =
pt;
53 EtaTK[NumberTracks] =
eta;
54 PhiTK[NumberTracks] = phi;
59 MomentumIJ[NumberInclusiveJet] =
p;
60 TransverseMomentumIJ[NumberInclusiveJet] =
pt;
61 EtaIJ[NumberInclusiveJet] =
eta;
62 PhiIJ[NumberInclusiveJet] = phi;
67 MomentumCJ[NumberChargedJet] =
p;
68 TransverseMomentumCJ[NumberChargedJet] =
pt;
69 EtaCJ[NumberChargedJet] =
eta;
70 PhiCJ[NumberChargedJet] = phi;
75 MomentumTJ[NumberTracksJet] =
p;
76 TransverseMomentumTJ[NumberTracksJet] =
pt;
77 EtaTJ[NumberTracksJet] =
eta;
78 PhiTJ[NumberTracksJet] = phi;
83 MomentumEHJ[NumberCaloJet] =
p;
84 TransverseMomentumEHJ[NumberCaloJet] =
pt;
85 EtaEHJ[NumberCaloJet] =
eta;
86 PhiEHJ[NumberCaloJet] = phi;
92 onlyRECO =
pset.getUntrackedParameter<
bool>(
"OnlyRECO",
false);
97 mayConsume<reco::GenJetCollection>(
pset.getUntrackedParameter<
InputTag>(
"GenJetCollectionName",
std::string(
"")));
98 chgJetCollToken = mayConsume<reco::GenJetCollection>(
100 tracksJetCollToken = consumes<reco::BasicJetCollection>(
102 recoCaloJetCollToken = consumes<reco::CaloJetCollection>(
104 chgGenPartCollToken = mayConsume<std::vector<reco::GenParticle> >(
106 tracksCollToken = consumes<reco::CandidateCollection>(
115 NumberMCParticles = 0;
117 NumberInclusiveJet = 0;
118 NumberChargedJet = 0;
125 AnalysisTree = fs->make<TTree>(
"AnalysisTree",
"MBUE Analysis Tree ");
127 AnalysisTree->Branch(
"EventKind", &EventKind,
"EventKind/I");
132 AnalysisTree->Branch(
"NumberMCParticles", &NumberMCParticles,
"NumberMCParticles/I");
133 AnalysisTree->Branch(
"MomentumMC", MomentumMC,
"MomentumMC[NumberMCParticles]/F");
134 AnalysisTree->Branch(
"TransverseMomentumMC", TransverseMomentumMC,
"TransverseMomentumMC[NumberMCParticles]/F");
135 AnalysisTree->Branch(
"EtaMC", EtaMC,
"EtaMC[NumberMCParticles]/F");
136 AnalysisTree->Branch(
"PhiMC", PhiMC,
"PhiMC[NumberMCParticles]/F");
139 AnalysisTree->Branch(
"NumberTracks", &NumberTracks,
"NumberTracks/I");
140 AnalysisTree->Branch(
"MomentumTK", MomentumTK,
"MomentumTK[NumberTracks]/F");
141 AnalysisTree->Branch(
"TrasverseMomentumTK", TransverseMomentumTK,
"TransverseMomentumTK[NumberTracks]/F");
142 AnalysisTree->Branch(
"EtaTK", EtaTK,
"EtaTK[NumberTracks]/F");
143 AnalysisTree->Branch(
"PhiTK", PhiTK,
"PhiTK[NumberTracks]/F");
146 AnalysisTree->Branch(
"NumberInclusiveJet", &NumberInclusiveJet,
"NumberInclusiveJet/I");
147 AnalysisTree->Branch(
"MomentumIJ", MomentumIJ,
"MomentumIJ[NumberInclusiveJet]/F");
148 AnalysisTree->Branch(
"TrasverseMomentumIJ", TransverseMomentumIJ,
"TransverseMomentumIJ[NumberInclusiveJet]/F");
149 AnalysisTree->Branch(
"EtaIJ", EtaIJ,
"EtaIJ[NumberInclusiveJet]/F");
150 AnalysisTree->Branch(
"PhiIJ", PhiIJ,
"PhiIJ[NumberInclusiveJet]/F");
153 AnalysisTree->Branch(
"NumberChargedJet", &NumberChargedJet,
"NumberChargedJet/I");
154 AnalysisTree->Branch(
"MomentumCJ", MomentumCJ,
"MomentumCJ[NumberChargedJet]/F");
155 AnalysisTree->Branch(
"TrasverseMomentumCJ", TransverseMomentumCJ,
"TransverseMomentumCJ[NumberChargedJet]/F");
156 AnalysisTree->Branch(
"EtaCJ", EtaCJ,
"EtaCJ[NumberChargedJet]/F");
157 AnalysisTree->Branch(
"PhiCJ", PhiCJ,
"PhiCJ[NumberChargedJet]/F");
160 AnalysisTree->Branch(
"NumberTracksJet", &NumberTracksJet,
"NumberTracksJet/I");
161 AnalysisTree->Branch(
"MomentumTJ", MomentumTJ,
"MomentumTJ[NumberTracksJet]/F");
162 AnalysisTree->Branch(
"TrasverseMomentumTJ", TransverseMomentumTJ,
"TransverseMomentumTJ[NumberTracksJet]/F");
163 AnalysisTree->Branch(
"EtaTJ", EtaTJ,
"EtaTJ[NumberTracksJet]/F");
164 AnalysisTree->Branch(
"PhiTJ", PhiTJ,
"PhiTJ[NumberTracksJet]/F");
167 AnalysisTree->Branch(
"NumberCaloJet", &NumberCaloJet,
"NumberCaloJet/I");
168 AnalysisTree->Branch(
"MomentumEHJ", MomentumEHJ,
"MomentumEHJ[NumberCaloJet]/F");
169 AnalysisTree->Branch(
"TrasverseMomentumEHJ", TransverseMomentumEHJ,
"TransverseMomentumEHJ[NumberCaloJet]/F");
170 AnalysisTree->Branch(
"EtaEHJ", EtaEHJ,
"EtaEHJ[NumberCaloJet]/F");
171 AnalysisTree->Branch(
"PhiEHJ", PhiEHJ,
"PhiEHJ[NumberCaloJet]/F");
177 MonteCarlo =
new TClonesArray(
"TLorentzVector", 10000);
178 AnalysisTree->Branch(
"MonteCarlo",
"TClonesArray", &
MonteCarlo, 128000, 0);
180 Track =
new TClonesArray(
"TLorentzVector", 10000);
181 AnalysisTree->Branch(
"Track",
"TClonesArray", &
Track, 128000, 0);
183 InclusiveJet =
new TClonesArray(
"TLorentzVector", 10000);
184 AnalysisTree->Branch(
"InclusiveJet",
"TClonesArray", &InclusiveJet, 128000, 0);
186 ChargedJet =
new TClonesArray(
"TLorentzVector", 10000);
187 AnalysisTree->Branch(
"ChargedJet",
"TClonesArray", &ChargedJet, 128000, 0);
189 TracksJet =
new TClonesArray(
"TLorentzVector", 10000);
190 AnalysisTree->Branch(
"TracksJet",
"TClonesArray", &TracksJet, 128000, 0);
192 CalorimeterJet =
new TClonesArray(
"TLorentzVector", 10000);
193 AnalysisTree->Branch(
"CalorimeterJet",
"TClonesArray", &CalorimeterJet, 128000, 0);
195 acceptedTriggers =
new TClonesArray(
"TObjString", 10000);
196 AnalysisTree->Branch(
"acceptedTriggers",
"TClonesArray", &acceptedTriggers, 128000, 0);
203 acceptedTriggers->Clear();
204 unsigned int iAcceptedTriggers(0);
211 const unsigned int n_TriggerResults(
triggerResults.product()->size());
212 for (
unsigned int itrig(0); itrig < n_TriggerResults; ++itrig) {
221 new ((*acceptedTriggers)[iAcceptedTriggers]) TObjString((
triggerNames.triggerName(itrig)).c_str());
232 e.getByToken(mcEventToken, EvtHandle);
233 e.getByToken(chgGenPartCollToken, CandHandleMC);
234 e.getByToken(chgJetCollToken, ChgGenJetsHandle);
235 e.getByToken(genJetCollToken, GenJetsHandle);
239 EventKind = Evt->signal_process_id();
241 std::vector<math::XYZTLorentzVector>
GenPart;
242 std::vector<GenJet> ChgGenJetContainer;
243 std::vector<GenJet> GenJetContainer;
246 ChgGenJetContainer.clear();
247 GenJetContainer.clear();
249 InclusiveJet->Clear();
253 if (!ChgGenJetsHandle->empty()) {
254 for (GenJetCollection::const_iterator it(ChgGenJetsHandle->begin()), itEnd(ChgGenJetsHandle->end()); it != itEnd;
256 ChgGenJetContainer.push_back(*it);
259 std::stable_sort(ChgGenJetContainer.begin(), ChgGenJetContainer.end(),
GenJetSort());
261 std::vector<GenJet>::const_iterator it(ChgGenJetContainer.begin()), itEnd(ChgGenJetContainer.end());
262 for (
int iChargedJet(0); it != itEnd; ++it, ++iChargedJet) {
263 fillChargedJet(it->p(), it->pt(), it->eta(), it->phi());
264 new ((*ChargedJet)[iChargedJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
269 if (!GenJetsHandle->empty()) {
270 for (GenJetCollection::const_iterator it(GenJetsHandle->begin()), itEnd(GenJetsHandle->end()); it != itEnd;
272 GenJetContainer.push_back(*it);
275 std::stable_sort(GenJetContainer.begin(), GenJetContainer.end(),
GenJetSort());
277 std::vector<GenJet>::const_iterator it(GenJetContainer.begin()), itEnd(GenJetContainer.end());
278 for (
int iInclusiveJet(0); it != itEnd; ++it, ++iInclusiveJet) {
279 fillInclusiveJet(it->p(), it->pt(), it->eta(), it->phi());
280 new ((*InclusiveJet)[iInclusiveJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
285 if (!CandHandleMC->empty()) {
286 for (vector<GenParticle>::const_iterator it(CandHandleMC->begin()), itEnd(CandHandleMC->end()); it != itEnd;
293 std::vector<math::XYZTLorentzVector>::const_iterator it(
GenPart.begin()), itEnd(
GenPart.end());
294 for (
int iMonteCarlo(0); it != itEnd; ++it, ++iMonteCarlo) {
295 fillMCParticles(it->P(), it->Pt(), it->Eta(), it->Phi());
296 new ((*MonteCarlo)[iMonteCarlo]) TLorentzVector(it->Px(), it->Py(), it->Pz(), it->E());
303 e.getByToken(tracksCollToken, CandHandleRECO);
304 e.getByToken(recoCaloJetCollToken, RecoCaloJetsHandle);
305 e.getByToken(tracksJetCollToken, TracksJetsHandle);
307 std::vector<math::XYZTLorentzVector>
Tracks;
308 std::vector<BasicJet> TracksJetContainer;
309 std::vector<CaloJet> RecoCaloJetContainer;
312 TracksJetContainer.clear();
313 RecoCaloJetContainer.clear();
317 CalorimeterJet->Clear();
319 if (!RecoCaloJetsHandle->empty()) {
320 for (CaloJetCollection::const_iterator it(RecoCaloJetsHandle->begin()), itEnd(RecoCaloJetsHandle->end());
323 RecoCaloJetContainer.push_back(*it);
325 std::stable_sort(RecoCaloJetContainer.begin(), RecoCaloJetContainer.end(),
CaloJetSort());
327 std::vector<CaloJet>::const_iterator it(RecoCaloJetContainer.begin()), itEnd(RecoCaloJetContainer.end());
328 for (
int iCalorimeterJet(0); it != itEnd; ++it, ++iCalorimeterJet) {
329 fillCaloJet(it->p(), it->pt(), it->eta(), it->phi());
330 new ((*CalorimeterJet)[iCalorimeterJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
334 if (!TracksJetsHandle->empty()) {
335 for (BasicJetCollection::const_iterator it(TracksJetsHandle->begin()), itEnd(TracksJetsHandle->end()); it != itEnd;
337 TracksJetContainer.push_back(*it);
339 std::stable_sort(TracksJetContainer.begin(), TracksJetContainer.end(),
BasicJetSort());
341 std::vector<BasicJet>::const_iterator it(TracksJetContainer.begin()), itEnd(TracksJetContainer.end());
342 for (
int iTracksJet(0); it != itEnd; ++it, ++iTracksJet) {
343 fillTracksJet(it->p(), it->pt(), it->eta(), it->phi());
344 new ((*TracksJet)[iTracksJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
348 if (!CandHandleRECO->empty()) {
351 Tracks.push_back(it->p4());
355 std::vector<math::XYZTLorentzVector>::const_iterator it(
Tracks.begin()), itEnd(
Tracks.end());
356 for (
int iTracks(0); it != itEnd; ++it, ++iTracks) {
357 fillTracks(it->P(), it->Pt(), it->Eta(), it->Phi());
358 new ((*Track)[iTracks]) TLorentzVector(it->Px(), it->Py(), it->Pz(), it->E());