Changes in readers/DelphesROOT.cpp [341014c:94083e7] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
readers/DelphesROOT.cpp
r341014c r94083e7 18 18 19 19 #include <algorithm> 20 #include <stdexcept> 20 21 #include <iostream> 22 #include <sstream> 21 23 #include <memory> 22 #include <sstream>23 #include <stdexcept>24 24 25 25 #include <map> 26 26 #include <vector> 27 27 28 #include <stdlib.h> 28 29 #include <signal.h> 29 30 #include <stdio.h> 30 #include <stdlib.h> 31 31 32 #include "TROOT.h" 32 33 #include "TApplication.h" 33 #include "TROOT.h" 34 34 35 #include "TFile.h" 35 36 #include "TClonesArray.h" 37 #include "TObjArray.h" 38 #include "TStopwatch.h" 36 39 #include "TDatabasePDG.h" 37 #include "T File.h"40 #include "TParticlePDG.h" 38 41 #include "TLorentzVector.h" 39 #include "TObjArray.h" 40 #include "TParticlePDG.h" 41 #include "TStopwatch.h" 42 42 43 #include "modules/Delphes.h" 44 #include "classes/DelphesStream.h" 43 45 #include "classes/DelphesClasses.h" 44 46 #include "classes/DelphesFactory.h" 45 #include "classes/DelphesStream.h" 46 #include "modules/Delphes.h" 47 47 48 #include "ExRootAnalysis/ExRootTreeWriter.h" 49 #include "ExRootAnalysis/ExRootTreeReader.h" 50 #include "ExRootAnalysis/ExRootTreeBranch.h" 48 51 #include "ExRootAnalysis/ExRootProgressBar.h" 49 #include "ExRootAnalysis/ExRootTreeBranch.h" 50 #include "ExRootAnalysis/ExRootTreeReader.h" 51 #include "ExRootAnalysis/ExRootTreeWriter.h" 52 53 52 54 53 55 using namespace std; 54 56 55 57 //--------------------------------------------------------------------------- 58 56 59 57 60 //--------------------------------------------------------------------------- … … 91 94 if(argc < 4) 92 95 { 93 cout << " Usage: " << appName << " config_file" 94 << " output_file" 95 << " input_file(s)" << endl; 96 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 96 97 cout << " config_file - configuration file in Tcl format," << endl; 97 98 cout << " output_file - output file in ROOT format," << endl; … … 121 122 122 123 branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class()); 123 124 124 125 confReader = new ExRootConfReader; 125 126 confReader->ReadFile(argv[1]); … … 128 129 modularDelphes->SetConfReader(confReader); 129 130 modularDelphes->SetTreeWriter(treeWriter); 130 131 131 132 TChain *chain = new TChain("Delphes"); 132 133 133 134 factory = modularDelphes->GetFactory(); 134 135 allParticleOutputArray = modularDelphes->ExportArray("allParticles"); … … 144 145 chain->Add(argv[i]); 145 146 ExRootTreeReader *treeReader = new ExRootTreeReader(chain); 146 147 147 148 inputFile = TFile::Open(argv[i]); 148 149 … … 152 153 throw runtime_error(message.str()); 153 154 } 154 155 155 156 numberOfEvents = treeReader->GetEntries(); 156 TClonesArray *branchParticle = treeReader->UseBranch("Particle");157 TClonesArray *branchParticle = treeReader->UseBranch("Particle"); 157 158 TClonesArray *branchHepMCEvent = treeReader->UseBranch("Event"); 158 159 159 160 if(numberOfEvents <= 0) continue; 160 161 … … 168 169 for(Int_t entry = 0; entry < numberOfEvents && !interrupted; ++entry) 169 170 { 170 171 171 172 treeReader->ReadEntry(entry); 172 173 173 // -- TBC need also to include event weights -- 174 175 eve = (HepMCEvent *)branchHepMCEvent->At(0);174 // -- TBC need also to include event weights -- 175 176 eve = (HepMCEvent*) branchHepMCEvent->At(0); 176 177 element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); 177 178 178 179 element->Number = eventCounter; 179 180 … … 196 197 element->ProcTime = eve->ProcTime; 197 198 198 for(Int_t j =0; j < branchParticle->GetEntriesFast(); j++)199 { 200 201 gen = (GenParticle *)branchParticle->At(j);199 for(Int_t j=0; j < branchParticle->GetEntriesFast(); j++) 200 { 201 202 gen = (GenParticle*) branchParticle->At(j); 202 203 candidate = factory->NewCandidate(); 203 204 204 205 candidate->Momentum = gen->P4(); 205 candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T * 1.0E3 *c_light);206 206 candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T*1.0E3*c_light); 207 207 208 candidate->PID = gen->PID; 208 209 candidate->Status = gen->Status; 209 210 210 211 candidate->M1 = gen->M1; 211 212 candidate->M2 = gen->M2; … … 215 216 216 217 candidate->Charge = gen->Charge; 217 candidate->Mass = gen->Mass;218 218 candidate->Mass = gen->Mass; 219 219 220 allParticleOutputArray->Add(candidate); 220 221 221 222 pdgCode = TMath::Abs(gen->PID); 222 223 … … 230 231 } 231 232 } 232 233 233 234 modularDelphes->ProcessTask(); 234 235 … … 241 242 ++eventCounter; 242 243 } 243 244 244 245 progressBar.Update(eventCounter, eventCounter, kTRUE); 245 246 progressBar.Finish(); 246 247 247 248 inputFile->Close(); 248 249 249 250 delete treeReader; 251 250 252 } 251 253 … … 260 262 delete outputFile; 261 263 delete chain; 262 264 263 265 return 0; 264 266 }
Note:
See TracChangeset
for help on using the changeset viewer.