Fork me on GitHub

Changeset a7c3c84 in git


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

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • cards/CMS_PhaseII/CMS_PhaseII_200PU_v03.tcl

    r9047a02 ra7c3c84  
    22802280                          (abs(eta) > 1.5 && abs(eta) <= 2.0) * (pt > 35.0 && pt <= 50.0) * (0.95) +
    22812281                          (abs(eta) > 1.5 && abs(eta) <= 2.0) * (pt > 50.0 && pt <= 14000.0) * (0.88) +
    2282                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 2.0 && pt <= 4.0) * (0.22) +
    2283                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 4.0 && pt <= 6.0) * (0.36) +
    2284                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 6.0 && pt <= 8.0) * (0.44) +
    2285                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 8.0 && pt <= 10.0) * (0.57) +
    2286                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 10.0 && pt <= 20.0) * (0.63) +
    2287                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 20.0 && pt <= 35.0) * (0.71) +
    2288                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 35.0 && pt <= 50.0) * (0.76) +
    2289                           (abs(eta) > 2.0 && abs(eta) <= 2.5) * (pt > 50.0 && pt <= 14000.0) * (0.82) +
    2290                           (abs(eta) > 2.5 && abs(eta) <= 2.8) * (pt > 2.0) * (0.80) +
     2282                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 2.0 && pt <= 4.0) * (0.22) +
     2283                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 4.0 && pt <= 6.0) * (0.36) +
     2284                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 6.0 && pt <= 8.0) * (0.44) +
     2285                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 8.0 && pt <= 10.0) * (0.57) +
     2286                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 10.0 && pt <= 20.0) * (0.63) +
     2287                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 20.0 && pt <= 35.0) * (0.71) +
     2288                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 35.0 && pt <= 50.0) * (0.76) +
     2289                          (abs(eta) > 2.0 && abs(eta) <= 2.8) * (pt > 50.0 && pt <= 14000.0) * (0.82) +
    22912290                          (abs(eta) > 2.8) * (0.00)
    22922291      }
  • classes/DelphesLHEFReader.cc

    r9047a02 ra7c3c84  
    3131#include <iostream>
    3232#include <sstream>
    33 #include <string>
    3433
    3534#include <stdio.h>
     
    103102  int rc, id;
    104103  char *pch;
    105   double weight;
     104  double weight, xsec;
    106105
    107106  if(!fgets(fBuffer, kBufferSize, fInputFile)) return kFALSE;
    108107
    109   // read cross section string from LHE file header (meant to work on Wizard output only)
    110   if(strstr(fBuffer, "<xsecinfo ") && fEventCounter < 0)
    111   {
    112     DelphesStream bufferStream(fBuffer);
    113 
    114     string buf = fBuffer;   
    115     string xsecstr="totxsec";
    116    
    117     if (buf.find(xsecstr) != string::npos)
    118     {
    119         buf = buf.substr(buf.find(xsecstr) + xsecstr.length()+1);
    120         unsigned first = buf.find_first_of("\"")+1;
    121         unsigned last = buf.find_last_of("\"");
    122         xsecstr = buf.substr(first,last-first);
    123         fCrossSection = stod(xsecstr);
    124     } 
    125   }
    126  
    127108  if(strstr(fBuffer, "<event>"))
    128109  {
     
    130111    fEventCounter = 1;
    131112  }
    132  
    133113  else if(fEventCounter > 0)
    134114  {
     
    207187    fWeightList.push_back(make_pair(id, weight));
    208188  }
     189  else if(strstr(fBuffer, "<xsecinfo"))
     190  {
     191    pch = strstr(fBuffer, "totxsec");
     192    if(!pch)
     193    {
     194      cerr << "** ERROR: " << "invalid cross section format" << endl;
     195      return kFALSE;
     196    }
     197
     198    pch = strpbrk(pch + 1, "\"'");
     199    if(!pch)
     200    {
     201      cerr << "** ERROR: " << "invalid cross section format" << endl;
     202      return kFALSE;
     203    }
     204
     205    DelphesStream xsecStream(pch + 1);
     206    rc = xsecStream.ReadDbl(xsec);
     207
     208    if(!rc)
     209    {
     210      cerr << "** ERROR: " << "invalid cross section format" << endl;
     211      return kFALSE;
     212    }
     213
     214    fCrossSection = xsec;
     215  }
    209216  else if(strstr(fBuffer, "</event>"))
    210217  {
  • python/DelphesAnalysis/Delphes.py

    r9047a02 ra7c3c84  
    1212  return theString
    1313
    14 _root.MakeRootClass( "Event" ).__str__    = _Event__str__
     14if hasattr(_root,"MakeRootClass"):
     15  _root.MakeRootClass( "Event" ).__str__    = _Event__str__
     16else:
     17  _root.CreateScopeProxy( "Event" ).__str__    = _Event__str__
    1518
    1619def _LHCOEvent__str__( self ):
     
    1821  return theString
    1922
    20 _root.MakeRootClass( "LHCOEvent" ).__str__    = _LHCOEvent__str__
     23if hasattr(_root,"MakeRootClass"):
     24  _root.MakeRootClass( "LHCOEvent" ).__str__    = _LHCOEvent__str__
     25else:
     26  _root.CreateScopeProxy( "LHCOEvent" ).__str__    = _LHCOEvent__str__
    2127
    2228def _LHEFEvent__str__( self ):
     
    2834  return hepmcstr
    2935
    30 _root.MakeRootClass( "LHEFEvent" ).__str__    = _LHEFEvent__str__
     36if hasattr(_root,"MakeRootClass"):
     37  _root.MakeRootClass( "LHEFEvent" ).__str__    = _LHEFEvent__str__
     38else:
     39  _root.CreateScopeProxy( "LHEFEvent" ).__str__    = _LHEFEvent__str__
    3140
    3241def _HepMCEvent__str__( self ):
     
    4352  return hepmcstr
    4453
    45 _root.MakeRootClass( "HepMCEvent" ).__str__    = _HepMCEvent__str__
     54if hasattr(_root,"MakeRootClass"):
     55  _root.MakeRootClass( "HepMCEvent" ).__str__    = _HepMCEvent__str__
     56else:
     57  _root.CreateScopeProxy( "HepMCEvent" ).__str__    = _HepMCEvent__str__
     58
    4659
    4760def _GenParticle__str__( self ):
     
    6174  return thestring
    6275
    63 _root.MakeRootClass( "GenParticle" ).__str__    = _GenParticle__str__
     76if hasattr(_root,"MakeRootClass"):
     77  _root.MakeRootClass( "GenParticle" ).__str__    = _GenParticle__str__
     78else:
     79  _root.CreateScopeProxy( "GenParticle" ).__str__    = _GenParticle__str__
    6480
    6581def _GenParticle_printDecay( self, db, particles, pre="" ):
     
    7187  return thestring
    7288
    73 _root.MakeRootClass( "GenParticle" ).printDecay = _GenParticle_printDecay
     89if hasattr(_root,"MakeRootClass"):
     90  _root.MakeRootClass( "GenParticle" ).printDecay = _GenParticle_printDecay
     91else:
     92  _root.CreateScopeProxy( "GenParticle" ).printDecay = _GenParticle_printDecay
    7493
    7594def _MissingET__str__( self ):
     
    7796  thestring += "Mising energy azimuthal angle: %f\n" % self.Phi
    7897  return thestring
    79  
    80 _root.MakeRootClass( "MissingET" ).__str__    = _MissingET__str__
     98
     99if hasattr(_root,"MakeRootClass"):
     100  _root.MakeRootClass( "MissingET" ).__str__    = _MissingET__str__
     101else:
     102  _root.CreateScopeProxy( "MissingET" ).__str__    = _MissingET__str__
    81103
    82104def _ScalarHT__str__( self ):
    83105  thestring = "Scalar sum of transverse momenta: %f\n" %self.HT
    84106
    85 _root.MakeRootClass( "ScalarHT" ).__str__    = _ScalarHT__str__
     107if hasattr(_root,"MakeRootClass"):
     108  _root.MakeRootClass( "ScalarHT" ).__str__    = _ScalarHT__str__
     109else:
     110  _root.CreateScopeProxy( "ScalarHT" ).__str__    = _ScalarHT__str__
    86111
    87112def _Photon__str__( self ):
     
    89114  return thestring
    90115
    91 _root.MakeRootClass( "Photon" ).__str__    = _Photon__str__
     116if hasattr(_root,"MakeRootClass"):
     117  _root.MakeRootClass( "Photon" ).__str__    = _Photon__str__
     118else:
     119  _root.CreateScopeProxy( "Photon" ).__str__    = _Photon__str__
    92120
    93121def _Electron__str__( self ):
     
    96124  return thestring
    97125
    98 _root.MakeRootClass( "Electron" ).__str__    = _Electron__str__
     126if hasattr(_root,"MakeRootClass"):
     127  _root.MakeRootClass( "Electron" ).__str__    = _Electron__str__
     128else:
     129  _root.CreateScopeProxy( "Electron" ).__str__    = _Electron__str__
    99130
    100131def _Muon__str__( self ):
     
    103134  return thestring
    104135
    105 _root.MakeRootClass( "Muon" ).__str__    = _Muon__str__
     136if hasattr(_root,"MakeRootClass"):
     137  _root.MakeRootClass( "Muon" ).__str__    = _Muon__str__
     138else:
     139  _root.CreateScopeProxy( "Muon" ).__str__    = _Muon__str__
     140
    106141
    107142def _Jet__str__( self ):
     
    126161  return thestring
    127162
    128 _root.MakeRootClass( "Jet" ).__str__    = _Jet__str__
     163if hasattr(_root,"MakeRootClass"):
     164  _root.MakeRootClass( "Jet" ).__str__    = _Jet__str__
     165else:
     166  _root.CreateScopeProxy( "Jet" ).__str__    = _Jet__str__
    129167
    130168def _Track__str__( self ):
     
    137175  return thestring
    138176
    139 _root.MakeRootClass( "Track" ).__str__    = _Track__str__
     177if hasattr(_root,"MakeRootClass"):
     178  _root.MakeRootClass( "Track" ).__str__    = _Track__str__
     179else:
     180  _root.CreateScopeProxy( "Track" ).__str__    = _Track__str__
    140181
    141182def _Tower__str__( self):
     
    145186  return thestring
    146187
    147 _root.MakeRootClass( "Tower" ).__str__    = _Tower__str__
     188if hasattr(_root,"MakeRootClass"):
     189  _root.MakeRootClass( "Tower" ).__str__    = _Tower__str__
     190else:
     191  _root.CreateScopeProxy( "Tower" ).__str__    = _Tower__str__
    148192
    149193#####################################################
     
    156200  return theString
    157201
    158 _root.MakeRootClass( "TLorentzVector" ).__str__    = _lorentzVector__str__
    159 
    160 
     202if hasattr(_root,"MakeRootClass"):
     203  _root.MakeRootClass( "TLorentzVector" ).__str__    = _lorentzVector__str__
     204else:
     205  _root.CreateScopeProxy( "TLorentzVector" ).__str__    = _lorentzVector__str__
     206
     207
  • 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.