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 // system include files
20 #include <memory>
21 
22 // user include files
25 
27 
30 
31 //
32 // class decleration
33 //
34 
36 public:
39 
40  using ReturnType = std::unique_ptr<L1RPCConeDefinition>;
41 
43 
44 private:
45  // ----------member data ---------------------------
48  int m_rollBeg;
49  int m_rollEnd;
52 
53  //L1RPCConeDefinition::TLPSizesInTowers m_LPSizesInTowers;
55 
56  //L1RPCConeDefinition::TRingsToTowers m_RingsToTowers;
58 
59  //L1RPCConeDefinition::TRingsToLP m_RingsToLP;
61 };
62 
63 //
64 // constants, enums and typedefs
65 //
66 
67 //
68 // static data member definitions
69 //
70 
71 //
72 // constructors and destructor
73 //
75  : m_towerBeg(iConfig.getParameter<int>("towerBeg")),
76  m_towerEnd(iConfig.getParameter<int>("towerEnd")),
77  m_rollBeg(iConfig.getParameter<int>("rollBeg")),
78  m_rollEnd(iConfig.getParameter<int>("rollEnd")),
79  m_hwPlaneBeg(iConfig.getParameter<int>("hwPlaneBeg")),
80  m_hwPlaneEnd(iConfig.getParameter<int>("hwPlaneEnd")) {
81  //the following line is needed to tell the framework what
82  // data is being produced
83  setWhatProduced(this);
84 
85  for (int t = m_towerBeg; t <= m_towerEnd; ++t) {
86  std::stringstream name;
87  name << "lpSizeTower" << t;
88 
89  std::vector<int> newSizes = iConfig.getParameter<std::vector<int> >(name.str().c_str());
90 
91  for (unsigned int lp = 0; lp < newSizes.size(); ++lp) {
92  // L1RPCConeDefinition::TLPSize lps(t, lp, newSizes[lp]);
94  lps.m_tower = t;
95  lps.m_LP = lp;
96  lps.m_size = newSizes[lp];
97  m_LPSizeVec.push_back(lps);
98  }
99  }
100 
101  //now do what ever other initialization is needed
102 
103  // hw planes numbered from 0 to 5
104  // rolls from 0 to 17 (etaPartition)
105  //
106  // rollConnLP_[roll]_[hwPlane-1]
107  // rollConnLP_5_3 = cms.vint32(6, 0, 0),
108  // ----- roll 5, hwPlane 4 (3+1) is logplane 6 (OK)
109  //
110  // rollConnT_[roll]_[hwPlane-1]
111  // rollConnT_5_3 = cms.vint32(4, -1, -1),
112  // ----- roll 5, hwPlane 4 (3+1) contirubtes to tower 4 (OK)
113 
114  for (int roll = m_rollBeg; roll <= m_rollEnd; ++roll) {
115  //L1RPCConeDefinition::THWplaneToTower newHwPlToTower;
116  //L1RPCConeDefinition::THWplaneToLP newHWplaneToLP;
117  for (int hwpl = m_hwPlaneBeg; hwpl <= m_hwPlaneEnd; ++hwpl) {
118  std::stringstream name;
119  name << "rollConnLP_" << roll << "_" << hwpl;
120 
121  std::vector<int> hwPl2LPVec = iConfig.getParameter<std::vector<int> >(name.str().c_str());
122  //newHWplaneToLP.push_back(newListLP);
123  for (unsigned int i = 0; i < hwPl2LPVec.size(); ++i) {
124  if (hwPl2LPVec[i] >= 0) {
125  // L1RPCConeDefinition::TRingToLP lp(roll, hwpl, hwPl2LPVec[i],i);
127  lp.m_etaPart = roll;
128  lp.m_hwPlane = hwpl;
129  lp.m_LP = hwPl2LPVec[i];
130  lp.m_index = i;
131  m_ringToLPVec.push_back(lp);
132  }
133  }
134 
135  std::stringstream name1;
136  name1 << "rollConnT_" << roll << "_" << hwpl;
137 
138  /*L1RPCConeDefinition::TLPList newListT =
139  iConfig.getParameter<std::vector<int> >(name1.str().c_str());
140  newHwPlToTower.push_back(newListT);*/
141  std::vector<int> hwPl2TowerVec = iConfig.getParameter<std::vector<int> >(name1.str().c_str());
142 
143  for (unsigned int i = 0; i < hwPl2TowerVec.size(); ++i) {
144  if (hwPl2TowerVec[i] >= 0) {
145  // L1RPCConeDefinition::TRingToTower rt(roll, hwpl, hwPl2TowerVec[i],i);
147  rt.m_etaPart = roll;
148  rt.m_hwPlane = hwpl;
149  rt.m_tower = hwPl2TowerVec[i];
150  rt.m_index = i;
151  m_ringToTowerVec.push_back(rt);
152  }
153  }
154  }
155  //m_RingsToTowers.push_back(newHwPlToTower);
156 
157  //m_RingsToLP.push_back(newHWplaneToLP);
158  }
159 }
160 
162 
163 //
164 // member functions
165 //
166 
167 // ------------ method called to produce the data ------------
169  auto pL1RPCConeDefinition = std::make_unique<L1RPCConeDefinition>();
170 
171  pL1RPCConeDefinition->setFirstTower(m_towerBeg);
172  pL1RPCConeDefinition->setLastTower(m_towerEnd);
173 
174  pL1RPCConeDefinition->setLPSizeVec(m_LPSizeVec);
175  pL1RPCConeDefinition->setRingToLPVec(m_ringToLPVec);
176  pL1RPCConeDefinition->setRingToTowerVec(m_ringToTowerVec);
177 
178  return pL1RPCConeDefinition;
179 }
180 
181 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
std::vector< TRingToTower > TRingToTowerVec
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< TRingToLP > TRingToLPVec
std::vector< TLPSize > TLPSizeVec
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
std::unique_ptr< L1RPCConeDefinition > ReturnType
L1RPCConeDefinition::TRingToLPVec m_ringToLPVec
L1RPCConeDefinition::TRingToTowerVec m_ringToTowerVec
L1RPCConeDefinitionProducer(const edm::ParameterSet &)
ReturnType produce(const L1RPCConeDefinitionRcd &)
L1RPCConeDefinition::TLPSizeVec m_LPSizeVec