Fork me on GitHub

Changeset c59be54 in git for converters


Ignore:
Timestamp:
Dec 19, 2014, 11:05:37 PM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
b594101
Parents:
df04eb1
Message:

check if ROOT file contains all required branches (close #340)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • converters/root2lhco.cpp

    rdf04eb1 rc59be54  
    108108
    109109LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile) :
    110   fTriggerWord(0), fEventNumber(1), fTreeReader(0), fOutputFile(0)
     110  fTriggerWord(0), fEventNumber(1), fTreeReader(0), fOutputFile(0),
     111  fBranchEvent(0), fBranchTrack(0), fBranchTower(0), fBranchPhoton(0),
     112  fBranchElectron(0), fBranchMuon(0), fBranchJet(0), fBranchMissingET(0)
    111113{
    112114  fTreeReader = treeReader;
     
    117119  // reconstructed tracks
    118120  fBranchTrack = fTreeReader->UseBranch("Track");
    119   fItTrack = fBranchTrack->MakeIterator();
    120121  // calorimeter towers
    121122  fBranchTower = fTreeReader->UseBranch("Tower");
    122   fItTower = fBranchTower->MakeIterator();
    123123  // reconstructed photons
    124124  fBranchPhoton = fTreeReader->UseBranch("Photon");
    125   fItPhoton = fBranchPhoton->MakeIterator();
    126125  // reconstructed electrons
    127126  fBranchElectron = fTreeReader->UseBranch("Electron");
    128   fItElectron = fBranchElectron->MakeIterator();
    129127  // reconstructed muons
    130128  fBranchMuon = fTreeReader->UseBranch("Muon");
    131   fItMuon = fBranchMuon->MakeIterator();
    132129  // reconstructed jets
    133130  fBranchJet = fTreeReader->UseBranch("Jet");
    134   fItJet = fBranchJet->MakeIterator();
    135131  // missing transverse energy
    136132  fBranchMissingET = fTreeReader->UseBranch("MissingET");
     133
     134  if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton ||
     135     !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET)
     136  {
     137    throw runtime_error("ROOT file doesn't contain all required branches");
     138  }
     139
     140  fItTrack = fBranchTrack->MakeIterator();
     141  fItTower = fBranchTower->MakeIterator();
     142  fItPhoton = fBranchPhoton->MakeIterator();
     143  fItElectron = fBranchElectron->MakeIterator();
     144  fItMuon = fBranchMuon->MakeIterator();
     145  fItJet = fBranchJet->MakeIterator();
    137146}
    138147
Note: See TracChangeset for help on using the changeset viewer.