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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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_.

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(nullptr),
26  theTopology(nullptr)
27 {
28 
29  // register for data access
30  tok_hf_ = consumes<HFDigiCollection>(inputLabel_);
31  tok_ho_ = consumes<HODigiCollection>(inputLabel_);
32  tok_calib_ = consumes<HcalCalibDigiCollection>(inputLabel_);
33 
34  std::string subd=conf.getParameter<std::string>("Subdetector");
35  if (!strcasecmp(subd.c_str(),"HO")) {
37  produces<HORecHitCollection>();
38  }
39  else if (!strcasecmp(subd.c_str(),"HF")) {
41  produces<HFRecHitCollection>();
42  }
43  else {
44  std::cout << "HcalSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
45  }
46 
47 }
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< HODigiCollection > tok_ho_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
HcalSimpleReconstructor::~HcalSimpleReconstructor ( )
override

Definition at line 49 of file HcalSimpleReconstructor.cc.

References paramTS, and theTopology.

49  {
50  delete paramTS;
51  delete theTopology;
52 }

Member Function Documentation

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

Definition at line 54 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 69 of file HcalSimpleReconstructor.cc.

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

69  {
70  if(tsFromDB_ && paramTS) {
71  delete paramTS;
72  paramTS = nullptr;
73  reco_.endRun();
74  }
75 }
void HcalSimpleReconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 133 of file HcalSimpleReconstructor.cc.

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

133  {
134 
135 
136  // horeco
138  descHO.add<double>("correctionPhaseNS", 13.0);
139  descHO.add<edm::InputTag>("digiLabel", edm::InputTag("hcalDigis"));
140  descHO.add<bool>("tsFromDB", true);
141  descHO.add<int>("samplesToAdd", 4);
142  descHO.add<std::string>("Subdetector", "HO");
143  descHO.add<bool>("correctForTimeslew", true);
144  descHO.add<bool>("dropZSmarkedPassed", true);
145  descHO.add<bool>("correctForPhaseContainment", true);
146  descHO.add<int>("firstSample", 4);
147  descriptions.add("hosimplereco", descHO);
148 
149  // hfreco
151  descHF.add<double>("correctionPhaseNS", 0.0);
152  descHF.add<edm::InputTag>("digiLabel", edm::InputTag("hcalDigis"));
153  descHF.add<bool>("tsFromDB", true);
154  descHF.add<int>("samplesToAdd", 2);
155  descHF.add<std::string>("Subdetector", "HF");
156  descHF.add<bool>("correctForTimeslew", false);
157  descHF.add<bool>("dropZSmarkedPassed", true);
158  descHF.add<bool>("correctForPhaseContainment", false);
159  descHF.add<int>("firstSample", 4);
160  descriptions.add("hfsimplereco", descHF);
161 }
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 79 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_.

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

Definition at line 119 of file HcalSimpleReconstructor.cc.

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

120 {
121  if (det_==DetId::Hcal) {
122  if (subdet_==HcalForward) {
123  process<HFDigiCollection, HFRecHitCollection>(e, eventSetup, tok_hf_);
124  } else if (subdet_==HcalOuter) {
125  process<HODigiCollection, HORecHitCollection>(e, eventSetup, tok_ho_);
126  } else if (subdet_==HcalOther && subdetOther_==HcalCalibration) {
127  process<HcalCalibDigiCollection, HcalCalibRecHitCollection>(e, eventSetup, tok_calib_);
128  }
129  }
130 }
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 38 of file HcalSimpleReconstructor.h.

Referenced by produce().

bool HcalSimpleReconstructor::dropZSmarkedPassed_
private

Definition at line 47 of file HcalSimpleReconstructor.h.

Referenced by process().

int HcalSimpleReconstructor::firstSample_
private

Definition at line 51 of file HcalSimpleReconstructor.h.

Referenced by process().

edm::InputTag HcalSimpleReconstructor::inputLabel_
private

Definition at line 41 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor().

HcalRecoParams* HcalSimpleReconstructor::paramTS
private

Definition at line 55 of file HcalSimpleReconstructor.h.

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

HcalSimpleRecAlgo HcalSimpleReconstructor::reco_
private

Definition at line 37 of file HcalSimpleReconstructor.h.

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

int HcalSimpleReconstructor::samplesToAdd_
private

Definition at line 52 of file HcalSimpleReconstructor.h.

Referenced by process().

int HcalSimpleReconstructor::subdet_
private

Definition at line 39 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

HcalOtherSubdetector HcalSimpleReconstructor::subdetOther_
private

Definition at line 40 of file HcalSimpleReconstructor.h.

Referenced by produce().

HcalTopology* HcalSimpleReconstructor::theTopology
private

Definition at line 56 of file HcalSimpleReconstructor.h.

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

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

Definition at line 45 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

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

Definition at line 43 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

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

Definition at line 44 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

bool HcalSimpleReconstructor::tsFromDB_
private

Definition at line 53 of file HcalSimpleReconstructor.h.

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