CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HcalTriggerPrimitiveAlgo Class Reference

#include <HcalTriggerPrimitiveAlgo.h>

Public Member Functions

 HcalTriggerPrimitiveAlgo (bool pf, const std::vector< double > &w, int latency, uint32_t FG_threshold, uint32_t ZS_threshold, int numberOfSamples, int numberOfPresamples, uint32_t minSignalThreshold=0, uint32_t PMT_NoiseThreshold=0)
 
void run (const HcalTPGCoder *incoder, const HcalTPGCompressor *outcoder, const HBHEDigiCollection &hbheDigis, const HFDigiCollection &hfDigis, HcalTrigPrimDigiCollection &result, const HcalTrigTowerGeometry *trigTowerGeometry, float rctlsb)
 
void runFEFormatError (const FEDRawDataCollection *rawraw, const HcalElectronicsMap *emap, HcalTrigPrimDigiCollection &result)
 
void runZS (HcalTrigPrimDigiCollection &tp)
 
void setPeakFinderAlgorithm (int algo)
 
 ~HcalTriggerPrimitiveAlgo ()
 

Private Types

typedef std::map
< HcalTrigTowerDetId,
std::vector< bool > > 
FGbitMap
 
typedef std::vector
< IntegerCaloSamples
SumFGContainer
 
typedef std::map
< HcalTrigTowerDetId,
IntegerCaloSamples
SumMap
 
typedef std::map
< HcalTrigTowerDetId,
SumFGContainer
TowerMapFGSum
 
typedef std::map< uint32_t,
std::vector< bool > > 
TowerMapVeto
 

Private Member Functions

void addFG (const HcalTrigTowerDetId &id, std::vector< bool > &msb)
 
void addSignal (const HBHEDataFrame &frame)
 adds the signal to the map More...
 
void addSignal (const HFDataFrame &frame)
 
void addSignal (const IntegerCaloSamples &samples)
 
void analyze (IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result)
 adds the actual RecHits More...
 
void analyzeHF (IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result, float rctlsb)
 

Private Attributes

uint32_t FG_threshold_
 
FGbitMap fgMap_
 
TowerMapVeto HF_Veto
 
const HcaluLUTTPGCoderincoder_
 
int latency_
 
uint32_t minSignalThreshold_
 
int numberOfPresamples_
 
int numberOfSamples_
 
const HcalTPGCompressoroutcoder_
 
int peak_finder_algorithm_
 
bool peakfind_
 
uint32_t PMT_NoiseThreshold_
 
SumMap theSumMap
 
double theThreshold
 
TowerMapFGSum theTowerMapFGSum
 
const HcalTrigTowerGeometrytheTrigTowerGeometry
 
std::vector< double > weights_
 
uint32_t ZS_threshold_
 
int ZS_threshold_I_
 

Detailed Description

Definition at line 20 of file HcalTriggerPrimitiveAlgo.h.

Member Typedef Documentation

typedef std::map<HcalTrigTowerDetId, std::vector<bool> > HcalTriggerPrimitiveAlgo::FGbitMap
private

Definition at line 99 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 83 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 80 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 84 of file HcalTriggerPrimitiveAlgo.h.

typedef std::map<uint32_t, std::vector<bool> > HcalTriggerPrimitiveAlgo::TowerMapVeto
private

Definition at line 96 of file HcalTriggerPrimitiveAlgo.h.

Constructor & Destructor Documentation

HcalTriggerPrimitiveAlgo::HcalTriggerPrimitiveAlgo ( bool  pf,
const std::vector< double > &  w,
int  latency,
uint32_t  FG_threshold,
uint32_t  ZS_threshold,
int  numberOfSamples,
int  numberOfPresamples,
uint32_t  minSignalThreshold = 0,
uint32_t  PMT_NoiseThreshold = 0 
)

Definition at line 15 of file HcalTriggerPrimitiveAlgo.cc.

References numberOfPresamples_, numberOfSamples_, peakfind_, ZS_threshold_, and ZS_threshold_I_.

19  : incoder_(0), outcoder_(0),
20  theThreshold(0), peakfind_(pf), weights_(w), latency_(latency),
21  FG_threshold_(FG_threshold), ZS_threshold_(ZS_threshold),
22  numberOfSamples_(numberOfSamples),
23  numberOfPresamples_(numberOfPresamples),
24  minSignalThreshold_(minSignalThreshold),
25  PMT_NoiseThreshold_(PMT_NoiseThreshold),
27 {
28  //No peak finding setting (for Fastsim)
29  if (!peakfind_){
30  numberOfSamples_ = 1;
32  }
33  // Switch to integer for comparisons - remove compiler warning
35 }
const double w
Definition: UKUtility.cc:23
const HcalTPGCompressor * outcoder_
std::vector< double > weights_
const HcaluLUTTPGCoder * incoder_
HcalTriggerPrimitiveAlgo::~HcalTriggerPrimitiveAlgo ( )

Definition at line 38 of file HcalTriggerPrimitiveAlgo.cc.

38  {
39 }

Member Function Documentation

void HcalTriggerPrimitiveAlgo::addFG ( const HcalTrigTowerDetId id,
std::vector< bool > &  msb 
)
private

Definition at line 375 of file HcalTriggerPrimitiveAlgo.cc.

References fgMap_, and i.

Referenced by addSignal().

375  {
376  FGbitMap::iterator itr = fgMap_.find(id);
377  if (itr != fgMap_.end()){
378  std::vector<bool>& _msb = itr->second;
379  for (size_t i=0; i<msb.size(); ++i)
380  _msb[i] = _msb[i] || msb[i];
381  }
382  else fgMap_[id] = msb;
383 }
int i
Definition: DBlmapReader.cc:9
void HcalTriggerPrimitiveAlgo::addSignal ( const HBHEDataFrame frame)
private

adds the signal to the map

Definition at line 83 of file HcalTriggerPrimitiveAlgo.cc.

References HcaluLUTTPGCoder::adc2Linear(), addFG(), HcalDetId::depth(), i, HBHEDataFrame::id(), incoder_, HcaluLUTTPGCoder::lookupMSB(), HBHEDataFrame::presamples(), HBHEDataFrame::size(), theTrigTowerGeometry, and HcalTrigTowerGeometry::towerIds().

Referenced by addSignal(), and run().

83  {
84  //Hack for 300_pre10, should be removed.
85  if (frame.id().depth()==5) return;
86 
87  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(frame.id());
88  assert(ids.size() == 1 || ids.size() == 2);
89  IntegerCaloSamples samples1(ids[0], int(frame.size()));
90 
91  samples1.setPresamples(frame.presamples());
92  incoder_->adc2Linear(frame, samples1);
93 
94  std::vector<bool> msb;
95  incoder_->lookupMSB(frame, msb);
96 
97  if(ids.size() == 2) {
98  // make a second trigprim for the other one, and split the energy
99  IntegerCaloSamples samples2(ids[1], samples1.size());
100  for(int i = 0; i < samples1.size(); ++i) {
101  samples1[i] = uint32_t(samples1[i]*0.5);
102  samples2[i] = samples1[i];
103  }
104  samples2.setPresamples(frame.presamples());
105  addSignal(samples2);
106  addFG(ids[1], msb);
107  }
108  addSignal(samples1);
109  addFG(ids[0], msb);
110 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
void addFG(const HcalTrigTowerDetId &id, std::vector< bool > &msb)
int depth() const
get the tower depth
Definition: HcalDetId.h:40
const HcalTrigTowerGeometry * theTrigTowerGeometry
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
Definition: HBHEDataFrame.h:28
const HcaluLUTTPGCoder * incoder_
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
virtual void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const
void addSignal(const HBHEDataFrame &frame)
adds the signal to the map
void HcalTriggerPrimitiveAlgo::addSignal ( const HFDataFrame frame)
private

Definition at line 113 of file HcalTriggerPrimitiveAlgo.cc.

References HcaluLUTTPGCoder::adc2Linear(), addSignal(), HcalDetId::depth(), HF_Veto, i, HFDataFrame::id(), incoder_, minSignalThreshold_, HFDataFrame::presamples(), DetId::rawId(), IntegerCaloSamples::setPresamples(), HFDataFrame::size(), theTowerMapFGSum, theTrigTowerGeometry, and HcalTrigTowerGeometry::towerIds().

113  {
114 
115  if(frame.id().depth() == 1 || frame.id().depth() == 2) {
116  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(frame.id());
117  assert(ids.size() == 1);
118  IntegerCaloSamples samples(ids[0], frame.size());
119  samples.setPresamples(frame.presamples());
120  incoder_->adc2Linear(frame, samples);
121 
122  // Don't add to final collection yet
123  // HF PMT veto sum is calculated in analyzerHF()
124  IntegerCaloSamples zero_samples(ids[0], frame.size());
125  zero_samples.setPresamples(frame.presamples());
126  addSignal(zero_samples);
127 
128  // Mask off depths: fgid is the same for both depths
129  uint32_t fgid = (frame.id().rawId() | 0x1c000) ;
130 
131  if ( theTowerMapFGSum.find(ids[0]) == theTowerMapFGSum.end() ) {
132  SumFGContainer sumFG;
133  theTowerMapFGSum.insert(std::pair<HcalTrigTowerDetId, SumFGContainer >(ids[0], sumFG));
134  }
135 
136  SumFGContainer& sumFG = theTowerMapFGSum[ids[0]];
137  SumFGContainer::iterator sumFGItr;
138  for ( sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
139  if (sumFGItr->id() == fgid) break;
140  }
141  // If find
142  if (sumFGItr != sumFG.end()) {
143  for (int i=0; i<samples.size(); ++i) (*sumFGItr)[i] += samples[i];
144  }
145  else {
146  //Copy samples (change to fgid)
147  IntegerCaloSamples sumFGSamples(DetId(fgid), samples.size());
148  sumFGSamples.setPresamples(samples.presamples());
149  for (int i=0; i<samples.size(); ++i) sumFGSamples[i] = samples[i];
150  sumFG.push_back(sumFGSamples);
151  }
152 
153  // set veto to true if Long or Short less than threshold
154  if (HF_Veto.find(fgid) == HF_Veto.end()) {
155  vector<bool> vetoBits(samples.size(), false);
156  HF_Veto[fgid] = vetoBits;
157  }
158  for (int i=0; i<samples.size(); ++i)
159  if (samples[i] < minSignalThreshold_)
160  HF_Veto[fgid][i] = true;
161  }
162 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
void setPresamples(int pre)
set presample information
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< IntegerCaloSamples > SumFGContainer
int depth() const
get the tower depth
Definition: HcalDetId.h:40
const HcalTrigTowerGeometry * theTrigTowerGeometry
Definition: DetId.h:18
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
const HcaluLUTTPGCoder * incoder_
virtual void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
Definition: HFDataFrame.h:28
const HcalDetId & id() const
Definition: HFDataFrame.h:22
void addSignal(const HBHEDataFrame &frame)
adds the signal to the map
void HcalTriggerPrimitiveAlgo::addSignal ( const IntegerCaloSamples samples)
private

Definition at line 165 of file HcalTriggerPrimitiveAlgo.cc.

References i, IntegerCaloSamples::id(), IntegerCaloSamples::size(), and theSumMap.

165  {
166  HcalTrigTowerDetId id(samples.id());
167  SumMap::iterator itr = theSumMap.find(id);
168  if(itr == theSumMap.end()) {
169  theSumMap.insert(std::make_pair(id, samples));
170  }
171  else {
172  // wish CaloSamples had a +=
173  for(int i = 0; i < samples.size(); ++i) {
174  (itr->second)[i] += samples[i];
175  }
176  }
177 }
int i
Definition: DBlmapReader.cc:9
int size() const
get the size
DetId id() const
get the (generic) id
void HcalTriggerPrimitiveAlgo::analyze ( IntegerCaloSamples samples,
HcalTriggerPrimitiveDigi result 
)
private

adds the actual RecHits

Definition at line 180 of file HcalTriggerPrimitiveAlgo.cc.

References HcalTPGCompressor::compress(), fgMap_, i, IntegerCaloSamples::id(), customizeTrackingMonitorSeedNumber::idx, numberOfPresamples_, numberOfSamples_, outcoder_, convertSQLitetoXML_cfg::output, peak_finder_algorithm_, peakfind_, IntegerCaloSamples::presamples(), edm::shift, IntegerCaloSamples::size(), theThreshold, and weights_.

Referenced by run().

180  {
181  int shrink = weights_.size() - 1;
182  std::vector<bool>& msb = fgMap_[samples.id()];
183  IntegerCaloSamples sum(samples.id(), samples.size());
184 
185  //slide algo window
186  for(int ibin = 0; ibin < int(samples.size())- shrink; ++ibin) {
187  int algosumvalue = 0;
188  for(unsigned int i = 0; i < weights_.size(); i++) {
189  //add up value * scale factor
190  algosumvalue += int(samples[ibin+i] * weights_[i]);
191  }
192  if (algosumvalue<0) sum[ibin]=0; // low-side
193  //high-side
194  //else if (algosumvalue>0x3FF) sum[ibin]=0x3FF;
195  else sum[ibin] = algosumvalue; //assign value to sum[]
196  }
197 
198  // Align digis and TP
199  int dgPresamples=samples.presamples();
200  int tpPresamples=numberOfPresamples_;
201  int shift = dgPresamples - tpPresamples;
202  int dgSamples=samples.size();
203  int tpSamples=numberOfSamples_;
204  if(peakfind_){
205  if((shift<shrink) || (shift + tpSamples + shrink > dgSamples - (peak_finder_algorithm_ - 1) ) ){
206  edm::LogInfo("HcalTriggerPrimitiveAlgo::analyze") <<
207  "TP presample or size from the configuration file is out of the accessible range. Using digi values from data instead...";
208  shift=shrink;
209  tpPresamples=dgPresamples-shrink;
210  tpSamples=dgSamples-(peak_finder_algorithm_-1)-shrink-shift;
211  }
212  }
213 
214  std::vector<bool> finegrain(tpSamples,false);
215 
216  IntegerCaloSamples output(samples.id(), tpSamples);
217  output.setPresamples(tpPresamples);
218 
219  for (int ibin = 0; ibin < tpSamples; ++ibin) {
220  // ibin - index for output TP
221  // idx - index for samples + shift
222  int idx = ibin + shift;
223 
224  //Peak finding
225  if (peakfind_) {
226  bool isPeak = false;
227  switch (peak_finder_algorithm_) {
228  case 1 :
229  isPeak = (samples[idx] > samples[idx-1] && samples[idx] >= samples[idx+1] && samples[idx] > theThreshold);
230  break;
231  case 2:
232  isPeak = (sum[idx] > sum[idx-1] && sum[idx] >= sum[idx+1] && sum[idx] > theThreshold);
233  break;
234  default:
235  break;
236  }
237 
238  if (isPeak){
239  output[ibin] = std::min<unsigned int>(sum[idx],0x3FF);
240  finegrain[ibin] = msb[idx];
241  }
242  // Not a peak
243  else output[ibin] = 0;
244  }
245  else { // No peak finding, just output running sum
246  output[ibin] = std::min<unsigned int>(sum[idx],0x3FF);
247  finegrain[ibin] = msb[idx];
248  }
249 
250  // Only Pegged for 1-TS algo.
251  if (peak_finder_algorithm_ == 1) {
252  if (samples[idx] >= 0x3FF)
253  output[ibin] = 0x3FF;
254  }
255  }
256  outcoder_->compress(output, finegrain, result);
257 }
int i
Definition: DBlmapReader.cc:9
int presamples() const
access presample information
const HcalTPGCompressor * outcoder_
int size() const
get the size
std::vector< double > weights_
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static unsigned int const shift
void compress(const IntegerCaloSamples &ics, const std::vector< bool > &fineGrain, HcalTriggerPrimitiveDigi &digi) const
DetId id() const
get the (generic) id
void HcalTriggerPrimitiveAlgo::analyzeHF ( IntegerCaloSamples samples,
HcalTriggerPrimitiveDigi result,
float  rctlsb 
)
private

Definition at line 260 of file HcalTriggerPrimitiveAlgo.cc.

References HcalTPGCompressor::compress(), FG_threshold_, HF_Veto, IntegerCaloSamples::id(), customizeTrackingMonitorSeedNumber::idx, numberOfPresamples_, numberOfSamples_, outcoder_, convertSQLitetoXML_cfg::output, PMT_NoiseThreshold_, IntegerCaloSamples::presamples(), edm::shift, IntegerCaloSamples::size(), theTowerMapFGSum, and TriggerAnalyzer::veto.

Referenced by run().

260  {
261  HcalTrigTowerDetId detId(samples.id());
262 
263  // Align digis and TP
264  int dgPresamples=samples.presamples();
265  int tpPresamples=numberOfPresamples_;
266  int shift = dgPresamples - tpPresamples;
267  int dgSamples=samples.size();
268  int tpSamples=numberOfSamples_;
269  if(shift<0 || shift+tpSamples>dgSamples){
270  edm::LogInfo("HcalTriggerPrimitiveAlgo::analyzeHF") <<
271  "TP presample or size from the configuration file is out of the accessible range. Using digi values from data instead...";
272  tpPresamples=dgPresamples;
273  shift=0;
274  tpSamples=dgSamples;
275  }
276 
277  std::vector<bool> finegrain(tpSamples, false);
278 
279  TowerMapFGSum::const_iterator tower2fg = theTowerMapFGSum.find(detId);
280  assert(tower2fg != theTowerMapFGSum.end());
281 
282  const SumFGContainer& sumFG = tower2fg->second;
283  // Loop over all L+S pairs that mapped from samples.id()
284  // Note: 1 samples.id() = 6 x (L+S) without noZS
285  for (SumFGContainer::const_iterator sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
286  const std::vector<bool>& veto = HF_Veto[sumFGItr->id().rawId()];
287  for (int ibin = 0; ibin < tpSamples; ++ibin) {
288  int idx = ibin + shift;
289  // if not vetod, add L+S to total sum and calculate FG
290  bool vetoed = idx<int(veto.size()) && veto[idx];
291  if (!(vetoed && (*sumFGItr)[idx] > PMT_NoiseThreshold_)) {
292  samples[idx] += (*sumFGItr)[idx];
293  finegrain[ibin] = (finegrain[ibin] || (*sumFGItr)[idx] >= FG_threshold_);
294  }
295  }
296  }
297 
298  IntegerCaloSamples output(samples.id(), tpSamples);
299  output.setPresamples(tpPresamples);
300 
301  for (int ibin = 0; ibin < tpSamples; ++ibin) {
302  int idx = ibin + shift;
303  output[ibin] = samples[idx] / (rctlsb == 0.25 ? 4 : 8);
304  if (output[ibin] > 0x3FF) output[ibin] = 0x3FF;
305  }
306  outcoder_->compress(output, finegrain, result);
307 }
int presamples() const
access presample information
const HcalTPGCompressor * outcoder_
std::vector< IntegerCaloSamples > SumFGContainer
int size() const
get the size
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static unsigned int const shift
void compress(const IntegerCaloSamples &ics, const std::vector< bool > &fineGrain, HcalTriggerPrimitiveDigi &digi) const
DetId id() const
get the (generic) id
void HcalTriggerPrimitiveAlgo::run ( const HcalTPGCoder incoder,
const HcalTPGCompressor outcoder,
const HBHEDigiCollection hbheDigis,
const HFDigiCollection hfDigis,
HcalTrigPrimDigiCollection result,
const HcalTrigTowerGeometry trigTowerGeometry,
float  rctlsb 
)

Definition at line 42 of file HcalTriggerPrimitiveAlgo.cc.

References addSignal(), analyze(), analyzeHF(), edm::SortedCollection< T, SORT >::back(), edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), fgMap_, HcalTrigTowerGeometry::firstHFTower(), HF_Veto, incoder_, outcoder_, edm::SortedCollection< T, SORT >::push_back(), theSumMap, theTowerMapFGSum, and theTrigTowerGeometry.

Referenced by HcalTrigPrimDigiProducer::produce().

48  {
49  theTrigTowerGeometry = trigTowerGeometry;
50 
51  incoder_=dynamic_cast<const HcaluLUTTPGCoder*>(incoder);
52  outcoder_=outcoder;
53 
54  theSumMap.clear();
55  theTowerMapFGSum.clear();
56  HF_Veto.clear();
57  fgMap_.clear();
58 
59  // do the HB/HE digis
60  for(HBHEDigiCollection::const_iterator hbheItr = hbheDigis.begin();
61  hbheItr != hbheDigis.end(); ++hbheItr) {
62  addSignal(*hbheItr);
63  }
64 
65  // and the HF digis
66  for(HFDigiCollection::const_iterator hfItr = hfDigis.begin();
67  hfItr != hfDigis.end(); ++hfItr) {
68  addSignal(*hfItr);
69 
70  }
71 
72  for(SumMap::iterator mapItr = theSumMap.begin(); mapItr != theSumMap.end(); ++mapItr) {
73  result.push_back(HcalTriggerPrimitiveDigi(mapItr->first));
74  HcalTrigTowerDetId detId(mapItr->second.id());
75  if(detId.ietaAbs() >= theTrigTowerGeometry->firstHFTower())
76  { analyzeHF(mapItr->second, result.back(), rctlsb);}
77  else{analyze(mapItr->second, result.back());}
78  }
79  return;
80 }
void analyze(IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result)
adds the actual RecHits
std::vector< HBHEDataFrame >::const_iterator const_iterator
void push_back(T const &t)
const HcalTPGCompressor * outcoder_
void analyzeHF(IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result, float rctlsb)
const HcalTrigTowerGeometry * theTrigTowerGeometry
const_iterator end() const
const HcaluLUTTPGCoder * incoder_
void addSignal(const HBHEDataFrame &frame)
adds the signal to the map
const_iterator begin() const
const_reference back() const
void HcalTriggerPrimitiveAlgo::runFEFormatError ( const FEDRawDataCollection rawraw,
const HcalElectronicsMap emap,
HcalTrigPrimDigiCollection result 
)

Definition at line 323 of file HcalTriggerPrimitiveAlgo.cc.

References edm::SortedCollection< T, SORT >::begin(), HcalHTRData::check(), FEDRawData::data(), DetId::det(), edm::SortedCollection< T, SORT >::end(), FEDRawDataCollection::FEDData(), HcalHTRData::getErrorsWord(), HcalDCCHeader::getSourceId(), HcalDCCHeader::getSpigotData(), HcalDCCHeader::getSpigotPresent(), HcalBarrel, HcalEndcap, HcalForward, HcalHTRData::htrSlot(), HcalHTRData::htrTopBottom(), i, HcalHTRData::isHistogramEvent(), HcalElectronicsMap::lookup(), FEDNumbering::MAXHCALFEDID, FEDNumbering::MINHCALFEDID, DetId::null(), HcalHTRData::readoutVMECrateId(), HcalElectronicsId::setHTR(), FEDRawData::size(), HcalDCCHeader::SPIGOT_COUNT, DetId::subdetId(), theTrigTowerGeometry, HcalTrigTowerGeometry::towerIds(), and TrackValidation_HighPurity_cff::valid.

Referenced by HcalTrigPrimDigiProducer::produce().

326  {
327  std::set<uint32_t> FrontEndErrors;
328 
330  const FEDRawData& raw = rawraw->FEDData(i);
331  if (raw.size()<12) continue;
332  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
333  if(!dccHeader) continue;
334  HcalHTRData htr;
335  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
336  if (!dccHeader->getSpigotPresent(spigot)) continue;
337  dccHeader->getSpigotData(spigot,htr,raw.size());
338  int dccid = dccHeader->getSourceId();
339  int errWord = htr.getErrorsWord() & 0x1FFFF;
340  bool HTRError = (!htr.check() || htr.isHistogramEvent() || (errWord & 0x800)!=0);
341 
342  if(HTRError) {
343  bool valid =false;
344  for(int fchan=0; fchan<3 && !valid; fchan++) {
345  for(int fib=0; fib<9 && !valid; fib++) {
346  HcalElectronicsId eid(fchan,fib,spigot,dccid-FEDNumbering::MINHCALFEDID);
347  eid.setHTR(htr.readoutVMECrateId(),htr.htrSlot(),htr.htrTopBottom());
348  DetId detId = emap->lookup(eid);
349  if(detId.null()) continue;
350  HcalSubdetector subdet=(HcalSubdetector(detId.subdetId()));
351  if (detId.det()!=4||
352  (subdet!=HcalBarrel && subdet!=HcalEndcap &&
353  subdet!=HcalForward )) continue;
354  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(detId);
355  for (std::vector<HcalTrigTowerDetId>::const_iterator triggerId=ids.begin(); triggerId != ids.end(); ++triggerId) {
356  FrontEndErrors.insert(triggerId->rawId());
357  }
358  //valid = true;
359  }
360  }
361  }
362  }
363  }
364 
365  // Loop over TP collection
366  // Set TP to zero if there is FE Format Error
367  HcalTriggerPrimitiveSample zeroSample(0);
368  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp){
369  if (FrontEndErrors.find(tp->id().rawId()) != FrontEndErrors.end()) {
370  for (int i=0; i<tp->size(); ++i) tp->setSample(i, zeroSample);
371  }
372  }
373 }
int i
Definition: DBlmapReader.cc:9
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:62
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
unsigned int htrTopBottom() const
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom)
Definition: HcalHTRData.cc:342
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
unsigned int htrSlot() const
HcalElectronicsId-style HTR slot.
Definition: HcalHTRData.cc:338
const HcalTrigTowerGeometry * theTrigTowerGeometry
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
HcalSubdetector
Definition: HcalAssistant.h:31
bool getSpigotPresent(unsigned int nspigot) const
Read the &quot;PRESENT&quot; bit for this spigot.
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::vector< HcalTriggerPrimitiveDigi >::iterator iterator
const_iterator end() const
int getSourceId() const
Definition: HcalDCCHeader.h:32
Definition: DetId.h:18
unsigned int getErrorsWord() const
Get the errors word.
Definition: HcalHTRData.h:157
bool null() const
is this a null id ?
Definition: DetId.h:45
unsigned int readoutVMECrateId() const
HcalElectronicsId-style VME crate number.
Definition: HcalHTRData.cc:346
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:19
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:385
const_iterator begin() const
void HcalTriggerPrimitiveAlgo::runZS ( HcalTrigPrimDigiCollection tp)

Definition at line 309 of file HcalTriggerPrimitiveAlgo.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), i, and ZS_threshold_I_.

Referenced by HcalTrigPrimDigiProducer::produce().

309  {
310  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp){
311  bool ZS = true;
312  for (int i=0; i<tp->size(); ++i) {
313  if (tp->sample(i).compressedEt() > ZS_threshold_I_) {
314  ZS=false;
315  break;
316  }
317  }
318  if (ZS) tp->setZSInfo(false,true);
319  else tp->setZSInfo(true,false);
320  }
321 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
std::vector< HcalTriggerPrimitiveDigi >::iterator iterator
size_type size() const
void HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm ( int  algo)

Definition at line 385 of file HcalTriggerPrimitiveAlgo.cc.

References edm::hlt::Exception, and peak_finder_algorithm_.

Referenced by HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer().

385  {
386  if (algo <=0 && algo>2)
387  throw cms::Exception("ERROR: Only algo 1 & 2 are supported.") << std::endl;
388  peak_finder_algorithm_ = algo;
389 }

Member Data Documentation

uint32_t HcalTriggerPrimitiveAlgo::FG_threshold_
private

Definition at line 61 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF().

FGbitMap HcalTriggerPrimitiveAlgo::fgMap_
private

Definition at line 100 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addFG(), analyze(), and run().

TowerMapVeto HcalTriggerPrimitiveAlgo::HF_Veto
private

Definition at line 97 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), analyzeHF(), and run().

const HcaluLUTTPGCoder* HcalTriggerPrimitiveAlgo::incoder_
private

Definition at line 55 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), and run().

int HcalTriggerPrimitiveAlgo::latency_
private

Definition at line 60 of file HcalTriggerPrimitiveAlgo.h.

uint32_t HcalTriggerPrimitiveAlgo::minSignalThreshold_
private

Definition at line 66 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal().

int HcalTriggerPrimitiveAlgo::numberOfPresamples_
private

Definition at line 65 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), analyzeHF(), and HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::numberOfSamples_
private

Definition at line 64 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), analyzeHF(), and HcalTriggerPrimitiveAlgo().

const HcalTPGCompressor* HcalTriggerPrimitiveAlgo::outcoder_
private

Definition at line 56 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), analyzeHF(), and run().

int HcalTriggerPrimitiveAlgo::peak_finder_algorithm_
private

Definition at line 73 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and setPeakFinderAlgorithm().

bool HcalTriggerPrimitiveAlgo::peakfind_
private

Definition at line 58 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and HcalTriggerPrimitiveAlgo().

uint32_t HcalTriggerPrimitiveAlgo::PMT_NoiseThreshold_
private

Definition at line 67 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF().

SumMap HcalTriggerPrimitiveAlgo::theSumMap
private

Definition at line 81 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), and run().

double HcalTriggerPrimitiveAlgo::theThreshold
private

Definition at line 57 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze().

TowerMapFGSum HcalTriggerPrimitiveAlgo::theTowerMapFGSum
private

Definition at line 85 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), analyzeHF(), and run().

const HcalTrigTowerGeometry* HcalTriggerPrimitiveAlgo::theTrigTowerGeometry
private

Definition at line 78 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), run(), and runFEFormatError().

std::vector<double> HcalTriggerPrimitiveAlgo::weights_
private

Definition at line 59 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze().

uint32_t HcalTriggerPrimitiveAlgo::ZS_threshold_
private

Definition at line 62 of file HcalTriggerPrimitiveAlgo.h.

Referenced by HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::ZS_threshold_I_
private

Definition at line 63 of file HcalTriggerPrimitiveAlgo.h.

Referenced by HcalTriggerPrimitiveAlgo(), and runZS().