Fork me on GitHub

Changeset 6049672 in git for modules/TimeSmearing.cc


Ignore:
Timestamp:
Jan 23, 2020, 8:59:46 PM (5 years ago)
Author:
Kaan Yüksel Oyulmaz <kaanyukseloyulmaz@…>
Branches:
Timing
Children:
4ac0049
Parents:
e70228d
Message:

New changes according to last meeting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/TimeSmearing.cc

    re70228d r6049672  
    5353
    5454TimeSmearing::TimeSmearing() :
    55   fItInputArray(0)
     55  fItInputArray(0), fFormula(0)
    5656{
     57        fFormula = new DelphesFormula;
    5758}
    5859
     
    6162TimeSmearing::~TimeSmearing()
    6263
     64        if(fFormula) delete fFormula;
    6365}
    6466
     
    6769void TimeSmearing::Init()
    6870{
    69   // read resolution formula
    70 
    71   fTimeResolution = GetDouble("TimeResolution", 1.);
     71  // read resolution formula   
     72  fFormula->Compile(GetString("TimeResolution", "0.001"));
    7273
    7374  // import input array
     
    9495  Double_t ti, tf_smeared, tf;
    9596  Double_t pt, eta, phi, e, p, l;
    96   Double_t sigma_t, beta_particle;
     97  Double_t beta_particle;
     98  Double_t timeResolution;
    9799
    98100
    99101  const Double_t c_light = 2.99792458E8;
    100 
    101   cout << " STARTINNNGG ---------->" << endl;
    102102
    103103  fItInputArray->Reset();
     
    117117    beta_particle = p/e;
    118118    l = candidate->L;
    119     // apply smearing formula
    120 
     119    timeResolution = fFormula->Eval(e);
     120   
    121121    if(candidate->Charge != 0)
    122122    {
    123       tf_smeared = tf + fTimeResolution*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);
     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);
    127127      candidate->InitialPosition.SetT((100+ti)*1.0E3*c_light);
    128128      candidate->Position.SetT(tf_smeared*1.0E3*c_light);
    129       candidate->ErrorT = fTimeResolution*1.0E3*c_light;
     129      candidate->ErrorT = timeResolution*1.0E3*c_light;
    130130      fOutputArray->Add(candidate);
    131131    }
    132132    else
    133133    {
    134         sigma_t = sqrt(pow(20,2) + pow(150,2)/e);
    135         ti = sigma_t - l*1.0E3/(c_light*beta_particle);   
    136         candidate->InitialPosition.SetT(ti);
    137         candidate->ErrorT = sigma_t*1.0E3*c_light;              // Do we need to sum with 100 like in upside ?
    138         fOutputArray->Add(candidate);
     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);
    139138    }
    140139   
Note: See TracChangeset for help on using the changeset viewer.