CMS 3D CMS Logo

EcalIndexingTools.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 
7 
9  int nBinsEta, double minEta, double maxEta, int nBinsEt, double minEt, double maxEt) {
10  // std::cout<< "[EcalIndexingTools::setBinRange] setting values "<< nBinsEta << " " << minEta << " " << maxEta << std::endl;
11 
12  totNumberOfBins_ = nBinsEta * nBinsEt;
13 
14  nBinsEt_ = nBinsEt;
16 
17  minEt_ = minEt;
18  minEta_ = minEta;
19  maxEt_ = maxEt;
20  maxEta_ = maxEta;
21 
22  // std::cout<< "[EcalIndexingTools::setBinRange] read back values: "<< nBinsEta_ << " " << minEta_ << " " << maxEta_ << std::endl;
23 
24  return;
25 }
26 
27 int EcalIndexingTools::getProgressiveIndex(double myEta, double myEt) {
28  std::cout << "minEt_ " << minEt_ << std::endl;
29  std::cout << "minEta_ " << minEta_ << std::endl;
30  std::cout << "maxEt_ " << maxEt_ << std::endl;
31  std::cout << "maxEta_ " << maxEta_ << std::endl;
32 
34 
35  double BoundaryEt[100] = {-99.};
36  double BoundaryEta[100] = {-99.};
37 
38  for (int i = 0; i < (nBinsEt_ + 1); i++) {
39  BoundaryEt[i] = minEt_ + i * ((maxEt_ - minEt_) / (double)nBinsEt_);
40  // std::cout << "i " << i << " BoundaryEt[i] "<< BoundaryEt[i] <<std::endl;
41  }
42 
43  for (int i = 0; i < (nBinsEta_ + 1); i++) {
44  BoundaryEta[i] = minEta_ + i * ((maxEta_ - minEta_) / (double)nBinsEta_);
45  //std::cout << "i " << i << " BoundaryEta[i] "<< BoundaryEta[i] <<std::endl;
46  }
47 
49  int etBin(-1);
50  int etaBin(-1);
51 
52  for (int i = 0; i < nBinsEta_; i++) {
53  if (myEta > BoundaryEta[i] && myEta <= BoundaryEta[i + 1])
54  etaBin = i;
55  }
56 
57  for (int i = 0; i < nBinsEt_; i++) {
58  if (myEt > BoundaryEt[i] && myEt <= BoundaryEt[i + 1])
59  etBin = i;
60  }
61 
62  // std::cout << " myEta "<< myEta << " myEt "<< myEt << " etaBin "<< etaBin << " etBin "<< etBin << std::endl;
63 
65 
66  int in = etaBin * nBinsEta_ + etBin;
67 
68  //std::cout << "Progressive index " << in << std::endl;
69 
70  return in;
71 }
void setBinRange(int, double, double, int, double, double)
constexpr float minEta
Definition: Common.h:9
double maxEta
static EcalIndexingTools * instance_
int getProgressiveIndex(double, double)