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
GamIsoDetIdCollectionProducer Class Reference

#include <GamIsoDetIdCollectionProducer.h>

Inheritance diagram for GamIsoDetIdCollectionProducer:
edm::EDProducer 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::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 37 of file GamIsoDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 32 of file GamIsoDetIdCollectionProducer.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
GamIsoDetIdCollectionProducer::~GamIsoDetIdCollectionProducer ( )

Definition at line 71 of file GamIsoDetIdCollectionProducer.cc.

72 {}

Member Function Documentation

void GamIsoDetIdCollectionProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 74 of file GamIsoDetIdCollectionProducer.cc.

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

producer

Implements edm::EDProducer.

Definition at line 79 of file GamIsoDetIdCollectionProducer.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_.

81 {
82  using namespace edm;
83  using namespace std;
84 
85  //Get EM Object
87  iEvent.getByLabel(emObjectLabel_,emObjectH);
88 
89  // take EcalRecHits
91  iEvent.getByLabel(recHitsLabel_,recHitsH);
92  std::auto_ptr<CaloRecHitMetaCollectionV> recHits_(0);
93  recHits_ = std::auto_ptr<CaloRecHitMetaCollectionV>(new EcalRecHitMetaCollection(*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 *doubleConeSel_ = 0;
104  if(recHitsLabel_.instance() == "EcalRecHitsEB")
106  else if(recHitsLabel_.instance() == "EcalRecHitsEE")
108 
109  //Create empty output collections
110  std::auto_ptr< DetIdCollection > detIdCollection (new 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  std::auto_ptr<CaloRecHitMetaCollectionV> chosen = doubleConeSel_->select(pclu,*recHits_);
120 
122  for (recIt = chosen->begin(); recIt!= chosen->end () ; ++recIt) { // Select RecHits
123 
124  if ( (recIt->energy()) < energyCut_) continue; //dont fill if below E noise value
125 
126  double et = recIt->energy() *
127  caloGeom->getPosition(recIt->detid()).perp() /
128  caloGeom->getPosition(recIt->detid()).mag();
129 
130  if ( et < etCut_) continue; //dont fill if below ET noise value
131 
132  bool isBarrel = false;
133  if (fabs(caloGeom->getPosition(recIt->detid()).eta() < 1.479))
134  isBarrel = true;
135 
136  int severityFlag = sevLevel->severityLevel(recIt->detid(), *recHitsH);
137  std::vector<int>::const_iterator sit;
138  if (isBarrel) {
139  sit = std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag);
140  if (sit!= severitiesexclEB_.end())
141  continue;
142  } else {
143  sit = std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag);
144  if (sit!= severitiesexclEE_.end())
145  continue;
146  }
147 
148  std::vector<int>::const_iterator vit;
149  if (isBarrel) {
150  // new rechit flag checks
151  //vit = std::find(flagsexclEB_.begin(), flagsexclEB_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
152  //if (vit != flagsexclEB_.end())
153  // continue;
154  if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) {
155  if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEB_)) {
156  continue;
157  }
158  }
159  } else {
160  // new rechit flag checks
161  //vit = std::find(flagsexclEE_.begin(), flagsexclEE_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
162  //if (vit != flagsexclEE_.end())
163  // continue;
164  if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) {
165  if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEE_)) {
166  continue;
167  }
168  }
169  }
170 
171  if(std::find(detIdCollection->begin(),detIdCollection->end(),recIt->detid()) == detIdCollection->end())
172  detIdCollection->push_back(recIt->detid());
173  } //end rechits
174 
175  } //end candidates
176 
177  delete doubleConeSel_;
178  } //end if cone selector was created
179 
180  iEvent.put( detIdCollection, interestingDetIdCollection_ );
181 }
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 GamIsoDetIdCollectionProducer::emObjectLabel_
private

Definition at line 49 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

double GamIsoDetIdCollectionProducer::energyCut_
private

Definition at line 50 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

double GamIsoDetIdCollectionProducer::etCandCut_
private

Definition at line 52 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

double GamIsoDetIdCollectionProducer::etCut_
private

Definition at line 51 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 59 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

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

Definition at line 60 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

double GamIsoDetIdCollectionProducer::innerRadius_
private

Definition at line 54 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

std::string GamIsoDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 55 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

double GamIsoDetIdCollectionProducer::outerRadius_
private

Definition at line 53 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

edm::InputTag GamIsoDetIdCollectionProducer::recHitsLabel_
private

Definition at line 48 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 57 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

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

Definition at line 58 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().