CMS 3D CMS Logo

L2TauNarrowConeIsolationProducer Class Reference

#include <RecoTauTag/HLTProducers/interface/L2TauNarrowConeIsolationProducer.h>

Inheritance diagram for L2TauNarrowConeIsolationProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 L2TauNarrowConeIsolationProducer (const edm::ParameterSet &)
 ~L2TauNarrowConeIsolationProducer ()

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 &, const edm::Event &)
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

double associationRadius_
edm::InputTag CaloTowers_
CrystalPtComparator comparePt
double crystalThresholdB_
double crystalThresholdE_
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_

Classes

struct  CrystalPtComparator


Detailed Description

Definition at line 53 of file L2TauNarrowConeIsolationProducer.h.


Constructor & Destructor Documentation

L2TauNarrowConeIsolationProducer::L2TauNarrowConeIsolationProducer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 6 of file L2TauNarrowConeIsolationProducer.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   CaloTowers_(iConfig.getParameter<edm::InputTag>("CaloTowers")),
00011   associationRadius_(iConfig.getParameter<double>("associationRadius")),
00012   crystalThresholdE_(iConfig.getParameter<double>("crystalThresholdEE")),
00013   crystalThresholdB_(iConfig.getParameter<double>("crystalThresholdEB")),
00014   towerThreshold_(iConfig.getParameter<double>("towerThreshold"))
00015  {
00016         
00017   //ECAL Isolation
00018   edm::ParameterSet ECALIsolParams = iConfig.getParameter<edm::ParameterSet>("ECALIsolation") ;
00019   ECALIsolation_innerCone_ =  ECALIsolParams.getParameter<double>( "innerCone" );
00020   ECALIsolation_outerCone_ =  ECALIsolParams.getParameter<double>( "outerCone" );
00021   ECALIsolation_run_       =  ECALIsolParams.getParameter<bool>( "runAlgorithm" );
00022 
00023   //ECAL Clustering
00024   edm::ParameterSet ECALClusterParams = iConfig.getParameter<edm::ParameterSet>("ECALClustering") ;
00025   ECALClustering_run_                 =  ECALClusterParams.getParameter<bool>( "runAlgorithm" );
00026   ECALClustering_clusterRadius_       =  ECALClusterParams.getParameter<double>( "clusterRadius" );
00027     
00028   //Tower Isolation
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 }

L2TauNarrowConeIsolationProducer::~L2TauNarrowConeIsolationProducer (  ) 

Definition at line 41 of file L2TauNarrowConeIsolationProducer.cc.

00042 {
00043   //Destruction
00044 
00045 }


Member Function Documentation

void L2TauNarrowConeIsolationProducer::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 105 of file L2TauNarrowConeIsolationProducer.cc.

00106 {
00107 }

void L2TauNarrowConeIsolationProducer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 111 of file L2TauNarrowConeIsolationProducer.cc.

00111                                          {
00112 }

math::PtEtaPhiELorentzVectorCollection L2TauNarrowConeIsolationProducer::getECALHits ( const CaloJet jet,
const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private]

Definition at line 142 of file L2TauNarrowConeIsolationProducer.cc.

References associationRadius_, comparePt, crystalThresholdB_, crystalThresholdE_, EBRecHits_, DetId::Ecal, EcalBarrel, EcalEndcap, EERecHits_, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), edm::Event::getByLabel(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), p, reco::Particle::p4(), PV3DBase< T, PVType, FrameType >::phi(), phi, funct::sin(), python::multivaluedict::sort(), theta, and PV3DBase< T, PVType, FrameType >::theta().

Referenced by produce().

00143 {
00144   //Init Geometry
00145   ESHandle<CaloGeometry> geometry;
00146   iSetup.get<CaloGeometryRecord>().get(geometry);
00147 
00148   //Create ECAL Geometry
00149   const CaloSubdetectorGeometry* EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel);
00150   const CaloSubdetectorGeometry* EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap);
00151 
00152   //Handle To the ECAL
00153   Handle<EBRecHitCollection> EBRecHits;
00154   Handle<EERecHitCollection> EERecHits;
00155 
00156   //Create a container for the hits
00157   math::PtEtaPhiELorentzVectorCollection jetRecHits;
00158 
00159   //Loop on the barrel hits
00160   if(iEvent.getByLabel( EBRecHits_, EBRecHits))
00161      for(EBRecHitCollection::const_iterator hit = EBRecHits->begin();hit!=EBRecHits->end();++hit)
00162        {
00163          //get Detector Geometry
00164          const CaloCellGeometry* this_cell = EB->getGeometry(hit->detid());
00165          GlobalPoint posi = this_cell->getPosition();
00166          double energy = hit->energy();
00167          double eta = posi.eta();
00168          double phi = posi.phi();
00169          double theta = posi.theta();
00170          if(theta > M_PI) theta = 2 * M_PI- theta;
00171          double et = energy * sin(theta);
00172          math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
00173          if(ROOT::Math::VectorUtil::DeltaR(p,jet.p4()) <associationRadius_)
00174            if(p.energy()>crystalThresholdB_)
00175              jetRecHits.push_back(p);
00176        }
00177 
00178  if(iEvent.getByLabel( EERecHits_, EERecHits))
00179      for(EERecHitCollection::const_iterator hit = EERecHits->begin();hit!=EERecHits->end();++hit)
00180        {
00181          //get Detector Geometry
00182          const CaloCellGeometry* this_cell = EE->getGeometry(hit->detid());
00183          GlobalPoint posi = this_cell->getPosition();
00184          double energy = hit->energy();
00185          double eta = posi.eta();
00186          double phi = posi.phi();
00187          double theta = posi.theta();
00188          if(theta > M_PI) theta = 2 * M_PI- theta;
00189          double et = energy * sin(theta);
00190          math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
00191          if(ROOT::Math::VectorUtil::DeltaR(p,jet.p4()) < associationRadius_)
00192            if(p.energy()>crystalThresholdE_)
00193              jetRecHits.push_back(p);
00194        }
00195 
00196 
00197  std::sort(jetRecHits.begin(),jetRecHits.end(),comparePt);
00198 
00199  return jetRecHits;
00200 }

math::PtEtaPhiELorentzVectorCollection L2TauNarrowConeIsolationProducer::getHCALHits ( const CaloJet jet,
const edm::Event iEvent 
) [private]

Definition at line 117 of file L2TauNarrowConeIsolationProducer.cc.

References associationRadius_, CaloTowers_, comparePt, relval_parameters_module::energy, eta, edm::Event::getByLabel(), i, reco::Particle::p4(), phi, python::multivaluedict::sort(), and towerThreshold_.

Referenced by produce().

00118 {
00119   edm::Handle<CaloTowerCollection> towers;
00120   math::PtEtaPhiELorentzVectorCollection towers2;
00121 
00122   if(iEvent.getByLabel(CaloTowers_,towers))
00123     for(size_t i=0;i<towers->size();++i)
00124       {
00125         math::PtEtaPhiELorentzVector tower((*towers)[i].et(),(*towers)[i].eta(),(*towers)[i].phi(),(*towers)[i].energy());
00126         if(ROOT::Math::VectorUtil::DeltaR(tower,jet.p4()) <associationRadius_)
00127           {
00128             if(tower.energy()>towerThreshold_)
00129               towers2.push_back(tower);
00130 
00131           }       
00132 
00133       }
00134 
00135  std::sort(towers2.begin(),towers2.end(),comparePt);
00136 
00137   return towers2;
00138 }

void L2TauNarrowConeIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 50 of file L2TauNarrowConeIsolationProducer.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 
00069            //Run ECALIsolation 
00070            if(ECALIsolation_run_)
00071              {
00072                L2TauECALIsolation ecal_isolation(ECALIsolation_innerCone_,ECALIsolation_outerCone_);
00073                ecal_isolation.run(getECALHits(*jc,iEvent,iSetup),*jc,l2info);
00074              }
00075 
00076            //Run ECALClustering 
00077            if(ECALClustering_run_)
00078              {
00079                L2TauECALClustering ecal_clustering(ECALClustering_clusterRadius_);
00080                ecal_clustering.run(getECALHits(*jc,iEvent,iSetup),*jc,l2info);
00081              }
00082 
00083            //Run CaloTower Isolation
00084            if(TowerIsolation_run_)
00085              {
00086                L2TauTowerIsolation tower_isolation(TowerIsolation_innerCone_,TowerIsolation_outerCone_);
00087                tower_isolation.run(*jc,getHCALHits(*jc,iEvent),l2info);
00088 
00089              }
00090 
00091            //Store the info Class
00092            edm::Ref<CaloJetCollection> jcRef(l2CaloJets,jc-jcStart);
00093            l2InfoAssoc->insert(jcRef, l2info);
00094          }
00095 
00096 
00097      
00098      } //end of if(*jetCrystalsObj)
00099 
00100     iEvent.put(l2InfoAssoc);
00101 }


Member Data Documentation

double L2TauNarrowConeIsolationProducer::associationRadius_ [private]

Definition at line 73 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits(), and getHCALHits().

edm::InputTag L2TauNarrowConeIsolationProducer::CaloTowers_ [private]

Definition at line 71 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getHCALHits().

CrystalPtComparator L2TauNarrowConeIsolationProducer::comparePt [private]

Definition at line 106 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits(), and getHCALHits().

double L2TauNarrowConeIsolationProducer::crystalThresholdB_ [private]

Definition at line 77 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

double L2TauNarrowConeIsolationProducer::crystalThresholdE_ [private]

Definition at line 76 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

edm::InputTag L2TauNarrowConeIsolationProducer::EBRecHits_ [private]

Definition at line 69 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

double L2TauNarrowConeIsolationProducer::ECALClustering_clusterRadius_ [private]

Definition at line 96 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

bool L2TauNarrowConeIsolationProducer::ECALClustering_run_ [private]

Definition at line 95 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::ECALIsolation_innerCone_ [private]

Definition at line 85 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::ECALIsolation_outerCone_ [private]

Definition at line 86 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

bool L2TauNarrowConeIsolationProducer::ECALIsolation_run_ [private]

Definition at line 83 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

edm::InputTag L2TauNarrowConeIsolationProducer::EERecHits_ [private]

Definition at line 70 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

edm::InputTag L2TauNarrowConeIsolationProducer::l2CaloJets_ [private]

Definition at line 68 of file L2TauNarrowConeIsolationProducer.h.

Referenced by produce().

double L2TauNarrowConeIsolationProducer::TowerIsolation_innerCone_ [private]

Definition at line 91 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::TowerIsolation_outerCone_ [private]

Definition at line 92 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

bool L2TauNarrowConeIsolationProducer::TowerIsolation_run_ [private]

Definition at line 89 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::towerThreshold_ [private]

Definition at line 78 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getHCALHits().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:27:11 2009 for CMSSW by  doxygen 1.5.4