00001 #ifndef SiStripMonitorDigi_SiStripMonitorDigi_h
00002 #define SiStripMonitorDigi_SiStripMonitorDigi_h
00003
00004
00005
00009
00010
00011
00012 #include <memory>
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/LuminosityBlock.h"
00015 #include "FWCore/Framework/interface/EDAnalyzer.h"
00016 #include "FWCore/Framework/interface/Event.h"
00017 #include "FWCore/Framework/interface/MakerMacros.h"
00018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020 #include "DQM/SiStripCommon/interface/TkHistoMap.h"
00021 #include "DQM/SiStripCommon/interface/APVShotFinder.h"
00022 #include "DQM/SiStripCommon/interface/APVShot.h"
00023
00024 class DQMStore;
00025 class SiStripDCSStatus;
00026 class SiStripDetCabling;
00027
00028 class SiStripMonitorDigi : public edm::EDAnalyzer {
00029 public:
00030 explicit SiStripMonitorDigi(const edm::ParameterSet&);
00031 ~SiStripMonitorDigi();
00032 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00033 virtual void beginJob();
00034 virtual void endJob() ;
00035 virtual void beginRun(const edm::Run&, const edm::EventSetup&);
00036 virtual void endRun(const edm::Run&, const edm::EventSetup&);
00037 virtual void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&);
00038 virtual void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&);
00039
00040 struct ModMEs{
00041
00042 MonitorElement* NumberOfDigis;
00043 MonitorElement* NumberOfDigisPerStrip;
00044 MonitorElement* ADCsHottestStrip;
00045 MonitorElement* ADCsCoolestStrip;
00046 MonitorElement* DigiADCs;
00047 MonitorElement* StripOccupancy;
00048 };
00049
00050 struct LayerMEs{
00051
00052 MonitorElement* LayerNumberOfDigis;
00053 MonitorElement* LayerNumberOfDigisTrend;
00054 MonitorElement* LayerADCsHottestStrip;
00055 MonitorElement* LayerADCsHottestStripTrend;
00056 MonitorElement* LayerADCsCoolestStrip;
00057 MonitorElement* LayerADCsCoolestStripTrend;
00058 MonitorElement* LayerDigiADCs;
00059 MonitorElement* LayerDigiADCsTrend;
00060 MonitorElement* LayerStripOccupancy;
00061 MonitorElement* LayerStripOccupancyTrend;
00062 MonitorElement* LayerNumberOfDigisProfile;
00063 MonitorElement* LayerDigiADCProfile;
00064
00065 };
00066
00067 struct SubDetMEs{
00068
00069 int totNDigis;
00070 MonitorElement* SubDetTotDigiProf;
00071 MonitorElement* SubDetDigiApvProf;
00072 MonitorElement* SubDetDigiApvTH2;
00073
00074
00075 std::vector<APVShot> SubDetApvShots;
00076 MonitorElement* SubDetNApvShotsTH1;
00077 MonitorElement* SubDetChargeMedianApvShotsTH1;
00078 MonitorElement* SubDetNStripsApvShotsTH1;
00079 MonitorElement* SubDetNApvShotsProf;
00080 MonitorElement* SubDetNApvShotsNApvTH1;
00081 };
00082
00083 struct DigiFailureMEs{
00084 MonitorElement* SubDetTotDigiProfLS;
00085 MonitorElement* SubDetDigiFailures2D;
00086 };
00087
00088 private:
00089 void createMEs(const edm::EventSetup& es);
00090 void ResetModuleMEs(uint32_t idet);
00091 void bookLayer();
00092 MonitorElement* bookMETrend(const char* ParameterSetLabel, const char* HistoName);
00093 MonitorElement* bookME1D(const char* ParameterSetLabel, const char* HistoName);
00094 void bookTrendMEs(TString name,int32_t layer,uint32_t id,std::string flag);
00095 void fillDigiADCsMEs(int value, std::string name);
00096 void fillTrend(MonitorElement* me ,float value, float timeinorbit);
00097 inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00098 inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00099 inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00100 inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00101 bool AllDigis( const edm::EventSetup& es);
00102
00103 void createModuleMEs(ModMEs& mod_single, uint32_t detid);
00104 void createLayerMEs(std::string label, int ndet);
00105 void createSubDetMEs(std::string label);
00106 void createSubDetTH2(std::string label);
00107 int getDigiSourceIndex(uint32_t id);
00108 void AddApvShotsToSubDet(const std::vector<APVShot> &, std::vector<APVShot> &);
00109 void FillApvShotsMap(TkHistoMap*, const std::vector<APVShot> &, uint32_t id ,int);
00110
00111 private:
00112
00113
00114 DQMStore* dqmStore_;
00115 edm::ParameterSet conf_;
00116 std::vector<edm::InputTag> digiProducerList;
00117 std::map<uint32_t, ModMEs> DigiMEs;
00118 bool show_mechanical_structure_view, show_readout_view, show_control_view, select_all_detectors, calculate_strip_occupancy, reset_each_run;
00119
00120 std::map<std::string, std::vector< uint32_t > > LayerDetMap;
00121 std::map<std::string, LayerMEs> LayerMEsMap;
00122 std::map<std::string, SubDetMEs> SubDetMEsMap;
00123 std::map<std::string, std::string> SubDetPhasePartMap;
00124 DigiFailureMEs digiFailureMEs;
00125
00126 TString name;
00127 SiStripFolderOrganizer folder_organizer;
00128 std::map<std::pair<std::string,int32_t>,bool> DetectedLayers;
00129 std::vector<const edm::DetSetVector<SiStripDigi> *> digi_detset_handles;
00130
00131 unsigned long long m_cacheID_;
00132 edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00133 std::vector<uint32_t> ModulesToBeExcluded_;
00134
00135
00136 MonitorElement *NApvShotsGlobal, *NApvShotsGlobalProf, *MedianChargeApvShotsGlobal, *NApvApvShotsGlobal, *StripMultiplicityApvShotsGlobal, *ShotsVsTimeApvShotsGlobal;
00137
00138 TkHistoMap* tkmapdigi, *tkmapNApvshots, *tkmapNstripApvshot, *tkmapMedianChargeApvshots;
00139
00140 int runNb, eventNb;
00141 int firstEvent;
00142 int TotalNShots;
00143
00144 bool globalsummaryapvshotson;
00145
00146 bool layerswitchnumdigison;
00147 bool layerswitchnumdigisapvon;
00148 bool layerswitchadchotteston;
00149 bool layerswitchadccooleston;
00150 bool layerswitchdigiadcson;
00151 bool layerswitchstripoccupancyon;
00152 bool layerswitchnumdigisprofon;
00153 bool layerswitchdigiadcprofon;
00154
00155 bool moduleswitchnumdigison;
00156 bool moduleswitchnumdigispstripon;
00157 bool moduleswitchadchotteston;
00158 bool moduleswitchadccooleston;
00159 bool moduleswitchdigiadcson;
00160 bool moduleswitchstripoccupancyon;
00161
00162 bool subdetswitchtotdigiprofon;
00163 bool subdetswitchapvcycleprofon;
00164 bool subdetswitchapvcycleth2on;
00165
00166 bool subdetswitchtotdigiproflson;
00167 bool subdetswitchtotdigifailureon;
00168
00169 bool subdetswitchnapvshotson;
00170 bool subdetswitchnstripsapvshotson;
00171 bool subdetswitchapvshotsonprof;
00172 bool subdetswitchchargemedianapvshotson;
00173 bool subdetswitchapvshotsApvon;
00174
00175 bool globalswitchnapvshotson;
00176 bool globalswitchnstripsapvshotson;
00177 bool globalswitchapvshotsonprof;
00178 bool globalswitchchargemedianapvshotson;
00179 bool globalswitchapvshotsApvon;
00180
00181
00182 int xLumiProf;
00183 bool isStableBeams;
00184 int nFEDConnected;
00185
00186 bool Mod_On_;
00187
00188 bool digitkhistomapon;
00189 bool shotshistomapon;
00190 bool shotsstripshistomapon;
00191 bool shotschargehistomapon;
00192
00193 bool createTrendMEs;
00194
00195 std::string topDir;
00196 edm::InputTag historyProducer_;
00197 edm::InputTag apvPhaseProducer_;
00198
00199 SiStripDCSStatus* dcsStatus_;
00200 };
00201 #endif
00202