StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTowerEnergyCorrectionForTracksFraction.cxx
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 25 August 2009
5 //
6 
7 #include "StjTowerEnergyCorrectionForTracksFraction.h"
8 
10 
11 StjTowerEnergyList StjTowerEnergyCorrectionForTracksFraction::Do(const StjTowerEnergyList& energyDepositList, const StjTrackList& trackList)
12 {
13  StjTowerEnergyList elist;
14  // Tower loop
15  for (StjTowerEnergyList::const_iterator iTower = energyDepositList.begin(); iTower != energyDepositList.end(); ++iTower) {
16  StjTowerEnergy tower = *iTower;
17  // Track loop
18  for (StjTrackList::const_iterator iTrack = trackList.begin(); iTrack != trackList.end(); ++iTrack) {
19  const StjTrack& track = *iTrack;
20  // Does track extrapolate to tower?
21  if (track.exitDetectorId == tower.detectorId && track.exitTowerId == tower.towerId) {
22  // You betcha. Subtract track momentum from tower energy.
23  tower.energy -= mFraction * track.pt * cosh(track.eta);
24  }
25  } // End track loop
26  // Drop towers without energy
27  //if (tower.energy > 0) elist.push_back(tower);
28 
29  // Artificially prevent this tower from contributing to
30  // the jet energy by assigning a really tiny amount (1e-10 GeV)
31  // to the tower energy. Otherwise we would lose the information
32  // about the position of the tower (eta and phi)
33  // if the tower energy was set to zero. This way we retain
34  // the tower ADC that contributes to the jet patch transverse energy
35  // and helps in identifying jets that could have fired the
36  // jet patch trigger.
37  if (tower.energy < 0) tower.energy = 1e-10;
38  elist.push_back(tower);
39  } // End tower loop
40  return elist;
41 }