CMS 3D CMS Logo

L1RPCConeDefinitionProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1RPCConeDefinitionProducer
4 // Class: L1RPCConeDefinitionProducer
5 //
13 //
14 // Original Author: Tomasz Maciej Frueboes
15 // Created: Mon Feb 23 12:09:06 CET 2009
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
28 
29 
32 
33 //
34 // class decleration
35 //
36 
38  public:
41 
42  typedef std::shared_ptr<L1RPCConeDefinition> ReturnType;
43 
44  ReturnType produce(const L1RPCConeDefinitionRcd&);
45  private:
46  // ----------member data ---------------------------
49  int m_rollBeg;
50  int m_rollEnd;
53 
54  //L1RPCConeDefinition::TLPSizesInTowers m_LPSizesInTowers;
56 
57  //L1RPCConeDefinition::TRingsToTowers m_RingsToTowers;
59 
60  //L1RPCConeDefinition::TRingsToLP m_RingsToLP;
62 };
63 
64 //
65 // constants, enums and typedefs
66 //
67 
68 //
69 // static data member definitions
70 //
71 
72 //
73 // constructors and destructor
74 //
76  m_towerBeg(iConfig.getParameter<int>("towerBeg")),
77  m_towerEnd(iConfig.getParameter<int>("towerEnd")),
78  m_rollBeg(iConfig.getParameter<int>("rollBeg")),
79  m_rollEnd(iConfig.getParameter<int>("rollEnd")),
80  m_hwPlaneBeg(iConfig.getParameter<int>("hwPlaneBeg")),
81  m_hwPlaneEnd(iConfig.getParameter<int>("hwPlaneEnd"))
82 {
83  //the following line is needed to tell the framework what
84  // data is being produced
85  setWhatProduced(this);
86 
87  for (int t = m_towerBeg; t <= m_towerEnd; ++t){
88 
89  std::stringstream name;
90  name << "lpSizeTower" << t;
91 
92 
93  std::vector<int> newSizes =
94  iConfig.getParameter<std::vector<int> >(name.str().c_str());
95 
96  for (unsigned int lp = 0; lp < newSizes.size();++lp){
97 // L1RPCConeDefinition::TLPSize lps(t, lp, newSizes[lp]);
99  lps.m_tower=t;
100  lps.m_LP=lp;
101  lps.m_size=newSizes[lp];
102  m_LPSizeVec.push_back(lps);
103  }
104 
105 
106 
107  }
108 
109 
110 
111  //now do what ever other initialization is needed
112 
113  // hw planes numbered from 0 to 5
114  // rolls from 0 to 17 (etaPartition)
115  //
116  // rollConnLP_[roll]_[hwPlane-1]
117  // rollConnLP_5_3 = cms.vint32(6, 0, 0),
118  // ----- roll 5, hwPlane 4 (3+1) is logplane 6 (OK)
119  //
120  // rollConnT_[roll]_[hwPlane-1]
121  // rollConnT_5_3 = cms.vint32(4, -1, -1),
122  // ----- roll 5, hwPlane 4 (3+1) contirubtes to tower 4 (OK)
123 
124  for (int roll = m_rollBeg; roll <= m_rollEnd; ++roll){
125  //L1RPCConeDefinition::THWplaneToTower newHwPlToTower;
126  //L1RPCConeDefinition::THWplaneToLP newHWplaneToLP;
127  for (int hwpl = m_hwPlaneBeg; hwpl <= m_hwPlaneEnd; ++hwpl){
128  std::stringstream name;
129  name << "rollConnLP_" << roll << "_" << hwpl;
130 
131  std::vector<int> hwPl2LPVec = iConfig.getParameter<std::vector<int> >(name.str().c_str());
132  //newHWplaneToLP.push_back(newListLP);
133  for (unsigned int i = 0;i < hwPl2LPVec.size();++i){
134 
135  if (hwPl2LPVec[i]>=0)
136  {
137 // L1RPCConeDefinition::TRingToLP lp(roll, hwpl, hwPl2LPVec[i],i);
139  lp.m_etaPart=roll;
140  lp.m_hwPlane=hwpl;
141  lp.m_LP=hwPl2LPVec[i];
142  lp.m_index=i;
143  m_ringToLPVec.push_back(lp);
144  }
145  }
146 
147 
148  std::stringstream name1;
149  name1 << "rollConnT_" << roll << "_" << hwpl;
150 
151  /*L1RPCConeDefinition::TLPList newListT =
152  iConfig.getParameter<std::vector<int> >(name1.str().c_str());
153  newHwPlToTower.push_back(newListT);*/
154  std::vector<int> hwPl2TowerVec = iConfig.getParameter<std::vector<int> >(name1.str().c_str());
155 
156  for (unsigned int i = 0;i < hwPl2TowerVec.size();++i){
157 
158  if (hwPl2TowerVec[i]>=0)
159  {
160 // L1RPCConeDefinition::TRingToTower rt(roll, hwpl, hwPl2TowerVec[i],i);
162  rt.m_etaPart=roll;
163  rt.m_hwPlane=hwpl;
164  rt.m_tower=hwPl2TowerVec[i];
165  rt.m_index=i;
166  m_ringToTowerVec.push_back(rt);
167  }
168  }
169 
170 
171  }
172  //m_RingsToTowers.push_back(newHwPlToTower);
173 
174  //m_RingsToLP.push_back(newHWplaneToLP);
175  }
176 }
177 
178 
180 
181 
182 
183 //
184 // member functions
185 //
186 
187 // ------------ method called to produce the data ------------
190 {
191  using namespace edm::es;
192  auto pL1RPCConeDefinition = std::make_shared<L1RPCConeDefinition>();
193 
194  pL1RPCConeDefinition->setFirstTower(m_towerBeg);
195  pL1RPCConeDefinition->setLastTower(m_towerEnd);
196 
197  pL1RPCConeDefinition->setLPSizeVec(m_LPSizeVec);
198  pL1RPCConeDefinition->setRingToLPVec(m_ringToLPVec);
199  pL1RPCConeDefinition->setRingToTowerVec(m_ringToTowerVec);
200 
201 
202  return pL1RPCConeDefinition ;
203 }
204 
205 //define this as a plug-in
T getParameter(std::string const &) const
std::vector< TRingToTower > TRingToTowerVec
std::vector< TRingToLP > TRingToLPVec
std::vector< TLPSize > TLPSizeVec
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::shared_ptr< L1RPCConeDefinition > ReturnType
L1RPCConeDefinition::TRingToLPVec m_ringToLPVec
L1RPCConeDefinition::TRingToTowerVec m_ringToTowerVec
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
L1RPCConeDefinitionProducer(const edm::ParameterSet &)
ReturnType produce(const L1RPCConeDefinitionRcd &)
L1RPCConeDefinition::TLPSizeVec m_LPSizeVec