CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DQM/SiStripMonitorCluster/interface/SiStripMonitorCluster.h

Go to the documentation of this file.
00001 #ifndef SiStripMonitorCluster_SiStripMonitorCluster_h
00002 #define SiStripMonitorCluster_SiStripMonitorCluster_h
00003 // -*- C++ -*-
00004 // Package:     SiStripMonitorCluster
00005 // Class  :     SiStripMonitorCluster
00009 // Original Author:  dkcira
00010 //         Created:  Wed Feb  1 16:47:14 CET 2006
00011 // $Id: SiStripMonitorCluster.h,v 1.42 2012/07/19 15:46:18 tosi Exp $
00012 #include <memory>
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/EDAnalyzer.h"
00015 #include "FWCore/Framework/interface/Event.h"
00016 #include "FWCore/Framework/interface/MakerMacros.h"
00017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00018 #include "FWCore/Framework/interface/ESHandle.h"
00019 #include "DataFormats/Common/interface/DetSetVector.h"
00020 #include "DQMServices/Core/interface/MonitorElement.h"
00021 #include "DQM/SiStripCommon/interface/TkHistoMap.h"
00022 
00023 #include <vector>
00024 
00025 class DQMStore;
00026 class SiStripDetCabling;
00027 class SiStripCluster;
00028 class SiStripDCSStatus;
00029 class GenericTriggerEventFlag;
00030 
00031 class SiStripMonitorCluster : public edm::EDAnalyzer {
00032  public:
00033   explicit SiStripMonitorCluster(const edm::ParameterSet&);
00034   ~SiStripMonitorCluster();
00035   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00036   //virtual void beginJob() ;
00037   virtual void endJob() ;
00038   virtual void beginRun(const edm::Run&, const edm::EventSetup&);
00039 
00040   struct ModMEs{ // MEs for one single detector module
00041 
00042     MonitorElement* NumberOfClusters;
00043     MonitorElement* ClusterPosition;
00044     MonitorElement* ClusterDigiPosition;
00045     MonitorElement* ClusterWidth;
00046     MonitorElement* ClusterCharge;
00047     MonitorElement* ClusterNoise;
00048     MonitorElement* ClusterSignalOverNoise;
00049     MonitorElement* ClusterSignalOverNoiseVsPos;
00050     MonitorElement* ModuleLocalOccupancy;
00051     MonitorElement* NrOfClusterizedStrips; // can be used at client level for occupancy calculations
00052   };
00053 
00054   struct LayerMEs{ // MEs for Layer Level
00055     MonitorElement* LayerClusterStoN;
00056     MonitorElement* LayerClusterStoNTrend;
00057     MonitorElement* LayerClusterCharge;
00058     MonitorElement* LayerClusterChargeTrend;
00059     MonitorElement* LayerClusterNoise;
00060     MonitorElement* LayerClusterNoiseTrend;
00061     MonitorElement* LayerClusterWidth;
00062     MonitorElement* LayerClusterWidthTrend;
00063     MonitorElement* LayerLocalOccupancy;
00064     MonitorElement* LayerLocalOccupancyTrend;
00065     MonitorElement* LayerNumberOfClusterProfile;
00066     MonitorElement* LayerClusterWidthProfile;
00067 
00068   };
00069 
00070   struct SubDetMEs{ // MEs for Subdetector Level
00071     int totNClusters; 
00072     MonitorElement* SubDetTotClusterTH1;
00073     MonitorElement* SubDetTotClusterProf;
00074     MonitorElement* SubDetClusterApvProf;
00075     MonitorElement* SubDetClusterApvTH2;
00076     MonitorElement* SubDetClusterDBxCycleProf;
00077     MonitorElement* SubDetApvDBxProf2;
00078   };
00079 
00080   struct ClusterProperties { // Cluster Properties
00081     float charge;
00082     float position;
00083     short start;
00084     short width;
00085     float noise;
00086   };
00087 
00088   MonitorElement* GlobalApvCycleDBxTH2; 
00089   MonitorElement* GlobalCStripVsCpix;
00090   MonitorElement* PixVsStripMultiplicityRegions;
00091   MonitorElement* GlobalMainDiagonalPosition;
00092   MonitorElement* StripNoise2Cycle;
00093   MonitorElement* StripNoise3Cycle;
00094   MonitorElement* NumberOfPixelClus;
00095   MonitorElement* NumberOfStripClus;
00096 
00097   MonitorElement* BPTXrateTrend;
00098 
00099  private:
00100 
00101   void createMEs(const edm::EventSetup& es);
00102   void createLayerMEs(std::string label, int ndets);
00103   void createModuleMEs(ModMEs& mod_single, uint32_t detid);
00104   void createSubDetMEs(std::string label);
00105   int FindRegion(int nstrip,int npixel);
00106   void fillModuleMEs(ModMEs& mod_mes, ClusterProperties& cluster);
00107   void fillLayerMEs(LayerMEs&, ClusterProperties& cluster, float timeinorbit);
00108 
00109   void ResetModuleMEs(uint32_t idet);
00110 
00111   inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00112   inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00113   inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00114   inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00115   MonitorElement * bookMETrend(const char*, const char*);
00116   MonitorElement* bookME1D(const char* ParameterSetLabel, const char* HistoName);
00117 
00118  private:
00119   DQMStore* dqmStore_;
00120   edm::ParameterSet conf_;
00121   std::map<uint32_t, ModMEs> ModuleMEsMap;
00122   std::map<std::string, LayerMEs> LayerMEsMap;
00123   std::map<std::string, std::vector< uint32_t > > LayerDetMap;
00124   std::map<std::string, SubDetMEs> SubDetMEsMap;
00125   std::map<std::string, std::string> SubDetPhasePartMap;
00126 
00127   // flags
00128   bool show_mechanical_structure_view, show_readout_view, show_control_view, select_all_detectors, reset_each_run;
00129   unsigned long long m_cacheID_;
00130 
00131   edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00132   std::vector<uint32_t> ModulesToBeExcluded_;
00133 
00134   edm::ParameterSet Parameters;
00135 
00136   // TkHistoMap added
00137   TkHistoMap* tkmapcluster; 
00138 
00139   int runNb, eventNb;
00140   int firstEvent;
00141 
00142   bool layerswitchncluson;
00143   bool layerswitchcluschargeon;
00144   bool layerswitchclusstonon;
00145   bool layerswitchclusstonVsposon;
00146   bool layerswitchclusposon;
00147   bool layerswitchclusdigiposon;
00148   bool layerswitchclusnoiseon;
00149   bool layerswitchcluswidthon;
00150   bool layerswitchlocaloccupancy;
00151   bool layerswitchnrclusterizedstrip;
00152   bool layerswitchnumclusterprofon;
00153   bool layerswitchclusterwidthprofon;
00154   
00155   bool globalswitchstripnoise2apvcycle;
00156   bool globalswitchstripnoise3apvcycle;
00157   bool globalswitchmaindiagonalposition;
00158 
00159   bool moduleswitchncluson;
00160   bool moduleswitchcluschargeon;
00161   bool moduleswitchclusstonon;
00162   bool moduleswitchclusstonVsposon;
00163   bool moduleswitchclusposon;
00164   bool moduleswitchclusdigiposon;
00165   bool moduleswitchclusnoiseon;
00166   bool moduleswitchcluswidthon;
00167   bool moduleswitchlocaloccupancy;
00168   bool moduleswitchnrclusterizedstrip;
00169   bool subdetswitchtotclusprofon;
00170   bool subdetswitchapvcycleprofon;
00171   bool subdetswitchapvcycleth2on;
00172   bool subdetswitchapvcycledbxprof2on;
00173   bool subdetswitchdbxcycleprofon;
00174   bool subdetswitchtotclusth1on;
00175   bool globalswitchapvcycledbxth2on;
00176   bool globalswitchcstripvscpix;
00177   bool globalswitchMultiRegions;
00178   bool clustertkhistomapon;
00179   bool createTrendMEs;
00180 
00181   bool Mod_On_;
00182   bool ClusterHisto_;
00183 
00184   std::string topFolderName_;
00185   std::string qualityLabel_;
00186 
00187   edm::InputTag clusterProducerStrip_;
00188   edm::InputTag clusterProducerPix_;
00189   edm::InputTag historyProducer_;  
00190   edm::InputTag apvPhaseProducer_;
00191 
00192   bool   applyClusterQuality_;
00193   double sToNLowerLimit_;  
00194   double sToNUpperLimit_;  
00195   double widthLowerLimit_;
00196   double widthUpperLimit_;
00197 
00198   double k0;
00199   double q0;
00200   double dk0;
00201   double maxClus;
00202   double minPix;
00203 
00204   SiStripDCSStatus* dcsStatus_;
00205 
00206   // add for selecting on ZeroBias events in the MinimumBias PD
00207   GenericTriggerEventFlag* genTriggerEventFlagBPTXfilter_;
00208   GenericTriggerEventFlag* genTriggerEventFlagPixelDCSfilter_;
00209   GenericTriggerEventFlag* genTriggerEventFlagStripDCSfilter_;
00210 
00211   bool passBPTXfilter_;
00212   bool passPixelDCSfilter_;
00213   bool passStripDCSfilter_;
00214 };
00215 #endif