Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-16 03:23:29

0001 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0003 
0004 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0005 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0006 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0007 
0008 #include "RecoLocalTracker/SiStripClusterizer/interface/SiStripClusterInfo.h"
0009 
0010 #include "CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h"
0011 
0012 class SiStripPositionCorrectionsTableProducer : public SiStripOnTrackClusterTableProducerBase {
0013 public:
0014   explicit SiStripPositionCorrectionsTableProducer(const edm::ParameterSet& params)
0015       : SiStripOnTrackClusterTableProducerBase(params),
0016         m_clusterInfo(consumesCollector()),
0017         m_tkGeomToken{esConsumes<>()} {}
0018 
0019   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0020     edm::ParameterSetDescription desc;
0021     desc.add<std::string>("name", "cluster");
0022     desc.add<std::string>("doc", "On-track cluster properties for Lorentz angle and backplane correction measurement");
0023     desc.add<bool>("extension", false);
0024     desc.add<edm::InputTag>("Tracks", edm::InputTag{"generalTracks"});
0025     descriptions.add("siStripPositionCorrectionsTable", desc);
0026   }
0027 
0028   void fillTable(const std::vector<OnTrackCluster>& clusters,
0029                  const edm::View<reco::Track>& tracks,
0030                  nanoaod::FlatTable* table,
0031                  const edm::EventSetup& iSetup) final;
0032 
0033 private:
0034   SiStripClusterInfo m_clusterInfo;
0035   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> m_tkGeomToken;
0036 };
0037 
0038 void SiStripPositionCorrectionsTableProducer::fillTable(const std::vector<OnTrackCluster>& clusters,
0039                                                         const edm::View<reco::Track>& tracks,
0040                                                         nanoaod::FlatTable* table,
0041                                                         const edm::EventSetup& iSetup) {
0042   const auto& tkGeom = iSetup.getData(m_tkGeomToken);
0043   std::vector<uint32_t> c_nstrips;
0044   std::vector<float> c_barycenter, c_variance, c_localdirx, c_localdiry, c_localdirz, c_localx, c_rhlocalx,
0045       c_rhlocalxerr;
0046   for (const auto clus : clusters) {
0047     c_nstrips.push_back(clus.cluster->amplitudes().size());
0048     m_clusterInfo.setCluster(*clus.cluster, clus.det);
0049     c_variance.push_back(m_clusterInfo.variance());
0050     const auto& trajState = clus.measurement.updatedState();
0051     const auto trackDir = trajState.localDirection();
0052     c_localdirx.push_back(trackDir.x());
0053     c_localdiry.push_back(trackDir.y());
0054     c_localdirz.push_back(trackDir.z());
0055     const auto hit = clus.measurement.recHit()->hit();
0056     const auto stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(hit->geographicalId()));
0057     c_barycenter.push_back(stripDet->specificTopology().localPosition(clus.cluster->barycenter()).x());
0058     c_localx.push_back(stripDet->toLocal(trajState.globalPosition()).x());
0059     c_rhlocalx.push_back(hit->localPosition().x());
0060     c_rhlocalxerr.push_back(hit->localPositionError().xx());
0061   }
0062   addColumn(table, "nstrips", c_nstrips, "cluster width");
0063   addColumn(table, "variance", c_variance, "Cluster variance");
0064   addColumn(table, "localdirx", c_localdirx, "x component of the local track direction");
0065   addColumn(table, "localdiry", c_localdiry, "y component of the local track direction");
0066   addColumn(table, "localdirz", c_localdirz, "z component of the local track direction");
0067   addColumn(table, "barycenter", c_barycenter, "Cluster barycenter (local x without corrections)");
0068   addColumn(table, "localx", c_localx, "Track local x");
0069   addColumn(table, "rhlocalx", c_rhlocalx, "RecHit local x");
0070   addColumn(table, "rhlocalxerr", c_rhlocalxerr, "RecHit local x uncertainty");
0071 }
0072 
0073 #include "FWCore/PluginManager/interface/ModuleDef.h"
0074 #include "FWCore/Framework/interface/MakerMacros.h"
0075 DEFINE_FWK_MODULE(SiStripPositionCorrectionsTableProducer);