Fork me on GitHub

Changeset 22dc7fd in git for modules/Calorimeter.cc


Ignore:
Timestamp:
Dec 21, 2013, 3:00:11 PM (11 years ago)
Author:
mselvaggi <mselvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
24d005f
Parents:
af88093
Message:

timing implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/Calorimeter.cc

    raf88093 r22dc7fd  
    330330      fTrackHCalEnergy = 0.0;
    331331
     332      fTowerECalTime = 0.0;
     333      fTowerHCalTime = 0.0;
     334
     335      fTrackECalTime = 0.0;
     336      fTrackHCalTime = 0.0;
     337
     338      fTowerECalWeightTime = 0.0;
     339      fTowerHCalWeightTime = 0.0;
     340     
    332341      fTowerTrackHits = 0;
    333342      fTowerPhotonHits = 0;
     
    343352      track = static_cast<Candidate*>(fTrackInputArray->At(number));
    344353      momentum = track->Momentum;
    345 
     354      position = track->Position;
     355
     356     
    346357      ecalEnergy = momentum.E() * fTrackECalFractions[number];
    347358      hcalEnergy = momentum.E() * fTrackHCalFractions[number];
     
    349360      fTrackECalEnergy += ecalEnergy;
    350361      fTrackHCalEnergy += hcalEnergy;
     362     
     363      fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T();
     364      fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
     365       
     366      fTrackECalWeightTime += TMath::Sqrt(ecalEnergy);
     367      fTrackHCalWeightTime += TMath::Sqrt(hcalEnergy);
    351368
    352369      fTowerTrackArray->Add(track);
     
    360377    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
    361378    momentum = particle->Momentum;
     379    position = particle->Position;
    362380
    363381    // fill current tower
     
    367385    fTowerECalEnergy += ecalEnergy;
    368386    fTowerHCalEnergy += hcalEnergy;
     387
     388    fTowerECalTime += TMath::Sqrt(ecalEnergy)*position.T();
     389    fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
     390
     391    fTowerECalWeightTime += TMath::Sqrt(ecalEnergy);
     392    fTowerHCalWeightTime += TMath::Sqrt(hcalEnergy);
     393   
    369394
    370395    fTower->AddCandidate(particle);
     
    383408  Double_t ecalEnergy, hcalEnergy;
    384409  Double_t ecalSigma, hcalSigma;
     410  Double_t ecalTime, hcalTime, time;
    385411
    386412  if(!fTower) return;
     
    392418
    393419  ecalEnergy = LogNormal(fTowerECalEnergy, ecalSigma);
     420  ecalTime = (fTowerECalWeightTime < 1.0E-09 ) ? 0 : fTowerECalTime/fTowerECalWeightTime;
    394421
    395422  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy);
     
    399426
    400427  hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma);
     428  hcalTime = (fTowerHCalWeightTime < 1.0E-09 ) ? 0 : fTowerHCalTime/fTowerHCalWeightTime;
    401429
    402430  energy = ecalEnergy + hcalEnergy;
     431  time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
    403432
    404433//  eta = fTowerEta;
     
    410439  pt = energy / TMath::CosH(eta);
    411440
    412   fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0);
     441 // fTower->Position.SetXYZT(-time, 0.0, 0.0, time);
     442  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
    413443  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    414444  fTower->Eem = ecalEnergy;
     
    420450  fTower->Edges[3] = fTowerEdges[3];
    421451
     452
    422453  // fill calorimeter towers and photon candidates
    423454  if(energy > 0.0)
Note: See TracChangeset for help on using the changeset viewer.