CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/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.29 2011/10/27 19:49:19 fiori 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 #include "DPGAnalysis/SiStripTools/interface/APVShotFinder.h"
00022 #include "DPGAnalysis/SiStripTools/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 
00041   struct ModMEs{
00042         
00043     MonitorElement* NumberOfDigis;
00044     MonitorElement* NumberOfDigisPerStrip;
00045     MonitorElement* ADCsHottestStrip;
00046     MonitorElement* ADCsCoolestStrip;
00047     MonitorElement* DigiADCs;
00048     MonitorElement* StripOccupancy;
00049   };
00050       
00051   struct LayerMEs{
00052         
00053     MonitorElement* LayerNumberOfDigis;
00054     MonitorElement* LayerNumberOfDigisTrend;
00055     MonitorElement* LayerADCsHottestStrip;
00056     MonitorElement* LayerADCsHottestStripTrend;
00057     MonitorElement* LayerADCsCoolestStrip;
00058     MonitorElement* LayerADCsCoolestStripTrend;
00059     MonitorElement* LayerDigiADCs;
00060     MonitorElement* LayerDigiADCsTrend;
00061     MonitorElement* LayerStripOccupancy;
00062     MonitorElement* LayerStripOccupancyTrend;
00063     MonitorElement* LayerNumberOfDigisProfile;
00064     MonitorElement* LayerDigiADCProfile;
00065         
00066   };
00067 
00068   struct SubDetMEs{
00069 
00070     int totNDigis;
00071     MonitorElement* SubDetTotDigiProf;
00072     MonitorElement* SubDetDigiApvProf;
00073     MonitorElement* SubDetDigiApvTH2;
00074 
00075     //int totApvShots;
00076     std::vector<APVShot> SubDetApvShots;
00077     MonitorElement* SubDetNApvShotsTH1;
00078     MonitorElement* SubDetChargeMedianApvShotsTH1;
00079     MonitorElement* SubDetNStripsApvShotsTH1;
00080     MonitorElement* SubDetNApvShotsProf; 
00081     MonitorElement* SubDetNApvShotsNApvTH1;
00082   };
00083 
00084   struct DigiFailureMEs{
00085     MonitorElement* SubDetTotDigiProfLS;
00086     MonitorElement* SubDetDigiFailures;
00087   };
00088 
00089  private:
00090   void createMEs(const edm::EventSetup& es);
00091   void ResetModuleMEs(uint32_t idet);
00092   void bookLayer(); 
00093   MonitorElement* bookMETrend(const char* ParameterSetLabel, const char* HistoName);
00094   MonitorElement* bookME1D(const char* ParameterSetLabel, const char* HistoName);
00095   void bookTrendMEs(TString name,int32_t layer,uint32_t id,std::string flag);
00096   void fillDigiADCsMEs(int value, std::string name);
00097   void fillTrend(MonitorElement* me ,float value, float timeinorbit);
00098   inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00099   inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00100   inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00101   inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00102   bool AllDigis( const edm::EventSetup& es);
00103 
00104   void createModuleMEs(ModMEs& mod_single, uint32_t detid);
00105   void createLayerMEs(std::string label, int ndet);
00106   void createSubDetMEs(std::string label);
00107   void createSubDetTH2(std::string label);
00108   int getDigiSourceIndex(uint32_t id);
00109   void AddApvShotsToSubDet(const std::vector<APVShot> &, std::vector<APVShot> &);
00110   void FillApvShotsMap(TkHistoMap*, const std::vector<APVShot> &, uint32_t id ,int);
00111    
00112  private:
00113   
00114 
00115   DQMStore* dqmStore_;
00116   edm::ParameterSet conf_;
00117   std::vector<edm::InputTag> digiProducerList;
00118   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.
00119   bool show_mechanical_structure_view, show_readout_view, show_control_view, select_all_detectors, calculate_strip_occupancy, reset_each_run;
00120 
00121   std::map<std::string, std::vector< uint32_t > > LayerDetMap;
00122   std::map<std::string, LayerMEs> LayerMEsMap;
00123   std::map<std::string, SubDetMEs> SubDetMEsMap;
00124   std::map<std::string, std::string> SubDetPhasePartMap;
00125   DigiFailureMEs digiFailureMEs;
00126       
00127   TString name;
00128   SiStripFolderOrganizer folder_organizer;
00129   std::map<std::pair<std::string,int32_t>,bool> DetectedLayers;
00130   std::vector<const edm::DetSetVector<SiStripDigi> *> digi_detset_handles;
00131 
00132   unsigned long long m_cacheID_;
00133   edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00134   std::vector<uint32_t> ModulesToBeExcluded_;
00135 
00136   //Global MEs to monitor APV Shots properties
00137   MonitorElement *NApvShotsGlobal, *NApvShotsGlobalProf, *MedianChargeApvShotsGlobal, *NApvApvShotsGlobal, *StripMultiplicityApvShotsGlobal, *ShotsVsTimeApvShotsGlobal;
00138 
00139   TkHistoMap* tkmapdigi, *tkmapNApvshots, *tkmapNstripApvshot, *tkmapMedianChargeApvshots;  
00140 
00141   int runNb, eventNb;
00142   int firstEvent;
00143   int TotalNShots;
00144 
00145   bool globalsummaryapvshotson;
00146   
00147   bool layerswitchnumdigison;
00148   bool layerswitchnumdigisapvon;
00149   bool layerswitchadchotteston;
00150   bool layerswitchadccooleston;
00151   bool layerswitchdigiadcson;
00152   bool layerswitchstripoccupancyon;
00153   bool layerswitchnumdigisprofon;
00154   bool layerswitchdigiadcprofon;
00155 
00156   bool moduleswitchnumdigison;
00157   bool moduleswitchnumdigispstripon;
00158   bool moduleswitchadchotteston;
00159   bool moduleswitchadccooleston;
00160   bool moduleswitchdigiadcson;
00161   bool moduleswitchstripoccupancyon;
00162 
00163   bool subdetswitchtotdigiprofon;
00164   bool subdetswitchapvcycleprofon;
00165   bool subdetswitchapvcycleth2on;
00166 
00167   bool subdetswitchtotdigiproflson;
00168   bool subdetswitchtotdigifailureon;
00169 
00170   bool subdetswitchnapvshotson;
00171   bool subdetswitchnstripsapvshotson;
00172   bool subdetswitchapvshotsonprof;
00173   bool subdetswitchchargemedianapvshotson;
00174   bool subdetswitchapvshotsApvon;
00175 
00176   bool globalswitchnapvshotson;
00177   bool globalswitchnstripsapvshotson;
00178   bool globalswitchapvshotsonprof;
00179   bool globalswitchchargemedianapvshotson;
00180   bool globalswitchapvshotsApvon;
00181 
00182 
00183   int xLumiProf;
00184 
00185   bool Mod_On_;
00186 
00187   bool digitkhistomapon;
00188   bool shotshistomapon;
00189   bool shotsstripshistomapon;
00190   bool shotschargehistomapon;
00191   
00192   bool createTrendMEs;
00193 
00194   std::string topDir;
00195   edm::InputTag historyProducer_;  
00196   edm::InputTag apvPhaseProducer_;
00197 
00198   SiStripDCSStatus* dcsStatus_;
00199 };
00200 #endif
00201