CMS 3D CMS Logo

HcalSimpleReconstructor.cc
Go to the documentation of this file.
13 
14 #include <iostream>
15 
17  : reco_(conf.getParameter<bool>("correctForTimeslew"),
18  conf.getParameter<bool>("correctForPhaseContainment"),
19  conf.getParameter<double>("correctionPhaseNS")),
20  det_(DetId::Hcal),
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 }
44 
46  delete paramTS;
47  delete theTopology;
48 }
49 
51  if (tsFromDB_) {
53  es.get<HcalRecoParamsRcd>().get(p);
54  paramTS = new HcalRecoParams(*p.product());
55 
57  es.get<HcalRecNumberingRecord>().get(htopo);
58  theTopology = new HcalTopology(*htopo);
60  }
61  reco_.beginRun(es);
62 }
63 
65  if (tsFromDB_ && paramTS) {
66  delete paramTS;
67  paramTS = nullptr;
68  reco_.endRun();
69  }
70 }
71 
72 template <class DIGICOLL, class RECHITCOLL>
74  const edm::EventSetup& eventSetup,
75  const edm::EDGetTokenT<DIGICOLL>& tok) {
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 }
114 
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 }
126 
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 }
ConfigurationDescriptions.h
HcalOther
Definition: HcalAssistant.h:38
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:372
HcalCalibrations.h
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
HcalSimpleReconstructor::tsFromDB_
bool tsFromDB_
Definition: HcalSimpleReconstructor.h:54
HcalCondObjectContainerBase::setTopo
void setTopo(const HcalTopology *topo)
Definition: HcalCondObjectContainerBase.cc:17
ESHandle.h
HcalSimpleReconstructor::reco_
HcalSimpleRecAlgo reco_
Definition: HcalSimpleReconstructor.h:38
HcalSimpleReconstructor::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HcalSimpleReconstructor.cc:127
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalTopology
Definition: HcalTopology.h:26
DetId::Hcal
Definition: DetId.h:28
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HcalSimpleReconstructor::paramTS
HcalRecoParams * paramTS
Definition: HcalSimpleReconstructor.h:56
AlignmentProducer_cff.calibrations
calibrations
Definition: AlignmentProducer_cff.py:59
HcalSimpleRecAlgo::beginRun
void beginRun(edm::EventSetup const &es)
Definition: HcalSimpleRecAlgo.cc:31
edm::Handle
Definition: AssociativeIterator.h:50
HcalSimpleReconstructor::HcalSimpleReconstructor
HcalSimpleReconstructor(const edm::ParameterSet &ps)
Definition: HcalSimpleReconstructor.cc:16
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
HcalDbService::getHcalShape
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:326
HcalCoderDb.h
HcalDbService::getHcalCalibrations
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:65
HcalDbService::getHcalCoder
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:319
HcalSimpleReconstructor::subdetOther_
HcalOtherSubdetector subdetOther_
Definition: HcalSimpleReconstructor.h:41
DetId
Definition: DetId.h:17
HcalSimpleReconstructor::process
void process(edm::Event &e, const edm::EventSetup &c, const edm::EDGetTokenT< DIGICOLL > &tok)
Definition: HcalSimpleReconstructor.cc:73
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
HcalRecoParam
Definition: HcalRecoParam.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HcalSimpleReconstructor::produce
void produce(edm::Event &e, const edm::EventSetup &c) final
Definition: HcalSimpleReconstructor.cc:115
HcalSimpleReconstructor::beginRun
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
Definition: HcalSimpleReconstructor.cc:50
edm::ESHandle
Definition: DTSurvey.h:22
HcalSimpleReconstructor::tok_ho_
edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalSimpleReconstructor.h:45
HcalOuter
Definition: HcalAssistant.h:35
HcalCalibration
Definition: HcalAssistant.h:40
HcalSimpleReconstructor::subdet_
int subdet_
Definition: HcalSimpleReconstructor.h:40
HcalDbRecord.h
HcalCalibrations
Definition: HcalCalibrations.h:9
ParameterSetDescription.h
HcalRecoParam::samplesToAdd
constexpr unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:32
HcalRecNumberingRecord
Definition: HcalRecNumberingRecord.h:23
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
HcalSimpleReconstructor::dropZSmarkedPassed_
bool dropZSmarkedPassed_
Definition: HcalSimpleReconstructor.h:48
edm::ParameterSet
Definition: ParameterSet.h:36
HcalSimpleReconstructor::theTopology
HcalTopology * theTopology
Definition: HcalSimpleReconstructor.h:57
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup
Definition: EventSetup.h:57
HcalSimpleReconstructor::firstSample_
int firstSample_
Definition: HcalSimpleReconstructor.h:52
get
#define get
HcalQIECoder
Definition: HcalQIECoder.h:20
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalSimpleReconstructor::samplesToAdd_
int samplesToAdd_
Definition: HcalSimpleReconstructor.h:53
HcalForward
Definition: HcalAssistant.h:36
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HcalSimpleReconstructor::tok_hf_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalSimpleReconstructor.h:44
HcalRecoParam::firstSample
constexpr unsigned int firstSample() const
Definition: HcalRecoParam.h:31
HcalTopology.h
HcalSimpleReconstructor::endRun
void endRun(edm::Run const &r, edm::EventSetup const &es) final
Definition: HcalSimpleReconstructor.cc:64
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HcalRecoParams
Definition: HcalRecoParams.h:9
HcalSimpleReconstructor::tok_calib_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
Definition: HcalSimpleReconstructor.h:46
HcalRecoParamsRcd
Definition: HcalRecoParamsRcd.h:6
EventSetup.h
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalCoderDb
Definition: HcalCoderDb.h:15
HcalDbService.h
HcalSimpleRecAlgo::endRun
void endRun()
Definition: HcalSimpleRecAlgo.cc:39
HcalDbRecord
Definition: HcalDbRecord.h:30
HcalSimpleReconstructor::~HcalSimpleReconstructor
~HcalSimpleReconstructor() override
Definition: HcalSimpleReconstructor.cc:45
edm::Event
Definition: Event.h:73
HcalSimpleRecAlgo::reconstruct
HFRecHit reconstruct(const HFDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
Definition: HcalSimpleRecAlgo.cc:378
EDCollection.h
edm::InputTag
Definition: InputTag.h:15
HcalSimpleReconstructor::det_
DetId::Detector det_
Definition: HcalSimpleReconstructor.h:39
HcalSimpleReconstructor::inputLabel_
edm::InputTag inputLabel_
Definition: HcalSimpleReconstructor.h:42
HcalSimpleReconstructor.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37