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 > &, 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 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 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() [1/2]

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

Definition at line 11 of file EcalFenixTcpFormat.cc.

12  : tcpFormat_(tcpFormat), debug_(debug), famos_(famos), binOfMax_(binOfMax) {
13  status_ = 0;
15 }

References badTTStatus_, and status_.

◆ ~EcalFenixTcpFormat() [1/2]

EcalFenixTcpFormat::~EcalFenixTcpFormat ( )
virtual

Definition at line 17 of file EcalFenixTcpFormat.cc.

17 {}

◆ EcalFenixTcpFormat() [2/2]

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

◆ ~EcalFenixTcpFormat() [2/2]

virtual EcalFenixTcpFormat::~EcalFenixTcpFormat ( )
virtual

Member Function Documentation

◆ process() [1/4]

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

Definition at line 26 of file EcalFenixTcpFormat.h.

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

References findQualityFiles::v.

◆ process() [2/4]

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

Definition at line 19 of file EcalFenixTcpFormat.cc.

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 << " EcalFenixTcpFormat::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 }

References mps_fire::i.

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

◆ process() [3/4]

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 49 of file EcalFenixTcpFormat.cc.

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 << " EcalFenixTcpFormat::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 }

References badTTStatus_, binOfMax_, famos_, mps_fire::i, lut_, MillePedeFileConverter_cfg::out, PointingDoubleMultiSkim_cfg::out2, spikeZeroThresh_, and tcpFormat_.

◆ process() [4/4]

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 19 of file EcalFenixTcpFormat.cc.

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)
36  myEt = 0x3ff;
37  if (isInInnerRings)
38  myEt = myEt / 2;
39 
40  // badTTStatus_ ==0 if the TT works
41  // badTTStatus_ !=0 if there are some problems
42  int lut_out;
43  if (*badTTStatus_ != 0) {
44  lut_out = 0;
45  } else
46  lut_out = (lut_)[myEt];
47 
48  int ttFlag = (lut_out & 0x700) >> 8;
49  myEt = lut_out & 0xff;
50  out[i] = EcalTriggerPrimitiveSample(myEt, fgvb[0], sfgvb[0], ttFlag);
51  } else
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)
70  myEt = 0x3ff;
71 
72  // Spike killing
73  if ((myEt > spikeZeroThresh_) && (mysFgvb == 0)) {
74  myEt = 0;
75  }
76 
77  int lut_out;
78  if (*badTTStatus_ != 0) {
79  lut_out = 0;
80  } else
81  lut_out = (lut_)[myEt];
82 
83  int ttFlag = (lut_out & 0x700) >> 8;
84  if (tcpFormat_) {
85  out2[i] = EcalTriggerPrimitiveSample(((ttFlag & 0x7) << 11) | ((myFgvb & 0x1) << 10) | (myEt & 0x3ff));
86  }
87  myEt = lut_out & 0xff;
88  out[i] = EcalTriggerPrimitiveSample(myEt, myFgvb, mysFgvb, ttFlag);
89  }
90  }
91 }

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

◆ setParameters() [1/2]

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

Definition at line 131 of file EcalFenixTcpFormat.cc.

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 }

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

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

◆ setParameters() [2/2]

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

Member Data Documentation

◆ badTTStatus_

const uint16_t * EcalFenixTcpFormat::badTTStatus_
private

Definition at line 43 of file EcalFenixTcpFormat.h.

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

◆ binOfMax_

unsigned int EcalFenixTcpFormat::binOfMax_
private

Definition at line 48 of file EcalFenixTcpFormat.h.

Referenced by process().

◆ debug_

bool EcalFenixTcpFormat::debug_
private

Definition at line 46 of file EcalFenixTcpFormat.h.

◆ famos_

bool EcalFenixTcpFormat::famos_
private

Definition at line 47 of file EcalFenixTcpFormat.h.

Referenced by process().

◆ lut_

const unsigned int * EcalFenixTcpFormat::lut_
private

Definition at line 42 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

◆ spikeZeroThresh_

uint16_t EcalFenixTcpFormat::spikeZeroThresh_
private

Definition at line 49 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

◆ status_

uint16_t EcalFenixTcpFormat::status_
private

Definition at line 44 of file EcalFenixTcpFormat.h.

Referenced by EcalFenixTcpFormat().

◆ tcpFormat_

bool EcalFenixTcpFormat::tcpFormat_
private

Definition at line 45 of file EcalFenixTcpFormat.h.

Referenced by process().

EcalTPGTowerStatus::getMap
const std::map< uint32_t, uint16_t > & getMap() const
Definition: EcalTPGTowerStatus.h:15
mps_fire.i
i
Definition: mps_fire.py:355
EcalFenixTcpFormat::status_
uint16_t status_
Definition: EcalFenixTcpFormat.h:44
EcalTPGLutIdMap::EcalTPGLutMap
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
Definition: EcalTPGLutIdMap.h:12
EcalTPGGroups::EcalTPGGroupsMapItr
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
EcalTPGTowerStatusMapIterator
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
Definition: EcalTPGTowerStatus.h:25
EcalFenixTcpFormat::binOfMax_
unsigned int binOfMax_
Definition: EcalFenixTcpFormat.h:48
findQualityFiles.v
v
Definition: findQualityFiles.py:179
EcalFenixTcpFormat::tcpFormat_
bool tcpFormat_
Definition: EcalFenixTcpFormat.h:45
EcalEBTriggerPrimitiveSample
Definition: EcalEBTriggerPrimitiveSample.h:12
EcalFenixTcpFormat::famos_
bool famos_
Definition: EcalFenixTcpFormat.h:47
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
EcalTPGSpike::getMap
const std::map< uint32_t, uint16_t > & getMap() const
Definition: EcalTPGSpike.h:18
debug
#define debug
Definition: HDRShower.cc:19
EcalTPGTowerStatusMap
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
Definition: EcalTPGTowerStatus.h:24
edm::LogWarning
Definition: MessageLogger.h:141
EcalTPGGroups::getMap
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
EcalFenixTcpFormat::debug_
bool debug_
Definition: EcalFenixTcpFormat.h:46
PointingDoubleMultiSkim_cfg.out2
out2
Definition: PointingDoubleMultiSkim_cfg.py:85
EcalTPGLutIdMap::EcalTPGLutMapItr
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
Definition: EcalTPGLutIdMap.h:13
EcalFenixTcpFormat::lut_
const unsigned int * lut_
Definition: EcalFenixTcpFormat.h:42
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
EcalTriggerPrimitiveSample
Definition: EcalTriggerPrimitiveSample.h:12
EcalTPGSpike::EcalTPGSpikeMapIterator
std::map< uint32_t, uint16_t >::const_iterator EcalTPGSpikeMapIterator
Definition: EcalTPGSpike.h:12
EcalFenixTcpFormat::spikeZeroThresh_
uint16_t spikeZeroThresh_
Definition: EcalFenixTcpFormat.h:49
EcalFenixTcpFormat::badTTStatus_
const uint16_t * badTTStatus_
Definition: EcalFenixTcpFormat.h:43
EcalTPGLutIdMap::getMap
const EcalTPGLutMap & getMap() const
Definition: EcalTPGLutIdMap.h:18
EcalTPGSpike::EcalTPGSpikeMap
std::map< uint32_t, uint16_t > EcalTPGSpikeMap
Definition: EcalTPGSpike.h:11
EcalTPGGroups::EcalTPGGroupsMap
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19