Fork me on GitHub

Changeset d1678fd in git for modules/Calorimeter.cc


Ignore:
Timestamp:
Mar 17, 2021, 5:07:53 PM (4 years ago)
Author:
michele <michele.selvaggi@…>
Branches:
master
Children:
5eda6767
Parents:
9cc5aeb
Message:

fix weighted time and tower position in calorimeter modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/Calorimeter.cc

    r9cc5aeb rd1678fd  
    450450
    451451    fTower->AddCandidate(particle);
     452    fTower->Position = position;
    452453  }
    453454
     
    461462{
    462463  Candidate *track, *tower, *mother;
    463   Double_t energy, pt, eta, phi;
     464  Double_t energy, pt, eta, phi, r;
    464465  Double_t ecalEnergy, hcalEnergy;
    465466  Double_t ecalNeutralEnergy, hcalNeutralEnergy;
     
    511512  for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i)
    512513  {
    513     weight = TMath::Sqrt(fTower->ECalEnergyTimePairs[i].first);
     514    weight = TMath::Power((fTower->ECalEnergyTimePairs[i].first),2);
    514515    sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second;
    515516    sumWeight += weight;
     
    517518  }
    518519
     520  r = TMath::Sqrt(fTower->Position.X()*fTower->Position.X()+fTower->Position.Y()*fTower->Position.Y());
     521
    519522  if(sumWeight > 0.0)
    520523  {
    521     fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime / sumWeight);
     524    fTower->Position.SetPtEtaPhiE(r, eta, phi, sumWeightedTime / sumWeight);
    522525  }
    523526  else
    524527  {
    525     fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9);
     528    fTower->Position.SetPtEtaPhiE(r, eta, phi, 999999.9);
    526529  }
    527530
Note: See TracChangeset for help on using the changeset viewer.