CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes

L2TauNarrowConeIsolationProducer Class Reference

#include <L2TauNarrowConeIsolationProducer.h>

Inheritance diagram for L2TauNarrowConeIsolationProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Classes

struct  CrystalPtComparator

Public Types

typedef reco::CaloJet CaloJet
typedef reco::CaloJetCollection CaloJetCollection

Public Member Functions

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

Private Member Functions

virtual void beginJob ()
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_

Detailed Description

Definition at line 52 of file L2TauNarrowConeIsolationProducer.h.


Member Typedef Documentation

Definition at line 54 of file L2TauNarrowConeIsolationProducer.h.

Definition at line 55 of file L2TauNarrowConeIsolationProducer.h.


Constructor & Destructor Documentation

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

Definition at line 8 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_.

                                                                                                :
  l2CaloJets_(iConfig.getParameter<edm::InputTag>("L2TauJetCollection")),
  EBRecHits_(iConfig.getParameter<edm::InputTag>("EBRecHits")),
  EERecHits_(iConfig.getParameter<edm::InputTag>("EERecHits")),
  CaloTowers_(iConfig.getParameter<edm::InputTag>("CaloTowers")),
  associationRadius_(iConfig.getParameter<double>("associationRadius")),
  crystalThresholdE_(iConfig.getParameter<double>("crystalThresholdEE")),
  crystalThresholdB_(iConfig.getParameter<double>("crystalThresholdEB")),
  towerThreshold_(iConfig.getParameter<double>("towerThreshold"))
 {
        
  //ECAL Isolation
  edm::ParameterSet ECALIsolParams = iConfig.getParameter<edm::ParameterSet>("ECALIsolation") ;
  ECALIsolation_innerCone_ =  ECALIsolParams.getParameter<double>( "innerCone" );
  ECALIsolation_outerCone_ =  ECALIsolParams.getParameter<double>( "outerCone" );
  ECALIsolation_run_       =  ECALIsolParams.getParameter<bool>( "runAlgorithm" );

  //ECAL Clustering
  edm::ParameterSet ECALClusterParams = iConfig.getParameter<edm::ParameterSet>("ECALClustering") ;
  ECALClustering_run_                 =  ECALClusterParams.getParameter<bool>( "runAlgorithm" );
  ECALClustering_clusterRadius_       =  ECALClusterParams.getParameter<double>( "clusterRadius" );
    
  //Tower Isolation
  edm::ParameterSet TowerIsolParams = iConfig.getParameter<edm::ParameterSet>("TowerIsolation") ;
  TowerIsolation_innerCone_         =  TowerIsolParams.getParameter<double>( "innerCone" );
  TowerIsolation_outerCone_         =  TowerIsolParams.getParameter<double>( "outerCone" );
  TowerIsolation_run_               =  TowerIsolParams.getParameter<bool>( "runAlgorithm" );
 

  //Add the products
  produces<L2TauInfoAssociation>();

}
L2TauNarrowConeIsolationProducer::~L2TauNarrowConeIsolationProducer ( )

Definition at line 43 of file L2TauNarrowConeIsolationProducer.cc.

{
  //Destruction

}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 119 of file L2TauNarrowConeIsolationProducer.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 125 of file L2TauNarrowConeIsolationProducer.cc.

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

Definition at line 156 of file L2TauNarrowConeIsolationProducer.cc.

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

Referenced by produce().

{
  //Init Geometry
  edm::ESHandle<CaloGeometry> geometry;
  iSetup.get<CaloGeometryRecord>().get(geometry);

  //Create ECAL Geometry
  const CaloSubdetectorGeometry* EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel);
  const CaloSubdetectorGeometry* EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap);

  //Handle To the ECAL
  edm::Handle<EBRecHitCollection> EBRecHits;
  edm::Handle<EERecHitCollection> EERecHits;

  //Create a container for the hits
  math::PtEtaPhiELorentzVectorCollection jetRecHits;

  //Loop on the barrel hits
  if(iEvent.getByLabel( EBRecHits_, EBRecHits))
     for(EBRecHitCollection::const_iterator hit = EBRecHits->begin();hit!=EBRecHits->end();++hit)
       {
         //get Detector Geometry
         const CaloCellGeometry* this_cell = EB->getGeometry(hit->detid());
         GlobalPoint posi = this_cell->getPosition();
         double energy = hit->energy();
         double eta = posi.eta();
         double phi = posi.phi();
         double theta = posi.theta();
         if(theta > M_PI) theta = 2 * M_PI- theta;
         double et = energy * sin(theta);
         math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
         if(ROOT::Math::VectorUtil::DeltaR(p,jet.p4()) <associationRadius_)
           if(p.energy()>crystalThresholdB_)
             jetRecHits.push_back(p);
       }

 if(iEvent.getByLabel( EERecHits_, EERecHits))
     for(EERecHitCollection::const_iterator hit = EERecHits->begin();hit!=EERecHits->end();++hit)
       {
         //get Detector Geometry
         const CaloCellGeometry* this_cell = EE->getGeometry(hit->detid());
         GlobalPoint posi = this_cell->getPosition();
         double energy = hit->energy();
         double eta = posi.eta();
         double phi = posi.phi();
         double theta = posi.theta();
         if(theta > M_PI) theta = 2 * M_PI- theta;
         double et = energy * sin(theta);
         math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
         if(ROOT::Math::VectorUtil::DeltaR(p,jet.p4()) < associationRadius_)
           if(p.energy()>crystalThresholdE_)
             jetRecHits.push_back(p);
       }


 std::sort(jetRecHits.begin(),jetRecHits.end(),comparePt);

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

Definition at line 131 of file L2TauNarrowConeIsolationProducer.cc.

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

Referenced by produce().

{
  edm::Handle<CaloTowerCollection> towers;
  math::PtEtaPhiELorentzVectorCollection towers2;

  if(iEvent.getByLabel(CaloTowers_,towers))
    for(size_t i=0;i<towers->size();++i)
      {
        math::PtEtaPhiELorentzVector tower((*towers)[i].et(),(*towers)[i].eta(),(*towers)[i].phi(),(*towers)[i].energy());
        if(ROOT::Math::VectorUtil::DeltaR(tower,jet.p4()) <associationRadius_)
          {
            if(tower.energy()>towerThreshold_)
              towers2.push_back(tower);

          }       

      }

 std::sort(towers2.begin(),towers2.end(),comparePt);

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

Implements edm::EDProducer.

Definition at line 52 of file L2TauNarrowConeIsolationProducer.cc.

References L2TauSimpleClustering::clusterize(), L2TauIsolationAlgs::clusterShape(), ECALClustering_clusterRadius_, ECALClustering_run_, ECALIsolation_innerCone_, ECALIsolation_outerCone_, ECALIsolation_run_, edm::Event::getByLabel(), getECALHits(), getHCALHits(), spr::hitsHCAL(), info, L2TauIsolationAlgs::isolatedEt(), l2CaloJets_, edm::Event::put(), reco::L2TauIsolationInfo::setEcalClusterShape(), reco::L2TauIsolationInfo::setEcalIsolEt(), reco::L2TauIsolationInfo::setHcalIsolEt(), reco::L2TauIsolationInfo::setNEcalHits(), reco::L2TauIsolationInfo::setSeedEcalHitEt(), reco::L2TauIsolationInfo::setSeedHcalHitEt(), TowerIsolation_innerCone_, TowerIsolation_outerCone_, and TowerIsolation_run_.

{


   edm::Handle<CaloJetCollection> l2CaloJets; //Handle to the input (L2TauCaloJets);
   iEvent.getByLabel(l2CaloJets_ ,l2CaloJets);//get the handle

   //Create the Association
   std::auto_ptr<L2TauInfoAssociation> l2InfoAssoc( new L2TauInfoAssociation);

   //If the JetCrystalsAssociation exists -> RUN The Producer
   if(l2CaloJets->size()>0)
     {
      CaloJetCollection::const_iterator jcStart = l2CaloJets->begin();
       //Loop on Jets
       for(CaloJetCollection::const_iterator jc = jcStart ;jc!=l2CaloJets->end();++jc)
         {
           //Create Algorithm Object
           L2TauIsolationAlgs alg;
           
           //Create Info Object
           L2TauIsolationInfo info; 

           //get Hits
           math::PtEtaPhiELorentzVectorCollection hitsECAL = getECALHits(*jc,iEvent,iSetup);
           math::PtEtaPhiELorentzVectorCollection hitsHCAL = getHCALHits(*jc,iEvent);



           //Run ECALIsolation 
           if(ECALIsolation_run_)
             {
               info.setEcalIsolEt( alg.isolatedEt(hitsECAL , jc->p4().Vect(), ECALIsolation_innerCone_,ECALIsolation_outerCone_) );
               if(hitsECAL.size()>0)
                 info.setSeedEcalHitEt(hitsECAL[0].pt());
             }

           //Run ECALClustering 
           if(ECALClustering_run_)
             {
               //load simple clustering algorithm
               L2TauSimpleClustering clustering(ECALClustering_clusterRadius_);
               math::PtEtaPhiELorentzVectorCollection clusters = clustering.clusterize(hitsECAL);
               info.setEcalClusterShape(alg.clusterShape(clusters,jc->p4().Vect(),0,0.5) );
               info.setNEcalHits(clusters.size());
             }

           //Run CaloTower Isolation
           if(TowerIsolation_run_)
             {
               info.setHcalIsolEt( alg.isolatedEt(hitsHCAL , jc->p4().Vect(), TowerIsolation_innerCone_,TowerIsolation_outerCone_) );
               if(hitsHCAL.size()>0)
                 info.setSeedHcalHitEt(hitsHCAL[0].pt());
             }

           //Store the info Class
           edm::Ref<CaloJetCollection> jcRef(l2CaloJets,jc-jcStart);
           l2InfoAssoc->insert(jcRef, info);
         }

     } //end of if(*jetCrystalsObj)

    iEvent.put(l2InfoAssoc);
}

Member Data Documentation

Definition at line 74 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits(), and getHCALHits().

Definition at line 72 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getHCALHits().

Definition at line 107 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits(), and getHCALHits().

Definition at line 78 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

Definition at line 77 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

Definition at line 70 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

Definition at line 97 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 96 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 86 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 87 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 84 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 71 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

Definition at line 69 of file L2TauNarrowConeIsolationProducer.h.

Referenced by produce().

Definition at line 92 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 93 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 90 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

Definition at line 79 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getHCALHits().