Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:15

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1RPCConeDefinitionProducer
0004 // Class:      L1RPCConeDefinitionProducer
0005 //
0006 /**\class L1RPCConeDefinitionProducer L1RPCConeDefinitionProducer.h L1TriggerConfig/L1RPCConeDefinitionProducer/src/L1RPCConeDefinitionProducer.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Tomasz Maciej Frueboes
0015 //         Created:  Mon Feb 23 12:09:06 CET 2009
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/ModuleFactory.h"
0024 #include "FWCore/Framework/interface/ESProducer.h"
0025 
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 
0028 #include "CondFormats/L1TObjects/interface/L1RPCConeDefinition.h"
0029 #include "CondFormats/DataRecord/interface/L1RPCConeDefinitionRcd.h"
0030 
0031 //
0032 // class decleration
0033 //
0034 
0035 class L1RPCConeDefinitionProducer : public edm::ESProducer {
0036 public:
0037   L1RPCConeDefinitionProducer(const edm::ParameterSet&);
0038   ~L1RPCConeDefinitionProducer() override;
0039 
0040   using ReturnType = std::unique_ptr<L1RPCConeDefinition>;
0041 
0042   ReturnType produce(const L1RPCConeDefinitionRcd&);
0043 
0044 private:
0045   // ----------member data ---------------------------
0046   int m_towerBeg;
0047   int m_towerEnd;
0048   int m_rollBeg;
0049   int m_rollEnd;
0050   int m_hwPlaneBeg;
0051   int m_hwPlaneEnd;
0052 
0053   //L1RPCConeDefinition::TLPSizesInTowers m_LPSizesInTowers;
0054   L1RPCConeDefinition::TLPSizeVec m_LPSizeVec;
0055 
0056   //L1RPCConeDefinition::TRingsToTowers m_RingsToTowers;
0057   L1RPCConeDefinition::TRingToTowerVec m_ringToTowerVec;
0058 
0059   //L1RPCConeDefinition::TRingsToLP m_RingsToLP;
0060   L1RPCConeDefinition::TRingToLPVec m_ringToLPVec;
0061 };
0062 
0063 //
0064 // constants, enums and typedefs
0065 //
0066 
0067 //
0068 // static data member definitions
0069 //
0070 
0071 //
0072 // constructors and destructor
0073 //
0074 L1RPCConeDefinitionProducer::L1RPCConeDefinitionProducer(const edm::ParameterSet& iConfig)
0075     : m_towerBeg(iConfig.getParameter<int>("towerBeg")),
0076       m_towerEnd(iConfig.getParameter<int>("towerEnd")),
0077       m_rollBeg(iConfig.getParameter<int>("rollBeg")),
0078       m_rollEnd(iConfig.getParameter<int>("rollEnd")),
0079       m_hwPlaneBeg(iConfig.getParameter<int>("hwPlaneBeg")),
0080       m_hwPlaneEnd(iConfig.getParameter<int>("hwPlaneEnd")) {
0081   //the following line is needed to tell the framework what
0082   // data is being produced
0083   setWhatProduced(this);
0084 
0085   for (int t = m_towerBeg; t <= m_towerEnd; ++t) {
0086     std::stringstream name;
0087     name << "lpSizeTower" << t;
0088 
0089     std::vector<int> newSizes = iConfig.getParameter<std::vector<int> >(name.str().c_str());
0090 
0091     for (unsigned int lp = 0; lp < newSizes.size(); ++lp) {
0092       //      L1RPCConeDefinition::TLPSize lps(t, lp,  newSizes[lp]);
0093       L1RPCConeDefinition::TLPSize lps;
0094       lps.m_tower = t;
0095       lps.m_LP = lp;
0096       lps.m_size = newSizes[lp];
0097       m_LPSizeVec.push_back(lps);
0098     }
0099   }
0100 
0101   //now do what ever other initialization is needed
0102 
0103   //  hw planes numbered from 0 to 5
0104   // rolls from 0 to 17 (etaPartition)
0105   //
0106   //  rollConnLP_[roll]_[hwPlane-1]
0107   //  rollConnLP_5_3 = cms.vint32(6, 0, 0),
0108   //     ----- roll 5, hwPlane 4 (3+1) is logplane 6 (OK)
0109   //
0110   //  rollConnT_[roll]_[hwPlane-1]
0111   //  rollConnT_5_3 = cms.vint32(4, -1, -1),
0112   //     ----- roll 5, hwPlane 4 (3+1) contirubtes to tower 4 (OK)
0113 
0114   for (int roll = m_rollBeg; roll <= m_rollEnd; ++roll) {
0115     //L1RPCConeDefinition::THWplaneToTower newHwPlToTower;
0116     //L1RPCConeDefinition::THWplaneToLP newHWplaneToLP;
0117     for (int hwpl = m_hwPlaneBeg; hwpl <= m_hwPlaneEnd; ++hwpl) {
0118       std::stringstream name;
0119       name << "rollConnLP_" << roll << "_" << hwpl;
0120 
0121       std::vector<int> hwPl2LPVec = iConfig.getParameter<std::vector<int> >(name.str().c_str());
0122       //newHWplaneToLP.push_back(newListLP);
0123       for (unsigned int i = 0; i < hwPl2LPVec.size(); ++i) {
0124         if (hwPl2LPVec[i] >= 0) {
0125           //          L1RPCConeDefinition::TRingToLP lp(roll, hwpl, hwPl2LPVec[i],i);
0126           L1RPCConeDefinition::TRingToLP lp;
0127           lp.m_etaPart = roll;
0128           lp.m_hwPlane = hwpl;
0129           lp.m_LP = hwPl2LPVec[i];
0130           lp.m_index = i;
0131           m_ringToLPVec.push_back(lp);
0132         }
0133       }
0134 
0135       std::stringstream name1;
0136       name1 << "rollConnT_" << roll << "_" << hwpl;
0137 
0138       /*L1RPCConeDefinition::TLPList newListT =  
0139       iConfig.getParameter<std::vector<int> >(name1.str().c_str());
0140       newHwPlToTower.push_back(newListT);*/
0141       std::vector<int> hwPl2TowerVec = iConfig.getParameter<std::vector<int> >(name1.str().c_str());
0142 
0143       for (unsigned int i = 0; i < hwPl2TowerVec.size(); ++i) {
0144         if (hwPl2TowerVec[i] >= 0) {
0145           //          L1RPCConeDefinition::TRingToTower rt(roll, hwpl, hwPl2TowerVec[i],i);
0146           L1RPCConeDefinition::TRingToTower rt;
0147           rt.m_etaPart = roll;
0148           rt.m_hwPlane = hwpl;
0149           rt.m_tower = hwPl2TowerVec[i];
0150           rt.m_index = i;
0151           m_ringToTowerVec.push_back(rt);
0152         }
0153       }
0154     }
0155     //m_RingsToTowers.push_back(newHwPlToTower);
0156 
0157     //m_RingsToLP.push_back(newHWplaneToLP);
0158   }
0159 }
0160 
0161 L1RPCConeDefinitionProducer::~L1RPCConeDefinitionProducer() {}
0162 
0163 //
0164 // member functions
0165 //
0166 
0167 // ------------ method called to produce the data  ------------
0168 L1RPCConeDefinitionProducer::ReturnType L1RPCConeDefinitionProducer::produce(const L1RPCConeDefinitionRcd& iRecord) {
0169   auto pL1RPCConeDefinition = std::make_unique<L1RPCConeDefinition>();
0170 
0171   pL1RPCConeDefinition->setFirstTower(m_towerBeg);
0172   pL1RPCConeDefinition->setLastTower(m_towerEnd);
0173 
0174   pL1RPCConeDefinition->setLPSizeVec(m_LPSizeVec);
0175   pL1RPCConeDefinition->setRingToLPVec(m_ringToLPVec);
0176   pL1RPCConeDefinition->setRingToTowerVec(m_ringToTowerVec);
0177 
0178   return pL1RPCConeDefinition;
0179 }
0180 
0181 //define this as a plug-in
0182 DEFINE_FWK_EVENTSETUP_MODULE(L1RPCConeDefinitionProducer);