@@ -132,8 +132,6 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer<Client>
132132 fTokChanInfo(this ->template consumes<edm::SortedCollection<HBHEChannelInfo,edm::StrictWeakOrdering<HBHEChannelInfo>> >(fChanInfoName )),
133133 fTokDigis(this ->template consumes<QIE11DigiCollection>(fDigiName ))
134134 {
135-
136-
137135 this ->template produces <HBHERecHitCollection>();
138136 this ->setDebugName (" HcalPhase1Reconstructor_FACILE" );
139137 }
@@ -151,61 +149,54 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer<Client>
151149
152150 tmp->clear ();
153151
154- processData<QIE11DataFrame>(*digis, *conditions, iInput, ninput);
155-
152+ processData<QIE11DataFrame>(*digis, *conditions, iInput, ninput);
156153 }
157154
158155 template <class DFrame , class Collection >
159156 void processData (const Collection& coll,
160- const HcalDbService& cond,
161- Input& iInput,
162- auto ninput)
157+ const HcalDbService& cond,
158+ Input& iInput,
159+ auto ninput)
163160 {
164-
165161 const bool skipDroppedChannels = false ;
166162
167163 unsigned int ib = 0 ;
168164 for (typename Collection::const_iterator it = coll.begin (); it != coll.end (); it++){
169-
170-
171-
172165 unsigned int ib = std::distance (coll.begin (),it);
173166
174- const DFrame& frame (*it);
175- const HcalDetId cell (frame.id ());
167+ const DFrame& frame (*it);
168+ const HcalDetId cell (frame.id ());
176169
177- const HcalSubdetector subdet = cell.subdet ();
178- if (!(subdet == HcalSubdetector::HcalBarrel ||
179- subdet == HcalSubdetector::HcalEndcap ||
180- subdet == HcalSubdetector::HcalOuter))
181- continue ;
170+ const HcalSubdetector subdet = cell.subdet ();
171+ if (!(subdet == HcalSubdetector::HcalBarrel ||
172+ subdet == HcalSubdetector::HcalEndcap ||
173+ subdet == HcalSubdetector::HcalOuter))
174+ continue ;
182175
183176 const HcalCalibrations& calib = cond.getHcalCalibrations (cell);
184- const HcalQIECoder* channelCoder = cond.getHcalCoder (cell);
185- const HcalQIEShape* shape = cond.getHcalShape (channelCoder);
186- const HcalCoderDb coder (*channelCoder, *shape);
177+ const HcalQIECoder* channelCoder = cond.getHcalCoder (cell);
178+ const HcalQIEShape* shape = cond.getHcalShape (channelCoder);
179+ const HcalCoderDb coder (*channelCoder, *shape);
187180
188181 CaloSamples cs;
189- coder.adc2fC (frame, cs);
190-
182+ coder.adc2fC (frame, cs);
191183
192184 const int nRead = cs.size ();
193- const int maxTS = std::min (nRead, static_cast <int >(HBHEChannelInfo::MAXSAMPLES));
185+ const int maxTS = std::min (nRead, static_cast <int >(HBHEChannelInfo::MAXSAMPLES));
194186
195187 const int soi = 3 ;
196188 const int nCycles = 8 ;
197- const RawChargeFromSample<DFrame> rcfs (sipmQTSShift_, sipmQNTStoSum_,
198- cond, cell, cs, soi, frame, maxTS);
199-
189+ const RawChargeFromSample<DFrame> rcfs (sipmQTSShift_, sipmQNTStoSum_,
190+ cond, cell, cs, soi, frame, maxTS);
200191
201192 iInput[ib*ninput + 0 ] = (float )cell.iphi ();
202193 for (int inputTS = 0 ; inputTS < nCycles; ++inputTS){
203194 auto s (frame[inputTS]);
204195 const uint8_t adc = s.adc ();
205196 const int capid = s.capid ();
206- const double gain = calib.respcorrgain (capid);
197+ const double gain = calib.respcorrgain (capid);
207198 iInput[ib*ninput + 1 ] = (float )gain;
208- const double rawCharge = rcfs.getRawCharge (cs[inputTS], calib.pedestal (capid));
199+ const double rawCharge = rcfs.getRawCharge (cs[inputTS], calib.pedestal (capid));
209200 iInput[ib*ninput+inputTS+2 ] = ((float )rawCharge);
210201 }
211202 for (unsigned int d = 1 ; d < 8 ; d++){
@@ -222,9 +213,7 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer<Client>
222213 }
223214 }
224215 void produce (edm::Event& iEvent, edm::EventSetup const & iSetup, Output const & iOutput) override {
225-
226-
227- std::unique_ptr<HBHERecHitCollection> out;
216+ std::unique_ptr<HBHERecHitCollection> out;
228217 out = std::make_unique<HBHERecHitCollection>();
229218
230219 unsigned int ib = 0 ;
@@ -241,55 +230,24 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer<Client>
241230 ~HcalPhase1Reconstructor_FACILE () override {}
242231
243232 private:
244-
245-
246-
247233 int sipmQTSShift_;
248234 int sipmQNTStoSum_;
249235 unsigned topN_;
250- edm::InputTag fDigiName ;
251- edm::InputTag fRHName ;
252- edm::InputTag fChanInfoName ;
253- edm::EDGetTokenT<edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit>>> fTokRH ;
254- edm::EDGetTokenT<edm::SortedCollection<HBHEChannelInfo,edm::StrictWeakOrdering<HBHEChannelInfo>>> fTokChanInfo ;
255- edm::EDGetTokenT<QIE11DigiCollection> fTokDigis ;
256-
257- std::vector<HBHERecHit> tmprh;
236+ edm::InputTag fDigiName ;
237+ edm::InputTag fRHName ;
238+ edm::InputTag fChanInfoName ;
239+ edm::EDGetTokenT<edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit>>> fTokRH ;
240+ edm::EDGetTokenT<edm::SortedCollection<HBHEChannelInfo,edm::StrictWeakOrdering<HBHEChannelInfo>>> fTokChanInfo ;
241+ edm::EDGetTokenT<QIE11DigiCollection> fTokDigis ;
242+
243+ std::vector<HBHERecHit> tmprh;
258244 std::vector<HBHERecHit> *tmp = &tmprh;
259245
260246 float depth, ieta, iphi;
261247
262248 using SonicEDProducer<Client>::client_;
263- template <unsigned int B, unsigned int I>
264- unsigned short f_to_ui (float f) {
265- bool isPos = f > 0 .;
266- short tmpIs = int (fabs (f));
267- unsigned short tmpI = tmpIs;
268- if (not isPos) {
269- unsigned short comp = ((unsigned short )((1 <<(sizeof (unsigned short )*4 -I+1 ))-1 )<<I);
270- tmpI = -tmpIs;
271- tmpI = tmpI-comp;
272- }
273- float tmpF = fabs (f) - float (tmpIs);
274- unsigned short fracs = tmpF*float (1 <<(B-I));
275- unsigned short val = (tmpI << (B-I)) + fracs;
276- return val;
277- }
278- template <unsigned int B, unsigned int I>
279- float ui_to_f (const unsigned short ui) {
280- unsigned short i = ui >> (B-I);
281- unsigned short mask = (1 << (B-I))-1 ;
282- unsigned short dec = ui & mask;
283- float lDec = float (dec)/float (1 << (B-I));
284- return float (i)+lDec;
285- }
286- uint32_t merge (unsigned short iA,unsigned short iB) {
287- uint32_t result = (uint32_t ) iA << 16 | iB;
288- return result;
289- }
290249};
291250
292-
293251typedef HcalPhase1Reconstructor_FACILE<TRTClientSync> HcalPhase1Reconstructor_FACILESync;
294252typedef HcalPhase1Reconstructor_FACILE<TRTClientAsync> HcalPhase1Reconstructor_FACILEAsync;
295253typedef HcalPhase1Reconstructor_FACILE<TRTClientPseudoAsync> HcalPhase1Reconstructor_FACILEPseudoAsync;
0 commit comments