#include <TCTauAlgorithm.h>
Definition at line 45 of file TCTauAlgorithm.h.
anonymous enum |
TCAlgoUndetermined | |
TCAlgoMomentum | |
TCAlgoTrackProblem | |
TCAlgoMomentumECAL | |
TCAlgoCaloJet | |
TCAlgoHadronicJet |
Definition at line 47 of file TCTauAlgorithm.h.
TCTauAlgorithm::TCTauAlgorithm | ( | ) |
TCTauAlgorithm::TCTauAlgorithm | ( | const edm::ParameterSet & | iConfig | ) |
TCTauAlgorithm::~TCTauAlgorithm | ( | ) |
Definition at line 24 of file TCTauAlgorithm.cc.
{}
int TCTauAlgorithm::algoComponent | ( | ) |
Definition at line 76 of file TCTauAlgorithm.cc.
Referenced by TCTauCorrector::algoComponent().
{ return algoComponentUsed; }
int TCTauAlgorithm::allTauCandidates | ( | ) |
Definition at line 72 of file TCTauAlgorithm.cc.
References cond::ecalcond::all.
Referenced by TCTauCorrector::allTauCandidates().
{ return all; }
double TCTauAlgorithm::efficiency | ( | ) |
Definition at line 64 of file TCTauAlgorithm.cc.
References cond::ecalcond::all.
Referenced by TCTauCorrector::efficiency().
void TCTauAlgorithm::eventSetup | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) |
Definition at line 80 of file TCTauAlgorithm.cc.
References egHLT::errCodes::EBRecHits, DetId::Ecal, EcalBarrel, EcalEndcap, egHLT::errCodes::EERecHits, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), egHLT::errCodes::HBHERecHits, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, egHLT::errCodes::HFRecHits, iEvent, edm::ESHandle< T >::product(), and HcalObjRepresent::setup().
Referenced by TCTauCorrector::eventSetup().
{ event = &iEvent; setup = &iSetup; edm::ESHandle<TransientTrackBuilder> builder; iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",builder); transientTrackBuilder = builder.product(); // geometry initialization edm::ESHandle<CaloGeometry> geometry; iSetup.get<CaloGeometryRecord>().get(geometry); EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel); EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap); HB = geometry->getSubdetectorGeometry(DetId::Hcal,HcalBarrel); HE = geometry->getSubdetectorGeometry(DetId::Hcal,HcalEndcap); HO = geometry->getSubdetectorGeometry(DetId::Hcal,HcalOuter); HF = geometry->getSubdetectorGeometry(DetId::Hcal,HcalForward); //hits iEvent.getByLabel( EcalRecHitsEB_input, EBRecHits ); iEvent.getByLabel( EcalRecHitsEE_input, EERecHits ); iEvent.getByLabel( HBHERecHits_input, HBHERecHits ); iEvent.getByLabel( HORecHits_input, HORecHits ); iEvent.getByLabel( HFRecHits_input, HFRecHits ); }
XYZVector TCTauAlgorithm::getCellMomentum | ( | const CaloCellGeometry * | cell, |
double & | energy | ||
) | [private] |
Definition at line 354 of file TCTauAlgorithm.cc.
References funct::cos(), CaloCellGeometry::getPosition(), PV3DBase< T, PVType, FrameType >::phi(), phi, funct::sin(), theta(), and PV3DBase< T, PVType, FrameType >::theta().
{ XYZVector momentum(0,0,0); if(cell){ GlobalPoint hitPosition = cell->getPosition(); double phi = hitPosition.phi(); double theta = hitPosition.theta(); if(theta > 3.14159) theta = 2*3.14159 - theta; double px = energy * sin(theta)*cos(phi); double py = energy * sin(theta)*sin(phi); double pz = energy * cos(theta); momentum = XYZVector(px,py,pz); } return momentum; }
std::pair< XYZVector, XYZVector > TCTauAlgorithm::getClusterEnergy | ( | const reco::CaloJet & | , |
math::XYZVector & | , | ||
double | |||
) | [private] |
Definition at line 254 of file TCTauAlgorithm.cc.
References DetId::det(), egHLT::errCodes::EBRecHits, DetId::Ecal, egHLT::errCodes::EERecHits, relval_parameters_module::energy, reco::CaloJet::getCaloConstituents(), egHLT::errCodes::HBHERecHits, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, egHLT::errCodes::HFRecHits, i, j, and DetId::subdetId().
{ XYZVector ecalCluster(0,0,0); XYZVector hcalCluster(0,0,0); std::vector<CaloTowerPtr> towers = caloJet.getCaloConstituents(); for(std::vector<CaloTowerPtr>::const_iterator iTower = towers.begin(); iTower!= towers.end(); ++iTower){ std::vector<XYZVector> ECALCells; std::vector<XYZVector> HCALCells; size_t numRecHits = (**iTower).constituentsSize(); // access CaloRecHits for(size_t j = 0; j < numRecHits; j++) { DetId recHitDetID = (**iTower).constituent(j); //DetId::Detector detNum=recHitDetID.det(); if( recHitDetID.det() == DetId::Ecal ){ if( recHitDetID.subdetId() == 1 ){ // Ecal Barrel EBDetId ecalID = recHitDetID; EBRecHitCollection::const_iterator theRecHit = EBRecHits->find(ecalID); if(theRecHit != EBRecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = EB->getGeometry(id); double energy = theRecHit->energy(); ECALCells.push_back(getCellMomentum(this_cell,energy)); } } if( recHitDetID.subdetId() == 2 ){ // Ecal Endcap EEDetId ecalID = recHitDetID; EERecHitCollection::const_iterator theRecHit = EERecHits->find(ecalID); if(theRecHit != EERecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = EE->getGeometry(id); double energy = theRecHit->energy(); ECALCells.push_back(getCellMomentum(this_cell,energy)); } } } if( recHitDetID.det() == DetId::Hcal ){ HcalDetId hcalID = recHitDetID; if( recHitDetID.subdetId() == HcalBarrel ){ //int depth = hcalID.depth(); //if (depth==1){ HBHERecHitCollection::const_iterator theRecHit=HBHERecHits->find(hcalID); if(theRecHit != HBHERecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = HB->getGeometry(id); double energy = theRecHit->energy(); HCALCells.push_back(getCellMomentum(this_cell,energy)); } //} } if( recHitDetID.subdetId() == HcalEndcap ){ //int depth = hcalID.depth(); //if (depth==1){ HBHERecHitCollection::const_iterator theRecHit=HBHERecHits->find(hcalID); if(theRecHit != HBHERecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = HE->getGeometry(id); double energy = theRecHit->energy(); HCALCells.push_back(getCellMomentum(this_cell,energy)); } //} } if( recHitDetID.subdetId() == HcalOuter ){ HORecHitCollection::const_iterator theRecHit=HORecHits->find(hcalID); if(theRecHit != HORecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = HO->getGeometry(id); double energy = theRecHit->energy(); HCALCells.push_back(getCellMomentum(this_cell,energy)); } } if( recHitDetID.subdetId() == HcalForward ){ HFRecHitCollection::const_iterator theRecHit=HFRecHits->find(hcalID); if(theRecHit != HFRecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = HF->getGeometry(id); double energy = theRecHit->energy(); HCALCells.push_back(getCellMomentum(this_cell,energy)); } } } } std::vector<XYZVector>::const_iterator i; for(i = ECALCells.begin(); i != ECALCells.end(); ++i) { double DR = ROOT::Math::VectorUtil::DeltaR(trackEcalHitPoint,*i); if( DR < cone ) ecalCluster += *i; } for(i = HCALCells.begin(); i != HCALCells.end(); ++i) { double DR = ROOT::Math::VectorUtil::DeltaR(trackEcalHitPoint,*i); if( DR < cone ) hcalCluster += *i; } } return std::pair<XYZVector,XYZVector> (ecalCluster,hcalCluster); }
void TCTauAlgorithm::init | ( | void | ) | [private] |
Definition at line 26 of file TCTauAlgorithm.cc.
References cond::ecalcond::all, and HcalObjRepresent::setup().
{ event = 0; setup = 0; trackAssociator = new TrackDetectorAssociator(); trackAssociator->useDefaultPropagator(); all = 0; passed = 0; prongs = -1; algoComponentUsed = 0; }
void TCTauAlgorithm::inputConfig | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 40 of file TCTauAlgorithm.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and MultipleCompare::pset.
Referenced by TCTauCorrector::inputConfig().
{ etCaloOverTrackMin = iConfig.getParameter<double>("EtCaloOverTrackMin"); etCaloOverTrackMax = iConfig.getParameter<double>("EtCaloOverTrackMax"); etHcalOverTrackMin = iConfig.getParameter<double>("EtHcalOverTrackMin"); etHcalOverTrackMax = iConfig.getParameter<double>("EtHcalOverTrackMax"); signalCone = iConfig.getParameter<double>("SignalConeSize"); ecalCone = iConfig.getParameter<double>("EcalConeSize"); EcalRecHitsEB_input= iConfig.getParameter<edm::InputTag>("EBRecHitCollection"); EcalRecHitsEE_input= iConfig.getParameter<edm::InputTag>("EERecHitCollection"); HBHERecHits_input = iConfig.getParameter<edm::InputTag>("HBHERecHitCollection"); HORecHits_input = iConfig.getParameter<edm::InputTag>("HORecHitCollection"); HFRecHits_input = iConfig.getParameter<edm::InputTag>("HFRecHitCollection"); edm::ParameterSet pset = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters"); trackAssociatorParameters.loadParameters( pset ); dropCaloJets = iConfig.getUntrackedParameter<bool>("DropCaloJets",false); dropRejected = iConfig.getUntrackedParameter<bool>("DropRejectedJets",true); }
math::XYZTLorentzVector TCTauAlgorithm::recalculateEnergy | ( | const reco::CaloJet & | caloJet, |
const reco::TrackRef & | leadTk, | ||
const reco::TrackRefVector & | associatedTracks | ||
) |
Definition at line 124 of file TCTauAlgorithm.cc.
References cond::ecalcond::all, edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), reco::LeafCandidate::energy(), edm::Ref< C, T, F >::isNull(), reco::LeafCandidate::p4(), p4, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().
{ all++; math::XYZTLorentzVector p4(0,0,0,0); algoComponentUsed = TCAlgoUndetermined; //if(!dropRejected) p4 = caloJet.p4(); if(leadTk.isNull()) return p4; XYZVector momentum(0,0,0); int prongCounter = 0; edm::RefVector<TrackCollection>::const_iterator iTrack; for(iTrack = associatedTracks.begin(); iTrack!= associatedTracks.end(); ++iTrack){ double DR = ROOT::Math::VectorUtil::DeltaR(leadTk->momentum(),(*iTrack)->momentum()); if(DR < signalCone) { momentum+=(*iTrack)->momentum(); prongCounter++; } } if(momentum.Rho() == 0) return p4; XYZVector ltrackEcalHitPoint = trackEcalHitPoint(*leadTk); if(! (ltrackEcalHitPoint.Rho() > 0 && ltrackEcalHitPoint.Rho() < 9999) ) return p4; std::pair<XYZVector,XYZVector> caloClusters = getClusterEnergy(caloJet,ltrackEcalHitPoint,signalCone); XYZVector EcalCluster = caloClusters.first; XYZVector HcalCluster = caloClusters.second; double eCaloOverTrack = (EcalCluster.R()+HcalCluster.R()-momentum.R())/momentum.R(); std::pair<XYZVector,XYZVector> caloClustersPhoton = getClusterEnergy(caloJet,ltrackEcalHitPoint,ecalCone); XYZVector EcalClusterPhoton = caloClustersPhoton.first; math::XYZTLorentzVector p4photons(0,0,0,EcalClusterPhoton.R() - EcalCluster.R()); if( eCaloOverTrack > etCaloOverTrackMin && eCaloOverTrack < etCaloOverTrackMax ) { double eHcalOverTrack = (HcalCluster.R()-momentum.R())/momentum.R(); if ( eHcalOverTrack > etHcalOverTrackMin && eHcalOverTrack < etHcalOverTrackMax ) { p4.SetXYZT(EcalCluster.X() + momentum.X(), EcalCluster.Y() + momentum.Y(), EcalCluster.Z() + momentum.Z(), EcalCluster.R() + momentum.R()); p4 += p4photons; algoComponentUsed = TCAlgoMomentumECAL; }else{ p4.SetXYZT(momentum.X(), momentum.Y(), momentum.Z(), momentum.R()); algoComponentUsed = TCAlgoMomentum; } } if( eCaloOverTrack > etCaloOverTrackMax ) { double eHcalOverTrack = (HcalCluster.R()-momentum.R())/momentum.R(); if ( eHcalOverTrack > etHcalOverTrackMin && eHcalOverTrack < etHcalOverTrackMax ) { p4.SetXYZT(EcalCluster.X() + momentum.X(), EcalCluster.Y() + momentum.Y(), EcalCluster.Z() + momentum.Z(), EcalCluster.R() + momentum.R()); p4 += p4photons; algoComponentUsed = TCAlgoMomentumECAL; } if ( eHcalOverTrack < etHcalOverTrackMin ) { if(!dropCaloJets) p4.SetXYZT(caloJet.px(),caloJet.py(),caloJet.pz(),caloJet.energy()); else p4.SetXYZT(0,0,0,0); algoComponentUsed = TCAlgoCaloJet; } if ( eHcalOverTrack > etHcalOverTrackMax ) { algoComponentUsed = TCAlgoHadronicJet; // reject if(!dropRejected) p4.SetXYZT(caloJet.px(),caloJet.py(),caloJet.pz(),caloJet.energy()); else p4.SetXYZT(0,0,0,0); } } if( eCaloOverTrack < etCaloOverTrackMin ) { algoComponentUsed = TCAlgoTrackProblem; // reject if(!dropRejected) p4.SetXYZT(caloJet.px(),caloJet.py(),caloJet.pz(),caloJet.energy()); } if(p4.Et() > 0) passed++; return p4; }
math::XYZTLorentzVector TCTauAlgorithm::recalculateEnergy | ( | const reco::CaloTau & | jet | ) |
Definition at line 111 of file TCTauAlgorithm.cc.
References reco::CaloTau::caloTauTagInfoRef(), edm::Ref< C, T, F >::get(), reco::BaseTau::leadTrack(), reco::LeafCandidate::p4(), and reco::LeafCandidate::setP4().
Referenced by TCTauCorrector::correctedP4(), and TCTauCorrector::correction().
{ const TrackRef& leadTk = jet.leadTrack(); const TrackRefVector associatedTracks = jet.caloTauTagInfoRef()->Tracks(); const CaloJet* cJet = jet.caloTauTagInfoRef()->calojetRef().get(); CaloJet caloJet = *cJet; caloJet.setP4(jet.p4()); return recalculateEnergy(caloJet,leadTk,associatedTracks); }
int TCTauAlgorithm::statistics | ( | ) |
Definition at line 68 of file TCTauAlgorithm.cc.
Referenced by TCTauCorrector::statistics().
{ return passed; }
XYZVector TCTauAlgorithm::trackEcalHitPoint | ( | const reco::Track & | track | ) | [private] |
Definition at line 244 of file TCTauAlgorithm.cc.
References event(), info, TrackDetMatchInfo::isGoodEcal, HcalObjRepresent::setup(), and TrackDetMatchInfo::trkGlobPosAtEcal.
{ const FreeTrajectoryState fts = trackAssociator->getFreeTrajectoryState(*setup,track); TrackDetMatchInfo info = trackAssociator->associate(*event, *setup, fts, trackAssociatorParameters); if( info.isGoodEcal != 0 ) { return XYZVector(info.trkGlobPosAtEcal.x(),info.trkGlobPosAtEcal.y(),info.trkGlobPosAtEcal.z()); } return XYZVector(0,0,0); }
XYZVector TCTauAlgorithm::trackEcalHitPoint | ( | const reco::TransientTrack & | transientTrack, |
const reco::CaloJet & | caloJet | ||
) | [private] |
Definition at line 215 of file TCTauAlgorithm.cc.
References reco::CaloJet::getCaloConstituents(), TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::stateOnSurface(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ GlobalPoint ecalHitPosition(0,0,0); double maxTowerEt = 0; std::vector<CaloTowerPtr> towers = caloJet.getCaloConstituents(); for(std::vector<CaloTowerPtr>::const_iterator iTower = towers.begin(); iTower!= towers.end(); ++iTower){ if((*iTower)->et() > maxTowerEt){ maxTowerEt = (*iTower)->et(); ecalHitPosition = (*iTower)->emPosition(); } } XYZVector ecalHitPoint(0,0,0); try{ GlobalPoint trackEcalHitPoint = transientTrack.stateOnSurface(ecalHitPosition).globalPosition(); ecalHitPoint.SetXYZ(trackEcalHitPoint.x(), trackEcalHitPoint.y(), trackEcalHitPoint.z()); }catch(...) {;} return ecalHitPoint; }
int TCTauAlgorithm::algoComponentUsed [private] |
Definition at line 89 of file TCTauAlgorithm.h.
int TCTauAlgorithm::all [private] |
Definition at line 86 of file TCTauAlgorithm.h.
bool TCTauAlgorithm::dropCaloJets [private] |
Definition at line 93 of file TCTauAlgorithm.h.
bool TCTauAlgorithm::dropRejected [private] |
Definition at line 94 of file TCTauAlgorithm.h.
const CaloSubdetectorGeometry* TCTauAlgorithm::EB [private] |
Definition at line 112 of file TCTauAlgorithm.h.
Definition at line 119 of file TCTauAlgorithm.h.
double TCTauAlgorithm::ecalCone [private] |
Definition at line 99 of file TCTauAlgorithm.h.
Definition at line 106 of file TCTauAlgorithm.h.
Definition at line 107 of file TCTauAlgorithm.h.
const CaloSubdetectorGeometry* TCTauAlgorithm::EE [private] |
Definition at line 113 of file TCTauAlgorithm.h.
Definition at line 120 of file TCTauAlgorithm.h.
double TCTauAlgorithm::etCaloOverTrackMax [private] |
Definition at line 101 of file TCTauAlgorithm.h.
double TCTauAlgorithm::etCaloOverTrackMin [private] |
Definition at line 101 of file TCTauAlgorithm.h.
double TCTauAlgorithm::etHcalOverTrackMax [private] |
Definition at line 101 of file TCTauAlgorithm.h.
double TCTauAlgorithm::etHcalOverTrackMin [private] |
Definition at line 101 of file TCTauAlgorithm.h.
const edm::Event* TCTauAlgorithm::event [private] |
Definition at line 72 of file TCTauAlgorithm.h.
const CaloSubdetectorGeometry* TCTauAlgorithm::HB [private] |
Definition at line 114 of file TCTauAlgorithm.h.
Definition at line 122 of file TCTauAlgorithm.h.
Definition at line 108 of file TCTauAlgorithm.h.
const CaloSubdetectorGeometry* TCTauAlgorithm::HE [private] |
Definition at line 115 of file TCTauAlgorithm.h.
const CaloSubdetectorGeometry* TCTauAlgorithm::HF [private] |
Definition at line 117 of file TCTauAlgorithm.h.
Definition at line 124 of file TCTauAlgorithm.h.
edm::InputTag TCTauAlgorithm::HFRecHits_input [private] |
Definition at line 110 of file TCTauAlgorithm.h.
const CaloSubdetectorGeometry* TCTauAlgorithm::HO [private] |
Definition at line 116 of file TCTauAlgorithm.h.
Definition at line 123 of file TCTauAlgorithm.h.
edm::InputTag TCTauAlgorithm::HORecHits_input [private] |
Definition at line 109 of file TCTauAlgorithm.h.
int TCTauAlgorithm::passed [private] |
Definition at line 86 of file TCTauAlgorithm.h.
int TCTauAlgorithm::prongs [private] |
Definition at line 91 of file TCTauAlgorithm.h.
const edm::EventSetup* TCTauAlgorithm::setup [private] |
Definition at line 73 of file TCTauAlgorithm.h.
double TCTauAlgorithm::signalCone [private] |
Definition at line 98 of file TCTauAlgorithm.h.
Definition at line 75 of file TCTauAlgorithm.h.
Definition at line 74 of file TCTauAlgorithm.h.
const TransientTrackBuilder* TCTauAlgorithm::transientTrackBuilder [private] |
Definition at line 96 of file TCTauAlgorithm.h.