Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-10 23:04:48

0001 #ifndef Alignment_MillePedeAlignmentAlgorithm_MillePedeDQMModule_h
0002 #define Alignment_MillePedeAlignmentAlgorithm_MillePedeDQMModule_h
0003 
0004 /**
0005  * @package   Alignment/MillePedeAlignmentAlgorithm
0006  * @file      MillePedeDQMModule.h
0007  *
0008  * @author    Max Stark (max.stark@cern.ch)
0009  * @date      Oct 26, 2015
0010  *
0011  * @brief     DQM Plotter for PCL-Alignment
0012  */
0013 
0014 /*** system includes ***/
0015 #include <array>
0016 #include <memory>
0017 
0018 /*** core framework functionality ***/
0019 #include "FWCore/Framework/interface/ESWatcher.h"
0020 #include "FWCore/Framework/interface/Event.h"
0021 #include "FWCore/Framework/interface/EventSetup.h"
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0027 #include "FWCore/ServiceRegistry/interface/Service.h"
0028 
0029 /*** Geometry ***/
0030 #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h"
0031 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0032 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeomBuilderFromGeometricDet.h"
0033 #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyMap.h"
0034 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0035 
0036 /*** Thresholds from DB ***/
0037 #include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h"
0038 
0039 /*** Quality from DB ***/
0040 #include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h"
0041 #include "CondFormats/DataRecord/interface/SiPixelQualityFromDbRcd.h"
0042 
0043 /*** DQM ***/
0044 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0045 #include "DQMServices/Core/interface/DQMStore.h"
0046 
0047 /*** Records for ESWatcher ***/
0048 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0049 #include "Geometry/Records/interface/PTrackerParametersRcd.h"
0050 #include "Geometry/Records/interface/PTrackerAdditionalParametersPerDetRcd.h"
0051 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0052 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0053 
0054 /*** MillePede ***/
0055 #include "Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h"
0056 
0057 class MillePedeDQMModule : public DQMEDHarvester {
0058   //========================== PUBLIC METHODS ==================================
0059 public:  //====================================================================
0060   MillePedeDQMModule(const edm::ParameterSet&);
0061   ~MillePedeDQMModule() override = default;
0062 
0063   void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;
0064 
0065   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0066 
0067   enum { SIZE_LG_STRUCTS = 6, SIZE_HG_STRUCTS = 820, SIZE_INDEX = 8 };
0068 
0069   //========================= PRIVATE METHODS ==================================
0070 private:  //===================================================================
0071   void beginRun(const edm::Run&, const edm::EventSetup&) override;
0072 
0073   void bookHistograms(DQMStore::IBooker&);
0074 
0075   void fillStatusHisto(MonitorElement* statusHisto);
0076 
0077   void fillStatusHistoHG(MonitorElement* statusHisto);
0078 
0079   void fillExpertHistos();
0080 
0081   void fillExpertHistos_HG();
0082 
0083   void fillExpertHisto(MonitorElement* histo,
0084                        const std::array<double, SIZE_INDEX>& cut,
0085                        const std::array<double, SIZE_INDEX>& sigCut,
0086                        const std::array<double, SIZE_INDEX>& maxMoveCut,
0087                        const std::array<double, SIZE_INDEX>& maxErrorCut,
0088                        const std::array<double, SIZE_LG_STRUCTS>& obs,
0089                        const std::array<double, SIZE_LG_STRUCTS>& obsErr);
0090 
0091   void fillExpertHisto_HG(std::map<std::string, MonitorElement*>& histo_map,
0092                           const std::array<double, SIZE_INDEX>& cut,
0093                           const std::array<double, SIZE_INDEX>& sigCut,
0094                           const std::array<double, SIZE_INDEX>& maxMoveCut,
0095                           const std::array<double, SIZE_INDEX>& maxErrorCut,
0096                           const std::array<double, SIZE_HG_STRUCTS>& obs,
0097                           const std::array<double, SIZE_HG_STRUCTS>& obsErr);
0098 
0099   bool setupChanged(const edm::EventSetup&);
0100   int getIndexFromString(const std::string& alignableId);
0101 
0102   //========================== PRIVATE DATA ====================================
0103   //============================================================================
0104 
0105   // esConsumes
0106   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0107   const edm::ESGetToken<GeometricDet, IdealGeometryRecord> gDetToken_;
0108   const edm::ESGetToken<PTrackerParameters, PTrackerParametersRcd> ptpToken_;
0109   const edm::ESGetToken<PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd> ptitpToken_;
0110   const edm::ESGetToken<AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd> aliThrToken_;
0111   const edm::ESGetToken<SiPixelQuality, SiPixelQualityFromDbRcd> siPixelQualityToken_;
0112   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0113 
0114   const std::string outputFolder_;
0115   const edm::ParameterSet mpReaderConfig_;
0116   std::unique_ptr<AlignableTracker> tracker_;
0117   std::unique_ptr<MillePedeFileReader> mpReader_;
0118   std::shared_ptr<PixelTopologyMap> pixelTopologyMap_;
0119   std::shared_ptr<SiPixelQuality> pixelQuality_;
0120 
0121   std::vector<std::pair<std::string, int>> layerVec;
0122 
0123   edm::ESWatcher<TrackerTopologyRcd> watchTrackerTopologyRcd_;
0124   edm::ESWatcher<IdealGeometryRecord> watchIdealGeometryRcd_;
0125   edm::ESWatcher<PTrackerParametersRcd> watchPTrackerParametersRcd_;
0126 
0127   // Histograms
0128   MonitorElement* h_xPos;
0129   MonitorElement* h_xRot;
0130   MonitorElement* h_yPos;
0131   MonitorElement* h_yRot;
0132   MonitorElement* h_zPos;
0133   MonitorElement* h_zRot;
0134 
0135   std::map<std::string, MonitorElement*> h_xPos_HG;
0136   std::map<std::string, MonitorElement*> h_xRot_HG;
0137   std::map<std::string, MonitorElement*> h_yPos_HG;
0138   std::map<std::string, MonitorElement*> h_yRot_HG;
0139   std::map<std::string, MonitorElement*> h_zPos_HG;
0140   std::map<std::string, MonitorElement*> h_zRot_HG;
0141 
0142   MonitorElement* statusResults;
0143   MonitorElement* binariesAvalaible;
0144   MonitorElement* exitCode;
0145   MonitorElement* isVetoed;
0146 
0147   bool isHG_;
0148 };
0149 
0150 // define this as a plug-in
0151 DEFINE_FWK_MODULE(MillePedeDQMModule);
0152 
0153 #endif /* Alignment_MillePedeAlignmentAlgorithm_MillePedeDQMModule_h */