CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  CrystalPtComparator
 

Public Types

typedef reco::CaloJet CaloJet
 
typedef reco::CaloJetCollection CaloJetCollection
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 L2TauNarrowConeIsolationProducer (const edm::ParameterSet &)
 
 ~L2TauNarrowConeIsolationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 &) override
 

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_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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_.

8  :
9  l2CaloJets_(iConfig.getParameter<edm::InputTag>("L2TauJetCollection")),
10  EBRecHits_(iConfig.getParameter<edm::InputTag>("EBRecHits")),
11  EERecHits_(iConfig.getParameter<edm::InputTag>("EERecHits")),
12  CaloTowers_(iConfig.getParameter<edm::InputTag>("CaloTowers")),
13  associationRadius_(iConfig.getParameter<double>("associationRadius")),
14  crystalThresholdE_(iConfig.getParameter<double>("crystalThresholdEE")),
15  crystalThresholdB_(iConfig.getParameter<double>("crystalThresholdEB")),
16  towerThreshold_(iConfig.getParameter<double>("towerThreshold"))
17  {
18 
19  //ECAL Isolation
20  edm::ParameterSet ECALIsolParams = iConfig.getParameter<edm::ParameterSet>("ECALIsolation") ;
21  ECALIsolation_innerCone_ = ECALIsolParams.getParameter<double>( "innerCone" );
22  ECALIsolation_outerCone_ = ECALIsolParams.getParameter<double>( "outerCone" );
23  ECALIsolation_run_ = ECALIsolParams.getParameter<bool>( "runAlgorithm" );
24 
25  //ECAL Clustering
26  edm::ParameterSet ECALClusterParams = iConfig.getParameter<edm::ParameterSet>("ECALClustering") ;
27  ECALClustering_run_ = ECALClusterParams.getParameter<bool>( "runAlgorithm" );
28  ECALClustering_clusterRadius_ = ECALClusterParams.getParameter<double>( "clusterRadius" );
29 
30  //Tower Isolation
31  edm::ParameterSet TowerIsolParams = iConfig.getParameter<edm::ParameterSet>("TowerIsolation") ;
32  TowerIsolation_innerCone_ = TowerIsolParams.getParameter<double>( "innerCone" );
33  TowerIsolation_outerCone_ = TowerIsolParams.getParameter<double>( "outerCone" );
34  TowerIsolation_run_ = TowerIsolParams.getParameter<bool>( "runAlgorithm" );
35 
36 
37  //Add the products
38  produces<L2TauInfoAssociation>();
39 
40 }
T getParameter(std::string const &) const
L2TauNarrowConeIsolationProducer::~L2TauNarrowConeIsolationProducer ( )

Definition at line 43 of file L2TauNarrowConeIsolationProducer.cc.

44 {
45  //Destruction
46 
47 }

Member Function Documentation

void L2TauNarrowConeIsolationProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 119 of file L2TauNarrowConeIsolationProducer.cc.

120 {
121 }
void L2TauNarrowConeIsolationProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 125 of file L2TauNarrowConeIsolationProducer.cc.

125  {
126 }
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, PV3DBase< T, PVType, FrameType >::eta(), eta(), geometry, edm::EventSetup::get(), edm::Event::getByLabel(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), M_PI, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::p4(), phi, PV3DBase< T, PVType, FrameType >::phi(), funct::sin(), python.multivaluedict::sort(), PV3DBase< T, PVType, FrameType >::theta(), and theta().

Referenced by produce().

157 {
158  //Init Geometry
160  iSetup.get<CaloGeometryRecord>().get(geometry);
161 
162  //Create ECAL Geometry
163  const CaloSubdetectorGeometry* EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel);
164  const CaloSubdetectorGeometry* EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap);
165 
166  //Handle To the ECAL
169 
170  //Create a container for the hits
172 
173  //Loop on the barrel hits
174  if(iEvent.getByLabel( EBRecHits_, EBRecHits))
175  for(EBRecHitCollection::const_iterator hit = EBRecHits->begin();hit!=EBRecHits->end();++hit)
176  {
177  //get Detector Geometry
178  const CaloCellGeometry* this_cell = EB->getGeometry(hit->detid());
179  GlobalPoint posi = this_cell->getPosition();
180  double energy = hit->energy();
181  double eta = posi.eta();
182  double phi = posi.phi();
183  double theta = posi.theta();
184  if(theta > M_PI) theta = 2 * M_PI- theta;
185  double et = energy * sin(theta);
186  math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
187  if(ROOT::Math::VectorUtil::DeltaR(p,jet.p4()) <associationRadius_)
188  if(p.energy()>crystalThresholdB_)
189  jetRecHits.push_back(p);
190  }
191 
192  if(iEvent.getByLabel( EERecHits_, EERecHits))
193  for(EERecHitCollection::const_iterator hit = EERecHits->begin();hit!=EERecHits->end();++hit)
194  {
195  //get Detector Geometry
196  const CaloCellGeometry* this_cell = EE->getGeometry(hit->detid());
197  GlobalPoint posi = this_cell->getPosition();
198  double energy = hit->energy();
199  double eta = posi.eta();
200  double phi = posi.phi();
201  double theta = posi.theta();
202  if(theta > M_PI) theta = 2 * M_PI- theta;
203  double et = energy * sin(theta);
204  math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
205  if(ROOT::Math::VectorUtil::DeltaR(p,jet.p4()) < associationRadius_)
206  if(p.energy()>crystalThresholdE_)
207  jetRecHits.push_back(p);
208  }
209 
210 
211  std::sort(jetRecHits.begin(),jetRecHits.end(),comparePt);
212 
213  return jetRecHits;
214 }
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalRecHit >::const_iterator const_iterator
Geom::Theta< T > theta() const
T eta() const
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
std::vector< PtEtaPhiELorentzVector > PtEtaPhiELorentzVectorCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
#define M_PI
Definition: BFit3D.cc:3
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
const T & get() const
Definition: EventSetup.h:55
T eta() const
Definition: PV3DBase.h:76
ESHandle< TrackerGeometry > geometry
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Definition: DDAxes.h:10
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().

132 {
135 
136  if(iEvent.getByLabel(CaloTowers_,towers))
137  for(size_t i=0;i<towers->size();++i)
138  {
139  math::PtEtaPhiELorentzVector tower((*towers)[i].et(),(*towers)[i].eta(),(*towers)[i].phi(),(*towers)[i].energy());
140  if(ROOT::Math::VectorUtil::DeltaR(tower,jet.p4()) <associationRadius_)
141  {
142  if(tower.energy()>towerThreshold_)
143  towers2.push_back(tower);
144 
145  }
146 
147  }
148 
149  std::sort(towers2.begin(),towers2.end(),comparePt);
150 
151  return towers2;
152 }
int i
Definition: DBlmapReader.cc:9
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
T eta() const
std::vector< PtEtaPhiELorentzVector > PtEtaPhiELorentzVectorCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
Definition: DDAxes.h:10
void L2TauNarrowConeIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

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_.

53 {
54 
55 
56  edm::Handle<CaloJetCollection> l2CaloJets; //Handle to the input (L2TauCaloJets);
57  iEvent.getByLabel(l2CaloJets_ ,l2CaloJets);//get the handle
58 
59  //Create the Association
60  std::auto_ptr<L2TauInfoAssociation> l2InfoAssoc( new L2TauInfoAssociation);
61 
62  //If the JetCrystalsAssociation exists -> RUN The Producer
63  if(l2CaloJets->size()>0)
64  {
65  CaloJetCollection::const_iterator jcStart = l2CaloJets->begin();
66  //Loop on Jets
67  for(CaloJetCollection::const_iterator jc = jcStart ;jc!=l2CaloJets->end();++jc)
68  {
69  //Create Algorithm Object
71 
72  //Create Info Object
74 
75  //get Hits
76  math::PtEtaPhiELorentzVectorCollection hitsECAL = getECALHits(*jc,iEvent,iSetup);
78 
79 
80 
81  //Run ECALIsolation
83  {
84  info.setEcalIsolEt( alg.isolatedEt(hitsECAL , jc->p4().Vect(), ECALIsolation_innerCone_,ECALIsolation_outerCone_) );
85  if(hitsECAL.size()>0)
86  info.setSeedEcalHitEt(hitsECAL[0].pt());
87  }
88 
89  //Run ECALClustering
91  {
92  //load simple clustering algorithm
94  math::PtEtaPhiELorentzVectorCollection clusters = clustering.clusterize(hitsECAL);
95  info.setEcalClusterShape(alg.clusterShape(clusters,jc->p4().Vect(),0,0.5) );
96  info.setNEcalHits(clusters.size());
97  }
98 
99  //Run CaloTower Isolation
101  {
102  info.setHcalIsolEt( alg.isolatedEt(hitsHCAL , jc->p4().Vect(), TowerIsolation_innerCone_,TowerIsolation_outerCone_) );
103  if(hitsHCAL.size()>0)
104  info.setSeedHcalHitEt(hitsHCAL[0].pt());
105  }
106 
107  //Store the info Class
108  edm::Ref<CaloJetCollection> jcRef(l2CaloJets,jc-jcStart);
109  l2InfoAssoc->insert(jcRef, info);
110  }
111 
112  } //end of if(*jetCrystalsObj)
113 
114  iEvent.put(l2InfoAssoc);
115 }
void setSeedHcalHitEt(double et)
static const TGPicture * info(bool iBackgroundIsBlack)
void setEcalClusterShape(const std::vector< double > &shape)
math::PtEtaPhiELorentzVectorCollection getHCALHits(const CaloJet &, const edm::Event &)
void setSeedEcalHitEt(double et)
double isolatedEt(const math::PtEtaPhiELorentzVectorCollection &, const math::XYZVector &, double innerCone, double outerCone) const
std::vector< PtEtaPhiELorentzVector > PtEtaPhiELorentzVectorCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void hitsHCAL(std::vector< DetId > &vdets, edm::Handle< T > &hits, std::vector< typename T::const_iterator > &hitlist, bool debug=false)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
math::PtEtaPhiELorentzVectorCollection getECALHits(const CaloJet &, const edm::Event &, const edm::EventSetup &iSetup)
std::vector< double > clusterShape(const math::PtEtaPhiELorentzVectorCollection &, const math::XYZVector &, double innerCone, double outerCone) const

Member Data Documentation

double L2TauNarrowConeIsolationProducer::associationRadius_
private

Definition at line 74 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits(), and getHCALHits().

edm::InputTag L2TauNarrowConeIsolationProducer::CaloTowers_
private

Definition at line 72 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getHCALHits().

CrystalPtComparator L2TauNarrowConeIsolationProducer::comparePt
private

Definition at line 107 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits(), and getHCALHits().

double L2TauNarrowConeIsolationProducer::crystalThresholdB_
private

Definition at line 78 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

double L2TauNarrowConeIsolationProducer::crystalThresholdE_
private

Definition at line 77 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

edm::InputTag L2TauNarrowConeIsolationProducer::EBRecHits_
private

Definition at line 70 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

double L2TauNarrowConeIsolationProducer::ECALClustering_clusterRadius_
private

Definition at line 97 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

bool L2TauNarrowConeIsolationProducer::ECALClustering_run_
private

Definition at line 96 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::ECALIsolation_innerCone_
private

Definition at line 86 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::ECALIsolation_outerCone_
private

Definition at line 87 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

bool L2TauNarrowConeIsolationProducer::ECALIsolation_run_
private

Definition at line 84 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

edm::InputTag L2TauNarrowConeIsolationProducer::EERecHits_
private

Definition at line 71 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getECALHits().

edm::InputTag L2TauNarrowConeIsolationProducer::l2CaloJets_
private

Definition at line 69 of file L2TauNarrowConeIsolationProducer.h.

Referenced by produce().

double L2TauNarrowConeIsolationProducer::TowerIsolation_innerCone_
private

Definition at line 92 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::TowerIsolation_outerCone_
private

Definition at line 93 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

bool L2TauNarrowConeIsolationProducer::TowerIsolation_run_
private

Definition at line 90 of file L2TauNarrowConeIsolationProducer.h.

Referenced by L2TauNarrowConeIsolationProducer(), and produce().

double L2TauNarrowConeIsolationProducer::towerThreshold_
private

Definition at line 79 of file L2TauNarrowConeIsolationProducer.h.

Referenced by getHCALHits().