File indexing completed on 2022-10-25 03:22: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
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_;
0044 } else if (btlL == BTLDetId::CrysLayout::bar || btlL == BTLDetId::CrysLayout::barphiflat ||
0045 btlL == BTLDetId::CrysLayout::v2) {
0046
0047 time_calib -= 0.5 * topo.pitch().first * btlLightCollSlope_;
0048 } else if (btlL == BTLDetId::CrysLayout::barzflat) {
0049
0050 time_calib -= 0.5 * topo.pitch().second * btlLightCollSlope_;
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
0065 TYPELOOKUP_DATA_REG(MTDTimeCalib);