CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalFenixTcpFormat.cc
Go to the documentation of this file.
6 #include <iostream>
7 
8 using namespace std;
9 
10 EcalFenixTcpFormat::EcalFenixTcpFormat(bool tcpFormat, bool debug, bool famos,int binOfMax)
11  : tcpFormat_(tcpFormat),debug_(debug),famos_(famos),binOfMax_(binOfMax)
12 {
13  status_=0;
15 }
16 
18 }
19 
20 
21 void EcalFenixTcpFormat::process(std::vector<int> &Et, std::vector<int> &fgvb, int eTTotShift,
22  std::vector<EcalTriggerPrimitiveSample> & out,
23  std::vector<EcalTriggerPrimitiveSample> & out2, bool isInInnerRings){
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 
28  int myEt;
29  if (famos_) {
30  for (unsigned int i=0; i<out.size();++i) {
31  if (i==binOfMax_-1) {
32  myEt=Et[0]>>eTTotShift;
33  if (myEt>0x3ff) myEt=0x3ff ;
34  if (isInInnerRings) myEt = myEt /2 ;
35 
36  // badTTStatus_ ==0 if the TT works
37  // badTTStatus_ !=0 if there are some problems
38  int lut_out;
39  if (*badTTStatus_!=0){
40  lut_out = 0;
41  }
42  else
43  lut_out = (lut_)[myEt] ;
44 
45  int ttFlag = (lut_out & 0x700) >> 8 ;
46  myEt = lut_out & 0xff ;
47  out[i]=EcalTriggerPrimitiveSample( myEt,fgvb[0],ttFlag);
48  }
49  else out[i]=EcalTriggerPrimitiveSample( );
50  }
51  }
52  else {
53  for (unsigned int i=0; i<Et.size();++i) {
54  int myFgvb=fgvb[i];
55  //myEt=Et[i]>>eTTotShift;
56  //if (myEt>0x3ff) myEt=0x3ff ;
57  //if (isInInnerRings) myEt = myEt /2 ;
58 
59  // bug fix 091009:
60  myEt=Et[i];
61  if (myEt>0xfff)
62  myEt=0xfff ;
63  if (isInInnerRings)
64  myEt = myEt /2 ;
65  myEt >>= eTTotShift ;
66  if (myEt>0x3ff) myEt=0x3ff ;
67 
68  int lut_out;
69  if (*badTTStatus_!=0){
70  lut_out = 0;
71  }
72  else
73  lut_out = (lut_)[myEt] ;
74 
75  int ttFlag = (lut_out & 0x700) >> 8 ;
76  if (tcpFormat_) {
77  out2[i]=EcalTriggerPrimitiveSample( ((ttFlag&0x7)<<11) | ((myFgvb & 0x1)<<10) | (myEt & 0x3ff));
78  }
79  myEt = lut_out & 0xff ;
80  out[i]=EcalTriggerPrimitiveSample( myEt,myFgvb,ttFlag);
81  }
82  }
83 }
84 
85 void EcalFenixTcpFormat::setParameters(uint32_t towid,const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT)
86 {
87  const EcalTPGGroups::EcalTPGGroupsMap & groupmap = ecaltpgLutGroup -> getMap();
88  EcalTPGGroups::EcalTPGGroupsMapItr it=groupmap.find(towid);
89  if (it!=groupmap.end()) {
90  uint32_t lutid=(*it).second;
91  const EcalTPGLutIdMap::EcalTPGLutMap &lutmap = ecaltpgLut-> getMap();
92  EcalTPGLutIdMap::EcalTPGLutMapItr itl=lutmap.find(lutid);
93  if (itl!=lutmap.end()) {
94  lut_=(*itl).second.getLut();
95  } else edm::LogWarning("EcalTPG")<<" could not find EcalTPGLutMap for "<<lutid;
96 
97  }
98  else edm::LogWarning("EcalTPG")<<" could not find EcalTPGFineGrainTowerEEMap for "<<towid;
99 
100  const EcalTPGTowerStatusMap & badTTMap = ecaltpgbadTT -> getMap();
101  EcalTPGTowerStatusMapIterator itbadTT = badTTMap.find(towid);
102  if (itbadTT!=badTTMap.end()) {
103  badTTStatus_=&(*itbadTT).second;
104  }
105 }
106 
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
int i
Definition: DBlmapReader.cc:9
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:21
const uint16_t * badTTStatus_
void setParameters(uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT)
const unsigned int * lut_
tuple out
Definition: dbtoconf.py:99
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
EcalFenixTcpFormat(bool tccFormat, bool debug, bool famos, int binOfMax)
#define debug
Definition: MEtoEDMFormat.h:34
virtual std::vector< int > process(std::vector< int >, std::vector< int >)
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:20
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr