CMS 3D CMS Logo

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

#include <EcalFenixTcpFormat.h>

Public Member Functions

 EcalFenixTcpFormat (bool tccFormat, bool debug, bool famos, int binOfMax)
 
 EcalFenixTcpFormat (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, std::vector< int > &fgvb, std::vector< int > &sfgvb, int eTTotShift, std::vector< EcalTriggerPrimitiveSample > &out, std::vector< EcalTriggerPrimitiveSample > &outTcc, bool isInInnerRings)
 
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)
 
void setParameters (uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike)
 
virtual ~EcalFenixTcpFormat ()
 
virtual ~EcalFenixTcpFormat ()
 

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

Definition at line 22 of file EcalFenixTcpFormat.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file EcalFenixTcpFormat.cc.

References badTTStatus_, and status_.

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

Definition at line 18 of file EcalFenixTcpFormat.cc.

18  {
19 }
EcalFenixTcpFormat::EcalFenixTcpFormat ( bool  tccFormat,
bool  debug,
bool  famos,
int  binOfMax 
)
virtual EcalFenixTcpFormat::~EcalFenixTcpFormat ( )
virtual

Member Function Documentation

virtual std::vector<int> EcalFenixTcpFormat::process ( const std::vector< int > &  ,
const std::vector< int > &   
)
inlinevirtual
void EcalFenixTcpFormat::process ( std::vector< int > &  Etin,
std::vector< int > &  Etout 
)

Definition at line 23 of file EcalFenixTcpFormat.cc.

References mps_fire::i.

Referenced by process(), EcalFenixTcp::process_part2_barrel(), EcalFenixTcp::process_part2_endcap(), and EcalEBTrigPrimTestAlgo::run().

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

Definition at line 22 of file EcalFenixTcpFormat.cc.

References badTTStatus_, binOfMax_, famos_, EcalTPGSpike::getMap(), mps_fire::i, lut_, setParameters(), spikeZeroThresh_, tcpFormat_, and globals_cff::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;
31  if (famos_) {
32  for (unsigned int i=0; i<out.size();++i) {
33  if (i==binOfMax_-1) {
34  myEt=Et[0]>>eTTotShift;
35  if (myEt>0x3ff) myEt=0x3ff ;
36  if (isInInnerRings) myEt = myEt /2 ;
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  }
44  else
45  lut_out = (lut_)[myEt] ;
46 
47  int ttFlag = (lut_out & 0x700) >> 8 ;
48  myEt = lut_out & 0xff ;
49  out[i]=EcalTriggerPrimitiveSample( myEt,fgvb[0],sfgvb[0],ttFlag);
50  }
52  }
53  }
54  else {
55  for (unsigned int i=0; i<Et.size();++i) {
56  int myFgvb=fgvb[i];
57  int mysFgvb=sfgvb[i];
58  //myEt=Et[i]>>eTTotShift;
59  //if (myEt>0x3ff) myEt=0x3ff ;
60  //if (isInInnerRings) myEt = myEt /2 ;
61 
62  // bug fix 091009:
63  myEt=Et[i];
64  if (myEt>0xfff)
65  myEt=0xfff ;
66  if (isInInnerRings)
67  myEt = myEt /2 ;
68  myEt >>= eTTotShift ;
69  if (myEt>0x3ff) myEt=0x3ff ;
70 
71  // Spike killing
72  if((myEt > spikeZeroThresh_) && (mysFgvb == 0))
73  {
74  myEt = 0;
75  }
76 
77  int lut_out;
78  if (*badTTStatus_!=0){
79  lut_out = 0;
80  }
81  else
82  lut_out = (lut_)[myEt] ;
83 
84  int ttFlag = (lut_out & 0x700) >> 8 ;
85  if (tcpFormat_) {
86  out2[i]=EcalTriggerPrimitiveSample( ((ttFlag&0x7)<<11) | ((myFgvb & 0x1)<<10) | (myEt & 0x3ff));
87  }
88  myEt = lut_out & 0xff ;
89  out[i]=EcalTriggerPrimitiveSample( myEt,myFgvb,mysFgvb,ttFlag);
90  }
91  }
92 }
const uint16_t * badTTStatus_
const unsigned int * lut_
void EcalFenixTcpFormat::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 57 of file EcalFenixTcpFormat.cc.

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

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

Definition at line 137 of file EcalFenixTcpFormat.cc.

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

Referenced by process(), EcalFenixTcp::process_part2_barrel(), EcalFenixTcp::process_part2_endcap(), and EcalEBTrigPrimTestAlgo::run().

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

Member Data Documentation

const uint16_t * EcalFenixTcpFormat::badTTStatus_
private

Definition at line 34 of file EcalFenixTcpFormat.h.

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

unsigned int EcalFenixTcpFormat::binOfMax_
private

Definition at line 39 of file EcalFenixTcpFormat.h.

Referenced by process().

bool EcalFenixTcpFormat::debug_
private

Definition at line 37 of file EcalFenixTcpFormat.h.

Referenced by process().

bool EcalFenixTcpFormat::famos_
private

Definition at line 38 of file EcalFenixTcpFormat.h.

Referenced by process().

const unsigned int * EcalFenixTcpFormat::lut_
private

Definition at line 33 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

uint16_t EcalFenixTcpFormat::spikeZeroThresh_
private

Definition at line 40 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

uint16_t EcalFenixTcpFormat::status_
private

Definition at line 35 of file EcalFenixTcpFormat.h.

Referenced by EcalFenixTcpFormat(), and process().

bool EcalFenixTcpFormat::tcpFormat_
private

Definition at line 36 of file EcalFenixTcpFormat.h.

Referenced by process().