CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZdcHitReconstructor.cc
Go to the documentation of this file.
1 #include "ZdcHitReconstructor.h"
15 
16 #include <iostream>
17 
18 /* Zdc Hit reconstructor allows for CaloRecHits with status words */
19 
21  reco_(conf.getParameter<bool>("correctForTimeslew"),
22  conf.getParameter<bool>("correctForPhaseContainment"),
23  conf.getParameter<double>("correctionPhaseNS"),
24  conf.getParameter<int>("recoMethod"),
25  conf.getParameter<int>("lowGainOffset"),
26  conf.getParameter<double>("lowGainFrac")),
27  det_(DetId::Hcal),
28  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
29  correctTiming_(conf.getParameter<bool>("correctTiming")),
30  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
31  setHSCPFlags_(conf.getParameter<bool>("setHSCPFlags")),
32  setSaturationFlags_(conf.getParameter<bool>("setSaturationFlags")),
33  setTimingTrustFlags_(conf.getParameter<bool>("setTimingTrustFlags")),
34  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
35  AuxTSvec_(conf.getParameter<std::vector<int> >("AuxTSvec")),
36  myobject(0),
37  theTopology(0)
38 
39 {
40  std::sort(AuxTSvec_.begin(),AuxTSvec_.end()); // sort vector in ascending TS order
41  std::string subd=conf.getParameter<std::string>("Subdetector");
42 
44  {
45  const edm::ParameterSet& pssat = conf.getParameter<edm::ParameterSet>("saturationParameters");
46  saturationFlagSetter_ = new HcalADCSaturationFlag(pssat.getParameter<int>("maxADCvalue"));
47  }
48  if (!strcasecmp(subd.c_str(),"ZDC")) {
51  produces<ZDCRecHitCollection>();
52  } else if (!strcasecmp(subd.c_str(),"CALIB")) {
55  produces<HcalCalibRecHitCollection>();
56  } else {
57  std::cout << "ZdcHitReconstructor is not associated with a specific subdetector!" << std::endl;
58  }
59 
60 }
61 
63 }
65 
67  es.get<HcalLongRecoParamsRcd>().get(p);
69 
71  es.get<IdealGeometryRecord>().get(htopo);
72  theTopology=new HcalTopology(*htopo);
74 
75 }
76 
78  delete myobject; myobject=0;
79  delete theTopology; theTopology=0;
80 }
82 {
83  // get conditions
85  eventSetup.get<HcalDbRecord>().get(conditions);
86 
88  eventSetup.get<HcalChannelQualityRcd>().get(p);
89  HcalChannelQuality* myqual = new HcalChannelQuality(*p.product());
90 
92  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
93  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
94 
95  // define vectors to pass noiseTS and signalTS
96  std::vector<unsigned int> mySignalTS;
97  std::vector<unsigned int> myNoiseTS;
98 
101  e.getByLabel(inputLabel_,digi);
102 
103  // create empty output
104  std::auto_ptr<ZDCRecHitCollection> rec(new ZDCRecHitCollection);
105  rec->reserve(digi->size());
106  // run the algorithm
108  for (i=digi->begin(); i!=digi->end(); i++) {
109  HcalZDCDetId cell = i->id();
110  DetId detcell=(DetId)cell;
111  // check on cells to be ignored and dropped: (rof,20.Feb.09)
112  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
113  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
115  if (i->zsMarkAndPass()) continue;
116  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
117  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
118  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
119  HcalCoderDb coder (*channelCoder, *shape);
120 
121 // get db values for signalTSs and noiseTSs
122  const HcalLongRecoParam* myParams = myobject->getValues(detcell);
123  mySignalTS.clear();
124  myNoiseTS.clear();
125  mySignalTS = myParams->signalTS();
126  myNoiseTS = myParams->noiseTS();
127 
128  rec->push_back(reco_.reconstruct(*i,myNoiseTS,mySignalTS,coder,calibrations));
129  (rec->back()).setFlags(0);
131  saturationFlagSetter_->setSaturationFlag(rec->back(),*i);
132 
133  // Set auxiliary flag with subset of digi information
134  // ZDC aux flag can store non-contiguous set of values
135  int auxflag=0;
136  for (unsigned int xx=0; xx<AuxTSvec_.size() && xx<4;++xx)
137  {
138  if (AuxTSvec_[xx]<0 || AuxTSvec_[xx]>9) continue; // don't allow
139  auxflag+=(i->sample(AuxTSvec_[xx]).adc())<<(7*xx); // store the time slices in the first 28 bits of aux, a set of 4 7-bit a dc values
140  }
141  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
142  if (AuxTSvec_.size()>0)
143  auxflag+=((i->sample(AuxTSvec_[0]).capid())<<28);
144  (rec->back()).setAux(auxflag);
145  }
146  // return result
147  e.put(rec);
148  } // else if (det_==DetId::Calo...)
149 
150  delete myqual;
151 } // void HcalHitReconstructor::produce(...)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int > signalTS() const
HcalTopology * theTopology
std::vector< T >::const_iterator const_iterator
void setTopo(const HcalTopology *topo) const
const Item * getValues(DetId fId, bool throwOnFail=true) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, const HcalCoder &coder, const HcalCalibrations &calibs) const
ZdcSimpleRecAlgo reco_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
HcalOtherSubdetector subdetOther_
virtual void beginRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
HcalLongRecoParams * myobject
bool dropChannel(const uint32_t &mystatus) const
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
HcalADCSaturationFlag * saturationFlagSetter_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple conf
Definition: dbtoconf.py:185
Definition: DetId.h:20
static const int SubdetectorId
Definition: HcalZDCDetId.h:22
ZdcHitReconstructor(const edm::ParameterSet &ps)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< int > AuxTSvec_
std::vector< unsigned int > noiseTS() const
tuple cout
Definition: gather_cfg.py:121
virtual void produce(edm::Event &e, const edm::EventSetup &c) overridefinal
uint32_t getValue() const
virtual void endRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
Definition: Run.h:36