Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:56

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 (static_cast<int>(btlL) >= static_cast<int>(BTLDetId::CrysLayout::barphiflat)) {
0043       //for bars in phi
0044       time_calib -= 0.5 * topo.pitch().first * btlLightCollSlope_;  //time offset for bar time is L/2v
0045     } else {
0046       throw cms::Exception("MTDTimeCalib")
0047           << "BTL topology mode " << static_cast<int>(btlL) << " unsupported! Aborting";
0048     }
0049   } else if (id.mtdSubDetector() == MTDDetId::ETL) {
0050     time_calib += etlTimeOffset_;
0051   } else {
0052     throw cms::Exception("MTDTimeCalib") << "MTDDetId: " << std::hex << id.rawId() << " is invalid!" << std::dec
0053                                          << std::endl;
0054   }
0055 
0056   return time_calib;
0057 }
0058 
0059 #include "FWCore/Utilities/interface/typelookup.h"
0060 
0061 //--- Now use the Framework macros to set it all up:
0062 TYPELOOKUP_DATA_REG(MTDTimeCalib);