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

Public Member Functions

void beginRun (edm::Run const &r, edm::EventSetup const &es) final
 
void endRun (edm::Run const &r, edm::EventSetup const &es) final
 
 HcalSimpleReconstructor (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) final
 
 ~HcalSimpleReconstructor () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::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< 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
 

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(), HcalForward, HcalOuter, inputLabel_, AlCaHLTBitMon_QueryRunRegistry::string, subdet_, tok_calib_, tok_hf_, and tok_ho_.

17  : reco_(conf.getParameter<bool>("correctForTimeslew"),
18  conf.getParameter<bool>("correctForPhaseContainment"),
19  conf.getParameter<double>("correctionPhaseNS")),
21  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
22  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
23  firstSample_(conf.getParameter<int>("firstSample")),
24  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
25  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
26  paramTS(nullptr),
27  theTopology(nullptr) {
28  // register for data access
29  tok_hf_ = consumes<HFDigiCollection>(inputLabel_);
30  tok_ho_ = consumes<HODigiCollection>(inputLabel_);
31  tok_calib_ = consumes<HcalCalibDigiCollection>(inputLabel_);
32 
33  std::string subd = conf.getParameter<std::string>("Subdetector");
34  if (!strcasecmp(subd.c_str(), "HO")) {
36  produces<HORecHitCollection>();
37  } else if (!strcasecmp(subd.c_str(), "HF")) {
39  produces<HFRecHitCollection>();
40  } else {
41  std::cout << "HcalSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
42  }
43 }
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< HODigiCollection > tok_ho_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
HcalSimpleReconstructor::~HcalSimpleReconstructor ( )
override

Definition at line 45 of file HcalSimpleReconstructor.cc.

References paramTS, and theTopology.

45  {
46  delete paramTS;
47  delete theTopology;
48 }

Member Function Documentation

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

Definition at line 50 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 
)
final

Definition at line 64 of file HcalSimpleReconstructor.cc.

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

64  {
65  if (tsFromDB_ && paramTS) {
66  delete paramTS;
67  paramTS = nullptr;
68  reco_.endRun();
69  }
70 }
void HcalSimpleReconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 127 of file HcalSimpleReconstructor.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

127  {
128  // horeco
130  descHO.add<double>("correctionPhaseNS", 13.0);
131  descHO.add<edm::InputTag>("digiLabel", edm::InputTag("hcalDigis"));
132  descHO.add<bool>("tsFromDB", true);
133  descHO.add<int>("samplesToAdd", 4);
134  descHO.add<std::string>("Subdetector", "HO");
135  descHO.add<bool>("correctForTimeslew", true);
136  descHO.add<bool>("dropZSmarkedPassed", true);
137  descHO.add<bool>("correctForPhaseContainment", true);
138  descHO.add<int>("firstSample", 4);
139  descriptions.add("hosimplereco", descHO);
140 
141  // hfreco
143  descHF.add<double>("correctionPhaseNS", 0.0);
144  descHF.add<edm::InputTag>("digiLabel", edm::InputTag("hcalDigis"));
145  descHF.add<bool>("tsFromDB", true);
146  descHF.add<int>("samplesToAdd", 2);
147  descHF.add<std::string>("Subdetector", "HF");
148  descHF.add<bool>("correctForTimeslew", false);
149  descHF.add<bool>("dropZSmarkedPassed", true);
150  descHF.add<bool>("correctForPhaseContainment", false);
151  descHF.add<int>("firstSample", 4);
152  descriptions.add("hfsimplereco", descHF);
153 }
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 73 of file HcalSimpleReconstructor.cc.

References AlignmentProducer_cff::calibrations, dropZSmarkedPassed_, dqmdumpme::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_.

75  {
76  // get conditions
78  eventSetup.get<HcalDbRecord>().get(conditions);
79 
81  e.getByToken(tok, digi);
82 
83  // create empty output
84  auto rec = std::make_unique<RECHITCOLL>();
85  rec->reserve(digi->size());
86  // run the algorithm
87  int first = firstSample_;
88  int toadd = samplesToAdd_;
89  typename DIGICOLL::const_iterator i;
90  for (i = digi->begin(); i != digi->end(); i++) {
91  HcalDetId cell = i->id();
92  DetId detcell = (DetId)cell;
93  // rof 27.03.09: drop ZS marked and passed digis:
95  if (i->zsMarkAndPass())
96  continue;
97 
98  const HcalCalibrations& calibrations = conditions->getHcalCalibrations(cell);
99  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
100  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
101  HcalCoderDb coder(*channelCoder, *shape);
102 
103  //>>> firstSample & samplesToAdd
104  if (tsFromDB_) {
105  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
106  first = param_ts->firstSample();
107  toadd = param_ts->samplesToAdd();
108  }
109  rec->push_back(reco_.reconstruct(*i, first, toadd, coder, calibrations));
110  }
111  // return result
112  e.put(std::move(rec));
113 }
constexpr unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:32
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const Item * getValues(DetId fId, bool throwOnFail=true) const
HFRecHit reconstruct(const HFDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
Definition: DetId.h:17
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:511
constexpr unsigned int firstSample() const
Definition: HcalRecoParam.h:31
void HcalSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
final

Definition at line 115 of file HcalSimpleReconstructor.cc.

References det_, MillePedeFileConverter_cfg::e, DetId::Hcal, HcalCalibration, HcalForward, HcalOther, HcalOuter, subdet_, subdetOther_, tok_calib_, tok_hf_, and tok_ho_.

115  {
116  if (det_ == DetId::Hcal) {
117  if (subdet_ == HcalForward) {
118  process<HFDigiCollection, HFRecHitCollection>(e, eventSetup, tok_hf_);
119  } else if (subdet_ == HcalOuter) {
120  process<HODigiCollection, HORecHitCollection>(e, eventSetup, tok_ho_);
121  } else if (subdet_ == HcalOther && subdetOther_ == HcalCalibration) {
122  process<HcalCalibDigiCollection, HcalCalibRecHitCollection>(e, eventSetup, tok_calib_);
123  }
124  }
125 }
HcalOtherSubdetector subdetOther_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< HODigiCollection > tok_ho_
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 48 of file HcalSimpleReconstructor.h.

Referenced by process().

int HcalSimpleReconstructor::firstSample_
private

Definition at line 52 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 56 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(), and process().

int HcalSimpleReconstructor::samplesToAdd_
private

Definition at line 53 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 57 of file HcalSimpleReconstructor.h.

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

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

Definition at line 46 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

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

Definition at line 44 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

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

Definition at line 45 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

bool HcalSimpleReconstructor::tsFromDB_
private

Definition at line 54 of file HcalSimpleReconstructor.h.

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