Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:16

0001 #include "RecoLocalTracker/Phase2TrackerRecHits/interface/Phase2StripCPE.h"
0002 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 Phase2StripCPE::Phase2StripCPE(edm::ParameterSet& conf,
0006                                const MagneticField& magf,
0007                                const TrackerGeometry& geom,
0008                                const SiPhase2OuterTrackerLorentzAngle& LorentzAngle)
0009     : magfield_(magf),
0010       geom_(geom),
0011       lorentzAngleMap_(LorentzAngle),
0012       tanLorentzAnglePerTesla_(conf.getParameter<double>("TanLorentzAnglePerTesla")) {
0013   use_LorentzAngle_DB_ = conf.getParameter<bool>("LorentzAngle_DB");
0014   fillParam();
0015 }
0016 
0017 Phase2StripCPE::LocalValues Phase2StripCPE::localParameters(const Phase2TrackerCluster1D& cluster,
0018                                                             const GeomDetUnit& detunit) const {
0019   auto const& p = m_Params[detunit.index() - m_off];
0020   auto const& topo = *p.topology;
0021   float ix = cluster.center() - 0.5f * p.coveredStrips;
0022   float iy = float(cluster.column()) + 0.5f;  // halfway the column
0023 
0024   LocalPoint lp(topo.localX(ix), topo.localY(iy), 0);  // x, y, z
0025 
0026   return std::make_pair(lp, p.localErr);
0027 }
0028 
0029 LocalVector Phase2StripCPE::driftDirection(const Phase2TrackerGeomDetUnit& det) const {
0030   LocalVector lbfield = (det.surface()).toLocal(magfield_.inTesla(det.surface().position()));
0031 
0032   float langle =
0033       use_LorentzAngle_DB_ ? lorentzAngleMap_.getLorentzAngle(det.geographicalId().rawId()) : tanLorentzAnglePerTesla_;
0034 
0035   float dir_x = -langle * lbfield.y();
0036   float dir_y = langle * lbfield.x();
0037   float dir_z = 1.f;  // E field always in z direction
0038 
0039   return LocalVector(dir_x, dir_y, dir_z);
0040 }
0041 
0042 void Phase2StripCPE::fillParam() {
0043   // in phase 2 they are all pixel topologies...
0044   auto const& dus = geom_.detUnits();
0045   m_off = dus.size();
0046   // skip Barrel and Foward pixels...
0047   for (unsigned int i = 3; i < 7; ++i) {
0048     LogDebug("LookingForFirstPhase2OT") << " Subdetector " << i << " GeomDetEnumerator "
0049                                         << GeomDetEnumerators::tkDetEnum[i] << " offset "
0050                                         << geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) << std::endl;
0051     if (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size()) {
0052       if (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) < m_off)
0053         m_off = geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]);
0054     }
0055   }
0056   LogDebug("LookingForFirstPhase2OT") << " Chosen offset: " << m_off;
0057 
0058   m_Params.resize(dus.size() - m_off);
0059   // very very minimal, for sure it will need to expand...
0060   for (auto i = m_off; i != dus.size(); ++i) {
0061     auto& p = m_Params[i - m_off];
0062 
0063     const Phase2TrackerGeomDetUnit& det = (const Phase2TrackerGeomDetUnit&)(*dus[i]);
0064     assert(det.index() == int(i));
0065     p.topology = &det.specificTopology();
0066 
0067     auto pitch_x = p.topology->pitch().first;
0068     auto pitch_y = p.topology->pitch().second;
0069 
0070     // see https://github.com/cms-sw/cmssw/blob/CMSSW_8_1_X/RecoLocalTracker/SiStripRecHitConverter/src/StripCPE.cc
0071     auto thickness = det.specificSurface().bounds().thickness();
0072     auto drift = driftDirection(det) * thickness;
0073     auto lvec = drift + LocalVector(0, 0, -thickness);
0074     p.coveredStrips = lvec.x() / pitch_x;  // simplifies wrt Phase0 tracker because only rectangular modules
0075 
0076     constexpr float o12 = 1. / 12;
0077     p.localErr = LocalError(o12 * pitch_x * pitch_x, 0, o12 * pitch_y * pitch_y);  // e2_xx, e2_xy, e2_yy
0078   }
0079 }