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_threshold1, uint32_t FG_threshold2, uint32_t ZS_threshold, int numberOfSamples, int numberOfPresamples, int numberOfSamplesHF, int numberOfPresamplesHF, 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 (int ieta, int iphi, int(&FGBit)[18][22], IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result, float rctlsb)
 

Private Attributes

uint32_t FG_threshold1_
 
uint32_t FG_threshold2_
 
FGbitMap fgMap_
 
TowerMapVeto HF_Veto
 
const HcaluLUTTPGCoderincoder_
 
int latency_
 
uint32_t minSignalThreshold_
 
int numberOfPresamples_
 
int numberOfPresamplesHF_
 
int numberOfSamples_
 
int numberOfSamplesHF_
 
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 103 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 87 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 84 of file HcalTriggerPrimitiveAlgo.h.

Definition at line 88 of file HcalTriggerPrimitiveAlgo.h.

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

Definition at line 100 of file HcalTriggerPrimitiveAlgo.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file HcalTriggerPrimitiveAlgo.cc.

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

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

Definition at line 43 of file HcalTriggerPrimitiveAlgo.cc.

43  {
44 }

Member Function Documentation

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

Definition at line 817 of file HcalTriggerPrimitiveAlgo.cc.

References fgMap_, and i.

Referenced by addSignal().

817  {
818  FGbitMap::iterator itr = fgMap_.find(id);
819  if (itr != fgMap_.end()){
820  std::vector<bool>& _msb = itr->second;
821  for (size_t i=0; i<msb.size(); ++i)
822  _msb[i] = _msb[i] || msb[i];
823  }
824  else fgMap_[id] = msb;
825 }
int i
Definition: DBlmapReader.cc:9
void HcalTriggerPrimitiveAlgo::addSignal ( const HBHEDataFrame frame)
private

adds the signal to the map

Definition at line 518 of file HcalTriggerPrimitiveAlgo.cc.

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

Referenced by addSignal(), and run().

518  {
519  //Hack for 300_pre10, should be removed.
520  if (frame.id().depth()==5) return;
521 
522  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(frame.id());
523  assert(ids.size() == 1 || ids.size() == 2);
524  IntegerCaloSamples samples1(ids[0], int(frame.size()));
525 
526  samples1.setPresamples(frame.presamples());
527  incoder_->adc2Linear(frame, samples1);
528 
529  std::vector<bool> msb;
530  incoder_->lookupMSB(frame, msb);
531 
532  if(ids.size() == 2) {
533  // make a second trigprim for the other one, and split the energy
534  IntegerCaloSamples samples2(ids[1], samples1.size());
535  for(int i = 0; i < samples1.size(); ++i) {
536  samples1[i] = uint32_t(samples1[i]*0.5);
537  samples2[i] = samples1[i];
538  }
539  samples2.setPresamples(frame.presamples());
540  addSignal(samples2);
541  addFG(ids[1], msb);
542  }
543  addSignal(samples1);
544  addFG(ids[0], msb);
545 }
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
assert(m_qm.get())
void addFG(const HcalTrigTowerDetId &id, std::vector< bool > &msb)
int depth() const
get the tower depth
Definition: HcalDetId.h:55
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 548 of file HcalTriggerPrimitiveAlgo.cc.

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

548  {
549 
550  if(frame.id().depth() == 1 || frame.id().depth() == 2) {
551  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(frame.id());
552  assert(ids.size() == 1);
553  IntegerCaloSamples samples(ids[0], frame.size());
554  samples.setPresamples(frame.presamples());
555  incoder_->adc2Linear(frame, samples);
556 
557  // Don't add to final collection yet
558  // HF PMT veto sum is calculated in analyzerHF()
559  IntegerCaloSamples zero_samples(ids[0], frame.size());
560  zero_samples.setPresamples(frame.presamples());
561  addSignal(zero_samples);
562 
563  // Mask off depths: fgid is the same for both depths
564  uint32_t fgid = (frame.id().maskDepth());
565 
566  if ( theTowerMapFGSum.find(ids[0]) == theTowerMapFGSum.end() ) {
567  SumFGContainer sumFG;
568  theTowerMapFGSum.insert(std::pair<HcalTrigTowerDetId, SumFGContainer >(ids[0], sumFG));
569  }
570 
571  SumFGContainer& sumFG = theTowerMapFGSum[ids[0]];
572  SumFGContainer::iterator sumFGItr;
573  for ( sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
574  if (sumFGItr->id() == fgid) break;
575  }
576  // If find
577  if (sumFGItr != sumFG.end()) {
578  for (int i=0; i<samples.size(); ++i) (*sumFGItr)[i] += samples[i];
579  }
580  else {
581  //Copy samples (change to fgid)
582  IntegerCaloSamples sumFGSamples(DetId(fgid), samples.size());
583  sumFGSamples.setPresamples(samples.presamples());
584  for (int i=0; i<samples.size(); ++i) sumFGSamples[i] = samples[i];
585  sumFG.push_back(sumFGSamples);
586  }
587 
588  // set veto to true if Long or Short less than threshold
589  if (HF_Veto.find(fgid) == HF_Veto.end()) {
590  vector<bool> vetoBits(samples.size(), false);
591  HF_Veto[fgid] = vetoBits;
592  }
593  for (int i=0; i<samples.size(); ++i)
594  if (samples[i] < minSignalThreshold_)
595  HF_Veto[fgid][i] = true;
596  }
597 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
assert(m_qm.get())
void setPresamples(int pre)
set presample information
uint32_t maskDepth() const
get the tower depth
Definition: HcalDetId.h:57
std::vector< IntegerCaloSamples > SumFGContainer
int depth() const
get the tower depth
Definition: HcalDetId.h:55
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 600 of file HcalTriggerPrimitiveAlgo.cc.

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

600  {
601  HcalTrigTowerDetId id(samples.id());
602  SumMap::iterator itr = theSumMap.find(id);
603  if(itr == theSumMap.end()) {
604  theSumMap.insert(std::make_pair(id, samples));
605  }
606  else {
607  // wish CaloSamples had a +=
608  for(int i = 0; i < samples.size(); ++i) {
609  (itr->second)[i] += samples[i];
610  }
611  }
612 }
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 615 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().

615  {
616  int shrink = weights_.size() - 1;
617  std::vector<bool>& msb = fgMap_[samples.id()];
618  IntegerCaloSamples sum(samples.id(), samples.size());
619 
620  //slide algo window
621  for(int ibin = 0; ibin < int(samples.size())- shrink; ++ibin) {
622  int algosumvalue = 0;
623  for(unsigned int i = 0; i < weights_.size(); i++) {
624  //add up value * scale factor
625  algosumvalue += int(samples[ibin+i] * weights_[i]);
626  }
627  if (algosumvalue<0) sum[ibin]=0; // low-side
628  //high-side
629  //else if (algosumvalue>0x3FF) sum[ibin]=0x3FF;
630  else sum[ibin] = algosumvalue; //assign value to sum[]
631  }
632 
633  // Align digis and TP
634  int dgPresamples=samples.presamples();
635  int tpPresamples=numberOfPresamples_;
636  int shift = dgPresamples - tpPresamples;
637  int dgSamples=samples.size();
638  int tpSamples=numberOfSamples_;
639  if(peakfind_){
640  if((shift<shrink) || (shift + tpSamples + shrink > dgSamples - (peak_finder_algorithm_ - 1) ) ){
641  edm::LogInfo("HcalTriggerPrimitiveAlgo::analyze") <<
642  "TP presample or size from the configuration file is out of the accessible range. Using digi values from data instead...";
643  shift=shrink;
644  tpPresamples=dgPresamples-shrink;
645  tpSamples=dgSamples-(peak_finder_algorithm_-1)-shrink-shift;
646  }
647  }
648 
649  std::vector<bool> finegrain(tpSamples,false);
650 
651  IntegerCaloSamples output(samples.id(), tpSamples);
652  output.setPresamples(tpPresamples);
653 
654  for (int ibin = 0; ibin < tpSamples; ++ibin) {
655  // ibin - index for output TP
656  // idx - index for samples + shift
657  int idx = ibin + shift;
658 
659  //Peak finding
660  if (peakfind_) {
661  bool isPeak = false;
662  switch (peak_finder_algorithm_) {
663  case 1 :
664  isPeak = (samples[idx] > samples[idx-1] && samples[idx] >= samples[idx+1] && samples[idx] > theThreshold);
665  break;
666  case 2:
667  isPeak = (sum[idx] > sum[idx-1] && sum[idx] >= sum[idx+1] && sum[idx] > theThreshold);
668  break;
669  default:
670  break;
671  }
672 
673  if (isPeak){
674  output[ibin] = std::min<unsigned int>(sum[idx],0x3FF);
675  finegrain[ibin] = msb[idx];
676  }
677  // Not a peak
678  else output[ibin] = 0;
679  }
680  else { // No peak finding, just output running sum
681  output[ibin] = std::min<unsigned int>(sum[idx],0x3FF);
682  finegrain[ibin] = msb[idx];
683  }
684 
685  // Only Pegged for 1-TS algo.
686  if (peak_finder_algorithm_ == 1) {
687  if (samples[idx] >= 0x3FF)
688  output[ibin] = 0x3FF;
689  }
690  }
691  outcoder_->compress(output, finegrain, result);
692 }
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 ( int  ieta,
int  iphi,
int(&)  FGBit[18][22],
IntegerCaloSamples samples,
HcalTriggerPrimitiveDigi result,
float  rctlsb 
)
private

Definition at line 695 of file HcalTriggerPrimitiveAlgo.cc.

References assert(), HcalTPGCompressor::compress(), converttoGCTetaFromTPG(), converttoGCTphiFromTPG(), HF_Veto, IntegerCaloSamples::id(), customizeTrackingMonitorSeedNumber::idx, cmsHarvester::index, numberOfPresamplesHF_, numberOfSamplesHF_, outcoder_, convertSQLitetoXML_cfg::output, PMT_NoiseThreshold_, IntegerCaloSamples::presamples(), edm::shift, IntegerCaloSamples::size(), theTowerMapFGSum, and TriggerAnalyzer::veto.

Referenced by run().

695  {
696  HcalTrigTowerDetId detId(samples.id());
697 
698  // Align digis and TP
699  int dgPresamples=samples.presamples();
700  int tpPresamples=numberOfPresamplesHF_;
701  int shift = dgPresamples - tpPresamples;
702  int dgSamples=samples.size();
703  int tpSamples=numberOfSamplesHF_;
704  if(shift<0 || shift+tpSamples>dgSamples){
705  edm::LogInfo("HcalTriggerPrimitiveAlgo::analyzeHF") <<
706  "TP presample or size from the configuration file is out of the accessible range. Using digi values from data instead...";
707  tpPresamples=dgPresamples;
708  shift=0;
709  tpSamples=dgSamples;
710  }
711 
712  std::vector<bool> finegrain(tpSamples, false);
713 
714  int ietaGCT = converttoGCTetaFromTPG(ieta);
715  int iphiGCT = converttoGCTphiFromTPG(iphi);
716 
717  for (int index = 0; index < tpSamples; ++index)
718  {
719  finegrain[index] = FGBit[iphiGCT][ietaGCT];
720  }
721 
722  TowerMapFGSum::const_iterator tower2fg = theTowerMapFGSum.find(detId);
723  assert(tower2fg != theTowerMapFGSum.end());
724 
725  const SumFGContainer& sumFG = tower2fg->second;
726  // Loop over all L+S pairs that mapped from samples.id()
727  // Note: 1 samples.id() = 6 x (L+S) without noZS
728  for (SumFGContainer::const_iterator sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
729  const std::vector<bool>& veto = HF_Veto[sumFGItr->id().rawId()];
730  for (int ibin = 0; ibin < tpSamples; ++ibin) {
731  int idx = ibin + shift;
732  // if not vetod, add L+S to total sum and calculate FG
733  bool vetoed = idx<int(veto.size()) && veto[idx];
734  if (!(vetoed && (*sumFGItr)[idx] > PMT_NoiseThreshold_)) {
735  samples[idx] += (*sumFGItr)[idx];
736  }
737  }
738  }
739 
740  IntegerCaloSamples output(samples.id(), tpSamples);
741  output.setPresamples(tpPresamples);
742 
743  for (int ibin = 0; ibin < tpSamples; ++ibin) {
744  int idx = ibin + shift;
745  output[ibin] = samples[idx] / (rctlsb == 0.25 ? 4 : 8);
746  if (output[ibin] > 0x3FF) output[ibin] = 0x3FF;
747  }
748  outcoder_->compress(output, finegrain, result);
749 }
int presamples() const
access presample information
int converttoGCTetaFromTPG(int &etaTPG)
assert(m_qm.get())
const HcalTPGCompressor * outcoder_
int converttoGCTphiFromTPG(int &phiTPG)
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 402 of file HcalTriggerPrimitiveAlgo.cc.

References addSignal(), analyze(), analyzeHF(), edm::SortedCollection< T, SORT >::back(), edm::SortedCollection< T, SORT >::begin(), converttoGCTeta(), converttoGCTphi(), edm::SortedCollection< T, SORT >::end(), FG_threshold1_, FG_threshold2_, fgMap_, HcalTrigTowerGeometry::firstHFTower(), HF_Veto, i, HcalTrigTowerDetId::ieta(), HcalDetId::ieta(), incoder_, HcalDetId::iphi(), j, relval_steps::k, outcoder_, edm::SortedCollection< T, SORT >::push_back(), theSumMap, theTowerMapFGSum, and theTrigTowerGeometry.

Referenced by HcalTrigPrimDigiProducer::produce().

408  {
409  theTrigTowerGeometry = trigTowerGeometry;
410 
411  incoder_=dynamic_cast<const HcaluLUTTPGCoder*>(incoder);
412  outcoder_=outcoder;
413 
414  theSumMap.clear();
415  theTowerMapFGSum.clear();
416  HF_Veto.clear();
417  fgMap_.clear();
418 
419  // do the HB/HE digis
420  for(HBHEDigiCollection::const_iterator hbheItr = hbheDigis.begin();
421  hbheItr != hbheDigis.end(); ++hbheItr) {
422  addSignal(*hbheItr);
423  }
424 
425  // and the HF digis
426  for(HFDigiCollection::const_iterator hfItr = hfDigis.begin();
427  hfItr != hfDigis.end(); ++hfItr) {
428  addSignal(*hfItr);
429 
430  }
431 
432  int phiBin = 18;
433  int etaBin = 22;
434  int thresholds = 2;
435 
436  int fiberQIEThresh[phiBin][etaBin][thresholds];
437  int FGBit[18][22];
438 
439  for (int i = 0; i < phiBin; i++)
440  {
441  for (int j = 0; j < etaBin; j++)
442  {
443  FGBit[i][j] = 0;
444  for (int k = 0; k < thresholds; k++)
445  {
446  fiberQIEThresh[i][j][k] = 0;
447  }
448  }
449  }
450 
451  for(HFDigiCollection::const_iterator hfdigi = hfDigis.begin(); hfdigi != hfDigis.end(); hfdigi++)
452  {
453  HcalDetId hcalid = HcalDetId(hfdigi->id()) ;
454 
455  int ieta = hcalid.ieta();
456  int iphi = hcalid.iphi();
457  int presample = hfdigi->presamples();
458 
459  double qieval = hfdigi->sample(presample).adc();
460 
461  int GCTeta = converttoGCTeta(ieta);
462  int GCTphi = converttoGCTphi(iphi);
463 
464  if (qieval > FG_threshold1_ )
465  {
466  fiberQIEThresh[GCTphi][GCTeta][0]++;
467  }
468  if (qieval > FG_threshold2_)
469  {
470  fiberQIEThresh[GCTphi][GCTeta][1]++;
471  }
472  }
473 
474  // Calculate the final FG bit
475  for (int i = 0; i < phiBin; i++)
476  {
477  for (int j = 0; j < etaBin; j++)
478  {
479  if (fiberQIEThresh[i][j][0] > 0 && j < 4)
480  {
481  FGBit[i][0] = 1;
482  FGBit[i][2] = 1;
483  }
484  if (fiberQIEThresh[i][j][0] > 0 && j > 17)
485  {
486  FGBit[i][19] = 1;
487  FGBit[i][21] = 1;
488  }
489  if (fiberQIEThresh[i][j][1] > 0 && j < 4)
490  {
491  FGBit[i][1] = 1;
492  FGBit[i][3] = 1;
493  }
494  if (fiberQIEThresh[i][j][1] > 0 && j > 17)
495  {
496  FGBit[i][18] = 1;
497  FGBit[i][20] = 1;
498  }
499  }
500  }
501 
502 
503  for(SumMap::iterator mapItr = theSumMap.begin(); mapItr != theSumMap.end(); ++mapItr) {
504  result.push_back(HcalTriggerPrimitiveDigi(mapItr->first));
505  HcalTrigTowerDetId detId(mapItr->second.id());
506  if(detId.ietaAbs() >= theTrigTowerGeometry->firstHFTower())
507  {
508  int ietaTow = detId.ieta();
509  int iphiTow = detId.iphi();
510  analyzeHF(ietaTow, iphiTow, FGBit, mapItr->second, result.back(), rctlsb);
511  }
512  else{ analyze(mapItr->second, result.back()); }
513  }
514  return;
515 }
void analyze(IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result)
adds the actual RecHits
int i
Definition: DBlmapReader.cc:9
void analyzeHF(int ieta, int iphi, int(&FGBit)[18][22], IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result, float rctlsb)
std::vector< HBHEDataFrame >::const_iterator const_iterator
void push_back(T const &t)
const HcalTPGCompressor * outcoder_
int ieta() const
get the tower ieta
const HcalTrigTowerGeometry * theTrigTowerGeometry
int converttoGCTphi(int &phi)
int ieta() const
get the cell ieta
Definition: HcalDetId.h:51
int j
Definition: DBlmapReader.cc:9
const_iterator end() const
int iphi() const
get the cell iphi
Definition: HcalDetId.h:53
const HcaluLUTTPGCoder * incoder_
int converttoGCTeta(int &eta)
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 765 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, and HcalTrigTowerGeometry::towerIds().

Referenced by HcalTrigPrimDigiProducer::produce().

768  {
769  std::set<uint32_t> FrontEndErrors;
770 
772  const FEDRawData& raw = rawraw->FEDData(i);
773  if (raw.size()<12) continue;
774  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
775  if(!dccHeader) continue;
776  HcalHTRData htr;
777  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
778  if (!dccHeader->getSpigotPresent(spigot)) continue;
779  dccHeader->getSpigotData(spigot,htr,raw.size());
780  int dccid = dccHeader->getSourceId();
781  int errWord = htr.getErrorsWord() & 0x1FFFF;
782  bool HTRError = (!htr.check() || htr.isHistogramEvent() || (errWord & 0x800)!=0);
783 
784  if(HTRError) {
785  bool valid =false;
786  for(int fchan=0; fchan<3 && !valid; fchan++) {
787  for(int fib=0; fib<9 && !valid; fib++) {
788  HcalElectronicsId eid(fchan,fib,spigot,dccid-FEDNumbering::MINHCALFEDID);
789  eid.setHTR(htr.readoutVMECrateId(),htr.htrSlot(),htr.htrTopBottom());
790  DetId detId = emap->lookup(eid);
791  if(detId.null()) continue;
792  HcalSubdetector subdet=(HcalSubdetector(detId.subdetId()));
793  if (detId.det()!=4||
794  (subdet!=HcalBarrel && subdet!=HcalEndcap &&
795  subdet!=HcalForward )) continue;
796  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(detId);
797  for (std::vector<HcalTrigTowerDetId>::const_iterator triggerId=ids.begin(); triggerId != ids.end(); ++triggerId) {
798  FrontEndErrors.insert(triggerId->rawId());
799  }
800  //valid = true;
801  }
802  }
803  }
804  }
805  }
806 
807  // Loop over TP collection
808  // Set TP to zero if there is FE Format Error
809  HcalTriggerPrimitiveSample zeroSample(0);
810  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp){
811  if (FrontEndErrors.find(tp->id().rawId()) != FrontEndErrors.end()) {
812  for (int i=0; i<tp->size(); ++i) tp->setSample(i, zeroSample);
813  }
814  }
815 }
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 751 of file HcalTriggerPrimitiveAlgo.cc.

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

Referenced by HcalTrigPrimDigiProducer::produce().

751  {
752  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp){
753  bool ZS = true;
754  for (int i=0; i<tp->size(); ++i) {
755  if (tp->sample(i).compressedEt() > ZS_threshold_I_) {
756  ZS=false;
757  break;
758  }
759  }
760  if (ZS) tp->setZSInfo(false,true);
761  else tp->setZSInfo(true,false);
762  }
763 }
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 827 of file HcalTriggerPrimitiveAlgo.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, Exception, and peak_finder_algorithm_.

Referenced by HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer().

827  {
828  if (algo <=0 && algo>2)
829  throw cms::Exception("ERROR: Only algo 1 & 2 are supported.") << std::endl;
831 }

Member Data Documentation

uint32_t HcalTriggerPrimitiveAlgo::FG_threshold1_
private

Definition at line 62 of file HcalTriggerPrimitiveAlgo.h.

Referenced by run().

uint32_t HcalTriggerPrimitiveAlgo::FG_threshold2_
private

Definition at line 63 of file HcalTriggerPrimitiveAlgo.h.

Referenced by run().

FGbitMap HcalTriggerPrimitiveAlgo::fgMap_
private

Definition at line 104 of file HcalTriggerPrimitiveAlgo.h.

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

TowerMapVeto HcalTriggerPrimitiveAlgo::HF_Veto
private

Definition at line 101 of file HcalTriggerPrimitiveAlgo.h.

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

const HcaluLUTTPGCoder* HcalTriggerPrimitiveAlgo::incoder_
private

Definition at line 56 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), and run().

int HcalTriggerPrimitiveAlgo::latency_
private

Definition at line 61 of file HcalTriggerPrimitiveAlgo.h.

uint32_t HcalTriggerPrimitiveAlgo::minSignalThreshold_
private

Definition at line 70 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal().

int HcalTriggerPrimitiveAlgo::numberOfPresamples_
private

Definition at line 67 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::numberOfPresamplesHF_
private

Definition at line 69 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF(), and HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::numberOfSamples_
private

Definition at line 66 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::numberOfSamplesHF_
private

Definition at line 68 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF(), and HcalTriggerPrimitiveAlgo().

const HcalTPGCompressor* HcalTriggerPrimitiveAlgo::outcoder_
private

Definition at line 57 of file HcalTriggerPrimitiveAlgo.h.

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

int HcalTriggerPrimitiveAlgo::peak_finder_algorithm_
private

Definition at line 77 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and setPeakFinderAlgorithm().

bool HcalTriggerPrimitiveAlgo::peakfind_
private

Definition at line 59 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze(), and HcalTriggerPrimitiveAlgo().

uint32_t HcalTriggerPrimitiveAlgo::PMT_NoiseThreshold_
private

Definition at line 71 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyzeHF().

SumMap HcalTriggerPrimitiveAlgo::theSumMap
private

Definition at line 85 of file HcalTriggerPrimitiveAlgo.h.

Referenced by addSignal(), and run().

double HcalTriggerPrimitiveAlgo::theThreshold
private

Definition at line 58 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze().

TowerMapFGSum HcalTriggerPrimitiveAlgo::theTowerMapFGSum
private

Definition at line 89 of file HcalTriggerPrimitiveAlgo.h.

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

const HcalTrigTowerGeometry* HcalTriggerPrimitiveAlgo::theTrigTowerGeometry
private

Definition at line 82 of file HcalTriggerPrimitiveAlgo.h.

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

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

Definition at line 60 of file HcalTriggerPrimitiveAlgo.h.

Referenced by analyze().

uint32_t HcalTriggerPrimitiveAlgo::ZS_threshold_
private

Definition at line 64 of file HcalTriggerPrimitiveAlgo.h.

Referenced by HcalTriggerPrimitiveAlgo().

int HcalTriggerPrimitiveAlgo::ZS_threshold_I_
private

Definition at line 65 of file HcalTriggerPrimitiveAlgo.h.

Referenced by HcalTriggerPrimitiveAlgo(), and runZS().