CMS 3D CMS Logo

EcalFenixFgvbEB.cc
Go to the documentation of this file.
5 
6 EcalFenixFgvbEB::EcalFenixFgvbEB(int maxNrSamples) { add_out_8_.resize(maxNrSamples); }
7 
9 
10 void EcalFenixFgvbEB::process(std::vector<int> &add_out, std::vector<int> &maxof2_out, std::vector<int> &output) {
11  int Elow, Ehigh, Tlow, Thigh, lut;
12  int ERatLow, ERatHigh;
13  // std::vector<int> add_out_8(add_out.size());
14  int COMP3, COMP2, COMP1, COMP0;
15 
16  // Elow = (*params_)[1024];
17  // Ehigh = (*params_)[1025];
18  // Tlow = (*params_)[1026];
19  // Thigh = (*params_)[1027];
20  // lut = (*params_)[1028];
21 
22  Elow = ETlow_;
23  Ehigh = EThigh_;
24  Tlow = Ratlow_;
25  Thigh = Rathigh_;
26  lut = lut_;
27 
28  if (Tlow > 127)
29  Tlow = Tlow - 128;
30  if (Thigh > 127)
31  Thigh = Thigh - 128;
32 
33  for (unsigned int i = 0; i < add_out.size(); i++) {
34  ERatLow = add_out[i] * Tlow >> 7;
35  if (ERatLow > 0xFFF)
36  ERatLow = 0xFFF;
37  ERatHigh = add_out[i] * Thigh >> 7;
38  if (ERatHigh > 0xFFF)
39  ERatHigh = 0xFFF;
40  if (add_out[i] > 0XFF)
41  add_out_8_[i] = 0xFF;
42  else
43  add_out_8_[i] = add_out[i];
44 
45  if (maxof2_out[i] >= ERatLow)
46  COMP3 = 1;
47  else
48  COMP3 = 0;
49  if (maxof2_out[i] >= ERatHigh)
50  COMP2 = 1;
51  else
52  COMP2 = 0;
53  if (add_out_8_[i] >= Elow)
54  COMP1 = 1;
55  else
56  COMP1 = 0;
57  if (add_out_8_[i] >= Ehigh)
58  COMP0 = 1;
59  else
60  COMP0 = 0;
61 
62  int ilut = (COMP3 << 3) + (COMP2 << 2) + (COMP1 << 1) + COMP0;
63  int mask = 1 << (ilut);
64  output[i] = (lut) & (mask);
65  if (output[i] > 0)
66  output[i] = 1;
67  }
68  return;
69 }
70 
71 void EcalFenixFgvbEB::setParameters(uint32_t towid,
72  const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,
73  const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB) {
74  const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgFgEBGroup->getMap();
75  EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(towid);
76  if (it != groupmap.end()) {
77  // uint32_t fgid =(*it).second;
78  // const EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMap fgmap =
79  // ecaltpgFineGrainEB -> getMap();
80  // EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMapItr itfg =
81  // fgmap.find(fgid);
82  // (*itfg).second.getValues( ETlow_, EThigh_, Ratlow_, Rathigh_,
83  // lut_);
84  EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMapItr itfg = (ecaltpgFineGrainEB->getMap()).find((*it).second);
85  (*itfg).second.getValues(ETlow_, EThigh_, Ratlow_, Rathigh_, lut_);
86  } else
87  edm::LogWarning("EcalTPG") << " could not find EcalTPGGroupsMap entry for " << towid;
88 }
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
void setParameters(uint32_t towid, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB)
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
void process(std::vector< int > &add_out, std::vector< int > &maxof2_out, std::vector< int > &output)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
virtual ~EcalFenixFgvbEB()
const EcalTPGFineGrainEBMap & getMap() const
std::vector< int > add_out_8_
EcalFenixFgvbEB(int maxNrSamples)
std::map< uint32_t, EcalTPGFineGrainConstEB >::const_iterator EcalTPGFineGrainEBMapItr
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19