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  consumesCollector()),
21  det_(DetId::Hcal),
22  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
23  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
24  firstSample_(conf.getParameter<int>("firstSample")),
25  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
26  tsFromDB_(conf.getParameter<bool>("tsFromDB")) {
27  // register for data access
28  tok_hf_ = consumes<HFDigiCollection>(inputLabel_);
29  tok_ho_ = consumes<HODigiCollection>(inputLabel_);
30  tok_calib_ = consumes<HcalCalibDigiCollection>(inputLabel_);
31 
32  std::string subd = conf.getParameter<std::string>("Subdetector");
33  if (!strcasecmp(subd.c_str(), "HO")) {
35  produces<HORecHitCollection>();
36  } else if (!strcasecmp(subd.c_str(), "HF")) {
38  produces<HFRecHitCollection>();
39  } else {
40  std::cout << "HcalSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
41  }
42 
43  // ES tokens
44  if (tsFromDB_) {
45  htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
46  paramsToken_ = esConsumes<HcalRecoParams, HcalRecoParamsRcd, edm::Transition::BeginRun>();
47  }
48  conditionsToken_ = esConsumes<HcalDbService, HcalDbRecord>();
49 }
50 
52 
54  if (tsFromDB_) {
55  const HcalTopology& htopo = es.getData(htopoToken_);
56  const HcalRecoParams& p = es.getData(paramsToken_);
57  paramTS_ = std::make_unique<HcalRecoParams>(p);
58  paramTS_->setTopo(&htopo);
59  }
60  reco_.beginRun(es);
61 }
62 
64 
65 template <class DIGICOLL, class RECHITCOLL>
67  const edm::EventSetup& eventSetup,
68  const edm::EDGetTokenT<DIGICOLL>& tok) {
69  // get conditions
70  const HcalDbService* conditions = &eventSetup.getData(conditionsToken_);
71 
73  e.getByToken(tok, digi);
74 
75  // create empty output
76  auto rec = std::make_unique<RECHITCOLL>();
77  rec->reserve(digi->size());
78  // run the algorithm
79  int first = firstSample_;
80  int toadd = samplesToAdd_;
81  typename DIGICOLL::const_iterator i;
82  for (i = digi->begin(); i != digi->end(); i++) {
83  HcalDetId cell = i->id();
84  DetId detcell = (DetId)cell;
85  // rof 27.03.09: drop ZS marked and passed digis:
87  if (i->zsMarkAndPass())
88  continue;
89 
90  const HcalCalibrations& calibrations = conditions->getHcalCalibrations(cell);
91  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
92  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
93  HcalCoderDb coder(*channelCoder, *shape);
94 
95  //>>> firstSample & samplesToAdd
96  if (tsFromDB_) {
97  const HcalRecoParam* param_ts = paramTS_->getValues(detcell.rawId());
98  first = param_ts->firstSample();
99  toadd = param_ts->samplesToAdd();
100  }
101  rec->push_back(reco_.reconstruct(*i, first, toadd, coder, calibrations));
102  }
103  // return result
104  e.put(std::move(rec));
105 }
106 
108  if (det_ == DetId::Hcal) {
109  if (subdet_ == HcalForward) {
110  process<HFDigiCollection, HFRecHitCollection>(e, eventSetup, tok_hf_);
111  } else if (subdet_ == HcalOuter) {
112  process<HODigiCollection, HORecHitCollection>(e, eventSetup, tok_ho_);
113  } else if (subdet_ == HcalOther && subdetOther_ == HcalCalibration) {
114  process<HcalCalibDigiCollection, HcalCalibRecHitCollection>(e, eventSetup, tok_calib_);
115  }
116  }
117 }
118 
120  // horeco
122  descHO.add<double>("correctionPhaseNS", 13.0);
123  descHO.add<edm::InputTag>("digiLabel", edm::InputTag("hcalDigis"));
124  descHO.add<bool>("tsFromDB", true);
125  descHO.add<int>("samplesToAdd", 4);
126  descHO.add<std::string>("Subdetector", "HO");
127  descHO.add<bool>("correctForTimeslew", true);
128  descHO.add<bool>("dropZSmarkedPassed", true);
129  descHO.add<bool>("correctForPhaseContainment", true);
130  descHO.add<int>("firstSample", 4);
131  descriptions.add("hosimplereco", descHO);
132 
133  // hfreco
135  descHF.add<double>("correctionPhaseNS", 0.0);
136  descHF.add<edm::InputTag>("digiLabel", edm::InputTag("hcalDigis"));
137  descHF.add<bool>("tsFromDB", true);
138  descHF.add<int>("samplesToAdd", 2);
139  descHF.add<std::string>("Subdetector", "HF");
140  descHF.add<bool>("correctForTimeslew", false);
141  descHF.add<bool>("dropZSmarkedPassed", true);
142  descHF.add<bool>("correctForPhaseContainment", false);
143  descHF.add<int>("firstSample", 4);
144  descriptions.add("hfsimplereco", descHF);
145 }
ConfigurationDescriptions.h
HcalOther
Definition: HcalAssistant.h:38
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
HcalCalibrations.h
mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
HcalSimpleReconstructor::tsFromDB_
bool tsFromDB_
Definition: HcalSimpleReconstructor.h:61
HcalSimpleReconstructor::reco_
HcalSimpleRecAlgo reco_
Definition: HcalSimpleReconstructor.h:45
HcalSimpleReconstructor::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HcalSimpleReconstructor.cc:119
HcalSimpleReconstructor::paramTS_
std::unique_ptr< HcalRecoParams > paramTS_
Definition: HcalSimpleReconstructor.h:63
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
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
AlignmentProducer_cff.calibrations
calibrations
Definition: AlignmentProducer_cff.py:59
HcalSimpleReconstructor::paramsToken_
edm::ESGetToken< HcalRecoParams, HcalRecoParamsRcd > paramsToken_
Definition: HcalSimpleReconstructor.h:67
HcalSimpleRecAlgo::beginRun
void beginRun(edm::EventSetup const &es)
Definition: HcalSimpleRecAlgo.cc:35
edm::Handle
Definition: AssociativeIterator.h:50
HcalSimpleReconstructor::HcalSimpleReconstructor
HcalSimpleReconstructor(const edm::ParameterSet &ps)
Definition: HcalSimpleReconstructor.cc:16
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HcalCoderDb.h
HcalSimpleReconstructor::subdetOther_
HcalOtherSubdetector subdetOther_
Definition: HcalSimpleReconstructor.h:48
DetId
Definition: DetId.h:17
HcalSimpleReconstructor::process
void process(edm::Event &e, const edm::EventSetup &c, const edm::EDGetTokenT< DIGICOLL > &tok)
Definition: HcalSimpleReconstructor.cc:66
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:107
HcalSimpleReconstructor::beginRun
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
Definition: HcalSimpleReconstructor.cc:53
HcalSimpleReconstructor::tok_ho_
edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalSimpleReconstructor.h:52
HcalOuter
Definition: HcalAssistant.h:35
HcalCalibration
Definition: HcalAssistant.h:40
HcalSimpleReconstructor::subdet_
int subdet_
Definition: HcalSimpleReconstructor.h:47
HcalDbRecord.h
HcalCalibrations
Definition: HcalCalibrations.h:9
ParameterSetDescription.h
HcalRecoParam::samplesToAdd
constexpr unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalSimpleReconstructor::dropZSmarkedPassed_
bool dropZSmarkedPassed_
Definition: HcalSimpleReconstructor.h:55
edm::ParameterSet
Definition: ParameterSet.h:47
HcalSimpleReconstructor::htopoToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
Definition: HcalSimpleReconstructor.h:66
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:59
HcalQIECoder
Definition: HcalQIECoder.h:20
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalSimpleReconstructor::samplesToAdd_
int samplesToAdd_
Definition: HcalSimpleReconstructor.h:60
HcalForward
Definition: HcalAssistant.h:36
HcalSimpleReconstructor::conditionsToken_
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
Definition: HcalSimpleReconstructor.h:68
HcalSimpleReconstructor::tok_hf_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalSimpleReconstructor.h:51
HcalRecoParam::firstSample
constexpr unsigned int firstSample() const
Definition: HcalRecoParam.h:31
HcalTopology.h
HcalDbService
Definition: HcalDbService.h:26
HcalSimpleReconstructor::endRun
void endRun(edm::Run const &r, edm::EventSetup const &es) final
Definition: HcalSimpleReconstructor.cc:63
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
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:53
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalCoderDb
Definition: HcalCoderDb.h:15
HcalDbService.h
HcalSimpleRecAlgo::endRun
void endRun()
Definition: HcalSimpleRecAlgo.cc:41
ConsumesCollector.h
HcalSimpleReconstructor::~HcalSimpleReconstructor
~HcalSimpleReconstructor() override
Definition: HcalSimpleReconstructor.cc:51
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:380
EDCollection.h
edm::InputTag
Definition: InputTag.h:15
HcalSimpleReconstructor::det_
DetId::Detector det_
Definition: HcalSimpleReconstructor.h:46
HcalSimpleReconstructor::inputLabel_
edm::InputTag inputLabel_
Definition: HcalSimpleReconstructor.h:49
HcalSimpleReconstructor.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37