Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:36

0001 #ifndef CALIBTRACKER_SISTRIPCHANNELGAIN_APVGAINHELPERS_H
0002 #define CALIBTRACKER_SISTRIPCHANNELGAIN_APVGAINHELPERS_H
0003 
0004 #include "CalibTracker/SiStripChannelGain/interface/APVGainStruct.h"
0005 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "DQMServices/Core/interface/DQMStore.h"
0008 
0009 #include <string>
0010 #include <vector>
0011 #include <utility>
0012 #include <cstdint>
0013 #include <unordered_map>
0014 
0015 namespace APVGain {
0016 
0017   typedef dqm::legacy::MonitorElement MonitorElement;
0018 
0019   int subdetectorId(uint32_t);
0020   int subdetectorId(const std::string&);
0021   int subdetectorSide(uint32_t, const TrackerTopology*);
0022   int thickness(uint32_t);
0023   int thickness(const std::string& tag);
0024   int subdetectorSide(const std::string&);
0025   int subdetectorPlane(uint32_t, const TrackerTopology*);
0026   int subdetectorPlane(const std::string&);
0027 
0028   std::vector<std::pair<std::string, std::string>> monHnames(std::vector<std::string>, bool, const char* tag);
0029 
0030   struct APVmon {
0031   public:
0032     APVmon(int v0, int v1, int v2, int v3, MonitorElement* v4)
0033         : m_thickness(v0), m_subdetectorId(v1), m_subdetectorSide(v2), m_subdetectorPlane(v3), m_monitor(v4) {}
0034 
0035     int getSubdetectorId() { return m_subdetectorId; }
0036 
0037     int getSubdetectorSide() { return m_subdetectorSide; }
0038 
0039     int getSubdetectorPlane() { return m_subdetectorPlane; }
0040 
0041     int getThickness() { return m_thickness; }
0042 
0043     MonitorElement* getMonitor() { return m_monitor; }
0044 
0045     void printAll() {
0046       LogDebug("APVGainHelpers") << "subDetectorID:" << m_subdetectorId << std::endl;
0047       LogDebug("APVGainHelpers") << "subDetectorSide:" << m_subdetectorSide << std::endl;
0048       LogDebug("APVGainHelpers") << "subDetectorPlane:" << m_subdetectorPlane << std::endl;
0049       LogDebug("APVGainHelpers") << "thickness:" << m_thickness << std::endl;
0050       LogDebug("APVGainHelpers") << "histoName:" << m_monitor->getName() << std::endl;
0051       return;
0052     }
0053 
0054   private:
0055     int m_thickness;
0056     int m_subdetectorId;
0057     int m_subdetectorSide;
0058     int m_subdetectorPlane;
0059     MonitorElement* m_monitor;
0060   };
0061 
0062   struct APVGainHistograms {
0063   public:
0064     APVGainHistograms()
0065         : EventStats(),
0066           Charge_Vs_Index(7),
0067           Charge_1(),
0068           Charge_2(),
0069           Charge_3(),
0070           Charge_4(),
0071           Charge_Vs_PathlengthTIB(7),
0072           Charge_Vs_PathlengthTOB(7),
0073           Charge_Vs_PathlengthTIDP(7),
0074           Charge_Vs_PathlengthTIDM(7),
0075           Charge_Vs_PathlengthTECP1(7),
0076           Charge_Vs_PathlengthTECP2(7),
0077           Charge_Vs_PathlengthTECM1(7),
0078           Charge_Vs_PathlengthTECM2(7),
0079           NStripAPVs(0),
0080           NPixelDets(0),
0081           APVsCollOrdered(),
0082           APVsColl() {}
0083 
0084     dqm::reco::MonitorElement* EventStats;
0085     std::vector<dqm::reco::MonitorElement*> Charge_Vs_Index;         /*!< Charge per cm for each detector id */
0086     std::array<std::vector<dqm::reco::MonitorElement*>, 7> Charge_1; /*!< Charge per cm per layer / wheel */
0087     std::array<std::vector<dqm::reco::MonitorElement*>, 7> Charge_2; /*!< Charge per cm per layer / wheel without G2 */
0088     std::array<std::vector<dqm::reco::MonitorElement*>, 7> Charge_3; /*!< Charge per cm per layer / wheel without G1 */
0089     std::array<std::vector<dqm::reco::MonitorElement*>, 7>
0090         Charge_4; /*!< Charge per cm per layer / wheel without G1 and G1*/
0091 
0092     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTIB;   /*!< Charge vs pathlength in TIB */
0093     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTOB;   /*!< Charge vs pathlength in TOB */
0094     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTIDP;  /*!< Charge vs pathlength in TIDP */
0095     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTIDM;  /*!< Charge vs pathlength in TIDM */
0096     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTECP1; /*!< Charge vs pathlength in TECP thin */
0097     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTECP2; /*!< Charge vs pathlength in TECP thick */
0098     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTECM1; /*!< Charge vs pathlength in TECP thin */
0099     std::vector<dqm::reco::MonitorElement*> Charge_Vs_PathlengthTECM2; /*!< Charge vs pathlength in TECP thick */
0100     mutable std::atomic<unsigned int> NStripAPVs;
0101     mutable std::atomic<unsigned int> NPixelDets;
0102     std::vector<std::shared_ptr<stAPVGain>> APVsCollOrdered;
0103     std::unordered_map<unsigned int, std::shared_ptr<stAPVGain>> APVsColl;
0104   };
0105 
0106   std::vector<MonitorElement*> FetchMonitor(std::vector<APVmon>, uint32_t, const TrackerTopology* topo = nullptr);
0107   std::vector<unsigned int> FetchIndices(std::map<unsigned int, APVloc>,
0108                                          uint32_t,
0109                                          const TrackerTopology* topo = nullptr);
0110 
0111 };  // namespace APVGain
0112 
0113 #endif