Fork me on GitHub

Changeset 839deb7 in git for modules/Calorimeter.cc


Ignore:
Timestamp:
Jun 29, 2015, 10:27:47 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
c1ce3fe
Parents:
5d2481f
Message:

fix variable names and formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/Calorimeter.cc

    r5d2481f r839deb7  
    142142  }
    143143
    144 /*
    145   TFractionMap::iterator itFractionMap;
    146   for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
    147   {
    148     cout << itFractionMap->first << "   " << itFractionMap->second.first  << "   " << itFractionMap->second.second << endl;
    149   }
    150 */
    151 
    152144  // read min E value for timing measurement in ECAL
    153   fTimingEMin = GetDouble("TimingEMin",4.);
     145  fTimingEnergyMin = GetDouble("TimingEnergyMin",4.);
    154146  // For timing
    155147  // So far this flag needs to be false
     
    157149  fElectronsFromTrack = false;
    158150
    159  
    160151  // read min E value for towers to be saved
    161152  fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
     
    385376      fTrackHCalEnergy += hcalEnergy;
    386377
    387       bool dbg_scz = false;
    388       if (dbg_scz) {
    389         cout << "   Calorimeter input track has x y z t " << track->Position.X() << " " << track->Position.Y() << " " << track->Position.Z() << " " << track->Position.T()
    390              << endl;
    391         Candidate *prt = static_cast<Candidate*>(track->GetCandidates()->Last());
    392         const TLorentzVector &ini = prt->Position;
    393 
    394         cout << "                and parent has x y z t " << ini.X() << " " << ini.Y() << " " << ini.Z() << " " << ini.T();
    395 
     378      if(ecalEnergy > fTimingEnergyMin && fTower)
     379      {
     380        if(fElectronsFromTrack)
     381        {
     382          fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, track->Position.T()));
     383        }
    396384      }
    397      
    398       if (ecalEnergy > fTimingEMin && fTower) {
    399         if (fElectronsFromTrack) {
    400           //      cout << " SCZ Debug pushing back track hit E=" << ecalEnergy << " T=" << track->Position.T() << " isPU=" << track->IsPU << " isRecoPU=" << track->IsRecoPU
    401           //           << " PID=" << track->PID << endl;
    402           fTower->Ecal_E_t.push_back(std::make_pair<float,float>(ecalEnergy,track->Position.T()));
    403         } else {
    404           //      cout << " Skipping track hit E=" << ecalEnergy << " T=" << track->Position.T() << " isPU=" << track->IsPU << " isRecoPU=" << track->IsRecoPU
    405           //           << " PID=" << track->PID << endl;
    406         }
    407       }
    408 
    409385
    410386      fTowerTrackArray->Add(track);
     
    412388      continue;
    413389    }
    414  
     390
    415391    // check for photon and electron hits in current tower
    416392    if(flags & 2) ++fTowerPhotonHits;
     
    427403    fTowerHCalEnergy += hcalEnergy;
    428404
    429     if (ecalEnergy > fTimingEMin && fTower) {
    430       if (abs(particle->PID) != 11 || !fElectronsFromTrack) {
    431         //      cout << " SCZ Debug About to push back particle hit E=" << ecalEnergy << " T=" << particle->Position.T() << " isPU=" << particle->IsPU
    432         //   << " PID=" << particle->PID << endl;
    433         fTower->Ecal_E_t.push_back(std::make_pair<Float_t,Float_t>(ecalEnergy,particle->Position.T()));
    434       } else {
    435        
    436         // N.B. Only charged particle set to leave ecal energy is the electrons
    437         //      cout << " SCZ Debug To avoid double-counting, skipping particle hit E=" << ecalEnergy << " T=" << particle->Position.T() << " isPU=" << particle->IsPU
    438         //           << " PID=" << particle->PID << endl;
    439        
     405    if(ecalEnergy > fTimingEnergyMin && fTower)
     406    {
     407      if (abs(particle->PID) != 11 || !fElectronsFromTrack)
     408      {
     409        fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T()));
    440410      }
    441411    }
     
    456426  Double_t ecalEnergy, hcalEnergy;
    457427  Double_t ecalSigma, hcalSigma;
    458  
     428  Float_t weight, sumWeightedTime, sumWeight;
     429
    459430  if(!fTower) return;
    460431
     
    472443
    473444  energy = ecalEnergy + hcalEnergy;
    474    
     445
    475446  if(fSmearTowerCenter)
    476447  {
     
    487458
    488459  // Time calculation for tower
    489   fTower->Ntimes = 0;
    490   Float_t tow_sumT = 0;
    491   Float_t tow_sumW = 0;
    492  
    493   for (Int_t i = 0 ; i < fTower->Ecal_E_t.size() ; i++)
    494   {
    495     Float_t w = TMath::Sqrt(fTower->Ecal_E_t[i].first);
    496     tow_sumT += w*fTower->Ecal_E_t[i].second;
    497     tow_sumW += w;
    498     fTower->Ntimes++;
    499   }
    500  
    501   if (tow_sumW > 0.) {
    502     fTower->Position.SetPtEtaPhiE(1.0, eta, phi,tow_sumT/tow_sumW);
    503   } else {
    504     fTower->Position.SetPtEtaPhiE(1.0,eta,phi,999999.);
     460  fTower->NTimeHits = 0;
     461  sumWeightedTime = 0.0;
     462  sumWeight = 0.0;
     463
     464  for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i)
     465  {
     466    weight = TMath::Sqrt(fTower->ECalEnergyTimePairs[i].first);
     467    sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second;
     468    sumWeight += weight;
     469    fTower->NTimeHits++;
     470  }
     471
     472  if(sumWeight > 0.0)
     473  {
     474    fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime/sumWeight);
     475  }
     476  else
     477  {
     478    fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9);
    505479  }
    506480
Note: See TracChangeset for help on using the changeset viewer.