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 // $Id: RPCTriggerHwConfig.cc,v 1.5 2010/02/26 15:50:59 fruboes Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include "boost/shared_ptr.hpp"
24 
25 // user include files
28 
30 
33 
34 
35 
36 //
37 // class decleration
38 //
39 
41  public:
44 
45  typedef std::auto_ptr<L1RPCHwConfig> ReturnType;
46 
48  private:
49  // ----------member data ---------------------------
50  std::vector<int> m_disableTowers;
51  std::vector<int> m_disableCrates;
52  std::vector<int> m_disableTowersInCrates;
53 
54  std::vector<int> m_enableTowers;
55  std::vector<int> m_enableCrates;
56  std::vector<int> m_enableTowersInCrates;
57 
59 
60 };
61 
62 //
63 // constants, enums and typedefs
64 //
65 
66 //
67 // static data member definitions
68 //
69 
70 //
71 // constructors and destructor
72 //
74 {
75  //the following line is needed to tell the framework what
76  // data is being produced
77  setWhatProduced(this);
78 
79  //now do what ever other initialization is needed
80  m_disableTowers = iConfig.getParameter<std::vector<int> >("disableTowers");
81  m_disableCrates = iConfig.getParameter<std::vector<int> >("disableCrates");
82  m_disableTowersInCrates = iConfig.getParameter<std::vector<int> >("disableTowersInCrates");
83 
84  m_disableAll = iConfig.getParameter<bool>("disableAll");
85 
86  m_enableTowers = iConfig.getParameter<std::vector<int> >("enableTowers");
87  m_enableCrates = iConfig.getParameter<std::vector<int> >("enableCrates");
88  m_enableTowersInCrates = iConfig.getParameter<std::vector<int> >("enableTowersInCrates");
89 
90  if (m_disableAll) {
91  m_disableTowers.clear();
92  m_disableCrates.clear();
93  m_disableTowersInCrates.clear();
94  // check if m_enableTowers & m_enableCrates are not empty?
95  }
96 
97 
98 
99 }
100 
101 
103 {
104 
105  // do anything here that needs to be done at desctruction time
106  // (e.g. close files, deallocate resources etc.)
107 
108 }
109 
110 
111 //
112 // member functions
113 //
114 
115 // ------------ method called to produce the data ------------
118 {
119  using namespace edm::es;
120  std::auto_ptr<L1RPCHwConfig> pL1RPCHwConfig = std::auto_ptr<L1RPCHwConfig>( new L1RPCHwConfig() );
121 
122  if (m_disableAll) {
123  pL1RPCHwConfig->enableAll(false);
124  std::vector<int>::iterator crIt = m_enableCrates.begin();
125  std::vector<int>::iterator twIt = m_enableTowers.begin();
126  for (; crIt!=m_enableCrates.end(); ++crIt){
127  pL1RPCHwConfig->enableCrate(*crIt,true);
128  }
129  for (; twIt!=m_enableTowers.end(); ++twIt){
130  pL1RPCHwConfig->enableTower(*twIt,true);
131  }
132  for (unsigned int It=0; It<m_enableTowersInCrates.size(); It++) {
133  if (It%2 == 0)
134  pL1RPCHwConfig->enableTowerInCrate(m_enableTowersInCrates[It+1], m_enableTowersInCrates[It], true);
135  }
136  } else {
137  std::vector<int>::iterator crIt = m_disableCrates.begin();
138  std::vector<int>::iterator twIt = m_disableTowers.begin();
139  for (; crIt!=m_disableCrates.end(); ++crIt){
140  pL1RPCHwConfig->enableCrate(*crIt,false);
141  }
142  for (; twIt!=m_disableTowers.end(); ++twIt){
143  pL1RPCHwConfig->enableTower(*twIt,false);
144  }
145  for (unsigned int It=0; It<m_disableTowersInCrates.size(); It++) {
146  if (It%2 == 0)
147  pL1RPCHwConfig->enableTowerInCrate(m_disableTowersInCrates[It+1], m_disableTowersInCrates[It], false);
148  }
149 
150  }
151 
152  return pL1RPCHwConfig ;
153 }
154 
155 //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:56
std::vector< int > m_enableTowers
std::vector< int > m_disableTowersInCrates