Changeset 341014c in git for converters
- Timestamp:
- Feb 12, 2019, 9:29:17 PM (6 years ago)
- Branches:
- ImprovedOutputFile, Timing, llp, master
- Children:
- 6455202
- Parents:
- 45e58be
- Location:
- converters
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
converters/hepmc2pileup.cpp
r45e58be r341014c 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h"27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h"32 #include "TParticlePDG.h"33 #include "TLorentzVector.h"34 34 35 35 #include "classes/DelphesClasses.h" … … 38 38 #include "classes/DelphesPileUpWriter.h" 39 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 71 71 if(argc < 2) 72 72 { 73 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 73 cout << " Usage: " << appName << " output_file" 74 << " [input_file(s)]" << endl; 74 75 cout << " output_file - output binary pile-up file," << endl; 75 76 cout << " input_file(s) - input file(s) in HepMC format," << endl; … … 142 143 reader->Clear(); 143 144 while(reader->ReadBlock(factory, allParticleOutputArray, 144 stableParticleOutputArray, partonOutputArray) && !interrupted) 145 stableParticleOutputArray, partonOutputArray) 146 && !interrupted) 145 147 { 146 148 if(reader->EventReady()) … … 149 151 150 152 itParticle->Reset(); 151 while((candidate = static_cast<Candidate *>(itParticle->Next())))153 while((candidate = static_cast<Candidate *>(itParticle->Next()))) 152 154 { 153 155 const TLorentzVector &position = candidate->Position; … … 173 175 174 176 ++i; 175 } 176 while(i < argc); 177 } while(i < argc); 177 178 178 179 writer->WriteIndex(); -
converters/lhco2root.cpp
r45e58be r341014c 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 22 23 #include <stdlib.h> 21 #include <stdexcept> 22 24 23 #include <signal.h> 25 24 #include <stdio.h> 26 25 #include <stdlib.h> 26 27 #include "TApplication.h" 27 28 #include "TROOT.h" 28 #include "TApplication.h" 29 29 30 #include "TDatabasePDG.h" 30 31 #include "TFile.h" 32 #include "TLorentzVector.h" 31 33 #include "TObjArray.h" 34 #include "TParticlePDG.h" 32 35 #include "TStopwatch.h" 33 #include "TDatabasePDG.h" 34 #include "TParticlePDG.h" 35 #include "TLorentzVector.h" 36 37 #include "modules/Delphes.h" 38 #include "classes/DelphesStream.h" 36 39 37 #include "classes/DelphesClasses.h" 40 38 #include "classes/DelphesFactory.h" 41 39 #include "classes/DelphesStream.h" 40 #include "modules/Delphes.h" 41 42 #include "ExRootAnalysis/ExRootProgressBar.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h" 42 44 #include "ExRootAnalysis/ExRootTreeWriter.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h"44 #include "ExRootAnalysis/ExRootProgressBar.h"45 45 46 46 using namespace std; 47 47 48 static const int kBufferSize 48 static const int kBufferSize = 1024; 49 49 50 50 /* … … 74 74 75 75 private: 76 77 76 void AddMissingEvents(); 78 77 … … 86 85 void AnalyseMissingET(ExRootTreeBranch *branch); 87 86 88 enum {kIntParamSize = 2, kDblParamSize = 7}; 87 enum 88 { 89 kIntParamSize = 2, 90 kDblParamSize = 7 91 }; 89 92 Int_t fIntParam[kIntParamSize]; 90 93 Double_t fDblParam[kDblParamSize]; … … 106 109 ExRootTreeBranch *fBranchJet; 107 110 ExRootTreeBranch *fBranchMissingET; 108 109 111 }; 110 112 … … 169 171 if(!rc) 170 172 { 171 cerr << "** ERROR: " << "invalid event format" << endl; 173 cerr << "** ERROR: " 174 << "invalid event format" << endl; 172 175 return kFALSE; 173 176 } … … 195 198 if(!rc) 196 199 { 197 cerr << "** ERROR: " << "invalid object format" << endl; 200 cerr << "** ERROR: " 201 << "invalid object format" << endl; 198 202 return kFALSE; 199 203 } … … 201 205 switch(fIntParam[1]) 202 206 { 203 204 205 206 207 208 207 case 0: AnalysePhoton(fBranchPhoton); break; 208 case 1: AnalyseElectron(fBranchElectron); break; 209 case 2: AnalyseMuon(fBranchMuon); break; 210 case 3: AnalyseTau(fBranchJet); break; 211 case 4: AnalyseJet(fBranchJet); break; 212 case 6: AnalyseMissingET(fBranchMissingET); break; 209 213 } 210 214 } … … 228 232 LHCOEvent *element; 229 233 230 element = static_cast<LHCOEvent *>(branch->NewEntry());234 element = static_cast<LHCOEvent *>(branch->NewEntry()); 231 235 232 236 element->Number = fEventNumber; … … 240 244 Photon *element; 241 245 242 element = static_cast<Photon *>(branch->NewEntry());246 element = static_cast<Photon *>(branch->NewEntry()); 243 247 244 248 element->Eta = fDblParam[0]; … … 254 258 Electron *element; 255 259 256 element = static_cast<Electron *>(branch->NewEntry());260 element = static_cast<Electron *>(branch->NewEntry()); 257 261 258 262 element->Eta = fDblParam[0]; … … 261 265 262 266 element->Charge = fDblParam[4] < 0.0 ? -1 : 1; 263 /*267 /* 264 268 element->Ntrk = TMath::Abs(fDblParam[4]); 265 269 */ … … 273 277 Muon *element; 274 278 275 element = static_cast<Muon *>(branch->NewEntry());279 element = static_cast<Muon *>(branch->NewEntry()); 276 280 277 281 element->Eta = fDblParam[0]; … … 280 284 281 285 element->Charge = fDblParam[4] < 0.0 ? -1 : 1; 282 /*286 /* 283 287 element->Ntrk = TMath::Abs(fDblParam[4]); 284 288 … … 296 300 Jet *element; 297 301 298 element = static_cast<Jet *>(branch->NewEntry());302 element = static_cast<Jet *>(branch->NewEntry()); 299 303 300 304 element->Eta = fDblParam[0]; … … 308 312 309 313 element->Charge = fDblParam[4] < 0 ? -1 : 1; 310 /*314 /* 311 315 element->Ntrk = TMath::Abs(fDblParam[4]); 312 316 */ … … 320 324 Jet *element; 321 325 322 element = static_cast<Jet *>(branch->NewEntry());326 element = static_cast<Jet *>(branch->NewEntry()); 323 327 324 328 element->Eta = fDblParam[0]; … … 327 331 328 332 element->Mass = fDblParam[3]; 329 /*333 /* 330 334 element->Ntrk = TMath::Abs(Int_t(fDblParam[4])); 331 335 */ … … 336 340 337 341 element->EhadOverEem = fDblParam[6]; 338 /*342 /* 339 343 element->Index = fIntParam[0]; 340 344 */ … … 347 351 MissingET *element; 348 352 349 element = static_cast<MissingET *>(branch->NewEntry());353 element = static_cast<MissingET *>(branch->NewEntry()); 350 354 351 355 element->Phi = fDblParam[1]; … … 376 380 if(argc < 2) 377 381 { 378 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 382 cout << " Usage: " << appName << " output_file" 383 << " [input_file(s)]" << endl; 379 384 cout << " output_file - output file in ROOT format," << endl; 380 385 cout << " input_file(s) - input file(s) in LHCO format," << endl; … … 456 461 457 462 ++i; 458 } 459 while(i < argc); 463 } while(i < argc); 460 464 461 465 cout << "** Exiting..." << endl; … … 474 478 } 475 479 } 476 477 -
converters/pileup2root.cpp
r45e58be r341014c 17 17 */ 18 18 19 20 #include <stdexcept>21 19 #include <iostream> 22 20 #include <sstream> 23 24 #include <stdlib.h> 21 #include <stdexcept> 22 25 23 #include <signal.h> 26 24 #include <stdio.h> 27 25 #include <stdlib.h> 26 27 #include "TApplication.h" 28 28 #include "TROOT.h" 29 #include "TApplication.h" 30 29 30 #include "TDatabasePDG.h" 31 31 #include "TFile.h" 32 #include "TLorentzVector.h" 32 33 #include "TObjArray.h" 34 #include "TParticlePDG.h" 33 35 #include "TStopwatch.h" 34 #include "TDatabasePDG.h" 35 #include "TParticlePDG.h" 36 #include "TLorentzVector.h" 37 38 #include "classes/DelphesStream.h" 36 39 37 #include "classes/DelphesClasses.h" 40 38 #include "classes/DelphesFactory.h" 41 39 #include "classes/DelphesPileUpReader.h" 42 40 #include "classes/DelphesStream.h" 41 42 #include "ExRootAnalysis/ExRootProgressBar.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h" 43 44 #include "ExRootAnalysis/ExRootTreeWriter.h" 44 #include "ExRootAnalysis/ExRootTreeBranch.h"45 #include "ExRootAnalysis/ExRootProgressBar.h"46 45 47 46 using namespace std; … … 62 61 while(reader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 63 62 { 64 particle = static_cast<GenParticle *>(branch->NewEntry());63 particle = static_cast<GenParticle *>(branch->NewEntry()); 65 64 66 65 particle->PID = pid; … … 84 83 85 84 pdgParticle = pdg->GetParticle(pid); 86 particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;85 particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 87 86 88 87 particle->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; … … 92 91 cosTheta = TMath::Abs(momentum.CosTheta()); 93 92 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 94 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());95 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());93 eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta()); 94 rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity()); 96 95 97 96 particle->Eta = eta; … … 126 125 if(argc != 3) 127 126 { 128 cout << " Usage: " << appName << " output_file" << " input_file" << endl; 127 cout << " Usage: " << appName << " output_file" 128 << " input_file" << endl; 129 129 cout << " output_file - output file in ROOT format," << endl; 130 130 cout << " input_file - input binary pile-up file." << endl; … … 199 199 } 200 200 } 201 202 -
converters/root2lhco.cpp
r45e58be r341014c 17 17 */ 18 18 19 #include <fstream> 20 #include <iostream> 21 #include <sstream> 19 22 #include <stdexcept> 20 #include <iostream>21 #include <fstream>22 #include <sstream>23 23 #include <string> 24 24 25 #include <stdlib.h>26 25 #include <signal.h> 27 26 #include <stdio.h> 28 27 #include <stdlib.h> 28 29 #include "TApplication.h" 29 30 #include "TROOT.h" 30 #include "TApplication.h" 31 31 32 #include "TClonesArray.h" 32 33 #include "TFile.h" 33 #include "TClonesArray.h"34 34 35 35 #include "classes/DelphesClasses.h" 36 36 37 #include "ExRootAnalysis/ExRootProgressBar.h" 37 38 #include "ExRootAnalysis/ExRootTreeReader.h" 38 #include "ExRootAnalysis/ExRootProgressBar.h"39 39 40 40 using namespace std; … … 62 62 63 63 private: 64 65 64 void Reset(); 66 65 void Write(); … … 76 75 void AnalyseMissingET(); 77 76 78 enum {kIntParamSize = 2, kDblParamSize = 9}; 77 enum 78 { 79 kIntParamSize = 2, 80 kDblParamSize = 9 81 }; 79 82 Int_t fIntParam[kIntParamSize]; 80 83 Double_t fDblParam[kDblParamSize]; … … 132 135 fBranchMissingET = fTreeReader->UseBranch("MissingET"); 133 136 134 if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || 135 !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET) 137 if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET) 136 138 { 137 139 throw runtime_error("ROOT file doesn't contain all required branches"); … … 202 204 Event *element; 203 205 204 element = static_cast<Event *>(fBranchEvent->At(0));206 element = static_cast<Event *>(fBranchEvent->At(0)); 205 207 206 208 fprintf(fOutputFile, "%4d %13lld %8d\n", 0, element->Number, 0); … … 216 218 217 219 fItPhoton->Reset(); 218 while((element = static_cast<Photon *>(fItPhoton->Next())))220 while((element = static_cast<Photon *>(fItPhoton->Next()))) 219 221 { 220 222 Reset(); … … 239 241 240 242 fItElectron->Reset(); 241 while((element = static_cast<Electron *>(fItElectron->Next())))243 while((element = static_cast<Electron *>(fItElectron->Next()))) 242 244 { 243 245 Reset(); … … 270 272 muonCounter = 0; 271 273 fItMuon->Reset(); 272 while((element = static_cast<Muon *>(fItMuon->Next())))274 while((element = static_cast<Muon *>(fItMuon->Next()))) 273 275 { 274 276 Reset(); … … 276 278 sumPT = 0.0; 277 279 fItTrack->Reset(); 278 while((track = static_cast<Track *>(fItTrack->Next())))280 while((track = static_cast<Track *>(fItTrack->Next()))) 279 281 { 280 282 if(element->P4().DeltaR(track->P4()) < 0.5) sumPT += track->PT; … … 283 285 sumET = 0.0; 284 286 fItTower->Reset(); 285 while((tower = static_cast<Tower *>(fItTower->Next())))287 while((tower = static_cast<Tower *>(fItTower->Next()))) 286 288 { 287 289 if(element->P4().DeltaR(tower->P4()) < 0.5) sumET += tower->ET; … … 293 295 minDR = 1.0E9; 294 296 fItJet->Reset(); 295 while((jet = static_cast<Jet *>(fItJet->Next())))297 while((jet = static_cast<Jet *>(fItJet->Next()))) 296 298 { 297 299 if(jet->TauTag != 0) … … 325 327 } 326 328 327 ratET = sumET /element->PT;329 ratET = sumET / element->PT; 328 330 fDblParam[6] = Float_t(TMath::Nint(sumPT)) + (ratET < 1.0 ? ratET : 0.99); 329 331 … … 342 344 343 345 fItJet->Reset(); 344 while((element = static_cast<Jet *>(fItJet->Next())))346 while((element = static_cast<Jet *>(fItJet->Next()))) 345 347 { 346 348 if(element->TauTag == 0) continue; … … 350 352 counter = 1; 351 353 352 /*354 /* 353 355 fItTrack->Reset(); 354 356 while((track = static_cast<Track*>(fItTrack->Next()))) … … 380 382 381 383 fItJet->Reset(); 382 while((element = static_cast<Jet *>(fItJet->Next())))384 while((element = static_cast<Jet *>(fItJet->Next()))) 383 385 { 384 386 if(element->TauTag != 0) continue; … … 388 390 counter = 0; 389 391 fItTrack->Reset(); 390 while((track = static_cast<Track *>(fItTrack->Next())))392 while((track = static_cast<Track *>(fItTrack->Next()))) 391 393 { 392 394 if(element->P4().DeltaR(track->P4()) < 0.5) ++counter; … … 413 415 MissingET *element; 414 416 415 element = static_cast<MissingET *>(fBranchMissingET->At(0));417 element = static_cast<MissingET *>(fBranchMissingET->At(0)); 416 418 417 419 Reset(); … … 471 473 if(argc < 2 || argc > 4) 472 474 { 473 cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl; 475 cerr << " Usage: " << appName << " input_file" 476 << " [output_file] [--jet-branch=Jet]" << endl; 474 477 cerr << " input_file - input file in ROOT format," << endl; 475 478 cerr << " output_file - output file in LHCO format," << endl; -
converters/root2pileup.cpp
r45e58be r341014c 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 #include <string> 23 23 24 24 #include <signal.h> 25 25 26 #include "TApplication.h" 26 27 #include "TROOT.h" 27 #include "TApplication.h"28 28 29 #include "TClonesArray.h" 29 30 #include "TFile.h" 30 #include "TClonesArray.h"31 31 32 32 #include "classes/DelphesClasses.h" 33 33 #include "classes/DelphesPileUpWriter.h" 34 34 35 #include "ExRootAnalysis/ExRootProgressBar.h" 35 36 #include "ExRootAnalysis/ExRootTreeReader.h" 36 #include "ExRootAnalysis/ExRootProgressBar.h"37 37 38 38 using namespace std; … … 64 64 if(argc < 3) 65 65 { 66 cout << " Usage: " << appName << " output_file" << " input_file(s)" << endl; 66 cout << " Usage: " << appName << " output_file" 67 << " input_file(s)" << endl; 67 68 cout << " output_file - output binary pile-up file," << endl; 68 69 cout << " input_file(s) - input file(s) in ROOT format." << endl; … … 108 109 109 110 itParticle->Reset(); 110 while((particle = static_cast<GenParticle *>(itParticle->Next())))111 while((particle = static_cast<GenParticle *>(itParticle->Next()))) 111 112 { 112 113 writer->WriteParticle(particle->PID, … … 114 115 particle->Px, particle->Py, particle->Pz, particle->E); 115 116 } 116 117 117 118 writer->WriteEntry(); 118 119 -
converters/stdhep2pileup.cpp
r45e58be r341014c 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h"27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h"32 #include "TParticlePDG.h"33 #include "TLorentzVector.h"34 34 35 35 #include "classes/DelphesClasses.h" 36 36 #include "classes/DelphesFactory.h" 37 #include "classes/DelphesPileUpWriter.h" 37 38 #include "classes/DelphesSTDHEPReader.h" 38 #include "classes/DelphesPileUpWriter.h"39 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 71 71 if(argc < 2) 72 72 { 73 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 73 cout << " Usage: " << appName << " output_file" 74 << " [input_file(s)]" << endl; 74 75 cout << " output_file - output binary pile-up file," << endl; 75 76 cout << " input_file(s) - input file(s) in STDHEP format," << endl; … … 142 143 reader->Clear(); 143 144 while(reader->ReadBlock(factory, allParticleOutputArray, 144 stableParticleOutputArray, partonOutputArray) && !interrupted) 145 stableParticleOutputArray, partonOutputArray) 146 && !interrupted) 145 147 { 146 148 if(reader->EventReady()) … … 149 151 150 152 itParticle->Reset(); 151 while((candidate = static_cast<Candidate *>(itParticle->Next())))153 while((candidate = static_cast<Candidate *>(itParticle->Next()))) 152 154 { 153 155 const TLorentzVector &position = candidate->Position; … … 173 175 174 176 ++i; 175 } 176 while(i < argc); 177 } while(i < argc); 177 178 178 179 writer->WriteIndex();
Note:
See TracChangeset
for help on using the changeset viewer.