Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:50:13

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   if (ptp.vitems[0].vpars.size() > 6) {                //Phase 2: extra hierarchy level for 3D sensors
0074     pxbVals.layerStartBit_ = ptp.vitems[0].vpars[0];   // 16
0075     pxbVals.ladderStartBit_ = ptp.vitems[0].vpars[1];  // 8
0076     pxbVals.moduleStartBit_ = ptp.vitems[0].vpars[2];  // 2
0077     pxbVals.doubleStartBit_ = ptp.vitems[0].vpars[3];  // 0
0078     pxbVals.layerMask_ = ptp.vitems[0].vpars[4];       // 0xF
0079     pxbVals.ladderMask_ = ptp.vitems[0].vpars[5];      // 0xFF
0080     pxbVals.moduleMask_ = ptp.vitems[0].vpars[6];      // 0x3F
0081     pxbVals.doubleMask_ = ptp.vitems[0].vpars[7];      // 0x3
0082   } else {                                             //Phase 1
0083     pxbVals.layerStartBit_ = ptp.vitems[0].vpars[0];   // 16
0084     pxbVals.ladderStartBit_ = ptp.vitems[0].vpars[1];  // 8
0085     pxbVals.moduleStartBit_ = ptp.vitems[0].vpars[2];  // 2
0086     pxbVals.layerMask_ = ptp.vitems[0].vpars[3];       // 0xF
0087     pxbVals.ladderMask_ = ptp.vitems[0].vpars[4];      // 0xFF
0088     pxbVals.moduleMask_ = ptp.vitems[0].vpars[5];      // 0x3F
0089   }
0090 
0091   if (ptp.vitems[1].vpars.size() >
0092       11) {  //Tracker with subdisk hierarchy level (additional hierarchy level wrt original)
0093     pxfVals.sideStartBit_ = ptp.vitems[1].vpars[0];
0094     pxfVals.diskStartBit_ = ptp.vitems[1].vpars[1];
0095     pxfVals.bladeStartBit_ = ptp.vitems[1].vpars[3];
0096     pxfVals.panelStartBit_ = ptp.vitems[1].vpars[4];
0097     pxfVals.moduleStartBit_ = ptp.vitems[1].vpars[5];
0098     pxfVals.sideMask_ = ptp.vitems[1].vpars[6];
0099     pxfVals.diskMask_ = ptp.vitems[1].vpars[7];
0100     pxfVals.bladeMask_ = ptp.vitems[1].vpars[9];
0101     pxfVals.panelMask_ = ptp.vitems[1].vpars[10];
0102     pxfVals.moduleMask_ = ptp.vitems[1].vpars[11];
0103   } else {  //Original tracker
0104     pxfVals.sideStartBit_ = ptp.vitems[1].vpars[0];
0105     pxfVals.diskStartBit_ = ptp.vitems[1].vpars[1];
0106     pxfVals.bladeStartBit_ = ptp.vitems[1].vpars[2];
0107     pxfVals.panelStartBit_ = ptp.vitems[1].vpars[3];
0108     pxfVals.moduleStartBit_ = ptp.vitems[1].vpars[4];
0109     pxfVals.sideMask_ = ptp.vitems[1].vpars[5];
0110     pxfVals.diskMask_ = ptp.vitems[1].vpars[6];
0111     pxfVals.bladeMask_ = ptp.vitems[1].vpars[7];
0112     pxfVals.panelMask_ = ptp.vitems[1].vpars[8];
0113     pxfVals.moduleMask_ = ptp.vitems[1].vpars[9];
0114   }
0115 
0116   // TEC: 6
0117   tecVals.sideStartBit_ = ptp.vitems[5].vpars[0];
0118   tecVals.wheelStartBit_ = ptp.vitems[5].vpars[1];
0119   tecVals.petal_fw_bwStartBit_ = ptp.vitems[5].vpars[2];
0120   tecVals.petalStartBit_ = ptp.vitems[5].vpars[3];
0121   tecVals.ringStartBit_ = ptp.vitems[5].vpars[4];
0122   tecVals.moduleStartBit_ = ptp.vitems[5].vpars[5];
0123   tecVals.sterStartBit_ = ptp.vitems[5].vpars[6];
0124   tecVals.sideMask_ = ptp.vitems[5].vpars[7];
0125   tecVals.wheelMask_ = ptp.vitems[5].vpars[8];
0126   tecVals.petal_fw_bwMask_ = ptp.vitems[5].vpars[9];
0127   tecVals.petalMask_ = ptp.vitems[5].vpars[10];
0128   tecVals.ringMask_ = ptp.vitems[5].vpars[11];
0129   tecVals.moduleMask_ = ptp.vitems[5].vpars[12];
0130   tecVals.sterMask_ = ptp.vitems[5].vpars[13];
0131 
0132   // TIB: 3
0133   tibVals.layerStartBit_ = ptp.vitems[2].vpars[0];
0134   tibVals.str_fw_bwStartBit_ = ptp.vitems[2].vpars[1];
0135   tibVals.str_int_extStartBit_ = ptp.vitems[2].vpars[2];
0136   tibVals.strStartBit_ = ptp.vitems[2].vpars[3];
0137   tibVals.moduleStartBit_ = ptp.vitems[2].vpars[4];
0138   tibVals.sterStartBit_ = ptp.vitems[2].vpars[5];
0139   tibVals.layerMask_ = ptp.vitems[2].vpars[6];
0140   tibVals.str_fw_bwMask_ = ptp.vitems[2].vpars[7];
0141   tibVals.str_int_extMask_ = ptp.vitems[2].vpars[8];
0142   tibVals.strMask_ = ptp.vitems[2].vpars[9];
0143   tibVals.moduleMask_ = ptp.vitems[2].vpars[10];
0144   tibVals.sterMask_ = ptp.vitems[2].vpars[11];
0145 
0146   // TID: 4
0147   tidVals.sideStartBit_ = ptp.vitems[3].vpars[0];
0148   tidVals.wheelStartBit_ = ptp.vitems[3].vpars[1];
0149   tidVals.ringStartBit_ = ptp.vitems[3].vpars[2];
0150   tidVals.module_fw_bwStartBit_ = ptp.vitems[3].vpars[3];
0151   tidVals.moduleStartBit_ = ptp.vitems[3].vpars[4];
0152   tidVals.sterStartBit_ = ptp.vitems[3].vpars[5];
0153   tidVals.sideMask_ = ptp.vitems[3].vpars[6];
0154   tidVals.wheelMask_ = ptp.vitems[3].vpars[7];
0155   tidVals.ringMask_ = ptp.vitems[3].vpars[8];
0156   tidVals.module_fw_bwMask_ = ptp.vitems[3].vpars[9];
0157   tidVals.moduleMask_ = ptp.vitems[3].vpars[10];
0158   tidVals.sterMask_ = ptp.vitems[3].vpars[11];
0159 
0160   // TOB: 5
0161   tobVals.layerStartBit_ = ptp.vitems[4].vpars[0];
0162   tobVals.rod_fw_bwStartBit_ = ptp.vitems[4].vpars[1];
0163   tobVals.rodStartBit_ = ptp.vitems[4].vpars[2];
0164   tobVals.moduleStartBit_ = ptp.vitems[4].vpars[3];
0165   tobVals.sterStartBit_ = ptp.vitems[4].vpars[4];
0166   tobVals.layerMask_ = ptp.vitems[4].vpars[5];
0167   tobVals.rod_fw_bwMask_ = ptp.vitems[4].vpars[6];
0168   tobVals.rodMask_ = ptp.vitems[4].vpars[7];
0169   tobVals.moduleMask_ = ptp.vitems[4].vpars[8];
0170   tobVals.sterMask_ = ptp.vitems[4].vpars[9];
0171 }
0172 
0173 DEFINE_FWK_EVENTSETUP_MODULE(TrackerTopologyEP);