Changes in readers/DelphesCMSFWLite.cpp [2886328:77e9ae1] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
readers/DelphesCMSFWLite.cpp
r2886328 r77e9ae1 18 18 19 19 #include <algorithm> 20 #include <iostream> 21 #include <memory> 22 #include <sstream> 20 23 #include <stdexcept> 21 #include <iostream>22 #include <sstream>23 #include <memory>24 24 25 25 #include <map> 26 26 #include <vector> 27 27 28 #include <stdlib.h>29 28 #include <signal.h> 30 29 #include <stdio.h> 31 30 #include <stdlib.h> 31 32 #include "TApplication.h" 32 33 #include "TROOT.h" 33 #include "TApplication.h" 34 34 35 #include "TDatabasePDG.h" 35 36 #include "TFile.h" 37 #include "TLorentzVector.h" 36 38 #include "TObjArray.h" 39 #include "TParticlePDG.h" 37 40 #include "TStopwatch.h" 38 #include "TDatabasePDG.h" 39 #include "TParticlePDG.h" 40 #include "TLorentzVector.h" 41 42 #include "modules/Delphes.h" 43 #include "classes/DelphesStream.h" 41 44 42 #include "classes/DelphesClasses.h" 45 43 #include "classes/DelphesFactory.h" 46 44 #include "classes/DelphesStream.h" 45 #include "modules/Delphes.h" 46 47 #include "ExRootAnalysis/ExRootProgressBar.h" 48 #include "ExRootAnalysis/ExRootTreeBranch.h" 47 49 #include "ExRootAnalysis/ExRootTreeWriter.h" 48 #include "ExRootAnalysis/ExRootTreeBranch.h" 49 #include "ExRootAnalysis/ExRootProgressBar.h" 50 51 #include "FWCore/FWLite/interface/FWLiteEnabler.h" 50 52 51 #include "DataFormats/FWLite/interface/Event.h" 53 52 #include "DataFormats/FWLite/interface/Handle.h" 54 53 #include "DataFormats/HepMCCandidate/interface/GenParticle.h" 55 54 #include "DataFormats/PatCandidates/interface/PackedGenParticle.h" 55 #include "FWCore/FWLite/interface/FWLiteEnabler.h" 56 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" 56 57 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 57 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"58 58 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" 59 59 #include "SimDataFormats/GeneratorProducts/interface/WeightsInfo.h" … … 69 69 { 70 70 71 fwlite::Handle< GenEventInfoProduct> handleGenEventInfo;72 fwlite::Handle< LHEEventProduct> handleLHEEvent;73 fwlite::Handle< vector< reco::GenParticle> > handleParticle;74 fwlite::Handle< vector< pat::PackedGenParticle> > handlePackedParticle;75 76 vector< reco::GenParticle>::const_iterator itParticle;77 vector< pat::PackedGenParticle>::const_iterator itPackedParticle;78 79 vector< const reco::Candidate *> vectorCandidate;80 vector< const reco::Candidate *>::iterator itCandidate;71 fwlite::Handle<GenEventInfoProduct> handleGenEventInfo; 72 fwlite::Handle<LHEEventProduct> handleLHEEvent; 73 fwlite::Handle<vector<reco::GenParticle> > handleParticle; 74 fwlite::Handle<vector<pat::PackedGenParticle> > handlePackedParticle; 75 76 vector<reco::GenParticle>::const_iterator itParticle; 77 vector<pat::PackedGenParticle>::const_iterator itPackedParticle; 78 79 vector<const reco::Candidate *> vectorCandidate; 80 vector<const reco::Candidate *>::iterator itCandidate; 81 81 82 82 handleGenEventInfo.getByLabel(event, "generator"); … … 99 99 handleParticle.getByLabel(event, "genParticles"); 100 100 } 101 else if(!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event, "prunedGenParticles")).empty()))101 else if(!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event, "prunedGenParticles")).empty())) 102 102 { 103 103 handleParticle.getByLabel(event, "prunedGenParticles"); … … 106 106 else 107 107 { 108 std::cout <<"Wrong GenParticle Label! Please, check the input file."<<std::endl;108 std::cout << "Wrong GenParticle Label! Please, check the input file." << std::endl; 109 109 exit(-1); 110 110 } 111 111 112 112 Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty()); 113 Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty()) 113 Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty()); 114 114 115 115 HepMCEvent *element; … … 148 148 if(foundLHE) 149 149 { 150 const vector< gen::WeightsInfo> &vectorWeightsInfo = handleLHEEvent->weights();151 vector< gen::WeightsInfo>::const_iterator itWeightsInfo;150 const vector<gen::WeightsInfo> &vectorWeightsInfo = handleLHEEvent->weights(); 151 vector<gen::WeightsInfo>::const_iterator itWeightsInfo; 152 152 153 153 for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo) … … 173 173 status = particle.status(); 174 174 if(isMiniAOD && particle.status() == 1) continue; 175 px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); 176 x = particle.vx(); y = particle.vy(); z = particle.vz(); 175 px = particle.px(); 176 py = particle.py(); 177 pz = particle.pz(); 178 e = particle.energy(); 179 mass = particle.mass(); 180 x = particle.vx(); 181 y = particle.vy(); 182 z = particle.vz(); 177 183 178 184 candidate = factory->NewCandidate(); … … 196 202 197 203 pdgParticle = pdg->GetParticle(pid); 198 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;204 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 199 205 candidate->Mass = mass; 200 206 201 207 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 202 208 203 candidate->Position.SetXYZT(x *10.0, y*10.0, z*10.0, 0.0);209 candidate->Position.SetXYZT(x * 10.0, y * 10.0, z * 10.0, 0.0); 204 210 205 211 allParticleOutputArray->Add(candidate); … … 232 238 pid = particle.pdgId(); 233 239 status = particle.status(); 234 px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); 235 x = particle.vx(); y = particle.vy(); z = particle.vz(); 240 px = particle.px(); 241 py = particle.py(); 242 pz = particle.pz(); 243 e = particle.energy(); 244 mass = particle.mass(); 245 x = particle.vx(); 246 y = particle.vy(); 247 z = particle.vz(); 236 248 237 249 candidate = factory->NewCandidate(); … … 255 267 256 268 pdgParticle = pdg->GetParticle(pid); 257 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;269 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 258 270 candidate->Mass = mass; 259 271 260 272 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 261 273 262 candidate->Position.SetXYZT(x *10.0, y*10.0, z*10.0, 0.0);274 candidate->Position.SetXYZT(x * 10.0, y * 10.0, z * 10.0, 0.0); 263 275 264 276 allParticleOutputArray->Add(candidate); … … 303 315 if(argc < 4) 304 316 { 305 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 317 cout << " Usage: " << appName << " config_file" 318 << " output_file" 319 << " input_file(s)" << endl; 306 320 cout << " config_file - configuration file in Tcl format," << endl; 307 321 cout << " output_file - output file in ROOT format," << endl;
Note:
See TracChangeset
for help on using the changeset viewer.