Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/EnergySmearing.cc

    rc4b2aae r341014c  
    1717 */
    1818
    19 
    2019/** \class EnergySmearing
    2120 *
     
    3231#include "classes/DelphesFormula.h"
    3332
     33#include "ExRootAnalysis/ExRootClassifier.h"
     34#include "ExRootAnalysis/ExRootFilter.h"
    3435#include "ExRootAnalysis/ExRootResult.h"
    35 #include "ExRootAnalysis/ExRootFilter.h"
    36 #include "ExRootAnalysis/ExRootClassifier.h"
    3736
     37#include "TDatabasePDG.h"
     38#include "TFormula.h"
     39#include "TLorentzVector.h"
    3840#include "TMath.h"
     41#include "TObjArray.h"
     42#include "TRandom3.h"
    3943#include "TString.h"
    40 #include "TFormula.h"
    41 #include "TRandom3.h"
    42 #include "TObjArray.h"
    43 #include "TDatabasePDG.h"
    44 #include "TLorentzVector.h"
    4544
    46 #include <algorithm>
    47 #include <stdexcept>
     45#include <algorithm>
    4846#include <iostream>
    4947#include <sstream>
     48#include <stdexcept>
    5049
    5150using namespace std;
     
    8786
    8887void EnergySmearing::Finish()
    89 { 
     88{
    9089  if(fItInputArray) delete fItInputArray;
    9190}
     
    9998
    10099  fItInputArray->Reset();
    101   while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     100  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
    102101  {
    103102    const TLorentzVector &candidatePosition = candidate->Position;
    104103    const TLorentzVector &candidateMomentum = candidate->Momentum;
    105    
     104
    106105    pt = candidatePosition.Pt();
    107106    eta = candidatePosition.Eta();
    108107    phi = candidatePosition.Phi();
    109108    energy = candidateMomentum.E();
    110  
     109
    111110    // apply smearing formula
    112111    energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy));
    113      
     112
    114113    if(energy <= 0.0) continue;
    115  
     114
    116115    mother = candidate;
    117     candidate = static_cast<Candidate*>(candidate->Clone());
     116    candidate = static_cast<Candidate *>(candidate->Clone());
    118117    eta = candidateMomentum.Eta();
    119118    phi = candidateMomentum.Phi();
    120     candidate->Momentum.SetPtEtaPhiE(energy/TMath::CosH(eta), eta, phi, energy);
    121     candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy)/candidateMomentum.E();
     119    candidate->Momentum.SetPtEtaPhiE(energy / TMath::CosH(eta), eta, phi, energy);
     120    candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) / candidateMomentum.E();
    122121    candidate->AddCandidate(mother);
    123  
     122
    124123    fOutputArray->Add(candidate);
    125124  }
Note: See TracChangeset for help on using the changeset viewer.