CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
L2TauIsolationProducer Class Reference

#include <L2TauIsolationProducer.h>

Inheritance diagram for L2TauIsolationProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L2TauIsolationProducer (const edm::ParameterSet &)
 
 ~L2TauIsolationProducer ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 reco::CaloJet &, const edm::Event &, const edm::EventSetup &iSetup)
 
math::PtEtaPhiELorentzVectorCollection getHCALHits (const reco::CaloJet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double crystalThreshold_
 
edm::EDGetTokenT
< EBRecHitCollection
EBRecHits_
 
double ECALClustering_clusterRadius_
 
bool ECALClustering_run_
 
double ECALIsolation_innerCone_
 
double ECALIsolation_outerCone_
 
bool ECALIsolation_run_
 
edm::EDGetTokenT
< EERecHitCollection
EERecHits_
 
edm::EDGetTokenT
< reco::CaloJetCollection
l2CaloJets_
 
double TowerIsolation_innerCone_
 
double TowerIsolation_outerCone_
 
bool TowerIsolation_run_
 
double towerThreshold_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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 53 of file L2TauIsolationProducer.h.

Constructor & Destructor Documentation

L2TauIsolationProducer::L2TauIsolationProducer ( const edm::ParameterSet iConfig)
explicit

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

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

Definition at line 44 of file L2TauIsolationProducer.cc.

45 {
46  //Destruction
47 
48 }

Member Function Documentation

void L2TauIsolationProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 122 of file L2TauIsolationProducer.cc.

123 {
124 }
void L2TauIsolationProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 128 of file L2TauIsolationProducer.cc.

128  {
129 }
math::PtEtaPhiELorentzVectorCollection L2TauIsolationProducer::getECALHits ( const reco::CaloJet jet,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 154 of file L2TauIsolationProducer.cc.

References prof2calltree::count, crystalThreshold_, DetId::det(), egHLT::errCodes::EBRecHits, EBRecHits_, DetId::Ecal, EcalBarrel, EcalEndcap, HWWFunctions::EE, egHLT::errCodes::EERecHits, EERecHits_, relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), eta(), geometry, edm::EventSetup::get(), edm::Event::getByToken(), reco::CaloJet::getCaloConstituents(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), j, M_PI, AlCaHLTBitMon_ParallelJobs::p, phi, PV3DBase< T, PVType, FrameType >::phi(), funct::sin(), DetId::subdetId(), std::swap(), PV3DBase< T, PVType, FrameType >::theta(), and theta().

Referenced by produce().

155 {
156 
157  //Init Geometry
159  iSetup.get<CaloGeometryRecord>().get(geometry);
160 
161  //Create ECAL Geometry
162  const CaloSubdetectorGeometry* EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel);
163  const CaloSubdetectorGeometry* EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap);
164 
165  //Handle To the ECAL
168 
169  //Read From File
170 
171  iEvent.getByToken( EBRecHits_, EBRecHits );
172  iEvent.getByToken( EERecHits_, EERecHits );
173 
174 
175 
176  //Create a container for the hits
178 
179 
180  //Create the Machinery to put the highest et crystal at the begining
181  double ref_pt = 0.;//max et
182  int ref_id=0; //id of the max element
183  int count=0; //counter
184 
185  //Code Copied from JetCrystalsAssociator
186  const std::vector<CaloTowerPtr> myTowers=jet.getCaloConstituents();
187  for (unsigned int iTower = 0; iTower < myTowers.size(); iTower++)
188  {
189  CaloTowerPtr theTower = myTowers[iTower];
190  size_t numRecHits = theTower->constituentsSize();
191  // access CaloRecHits
192  for (size_t j = 0; j < numRecHits; j++) {
193  DetId RecHitDetID=theTower->constituent(j);
194  DetId::Detector DetNum=RecHitDetID.det();
195  if( DetNum == DetId::Ecal ){
196  int EcalNum = RecHitDetID.subdetId();
197  if( EcalNum == 1 ){
198  EBDetId EcalID = RecHitDetID;
199  EBRecHitCollection::const_iterator theRecHit=EBRecHits->find(EcalID);
200  if(theRecHit != EBRecHits->end()){
201  DetId id = theRecHit->detid();
202  const CaloCellGeometry* this_cell = EB->getGeometry(id);
203  if (this_cell) {
204  GlobalPoint posi = this_cell->getPosition();
205  double energy = theRecHit->energy();
206  double eta = posi.eta();
207  double phi = posi.phi();
208  double theta = posi.theta();
209  if(theta > M_PI) theta = 2 * M_PI- theta;
210  double et = energy * sin(theta);
211  //Apply Thresholds Here
212  math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
213  if(p.pt()>crystalThreshold_)
214  {
215  if(p.pt()>ref_pt)
216  {
217  ref_id=count;
218  ref_pt = p.pt();
219  }
220  jetRecHits.push_back(p);
221  count++;
222  }
223 
224  }
225  }
226  } else if ( EcalNum == 2 ) {
227  EEDetId EcalID = RecHitDetID;
228  EERecHitCollection::const_iterator theRecHit=EERecHits->find(EcalID);
229  if(theRecHit != EBRecHits->end()){
230  DetId id = theRecHit->detid();
231  const CaloCellGeometry* this_cell = EE->getGeometry(id);
232  if (this_cell) {
233  GlobalPoint posi = this_cell->getPosition();
234  double energy = theRecHit->energy();
235  double eta = posi.eta();
236  double phi = posi.phi();
237  double theta = posi.theta();
238  if (theta > M_PI) theta = 2 * M_PI - theta;
239  double et = energy * sin(theta);
240  // std::cout <<"Et "<<et<<std::endl;
241  math::PtEtaPhiELorentzVector p(et, eta, phi, energy);
242  if(p.pt()>crystalThreshold_)
243  {
244  if(p.pt()>ref_pt)
245  {
246  ref_id=count;
247  ref_pt = p.pt();
248  }
249  jetRecHits.push_back(p);
250  count++;
251  }
252  }
253  }
254  }
255  }
256  }
257  }
258 
259  //bring it to the front
260  if(jetRecHits.size()>0)
261  std::swap(jetRecHits[ref_id],jetRecHits[0]);
262 
263  return jetRecHits;
264 }
edm::EDGetTokenT< EBRecHitCollection > EBRecHits_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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 std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:93
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
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
int j
Definition: DBlmapReader.cc:9
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
#define M_PI
Definition: DetId.h:18
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
Detector
Definition: DetId.h:24
const T & get() const
Definition: EventSetup.h:55
T eta() const
Definition: PV3DBase.h:76
ESHandle< TrackerGeometry > geometry
edm::EDGetTokenT< EERecHitCollection > EERecHits_
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Definition: DDAxes.h:10
math::PtEtaPhiELorentzVectorCollection L2TauIsolationProducer::getHCALHits ( const reco::CaloJet jet)
private

Definition at line 134 of file L2TauIsolationProducer.cc.

References relval_parameters_module::energy, reco::CaloJet::getCaloConstituents(), i, HLT_25ns14e33_v1_cff::towers, and towerThreshold_.

Referenced by produce().

135 {
136 
137 
138  std::vector<CaloTowerPtr> towers = jet.getCaloConstituents();
139 
141 
142  for(size_t i=0;i<towers.size();++i)
143  if(towers[i]->energy()>towerThreshold_)
144  towers2.push_back(math::PtEtaPhiELorentzVector(towers[i]->et(),towers[i]->eta(),towers[i]->phi(),towers[i]->energy()));
145 
146  return towers2;
147 }
int i
Definition: DBlmapReader.cc:9
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:93
std::vector< PtEtaPhiELorentzVector > PtEtaPhiELorentzVectorCollection
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
void L2TauIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 53 of file L2TauIsolationProducer.cc.

References L2TauSimpleClustering::clusterize(), HLT_25ns14e33_v1_cff::clusters, L2TauIsolationAlgs::clusterShape(), ECALClustering_clusterRadius_, ECALClustering_run_, ECALIsolation_innerCone_, ECALIsolation_outerCone_, ECALIsolation_run_, edm::Event::getByToken(), 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_.

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

Member Data Documentation

double L2TauIsolationProducer::crystalThreshold_
private

Definition at line 74 of file L2TauIsolationProducer.h.

Referenced by getECALHits().

edm::EDGetTokenT<EBRecHitCollection> L2TauIsolationProducer::EBRecHits_
private

Definition at line 69 of file L2TauIsolationProducer.h.

Referenced by getECALHits().

double L2TauIsolationProducer::ECALClustering_clusterRadius_
private

Definition at line 94 of file L2TauIsolationProducer.h.

Referenced by L2TauIsolationProducer(), and produce().

bool L2TauIsolationProducer::ECALClustering_run_
private

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().

bool L2TauIsolationProducer::ECALIsolation_run_
private

Definition at line 81 of file L2TauIsolationProducer.h.

Referenced by L2TauIsolationProducer(), and produce().

edm::EDGetTokenT<EERecHitCollection> L2TauIsolationProducer::EERecHits_
private

Definition at line 70 of file L2TauIsolationProducer.h.

Referenced by getECALHits().

edm::EDGetTokenT<reco::CaloJetCollection> L2TauIsolationProducer::l2CaloJets_
private

Definition at line 68 of file L2TauIsolationProducer.h.

Referenced by 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().

bool L2TauIsolationProducer::TowerIsolation_run_
private

Definition at line 87 of file L2TauIsolationProducer.h.

Referenced by L2TauIsolationProducer(), and produce().

double L2TauIsolationProducer::towerThreshold_
private

Definition at line 75 of file L2TauIsolationProducer.h.

Referenced by getHCALHits().