Fork me on GitHub

Changes between Version 13 and Version 14 of WorkBook/QuickTour


Ignore:
Timestamp:
Feb 25, 2013, 1:08:55 AM (12 years ago)
Author:
Pavel Demin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WorkBook/QuickTour

    v13 v14  
    9898void Example1(const char *inputFile)
    9999{
     100  gSystem->Load("libDelphes");
     101
    100102  // Create chain of root trees
    101103  TChain chain("Delphes");
     
    117119  for(Int_t entry = 0; entry < numberOfEntries; ++entry)
    118120  {
    119 
    120121    // Load selected branches with data from specified event
    121122    treeReader->ReadEntry(entry);
     
    124125    if(branchJet->GetEntries() > 0)
    125126    {
    126 
    127127      // Take first jet
    128       TRootJet *jet = (TRootJet*) branchJet->At(0);
     128      Jet *jet = (Jet*) branchJet->At(0);
    129129     
    130130      // Plot jet transverse momentum
     
    135135    }
    136136
    137     TRootElectron *elec1, *elec2;
    138     TLorentzVector vec1, vec2;
     137    Electron *elec1, *elec2;
    139138
    140139    // If event contains at least 2 electrons
    141140    if(branchElectron->GetEntries() > 1)
    142141    {
    143 
    144142      // Take first two electrons
    145       elec1 = (TRootElectron *) branchElectron->At(0);
    146       elec2 = (TRootElectron *) branchElectron->At(1);
    147 
    148       // Create two 4-vectors for the electrons
    149       vec1.SetPtEtaPhiM(elec1->PT, elec1->Eta, elec1->Phi, 0.0);
    150       vec2.SetPtEtaPhiM(elec2->PT, elec2->Eta, elec2->Phi, 0.0);
     143      elec1 = (Electron *) branchElectron->At(0);
     144      elec2 = (Electron *) branchElectron->At(1);
    151145
    152146      // Plot their invariant mass
    153       histMass->Fill((vec1 + vec2).M());
     147      histMass->Fill(((elec1->P4()) + (elec2->P4())).M());
    154148    }
    155149  }