CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DQM/SiStripMonitorDigi/interface/SiStripMonitorDigi.h

Go to the documentation of this file.
00001 #ifndef SiStripMonitorDigi_SiStripMonitorDigi_h
00002 #define SiStripMonitorDigi_SiStripMonitorDigi_h
00003 // -*- C++ -*-
00004 // Package:     SiStripMonitorDigi
00005 // Class  :     SiStripMonitorDigi
00009 // Original Author:  dkcira
00010 //         Created:  Sat Feb  4 20:49:51 CET 2006
00011 // $Id: SiStripMonitorDigi.h,v 1.27 2011/03/03 08:21:15 borrell Exp $
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 
00022 class DQMStore;
00023 class SiStripDCSStatus;
00024 class SiStripDetCabling;
00025 
00026 class SiStripMonitorDigi : public edm::EDAnalyzer {
00027  public:
00028   explicit SiStripMonitorDigi(const edm::ParameterSet&);
00029   ~SiStripMonitorDigi();
00030   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00031   virtual void beginJob();
00032   virtual void endJob() ;
00033   virtual void beginRun(const edm::Run&, const edm::EventSetup&);
00034   virtual void endRun(const edm::Run&, const edm::EventSetup&);
00035   virtual void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&);
00036   virtual void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&);
00037 
00038   struct ModMEs{
00039         
00040     MonitorElement* NumberOfDigis;
00041     MonitorElement* NumberOfDigisPerStrip;
00042     MonitorElement* ADCsHottestStrip;
00043     MonitorElement* ADCsCoolestStrip;
00044     MonitorElement* DigiADCs;
00045     MonitorElement* StripOccupancy;
00046   };
00047       
00048   struct LayerMEs{
00049         
00050     MonitorElement* LayerNumberOfDigis;
00051     MonitorElement* LayerNumberOfDigisTrend;
00052     MonitorElement* LayerADCsHottestStrip;
00053     MonitorElement* LayerADCsHottestStripTrend;
00054     MonitorElement* LayerADCsCoolestStrip;
00055     MonitorElement* LayerADCsCoolestStripTrend;
00056     MonitorElement* LayerDigiADCs;
00057     MonitorElement* LayerDigiADCsTrend;
00058     MonitorElement* LayerStripOccupancy;
00059     MonitorElement* LayerStripOccupancyTrend;
00060     MonitorElement* LayerNumberOfDigisProfile;
00061     MonitorElement* LayerDigiADCProfile;
00062         
00063   };
00064 
00065   struct SubDetMEs{
00066     int totNDigis;
00067     MonitorElement* SubDetTotDigiProf;
00068     MonitorElement* SubDetDigiApvProf;
00069     MonitorElement* SubDetDigiApvTH2;
00070   };
00071 
00072   struct DigiFailureMEs{
00073     MonitorElement* SubDetTotDigiProfLS;
00074     MonitorElement* SubDetDigiFailures;
00075   };
00076 
00077  private:
00078   void createMEs(const edm::EventSetup& es);
00079   void ResetModuleMEs(uint32_t idet);
00080   void bookLayer(); 
00081   MonitorElement* bookMETrend(const char* ParameterSetLabel, const char* HistoName);
00082   MonitorElement* bookME1D(const char* ParameterSetLabel, const char* HistoName);
00083   void bookTrendMEs(TString name,int32_t layer,uint32_t id,std::string flag);
00084   void fillDigiADCsMEs(int value, std::string name);
00085   void fillTrend(MonitorElement* me ,float value, float timeinorbit);
00086   inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00087   inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00088   inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00089   inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00090   bool AllDigis( const edm::EventSetup& es);
00091 
00092   void createModuleMEs(ModMEs& mod_single, uint32_t detid);
00093   void createLayerMEs(std::string label, int ndet);
00094   void createSubDetMEs(std::string label);
00095   void createSubDetTH2(std::string label);
00096   int getDigiSourceIndex(uint32_t id);
00097       
00098  private:
00099   DQMStore* dqmStore_;
00100   edm::ParameterSet conf_;
00101   std::vector<edm::InputTag> digiProducerList;
00102   std::map<uint32_t, ModMEs> DigiMEs; // uint32_t me_type: 1=#digis/module; 2=adcs of hottest strip/module; 3= adcs of coolest strips/module.
00103   bool show_mechanical_structure_view, show_readout_view, show_control_view, select_all_detectors, calculate_strip_occupancy, reset_each_run;
00104 
00105   std::map<std::string, std::vector< uint32_t > > LayerDetMap;
00106   std::map<std::string, LayerMEs> LayerMEsMap;
00107   std::map<std::string, SubDetMEs> SubDetMEsMap;
00108   std::map<std::string, std::string> SubDetPhasePartMap;
00109   DigiFailureMEs digiFailureMEs;
00110       
00111   TString name;
00112   SiStripFolderOrganizer folder_organizer;
00113   std::map<std::pair<std::string,int32_t>,bool> DetectedLayers;
00114   std::vector<const edm::DetSetVector<SiStripDigi> *> digi_detset_handles;
00115 
00116   unsigned long long m_cacheID_;
00117   edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00118   std::vector<uint32_t> ModulesToBeExcluded_;
00119 
00120   TkHistoMap* tkmapdigi;  
00121 
00122   int runNb, eventNb;
00123   int firstEvent;
00124 
00125   bool layerswitchnumdigison;
00126   bool layerswitchnumdigisapvon;
00127   bool layerswitchadchotteston;
00128   bool layerswitchadccooleston;
00129   bool layerswitchdigiadcson;
00130   bool layerswitchstripoccupancyon;
00131   bool layerswitchnumdigisprofon;
00132   bool layerswitchdigiadcprofon;
00133 
00134   bool moduleswitchnumdigison;
00135   bool moduleswitchnumdigispstripon;
00136   bool moduleswitchadchotteston;
00137   bool moduleswitchadccooleston;
00138   bool moduleswitchdigiadcson;
00139   bool moduleswitchstripoccupancyon;
00140 
00141   bool subdetswitchtotdigiprofon;
00142   bool subdetswitchapvcycleprofon;
00143   bool subdetswitchapvcycleth2on;
00144 
00145   bool subdetswitchtotdigiproflson;
00146   bool subdetswitchtotdigifailureon;
00147 
00148   int xLumiProf;
00149 
00150   bool Mod_On_;
00151 
00152   bool digitkhistomapon;
00153   bool createTrendMEs;
00154 
00155   std::string topDir;
00156   edm::InputTag historyProducer_;  
00157   edm::InputTag apvPhaseProducer_;
00158 
00159   SiStripDCSStatus* dcsStatus_;
00160 };
00161 #endif
00162