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, 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
 
HcalTrigTowerGeometry theTrigTowerGeometry
 
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 98 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 82 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 79 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 83 of file HcalTriggerPrimitiveAlgo.h.

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

Definition at line 95 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),
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 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 353 of file HcalTriggerPrimitiveAlgo.cc.

References fgMap_, i, and ExpressReco_HICollisions_FallBack::id.

Referenced by addSignal().

353  {
354  FGbitMap::iterator itr = fgMap_.find(id);
355  if (itr != fgMap_.end()){
356  std::vector<bool>& _msb = itr->second;
357  for (size_t i=0; i<msb.size(); ++i)
358  _msb[i] = _msb[i] || msb[i];
359  }
360  else fgMap_[id] = msb;
361 }
int i
Definition: DBlmapReader.cc:9
void HcalTriggerPrimitiveAlgo::addSignal ( const HBHEDataFrame frame)
private

adds the signal to the map

Definition at line 81 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().

81  {
82  //Hack for 300_pre10, should be removed.
83  if (frame.id().depth()==5) return;
84 
85  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry.towerIds(frame.id());
86  assert(ids.size() == 1 || ids.size() == 2);
87  IntegerCaloSamples samples1(ids[0], int(frame.size()));
88 
89  samples1.setPresamples(frame.presamples());
90  incoder_->adc2Linear(frame, samples1);
91 
92  std::vector<bool> msb;
93  incoder_->lookupMSB(frame, msb);
94 
95  if(ids.size() == 2) {
96  // make a second trigprim for the other one, and split the energy
97  IntegerCaloSamples samples2(ids[1], samples1.size());
98  for(int i = 0; i < samples1.size(); ++i) {
99  samples1[i] = uint32_t(samples1[i]*0.5);
100  samples2[i] = samples1[i];
101  }
102  samples2.setPresamples(frame.presamples());
103  addSignal(samples2);
104  addFG(ids[1], msb);
105  }
106  addSignal(samples1);
107  addFG(ids[0], msb);
108 }
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)
HcalTrigTowerGeometry theTrigTowerGeometry
int depth() const
get the tower depth
Definition: HcalDetId.h:42
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 111 of file HcalTriggerPrimitiveAlgo.cc.

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

111  {
112 
113  if(frame.id().depth() == 1 || frame.id().depth() == 2) {
114  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry.towerIds(frame.id());
115  assert(ids.size() == 1);
116  IntegerCaloSamples samples(ids[0], frame.size());
117  samples.setPresamples(frame.presamples());
118  incoder_->adc2Linear(frame, samples);
119 
120  // Don't add to final collection yet
121  // HF PMT veto sum is calculated in analyzerHF()
122  IntegerCaloSamples zero_samples(ids[0], frame.size());
123  zero_samples.setPresamples(frame.presamples());
124  addSignal(zero_samples);
125 
126  // Mask off depths: fgid is the same for both depths
127  uint32_t fgid = (frame.id().rawId() | 0x1c000) ;
128 
129  if ( theTowerMapFGSum.find(ids[0]) == theTowerMapFGSum.end() ) {
130  SumFGContainer sumFG;
131  theTowerMapFGSum.insert(std::pair<HcalTrigTowerDetId, SumFGContainer >(ids[0], sumFG));
132  }
133 
134  SumFGContainer& sumFG = theTowerMapFGSum[ids[0]];
135  SumFGContainer::iterator sumFGItr;
136  for ( sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
137  if (sumFGItr->id() == fgid) break;
138  }
139  // If find
140  if (sumFGItr != sumFG.end()) {
141  for (int i=0; i<samples.size(); ++i) (*sumFGItr)[i] += samples[i];
142  }
143  else {
144  //Copy samples (change to fgid)
145  IntegerCaloSamples sumFGSamples(DetId(fgid), samples.size());
146  sumFGSamples.setPresamples(samples.presamples());
147  for (int i=0; i<samples.size(); ++i) sumFGSamples[i] = samples[i];
148  sumFG.push_back(sumFGSamples);
149  }
150 
151  // set veto to true if Long or Short less than threshold
152  if (HF_Veto.find(fgid) == HF_Veto.end()) {
153  vector<bool> vetoBits(samples.size(), false);
154  HF_Veto[fgid] = vetoBits;
155  }
156  for (int i=0; i<samples.size(); ++i)
158  HF_Veto[fgid][i] = true;
159  }
160 }
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
HcalTrigTowerGeometry theTrigTowerGeometry
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::vector< IntegerCaloSamples > SumFGContainer
int depth() const
get the tower depth
Definition: HcalDetId.h:42
Definition: DetId.h:20
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 163 of file HcalTriggerPrimitiveAlgo.cc.

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

163  {
164  HcalTrigTowerDetId id(samples.id());
165  SumMap::iterator itr = theSumMap.find(id);
166  if(itr == theSumMap.end()) {
167  theSumMap.insert(std::make_pair(id, samples));
168  }
169  else {
170  // wish CaloSamples had a +=
171  for(int i = 0; i < samples.size(); ++i) {
172  (itr->second)[i] += samples[i];
173  }
174  }
175 }
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 178 of file HcalTriggerPrimitiveAlgo.cc.

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

Referenced by run().

178  {
179  int shrink = weights_.size() - 1;
180  std::vector<bool> finegrain(numberOfSamples_,false);
181  std::vector<bool>& msb = fgMap_[samples.id()];
182  IntegerCaloSamples sum(samples.id(), samples.size());
183 
184  //slide algo window
185  for(int ibin = 0; ibin < int(samples.size())- shrink; ++ibin) {
186  int algosumvalue = 0;
187  for(unsigned int i = 0; i < weights_.size(); i++) {
188  //add up value * scale factor
189  algosumvalue += int(samples[ibin+i] * weights_[i]);
190  }
191  if (algosumvalue<0) sum[ibin]=0; // low-side
192  //high-side
193  //else if (algosumvalue>0x3FF) sum[ibin]=0x3FF;
194  else sum[ibin] = algosumvalue; //assign value to sum[]
195  }
196 
198  output.setPresamples(numberOfPresamples_);
199 
200  // Align digis and TP
201  int shift = samples.presamples() - numberOfPresamples_;
202  if (peakfind_) {
203  assert (shift >= (peakfind_ ? shrink : 0));
204  assert(shift + numberOfSamples_ + shrink <= samples.size() - (peak_finder_algorithm_ - 1));
205  }
206 
207 
208  for (int ibin = 0; ibin < numberOfSamples_; ++ibin) {
209  // ibin - index for output TP
210  // idx - index for samples + shift
211  int idx = ibin + shift;
212 
213  //Peak finding
214  if (peakfind_) {
215  bool isPeak = false;
216  switch (peak_finder_algorithm_) {
217  case 1 :
218  isPeak = (samples[idx] > samples[idx-1] && samples[idx] >= samples[idx+1] && samples[idx] > theThreshold);
219  break;
220  case 2:
221  isPeak = (sum[idx] > sum[idx-1] && sum[idx] >= sum[idx+1] && sum[idx] > theThreshold);
222  break;
223  default:
224  break;
225  }
226 
227  if (isPeak){
228  output[ibin] = std::min<unsigned int>(sum[idx],0x3FF);
229  finegrain[ibin] = msb[idx];
230  }
231  // Not a peak
232  else output[ibin] = 0;
233  }
234  else { // No peak finding, just output running sum
235  output[ibin] = std::min<unsigned int>(sum[idx],0x3FF);
236  finegrain[ibin] = msb[idx];
237  }
238 
239  // Only Pegged for 1-TS algo.
240  if (peak_finder_algorithm_ == 1) {
241  if (samples[idx] >= 0x3FF)
242  output[ibin] = 0x3FF;
243  }
244  outcoder_->compress(output, finegrain, result);
245  }
246 }
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_
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 249 of file HcalTriggerPrimitiveAlgo.cc.

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

Referenced by run().

249  {
250  std::vector<bool> finegrain(numberOfSamples_, false);
251  HcalTrigTowerDetId detId(samples.id());
252 
253  // Align digis and TP
254  int shift = samples.presamples() - numberOfPresamples_;
255  assert(shift >= 0);
256  assert((shift + numberOfSamples_) <= samples.size());
257 
258  TowerMapFGSum::const_iterator tower2fg = theTowerMapFGSum.find(detId);
259  assert(tower2fg != theTowerMapFGSum.end());
260 
261  const SumFGContainer& sumFG = tower2fg->second;
262  // Loop over all L+S pairs that mapped from samples.id()
263  // Note: 1 samples.id() = 6 x (L+S) without noZS
264  for (SumFGContainer::const_iterator sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
265  const std::vector<bool>& veto = HF_Veto[sumFGItr->id().rawId()];
266  for (int ibin = 0; ibin < numberOfSamples_; ++ibin) {
267  int idx = ibin + shift;
268  // if not vetod, add L+S to total sum and calculate FG
269  if (!(veto[idx] && (*sumFGItr)[idx] > PMT_NoiseThreshold_)) {
270  samples[idx] += (*sumFGItr)[idx];
271  finegrain[ibin] = (finegrain[ibin] || (*sumFGItr)[idx] >= FG_threshold_);
272  }
273  }
274  }
275 
277  output.setPresamples(numberOfPresamples_);
278 
279  for (int ibin = 0; ibin < numberOfSamples_; ++ibin) {
280  int idx = ibin + shift;
281  output[ibin] = samples[idx] / (rctlsb == 0.25 ? 4 : 8);
282  if (output[ibin] > 0x3FF) output[ibin] = 0x3FF;
283  }
284  outcoder_->compress(output, finegrain, result);
285 }
int presamples() const
access presample information
const HcalTPGCompressor * outcoder_
std::vector< IntegerCaloSamples > SumFGContainer
int size() const
get the size
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,
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().

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

304  {
305  std::set<uint32_t> FrontEndErrors;
306 
308  const FEDRawData& raw = rawraw->FEDData(i);
309  if (raw.size()<12) continue;
310  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
311  if(!dccHeader) continue;
312  HcalHTRData htr;
313  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
314  if (!dccHeader->getSpigotPresent(spigot)) continue;
315  dccHeader->getSpigotData(spigot,htr,raw.size());
316  int dccid = dccHeader->getSourceId();
317  int errWord = htr.getErrorsWord() & 0x1FFFF;
318  bool HTRError = (!htr.check() || htr.isHistogramEvent() || (errWord & 0x800)!=0);
319 
320  if(HTRError) {
321  bool valid =false;
322  for(int fchan=0; fchan<3 && !valid; fchan++) {
323  for(int fib=0; fib<9 && !valid; fib++) {
324  HcalElectronicsId eid(fchan,fib,spigot,dccid-FEDNumbering::MINHCALFEDID);
325  eid.setHTR(htr.readoutVMECrateId(),htr.htrSlot(),htr.htrTopBottom());
326  DetId detId = emap->lookup(eid);
327  if(detId.null()) continue;
328  HcalSubdetector subdet=(HcalSubdetector(detId.subdetId()));
329  if (detId.det()!=4||
330  (subdet!=HcalBarrel && subdet!=HcalEndcap &&
331  subdet!=HcalForward )) continue;
332  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry.towerIds(detId);
333  for (std::vector<HcalTrigTowerDetId>::const_iterator triggerId=ids.begin(); triggerId != ids.end(); ++triggerId) {
334  FrontEndErrors.insert(triggerId->rawId());
335  }
336  //valid = true;
337  }
338  }
339  }
340  }
341  }
342 
343  // Loop over TP collection
344  // Set TP to zero if there is FE Format Error
345  HcalTriggerPrimitiveSample zeroSample(0);
346  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp){
347  if (FrontEndErrors.find(tp->id().rawId()) != FrontEndErrors.end()) {
348  for (int i=0; i<tp->size(); ++i) tp->setSample(i, zeroSample);
349  }
350  }
351 }
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:317
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
HcalTrigTowerGeometry theTrigTowerGeometry
unsigned int htrSlot() const
HcalElectronicsId-style HTR slot.
Definition: HcalHTRData.cc:313
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
HcalSubdetector
Definition: HcalAssistant.h:32
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:39
std::vector< T >::iterator iterator
const_iterator end() const
int getSourceId() const
Definition: HcalDCCHeader.h:34
Definition: DetId.h:20
unsigned int getErrorsWord() const
Get the errors word.
Definition: HcalHTRData.h:144
bool null() const
is this a null id ?
Definition: DetId.h:47
unsigned int readoutVMECrateId() const
HcalElectronicsId-style VME crate number.
Definition: HcalHTRData.cc:321
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:21
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
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:360
const_iterator begin() const
void HcalTriggerPrimitiveAlgo::runZS ( HcalTrigPrimDigiCollection tp)

Definition at line 287 of file HcalTriggerPrimitiveAlgo.cc.

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

Referenced by HcalTrigPrimDigiProducer::produce().

287  {
288  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp){
289  bool ZS = true;
290  for (int i=0; i<tp->size(); ++i) {
291  if (tp->sample(i).compressedEt() > ZS_threshold_I_) {
292  ZS=false;
293  break;
294  }
295  }
296  if (ZS) tp->setZSInfo(false,true);
297  else tp->setZSInfo(true,false);
298  }
299 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
std::vector< T >::iterator iterator
size_type size() const
void HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm ( int  algo)

Definition at line 363 of file HcalTriggerPrimitiveAlgo.cc.

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

Referenced by HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer().

363  {
364  if (algo <=0 && algo>2)
365  throw cms::Exception("ERROR: Only algo 1 & 2 are supported.") << std::endl;
367 }

Member Data Documentation

uint32_t HcalTriggerPrimitiveAlgo::FG_threshold_
private

Definition at line 60 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF().

FGbitMap HcalTriggerPrimitiveAlgo::fgMap_
private

Definition at line 99 of file HcalTriggerPrimitiveAlgo.h.

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

TowerMapVeto HcalTriggerPrimitiveAlgo::HF_Veto
private

Definition at line 96 of file HcalTriggerPrimitiveAlgo.h.

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

const HcaluLUTTPGCoder* HcalTriggerPrimitiveAlgo::incoder_
private

Definition at line 54 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), and run().

int HcalTriggerPrimitiveAlgo::latency_
private

Definition at line 59 of file HcalTriggerPrimitiveAlgo.h.

uint32_t HcalTriggerPrimitiveAlgo::minSignalThreshold_
private

Definition at line 65 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal().

int HcalTriggerPrimitiveAlgo::numberOfPresamples_
private

Definition at line 64 of file HcalTriggerPrimitiveAlgo.h.

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

int HcalTriggerPrimitiveAlgo::numberOfSamples_
private

Definition at line 63 of file HcalTriggerPrimitiveAlgo.h.

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

const HcalTPGCompressor* HcalTriggerPrimitiveAlgo::outcoder_
private

Definition at line 55 of file HcalTriggerPrimitiveAlgo.h.

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

int HcalTriggerPrimitiveAlgo::peak_finder_algorithm_
private

Definition at line 72 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and setPeakFinderAlgorithm().

bool HcalTriggerPrimitiveAlgo::peakfind_
private

Definition at line 57 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and HcalTriggerPrimitiveAlgo().

uint32_t HcalTriggerPrimitiveAlgo::PMT_NoiseThreshold_
private

Definition at line 66 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF().

SumMap HcalTriggerPrimitiveAlgo::theSumMap
private

Definition at line 80 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), and run().

double HcalTriggerPrimitiveAlgo::theThreshold
private

Definition at line 56 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze().

TowerMapFGSum HcalTriggerPrimitiveAlgo::theTowerMapFGSum
private

Definition at line 84 of file HcalTriggerPrimitiveAlgo.h.

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

HcalTrigTowerGeometry HcalTriggerPrimitiveAlgo::theTrigTowerGeometry
private

Definition at line 77 of file HcalTriggerPrimitiveAlgo.h.

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

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

Definition at line 58 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze().

uint32_t HcalTriggerPrimitiveAlgo::ZS_threshold_
private

Definition at line 61 of file HcalTriggerPrimitiveAlgo.h.

Referenced by HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::ZS_threshold_I_
private

Definition at line 62 of file HcalTriggerPrimitiveAlgo.h.

Referenced by HcalTriggerPrimitiveAlgo(), and runZS().