test
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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 Attributes

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 34 of file EleIsoDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 31 of file EleIsoDetIdCollectionProducer.cc.

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

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

Definition at line 72 of file EleIsoDetIdCollectionProducer.cc.

73 {}

Member Function Documentation

void EleIsoDetIdCollectionProducer::beginJob ( void  )

Definition at line 75 of file EleIsoDetIdCollectionProducer.cc.

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

producer

Implements edm::stream::EDProducerBase.

Definition at line 80 of file EleIsoDetIdCollectionProducer.cc.

References EcalRecHit::checkFlag(), EcalRecHit::checkFlags(), EcalRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, emObjectToken_, EcalRecHit::energy(), energyCut_, eta, etCandCut_, etCut_, spr::find(), flagsexclEB_, flagsexclEE_, edm::EventSetup::get(), edm::Event::getByToken(), innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, GeomDetEnumerators::isBarrel(), EcalRecHit::kGood, mag(), outerRadius_, perp(), edm::Event::put(), recHitsLabel_, recHitsToken_, severitiesexclEB_, and severitiesexclEE_.

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

Member Data Documentation

edm::InputTag EleIsoDetIdCollectionProducer::emObjectLabel_
private

Definition at line 48 of file EleIsoDetIdCollectionProducer.h.

edm::EDGetToken EleIsoDetIdCollectionProducer::emObjectToken_
private

Definition at line 46 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

double EleIsoDetIdCollectionProducer::energyCut_
private

Definition at line 49 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

double EleIsoDetIdCollectionProducer::etCandCut_
private

Definition at line 51 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

double EleIsoDetIdCollectionProducer::etCut_
private

Definition at line 50 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 58 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

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

Definition at line 59 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

double EleIsoDetIdCollectionProducer::innerRadius_
private

Definition at line 53 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

std::string EleIsoDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 54 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

double EleIsoDetIdCollectionProducer::outerRadius_
private

Definition at line 52 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

edm::InputTag EleIsoDetIdCollectionProducer::recHitsLabel_
private

Definition at line 47 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

edm::EDGetToken EleIsoDetIdCollectionProducer::recHitsToken_
private

Definition at line 45 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 56 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

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

Definition at line 57 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().