Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 
0066   if (cp.theCluster->getClusterErrorX() < 0.) {
0067     return dp.theTopol->localPosition(pos);
0068   } else {
0069     LocalPoint out(cp.theCluster->getClusterPosX(), dp.theTopol->localY(pos.y()));
0070     return out;
0071   }
0072 }
0073 
0074 LocalError MTDCPEBase::localError(DetParam const& dp, ClusterParam& cp) const {
0075   MeasurementPoint pos(cp.theCluster->x(), cp.theCluster->y());
0076   float sigma2 = cp.theCluster->positionError(sigma_flat);
0077   sigma2 *= sigma2;
0078   MeasurementError posErr(sigma2, 0, sigma2);
0079   LocalError outErr = dp.theTopol->localError(pos, posErr);
0080 
0081   if (cp.theCluster->getClusterErrorX() < 0.) {
0082     return outErr;
0083   } else {
0084     LocalPoint outPos(cp.theCluster->getClusterPosX(), dp.theTopol->localY(pos.y()));
0085     float sigmaX2 = cp.theCluster->getClusterErrorX();
0086     sigmaX2 *= sigmaX2;
0087     LocalError outErrDet(sigmaX2, 0, outErr.yy());
0088     return outErrDet;
0089   }
0090 }
0091 
0092 MTDCPEBase::TimeValue MTDCPEBase::clusterTime(DetParam const& dp, ClusterParam& cp) const {
0093   return cp.theCluster->time();
0094 }
0095 
0096 MTDCPEBase::TimeValueError MTDCPEBase::clusterTimeError(DetParam const& dp, ClusterParam& cp) const {
0097   return cp.theCluster->timeError();
0098 }