Fork me on GitHub

Changeset a7c3c84 in git for readers/DelphesProIO.cpp


Ignore:
Timestamp:
Dec 6, 2018, 8:19:22 AM (6 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
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.
Message:

Merge branch 'master' of github.com:delphes/delphes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesProIO.cpp

    r9047a02 ra7c3c84  
    5757
    5858//---------------------------------------------------------------------------
    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.
     61void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit,
    6162  ExRootTreeBranch *branch, DelphesFactory *factory,
    6263  TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray,
     
    7677  pdg = TDatabasePDG::Instance();
    7778
    78 
    7979  // event information
    8080  element = static_cast<HepMCEvent *>(branch->NewEntry());
    81 
    8281
    8382 int nID=0;
     
    9998/*
    10099  // Pythia8 specific
    101   element->Number = mutableEvent->number();
    102   element->ProcessID = mutableEvent->process_id();
    103100  element->MPI = mutableEvent->mpi();
    104   element->Weight = mutableEvent->weight();
    105101  element->Scale = mutableEvent->scale();
    106102  element->AlphaQED = mutableEvent->alpha_qed();
     
    117113  element->ReadTime = readStopWatch->RealTime();
    118114  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 {
    119170
    120171
     
    198249  }
    199250
     251
     252  } // end particle type
    200253
    201254}
     
    299352
    300353    auto event = new proio::Event();
     354
     355
     356   double varint_energy=0;
     357   double varint_length=0;
     358
     359
    301360    auto max_n_events = std::numeric_limits<uint64_t>::max();
    302361    auto nn = inputFile->Skip(max_n_events);
     
    320379        if(event == 0) continue;
    321380
     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
    322395        readStopWatch.Stop();
    323396
    324397        procStopWatch.Start();
    325398
    326         ConvertInput(event,
     399        ConvertInput(event, varint_energy, varint_length,
    327400          branchEvent, factory,
    328401          allParticleOutputArray, stableParticleOutputArray,
Note: See TracChangeset for help on using the changeset viewer.