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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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(), cond::rpcobgas::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_, 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(((EcalRecHit*)(&*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  vit = std::find(flagsexclEB_.begin(), flagsexclEB_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
151  if (vit != flagsexclEB_.end())
152  continue;
153  } else {
154  vit = std::find(flagsexclEE_.begin(), flagsexclEE_.end(), ((EcalRecHit*)(&*recIt))->recoFlag());
155  if (vit != flagsexclEE_.end())
156  continue;
157  }
158 
159  if(std::find(detIdCollection->begin(),detIdCollection->end(),recIt->detid()) == detIdCollection->end())
160  detIdCollection->push_back(recIt->detid());
161  } //end rechits
162 
163  } //end candidates
164 
165  delete doubleConeSel_;
166  } //end if cone selector was created
167 
168  iEvent.put( detIdCollection, interestingDetIdCollection_ );
169 }
const DetId & detid() const
Definition: CaloRecHit.h:22
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:85
float energy() const
Definition: CaloRecHit.h:19
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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:26

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