Fork me on GitHub

Changeset 9e3f2fb in git for modules


Ignore:
Timestamp:
Jan 26, 2020, 4:52:03 PM (5 years ago)
Author:
michele <michele.selvaggi@…>
Branches:
Timing
Children:
f59b36de
Parents:
c7e90d8
Message:

adapted TimeSmearing to neutral particles

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/TimeSmearing.cc

    rc7e90d8 r9e3f2fb  
    5353
    5454TimeSmearing::TimeSmearing() :
    55   fItInputArray(0), fFormula(0)
     55  fItInputArray(0), fResolutionFormula(0)
    5656{
    57         fFormula = new DelphesFormula;
     57        fResolutionFormula = new DelphesFormula;
    5858}
    5959
     
    6161
    6262TimeSmearing::~TimeSmearing()
    63 { 
    64         if(fFormula) delete fFormula;
     63{
     64        if(fResolutionFormula) delete fResolutionFormula;
    6565}
    6666
     
    6969void TimeSmearing::Init()
    7070{
    71   // read resolution formula   
    72   fFormula->Compile(GetString("TimeResolution", "0.001"));
     71  // read time resolution formula in seconds
     72  fResolutionFormula->Compile(GetString("TimeResolution", "30e-12"));
    7373
    7474  // import input array
    75   fEtaMax = GetDouble("EtaMax", 6.);
    76   fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons"));
     75  fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
    7776  fItInputArray = fInputArray->MakeIterator();
     77
    7878  // create output array
    79 
    80   fOutputArray = ExportArray(GetString("OutputArray", "muons"));
     79  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
    8180}
    8281
     
    9392{
    9493  Candidate *candidate, *mother;
    95   Double_t ti, tf_smeared, tf;
    96   Double_t pt, eta, phi, e, p, l;
    97   Double_t beta_particle;
     94  Double_t ti,ti_smeared, tf, tf_smeared, dt;
     95  Double_t eta, energy;
    9896  Double_t timeResolution;
    9997
     
    104102  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    105103  {
     104    const TLorentzVector &candidatePosition = candidate->Position;
     105    const TLorentzVector &candidateMomentum = candidate->Momentum;
     106
     107    // convert mm in seconds
    106108    ti = candidate->InitialPosition.T()*1.0E-3/c_light;
    107109    tf = candidate->Position.T()*1.0E-3/c_light;
    108    
    109     // dummy, only need to properly call TFormula
    110     const TLorentzVector &candidatePosition = candidate->Position;
    111     const TLorentzVector &candidateMomentum = candidate->Momentum;
     110
    112111    eta = candidatePosition.Eta();
    113     phi = candidatePosition.Phi();
    114     pt = candidateMomentum.Pt();
    115     e = candidateMomentum.E();
    116     p = candidateMomentum.P();
    117     beta_particle = p/e;
    118     l = candidate->L;
    119     timeResolution = fFormula->Eval(e);
    120    
     112    energy = candidateMomentum.E();
     113    timeResolution = fResolutionFormula->Eval(0.0, eta, 0.0, energy);
     114
     115    dt = timeResolution*gRandom->Gaus(0, 1);
     116    tf_smeared = tf + dt;
     117    ti_smeared = ti + dt;
     118    mother = candidate;
     119    candidate = static_cast<Candidate*>(candidate->Clone());
     120    candidate->AddCandidate(mother);
     121
     122    candidate->Position.SetT(tf_smeared*1.0E3*c_light);
     123    candidate->ErrorT = timeResolution*1.0E3*c_light;
     124
     125    // treating charged and neutral differently:
     126    // for charged we smear the time after propagation, and put a dummy value for time at Vertex
     127    // since the correct value will be computed after Vertexing4D
    121128    if(candidate->Charge != 0)
    122     {
    123       tf_smeared = tf + timeResolution*gRandom->Gaus(0, 1);
    124       mother = candidate;
    125       candidate = static_cast<Candidate*>(candidate->Clone());  // I am not sure that we need these lines !!!
    126       candidate->AddCandidate(mother);
    127       candidate->InitialPosition.SetT((100+ti)*1.0E3*c_light);  // Dummy Value, correct value will be computed by VertexFinderDA4D
    128       candidate->Position.SetT(tf_smeared*1.0E3*c_light);
    129       candidate->ErrorT = timeResolution*1.0E3*c_light;
    130       fOutputArray->Add(candidate);
    131     }
     129      // Dummy Value, correct value will be computed by VertexFinderDA4D
     130      candidate->InitialPosition.SetT((100+ti)*1.0E3*c_light);
    132131    else
    133     {
    134       ti = timeResolution - l*1.0E3/(c_light*beta_particle);   
    135       candidate->InitialPosition.SetT(ti);
    136       candidate->ErrorT = timeResolution*1.0E3*c_light;         // Do we need to sum with 100 like in upside ?
    137       fOutputArray->Add(candidate);
    138     }
    139    
     132      candidate->InitialPosition.SetT(ti_smeared*1.0E3*c_light);
     133
     134    fOutputArray->Add(candidate);
     135
    140136  }
    141137}
  • modules/TimeSmearing.h

    rc7e90d8 r9e3f2fb  
    2222/** \class TimeSmearing
    2323 *
    24  *  Performs transverse time smearing.
     24 *  Performs time of flight smearing.
    2525 *
    2626 *  \author Michele Selvaggi - UCL, Louvain-la-Neuve
     
    4545
    4646private:
    47   DelphesFormula *fFormula;
    48   Double_t fEtaMax;
    4947
     48  DelphesFormula *fResolutionFormula;
     49 
    5050  TIterator *fItInputArray; //!
    5151
Note: See TracChangeset for help on using the changeset viewer.