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_
 
double innerRadius_
 
std::string interestingDetIdCollection_
 
double outerRadius_
 
edm::InputTag recHitsLabel_
 
int severityLevelCut_
 
std::vector< int > v_chstatus_
 

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)
 
- 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 31 of file GamIsoDetIdCollectionProducer.cc.

References interestingDetIdCollection_.

31  :
32  recHitsLabel_(iConfig.getParameter< edm::InputTag > ("recHitsLabel")),
33  emObjectLabel_(iConfig.getParameter< edm::InputTag > ("emObjectLabel")),
34  energyCut_(iConfig.getParameter<double>("energyCut")),
35  etCut_(iConfig.getParameter<double>("etCut")),
36  etCandCut_(iConfig.getParameter<double> ("etCandCut")),
37  outerRadius_(iConfig.getParameter<double>("outerRadius")),
38  innerRadius_(iConfig.getParameter<double>("innerRadius")),
39  interestingDetIdCollection_(iConfig.getParameter<std::string>("interestingDetIdCollection")),
40  severityLevelCut_(iConfig.getParameter<int>("severityLevelCut")),
41  //severityRecHitThreshold_(iConfig.getParameter<double>("severityRecHitThreshold")),
42  //spIdString_(iConfig.getParameter<std::string>("spikeIdString")),
43  //spIdThreshold_(iConfig.getParameter<double>("spikeIdThreshold")),
44  v_chstatus_(iConfig.getParameter<std::vector<int> >("recHitFlagsToBeExcluded")) {
45 
46 // if ( !spIdString_.compare("kE1OverE9") ) spId_ = EcalSeverityLevelAlgo::kE1OverE9;
47 // else if( !spIdString_.compare("kSwissCross") ) spId_ = EcalSeverityLevelAlgo::kSwissCross;
48 // else if( !spIdString_.compare("kSwissCrossBordersIncluded") ) spId_ = EcalSeverityLevelAlgo::kSwissCrossBordersIncluded;
49 // else spId_ = EcalSeverityLevelAlgo::kSwissCross;
50 
51  //register your products
52  produces< DetIdCollection > (interestingDetIdCollection_) ;
53 }
T getParameter(std::string const &) const
GamIsoDetIdCollectionProducer::~GamIsoDetIdCollectionProducer ( )

Definition at line 55 of file GamIsoDetIdCollectionProducer.cc.

55 {}

Member Function Documentation

void GamIsoDetIdCollectionProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 57 of file GamIsoDetIdCollectionProducer.cc.

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

producer

Implements edm::EDProducer.

Definition at line 62 of file GamIsoDetIdCollectionProducer.cc.

References CaloRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, emObjectLabel_, CaloRecHit::energy(), energyCut_, etCandCut_, etCut_, spr::find(), edm::EventSetup::get(), edm::Event::getByLabel(), innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, mag(), outerRadius_, perp(), edm::Event::put(), recHitsLabel_, severityLevelCut_, and v_chstatus_.

64 {
65  using namespace edm;
66  using namespace std;
67 
68  //Get EM Object
70  iEvent.getByLabel(emObjectLabel_,emObjectH);
71 
72  // take EcalRecHits
74  iEvent.getByLabel(recHitsLabel_,recHitsH);
75  std::auto_ptr<CaloRecHitMetaCollectionV> recHits_(0);
76  recHits_ = std::auto_ptr<CaloRecHitMetaCollectionV>(new EcalRecHitMetaCollection(*recHitsH));
77 
79  iSetup.get<CaloGeometryRecord>().get(pG);
80  const CaloGeometry* caloGeom = pG.product();
81 
82  //Get the channel status from the db
84  iSetup.get<EcalChannelStatusRcd>().get(chStatus);
85 
87  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
88  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
89 
90  CaloDualConeSelector *doubleConeSel_ = 0;
91  if(recHitsLabel_.instance() == "EcalRecHitsEB")
93  else if(recHitsLabel_.instance() == "EcalRecHitsEE")
95 
96  //Create empty output collections
97  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection() ) ;
98 
99  reco::PhotonCollection::const_iterator emObj;
100  if(doubleConeSel_) { //if cone selector was created
101  for (emObj = emObjectH->begin(); emObj != emObjectH->end(); emObj++) { //Loop over candidates
102 
103  if(emObj->et() < etCandCut_) continue;
104 
105  GlobalPoint pclu (emObj->caloPosition().x(),emObj->caloPosition().y(),emObj->caloPosition().z());
106  std::auto_ptr<CaloRecHitMetaCollectionV> chosen = doubleConeSel_->select(pclu,*recHits_);
107 
109  for (recIt = chosen->begin(); recIt!= chosen->end () ; ++recIt) { // Select RecHits
110 
111  if ( fabs(recIt->energy()) < energyCut_) continue; //dont fill if below E noise value
112 
113  double et = recIt->energy() *
114  caloGeom->getPosition(recIt->detid()).perp() /
115  caloGeom->getPosition(recIt->detid()).mag();
116 
117  if ( fabs(et) < etCut_) continue; //dont fill if below ET noise value
118 
119  //make sure we have a barrel rechit
120  //call the severity level method
121  //passing the EBDetId
122  //the rechit collection in order to calculate the swiss crss
123  //and the EcalChannelRecHitRcd
124  //only consider rechits with ET >
125  //the SpikeId method (currently kE1OverE9 or kSwissCross)
126  //cut value for above
127  //then if the severity level is too high, we continue to the next rechit
128  if(recHitsLabel_.instance() == "EcalRecHitsEB" &&
129  sevLevel->severityLevel(EBDetId(recIt->detid()), *recHitsH)>= severityLevelCut_) continue;
130  // *chStatus,
131  // severityRecHitThreshold_,
132  // spId_,
133  // spIdThreshold_
134  // ) >= severityLevelCut_) continue;
135 
136  //Check based on flags to protect from recovered channels from non-read towers
137  //Assumption is that v_chstatus_ is empty unless doFlagChecks() has been called
138  std::vector<int>::const_iterator vit = std::find( v_chstatus_.begin(), v_chstatus_.end(), ((EcalRecHit*)(&*recIt))->recoFlag() );
139  if ( vit != v_chstatus_.end() ) continue; // the recHit has to be excluded from the iso sum
140 
141  if(std::find(detIdCollection->begin(),detIdCollection->end(),recIt->detid()) == detIdCollection->end())
142  detIdCollection->push_back(recIt->detid());
143  } //end rechits
144 
145  } //end candidates
146 
147  delete doubleConeSel_;
148  } //end if cone selector was created
149 
150  iEvent.put( detIdCollection, interestingDetIdCollection_ );
151 }
const DetId & detid() const
Definition: CaloRecHit.h:21
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
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:84
float energy() const
Definition: CaloRecHit.h:19
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
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().

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

int GamIsoDetIdCollectionProducer::severityLevelCut_
private

Definition at line 56 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

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

Definition at line 61 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().