CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ZdcSimpleReconstructor.cc
Go to the documentation of this file.
10 
11 #include <iostream>
12 
14  : reco_(conf.getParameter<bool>("correctForTimeslew"),
15  conf.getParameter<bool>("correctForPhaseContainment"),
16  conf.getParameter<double>("correctionPhaseNS"),
17  conf.getParameter<int>("recoMethod"),
18  conf.getParameter<int>("lowGainOffset"),
19  conf.getParameter<double>("lowGainFrac")),
20  det_(DetId::Hcal),
21  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")) {
22  tok_input_castor = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelcastor"));
23  tok_input_hcal = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelhcal"));
24 
25  std::string subd = conf.getParameter<std::string>("Subdetector");
26  if (!strcasecmp(subd.c_str(), "ZDC")) {
27  det_ = DetId::Calo;
29  produces<ZDCRecHitCollection>();
30  } else if (!strcasecmp(subd.c_str(), "CALIB")) {
33  produces<HcalCalibRecHitCollection>();
34  } else {
35  std::cout << "ZdcSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
36  }
37 
38  hcalTimeSlew_delay_ = nullptr;
39 
40  // ES tokens
41  htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
42  paramsToken_ = esConsumes<HcalLongRecoParams, HcalLongRecoParamsRcd, edm::Transition::BeginRun>();
43  conditionsToken_ = esConsumes<HcalDbService, HcalDbRecord>();
44  timeSlewToken_ = esConsumes<HcalTimeSlew, HcalTimeSlewRecord>(edm::ESInputTag("", "HBHE"));
45 }
46 
48 
50  const HcalTopology& htopo = es.getData(htopoToken_);
52  longRecoParams_ = std::make_unique<HcalLongRecoParams>(p);
53  longRecoParams_->setTopo(&htopo);
54 
56 }
57 
59 
61  // get conditions
62  const HcalDbService* conditions = &eventSetup.getData(conditionsToken_);
63 
64  // define vectors to pass noiseTS and signalTS
65  std::vector<unsigned int> mySignalTS;
66  std::vector<unsigned int> myNoiseTS;
67 
70  e.getByToken(tok_input_hcal, digi);
71 
72  if (digi->empty()) {
74  if (digi->empty())
75  edm::LogInfo("ZdcHitReconstructor") << "No ZDC info found in either castorDigis or hcalDigis." << std::endl;
76  }
77 
78  // create empty output
79  auto rec = std::make_unique<ZDCRecHitCollection>();
80  rec->reserve(digi->size());
81  // run the algorithm
82  unsigned int toaddMem = 0;
83 
85  for (i = digi->begin(); i != digi->end(); i++) {
86  HcalZDCDetId cell = i->id();
87  DetId detcell = (DetId)cell;
88  // rof 27.03.09: drop ZS marked and passed digis:
90  if (i->zsMarkAndPass())
91  continue;
92 
93  // get db values for signalTSs and noiseTSs
94  const HcalLongRecoParam* myParams = longRecoParams_->getValues(detcell);
95  mySignalTS.clear();
96  myNoiseTS.clear();
97  mySignalTS = myParams->signalTS();
98  myNoiseTS = myParams->noiseTS();
99  // warning: the PulseCorrection is not used by ZDC. If it gets a non-contingious set of
100  // signal TS, it may not work properly. Assume contiguous here....
101  unsigned int toadd = mySignalTS.size();
102  if (toaddMem != toadd) {
104  toaddMem = toadd;
105  }
106  const HcalCalibrations& calibrations = conditions->getHcalCalibrations(cell);
107  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
108  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
109  HcalCoderDb coder(*channelCoder, *shape);
110  rec->push_back(reco_.reconstruct(*i, myNoiseTS, mySignalTS, coder, calibrations));
111  }
112  // return result
113  e.put(std::move(rec));
114  }
115 }
HcalOtherSubdetector subdetOther_
void endRun(edm::Run const &r, edm::EventSetup const &es) final
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< unsigned int > signalTS() const
void initPulseCorr(int toadd, const HcalTimeSlew *hcalTimeSlew_delay)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< ZDCDigiCollection > tok_input_hcal
std::vector< T >::const_iterator const_iterator
const HcalTimeSlew * hcalTimeSlew_delay_
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
ZdcSimpleReconstructor(const edm::ParameterSet &ps)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, const HcalCoder &coder, const HcalCalibrations &calibs) const
def move
Definition: eostools.py:511
edm::EDGetTokenT< ZDCDigiCollection > tok_input_castor
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
edm::ESGetToken< HcalLongRecoParams, HcalLongRecoParamsRcd > paramsToken_
Definition: DetId.h:17
std::unique_ptr< HcalLongRecoParams > longRecoParams_
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > timeSlewToken_
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
std::vector< unsigned int > noiseTS() const
tuple cout
Definition: gather_cfg.py:144
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
Definition: Run.h:45