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:
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  using namespace edm::es;
118  auto pL1RPCHwConfig = std::make_unique<L1RPCHwConfig>();
119 
120  if (m_disableAll) {
121  pL1RPCHwConfig->enableAll(false);
122  std::vector<int>::iterator crIt = m_enableCrates.begin();
123  std::vector<int>::iterator twIt = m_enableTowers.begin();
124  for (; crIt!=m_enableCrates.end(); ++crIt){
125  pL1RPCHwConfig->enableCrate(*crIt,true);
126  }
127  for (; twIt!=m_enableTowers.end(); ++twIt){
128  pL1RPCHwConfig->enableTower(*twIt,true);
129  }
130  for (unsigned int It=0; It<m_enableTowersInCrates.size(); It++) {
131  if (It%2 == 0)
132  pL1RPCHwConfig->enableTowerInCrate(m_enableTowersInCrates[It+1], m_enableTowersInCrates[It], true);
133  }
134  } else {
135  std::vector<int>::iterator crIt = m_disableCrates.begin();
136  std::vector<int>::iterator twIt = m_disableTowers.begin();
137  for (; crIt!=m_disableCrates.end(); ++crIt){
138  pL1RPCHwConfig->enableCrate(*crIt,false);
139  }
140  for (; twIt!=m_disableTowers.end(); ++twIt){
141  pL1RPCHwConfig->enableTower(*twIt,false);
142  }
143  for (unsigned int It=0; It<m_disableTowersInCrates.size(); It++) {
144  if (It%2 == 0)
145  pL1RPCHwConfig->enableTowerInCrate(m_disableTowersInCrates[It+1], m_disableTowersInCrates[It], false);
146  }
147 
148  }
149 
150  return pL1RPCHwConfig ;
151 }
152 
153 //define this as a plug-in
T getParameter(std::string const &) const
std::vector< int > m_disableCrates
std::vector< int > m_enableCrates
RPCTriggerHwConfig(const edm::ParameterSet &)
ReturnType produce(const L1RPCHwConfigRcd &)
std::vector< int > m_disableTowers
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::unique_ptr< L1RPCHwConfig > ReturnType
std::vector< int > m_enableTowersInCrates
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::vector< int > m_enableTowers
std::vector< int > m_disableTowersInCrates