CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalRegionCabling.h
Go to the documentation of this file.
1 #ifndef EcalRegionCabling_H
2 #define EcalRegionCabling_H
3 
6 
12 
14 
16  public:
18  : mapping_(m)
19  {
20  const edm::ParameterSet esMap = conf.getParameter<edm::ParameterSet>("esMapping");
21  es_mapping_ = new ESElectronicsMapper(esMap);
22  }
23 
25  // this pointer is own by this object.
26  delete es_mapping_;
27  }
28  const EcalElectronicsMapping * mapping() const { return mapping_;}
29  const ESElectronicsMapper * es_mapping() const { return es_mapping_;}
30 
31  template <class T> void updateEcalRefGetterWithElementIndex(edm::RefGetter<T> & refgetter,
32  const edm::Handle< edm::LazyGetter<T> >& lazygetter,
33  const uint32_t index)const;
34 
35  template <class T> void updateEcalRefGetterWithFedIndex(edm::RefGetter<T> & refgetter,
36  const edm::Handle< edm::LazyGetter<T> >& lazygetter,
37  const int index)const;
38 
39  template <class T> void updateEcalRefGetterWithEtaPhi(edm::RefGetter<T> & refgetter,
40  const edm::Handle< edm::LazyGetter<T> >& lazygetter,
41  const double eta,
42  const double phi)const;
43 
46 
47  static uint32_t elementIndex(const int FEDindex) {
48  //do a test for the time being
49  if (FEDindex > FEDNumbering::MAXECALFEDID || FEDindex < FEDNumbering::MINECALFEDID) {
50  edm::LogError("IncorrectMapping")<<"FEDindex: "<< FEDindex
51  <<" is not between: "<<(int) FEDNumbering::MINECALFEDID
52  <<" and "<<(int)FEDNumbering::MAXECALFEDID;
53  return 0;}
54  uint32_t eI = FEDindex - FEDNumbering::MINECALFEDID;
55  return eI; }
56 
57  static uint32_t esElementIndex(const int FEDindex) {
58  //do a test for the time being
60  edm::LogError("IncorrectMapping")<<"FEDindex: "<< FEDindex
61  <<" is not between: "<<(int) FEDNumbering::MINPreShowerFEDID
62  <<" and "<<(int)FEDNumbering::MAXPreShowerFEDID;
63  return 0;}
64  uint32_t eI = FEDindex - FEDNumbering::MINPreShowerFEDID;
65  return eI; }
66 
67  static int fedIndex(const uint32_t index){
68  int fI = index+FEDNumbering::MINECALFEDID;
69  return fI;}
70 
71  static int esFedIndex(const uint32_t index){
72  int fI = index+FEDNumbering::MINPreShowerFEDID;
73  return fI;}
74 
75 
76  uint32_t elementIndex(const double eta, const double phi) const{
77  int FEDindex = mapping()->GetFED(eta,phi);
78  return elementIndex(FEDindex); }
79 
80  private:
83 };
84 
85 
87  const edm::Handle< edm::LazyGetter<T> >& lazygetter,
88  const uint32_t index)const{
89  LogDebug("EcalRawToRecHit|Cabling")<<"updating a refgetter with element index: "<<index;
90  refgetter.push_back(lazygetter, index);
91 }
92 
93 
95  const edm::Handle< edm::LazyGetter<T> >& lazygetter,
96  const int fedindex)const{
97  LogDebug("EcalRawToRecHit|Cabling")<<"updating a refgetter with fed index: "<<fedindex;
98  updateEcalRefGetterWithElementIndex(refgetter, lazygetter, elementIndex(fedindex));
99 }
100 
101 
103  const edm::Handle< edm::LazyGetter<T> >& lazygetter,
104  const double eta,
105  const double phi)const{
106  int index = mapping()->GetFED(eta,phi);
107  LogDebug("EcalRawToRecHit|Cabling")<<"updating a refgetter with eta: "<<eta<<" phi: "<<phi;
108  updateEcalRefGetterWithFedIndex(refgetter, lazygetter, index);
109 }
110 
111 #endif
#define LogDebug(id)
T getParameter(std::string const &) const
int GetFED(double eta, double phi) const
const ESElectronicsMapper * es_mapping_
void push_back(const edm::Handle< LazyGetter< T > > &, const uint32_t &)
Add a new region to the end of the collection.
Definition: RefGetter.h:110
void updateEcalRefGetterWithElementIndex(edm::RefGetter< T > &refgetter, const edm::Handle< edm::LazyGetter< T > > &lazygetter, const uint32_t index) const
const EcalElectronicsMapping * mapping() const
static int fedIndex(const uint32_t index)
static uint32_t esElementIndex(const int FEDindex)
EcalRegionCabling(edm::ParameterSet &conf, const EcalElectronicsMapping *m)
void updateEcalRefGetterWithEtaPhi(edm::RefGetter< T > &refgetter, const edm::Handle< edm::LazyGetter< T > > &lazygetter, const double eta, const double phi) const
const EcalElectronicsMapping * mapping_
static uint32_t elementIndex(const int FEDindex)
tuple conf
Definition: dbtoconf.py:185
uint32_t elementIndex(const double eta, const double phi) const
static uint32_t maxElementIndex()
Geom::Phi< T > phi() const
static int esFedIndex(const uint32_t index)
const ESElectronicsMapper * es_mapping() const
static uint32_t maxESElementIndex()
void updateEcalRefGetterWithFedIndex(edm::RefGetter< T > &refgetter, const edm::Handle< edm::LazyGetter< T > > &lazygetter, const int index) const