#ifdef USE_CDFEDM2 ////////////////////////////////////////////////////////////////////////// // // Component: StandardCalculator.cc // Purpose: This class inherits from TowerCalculator. It sums the // EM and Hadronic compartements according to what was done // in Run 1. // // Created: 15/09/99 Pierre Savard // History: Aug 15, 2002 Jean-Francois Arguin: Change makePhysicsTower // to accommodate PhysicsTower made from CdfTracks // or HEPG bank, i.e.: if EnergyData has a non-null // eta member, use it for PhysicsTower eta instead // of using ieta. // 25/11/2002 Matthias Toennesmann - Changes triggered by the changes // in the EnergyData class: The EnergyData object now // contains a 4-vector instead of its pseudorapidity. // The PhysicsTower now gets the 4-vector of the EnergyData // object. It is not made massless anymore (important if // HEPG is the source). // 01/05/2003 Dan MacQueen: Changed locs(ieta) to locs (ieta,iphi) // ////////////////////////////////////////////////////////////////////////// #include #include "Calor/StandardCalculator.hh" // namespace calor { StandardCalculator::StandardCalculator() { _etThreshold = 0.1; _calcName = "Standard"; } StandardCalculator::StandardCalculator(float etThreshold) { _etThreshold = etThreshold; _calcName = "Standard"; } PhysicsTower* StandardCalculator::makePhysicsTower(EnergyData* eData, Locations* locs) const { return makeCorrPhysicsTower(eData,locs,1.0,1.0); } PhysicsTower* StandardCalculator::makeCorrPhysicsTower(EnergyData* eData, Locations* locs, float correm,float corrhad) const { size_t iEta = eData->iEta(); size_t iPhi = eData->iPhi(); float emEnergy = eData->emEnergy(); float hadEnergy = eData->hadEnergy(); // correction (offline LERs) emEnergy =emEnergy * correm; hadEnergy =hadEnergy * corrhad; // Take sinTheta from iEta (CalData) or eta (CdfTrack or HEPG) float emSinTheta, hadSinTheta; if(eData->fourMomentum().rho() == 0.0){ emSinTheta = locs->emSinTheta(iEta,iPhi); hadSinTheta = locs->hadSinTheta(iEta,iPhi); } else{ emSinTheta = sin(eData->fourMomentum().theta()); hadSinTheta = emSinTheta; } float emEt = emEnergy * emSinTheta; float hadEt = hadEnergy * hadSinTheta; float totEt = emEt + hadEt; if((totEt == 0. || totEt < _etThreshold)) return 0; // do not waste time making this tower float emEta, emTheta; float hadEta, hadTheta; if(eData->fourMomentum().rho() == 0.0){ emEta = locs->emEta(iEta,iPhi); hadEta = locs->hadEta(iEta,iPhi); emTheta = locs->emTheta(iEta,iPhi); hadTheta = locs->hadTheta(iEta,iPhi); } else{ emEta = eData->fourMomentum().pseudoRapidity(); emTheta = eData->fourMomentum().theta(); hadEta = emEta; hadTheta = emTheta; } float totEta = (emEta *emEt + hadEta *hadEt)/totEt; float emPhi = eData->emPhi(); float hadPhi = eData->hadPhi(); float totPhi = (emPhi *emEt + hadPhi *hadEt)/totEt; float px,py,pz; if(eData->fourMomentum().rho() == 0.0){ px = emEnergy * cos(emPhi) * emSinTheta + hadEnergy * cos(hadPhi) * hadSinTheta; py = emEnergy * sin(emPhi) * emSinTheta + hadEnergy * sin(hadPhi) * hadSinTheta; pz = emEnergy * cos(emTheta) + hadEnergy * cos(hadTheta) ; } else{ px = eData->fourMomentum().x(); py = eData->fourMomentum().y(); pz = eData->fourMomentum().z(); } HepLorentzVector fourMomentum(px,py,pz,(emEnergy+hadEnergy)); return new PhysicsTower(totEta, emEta, hadEta, totPhi, emPhi, hadPhi, emEnergy, hadEnergy, fourMomentum, emEt, hadEt, totEt, iEta, iPhi); } // } // namespace calor #endif // USE_CDFEDM2