Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-22 04:02:31

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