CMS 3D CMS Logo

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

Formatting for Fenix Tcp input 10 bits from Ettot 1 bit from fgvb 3 bits TriggerTowerFlag output: 16 bits simple formatting. More...

#include <EcalEBFenixTcpFormat.h>

Public Member Functions

 EcalEBFenixTcpFormat (bool tccFormat, bool debug, bool famos, int binOfMax)
 
void process (std::vector< int > &, std::vector< int > &)
 
void process (std::vector< int > &Et, std::vector< int > &fgvb, std::vector< int > &sfgvb, int eTTotShift, std::vector< EcalEBTriggerPrimitiveSample > &out, std::vector< EcalEBTriggerPrimitiveSample > &outTcc, bool isInInnerRings)
 
void setParameters (uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike)
 
virtual ~EcalEBFenixTcpFormat ()
 

Private Attributes

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

Detailed Description

Formatting for Fenix Tcp input 10 bits from Ettot 1 bit from fgvb 3 bits TriggerTowerFlag output: 16 bits simple formatting.

Definition at line 22 of file EcalEBFenixTcpFormat.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file EcalEBFenixTcpFormat.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
EcalEBFenixTcpFormat::~EcalEBFenixTcpFormat ( )
virtual

Definition at line 17 of file EcalEBFenixTcpFormat.cc.

17 {}

Member Function Documentation

void EcalEBFenixTcpFormat::process ( std::vector< int > &  Etin,
std::vector< int > &  Etout 
)

Definition at line 19 of file EcalEBFenixTcpFormat.cc.

References mps_fire::i.

Referenced by EcalEBTrigPrimTestAlgo::run().

19  {
20  // put TP-s in the output
21  // on request also in TcpFormat
22  // for famos version we have to write dummies except for the middle
23  // std::cout << " EcalEBFenixTcpFormat::process(... Etout size " << Etout.size() << " Et size " << Etin.size() << std::endl;
24 
25  int myEt;
26  int eTTotShift = 2;
27 
28  // std::cout << " FenixTcpFormatter Etin size() " << Etin.size() << std::endl;
29  for (unsigned int i = 0; i < Etin.size(); ++i) {
30  // bug fix 091009:
31  myEt = Etin[i];
32  //std::cout << " Et " << myEt << std::endl;
33  if (myEt > 0xfff)
34  myEt = 0xfff;
35 
36  myEt >>= eTTotShift;
37  //std::cout << " after myEt>>= eTTotShift " << myEt << std::endl;
38  if (myEt > 0x3ff)
39  myEt = 0x3ff;
40 
41  //myEt = lut_out & 0xff ;
42  // the lut is foreseen for 8 bits. Useless to use it here
43 
44  // stay with 10 bits
45  Etout[i] = myEt;
46  }
47 }
void EcalEBFenixTcpFormat::process ( std::vector< int > &  Et,
std::vector< int > &  fgvb,
std::vector< int > &  sfgvb,
int  eTTotShift,
std::vector< EcalEBTriggerPrimitiveSample > &  out,
std::vector< EcalEBTriggerPrimitiveSample > &  outTcc,
bool  isInInnerRings 
)

Definition at line 49 of file EcalEBFenixTcpFormat.cc.

References badTTStatus_, binOfMax_, famos_, mps_fire::i, lut_, spikeZeroThresh_, and tcpFormat_.

55  {
56  // put TP-s in the output
57  // on request also in TcpFormat
58  // for famos version we have to write dummies except for the middle
59  //std::cout << " EcalEBFenixTcpFormat::process(... out size " << out.size() << " Et size " << Et.size() << " Et[0] " << Et[0] << std::endl;
60 
61  int myEt;
62  if (famos_) {
63  for (unsigned int i = 0; i < out.size(); ++i) {
64  if (i == binOfMax_ - 1) {
65  myEt = Et[0] >> eTTotShift;
66  if (myEt > 0x3ff)
67  myEt = 0x3ff;
68  if (isInInnerRings)
69  myEt = myEt / 2;
70 
71  // badTTStatus_ ==0 if the TT works
72  // badTTStatus_ !=0 if there are some problems
73  int lut_out;
74  if (*badTTStatus_ != 0) {
75  lut_out = 0;
76  } else
77  lut_out = (lut_)[myEt];
78 
79  // int ttFlag = (lut_out & 0x700) >> 8 ;
80  myEt = lut_out & 0xff;
81  // out[i]=EcalEBTriggerPrimitiveSample( myEt,fgvb[0],sfgvb[0],ttFlag);
83  } else
85  }
86  } else {
87  //std::cout << " FenixTcpFormatter et.size() " << Et.size() << std::endl;
88  for (unsigned int i = 0; i < Et.size(); ++i) {
89  //int myFgvb=fgvb[i];
90  int mysFgvb = sfgvb[i];
91  //myEt=Et[i]>>eTTotShift;
92  //if (myEt>0x3ff) myEt=0x3ff ;
93  //if (isInInnerRings) myEt = myEt /2 ;
94 
95  // bug fix 091009:
96  myEt = Et[i];
97  //std::cout << " Et " << myEt << std::endl;
98  if (myEt > 0xfff)
99  myEt = 0xfff;
100  if (isInInnerRings)
101  myEt = myEt / 2;
102  myEt >>= eTTotShift;
103  //std::cout << " after myEt>>= eTTotShift " << myEt << std::endl;
104  if (myEt > 0x3ff)
105  myEt = 0x3ff;
106 
107  // Spike killing
108  if ((myEt > spikeZeroThresh_) && (mysFgvb == 0)) {
109  myEt = 0;
110  }
111 
112  int lut_out;
113  if (*badTTStatus_ != 0) {
114  lut_out = 0;
115  } else
116  lut_out = (lut_)[myEt];
117 
118  //int ttFlag = (lut_out & 0x700) >> 8 ;
119  if (tcpFormat_) {
120  out2[i] = EcalEBTriggerPrimitiveSample(myEt & 0x3ff);
121  //std::cout << " FenixTcpFormatter final et " << (myEt & 0x3ff) << std::endl;
122  }
123 
124  myEt = lut_out & 0xff;
125  //std::cout << " FenixTcpFormatter final lut_out " << lut_out << " 0xff " << 0xff << " et " << myEt << std::endl;
127  }
128  }
129 }
const unsigned int * lut_
const uint16_t * badTTStatus_
void EcalEBFenixTcpFormat::setParameters ( uint32_t  towid,
const EcalTPGLutGroup ecaltpgLutGroup,
const EcalTPGLutIdMap ecaltpgLut,
const EcalTPGTowerStatus ecaltpgbadTT,
const EcalTPGSpike ecaltpgSpike 
)

Definition at line 131 of file EcalEBFenixTcpFormat.cc.

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

Referenced by EcalEBTrigPrimTestAlgo::run().

135  {
136  // Get TP zeroing threshold - defaut to 1023 for old data (no record found or EE)
137  spikeZeroThresh_ = 1023;
138  if (ecaltpgSpike != nullptr) {
139  const EcalTPGSpike::EcalTPGSpikeMap &spikeMap = ecaltpgSpike->getMap();
140  EcalTPGSpike::EcalTPGSpikeMapIterator sit = spikeMap.find(towid);
141  if (sit != spikeMap.end()) {
142  spikeZeroThresh_ = sit->second;
143  }
144  }
145 
146  const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgLutGroup->getMap();
147  EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(towid);
148  if (it != groupmap.end()) {
149  uint32_t lutid = (*it).second;
150  const EcalTPGLutIdMap::EcalTPGLutMap &lutmap = ecaltpgLut->getMap();
151  EcalTPGLutIdMap::EcalTPGLutMapItr itl = lutmap.find(lutid);
152  if (itl != lutmap.end()) {
153  lut_ = (*itl).second.getLut();
154  //std::cout << " FenixTcpFormatter lut_ " << std::dec<<lut_ << std::endl;
155  } else
156  edm::LogWarning("EcalTPG") << " could not find EcalTPGLutMap for " << lutid;
157 
158  } else
159  edm::LogWarning("EcalTPG") << " could not find EcalTPGFineGrainTowerEEMap for " << towid;
160 
161  const EcalTPGTowerStatusMap &badTTMap = ecaltpgbadTT->getMap();
162  EcalTPGTowerStatusMapIterator itbadTT = badTTMap.find(towid);
163  if (itbadTT != badTTMap.end()) {
164  badTTStatus_ = &(*itbadTT).second;
165  }
166 }
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
const unsigned int * lut_
const uint16_t * badTTStatus_
std::map< uint32_t, uint16_t >::const_iterator EcalTPGSpikeMapIterator
Definition: EcalTPGSpike.h:12
const EcalTPGLutMap & getMap() const
const std::map< uint32_t, uint16_t > & getMap() const
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
std::map< uint32_t, uint16_t > EcalTPGSpikeMap
Definition: EcalTPGSpike.h:11
Log< level::Warning, false > LogWarning
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
const std::map< uint32_t, uint16_t > & getMap() const
Definition: EcalTPGSpike.h:18

Member Data Documentation

const uint16_t* EcalEBFenixTcpFormat::badTTStatus_
private

Definition at line 43 of file EcalEBFenixTcpFormat.h.

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

unsigned int EcalEBFenixTcpFormat::binOfMax_
private

Definition at line 48 of file EcalEBFenixTcpFormat.h.

Referenced by process().

bool EcalEBFenixTcpFormat::debug_
private

Definition at line 46 of file EcalEBFenixTcpFormat.h.

bool EcalEBFenixTcpFormat::famos_
private

Definition at line 47 of file EcalEBFenixTcpFormat.h.

Referenced by process().

const unsigned int* EcalEBFenixTcpFormat::lut_
private

Definition at line 42 of file EcalEBFenixTcpFormat.h.

Referenced by process(), and setParameters().

uint16_t EcalEBFenixTcpFormat::spikeZeroThresh_
private

Definition at line 49 of file EcalEBFenixTcpFormat.h.

Referenced by process(), and setParameters().

uint16_t EcalEBFenixTcpFormat::status_
private

Definition at line 44 of file EcalEBFenixTcpFormat.h.

Referenced by EcalEBFenixTcpFormat().

bool EcalEBFenixTcpFormat::tcpFormat_
private

Definition at line 45 of file EcalEBFenixTcpFormat.h.

Referenced by process().