Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-18 09:15:16

0001 #include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetUnit.h"
0002 #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h"
0003 #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h"
0004 
0005 #include "RecoLocalFastTime/FTLClusterizer/interface/MTDCPEBase.h"
0006 
0007 // MessageLogger
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 
0010 // Magnetic field
0011 #include "MagneticField/Engine/interface/MagneticField.h"
0012 
0013 #include <iostream>
0014 
0015 using namespace std;
0016 
0017 //-----------------------------------------------------------------------------
0018 //  A constructor run for generic and templates
0019 //
0020 //-----------------------------------------------------------------------------
0021 MTDCPEBase::MTDCPEBase(edm::ParameterSet const& conf, const MTDGeometry& geom) : geom_(geom) {
0022   //-----------------------------------------------------------------------------
0023   //  Fill all variables which are constant for an event (geometry)
0024   //-----------------------------------------------------------------------------
0025   auto const& dus = geom_.detUnits();
0026   unsigned detectors = dus.size();
0027   m_DetParams.resize(detectors);
0028   LogDebug("MTDCPEBase::fillDetParams():") << "caching " << detectors << "MTD detectors" << endl;
0029   for (unsigned i = 0; i != detectors; ++i) {
0030     auto& p = m_DetParams[i];
0031     p.theDet = dynamic_cast<const MTDGeomDetUnit*>(dus[i]);
0032     assert(p.theDet);
0033 
0034     p.theOrigin = p.theDet->surface().toLocal(GlobalPoint(0, 0, 0));
0035 
0036     //--- p.theDet->type() returns a GeomDetType, which implements subDetector()
0037     p.thePart = p.theDet->type().subDetector();
0038 
0039     //--- bounds() is implemented in BoundSurface itself.
0040     p.theThickness = p.theDet->surface().bounds().thickness();
0041 
0042     // Cache the det id for templates and generic erros
0043     p.theTopol = &(static_cast<const ProxyMTDTopology&>(p.theDet->topology()));
0044     assert(p.theTopol);
0045     p.theRecTopol = &(static_cast<const RectangularMTDTopology&>(p.theTopol->specificTopology()));
0046     assert(p.theRecTopol);
0047 
0048     //--- The geometrical description of one module/plaquette
0049     std::pair<float, float> pitchxy = p.theRecTopol->pitch();
0050     p.thePitchX = pitchxy.first;   // pitch along x
0051     p.thePitchY = pitchxy.second;  // pitch along y
0052 
0053     LogDebug("MTDCPEBase::fillDetParams()") << "***** MTD LAYOUT *****"
0054                                             << " thePart = " << p.thePart << " theThickness = " << p.theThickness
0055                                             << " thePitchX  = " << p.thePitchX << " thePitchY  = " << p.thePitchY;
0056   }
0057 }
0058 
0059 //------------------------------------------------------------------------
0060 MTDCPEBase::DetParam const& MTDCPEBase::detParam(const GeomDetUnit& det) const { return m_DetParams.at(det.index()); }
0061 
0062 LocalPoint MTDCPEBase::localPosition(DetParam const& dp, ClusterParam& cp) const {
0063   //remember measurement point is row(col)+0.5f
0064   MeasurementPoint pos(cp.theCluster->x(), cp.theCluster->y());
0065   return dp.theTopol->localPosition(pos);
0066 }
0067 
0068 LocalError MTDCPEBase::localError(DetParam const& dp, ClusterParam& cp) const {
0069   constexpr double one_over_twelve = 1. / 12.;
0070   MeasurementPoint pos(cp.theCluster->x(), cp.theCluster->y());
0071   MeasurementError simpleRect(one_over_twelve, 0, one_over_twelve);
0072   return dp.theTopol->localError(pos, simpleRect);
0073 }
0074 
0075 MTDCPEBase::TimeValue MTDCPEBase::clusterTime(DetParam const& dp, ClusterParam& cp) const {
0076   return cp.theCluster->time();
0077 }
0078 
0079 MTDCPEBase::TimeValueError MTDCPEBase::clusterTimeError(DetParam const& dp, ClusterParam& cp) const {
0080   return cp.theCluster->timeError();
0081 }