CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DQM/SiStripCommon/interface/TkHistoMap.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripCommon_TKHistoMap_h
00002 #define DQM_SiStripCommon_TKHistoMap_h
00003 
00004 #include "DQMServices/Core/interface/DQMStore.h"
00005 #include "DQMServices/Core/interface/MonitorElement.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "FWCore/ServiceRegistry/interface/Service.h"
00008 
00009 #include "CalibTracker/SiStripCommon/interface/TkDetMap.h"
00010 #include "CommonTools/TrackerMap/interface/TrackerMap.h"
00011 #include <string>
00012 
00013 class TkHistoMap{
00014 
00015   typedef std::vector<MonitorElement*> tkHistoMapVect;
00016 
00017  public:
00018   TkHistoMap(std::string path, std::string MapName, float baseline=0, bool mechanicalView=false);
00019   TkHistoMap();
00020   ~TkHistoMap(){};
00021 
00022   void loadServices();
00023 
00024   void loadTkHistoMap(std::string path, std::string MapName, bool mechanicalView=false);
00025 
00026   MonitorElement* getMap(short layerNumber){return tkHistoMap_[layerNumber];};
00027   std::vector<MonitorElement*>& getAllMaps(){return tkHistoMap_;};
00028 
00029   float getValue(uint32_t& detid);
00030   float getEntries(uint32_t& detid);
00031   uint32_t getDetId(std::string title, int ix, int iy){return getDetId(getLayerNum(getLayerName(title)),ix,iy);}
00032   uint32_t getDetId(int layer, int ix, int iy){return tkdetmap_->getDetFromBin(layer,ix,iy);}
00033   uint32_t getDetId(MonitorElement*ME, int ix, int iy){return getDetId(ME->getTitle(),ix,iy);}
00034   std::string getLayerName(std::string title){return title.erase(0,MapName_.size()+1);}
00035   uint16_t getLayerNum(std::string layerName){return tkdetmap_->getLayerNum(layerName);}
00036 
00037   void fillFromAscii(std::string filename);
00038   void fill(uint32_t& detid,float value);
00039   void setBinContent(uint32_t& detid,float value);
00040   void add(uint32_t& detid,float value);
00041 
00042   void dumpInTkMap(TrackerMap* tkmap, bool dumpEntries=false); //dumpEntries==true? (dump entries) : (dump mean values)
00043   void save(std::string filename);
00044   void saveAsCanvas(std::string filename,std::string options="", std::string mode="RECREATE");
00045 
00046  private:
00047 
00048   void createTkHistoMap(std::string& path, std::string& MapName, float& baseline, bool mechanicalView);
00049   std::string folderDefinition(std::string& path, std::string& MapName, int layer , bool mechanicalView, std::string& fullName);
00050 
00051   DQMStore* dqmStore_;
00052   TkDetMap* tkdetmap_;
00053   std::vector<MonitorElement*> tkHistoMap_;
00054   int HistoNumber;
00055   std::string MapName_;
00056 };
00057 
00058 #endif