![]() |
![]() |
#include <RecoTauTag/HLTProducers/interface/L2TauIsolationProducer.h>
Public Member Functions | |
L2TauIsolationProducer (const edm::ParameterSet &) | |
~L2TauIsolationProducer () | |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
math::PtEtaPhiELorentzVectorCollection | getECALHits (const CaloJet &, const edm::Event &, const edm::EventSetup &iSetup) |
math::PtEtaPhiELorentzVectorCollection | getHCALHits (const CaloJet &) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | crystalThreshold_ |
edm::InputTag | EBRecHits_ |
double | ECALClustering_clusterRadius_ |
bool | ECALClustering_run_ |
double | ECALIsolation_innerCone_ |
double | ECALIsolation_outerCone_ |
bool | ECALIsolation_run_ |
edm::InputTag | EERecHits_ |
edm::InputTag | l2CaloJets_ |
double | TowerIsolation_innerCone_ |
double | TowerIsolation_outerCone_ |
bool | TowerIsolation_run_ |
double | towerThreshold_ |
Definition at line 53 of file L2TauIsolationProducer.h.
L2TauIsolationProducer::L2TauIsolationProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 6 of file L2TauIsolationProducer.cc.
References ECALClustering_clusterRadius_, ECALClustering_run_, ECALIsolation_innerCone_, ECALIsolation_outerCone_, ECALIsolation_run_, edm::ParameterSet::getParameter(), TowerIsolation_innerCone_, TowerIsolation_outerCone_, and TowerIsolation_run_.
00006 : 00007 l2CaloJets_(iConfig.getParameter<edm::InputTag>("L2TauJetCollection")), 00008 EBRecHits_(iConfig.getParameter<edm::InputTag>("EBRecHits")), 00009 EERecHits_(iConfig.getParameter<edm::InputTag>("EERecHits")), 00010 crystalThreshold_(iConfig.getParameter<double>("crystalThreshold")), 00011 towerThreshold_(iConfig.getParameter<double>("towerThreshold")) 00012 { 00013 00014 //ECAL Isolation 00015 edm::ParameterSet ECALIsolParams = iConfig.getParameter<edm::ParameterSet>("ECALIsolation") ; 00016 00017 ECALIsolation_innerCone_ = ECALIsolParams.getParameter<double>( "innerCone" ); 00018 ECALIsolation_outerCone_ = ECALIsolParams.getParameter<double>( "outerCone" ); 00019 ECALIsolation_run_ = ECALIsolParams.getParameter<bool>( "runAlgorithm" ); 00020 00021 00022 //ECAL Clustering 00023 edm::ParameterSet ECALClusterParams = iConfig.getParameter<edm::ParameterSet>("ECALClustering") ; 00024 ECALClustering_run_ = ECALClusterParams.getParameter<bool>( "runAlgorithm" ); 00025 ECALClustering_clusterRadius_ = ECALClusterParams.getParameter<double>( "clusterRadius" ); 00026 00027 //Tower Isolation 00028 00029 edm::ParameterSet TowerIsolParams = iConfig.getParameter<edm::ParameterSet>("TowerIsolation") ; 00030 TowerIsolation_innerCone_ = TowerIsolParams.getParameter<double>( "innerCone" ); 00031 TowerIsolation_outerCone_ = TowerIsolParams.getParameter<double>( "outerCone" ); 00032 TowerIsolation_run_ = TowerIsolParams.getParameter<bool>( "runAlgorithm" ); 00033 00034 00035 //Add the products 00036 produces<L2TauInfoAssociation>(); 00037 00038 }
L2TauIsolationProducer::~L2TauIsolationProducer | ( | ) |
void L2TauIsolationProducer::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
math::PtEtaPhiELorentzVectorCollection L2TauIsolationProducer::getECALHits | ( | const CaloJet & | jet, | |
const edm::Event & | iEvent, | |||
const edm::EventSetup & | iSetup | |||
) | [private] |
Definition at line 136 of file L2TauIsolationProducer.cc.
References count, crystalThreshold_, DetId::det(), EBRecHits_, DetId::Ecal, EcalBarrel, EcalEndcap, EERecHits_, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), edm::Event::getByLabel(), reco::CaloJet::getCaloConstituents(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), j, p, PV3DBase< T, PVType, FrameType >::phi(), phi, funct::sin(), DetId::subdetId(), std::swap(), theta, and PV3DBase< T, PVType, FrameType >::theta().
Referenced by produce().
00137 { 00138 00139 //Init Geometry 00140 ESHandle<CaloGeometry> geometry; 00141 iSetup.get<CaloGeometryRecord>().get(geometry); 00142 00143 //Create ECAL Geometry 00144 const CaloSubdetectorGeometry* EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel); 00145 const CaloSubdetectorGeometry* EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap); 00146 00147 //Handle To the ECAL 00148 Handle<EBRecHitCollection> EBRecHits; 00149 Handle<EERecHitCollection> EERecHits; 00150 00151 //Read From File 00152 00153 iEvent.getByLabel( EBRecHits_, EBRecHits ); 00154 iEvent.getByLabel( EERecHits_, EERecHits ); 00155 00156 00157 00158 //Create a container for the hits 00159 math::PtEtaPhiELorentzVectorCollection jetRecHits; 00160 00161 00162 //Create the Machinery to put the highest et crystal at the begining 00163 double ref_pt = 0.;//max et 00164 int ref_id=0; //id of the max element 00165 int count=0; //counter 00166 00167 //Code Copied from JetCrystalsAssociator 00168 const std::vector<CaloTowerPtr> myTowers=jet.getCaloConstituents(); 00169 for (unsigned int iTower = 0; iTower < myTowers.size(); iTower++) 00170 { 00171 CaloTowerPtr theTower = myTowers[iTower]; 00172 size_t numRecHits = theTower->constituentsSize(); 00173 // access CaloRecHits 00174 for (size_t j = 0; j < numRecHits; j++) { 00175 DetId RecHitDetID=theTower->constituent(j); 00176 DetId::Detector DetNum=RecHitDetID.det(); 00177 if( DetNum == DetId::Ecal ){ 00178 int EcalNum = RecHitDetID.subdetId(); 00179 if( EcalNum == 1 ){ 00180 EBDetId EcalID = RecHitDetID; 00181 EBRecHitCollection::const_iterator theRecHit=EBRecHits->find(EcalID); 00182 if(theRecHit != EBRecHits->end()){ 00183 DetId id = theRecHit->detid(); 00184 const CaloCellGeometry* this_cell = EB->getGeometry(id); 00185 if (this_cell) { 00186 GlobalPoint posi = this_cell->getPosition(); 00187 double energy = theRecHit->energy(); 00188 double eta = posi.eta(); 00189 double phi = posi.phi(); 00190 double theta = posi.theta(); 00191 if(theta > M_PI) theta = 2 * M_PI- theta; 00192 double et = energy * sin(theta); 00193 //Apply Thresholds Here 00194 math::PtEtaPhiELorentzVector p(et, eta, phi, energy); 00195 if(p.pt()>crystalThreshold_) 00196 { 00197 if(p.pt()>ref_pt) 00198 { 00199 ref_id=count; 00200 ref_pt = p.pt(); 00201 } 00202 jetRecHits.push_back(p); 00203 count++; 00204 } 00205 00206 } 00207 } 00208 } else if ( EcalNum == 2 ) { 00209 EEDetId EcalID = RecHitDetID; 00210 EERecHitCollection::const_iterator theRecHit=EERecHits->find(EcalID); 00211 if(theRecHit != EBRecHits->end()){ 00212 DetId id = theRecHit->detid(); 00213 const CaloCellGeometry* this_cell = EE->getGeometry(id); 00214 if (this_cell) { 00215 GlobalPoint posi = this_cell->getPosition(); 00216 double energy = theRecHit->energy(); 00217 double eta = posi.eta(); 00218 double phi = posi.phi(); 00219 double theta = posi.theta(); 00220 if (theta > M_PI) theta = 2 * M_PI - theta; 00221 double et = energy * sin(theta); 00222 // cout <<"Et "<<et<<endl; 00223 math::PtEtaPhiELorentzVector p(et, eta, phi, energy); 00224 if(p.pt()>crystalThreshold_) 00225 { 00226 if(p.pt()>ref_pt) 00227 { 00228 ref_id=count; 00229 ref_pt = p.pt(); 00230 } 00231 jetRecHits.push_back(p); 00232 count++; 00233 } 00234 } 00235 } 00236 } 00237 } 00238 } 00239 } 00240 00241 //bring it to the front 00242 if(jetRecHits.size()>0) 00243 std::swap(jetRecHits[ref_id],jetRecHits[0]); 00244 00245 return jetRecHits; 00246 }
math::PtEtaPhiELorentzVectorCollection L2TauIsolationProducer::getHCALHits | ( | const CaloJet & | jet | ) | [private] |
Definition at line 116 of file L2TauIsolationProducer.cc.
References relval_parameters_module::energy, reco::CaloJet::getCaloConstituents(), i, and towerThreshold_.
Referenced by produce().
00117 { 00118 00119 00120 std::vector<CaloTowerPtr> towers = jet.getCaloConstituents(); 00121 00122 math::PtEtaPhiELorentzVectorCollection towers2; 00123 00124 for(size_t i=0;i<towers.size();++i) 00125 if(towers[i]->energy()>towerThreshold_) 00126 towers2.push_back(math::PtEtaPhiELorentzVector(towers[i]->et(),towers[i]->eta(),towers[i]->phi(),towers[i]->energy())); 00127 00128 return towers2; 00129 }
void L2TauIsolationProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 50 of file L2TauIsolationProducer.cc.
References ECALClustering_clusterRadius_, ECALClustering_run_, ECALIsolation_innerCone_, ECALIsolation_outerCone_, ECALIsolation_run_, edm::Event::getByLabel(), getECALHits(), getHCALHits(), l2CaloJets_, edm::Event::put(), L2TauECALClustering::run(), L2TauECALIsolation::run(), L2TauTowerIsolation::run(), TowerIsolation_innerCone_, TowerIsolation_outerCone_, and TowerIsolation_run_.
00051 { 00052 00053 00054 Handle<CaloJetCollection> l2CaloJets; //Handle to the input (L2TauCaloJets); 00055 iEvent.getByLabel(l2CaloJets_ ,l2CaloJets);//get the handle 00056 00057 //Create the Association 00058 std::auto_ptr<L2TauInfoAssociation> l2InfoAssoc( new L2TauInfoAssociation); 00059 00060 //If the JetCrystalsAssociation exists -> RUN The Producer 00061 if(l2CaloJets->size()>0) 00062 { 00063 CaloJetCollection::const_iterator jcStart = l2CaloJets->begin(); 00064 //Loop on Jets 00065 for(CaloJetCollection::const_iterator jc = jcStart ;jc!=l2CaloJets->end();++jc) 00066 { 00067 L2TauIsolationInfo l2info; //Create Info Object 00068 //Run ECALIsolation 00069 if(ECALIsolation_run_) 00070 { 00071 L2TauECALIsolation ecal_isolation(ECALIsolation_innerCone_,ECALIsolation_outerCone_); 00072 ecal_isolation.run(getECALHits(*jc,iEvent,iSetup),*jc,l2info); 00073 } 00074 00075 //Run ECALClustering 00076 if(ECALClustering_run_) 00077 { 00078 L2TauECALClustering ecal_clustering(ECALClustering_clusterRadius_); 00079 ecal_clustering.run(getECALHits(*jc,iEvent,iSetup),*jc,l2info); 00080 } 00081 00082 //Run CaloTower Isolation 00083 if(TowerIsolation_run_) 00084 { 00085 L2TauTowerIsolation tower_isolation(TowerIsolation_innerCone_,TowerIsolation_outerCone_); 00086 tower_isolation.run(*jc,getHCALHits(*jc),l2info); 00087 00088 } 00089 00090 //Store the info Class 00091 edm::Ref<CaloJetCollection> jcRef(l2CaloJets,jc-jcStart); 00092 l2InfoAssoc->insert(jcRef, l2info); 00093 } 00094 00095 00096 00097 } //end of if(*jetCrystalsObj) 00098 00099 iEvent.put(l2InfoAssoc); 00100 }
double L2TauIsolationProducer::crystalThreshold_ [private] |
double L2TauIsolationProducer::ECALClustering_clusterRadius_ [private] |
Definition at line 94 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
Definition at line 93 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::ECALIsolation_innerCone_ [private] |
Definition at line 83 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::ECALIsolation_outerCone_ [private] |
Definition at line 84 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
Definition at line 81 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::TowerIsolation_innerCone_ [private] |
Definition at line 89 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::TowerIsolation_outerCone_ [private] |
Definition at line 90 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
Definition at line 87 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::towerThreshold_ [private] |