Changeset a7c3c84 in git for readers/DelphesProIO.cpp
- Timestamp:
- Dec 6, 2018, 8:19:22 AM (6 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 92263a8, adde560
- Parents:
- 9047a02 (diff), 0882413 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
readers/DelphesProIO.cpp
r9047a02 ra7c3c84 57 57 58 58 //--------------------------------------------------------------------------- 59 60 void ConvertInput(proio::Event *event, 59 // This method dynamically checks the message type (varint or not) depending on 60 // non-zero value of units momentumUnit and positionUnit. 61 void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit, 61 62 ExRootTreeBranch *branch, DelphesFactory *factory, 62 63 TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, … … 76 77 pdg = TDatabasePDG::Instance(); 77 78 78 79 79 // event information 80 80 element = static_cast<HepMCEvent *>(branch->NewEntry()); 81 82 81 83 82 int nID=0; … … 99 98 /* 100 99 // Pythia8 specific 101 element->Number = mutableEvent->number();102 element->ProcessID = mutableEvent->process_id();103 100 element->MPI = mutableEvent->mpi(); 104 element->Weight = mutableEvent->weight();105 101 element->Scale = mutableEvent->scale(); 106 102 element->AlphaQED = mutableEvent->alpha_qed(); … … 117 113 element->ReadTime = readStopWatch->RealTime(); 118 114 element->ProcTime = procStopWatch->RealTime(); 115 116 117 118 if ( momentumUnit >0 && positionUnit>0) { 119 120 121 auto entries = event->TaggedEntries("VarintPackedParticles"); 122 123 for (uint64_t entryID : entries) { 124 125 auto mutableParticles = dynamic_cast<model::VarintPackedParticles *>(event->GetEntry(entryID)); 126 127 for(int i = 0; i < mutableParticles->pdg_size(); ++i) 128 { 129 pid = mutableParticles->pdg(i); 130 status = mutableParticles->status(i); 131 px = mutableParticles->px(i)/momentumUnit; 132 py = mutableParticles->py(i)/momentumUnit; 133 pz = mutableParticles->pz(i)/momentumUnit; 134 mass = mutableParticles->mass(i)/momentumUnit; 135 x = mutableParticles->x(i)/positionUnit; 136 y = mutableParticles->y(i)/positionUnit; 137 z = mutableParticles->z(i)/positionUnit; 138 t = mutableParticles->t(i)/positionUnit; 139 140 candidate = factory->NewCandidate(); 141 candidate->PID = pid; 142 pdgCode = TMath::Abs(candidate->PID); 143 candidate->Status = status; 144 candidate->M1 = mutableParticles->parent1(i); 145 candidate->M2 = mutableParticles->parent2(i); 146 candidate->D1 = mutableParticles->child1(i); 147 candidate->D2 = mutableParticles->child2(i); 148 pdgParticle = pdg->GetParticle(pid); 149 candidate->Charge = mutableParticles->charge(i)/3.0; 150 //candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 151 candidate->Mass = mass; 152 candidate->Momentum.SetXYZM(px, py, pz, mass); 153 candidate->Position.SetXYZT(x, y, z, t); 154 allParticleOutputArray->Add(candidate); 155 if(!pdgParticle) continue; 156 157 if(status == 1) 158 { 159 stableParticleOutputArray->Add(candidate); 160 } 161 else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) 162 { 163 partonOutputArray->Add(candidate); 164 } 165 } 166 167 } 168 169 } else { 119 170 120 171 … … 198 249 } 199 250 251 252 } // end particle type 200 253 201 254 } … … 299 352 300 353 auto event = new proio::Event(); 354 355 356 double varint_energy=0; 357 double varint_length=0; 358 359 301 360 auto max_n_events = std::numeric_limits<uint64_t>::max(); 302 361 auto nn = inputFile->Skip(max_n_events); … … 320 379 if(event == 0) continue; 321 380 381 // get metadata 382 if (eventCounter == 0) { 383 auto metadata = event->Metadata(); 384 std::cout << "** INFO: ProIO file metadata:" << std::endl; 385 for (auto element : metadata) { 386 string key=(string)element.first; 387 string value=(string)(*element.second); 388 std::cout << "** INFO: " << key << " = " << value << std::endl; 389 if (key=="info:varint_energy") varint_energy=std::stod(value); 390 if (key=="info:varint_length") varint_length=std::stod(value); 391 } 392 } 393 394 322 395 readStopWatch.Stop(); 323 396 324 397 procStopWatch.Start(); 325 398 326 ConvertInput(event, 399 ConvertInput(event, varint_energy, varint_length, 327 400 branchEvent, factory, 328 401 allParticleOutputArray, stableParticleOutputArray,
Note:
See TracChangeset
for help on using the changeset viewer.