Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-12 02:58:33

0001 #include "RecoLocalFastTime/FTLCommonAlgos/interface/MTDTimeCalib.h"
0002 
0003 #include "DataFormats/ForwardDetId/interface/BTLDetId.h"
0004 #include "DataFormats/ForwardDetId/interface/ETLDetId.h"
0005 
0006 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0007 #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h"
0008 #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h"
0009 #include "Geometry/MTDCommonData/interface/MTDTopologyMode.h"
0010 
0011 MTDTimeCalib::MTDTimeCalib(edm::ParameterSet const& conf, const MTDGeometry* geom, const MTDTopology* topo)
0012     : geom_(geom),
0013       topo_(topo),
0014       btlTimeOffset_(conf.getParameter<double>("BTLTimeOffset")),
0015       etlTimeOffset_(conf.getParameter<double>("ETLTimeOffset")),
0016       btlLightCollTime_(conf.getParameter<double>("BTLLightCollTime")),
0017       btlLightCollSlope_(conf.getParameter<double>("BTLLightCollSlope")) {}
0018 
0019 float MTDTimeCalib::getTimeCalib(const MTDDetId& id) const {
0020   if (id.subDetector() != MTDDetId::FastTime) {
0021     throw cms::Exception("MTDTimeCalib") << "MTDDetId: " << std::hex << id.rawId() << " is invalid!" << std::dec
0022                                          << std::endl;
0023   }
0024 
0025   float time_calib = 0.;
0026 
0027   if (id.mtdSubDetector() == MTDDetId::BTL) {
0028     time_calib += btlTimeOffset_;
0029     BTLDetId hitId(id);
0030     //for BTL topology gives different layout id
0031     DetId geoId = hitId.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(topo_->getMTDTopologyMode()));
0032     const MTDGeomDet* thedet = geom_->idToDet(geoId);
0033 
0034     if (thedet == nullptr) {
0035       throw cms::Exception("MTDTimeCalib") << "GeographicalID: " << std::hex << geoId.rawId() << " (" << id.rawId()
0036                                            << ") is invalid!" << std::dec << std::endl;
0037     }
0038     const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
0039     const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
0040 
0041     BTLDetId::CrysLayout btlL = MTDTopologyMode::crysLayoutFromTopoMode(topo_->getMTDTopologyMode());
0042     if (btlL == BTLDetId::CrysLayout::tile) {
0043       time_calib -= btlLightCollTime_;  //simply remove the offset introduced at sim level
0044     } else if (btlL == BTLDetId::CrysLayout::bar || btlL == BTLDetId::CrysLayout::barphiflat ||
0045                btlL == BTLDetId::CrysLayout::tdr) {
0046       //for bars in phi
0047       time_calib -= 0.5 * topo.pitch().first * btlLightCollSlope_;  //time offset for bar time is L/2v
0048     } else if (btlL == BTLDetId::CrysLayout::barzflat) {
0049       //for bars in z
0050       time_calib -= 0.5 * topo.pitch().second * btlLightCollSlope_;  //time offset for bar time is L/2v
0051     }
0052   } else if (id.mtdSubDetector() == MTDDetId::ETL) {
0053     time_calib += etlTimeOffset_;
0054   } else {
0055     throw cms::Exception("MTDTimeCalib") << "MTDDetId: " << std::hex << id.rawId() << " is invalid!" << std::dec
0056                                          << std::endl;
0057   }
0058 
0059   return time_calib;
0060 }
0061 
0062 #include "FWCore/Utilities/interface/typelookup.h"
0063 
0064 //--- Now use the Framework macros to set it all up:
0065 TYPELOOKUP_DATA_REG(MTDTimeCalib);