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 Attributes
EleIsoDetIdCollectionProducer Class Reference

#include <EleIsoDetIdCollectionProducer.h>

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

Public Member Functions

void beginJob ()
 
 EleIsoDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer More...
 
 ~EleIsoDetIdCollectionProducer ()
 
- 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 Attributes

edm::InputTag emObjectLabel_
 
double energyCut_
 
double etCandCut_
 
double etCut_
 
std::vector< int > flagsexclEB_
 
std::vector< int > flagsexclEE_
 
double innerRadius_
 
std::string interestingDetIdCollection_
 
double outerRadius_
 
edm::InputTag recHitsLabel_
 
std::vector< int > severitiesexclEB_
 
std::vector< int > severitiesexclEE_
 

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

Original author: Matthew LeBourgeois PH/CMG Modified from : RecoEcal/EgammaClusterProducers/{src,interface}/InterestingDetIdCollectionProducer.{h,cc} by Paolo Meridiani PH/CMG

Implementation: <Notes on="" implementation>="">

Definition at line 35 of file EleIsoDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 32 of file EleIsoDetIdCollectionProducer.cc.

References flagsexclEB_, flagsexclEE_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, severitiesexclEB_, and severitiesexclEE_.

32  :
33  recHitsLabel_(iConfig.getParameter< edm::InputTag > ("recHitsLabel")),
34  emObjectLabel_(iConfig.getParameter< edm::InputTag > ("emObjectLabel")),
35  energyCut_(iConfig.getParameter<double>("energyCut")),
36  etCut_(iConfig.getParameter<double>("etCut")),
37  etCandCut_(iConfig.getParameter<double> ("etCandCut")),
38  outerRadius_(iConfig.getParameter<double>("outerRadius")),
39  innerRadius_(iConfig.getParameter<double>("innerRadius")),
40  interestingDetIdCollection_(iConfig.getParameter<std::string>("interestingDetIdCollection"))
41  {
42 
43  const std::vector<std::string> flagnamesEB =
44  iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
45 
46  const std::vector<std::string> flagnamesEE =
47  iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
48 
49  flagsexclEB_=
50  StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
51 
53  StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
54 
55  const std::vector<std::string> severitynamesEB =
56  iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
57 
59  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
60 
61  const std::vector<std::string> severitynamesEE =
62  iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
63 
65  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
66 
67  //register your products
68  produces< DetIdCollection > (interestingDetIdCollection_) ;
69 }
T getParameter(std::string const &) const
EleIsoDetIdCollectionProducer::~EleIsoDetIdCollectionProducer ( )

Definition at line 71 of file EleIsoDetIdCollectionProducer.cc.

72 {}

Member Function Documentation

void EleIsoDetIdCollectionProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 74 of file EleIsoDetIdCollectionProducer.cc.

75 {}
void EleIsoDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

producer

Implements edm::EDProducer.

Definition at line 79 of file EleIsoDetIdCollectionProducer.cc.

References CaloRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, emObjectLabel_, CaloRecHit::energy(), energyCut_, eta(), etCandCut_, etCut_, spr::find(), flagsexclEB_, flagsexclEE_, edm::EventSetup::get(), edm::Event::getByLabel(), innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, EcalRecHit::kGood, mag(), outerRadius_, perp(), edm::Event::put(), recHitsLabel_, severitiesexclEB_, and severitiesexclEE_.

79  {
80  using namespace edm;
81  using namespace std;
82 
83  //Get EM Object
85  iEvent.getByLabel(emObjectLabel_,emObjectH);
86 
87  // take EcalRecHits
89  iEvent.getByLabel(recHitsLabel_,recHitsH);
90  std::auto_ptr<CaloRecHitMetaCollectionV> recHits_(0);
91  recHits_ = std::auto_ptr<CaloRecHitMetaCollectionV>(new EcalRecHitMetaCollection(*recHitsH));
92 
94  iSetup.get<CaloGeometryRecord>().get(pG);
95  const CaloGeometry* caloGeom = pG.product();
96 
97  //Get the channel status from the db
98  //edm::ESHandle<EcalChannelStatus> chStatus;
99  //iSetup.get<EcalChannelStatusRcd>().get(chStatus);
100 
102  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
103  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
104 
105  CaloDualConeSelector *doubleConeSel_ = 0;
106  if(recHitsLabel_.instance() == "EcalRecHitsEB")
108  else if(recHitsLabel_.instance() == "EcalRecHitsEE")
110 
111  //Create empty output collections
112  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection() ) ;
113 
114  reco::GsfElectronCollection::const_iterator emObj;
115  if(doubleConeSel_) { //if cone selector was created
116  for (emObj = emObjectH->begin(); emObj != emObjectH->end(); emObj++) { //Loop over candidates
117 
118  if(emObj->et() < etCandCut_) continue; //don't calculate if object hasn't enough energy
119 
120  GlobalPoint pclu (emObj->caloPosition().x(),emObj->caloPosition().y(),emObj->caloPosition().z());
121  std::auto_ptr<CaloRecHitMetaCollectionV> chosen = doubleConeSel_->select(pclu,*recHits_);
122 
124  for (recIt = chosen->begin(); recIt!= chosen->end () ; ++recIt) { // Select RecHits
125 
126  if (recIt->energy() < energyCut_)
127  continue; //dont fill if below E noise value
128 
129  double et = recIt->energy() *
130  caloGeom->getPosition(recIt->detid()).perp() /
131  caloGeom->getPosition(recIt->detid()).mag();
132 
133  bool isBarrel = false;
134  if (fabs(caloGeom->getPosition(recIt->detid()).eta() < 1.479))
135  isBarrel = true;
136 
137  if (et < etCut_)
138  continue; //dont fill if below ET noise value
139 
140  std::vector<int>::const_iterator sit;
141  int severityFlag = sevLevel->severityLevel(recIt->detid(), *recHitsH);
142  if (isBarrel) {
143  sit = std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag);
144  if (sit != severitiesexclEB_.end())
145  continue;
146  } else {
147  sit = std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag);
148  if (sit != severitiesexclEE_.end())
149  continue;
150  }
151 
152  std::vector<int>::const_iterator vit;
153  if (isBarrel) {
154  // new rechit flag checks
155  //vit = std::find(flagsexclEB_.begin(), flagsexclEB_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
156  //if (vit != flagsexclEB_.end())
157  // continue;
158  if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) {
159  if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEB_)) {
160  continue;
161  }
162  }
163  } else {
164  // new rechit flag checks
165  //vit = std::find(flagsexclEE_.begin(), flagsexclEE_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
166  //if (vit != flagsexclEE_.end())
167  // continue;
168  if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) {
169  if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEE_)) {
170  continue;
171  }
172  }
173  }
174 
175  if(std::find(detIdCollection->begin(),detIdCollection->end(),recIt->detid()) == detIdCollection->end())
176  detIdCollection->push_back(recIt->detid());
177  } //end rechits
178 
179  } //end candidates
180 
181  delete doubleConeSel_;
182  } //end if cone selector was created
183 
184  iEvent.put( detIdCollection, interestingDetIdCollection_ );
185 }
const DetId & detid() const
Definition: CaloRecHit.h:20
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T eta() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
float energy() const
Definition: CaloRecHit.h:17
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
const T & get() const
Definition: EventSetup.h:55
T perp() const
Magnitude of transverse component.
SimpleCaloRecHitMetaCollection< EcalRecHitCollection > EcalRecHitMetaCollection
edm::EDCollection< DetId > DetIdCollection
std::string const & instance() const
Definition: InputTag.h:43

Member Data Documentation

edm::InputTag EleIsoDetIdCollectionProducer::emObjectLabel_
private

Definition at line 47 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

double EleIsoDetIdCollectionProducer::energyCut_
private

Definition at line 48 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

double EleIsoDetIdCollectionProducer::etCandCut_
private

Definition at line 50 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

double EleIsoDetIdCollectionProducer::etCut_
private

Definition at line 49 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

std::vector<int> EleIsoDetIdCollectionProducer::flagsexclEB_
private

Definition at line 57 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

std::vector<int> EleIsoDetIdCollectionProducer::flagsexclEE_
private

Definition at line 58 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

double EleIsoDetIdCollectionProducer::innerRadius_
private

Definition at line 52 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

std::string EleIsoDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 53 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

double EleIsoDetIdCollectionProducer::outerRadius_
private

Definition at line 51 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

edm::InputTag EleIsoDetIdCollectionProducer::recHitsLabel_
private

Definition at line 46 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

std::vector<int> EleIsoDetIdCollectionProducer::severitiesexclEB_
private

Definition at line 55 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

std::vector<int> EleIsoDetIdCollectionProducer::severitiesexclEE_
private

Definition at line 56 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().