CMS 3D CMS Logo

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