Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/EnergySmearing.cc

    r341014c rc4b2aae  
    1717 */
    1818
     19
    1920/** \class EnergySmearing
    2021 *
     
    3132#include "classes/DelphesFormula.h"
    3233
     34#include "ExRootAnalysis/ExRootResult.h"
     35#include "ExRootAnalysis/ExRootFilter.h"
    3336#include "ExRootAnalysis/ExRootClassifier.h"
    34 #include "ExRootAnalysis/ExRootFilter.h"
    35 #include "ExRootAnalysis/ExRootResult.h"
    3637
     38#include "TMath.h"
     39#include "TString.h"
     40#include "TFormula.h"
     41#include "TRandom3.h"
     42#include "TObjArray.h"
    3743#include "TDatabasePDG.h"
    38 #include "TFormula.h"
    3944#include "TLorentzVector.h"
    40 #include "TMath.h"
    41 #include "TObjArray.h"
    42 #include "TRandom3.h"
    43 #include "TString.h"
    4445
    45 #include <algorithm>
     46#include <algorithm>
     47#include <stdexcept>
    4648#include <iostream>
    4749#include <sstream>
    48 #include <stdexcept>
    4950
    5051using namespace std;
     
    8687
    8788void EnergySmearing::Finish()
    88 {
     89{ 
    8990  if(fItInputArray) delete fItInputArray;
    9091}
     
    9899
    99100  fItInputArray->Reset();
    100   while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
     101  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    101102  {
    102103    const TLorentzVector &candidatePosition = candidate->Position;
    103104    const TLorentzVector &candidateMomentum = candidate->Momentum;
    104 
     105   
    105106    pt = candidatePosition.Pt();
    106107    eta = candidatePosition.Eta();
    107108    phi = candidatePosition.Phi();
    108109    energy = candidateMomentum.E();
    109 
     110 
    110111    // apply smearing formula
    111112    energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy));
    112 
     113     
    113114    if(energy <= 0.0) continue;
    114 
     115 
    115116    mother = candidate;
    116     candidate = static_cast<Candidate *>(candidate->Clone());
     117    candidate = static_cast<Candidate*>(candidate->Clone());
    117118    eta = candidateMomentum.Eta();
    118119    phi = candidateMomentum.Phi();
    119     candidate->Momentum.SetPtEtaPhiE(energy / TMath::CosH(eta), eta, phi, energy);
    120     candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) / candidateMomentum.E();
     120    candidate->Momentum.SetPtEtaPhiE(energy/TMath::CosH(eta), eta, phi, energy);
     121    candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy)/candidateMomentum.E();
    121122    candidate->AddCandidate(mother);
    122 
     123 
    123124    fOutputArray->Add(candidate);
    124125  }
Note: See TracChangeset for help on using the changeset viewer.