File indexing completed on 2024-04-06 12:33:20
0001 #ifndef Validation_RecoTrack_SiStripTrackingRecHitsValid_h
0002 #define Validation_RecoTrack_SiStripTrackingRecHitsValid_h
0003
0004
0005 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0006 #include "DQMServices/Core/interface/DQMStore.h"
0007 #include "DataFormats/Common/interface/Handle.h"
0008 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0009 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0010 #include "DataFormats/TrackReco/interface/Track.h"
0011 #include "DataFormats/TrackReco/interface/TrackExtra.h"
0012 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0013 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
0014 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 #include "FWCore/ServiceRegistry/interface/Service.h"
0020 #include "FWCore/Utilities/interface/EDGetToken.h"
0021 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0022 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0023 #include "RecoLocalTracker/Records/interface/TkStripCPERecord.h"
0024 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0025 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
0026 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
0027 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
0028 #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h"
0029 #include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
0030 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0031 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0032
0033 #include <TROOT.h>
0034 #include <TTree.h>
0035 #include <TFile.h>
0036 #include <TH1F.h>
0037 #include <TProfile.h>
0038 #include <string>
0039
0040 #include "FWCore/Framework/interface/Frameworkfwd.h"
0041 #include "FWCore/Framework/interface/EventSetup.h"
0042 #include "FWCore/Framework/interface/ESHandle.h"
0043 #include "FWCore/Framework/interface/MakerMacros.h"
0044 #include "FWCore/Framework/interface/ESWatcher.h"
0045 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0046
0047
0048 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0049 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0050 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0051 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0052 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0053 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0054 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0055 #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
0056 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0057 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0058 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0059 #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h"
0060 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
0061 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
0062 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0063
0064 class SiStripDetCabling;
0065 class SiStripDCSStatus;
0066
0067 class SiStripTrackingRecHitsValid : public DQMEDAnalyzer {
0068 public:
0069 SiStripTrackingRecHitsValid(const edm::ParameterSet& conf);
0070
0071 ~SiStripTrackingRecHitsValid() override;
0072
0073
0074
0075
0076 struct SimpleHitsMEs {
0077 MonitorElement* meCategory;
0078 MonitorElement* meTrackwidth;
0079 MonitorElement* meExpectedwidth;
0080 MonitorElement* meClusterwidth;
0081 MonitorElement* meTrackanglealpha;
0082 MonitorElement* meTrackanglebeta;
0083 MonitorElement* meResolxMFTrackwidthProfile;
0084 MonitorElement* meResolxMFTrackwidthProfileWClus1;
0085 MonitorElement* meResolxMFTrackwidthProfileWClus2;
0086 MonitorElement* meResolxMFTrackwidthProfileWClus3;
0087 MonitorElement* meResolxMFTrackwidthProfileWClus4;
0088 MonitorElement* meResMFTrackwidthProfileWClus1;
0089
0090 MonitorElement* meResMFTrackwidthProfileWClus2;
0091 MonitorElement* meResMFTrackwidthProfileWClus21;
0092 MonitorElement* meResMFTrackwidthProfileWClus22;
0093 MonitorElement* meResMFTrackwidthProfileWClus23;
0094
0095 MonitorElement* meResMFTrackwidthProfileWClus3;
0096 MonitorElement* meResMFTrackwidthProfileWClus4;
0097 MonitorElement* meResolxMFTrackwidthProfileCategory1;
0098 MonitorElement* meResolxMFTrackwidthProfileCategory2;
0099 MonitorElement* meResolxMFTrackwidthProfileCategory3;
0100 MonitorElement* meResolxMFTrackwidthProfileCategory4;
0101 MonitorElement* meResolxMFClusterwidthProfileCategory1;
0102 MonitorElement* meResolxMFAngleProfile;
0103 MonitorElement* meResolxLF;
0104 MonitorElement* meResLF;
0105 MonitorElement* mePullLF;
0106 MonitorElement* meResolxMF;
0107 MonitorElement* meResMF;
0108 MonitorElement* mePullMF;
0109 };
0110
0111 struct LayerMEs {
0112 MonitorElement* meWclusRphi;
0113 MonitorElement* meAdcRphi;
0114 MonitorElement* meResolxLFRphi;
0115 MonitorElement* meResolxMFRphi;
0116 MonitorElement* meResolxMFRphiwclus1;
0117 MonitorElement* meResolxMFRphiwclus2;
0118 MonitorElement* meResolxMFRphiwclus3;
0119 MonitorElement* meResolxMFRphiwclus4;
0120 MonitorElement* meResLFRphi;
0121 MonitorElement* meResMFRphi;
0122 MonitorElement* meResMFRphiwclus1;
0123 MonitorElement* meResMFRphiwclus2;
0124 MonitorElement* meResMFRphiwclus3;
0125 MonitorElement* meResMFRphiwclus4;
0126 MonitorElement* mePullLFRphi;
0127 MonitorElement* mePullMFRphi;
0128 MonitorElement* mePullMFRphiwclus1;
0129 MonitorElement* mePullMFRphiwclus2;
0130 MonitorElement* mePullMFRphiwclus3;
0131 MonitorElement* mePullMFRphiwclus4;
0132 MonitorElement* meTrackangleRphi;
0133 MonitorElement* meTrackanglebetaRphi;
0134 MonitorElement* meTrackangle2Rphi;
0135 MonitorElement* mePullTrackangleProfileRphi;
0136 MonitorElement* mePullTrackangle2DRphi;
0137 MonitorElement* meTrackwidthRphi;
0138 MonitorElement* meExpectedwidthRphi;
0139 MonitorElement* meClusterwidthRphi;
0140 MonitorElement* meCategoryRphi;
0141 MonitorElement* mePullTrackwidthProfileRphi;
0142 MonitorElement* mePullTrackwidthProfileRphiwclus1;
0143 MonitorElement* mePullTrackwidthProfileRphiwclus2;
0144 MonitorElement* mePullTrackwidthProfileRphiwclus3;
0145 MonitorElement* mePullTrackwidthProfileRphiwclus4;
0146 MonitorElement* mePullTrackwidthProfileCategory1Rphi;
0147 MonitorElement* mePullTrackwidthProfileCategory2Rphi;
0148 MonitorElement* mePullTrackwidthProfileCategory3Rphi;
0149 MonitorElement* mePullTrackwidthProfileCategory4Rphi;
0150 MonitorElement* meResolxMFTrackwidthProfileRphi;
0151
0152 MonitorElement* meResolxMFTrackwidthProfileWclus1Rphi;
0153 MonitorElement* meResolxMFTrackwidthProfileWclus2Rphi;
0154 MonitorElement* meResolxMFTrackwidthProfileWclus3Rphi;
0155 MonitorElement* meResolxMFTrackwidthProfileWclus4Rphi;
0156 MonitorElement* meResMFTrackwidthProfileWclus1Rphi;
0157 MonitorElement* meResMFTrackwidthProfileWclus2Rphi;
0158 MonitorElement* meResMFTrackwidthProfileWclus3Rphi;
0159 MonitorElement* meResMFTrackwidthProfileWclus4Rphi;
0160
0161 MonitorElement* meResolxMFTrackwidthProfileCategory1Rphi;
0162 MonitorElement* meResolxMFTrackwidthProfileCategory2Rphi;
0163 MonitorElement* meResolxMFTrackwidthProfileCategory3Rphi;
0164 MonitorElement* meResolxMFTrackwidthProfileCategory4Rphi;
0165 MonitorElement* meResolxMFClusterwidthProfileCategory1Rphi;
0166 MonitorElement* meResolxMFAngleProfileRphi;
0167 MonitorElement* merapidityResProfilewclus1;
0168 MonitorElement* merapidityResProfilewclus2;
0169 MonitorElement* merapidityResProfilewclus3;
0170 MonitorElement* merapidityResProfilewclus4;
0171 };
0172
0173 struct StereoAndMatchedMEs {
0174
0175 MonitorElement* meWclusSas;
0176 MonitorElement* meAdcSas;
0177 MonitorElement* meResolxLFSas;
0178 MonitorElement* meResolxMFSas;
0179 MonitorElement* meResLFSas;
0180 MonitorElement* meResMFSas;
0181 MonitorElement* mePullLFSas;
0182 MonitorElement* mePullMFSas;
0183 MonitorElement* meTrackangleSas;
0184 MonitorElement* meTrackanglebetaSas;
0185 MonitorElement* mePullTrackangleProfileSas;
0186 MonitorElement* meTrackwidthSas;
0187 MonitorElement* meExpectedwidthSas;
0188 MonitorElement* meClusterwidthSas;
0189 MonitorElement* meCategorySas;
0190 MonitorElement* mePullTrackwidthProfileSas;
0191 MonitorElement* mePullTrackwidthProfileCategory1Sas;
0192 MonitorElement* mePullTrackwidthProfileCategory2Sas;
0193 MonitorElement* mePullTrackwidthProfileCategory3Sas;
0194 MonitorElement* mePullTrackwidthProfileCategory4Sas;
0195 MonitorElement* meResolxMFTrackwidthProfileSas;
0196 MonitorElement* meResolxMFTrackwidthProfileCategory1Sas;
0197 MonitorElement* meResolxMFTrackwidthProfileCategory2Sas;
0198 MonitorElement* meResolxMFTrackwidthProfileCategory3Sas;
0199 MonitorElement* meResolxMFTrackwidthProfileCategory4Sas;
0200 MonitorElement* meResolxMFClusterwidthProfileCategory1Sas;
0201 MonitorElement* meResolxMFAngleProfileSas;
0202
0203 MonitorElement* mePosxMatched;
0204 MonitorElement* mePosyMatched;
0205 MonitorElement* meResolxMatched;
0206 MonitorElement* meResolyMatched;
0207 MonitorElement* meResxMatched;
0208 MonitorElement* meResyMatched;
0209 MonitorElement* mePullxMatched;
0210 MonitorElement* mePullyMatched;
0211 };
0212
0213 struct RecHitProperties {
0214 float x;
0215 float y;
0216 float z;
0217 float resolxx;
0218 float resolxy;
0219 float resolyy;
0220 float resolxxMF;
0221
0222 float resx;
0223 float resy;
0224 float resxMF;
0225 float pullx;
0226 float pully;
0227 float pullxMF;
0228 float trackangle;
0229 float trackanglebeta;
0230
0231 float trackwidth;
0232 int expectedwidth;
0233 int category;
0234 float thickness;
0235 int clusiz;
0236 float cluchg;
0237 };
0238
0239 protected:
0240 void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0241 void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& es) override;
0242
0243 private:
0244 const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> m_geomToken;
0245 const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> m_topoToken, m_topoTokenBR;
0246 const edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> m_SiStripDetCablingToken;
0247 const edm::ESGetToken<StripClusterParameterEstimator, TkStripCPERecord> m_stripCPEToken;
0248
0249 edm::ESWatcher<SiStripDetCablingRcd> watchSiStripDetCablingRcd_;
0250
0251 DQMStore* dbe_;
0252 bool runStandalone;
0253 bool outputMEsInRootFile;
0254 std::string outputFileName;
0255
0256 std::string topFolderName_;
0257
0258 bool layerswitchResolx_LF;
0259 bool layerswitchResolx_MF;
0260 bool layerswitchRes_LF;
0261 bool layerswitchRes_MF;
0262 bool layerswitchPull_LF;
0263 bool layerswitchPull_MF;
0264 bool layerswitchCategory;
0265 bool layerswitchTrackwidth;
0266 bool layerswitchExpectedwidth;
0267 bool layerswitchClusterwidth;
0268 bool layerswitchTrackanglealpha;
0269 bool layerswitchTrackanglebeta;
0270 bool layerswitchResolxMFTrackwidthProfile_WClus1;
0271 bool layerswitchResolxMFTrackwidthProfile_WClus2;
0272 bool layerswitchResolxMFTrackwidthProfile_WClus3;
0273 bool layerswitchResolxMFTrackwidthProfile_WClus4;
0274 bool layerswitchResMFTrackwidthProfile_WClus1;
0275 bool layerswitchResMFTrackwidthProfile_WClus2;
0276 bool layerswitchResMFTrackwidthProfile_WClus21;
0277 bool layerswitchResMFTrackwidthProfile_WClus22;
0278 bool layerswitchResMFTrackwidthProfile_WClus23;
0279 bool layerswitchResMFTrackwidthProfile_WClus3;
0280 bool layerswitchResMFTrackwidthProfile_WClus4;
0281 bool layerswitchResolxMFTrackwidthProfile;
0282 bool layerswitchResolxMFTrackwidthProfile_Category1;
0283 bool layerswitchResolxMFTrackwidthProfile_Category2;
0284 bool layerswitchResolxMFTrackwidthProfile_Category3;
0285 bool layerswitchResolxMFTrackwidthProfile_Category4;
0286 bool layerswitchResolxMFClusterwidthProfile_Category1;
0287 bool layerswitchResolxMFAngleProfile;
0288 bool layerswitchWclusRphi;
0289 bool layerswitchAdcRphi;
0290 bool layerswitchResolxLFRphi;
0291 bool layerswitchResolxMFRphi;
0292 bool layerswitchResolxMFRphiwclus1;
0293 bool layerswitchResolxMFRphiwclus2;
0294 bool layerswitchResolxMFRphiwclus3;
0295 bool layerswitchResolxMFRphiwclus4;
0296 bool layerswitchResLFRphi;
0297 bool layerswitchResMFRphi;
0298 bool layerswitchResMFRphiwclus1;
0299 bool layerswitchResMFRphiwclus2;
0300 bool layerswitchResMFRphiwclus3;
0301 bool layerswitchResMFRphiwclus4;
0302 bool layerswitchPullLFRphi;
0303 bool layerswitchPullMFRphi;
0304 bool layerswitchPullMFRphiwclus1;
0305 bool layerswitchPullMFRphiwclus2;
0306 bool layerswitchPullMFRphiwclus3;
0307 bool layerswitchPullMFRphiwclus4;
0308 bool layerswitchTrackangleRphi;
0309 bool layerswitchTrackanglebetaRphi;
0310 bool layerswitchTrackangle2Rphi;
0311 bool layerswitchPullTrackangleProfileRphi;
0312 bool layerswitchPullTrackangle2DRphi;
0313 bool layerswitchTrackwidthRphi;
0314 bool layerswitchExpectedwidthRphi;
0315 bool layerswitchClusterwidthRphi;
0316 bool layerswitchCategoryRphi;
0317 bool layerswitchPullTrackwidthProfileRphi;
0318 bool layerswitchPullTrackwidthProfileRphiwclus1;
0319 bool layerswitchPullTrackwidthProfileRphiwclus2;
0320 bool layerswitchPullTrackwidthProfileRphiwclus3;
0321 bool layerswitchPullTrackwidthProfileRphiwclus4;
0322 bool layerswitchPullTrackwidthProfileCategory1Rphi;
0323 bool layerswitchPullTrackwidthProfileCategory2Rphi;
0324 bool layerswitchPullTrackwidthProfileCategory3Rphi;
0325 bool layerswitchPullTrackwidthProfileCategory4Rphi;
0326 bool layerswitchResolxMFTrackwidthProfileRphi;
0327 bool layerswitchResolxMFTrackwidthProfileWclus1Rphi;
0328 bool layerswitchResolxMFTrackwidthProfileWclus2Rphi;
0329 bool layerswitchResolxMFTrackwidthProfileWclus3Rphi;
0330 bool layerswitchResolxMFTrackwidthProfileWclus4Rphi;
0331 bool layerswitchResMFTrackwidthProfileWclus1Rphi;
0332 bool layerswitchResMFTrackwidthProfileWclus2Rphi;
0333 bool layerswitchResMFTrackwidthProfileWclus3Rphi;
0334 bool layerswitchResMFTrackwidthProfileWclus4Rphi;
0335 bool layerswitchResolxMFTrackwidthProfileCategory1Rphi;
0336 bool layerswitchResolxMFTrackwidthProfileCategory2Rphi;
0337 bool layerswitchResolxMFTrackwidthProfileCategory3Rphi;
0338 bool layerswitchResolxMFTrackwidthProfileCategory4Rphi;
0339 bool layerswitchResolxMFAngleProfileRphi;
0340 bool layerswitchResolxMFClusterwidthProfileCategory1Rphi;
0341 bool layerswitchrapidityResProfilewclus1;
0342 bool layerswitchrapidityResProfilewclus2;
0343 bool layerswitchrapidityResProfilewclus3;
0344 bool layerswitchrapidityResProfilewclus4;
0345 bool layerswitchWclusSas;
0346 bool layerswitchAdcSas;
0347 bool layerswitchResolxLFSas;
0348 bool layerswitchResolxMFSas;
0349 bool layerswitchResLFSas;
0350 bool layerswitchResMFSas;
0351 bool layerswitchPullLFSas;
0352 bool layerswitchPullMFSas;
0353 bool layerswitchTrackangleSas;
0354 bool layerswitchTrackanglebetaSas;
0355 bool layerswitchPullTrackangleProfileSas;
0356 bool layerswitchTrackwidthSas;
0357 bool layerswitchExpectedwidthSas;
0358 bool layerswitchClusterwidthSas;
0359 bool layerswitchCategorySas;
0360 bool layerswitchPullTrackwidthProfileSas;
0361 bool layerswitchPullTrackwidthProfileCategory1Sas;
0362 bool layerswitchPullTrackwidthProfileCategory2Sas;
0363 bool layerswitchPullTrackwidthProfileCategory3Sas;
0364 bool layerswitchPullTrackwidthProfileCategory4Sas;
0365 bool layerswitchResolxMFTrackwidthProfileSas;
0366 bool layerswitchResolxMFTrackwidthProfileCategory1Sas;
0367 bool layerswitchResolxMFTrackwidthProfileCategory2Sas;
0368 bool layerswitchResolxMFTrackwidthProfileCategory3Sas;
0369 bool layerswitchResolxMFTrackwidthProfileCategory4Sas;
0370 bool layerswitchResolxMFAngleProfileSas;
0371 bool layerswitchResolxMFClusterwidthProfileCategory1Sas;
0372 bool layerswitchPosxMatched;
0373 bool layerswitchPosyMatched;
0374 bool layerswitchResolxMatched;
0375 bool layerswitchResolyMatched;
0376 bool layerswitchResxMatched;
0377 bool layerswitchResyMatched;
0378 bool layerswitchPullxMatched;
0379 bool layerswitchPullyMatched;
0380
0381 SimpleHitsMEs simplehitsMEs;
0382 std::vector<PSimHit> matched;
0383 std::map<std::string, LayerMEs> LayerMEsMap;
0384 std::map<std::string, StereoAndMatchedMEs> StereoAndMatchedMEsMap;
0385 std::map<std::string, std::vector<uint32_t> > LayerDetMap;
0386 std::map<std::string, std::vector<uint32_t> > StereoAndMatchedDetMap;
0387 std::pair<LocalPoint, LocalVector> projectHit(const PSimHit& hit,
0388 const StripGeomDetUnit* stripDet,
0389 const BoundPlane& plane);
0390
0391 LocalVector driftDirection(const StripGeomDetUnit* det) const;
0392
0393 MonitorElement* Fit_SliceY(TH2F* Histo2D);
0394
0395 void createMEs(DQMStore::IBooker& ibooker, const edm::EventSetup& es);
0396 void createSimpleHitsMEs(DQMStore::IBooker& ibooker);
0397 void createLayerMEs(DQMStore::IBooker& ibooker, std::string label);
0398 void createStereoAndMatchedMEs(DQMStore::IBooker& ibooker, std::string label);
0399
0400 MonitorElement* bookME1D(DQMStore::IBooker& ibooker,
0401 const char* ParameterSetLabel,
0402 const char* HistoName,
0403 const char* HistoTitle);
0404 MonitorElement* bookMEProfile(DQMStore::IBooker& ibooker,
0405 const char* ParameterSetLabel,
0406 const char* HistoName,
0407 const char* HistoTitle);
0408
0409 inline void fillME(MonitorElement* ME, float value1) {
0410 if (ME != nullptr)
0411 ME->Fill(value1);
0412 }
0413 inline void fillME(MonitorElement* ME, float value1, float value2) {
0414 if (ME != nullptr)
0415 ME->Fill(value1, value2);
0416 }
0417 inline void fillME(MonitorElement* ME, float value1, float value2, float value3) {
0418 if (ME != nullptr)
0419 ME->Fill(value1, value2, value3);
0420 }
0421 inline void fillME(MonitorElement* ME, float value1, float value2, float value3, float value4) {
0422 if (ME != nullptr)
0423 ME->Fill(value1, value2, value3, value4);
0424 }
0425
0426 edm::ParameterSet conf_;
0427 TrackerHitAssociator::Config trackerHitAssociatorConfig_;
0428 edm::ParameterSet Parameters;
0429
0430 RecHitProperties rechitpro;
0431
0432 void rechitanalysis(LocalVector ldir,
0433 const TrackingRecHit* rechit,
0434 const StripGeomDetUnit* stripdet,
0435 const StripClusterParameterEstimator* stripcpe,
0436 TrackerHitAssociator& associate,
0437 bool simplehit1or2D);
0438
0439 enum class MatchStatus { matched, monoHit, stereoHit };
0440 void rechitanalysis_matched(LocalVector ldir,
0441 const TrackingRecHit* rechit,
0442 const GluedGeomDet* gluedDet,
0443 TrackerHitAssociator& associate,
0444 const StripClusterParameterEstimator* stripcpe,
0445 const MatchStatus matchedmonorstereo);
0446
0447 float track_rapidity;
0448 edm::EDGetTokenT<std::vector<reco::Track> > tracksInputToken_;
0449 };
0450
0451 #endif