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 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
28 
31 
32 
33 
34 //
35 // class decleration
36 //
37 
39  public:
41  ~RPCTriggerHwConfig() override;
42 
43  typedef std::unique_ptr<L1RPCHwConfig> ReturnType;
44 
45  ReturnType produce(const L1RPCHwConfigRcd&);
46  private:
47  // ----------member data ---------------------------
48  std::vector<int> m_disableTowers;
49  std::vector<int> m_disableCrates;
50  std::vector<int> m_disableTowersInCrates;
51 
52  std::vector<int> m_enableTowers;
53  std::vector<int> m_enableCrates;
54  std::vector<int> m_enableTowersInCrates;
55 
57 
58 };
59 
60 //
61 // constants, enums and typedefs
62 //
63 
64 //
65 // static data member definitions
66 //
67 
68 //
69 // constructors and destructor
70 //
72 {
73  //the following line is needed to tell the framework what
74  // data is being produced
75  setWhatProduced(this);
76 
77  //now do what ever other initialization is needed
78  m_disableTowers = iConfig.getParameter<std::vector<int> >("disableTowers");
79  m_disableCrates = iConfig.getParameter<std::vector<int> >("disableCrates");
80  m_disableTowersInCrates = iConfig.getParameter<std::vector<int> >("disableTowersInCrates");
81 
82  m_disableAll = iConfig.getParameter<bool>("disableAll");
83 
84  m_enableTowers = iConfig.getParameter<std::vector<int> >("enableTowers");
85  m_enableCrates = iConfig.getParameter<std::vector<int> >("enableCrates");
86  m_enableTowersInCrates = iConfig.getParameter<std::vector<int> >("enableTowersInCrates");
87 
88  if (m_disableAll) {
89  m_disableTowers.clear();
90  m_disableCrates.clear();
91  m_disableTowersInCrates.clear();
92  // check if m_enableTowers & m_enableCrates are not empty?
93  }
94 
95 
96 
97 }
98 
99 
101 {
102 
103  // do anything here that needs to be done at desctruction time
104  // (e.g. close files, deallocate resources etc.)
105 
106 }
107 
108 
109 //
110 // member functions
111 //
112 
113 // ------------ method called to produce the data ------------
116 {
117  auto pL1RPCHwConfig = std::make_unique<L1RPCHwConfig>();
118 
119  if (m_disableAll) {
120  pL1RPCHwConfig->enableAll(false);
121  std::vector<int>::iterator crIt = m_enableCrates.begin();
122  std::vector<int>::iterator twIt = m_enableTowers.begin();
123  for (; crIt!=m_enableCrates.end(); ++crIt){
124  pL1RPCHwConfig->enableCrate(*crIt,true);
125  }
126  for (; twIt!=m_enableTowers.end(); ++twIt){
127  pL1RPCHwConfig->enableTower(*twIt,true);
128  }
129  for (unsigned int It=0; It<m_enableTowersInCrates.size(); It++) {
130  if (It%2 == 0)
131  pL1RPCHwConfig->enableTowerInCrate(m_enableTowersInCrates[It+1], m_enableTowersInCrates[It], true);
132  }
133  } else {
134  std::vector<int>::iterator crIt = m_disableCrates.begin();
135  std::vector<int>::iterator twIt = m_disableTowers.begin();
136  for (; crIt!=m_disableCrates.end(); ++crIt){
137  pL1RPCHwConfig->enableCrate(*crIt,false);
138  }
139  for (; twIt!=m_disableTowers.end(); ++twIt){
140  pL1RPCHwConfig->enableTower(*twIt,false);
141  }
142  for (unsigned int It=0; It<m_disableTowersInCrates.size(); It++) {
143  if (It%2 == 0)
144  pL1RPCHwConfig->enableTowerInCrate(m_disableTowersInCrates[It+1], m_disableTowersInCrates[It], false);
145  }
146 
147  }
148 
149  return pL1RPCHwConfig ;
150 }
151 
152 //define this as a plug-in
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
std::vector< int > m_disableCrates
std::vector< int > m_enableCrates
RPCTriggerHwConfig(const edm::ParameterSet &)
ReturnType produce(const L1RPCHwConfigRcd &)
std::vector< int > m_disableTowers
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