CMS 3D CMS Logo

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

#include <EcalFenixTcpFormatEE.h>

Public Member Functions

 EcalFenixTcpFormatEE (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, bool isInInnerRings)
 
void setParameters (uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike, const EcalTPGTPMode *ecaltpgTPMode)
 
virtual ~EcalFenixTcpFormatEE ()
 

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 23 of file EcalFenixTcpFormatEE.h.

Constructor & Destructor Documentation

◆ EcalFenixTcpFormatEE()

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

Definition at line 11 of file EcalFenixTcpFormatEE.cc.

References badTTStatus_, and status_.

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

◆ ~EcalFenixTcpFormatEE()

EcalFenixTcpFormatEE::~EcalFenixTcpFormatEE ( )
virtual

Definition at line 17 of file EcalFenixTcpFormatEE.cc.

17 {}

Member Function Documentation

◆ process() [1/2]

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

Definition at line 27 of file EcalFenixTcpFormatEE.h.

References findQualityFiles::v.

Referenced by EcalFenixTcp::process_part2_endcap().

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

◆ process() [2/2]

void EcalFenixTcpFormatEE::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,
bool  isInInnerRings 
)

Definition at line 19 of file EcalFenixTcpFormatEE.cc.

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

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

◆ setParameters()

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

Definition at line 120 of file EcalFenixTcpFormatEE.cc.

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

Referenced by EcalFenixTcp::process_part2_endcap().

125  {
126  // Get TP zeroing threshold - defaut to 1023 for old data (no record found or
127  // EE)
128  spikeZeroThresh_ = 1023;
129  if (ecaltpgSpike != nullptr) {
130  const EcalTPGSpike::EcalTPGSpikeMap &spikeMap = ecaltpgSpike->getMap();
131  EcalTPGSpike::EcalTPGSpikeMapIterator sit = spikeMap.find(towid);
132  if (sit != spikeMap.end()) {
133  spikeZeroThresh_ = sit->second;
134  }
135  }
136 
137  const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgLutGroup->getMap();
138  EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(towid);
139  if (it != groupmap.end()) {
140  uint32_t lutid = (*it).second;
141  const EcalTPGLutIdMap::EcalTPGLutMap &lutmap = ecaltpgLut->getMap();
142  EcalTPGLutIdMap::EcalTPGLutMapItr itl = lutmap.find(lutid);
143  if (itl != lutmap.end()) {
144  lut_ = (*itl).second.getLut();
145  } else
146  edm::LogWarning("EcalTPG") << " could not find EcalTPGLutMap for " << lutid;
147 
148  } else
149  edm::LogWarning("EcalTPG") << " could not find EcalTPGFineGrainTowerEEMap for " << towid;
150 
151  const EcalTPGTowerStatusMap &badTTMap = ecaltpgbadTT->getMap();
152  EcalTPGTowerStatusMapIterator itbadTT = badTTMap.find(towid);
153  if (itbadTT != badTTMap.end()) {
154  badTTStatus_ = &(*itbadTT).second;
155  }
156 
157  ecaltpgTPMode_ = ecaltpgTPMode;
158 }
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
const EcalTPGLutMap & getMap() const
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
const unsigned int * lut_
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
const uint16_t * badTTStatus_
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* EcalFenixTcpFormatEE::badTTStatus_
private

Definition at line 48 of file EcalFenixTcpFormatEE.h.

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

◆ binOfMax_

unsigned int EcalFenixTcpFormatEE::binOfMax_
private

Definition at line 53 of file EcalFenixTcpFormatEE.h.

Referenced by process().

◆ debug_

bool EcalFenixTcpFormatEE::debug_
private

Definition at line 51 of file EcalFenixTcpFormatEE.h.

◆ ecaltpgTPMode_

const EcalTPGTPMode* EcalFenixTcpFormatEE::ecaltpgTPMode_
private

Definition at line 55 of file EcalFenixTcpFormatEE.h.

Referenced by process(), and setParameters().

◆ famos_

bool EcalFenixTcpFormatEE::famos_
private

Definition at line 52 of file EcalFenixTcpFormatEE.h.

Referenced by process().

◆ lut_

const unsigned int* EcalFenixTcpFormatEE::lut_
private

Definition at line 47 of file EcalFenixTcpFormatEE.h.

Referenced by process(), and setParameters().

◆ spikeZeroThresh_

uint16_t EcalFenixTcpFormatEE::spikeZeroThresh_
private

Definition at line 54 of file EcalFenixTcpFormatEE.h.

Referenced by process(), and setParameters().

◆ status_

uint16_t EcalFenixTcpFormatEE::status_
private

Definition at line 49 of file EcalFenixTcpFormatEE.h.

Referenced by EcalFenixTcpFormatEE().

◆ tcpFormat_

bool EcalFenixTcpFormatEE::tcpFormat_
private

Definition at line 50 of file EcalFenixTcpFormatEE.h.

Referenced by process().