Fork me on GitHub

Ignore:
Timestamp:
Aug 24, 2021, 11:57:44 AM (3 years ago)
Author:
michele <michele.selvaggi@…>
Branches:
master
Children:
83e77ee
Parents:
1ad8eca
Message:

added charged deposit to calo, fix time calc in DR, add path length to tower

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/DualReadoutCalorimeter.cc

    r1ad8eca r61dccd3  
    248248  number = -1;
    249249  fTowerRmax=0.;
     250
     251  //cout<<"--------- new event ---------- "<<endl;
     252
    250253  while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
    251254  {
     
    391394      fTowerTrackHits = 0;
    392395      fTowerPhotonHits = 0;
     396
     397      fTowerTime = 0.0;
     398      fTowerTimeWeight = 0.0;
    393399
    394400      fECalTowerTrackArray->Clear();
     
    455461    position = particle->Position;
    456462
     463
    457464    // fill current tower
    458465    ecalEnergy = momentum.E() * fECalTowerFractions[number];
     
    462469    fHCalTowerEnergy += hcalEnergy;
    463470
    464     if(ecalEnergy > fTimingEnergyMin && fTower)
    465     {
    466       if (abs(particle->PID) != 11 || !fElectronsFromTrack)
    467       {
    468         fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T()));
    469       }
    470     }
     471    // assume combined timing measurements in ECAL/HCAL sections
     472    fTowerTime += (ecalEnergy + hcalEnergy) * position.T(); //sigma_t ~ 1/sqrt(E)
     473    fTowerTimeWeight += ecalEnergy + hcalEnergy;
     474    //fTowerTime += (hcalEnergy) * position.T(); //sigma_t ~ 1/sqrt(E)
     475    //fTowerTimeWeight += hcalEnergy;
     476    //fTowerTime +=  position.T(); //sigma_t ~ 1/sqrt(E)
     477    //fTowerTimeWeight += 1;
     478
     479    //cout<<" tower particle PID, pt, eta, phi, l, tof:  "<<particle->PID<<", "<<momentum.E()<<", "<<momentum.Eta()<<", "<<momentum.Phi()<<", "<<position.Vect().Mag()<<", "<<position.T()/2.99792458E2<<endl;
     480    //cout<<" tower particle time, weight:  "<<fTowerTime/2.99792458E2<<", "<<fTowerTimeWeight<<endl;
    471481
    472482    fTower->AddCandidate(particle);
     
    484494
    485495  Candidate *track, *tower, *mother;
    486   Double_t energy, pt, eta, phi, r;
     496  Double_t energy, pt, eta, phi, r, time;
    487497  Double_t ecalEnergy, hcalEnergy;
    488498  Double_t ecalNeutralEnergy, hcalNeutralEnergy, neutralEnergy;
     
    529539  hcalEnergy = LogNormal(fHCalTowerEnergy, hcalSigma);
    530540
     541  time = (fTowerTimeWeight < 1.0E-09) ? 0.0 : fTowerTime / fTowerTimeWeight;
     542
    531543  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
    532544  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
     
    535547  if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0;
    536548
    537   //cout<<"Measured energy: "<<energy<<endl;
    538 
    539549  if(fSmearTowerCenter)
    540550  {
     
    550560  pt = energy / TMath::CosH(eta);
    551561
    552   // Time calculation for tower
    553   fTower->NTimeHits = 0;
    554   sumWeightedTime = 0.0;
    555   sumWeight = 0.0;
    556 
    557   for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i)
    558   {
    559     weight = TMath::Power((fTower->ECalEnergyTimePairs[i].first),2);
    560     sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second;
    561     sumWeight += weight;
    562     fTower->NTimeHits++;
    563   }
    564 
    565562  // check whether barrel or endcap tower
    566   if (fTower->Position.Perp() < fTowerRmax && TMath::Abs(eta) > 0.)
     563  if ((fTowerRmax - fTower->Position.Perp()) < 1.e-06 && TMath::Abs(eta) > 0.)
    567564    r = fTower->Position.Z()/TMath::SinH(eta);
    568565  else
    569566    r = fTower->Position.Pt();
    570567
    571   if(sumWeight > 0.0)
    572   {
    573     fTower->Position.SetPtEtaPhiE(r, eta, phi, sumWeightedTime/sumWeight);
    574   }
    575   else
    576   {
    577     fTower->Position.SetPtEtaPhiE(r, eta, phi, 999999.9);
    578   }
     568  fTower->Position.SetPtEtaPhiE(r, eta, phi, time);
     569
     570  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
     571  fTower->L = fTower->Position.Vect().Mag();
     572  //cout<<"   tower pt, eta, phi, l, tof:  "<<fTower->Momentum.E()<<", "<<fTower->Momentum.Eta()<<", "<<fTower->Momentum.Phi()<<", "<<fTower->L<<", "<<fTower->Position.T()/2.99792458E2<<endl;
    579573
    580574  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    581575  fTower->Eem = ecalEnergy;
    582576  fTower->Ehad = hcalEnergy;
    583 
     577  fTower->Etrk = fTrackEnergy;
    584578  fTower->Edges[0] = fTowerEdges[0];
    585579  fTower->Edges[1] = fTowerEdges[1];
     
    602596  neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma*fTrackSigma + sigma*sigma);
    603597
    604   //cout<<"trackEnergy: "<<fTrackEnergy<<", trackSigma: "<<fTrackSigma<<", Ntracks: "<<fTowerTrackArray->GetEntries()<<endl;
    605 
    606   //cout<<"neutralEnergy: "<<neutralEnergy<<", neutralSigma: "<<neutralSigma<<", :fEnergyMin "<<fEnergyMin<<", fEnergySignificanceMin: "<<fEnergySignificanceMin<<endl;
    607 
    608    // For now, if neutral excess is significant, simply create neutral EflowPhoton tower and clone each track into eflowtrack !!! -> Creating only photons !! EFlowNeutralHadron collection will be empy!!! TO BE FIXED
    609598  if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin)
    610599  {
    611 
    612     //cout<<"significant neutral excess found:"<<endl;
    613600    // create new photon tower
    614601    tower = static_cast<Candidate*>(fTower->Clone());
    615602    pt = neutralEnergy / TMath::CosH(eta);
    616     //cout<<"Creating tower with Pt, Eta, Phi, Energy: "<<pt<<","<<eta<<","<<phi<<","<<neutralEnergy<<endl;
    617603    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy);
    618604
Note: See TracChangeset for help on using the changeset viewer.