Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:39:29

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/ParameterSet/interface/ParameterSet.h"
0020 #include "FWCore/ServiceRegistry/interface/Service.h"
0021 #include "FWCore/Framework/interface/ESWatcher.h"
0022 #include "FWCore/Framework/interface/Event.h"
0023 #include "FWCore/Framework/interface/EventSetup.h"
0024 #include "FWCore/Framework/interface/MakerMacros.h"
0025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0026 
0027 /*** Geometry ***/
0028 #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h"
0029 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0030 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeomBuilderFromGeometricDet.h"
0031 #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyMap.h"
0032 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0033 
0034 /*** Thresholds from DB ***/
0035 #include "CondFormats/DataRecord/interface/AlignPCLThresholdsHGRcd.h"
0036 
0037 /*** DQM ***/
0038 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0039 #include "DQMServices/Core/interface/DQMStore.h"
0040 
0041 /*** Records for ESWatcher ***/
0042 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0043 #include "Geometry/Records/interface/PTrackerParametersRcd.h"
0044 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0045 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0046 
0047 /*** MillePede ***/
0048 #include "Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h"
0049 
0050 class MillePedeDQMModule : public DQMEDHarvester {
0051   //========================== PUBLIC METHODS ==================================
0052 public:  //====================================================================
0053   MillePedeDQMModule(const edm::ParameterSet&);
0054   ~MillePedeDQMModule() override;
0055 
0056   void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;
0057 
0058   enum { SIZE_LG_STRUCTS = 6, SIZE_HG_STRUCTS = 820, SIZE_INDEX = 8 };
0059 
0060   //========================= PRIVATE METHODS ==================================
0061 private:  //===================================================================
0062   void beginRun(const edm::Run&, const edm::EventSetup&) override;
0063 
0064   void bookHistograms(DQMStore::IBooker&);
0065 
0066   void fillStatusHisto(MonitorElement* statusHisto);
0067 
0068   void fillStatusHistoHG(MonitorElement* statusHisto);
0069 
0070   void fillExpertHistos();
0071 
0072   void fillExpertHistos_HG();
0073 
0074   void fillExpertHisto(MonitorElement* histo,
0075                        const std::array<double, SIZE_INDEX>& cut,
0076                        const std::array<double, SIZE_INDEX>& sigCut,
0077                        const std::array<double, SIZE_INDEX>& maxMoveCut,
0078                        const std::array<double, SIZE_INDEX>& maxErrorCut,
0079                        const std::array<double, SIZE_LG_STRUCTS>& obs,
0080                        const std::array<double, SIZE_LG_STRUCTS>& obsErr);
0081 
0082   void fillExpertHisto_HG(std::map<std::string, MonitorElement*>& histo_map,
0083                           const std::array<double, SIZE_INDEX>& cut,
0084                           const std::array<double, SIZE_INDEX>& sigCut,
0085                           const std::array<double, SIZE_INDEX>& maxMoveCut,
0086                           const std::array<double, SIZE_INDEX>& maxErrorCut,
0087                           const std::array<double, SIZE_HG_STRUCTS>& obs,
0088                           const std::array<double, SIZE_HG_STRUCTS>& obsErr);
0089 
0090   bool setupChanged(const edm::EventSetup&);
0091   int getIndexFromString(const std::string& alignableId);
0092 
0093   //========================== PRIVATE DATA ====================================
0094   //============================================================================
0095 
0096   // esConsumes
0097   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0098   const edm::ESGetToken<GeometricDet, IdealGeometryRecord> gDetToken_;
0099   const edm::ESGetToken<PTrackerParameters, PTrackerParametersRcd> ptpToken_;
0100   const edm::ESGetToken<AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd> aliThrToken_;
0101   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0102 
0103   const edm::ParameterSet mpReaderConfig_;
0104   std::unique_ptr<AlignableTracker> tracker_;
0105   std::unique_ptr<MillePedeFileReader> mpReader_;
0106   std::shared_ptr<PixelTopologyMap> pixelTopologyMap_;
0107 
0108   std::vector<std::pair<std::string, int>> layerVec;
0109 
0110   edm::ESWatcher<TrackerTopologyRcd> watchTrackerTopologyRcd_;
0111   edm::ESWatcher<IdealGeometryRecord> watchIdealGeometryRcd_;
0112   edm::ESWatcher<PTrackerParametersRcd> watchPTrackerParametersRcd_;
0113 
0114   // Histograms
0115   MonitorElement* h_xPos;
0116   MonitorElement* h_xRot;
0117   MonitorElement* h_yPos;
0118   MonitorElement* h_yRot;
0119   MonitorElement* h_zPos;
0120   MonitorElement* h_zRot;
0121 
0122   std::map<std::string, MonitorElement*> h_xPos_HG;
0123   std::map<std::string, MonitorElement*> h_xRot_HG;
0124   std::map<std::string, MonitorElement*> h_yPos_HG;
0125   std::map<std::string, MonitorElement*> h_yRot_HG;
0126   std::map<std::string, MonitorElement*> h_zPos_HG;
0127   std::map<std::string, MonitorElement*> h_zRot_HG;
0128 
0129   MonitorElement* statusResults;
0130   MonitorElement* binariesAvalaible;
0131   MonitorElement* exitCode;
0132   MonitorElement* isVetoed;
0133 
0134   bool isHG_;
0135 };
0136 
0137 // define this as a plug-in
0138 DEFINE_FWK_MODULE(MillePedeDQMModule);
0139 
0140 #endif /* Alignment_MillePedeAlignmentAlgorithm_MillePedeDQMModule_h */