CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/L1TriggerConfig/RPCTriggerConfig/src/L1RPCConeDefinitionProducer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1RPCConeDefinitionProducer
00004 // Class:      L1RPCConeDefinitionProducer
00005 // 
00013 //
00014 // Original Author:  Tomasz Maciej Frueboes
00015 //         Created:  Mon Feb 23 12:09:06 CET 2009
00016 // $Id: L1RPCConeDefinitionProducer.cc,v 1.5 2009/03/20 15:25:15 michals Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include "boost/shared_ptr.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/ModuleFactory.h"
00027 #include "FWCore/Framework/interface/ESProducer.h"
00028 
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 
00031 
00032 #include "CondFormats/L1TObjects/interface/L1RPCConeDefinition.h"
00033 #include "CondFormats/DataRecord/interface/L1RPCConeDefinitionRcd.h"
00034 
00035 //
00036 // class decleration
00037 //
00038 
00039 class L1RPCConeDefinitionProducer : public edm::ESProducer {
00040    public:
00041       L1RPCConeDefinitionProducer(const edm::ParameterSet&);
00042       ~L1RPCConeDefinitionProducer();
00043 
00044       typedef boost::shared_ptr<L1RPCConeDefinition> ReturnType;
00045 
00046       ReturnType produce(const L1RPCConeDefinitionRcd&);
00047    private:
00048       // ----------member data ---------------------------
00049      int m_towerBeg;
00050      int m_towerEnd;
00051      int m_rollBeg;
00052      int m_rollEnd;
00053      int m_hwPlaneBeg;
00054      int m_hwPlaneEnd;
00055      
00056      //L1RPCConeDefinition::TLPSizesInTowers m_LPSizesInTowers;
00057      L1RPCConeDefinition::TLPSizeVec m_LPSizeVec;
00058      
00059      //L1RPCConeDefinition::TRingsToTowers m_RingsToTowers;
00060      L1RPCConeDefinition::TRingToTowerVec m_ringToTowerVec;
00061      
00062      //L1RPCConeDefinition::TRingsToLP m_RingsToLP;
00063      L1RPCConeDefinition::TRingToLPVec m_ringToLPVec;
00064 };
00065 
00066 //
00067 // constants, enums and typedefs
00068 //
00069 
00070 //
00071 // static data member definitions
00072 //
00073 
00074 //
00075 // constructors and destructor
00076 //
00077 L1RPCConeDefinitionProducer::L1RPCConeDefinitionProducer(const edm::ParameterSet& iConfig):
00078       m_towerBeg(iConfig.getParameter<int>("towerBeg")),
00079       m_towerEnd(iConfig.getParameter<int>("towerEnd")),
00080       m_rollBeg(iConfig.getParameter<int>("rollBeg")),
00081       m_rollEnd(iConfig.getParameter<int>("rollEnd")),
00082       m_hwPlaneBeg(iConfig.getParameter<int>("hwPlaneBeg")),
00083       m_hwPlaneEnd(iConfig.getParameter<int>("hwPlaneEnd"))
00084 {
00085   //the following line is needed to tell the framework what
00086   // data is being produced
00087   setWhatProduced(this);
00088 
00089   for (int t = m_towerBeg; t <= m_towerEnd; ++t){
00090       
00091     std::stringstream name;
00092     name << "lpSizeTower" << t;
00093       
00094     
00095     std::vector<int> newSizes = 
00096         iConfig.getParameter<std::vector<int> >(name.str().c_str());
00097     
00098     for (unsigned int lp = 0; lp < newSizes.size();++lp){
00099 //      L1RPCConeDefinition::TLPSize lps(t, lp,  newSizes[lp]);
00100       L1RPCConeDefinition::TLPSize lps;
00101       lps.m_tower=t;
00102       lps.m_LP=lp;
00103       lps.m_size=newSizes[lp];
00104       m_LPSizeVec.push_back(lps);
00105     }
00106       
00107 
00108     
00109   }
00110 
00111 
00112 
00113    //now do what ever other initialization is needed
00114    
00115    //  hw planes numbered from 0 to 5
00116    // rolls from 0 to 17 (etaPartition)
00117    //
00118    //  rollConnLP_[roll]_[hwPlane-1]
00119    //  rollConnLP_5_3 = cms.vint32(6, 0, 0),
00120    //     ----- roll 5, hwPlane 4 (3+1) is logplane 6 (OK)
00121    //
00122    //  rollConnT_[roll]_[hwPlane-1]
00123    //  rollConnT_5_3 = cms.vint32(4, -1, -1),
00124    //     ----- roll 5, hwPlane 4 (3+1) contirubtes to tower 4 (OK)
00125   
00126    for (int roll = m_rollBeg; roll <= m_rollEnd; ++roll){
00127     //L1RPCConeDefinition::THWplaneToTower newHwPlToTower;
00128     //L1RPCConeDefinition::THWplaneToLP newHWplaneToLP;
00129     for (int hwpl = m_hwPlaneBeg; hwpl <= m_hwPlaneEnd; ++hwpl){
00130       std::stringstream name;
00131       name << "rollConnLP_" << roll << "_" << hwpl;
00132             
00133       std::vector<int> hwPl2LPVec =  iConfig.getParameter<std::vector<int> >(name.str().c_str());
00134       //newHWplaneToLP.push_back(newListLP);
00135       for (unsigned int i = 0;i < hwPl2LPVec.size();++i){
00136         
00137         if (hwPl2LPVec[i]>=0)
00138         {
00139 //          L1RPCConeDefinition::TRingToLP lp(roll, hwpl, hwPl2LPVec[i],i);
00140           L1RPCConeDefinition::TRingToLP lp;
00141           lp.m_etaPart=roll;
00142           lp.m_hwPlane=hwpl;
00143           lp.m_LP=hwPl2LPVec[i];
00144           lp.m_index=i;
00145           m_ringToLPVec.push_back(lp);
00146         }
00147       }
00148       
00149             
00150       std::stringstream name1;
00151       name1 << "rollConnT_" << roll << "_" << hwpl;
00152             
00153       /*L1RPCConeDefinition::TLPList newListT =  
00154       iConfig.getParameter<std::vector<int> >(name1.str().c_str());
00155       newHwPlToTower.push_back(newListT);*/
00156       std::vector<int> hwPl2TowerVec = iConfig.getParameter<std::vector<int> >(name1.str().c_str());
00157       
00158       for (unsigned int i = 0;i < hwPl2TowerVec.size();++i){
00159         
00160         if (hwPl2TowerVec[i]>=0)
00161         {
00162 //          L1RPCConeDefinition::TRingToTower rt(roll, hwpl, hwPl2TowerVec[i],i);
00163           L1RPCConeDefinition::TRingToTower rt;
00164           rt.m_etaPart=roll;
00165           rt.m_hwPlane=hwpl;
00166           rt.m_tower=hwPl2TowerVec[i];
00167           rt.m_index=i;
00168           m_ringToTowerVec.push_back(rt);
00169         }
00170       }
00171 
00172 
00173     }
00174     //m_RingsToTowers.push_back(newHwPlToTower);
00175     
00176     //m_RingsToLP.push_back(newHWplaneToLP);
00177   }
00178 }
00179 
00180 
00181 L1RPCConeDefinitionProducer::~L1RPCConeDefinitionProducer(){}
00182 
00183 
00184 
00185 //
00186 // member functions
00187 //
00188 
00189 // ------------ method called to produce the data  ------------
00190 L1RPCConeDefinitionProducer::ReturnType
00191 L1RPCConeDefinitionProducer::produce(const L1RPCConeDefinitionRcd& iRecord)
00192 {
00193    using namespace edm::es;
00194    boost::shared_ptr<L1RPCConeDefinition> pL1RPCConeDefinition(new L1RPCConeDefinition);
00195 
00196    pL1RPCConeDefinition->setFirstTower(m_towerBeg);
00197    pL1RPCConeDefinition->setLastTower(m_towerEnd);
00198    
00199    pL1RPCConeDefinition->setLPSizeVec(m_LPSizeVec);
00200    pL1RPCConeDefinition->setRingToLPVec(m_ringToLPVec);
00201    pL1RPCConeDefinition->setRingToTowerVec(m_ringToTowerVec);
00202    
00203    
00204    return pL1RPCConeDefinition ;
00205 }
00206 
00207 //define this as a plug-in
00208 DEFINE_FWK_EVENTSETUP_MODULE(L1RPCConeDefinitionProducer);