CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalFenixTcpFormatEB Class Reference

#include <EcalFenixTcpFormatEB.h>

Public Member Functions

 EcalFenixTcpFormatEB (bool tccFormat, bool debug, bool famos, int binOfMax)
 
virtual std::vector< int > process (const std::vector< int > &, const std::vector< int > &)
 
void process (std::vector< int > &Et_even_sum, std::vector< int > &Et_odd_sum, std::vector< int > &fgvb, std::vector< int > &sfgvb, int eTTotShift, std::vector< EcalTriggerPrimitiveSample > &out, std::vector< EcalTriggerPrimitiveSample > &outTcc)
 
void setParameters (uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike, const EcalTPGTPMode *ecaltpgTPMode)
 
virtual ~EcalFenixTcpFormatEB ()
 

Private Attributes

const uint16_t * badTTStatus_
 
unsigned int binOfMax_
 
bool debug_
 
const EcalTPGTPModeecaltpgTPMode_
 
bool famos_
 
const unsigned int * lut_
 
uint16_t spikeZeroThresh_
 
uint16_t status_
 
bool tcpFormat_
 

Detailed Description

Definition at line 24 of file EcalFenixTcpFormatEB.h.

Constructor & Destructor Documentation

◆ EcalFenixTcpFormatEB()

EcalFenixTcpFormatEB::EcalFenixTcpFormatEB ( bool  tccFormat,
bool  debug,
bool  famos,
int  binOfMax 
)

Definition at line 11 of file EcalFenixTcpFormatEB.cc.

References badTTStatus_, and status_.

12  : tcpFormat_(tcpFormat), debug_(debug), famos_(famos), binOfMax_(binOfMax) {
13  status_ = 0;
15 }
const uint16_t * badTTStatus_
#define debug
Definition: HDRShower.cc:19

◆ ~EcalFenixTcpFormatEB()

EcalFenixTcpFormatEB::~EcalFenixTcpFormatEB ( )
virtual

Definition at line 17 of file EcalFenixTcpFormatEB.cc.

17 {}

Member Function Documentation

◆ process() [1/2]

virtual std::vector<int> EcalFenixTcpFormatEB::process ( const std::vector< int > &  ,
const std::vector< int > &   
)
inlinevirtual

Definition at line 28 of file EcalFenixTcpFormatEB.h.

References findQualityFiles::v.

Referenced by EcalFenixTcp::process_part2_barrel().

28  {
29  std::vector<int> v;
30  return v;
31  }

◆ process() [2/2]

void EcalFenixTcpFormatEB::process ( std::vector< int > &  Et_even_sum,
std::vector< int > &  Et_odd_sum,
std::vector< int > &  fgvb,
std::vector< int > &  sfgvb,
int  eTTotShift,
std::vector< EcalTriggerPrimitiveSample > &  out,
std::vector< EcalTriggerPrimitiveSample > &  outTcc 
)

Definition at line 19 of file EcalFenixTcpFormatEB.cc.

References badTTStatus_, binOfMax_, EcalTPGTPMode::EBFenixTcpInfobit1, EcalTPGTPMode::EBFenixTcpOutput, ecaltpgTPMode_, famos_, mps_fire::i, lut_, MillePedeFileConverter_cfg::out, PointingDoubleMultiSkim_cfg::out2, spikeZeroThresh_, tcpFormat_, and testProducerWithPsetDescEmpty_cfi::x1.

25  {
26  // put TP-s in the output
27  // on request also in TcpFormat
28  // for famos version we have to write dummies except for the middle
29 
30  int myEt = 0;
31  if (famos_) {
32  for (unsigned int i = 0; i < out.size(); ++i) {
33  if (i == binOfMax_ - 1) {
34  myEt = Et_even_sum[i] >> eTTotShift;
35  if (myEt > 0x3ff)
36  myEt = 0x3ff;
37 
38  // badTTStatus_ ==0 if the TT works
39  // badTTStatus_ !=0 if there are some problems
40  int lut_out;
41  if (*badTTStatus_ != 0) {
42  lut_out = 0;
43  } else
44  lut_out = (lut_)[myEt];
45 
46  int ttFlag = (lut_out & 0x700) >> 8;
47  myEt = lut_out & 0xff;
48  out[i] = EcalTriggerPrimitiveSample(myEt, fgvb[0], sfgvb[0], ttFlag);
49  } else
51  }
52  } else {
53  for (unsigned int i = 0; i < Et_even_sum.size(); ++i) {
54  int myFgvb = fgvb[i];
55  int mysFgvb = sfgvb[i];
56  bool is_odd_larger = false;
57 
58  // Check if odd sum is larger than even sum, in case flag_EB_odd_even_tcp is used
59  if (Et_odd_sum[i] > Et_even_sum[i]) {
60  is_odd_larger = true;
61  }
62 
64  case 0: //output even sum
65  myEt = Et_even_sum[i];
66  break;
67  case 1: // output larger of odd and even
68  if (Et_odd_sum[i] > Et_even_sum[i]) {
69  myEt = Et_odd_sum[i];
70  } else {
71  myEt = Et_even_sum[i];
72  }
73  break;
74  case 2: // output even+odd
75  myEt = Et_even_sum[i] + Et_odd_sum[i];
76  break;
77  default:
78  // In case of unknown configuration switch to default
79  myEt = Et_even_sum[i];
80  break;
81  }
82 
83  // check TPmode config to decide to output the FGVB or the odd>even flag
84  int infobit1 = myFgvb;
86  infobit1 = is_odd_larger;
87 
88  if (myEt > 0xfff)
89  myEt = 0xfff;
90  myEt >>= eTTotShift;
91  if (myEt > 0x3ff)
92  myEt = 0x3ff;
93 
94  // Spike killer
95  if ((myEt > spikeZeroThresh_) && (mysFgvb == 0)) {
96  myEt = 0;
97  }
98 
99  int lut_out;
100  if (*badTTStatus_ != 0) {
101  lut_out = 0;
102  } else
103  lut_out = (lut_)[myEt];
104 
105  int ttFlag = (lut_out & 0x700) >> 8;
106  if (tcpFormat_) {
107  out2[i] = EcalTriggerPrimitiveSample(((ttFlag & 0x7) << 11) | ((infobit1 & 0x1) << 10) | (myEt & 0x3ff));
108  }
109  myEt = lut_out & 0xff;
110  out[i] = EcalTriggerPrimitiveSample(myEt, infobit1, mysFgvb, ttFlag);
111  }
112  }
113 }
const uint16_t * badTTStatus_
uint16_t EBFenixTcpInfobit1
Definition: EcalTPGTPMode.h:28
const unsigned int * lut_
uint16_t EBFenixTcpOutput
Definition: EcalTPGTPMode.h:27
const EcalTPGTPMode * ecaltpgTPMode_

◆ setParameters()

void EcalFenixTcpFormatEB::setParameters ( uint32_t  towid,
const EcalTPGLutGroup ecaltpgLutGroup,
const EcalTPGLutIdMap ecaltpgLut,
const EcalTPGTowerStatus ecaltpgbadTT,
const EcalTPGSpike ecaltpgSpike,
const EcalTPGTPMode ecaltpgTPMode 
)

Definition at line 115 of file EcalFenixTcpFormatEB.cc.

References badTTStatus_, ecaltpgTPMode_, EcalTPGTowerStatus::getMap(), EcalTPGLutIdMap::getMap(), EcalTPGSpike::getMap(), EcalTPGGroups::getMap(), lut_, and spikeZeroThresh_.

Referenced by EcalFenixTcp::process_part2_barrel().

120  {
121  // Get TP zeroing threshold - defaut to 1023 for old data (no record found or
122  // EE)
123  spikeZeroThresh_ = 1023;
124  if (ecaltpgSpike != nullptr) {
125  const EcalTPGSpike::EcalTPGSpikeMap &spikeMap = ecaltpgSpike->getMap();
126  EcalTPGSpike::EcalTPGSpikeMapIterator sit = spikeMap.find(towid);
127  if (sit != spikeMap.end()) {
128  spikeZeroThresh_ = sit->second;
129  }
130  }
131 
132  const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgLutGroup->getMap();
133  EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(towid);
134  if (it != groupmap.end()) {
135  uint32_t lutid = (*it).second;
136  const EcalTPGLutIdMap::EcalTPGLutMap &lutmap = ecaltpgLut->getMap();
137  EcalTPGLutIdMap::EcalTPGLutMapItr itl = lutmap.find(lutid);
138  if (itl != lutmap.end()) {
139  lut_ = (*itl).second.getLut();
140  } else
141  edm::LogWarning("EcalTPG") << " could not find EcalTPGLutMap for " << lutid;
142 
143  } else
144  edm::LogWarning("EcalTPG") << " could not find EcalTPGFineGrainTowerEEMap for " << towid;
145 
146  const EcalTPGTowerStatusMap &badTTMap = ecaltpgbadTT->getMap();
147  EcalTPGTowerStatusMapIterator itbadTT = badTTMap.find(towid);
148  if (itbadTT != badTTMap.end()) {
149  badTTStatus_ = &(*itbadTT).second;
150  }
151 
152  ecaltpgTPMode_ = ecaltpgTPMode;
153 }
const uint16_t * badTTStatus_
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
const EcalTPGLutMap & getMap() const
const unsigned int * lut_
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
std::map< uint32_t, uint16_t >::const_iterator EcalTPGSpikeMapIterator
Definition: EcalTPGSpike.h:12
const EcalTPGTPMode * ecaltpgTPMode_
const std::map< uint32_t, uint16_t > & getMap() const
Definition: EcalTPGSpike.h:18
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
std::map< uint32_t, uint16_t > EcalTPGSpikeMap
Definition: EcalTPGSpike.h:11
const std::map< uint32_t, uint16_t > & getMap() const
Log< level::Warning, false > LogWarning
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr

Member Data Documentation

◆ badTTStatus_

const uint16_t* EcalFenixTcpFormatEB::badTTStatus_
private

Definition at line 48 of file EcalFenixTcpFormatEB.h.

Referenced by EcalFenixTcpFormatEB(), process(), and setParameters().

◆ binOfMax_

unsigned int EcalFenixTcpFormatEB::binOfMax_
private

Definition at line 53 of file EcalFenixTcpFormatEB.h.

Referenced by process().

◆ debug_

bool EcalFenixTcpFormatEB::debug_
private

Definition at line 51 of file EcalFenixTcpFormatEB.h.

◆ ecaltpgTPMode_

const EcalTPGTPMode* EcalFenixTcpFormatEB::ecaltpgTPMode_
private

Definition at line 55 of file EcalFenixTcpFormatEB.h.

Referenced by process(), and setParameters().

◆ famos_

bool EcalFenixTcpFormatEB::famos_
private

Definition at line 52 of file EcalFenixTcpFormatEB.h.

Referenced by process().

◆ lut_

const unsigned int* EcalFenixTcpFormatEB::lut_
private

Definition at line 47 of file EcalFenixTcpFormatEB.h.

Referenced by process(), and setParameters().

◆ spikeZeroThresh_

uint16_t EcalFenixTcpFormatEB::spikeZeroThresh_
private

Definition at line 54 of file EcalFenixTcpFormatEB.h.

Referenced by process(), and setParameters().

◆ status_

uint16_t EcalFenixTcpFormatEB::status_
private

Definition at line 49 of file EcalFenixTcpFormatEB.h.

Referenced by EcalFenixTcpFormatEB().

◆ tcpFormat_

bool EcalFenixTcpFormatEB::tcpFormat_
private

Definition at line 50 of file EcalFenixTcpFormatEB.h.

Referenced by process().