CMS 3D CMS Logo

MTDTimeCalib.cc
Go to the documentation of this file.
2 
5 
10 
12  const MTDGeometry* geom, const MTDTopology* topo):
13  geom_(geom),
14  topo_(topo),
15  btlTimeOffset_( conf.getParameter<double>("BTLTimeOffset") ),
16  etlTimeOffset_( conf.getParameter<double>("ETLTimeOffset") ),
17  btlLightCollTime_( conf.getParameter<double>("BTLLightCollTime") ),
18  btlLightCollSlope_( conf.getParameter<double>("BTLLightCollSlope") )
19 {
20 }
21 
22 
23 float MTDTimeCalib::getTimeCalib(const MTDDetId& id) const
24 {
25  if (id.subDetector() != MTDDetId::FastTime)
26  {
27  throw cms::Exception("MTDTimeCalib") << "MTDDetId: " << std::hex
28  << id.rawId()
29  << " is invalid!" << std::dec
30  << std::endl;
31  }
32 
33  float time_calib = 0.;
34 
35  if ( id.mtdSubDetector() == MTDDetId::BTL )
36  {
37  time_calib += btlTimeOffset_;
38  BTLDetId hitId(id);
39  DetId geoId = hitId.geographicalId( (BTLDetId::CrysLayout) topo_->getMTDTopologyMode() ); //for BTL topology gives different layout id
40  const MTDGeomDet* thedet = geom_->idToDet(geoId);
41 
42  if( thedet == nullptr ) {
43  throw cms::Exception("MTDTimeCalib") << "GeographicalID: " << std::hex
44  << geoId.rawId()
45  << " (" << id.rawId()<< ") is invalid!" << std::dec
46  << std::endl;
47  }
48  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
49  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
50 
52  {
53  time_calib -= btlLightCollTime_; //simply remove the offset introduced at sim level
54  }
57  )
58  {
59  //for bars in phi
60  time_calib -= 0.5*topo.pitch().first*btlLightCollSlope_; //time offset for bar time is L/2v
61  }
63  {
64  //for bars in z
65  time_calib -= 0.5*topo.pitch().second*btlLightCollSlope_; //time offset for bar time is L/2v
66  }
67  }
68  else if ( id.mtdSubDetector() == MTDDetId::ETL )
69  {
70  time_calib += etlTimeOffset_;
71  }
72  else
73  {
74  throw cms::Exception("MTDTimeCalib") << "MTDDetId: " << std::hex
75  << id.rawId()
76  << " is invalid!" << std::dec
77  << std::endl;
78  }
79 
80  return time_calib;
81 }
82 
84 
85 //--- Now use the Framework macros to set it all up:
float etlTimeOffset_
Definition: MTDTimeCalib.h:25
CrysLayout
Definition: BTLDetId.h:66
virtual const Topology & topology() const
Definition: GeomDet.cc:81
float btlLightCollSlope_
Definition: MTDTimeCalib.h:29
int getMTDTopologyMode() const
Definition: MTDTopology.h:74
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
float btlLightCollTime_
Definition: MTDTimeCalib.h:28
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:184
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:162
MTDTimeCalib(edm::ParameterSet const &conf, const MTDGeometry *geom, const MTDTopology *topo)
Definition: MTDTimeCalib.cc:11
virtual const PixelTopology & specificTopology() const
const MTDTopology * topo_
Definition: MTDTimeCalib.h:23
float btlTimeOffset_
Definition: MTDTimeCalib.h:24
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
Definition: DetId.h:18
float getTimeCalib(const MTDDetId &id) const
Definition: MTDTimeCalib.cc:23
const MTDGeometry * geom_
Definition: MTDTimeCalib.h:22
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
std::pair< float, float > pitch() const override