CMS 3D CMS Logo

ZdcSimpleReconstructor.cc
Go to the documentation of this file.
10 
11 #include <iostream>
12 
13 
15  reco_(conf.getParameter<bool>("correctForTimeslew"),
16  conf.getParameter<bool>("correctForPhaseContainment"),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 {
23  tok_input_castor = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelcastor"));
24  tok_input_hcal = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelhcal"));
25 
26 
27  std::string subd=conf.getParameter<std::string>("Subdetector");
28  if (!strcasecmp(subd.c_str(),"ZDC")) {
31  produces<ZDCRecHitCollection>();
32  } else if (!strcasecmp(subd.c_str(),"CALIB")) {
35  produces<HcalCalibRecHitCollection>();
36  } else {
37  std::cout << "ZdcSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
38  }
39 
40  hcalTimeSlew_delay_ = nullptr;
41 }
42 
44 }
46 
48  es.get<HcalLongRecoParamsRcd>().get(p);
50 
52  es.get<HcalTimeSlewRecord>().get("HBHE", delay);
53  hcalTimeSlew_delay_ = &*delay;
54 }
55 
57  delete myobject; myobject = nullptr;
58 }
60 {
61  // get conditions
63  eventSetup.get<HcalDbRecord>().get(conditions);
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()) continue;
91 
92 // get db values for signalTSs and noiseTSs
93  const HcalLongRecoParam* myParams = myobject->getValues(detcell);
94  mySignalTS.clear();
95  myNoiseTS.clear();
96  mySignalTS = myParams->signalTS();
97  myNoiseTS = myParams->noiseTS();
98 // warning: the PulseCorrection is not used by ZDC. If it gets a non-contingious set of
99 // signal TS, it may not work properly. Assume contiguous here....
100  unsigned int toadd = mySignalTS.size();
101  if(toaddMem != toadd) {
103  toaddMem = toadd;
104  }
105  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
106  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
107  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
108  HcalCoderDb coder (*channelCoder, *shape);
109  rec->push_back(reco_.reconstruct(*i,myNoiseTS,mySignalTS,coder,calibrations));
110  }
111  // return result
112  e.put(std::move(rec));
113  }
114 }
T getParameter(std::string const &) const
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:137
std::vector< unsigned int > signalTS() const
HcalLongRecoParams * myobject
void initPulseCorr(int toadd, const HcalTimeSlew *hcalTimeSlew_delay)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< ZDCDigiCollection > tok_input_hcal
std::vector< ZDCDataFrame >::const_iterator const_iterator
const HcalTimeSlew * hcalTimeSlew_delay_
const Item * getValues(DetId fId, bool throwOnFail=true) const
ZdcSimpleReconstructor(const edm::ParameterSet &ps)
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, const HcalCoder &coder, const HcalCalibrations &calibs) const
edm::EDGetTokenT< ZDCDigiCollection > tok_input_castor
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
const_iterator end() const
Definition: DetId.h:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
size_type size() const
T get() const
Definition: EventSetup.h:68
std::vector< unsigned int > noiseTS() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
T const * product() const
Definition: ESHandle.h:84
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const
Definition: Run.h:44