CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GamIsoDetIdCollectionProducer Class Reference

#include <GamIsoDetIdCollectionProducer.h>

Inheritance diagram for GamIsoDetIdCollectionProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob ()
 
 GamIsoDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer More...
 
 ~GamIsoDetIdCollectionProducer ()
 
- 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)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag emObjectLabel_
 
edm::EDGetTokenT< reco::PhotonCollectionemObjectToken_
 
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::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
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 39 of file GamIsoDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 31 of file GamIsoDetIdCollectionProducer.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::PhotonCollection>(iConfig.getParameter< edm::InputTag > ("emObjectLabel"))),
34  //the labels are still used to decide if its endcap or barrel...
35  recHitsLabel_(iConfig.getParameter< edm::InputTag > ("recHitsLabel")),
36  emObjectLabel_(iConfig.getParameter< edm::InputTag > ("emObjectLabel")),
37  energyCut_(iConfig.getParameter<double>("energyCut")),
38  etCut_(iConfig.getParameter<double>("etCut")),
39  etCandCut_(iConfig.getParameter<double> ("etCandCut")),
40  outerRadius_(iConfig.getParameter<double>("outerRadius")),
41  innerRadius_(iConfig.getParameter<double>("innerRadius")),
42  interestingDetIdCollection_(iConfig.getParameter<std::string>("interestingDetIdCollection"))
43  {
44 
45  const std::vector<std::string> flagnamesEB =
46  iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
47 
48  const std::vector<std::string> flagnamesEE =
49  iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
50 
51  flagsexclEB_=
52  StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
53 
55  StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
56 
57  const std::vector<std::string> severitynamesEB =
58  iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
59 
61  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
62 
63  const std::vector<std::string> severitynamesEE =
64  iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
65 
67  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
68 
69  //register your products
70  produces< DetIdCollection > (interestingDetIdCollection_) ;
71 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
edm::EDGetTokenT< reco::PhotonCollection > emObjectToken_
GamIsoDetIdCollectionProducer::~GamIsoDetIdCollectionProducer ( )

Definition at line 73 of file GamIsoDetIdCollectionProducer.cc.

74 {}

Member Function Documentation

void GamIsoDetIdCollectionProducer::beginJob ( void  )

Definition at line 76 of file GamIsoDetIdCollectionProducer.cc.

77 {}
void GamIsoDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

producer

Definition at line 81 of file GamIsoDetIdCollectionProducer.cc.

References EcalRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, emObjectToken_, EcalRecHit::energy(), energyCut_, stringResolutionProvider_cfi::et, stringResolutionProvider_cfi::eta, etCandCut_, etCut_, spr::find(), flagsexclEB_, flagsexclEE_, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getPosition(), innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, gedGsfElectrons_cfi::isBarrel, EcalRecHit::kGood, mag(), eostools::move(), outerRadius_, perp(), edm::ESHandle< T >::product(), edm::Event::put(), recHitsLabel_, recHitsToken_, CaloDualConeSelector< T >::selectCallback(), severitiesexclEB_, severitiesexclEE_, and EcalSeverityLevelAlgo::severityLevel().

83 {
84  using namespace edm;
85  using namespace std;
86 
87  //Get EM Object
89  iEvent.getByToken(emObjectToken_,emObjectH);
90 
91  // take EcalRecHits
93  iEvent.getByToken(recHitsToken_,recHitsH);
94 
96  iSetup.get<CaloGeometryRecord>().get(pG);
97  const CaloGeometry* caloGeom = pG.product();
98 
100  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
101  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
102 
103  CaloDualConeSelector<EcalRecHit> *doubleConeSel_ = 0;
104  if(recHitsLabel_.instance() == "EcalRecHitsEB")
106  else if(recHitsLabel_.instance() == "EcalRecHitsEE")
108 
109  //Create empty output collections
110  auto detIdCollection = std::make_unique<DetIdCollection>();
111 
112  reco::PhotonCollection::const_iterator emObj;
113  if(doubleConeSel_) { //if cone selector was created
114  for (emObj = emObjectH->begin(); emObj != emObjectH->end(); emObj++) { //Loop over candidates
115 
116  if(emObj->et() < etCandCut_) continue;
117 
118  GlobalPoint pclu (emObj->caloPosition().x(),emObj->caloPosition().y(),emObj->caloPosition().z());
119  doubleConeSel_->selectCallback(pclu, *recHitsH, [&](const EcalRecHit& recHitRef) {
120  const EcalRecHit* recIt = &recHitRef;
121 
122  if ( (recIt->energy()) < energyCut_) 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  if ( et < etCut_) return; //dont fill if below ET noise value
129 
130  bool isBarrel = false;
131  if (fabs(caloGeom->getPosition(recIt->detid()).eta() < 1.479))
132  isBarrel = true;
133 
134  int severityFlag = sevLevel->severityLevel(recIt->detid(), *recHitsH);
135  std::vector<int>::const_iterator sit;
136  if (isBarrel) {
137  sit = std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag);
138  if (sit!= severitiesexclEB_.end())
139  return;
140  } else {
141  sit = std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag);
142  if (sit!= severitiesexclEE_.end())
143  return;
144  }
145 
146  std::vector<int>::const_iterator vit;
147  if (isBarrel) {
148  // new rechit flag checks
149  //vit = std::find(flagsexclEB_.begin(), flagsexclEB_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
150  //if (vit != flagsexclEB_.end())
151  // continue;
152  if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) {
153  if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEB_)) {
154  return;
155  }
156  }
157  } else {
158  // new rechit flag checks
159  //vit = std::find(flagsexclEE_.begin(), flagsexclEE_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
160  //if (vit != flagsexclEE_.end())
161  // continue;
162  if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) {
163  if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEE_)) {
164  return;
165  }
166  }
167  }
168 
169  if(std::find(detIdCollection->begin(),detIdCollection->end(),recIt->detid()) == detIdCollection->end())
170  detIdCollection->push_back(recIt->detid());
171  }); //end rechits
172 
173  } //end candidates
174 
175  delete doubleConeSel_;
176  } //end if cone selector was created
177 
178  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_ );
179 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const DetId & detid() const
Definition: EcalRecHit.h:72
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
float energy() const
Definition: EcalRecHit.h:68
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:70
const T & get() const
Definition: EventSetup.h:56
et
define resolution functions of each parameter
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
T perp() const
Magnitude of transverse component.
HLT enums.
edm::EDGetTokenT< reco::PhotonCollection > emObjectToken_
T const * product() const
Definition: ESHandle.h:86
std::string const & instance() const
Definition: InputTag.h:37
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::InputTag GamIsoDetIdCollectionProducer::emObjectLabel_
private

Definition at line 53 of file GamIsoDetIdCollectionProducer.h.

edm::EDGetTokenT<reco::PhotonCollection> GamIsoDetIdCollectionProducer::emObjectToken_
private

Definition at line 51 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

double GamIsoDetIdCollectionProducer::energyCut_
private

Definition at line 54 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

double GamIsoDetIdCollectionProducer::etCandCut_
private

Definition at line 56 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

double GamIsoDetIdCollectionProducer::etCut_
private

Definition at line 55 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 63 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

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

Definition at line 64 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

double GamIsoDetIdCollectionProducer::innerRadius_
private

Definition at line 58 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

std::string GamIsoDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 59 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

double GamIsoDetIdCollectionProducer::outerRadius_
private

Definition at line 57 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

edm::InputTag GamIsoDetIdCollectionProducer::recHitsLabel_
private

Definition at line 52 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

edm::EDGetTokenT<EcalRecHitCollection> GamIsoDetIdCollectionProducer::recHitsToken_
private

Definition at line 50 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 61 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

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

Definition at line 62 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().