Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-12 09:07:40

0001 #include "FWCore/Utilities/interface/Exception.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "FWCore/Framework/interface/ModuleFactory.h"
0006 #include "FWCore/Framework/interface/ESProducer.h"
0007 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0008 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0009 #include "Geometry/Records/interface/PTrackerParametersRcd.h"
0010 #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h"
0011 
0012 #include <memory>
0013 
0014 namespace edm {
0015   class ConfigurationDescriptions;
0016 }
0017 
0018 class TrackerTopologyEP : public edm::ESProducer {
0019 public:
0020   TrackerTopologyEP(const edm::ParameterSet&);
0021 
0022   using ReturnType = std::unique_ptr<TrackerTopology>;
0023 
0024   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0025 
0026   ReturnType produce(const TrackerTopologyRcd&);
0027 
0028 private:
0029   void fillParameters(const PTrackerParameters&,
0030                       TrackerTopology::PixelBarrelValues& pxbVals,
0031                       TrackerTopology::PixelEndcapValues& pxfVals,
0032                       TrackerTopology::TECValues& tecVals,
0033                       TrackerTopology::TIBValues& tibVals,
0034                       TrackerTopology::TIDValues& tidVals,
0035                       TrackerTopology::TOBValues& tobVals);
0036 
0037   const edm::ESGetToken<PTrackerParameters, PTrackerParametersRcd> token_;
0038 };
0039 
0040 TrackerTopologyEP::TrackerTopologyEP(const edm::ParameterSet& conf)
0041     : token_(setWhatProduced(this).consumesFrom<PTrackerParameters, PTrackerParametersRcd>(edm::ESInputTag())) {
0042   edm::LogInfo("TRACKER") << "TrackerTopologyEP::TrackerTopologyEP";
0043 }
0044 
0045 void TrackerTopologyEP::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0046   edm::ParameterSetDescription ttc;
0047   descriptions.add("trackerTopology", ttc);
0048 }
0049 
0050 TrackerTopologyEP::ReturnType TrackerTopologyEP::produce(const TrackerTopologyRcd& iRecord) {
0051   edm::LogInfo("TrackerTopologyEP") << "TrackerTopologyEP::produce(const TrackerTopologyRcd& iRecord)";
0052   auto ptp = iRecord.getRecord<PTrackerParametersRcd>().getTransientHandle(token_);
0053 
0054   TrackerTopology::PixelBarrelValues pxbVals;
0055   TrackerTopology::PixelEndcapValues pxfVals;
0056   TrackerTopology::TECValues tecVals;
0057   TrackerTopology::TIBValues tibVals;
0058   TrackerTopology::TIDValues tidVals;
0059   TrackerTopology::TOBValues tobVals;
0060 
0061   fillParameters(*ptp, pxbVals, pxfVals, tecVals, tibVals, tidVals, tobVals);
0062 
0063   return std::make_unique<TrackerTopology>(pxbVals, pxfVals, tecVals, tibVals, tidVals, tobVals);
0064 }
0065 
0066 void TrackerTopologyEP::fillParameters(const PTrackerParameters& ptp,
0067                                        TrackerTopology::PixelBarrelValues& pxbVals,
0068                                        TrackerTopology::PixelEndcapValues& pxfVals,
0069                                        TrackerTopology::TECValues& tecVals,
0070                                        TrackerTopology::TIBValues& tibVals,
0071                                        TrackerTopology::TIDValues& tidVals,
0072                                        TrackerTopology::TOBValues& tobVals) {
0073   pxbVals.layerStartBit_ = ptp.vitems[0].vpars[0];   // 16
0074   pxbVals.ladderStartBit_ = ptp.vitems[0].vpars[1];  // 8
0075   pxbVals.moduleStartBit_ = ptp.vitems[0].vpars[2];  // 2
0076   pxbVals.layerMask_ = ptp.vitems[0].vpars[3];       // 0xF
0077   pxbVals.ladderMask_ = ptp.vitems[0].vpars[4];      // 0xFF
0078   pxbVals.moduleMask_ = ptp.vitems[0].vpars[5];      // 0x3F
0079 
0080   if (ptp.vitems[1].vpars.size() >
0081       11) {  //Tracker with subdisk hierarchy level (additional hierarchy level wrt original)
0082     pxfVals.sideStartBit_ = ptp.vitems[1].vpars[0];
0083     pxfVals.diskStartBit_ = ptp.vitems[1].vpars[1];
0084     pxfVals.bladeStartBit_ = ptp.vitems[1].vpars[3];
0085     pxfVals.panelStartBit_ = ptp.vitems[1].vpars[4];
0086     pxfVals.moduleStartBit_ = ptp.vitems[1].vpars[5];
0087     pxfVals.sideMask_ = ptp.vitems[1].vpars[6];
0088     pxfVals.diskMask_ = ptp.vitems[1].vpars[7];
0089     pxfVals.bladeMask_ = ptp.vitems[1].vpars[9];
0090     pxfVals.panelMask_ = ptp.vitems[1].vpars[10];
0091     pxfVals.moduleMask_ = ptp.vitems[1].vpars[11];
0092   } else {  //Original tracker
0093     pxfVals.sideStartBit_ = ptp.vitems[1].vpars[0];
0094     pxfVals.diskStartBit_ = ptp.vitems[1].vpars[1];
0095     pxfVals.bladeStartBit_ = ptp.vitems[1].vpars[2];
0096     pxfVals.panelStartBit_ = ptp.vitems[1].vpars[3];
0097     pxfVals.moduleStartBit_ = ptp.vitems[1].vpars[4];
0098     pxfVals.sideMask_ = ptp.vitems[1].vpars[5];
0099     pxfVals.diskMask_ = ptp.vitems[1].vpars[6];
0100     pxfVals.bladeMask_ = ptp.vitems[1].vpars[7];
0101     pxfVals.panelMask_ = ptp.vitems[1].vpars[8];
0102     pxfVals.moduleMask_ = ptp.vitems[1].vpars[9];
0103   }
0104 
0105   // TEC: 6
0106   tecVals.sideStartBit_ = ptp.vitems[5].vpars[0];
0107   tecVals.wheelStartBit_ = ptp.vitems[5].vpars[1];
0108   tecVals.petal_fw_bwStartBit_ = ptp.vitems[5].vpars[2];
0109   tecVals.petalStartBit_ = ptp.vitems[5].vpars[3];
0110   tecVals.ringStartBit_ = ptp.vitems[5].vpars[4];
0111   tecVals.moduleStartBit_ = ptp.vitems[5].vpars[5];
0112   tecVals.sterStartBit_ = ptp.vitems[5].vpars[6];
0113   tecVals.sideMask_ = ptp.vitems[5].vpars[7];
0114   tecVals.wheelMask_ = ptp.vitems[5].vpars[8];
0115   tecVals.petal_fw_bwMask_ = ptp.vitems[5].vpars[9];
0116   tecVals.petalMask_ = ptp.vitems[5].vpars[10];
0117   tecVals.ringMask_ = ptp.vitems[5].vpars[11];
0118   tecVals.moduleMask_ = ptp.vitems[5].vpars[12];
0119   tecVals.sterMask_ = ptp.vitems[5].vpars[13];
0120 
0121   // TIB: 3
0122   tibVals.layerStartBit_ = ptp.vitems[2].vpars[0];
0123   tibVals.str_fw_bwStartBit_ = ptp.vitems[2].vpars[1];
0124   tibVals.str_int_extStartBit_ = ptp.vitems[2].vpars[2];
0125   tibVals.strStartBit_ = ptp.vitems[2].vpars[3];
0126   tibVals.moduleStartBit_ = ptp.vitems[2].vpars[4];
0127   tibVals.sterStartBit_ = ptp.vitems[2].vpars[5];
0128   tibVals.layerMask_ = ptp.vitems[2].vpars[6];
0129   tibVals.str_fw_bwMask_ = ptp.vitems[2].vpars[7];
0130   tibVals.str_int_extMask_ = ptp.vitems[2].vpars[8];
0131   tibVals.strMask_ = ptp.vitems[2].vpars[9];
0132   tibVals.moduleMask_ = ptp.vitems[2].vpars[10];
0133   tibVals.sterMask_ = ptp.vitems[2].vpars[11];
0134 
0135   // TID: 4
0136   tidVals.sideStartBit_ = ptp.vitems[3].vpars[0];
0137   tidVals.wheelStartBit_ = ptp.vitems[3].vpars[1];
0138   tidVals.ringStartBit_ = ptp.vitems[3].vpars[2];
0139   tidVals.module_fw_bwStartBit_ = ptp.vitems[3].vpars[3];
0140   tidVals.moduleStartBit_ = ptp.vitems[3].vpars[4];
0141   tidVals.sterStartBit_ = ptp.vitems[3].vpars[5];
0142   tidVals.sideMask_ = ptp.vitems[3].vpars[6];
0143   tidVals.wheelMask_ = ptp.vitems[3].vpars[7];
0144   tidVals.ringMask_ = ptp.vitems[3].vpars[8];
0145   tidVals.module_fw_bwMask_ = ptp.vitems[3].vpars[9];
0146   tidVals.moduleMask_ = ptp.vitems[3].vpars[10];
0147   tidVals.sterMask_ = ptp.vitems[3].vpars[11];
0148 
0149   // TOB: 5
0150   tobVals.layerStartBit_ = ptp.vitems[4].vpars[0];
0151   tobVals.rod_fw_bwStartBit_ = ptp.vitems[4].vpars[1];
0152   tobVals.rodStartBit_ = ptp.vitems[4].vpars[2];
0153   tobVals.moduleStartBit_ = ptp.vitems[4].vpars[3];
0154   tobVals.sterStartBit_ = ptp.vitems[4].vpars[4];
0155   tobVals.layerMask_ = ptp.vitems[4].vpars[5];
0156   tobVals.rod_fw_bwMask_ = ptp.vitems[4].vpars[6];
0157   tobVals.rodMask_ = ptp.vitems[4].vpars[7];
0158   tobVals.moduleMask_ = ptp.vitems[4].vpars[8];
0159   tobVals.sterMask_ = ptp.vitems[4].vpars[9];
0160 }
0161 
0162 DEFINE_FWK_EVENTSETUP_MODULE(TrackerTopologyEP);