Fork me on GitHub

Changeset f29758e in git


Ignore:
Timestamp:
Jul 4, 2014, 6:24:22 PM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
529fe78
Parents:
a6db2d6
Message:

add Event branch to DelphesCMSFWLite.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesCMSFWLite.cpp

    ra6db2d6 rf29758e  
    3636#include "DataFormats/FWLite/interface/Handle.h"
    3737#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
     38#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
     39#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
    3840
    3941using namespace std;
     
    4143//---------------------------------------------------------------------------
    4244
    43 void ConvertInput(fwlite::Event &event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
     45void ConvertInput(fwlite::Event &event, Long64_t eventCounter,
     46  ExRootTreeBranch *branchEvent, DelphesFactory *factory,
     47  TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray,
     48  TObjArray *partonOutputArray)
    4449{
     50  fwlite::Handle< GenEventInfoProduct > handleGenEventInfo;
     51
    4552  fwlite::Handle< vector< reco::GenParticle > > handleParticle;
    4653  vector< reco::GenParticle >::const_iterator itParticle;
     
    4956  vector< const reco::Candidate * >::iterator itCandidate;
    5057
     58  handleGenEventInfo.getByLabel(event, "generator");
    5159  handleParticle.getByLabel(event, "genParticles");
    5260
     61  HepMCEvent *element;
    5362  Candidate *candidate;
    5463  TDatabasePDG *pdg;
     
    6069  Double_t x, y, z;
    6170
     71  element = static_cast<HepMCEvent *>(branchEvent->NewEntry());
     72
     73  element->Number = eventCounter;
     74
     75  element->ProcessID = handleGenEventInfo->signalProcessID();
     76  element->MPI = 1;
     77  element->Weight = handleGenEventInfo->weights()[0];
     78  element->Scale = handleGenEventInfo->qScale();
     79  element->AlphaQED = handleGenEventInfo->alphaQED();
     80  element->AlphaQCD = handleGenEventInfo->alphaQCD();
     81
     82  element->ID1 = 0;
     83  element->ID2 = 0;
     84  element->X1 = 0.0;
     85  element->X2 = 0.0;
     86  element->ScalePDF = 0.0;
     87  element->PDF1 = 0.0;
     88  element->PDF2 = 0.0;
     89
     90  element->ReadTime = 0.0;
     91  element->ProcTime = 0.0;
     92
    6293  pdg = TDatabasePDG::Instance();
    6394
     
    82113
    83114    candidate->Status = status;
     115
     116    if(particle.mother())
     117    {
     118      itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.mother());
     119      if(itCandidate != vectorCandidate.end()) candidate->M1 = distance(vectorCandidate.begin(), itCandidate);
     120    }
    84121
    85122    itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0));
     
    131168  TStopwatch eventStopWatch;
    132169  ExRootTreeWriter *treeWriter = 0;
     170  ExRootTreeBranch *branchEvent = 0;
    133171  ExRootConfReader *confReader = 0;
    134172  Delphes *modularDelphes = 0;
     
    169207    treeWriter = new ExRootTreeWriter(outputFile, "Delphes");
    170208
     209    branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class());
     210
    171211    confReader = new ExRootConfReader;
    172212    confReader->ReadFile(argv[1]);
     
    210250      for(event.toBegin(); !event.atEnd() && !interrupted; ++event)
    211251      {
    212         ConvertInput(event, factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
     252        ConvertInput(event, eventCounter, branchEvent, factory,
     253          allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
    213254        modularDelphes->ProcessTask();
    214255
Note: See TracChangeset for help on using the changeset viewer.