CMS 3D CMS Logo

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

#include <HcalSimpleReconstructor.h>

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

Public Member Functions

virtual void beginRun (edm::Run const &r, edm::EventSetup const &es) override final
 
virtual void endRun (edm::Run const &r, edm::EventSetup const &es) override final
 
 HcalSimpleReconstructor (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override final
 
virtual ~HcalSimpleReconstructor ()
 
- 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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

template<class DIGICOLL , class RECHITCOLL >
void process (edm::Event &e, const edm::EventSetup &c, const edm::EDGetTokenT< DIGICOLL > &tok)
 

Private Attributes

DetId::Detector det_
 
bool dropZSmarkedPassed_
 
int firstSample_
 
edm::InputTag inputLabel_
 
HcalRecoParamsparamTS
 
HcalSimpleRecAlgo reco_
 
int samplesToAdd_
 
int subdet_
 
HcalOtherSubdetector subdetOther_
 
HcalTopologytheTopology
 
edm::EDGetTokenT< HcalCalibDigiCollectiontok_calib_
 
edm::EDGetTokenT< HBHEDigiCollectiontok_hbhe_
 
edm::EDGetTokenT< HFDigiCollectiontok_hf_
 
edm::EDGetTokenT< HODigiCollectiontok_ho_
 
bool tsFromDB_
 

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
 
- 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

Author
J. Mans - Minnesota
E. Garcia - CSU Based on HcalSimpleReconstructor.h by J. Mans

Definition at line 26 of file HcalSimpleReconstructor.h.

Constructor & Destructor Documentation

HcalSimpleReconstructor::HcalSimpleReconstructor ( const edm::ParameterSet ps)
explicit

Definition at line 16 of file HcalSimpleReconstructor.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), HcalBarrel, HcalForward, HcalOuter, inputLabel_, reco_, HcalSimpleRecAlgo::setMeth3Params(), AlCaHLTBitMon_QueryRunRegistry::string, subdet_, tok_calib_, tok_hbhe_, tok_hf_, and tok_ho_.

16  :
17  reco_(conf.getParameter<bool>("correctForTimeslew"),
18  conf.getParameter<bool>("correctForPhaseContainment"),conf.getParameter<double>("correctionPhaseNS")),
20  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
21  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
22  firstSample_(conf.getParameter<int>("firstSample")),
23  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
24  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
25  paramTS(0),
26  theTopology(0)
27 {
28  // Intitialize "method 3"
30  conf.getParameter<bool> ("applyTimeSlewM3"),
31  conf.getParameter<double> ("pedestalUpperLimit"),
32  conf.getParameter<int> ("timeSlewParsType"),
33  conf.getParameter<std::vector<double> >("timeSlewPars"),
34  conf.getParameter<double> ("respCorrM3")
35  );
36 
37  // register for data access
38  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabel_);
39  tok_hf_ = consumes<HFDigiCollection>(inputLabel_);
40  tok_ho_ = consumes<HODigiCollection>(inputLabel_);
41  tok_calib_ = consumes<HcalCalibDigiCollection>(inputLabel_);
42 
43  std::string subd=conf.getParameter<std::string>("Subdetector");
44  if (!strcasecmp(subd.c_str(),"HO")) {
46  produces<HORecHitCollection>();
47  }
48  else if (!strcasecmp(subd.c_str(),"HBHE")) {
50  produces<HBHERecHitCollection>();
51  }
52  else if (!strcasecmp(subd.c_str(),"HF")) {
54  produces<HFRecHitCollection>();
55  }
56  else {
57  std::cout << "HcalSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
58  }
59 
60 }
void setMeth3Params(bool iApplyTimeSlew, float iPedSubThreshold, int iTimeSlewParsType, std::vector< double > iTimeSlewPars, double irespCorrM3)
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< HODigiCollection > tok_ho_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
HcalSimpleReconstructor::~HcalSimpleReconstructor ( )
virtual

Definition at line 73 of file HcalSimpleReconstructor.cc.

References paramTS, and theTopology.

73  {
74  delete paramTS;
75  delete theTopology;
76 }

Member Function Documentation

void HcalSimpleReconstructor::beginRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 78 of file HcalSimpleReconstructor.cc.

References HcalSimpleRecAlgo::beginRun(), edm::EventSetup::get(), AlCaHLTBitMon_ParallelJobs::p, paramTS, edm::ESHandle< T >::product(), reco_, HcalCondObjectContainerBase::setTopo(), theTopology, and tsFromDB_.

void HcalSimpleReconstructor::endRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 93 of file HcalSimpleReconstructor.cc.

References HcalSimpleRecAlgo::endRun(), paramTS, reco_, and tsFromDB_.

93  {
94  if(tsFromDB_ && paramTS) {
95  delete paramTS;
96  paramTS = 0;
97  reco_.endRun();
98  }
99 }
void HcalSimpleReconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 62 of file HcalSimpleReconstructor.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and edm::ParameterSetDescription::setAllowAnything().

62  {
64  desc.setAllowAnything();
65  desc.add<bool>("applyTimeSlewM3", true);
66  desc.add<double>("pedestalUpperLimit", 2.7);
67  desc.add<int>("timeSlewParsType",3);
68  desc.add<std::vector<double>>("timeSlewPars", { 12.2999, -2.19142, 0, 12.2999, -2.19142, 0, 12.2999, -2.19142, 0 });
69  desc.add<double>("respCorrM3", 1.0);
70  descriptions.add("simpleHbhereco",desc);
71 }
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<class DIGICOLL , class RECHITCOLL >
void HcalSimpleReconstructor::process ( edm::Event e,
const edm::EventSetup c,
const edm::EDGetTokenT< DIGICOLL > &  tok 
)
private

Definition at line 103 of file HcalSimpleReconstructor.cc.

References AlignmentProducer_cff::calibrations, dropZSmarkedPassed_, plotBeamSpotDB::first, HcalRecoParam::firstSample(), firstSample_, edm::EventSetup::get(), edm::Event::getByToken(), HcalDbService::getHcalCalibrations(), HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), HcalCondObjectContainer< Item >::getValues(), mps_fire::i, eostools::move(), paramTS, edm::Event::put(), DetId::rawId(), reco_, HcalSimpleRecAlgo::reconstruct(), HcalRecoParam::samplesToAdd(), samplesToAdd_, and tsFromDB_.

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

104 {
105  // get conditions
106  edm::ESHandle<HcalDbService> conditions;
107  eventSetup.get<HcalDbRecord>().get(conditions);
108 
110  e.getByToken(tok,digi);
111 
112  // create empty output
113  auto rec = std::make_unique<RECHITCOLL>();
114  rec->reserve(digi->size());
115  // run the algorithm
116  int first = firstSample_;
117  int toadd = samplesToAdd_;
118  typename DIGICOLL::const_iterator i;
119  for (i=digi->begin(); i!=digi->end(); i++) {
120  HcalDetId cell = i->id();
121  DetId detcell=(DetId)cell;
122  // rof 27.03.09: drop ZS marked and passed digis:
124  if (i->zsMarkAndPass()) continue;
125 
126  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
127  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
128  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
129  HcalCoderDb coder (*channelCoder, *shape);
130 
131  //>>> firstSample & samplesToAdd
132  if(tsFromDB_) {
133  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
134  first = param_ts->firstSample();
135  toadd = param_ts->samplesToAdd();
136  }
137  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
138  }
139  // return result
140  e.put(std::move(rec));
141 }
unsigned int firstSample() const
Definition: HcalRecoParam.h:32
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
HBHERecHit reconstruct(const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
const Item * getValues(DetId fId, bool throwOnFail=true) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:33
Definition: DetId.h:18
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
def move(src, dest)
Definition: eostools.py:510
void HcalSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
finaloverridevirtual

Definition at line 143 of file HcalSimpleReconstructor.cc.

References det_, MillePedeFileConverter_cfg::e, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, edm::EventBase::isRealData(), reco_, edm::Event::run(), HcalSimpleRecAlgo::setForData(), subdet_, subdetOther_, tok_calib_, tok_hbhe_, tok_hf_, and tok_ho_.

144 {
145  // HACK related to HB- corrections
146  if(e.isRealData()) reco_.setForData(e.run());
147 
148  if (det_==DetId::Hcal) {
149  if ((subdet_==HcalBarrel || subdet_==HcalEndcap)) {
150  process<HBHEDigiCollection, HBHERecHitCollection>(e, eventSetup, tok_hbhe_);
151  } else if (subdet_==HcalForward) {
152  process<HFDigiCollection, HFRecHitCollection>(e, eventSetup, tok_hf_);
153  } else if (subdet_==HcalOuter) {
154  process<HODigiCollection, HORecHitCollection>(e, eventSetup, tok_ho_);
155  } else if (subdet_==HcalOther && subdetOther_==HcalCalibration) {
156  process<HcalCalibDigiCollection, HcalCalibRecHitCollection>(e, eventSetup, tok_calib_);
157  }
158  }
159 }
bool isRealData() const
Definition: EventBase.h:64
HcalOtherSubdetector subdetOther_
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
RunNumber_t run() const
Definition: Event.h:94
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< HODigiCollection > tok_ho_
void setForData(int runnum)
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_

Member Data Documentation

DetId::Detector HcalSimpleReconstructor::det_
private

Definition at line 39 of file HcalSimpleReconstructor.h.

Referenced by produce().

bool HcalSimpleReconstructor::dropZSmarkedPassed_
private

Definition at line 49 of file HcalSimpleReconstructor.h.

Referenced by process().

int HcalSimpleReconstructor::firstSample_
private

Definition at line 53 of file HcalSimpleReconstructor.h.

Referenced by process().

edm::InputTag HcalSimpleReconstructor::inputLabel_
private

Definition at line 42 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor().

HcalRecoParams* HcalSimpleReconstructor::paramTS
private

Definition at line 57 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), endRun(), process(), and ~HcalSimpleReconstructor().

HcalSimpleRecAlgo HcalSimpleReconstructor::reco_
private

Definition at line 38 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), endRun(), HcalSimpleReconstructor(), process(), and produce().

int HcalSimpleReconstructor::samplesToAdd_
private

Definition at line 54 of file HcalSimpleReconstructor.h.

Referenced by process().

int HcalSimpleReconstructor::subdet_
private

Definition at line 40 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

HcalOtherSubdetector HcalSimpleReconstructor::subdetOther_
private

Definition at line 41 of file HcalSimpleReconstructor.h.

Referenced by produce().

HcalTopology* HcalSimpleReconstructor::theTopology
private

Definition at line 58 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), and ~HcalSimpleReconstructor().

edm::EDGetTokenT<HcalCalibDigiCollection> HcalSimpleReconstructor::tok_calib_
private

Definition at line 47 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

edm::EDGetTokenT<HBHEDigiCollection> HcalSimpleReconstructor::tok_hbhe_
private

Definition at line 44 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

edm::EDGetTokenT<HFDigiCollection> HcalSimpleReconstructor::tok_hf_
private

Definition at line 45 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

edm::EDGetTokenT<HODigiCollection> HcalSimpleReconstructor::tok_ho_
private

Definition at line 46 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

bool HcalSimpleReconstructor::tsFromDB_
private

Definition at line 55 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), endRun(), and process().