CMS 3D CMS Logo

RPCTriggerHwConfig.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: RPCTriggerHwConfig
4 // Class: RPCTriggerHwConfig
5 //
13 //
14 // Original Author: Tomasz Maciej Frueboes
15 // Created: Wed Apr 9 13:57:29 CEST 2008
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
27 
30 
31 //
32 // class decleration
33 //
34 
36 public:
38  ~RPCTriggerHwConfig() override;
39 
40  typedef std::unique_ptr<L1RPCHwConfig> ReturnType;
41 
42  ReturnType produce(const L1RPCHwConfigRcd&);
43 
44 private:
45  // ----------member data ---------------------------
46  std::vector<int> m_disableTowers;
47  std::vector<int> m_disableCrates;
48  std::vector<int> m_disableTowersInCrates;
49 
50  std::vector<int> m_enableTowers;
51  std::vector<int> m_enableCrates;
52  std::vector<int> m_enableTowersInCrates;
53 
55 };
56 
57 //
58 // constants, enums and typedefs
59 //
60 
61 //
62 // static data member definitions
63 //
64 
65 //
66 // constructors and destructor
67 //
69  //the following line is needed to tell the framework what
70  // data is being produced
71  setWhatProduced(this);
72 
73  //now do what ever other initialization is needed
74  m_disableTowers = iConfig.getParameter<std::vector<int> >("disableTowers");
75  m_disableCrates = iConfig.getParameter<std::vector<int> >("disableCrates");
76  m_disableTowersInCrates = iConfig.getParameter<std::vector<int> >("disableTowersInCrates");
77 
78  m_disableAll = iConfig.getParameter<bool>("disableAll");
79 
80  m_enableTowers = iConfig.getParameter<std::vector<int> >("enableTowers");
81  m_enableCrates = iConfig.getParameter<std::vector<int> >("enableCrates");
82  m_enableTowersInCrates = iConfig.getParameter<std::vector<int> >("enableTowersInCrates");
83 
84  if (m_disableAll) {
85  m_disableTowers.clear();
86  m_disableCrates.clear();
87  m_disableTowersInCrates.clear();
88  // check if m_enableTowers & m_enableCrates are not empty?
89  }
90 }
91 
93  // do anything here that needs to be done at desctruction time
94  // (e.g. close files, deallocate resources etc.)
95 }
96 
97 //
98 // member functions
99 //
100 
101 // ------------ method called to produce the data ------------
103  auto pL1RPCHwConfig = std::make_unique<L1RPCHwConfig>();
104 
105  if (m_disableAll) {
106  pL1RPCHwConfig->enableAll(false);
107  std::vector<int>::iterator crIt = m_enableCrates.begin();
108  std::vector<int>::iterator twIt = m_enableTowers.begin();
109  for (; crIt != m_enableCrates.end(); ++crIt) {
110  pL1RPCHwConfig->enableCrate(*crIt, true);
111  }
112  for (; twIt != m_enableTowers.end(); ++twIt) {
113  pL1RPCHwConfig->enableTower(*twIt, true);
114  }
115  for (unsigned int It = 0; It < m_enableTowersInCrates.size(); It++) {
116  if (It % 2 == 0)
117  pL1RPCHwConfig->enableTowerInCrate(m_enableTowersInCrates[It + 1], m_enableTowersInCrates[It], true);
118  }
119  } else {
120  std::vector<int>::iterator crIt = m_disableCrates.begin();
121  std::vector<int>::iterator twIt = m_disableTowers.begin();
122  for (; crIt != m_disableCrates.end(); ++crIt) {
123  pL1RPCHwConfig->enableCrate(*crIt, false);
124  }
125  for (; twIt != m_disableTowers.end(); ++twIt) {
126  pL1RPCHwConfig->enableTower(*twIt, false);
127  }
128  for (unsigned int It = 0; It < m_disableTowersInCrates.size(); It++) {
129  if (It % 2 == 0)
130  pL1RPCHwConfig->enableTowerInCrate(m_disableTowersInCrates[It + 1], m_disableTowersInCrates[It], false);
131  }
132  }
133 
134  return pL1RPCHwConfig;
135 }
136 
137 //define this as a plug-in
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
std::vector< int > m_disableCrates
std::vector< int > m_enableCrates
RPCTriggerHwConfig(const edm::ParameterSet &)
ReturnType produce(const L1RPCHwConfigRcd &)
std::vector< int > m_disableTowers
~RPCTriggerHwConfig() override
std::unique_ptr< L1RPCHwConfig > ReturnType
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::vector< int > m_enableTowersInCrates
std::vector< int > m_enableTowers
std::vector< int > m_disableTowersInCrates