CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_ = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabel"));
24 
25  std::string subd=conf.getParameter<std::string>("Subdetector");
26  if (!strcasecmp(subd.c_str(),"ZDC")) {
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 }
39 
41 }
43 
45  es.get<HcalLongRecoParamsRcd>().get(p);
47 }
48 
50  delete myobject; myobject = 0;
51 }
53 {
54  // get conditions
56  eventSetup.get<HcalDbRecord>().get(conditions);
57  // define vectors to pass noiseTS and signalTS
58  std::vector<unsigned int> mySignalTS;
59  std::vector<unsigned int> myNoiseTS;
60 
63  e.getByToken(tok_input_,digi);
64 
65  // create empty output
66  std::auto_ptr<ZDCRecHitCollection> rec(new ZDCRecHitCollection);
67  rec->reserve(digi->size());
68  // run the algorithm
69  unsigned int toaddMem = 0;
70 
72  for (i=digi->begin(); i!=digi->end(); i++) {
73  HcalZDCDetId cell = i->id();
74  DetId detcell=(DetId)cell;
75  // rof 27.03.09: drop ZS marked and passed digis:
77  if (i->zsMarkAndPass()) continue;
78 
79 // get db values for signalTSs and noiseTSs
80  const HcalLongRecoParam* myParams = myobject->getValues(detcell);
81  mySignalTS.clear();
82  myNoiseTS.clear();
83  mySignalTS = myParams->signalTS();
84  myNoiseTS = myParams->noiseTS();
85 // warning: the PulseCorrection is not used by ZDC. If it gets a non-contingious set of
86 // signal TS, it may not work properly. Assume contiguous here....
87  unsigned int toadd = mySignalTS.size();
88  if(toaddMem != toadd) {
89  reco_.initPulseCorr(toadd);
90  toaddMem = toadd;
91  }
92  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
93  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
94  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
95  HcalCoderDb coder (*channelCoder, *shape);
96  rec->push_back(reco_.reconstruct(*i,myNoiseTS,mySignalTS,coder,calibrations));
97  }
98  // return result
99  e.put(rec);
100  }
101 }
virtual void produce(edm::Event &e, const edm::EventSetup &c)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
HcalOtherSubdetector subdetOther_
std::vector< unsigned int > signalTS() const
HcalLongRecoParams * myobject
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< ZDCDataFrame >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
virtual void endRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
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
void initPulseCorr(int toadd)
virtual void beginRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
tuple conf
Definition: dbtoconf.py:185
Definition: DetId.h:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:20
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::vector< unsigned int > noiseTS() const
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< ZDCDigiCollection > tok_input_
Definition: Run.h:43