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

#include <CaloRecHitCandidateProducer.h>

Inheritance diagram for CaloRecHitCandidateProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CaloRecHitCandidateProducer (const edm::ParameterSet &)
 
double cellTresholdAndWeight (const CaloRecHit &, const HcalTopology &) const
 
void produce (edm::Event &, const edm::EventSetup &)
 
 ~CaloRecHitCandidateProducer ()
 
- 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

bool mAllowMissingInputs
 
double mEBthreshold
 
double mEBweight
 
std::vector< edm::InputTagmEcalLabels
 source collection tag More...
 
double mEEthreshold
 
double mEEweight
 
double mHBthreshold
 
double mHBweight
 
double mHEDthreshold
 
double mHEDweight
 
double mHESthreshold
 
double mHESweight
 
double mHF1threshold
 
double mHF1weight
 
double mHF2threshold
 
double mHF2weight
 
double mHOthreshold
 
double mHOweight
 
bool mUseHO
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hf_
 
edm::EDGetTokenT
< HORecHitCollection
tok_ho_
 
std::vector< edm::EDGetTokenT
< EcalRecHitCollection > > 
toks_ecal_
 

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

Definition at line 15 of file CaloRecHitCandidateProducer.h.

Constructor & Destructor Documentation

CaloRecHitCandidateProducer::CaloRecHitCandidateProducer ( const edm::ParameterSet fConfig)

Definition at line 65 of file CaloRecHitCandidateProducer.cc.

References edm::ParameterSet::getParameter(), i, mEcalLabels, tok_hbhe_, tok_hf_, tok_ho_, and toks_ecal_.

66  : mEcalLabels (fConfig.getParameter<std::vector<edm::InputTag> >("ecalInputs")),
67  mAllowMissingInputs (fConfig.getUntrackedParameter<bool>("AllowMissingInputs",false)),
68  mUseHO (fConfig.getParameter<bool>("UseHO")),
69 
70  mEBthreshold (fConfig.getParameter<double>("EBThreshold")),
71  mEEthreshold (fConfig.getParameter<double>("EEThreshold")),
72  mHBthreshold (fConfig.getParameter<double>("HBThreshold")),
73  mHESthreshold (fConfig.getParameter<double>("HESThreshold")),
74  mHEDthreshold (fConfig.getParameter<double>("HEDThreshold")),
75  mHOthreshold (fConfig.getParameter<double>("HOThreshold")),
76  mHF1threshold (fConfig.getParameter<double>("HF1Threshold")),
77  mHF2threshold (fConfig.getParameter<double>("HF2Threshold")),
78  mEBweight (fConfig.getParameter<double>("EBWeight")),
79  mEEweight (fConfig.getParameter<double>("EEWeight")),
80  mHBweight (fConfig.getParameter<double>("HBWeight")),
81  mHESweight (fConfig.getParameter<double>("HESWeight")),
82  mHEDweight (fConfig.getParameter<double>("HEDWeight")),
83  mHOweight (fConfig.getParameter<double>("HOWeight")),
84  mHF1weight (fConfig.getParameter<double>("HF1Weight")),
85  mHF2weight (fConfig.getParameter<double>("HF2Weight"))
86 {
87 
88  tok_hbhe_ = consumes<HBHERecHitCollection>(fConfig.getParameter<edm::InputTag>("hbheInput"));
89  tok_ho_ = consumes<HORecHitCollection> (fConfig.getParameter<edm::InputTag>("hoInput"));
90  tok_hf_ = consumes<HFRecHitCollection> (fConfig.getParameter<edm::InputTag>("hfInput"));
91 
92  const unsigned nLabels = mEcalLabels.size();
93  for ( unsigned i=0; i != nLabels; i++ )
94  toks_ecal_.push_back(consumes<EcalRecHitCollection>(mEcalLabels[i]));
95 
96  produces<CandidateCollection>();
97 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > mEcalLabels
source collection tag
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
CaloRecHitCandidateProducer::~CaloRecHitCandidateProducer ( )
inline

Definition at line 18 of file CaloRecHitCandidateProducer.h.

18 { }

Member Function Documentation

double CaloRecHitCandidateProducer::cellTresholdAndWeight ( const CaloRecHit fHit,
const HcalTopology fTopology 
) const

Definition at line 162 of file CaloRecHitCandidateProducer.cc.

References HcalDetId::depth(), DetId::det(), CaloRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, CaloRecHit::energy(), HcalTopology::firstHEDoublePhiRing(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ietaAbs(), mEBthreshold, mEBweight, mEEthreshold, mEEweight, mHBthreshold, mHBweight, mHEDthreshold, mHEDweight, mHESthreshold, mHESweight, mHF1threshold, mHF1weight, mHF2threshold, mHF2weight, mHOthreshold, mHOweight, HcalDetId::subdet(), DetId::subdetId(), and dtDQMClient_cfg::threshold.

162  {
163  double weight = 0;
164  double threshold = 0;
165  DetId detId = fHit.detid ();
166  DetId::Detector det = detId.det ();
167  if(det == DetId::Ecal) {
168  // may or may not be EB. We'll find out.
169 
170  EcalSubdetector subdet = (EcalSubdetector)(detId.subdetId());
171  if(subdet == EcalBarrel) {
172  threshold = mEBthreshold;
173  weight = mEBweight;
174  }
175  else if(subdet == EcalEndcap) {
176  threshold = mEEthreshold;
177  weight = mEEweight;
178  }
179  }
180  else if(det == DetId::Hcal) {
181  HcalDetId hcalDetId(detId);
182  HcalSubdetector subdet = hcalDetId.subdet();
183 
184  if(subdet == HcalBarrel) {
185  threshold = mHBthreshold;
186  weight = mHBweight;
187  }
188 
189  else if(subdet == HcalEndcap) {
190  // check if it's single or double tower
191  if(hcalDetId.ietaAbs() < fTopology.firstHEDoublePhiRing()) {
192  threshold = mHESthreshold;
193  weight = mHESweight;
194  }
195  else {
196  threshold = mHEDthreshold;
197  weight = mHEDweight;
198  }
199  } else if(subdet == HcalOuter) {
200  threshold = mHOthreshold;
201  weight = mHOweight;
202  } else if(subdet == HcalForward) {
203  if(hcalDetId.depth() == 1) {
204  threshold = mHF1threshold;
205  weight = mHF1weight;
206  } else {
207  threshold = mHF2threshold;
208  weight = mHF2weight;
209  }
210  }
211  }
212  return fHit.energy () >= threshold ? weight : 0;
213 }
const DetId & detid() const
Definition: CaloRecHit.h:20
float energy() const
Definition: CaloRecHit.h:17
HcalSubdetector
Definition: HcalAssistant.h:31
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:86
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
Detector
Definition: DetId.h:24
int weight
Definition: histoStyle.py:50
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
EcalSubdetector
void CaloRecHitCandidateProducer::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 99 of file CaloRecHitCandidateProducer.cc.

References geometry, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByToken(), i, edm::HandleBase::isValid(), mAllowMissingInputs, mUseHO, convertSQLitetoXML_cfg::output, edm::Event::put(), GlobalPosition_Frontier_DevDB_cff::record, tok_hbhe_, tok_hf_, tok_ho_, and toks_ecal_.

99  {
100  // get geometry
101  // const IdealGeometryRecord& record = fSetup.template get<IdealGeometryRecord>();
102  const CaloGeometryRecord& caloRecord = fSetup.get<CaloGeometryRecord>();
104  caloRecord.get (geometry);
106  ESHandle<HcalTopology> topology;
107  record.get (topology);
108  // set Output
109  auto_ptr<CandidateCollection> output ( new CandidateCollection );
110  // get and process Inputs
112  fEvent.getByToken(tok_hbhe_,hbhe);
113  if (!hbhe.isValid()) {
114  // can't find it!
115  if (!mAllowMissingInputs) {
116  *hbhe; // will throw the proper exception
117  }
118  } else {
119  processHits (hbhe, *this, *geometry, *topology, &*output);
120  }
121 
122  if (mUseHO) {
124  fEvent.getByToken(tok_ho_,ho);
125  if (!ho.isValid()) {
126  // can't find it!
127  if (!mAllowMissingInputs) {
128  *ho; // will throw the proper exception
129  }
130  } else {
131  processHits (ho, *this, *geometry, *topology, &*output);
132  }
133  }
134 
136  fEvent.getByToken(tok_hf_,hf);
137  if (!hf.isValid()) {
138  // can't find it!
139  if (!mAllowMissingInputs) {
140  *hf; // will throw the proper exception
141  }
142  } else {
143  processHits (hf, *this, *geometry, *topology, &*output);
144  }
145 
146  std::vector<edm::EDGetTokenT<EcalRecHitCollection> >::const_iterator i;
147  for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) {
149  fEvent.getByToken(*i,ec);
150  if (!ec.isValid()) {
151  // can't find it!
152  if (!mAllowMissingInputs) {
153  *ec; // will throw the proper exception
154  }
155  } else {
156  processHits (ec, *this, *geometry, *topology, &*output);
157  }
158  }
159  fEvent.put(output);
160 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void get(HolderT &iHolder) const
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< HORecHitCollection > tok_ho_
ESHandle< TrackerGeometry > geometry
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_

Member Data Documentation

bool CaloRecHitCandidateProducer::mAllowMissingInputs
private

Definition at line 29 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

double CaloRecHitCandidateProducer::mEBthreshold
private

Definition at line 31 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mEBweight
private

Definition at line 34 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

std::vector<edm::InputTag> CaloRecHitCandidateProducer::mEcalLabels
private

source collection tag

Definition at line 24 of file CaloRecHitCandidateProducer.h.

Referenced by CaloRecHitCandidateProducer().

double CaloRecHitCandidateProducer::mEEthreshold
private

Definition at line 31 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mEEweight
private

Definition at line 34 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHBthreshold
private

Definition at line 32 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHBweight
private

Definition at line 35 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHEDthreshold
private

Definition at line 32 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHEDweight
private

Definition at line 35 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHESthreshold
private

Definition at line 32 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHESweight
private

Definition at line 35 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHF1threshold
private

Definition at line 33 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHF1weight
private

Definition at line 35 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHF2threshold
private

Definition at line 33 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHF2weight
private

Definition at line 35 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHOthreshold
private

Definition at line 33 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

double CaloRecHitCandidateProducer::mHOweight
private

Definition at line 35 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

bool CaloRecHitCandidateProducer::mUseHO
private

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

edm::EDGetTokenT<HBHERecHitCollection> CaloRecHitCandidateProducer::tok_hbhe_
private

Definition at line 25 of file CaloRecHitCandidateProducer.h.

Referenced by CaloRecHitCandidateProducer(), and produce().

edm::EDGetTokenT<HFRecHitCollection> CaloRecHitCandidateProducer::tok_hf_
private

Definition at line 27 of file CaloRecHitCandidateProducer.h.

Referenced by CaloRecHitCandidateProducer(), and produce().

edm::EDGetTokenT<HORecHitCollection> CaloRecHitCandidateProducer::tok_ho_
private

Definition at line 26 of file CaloRecHitCandidateProducer.h.

Referenced by CaloRecHitCandidateProducer(), and produce().

std::vector<edm::EDGetTokenT<EcalRecHitCollection> > CaloRecHitCandidateProducer::toks_ecal_
private

Definition at line 28 of file CaloRecHitCandidateProducer.h.

Referenced by CaloRecHitCandidateProducer(), and produce().