CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DQM/RPCMonitorClient/interface/clientTools.h

Go to the documentation of this file.
00001 #ifndef rpcdqmclient_clientTools_H
00002 #define rpcdqmclient_clientTools_H
00003 
00004 #include "DQM/RPCMonitorDigi/interface/RPCBookFolderStructure.h"
00005 
00006 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00007 
00008 #include "DQMServices/Core/interface/DQMStore.h"
00009 #include "DQMServices/Core/interface/MonitorElement.h"
00010 
00011 #include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
00012 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
00013 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00014 
00015 #include <vector>
00016 #include <iomanip>
00017 
00018 
00019 namespace rpcdqmclient{
00020   class clientTools{
00021   public:
00022 
00023   std::vector<MonitorElement*> constructMEVector(const edm::EventSetup& iSetup, const std::string & prefixDir, const std::string & MEName, DQMStore* dbe ){
00024     cout<<"Starting ConstructMEVector"<<endl;
00025     this->getMEs(iSetup, prefixDir,  MEName, dbe);
00026 
00027     return      myMeVect_;
00028   }
00029 
00030   std::vector<RPCDetId>  getAssociatedRPCdetId(){
00031     std::vector<RPCDetId> myVector; 
00032     myVector.clear();
00033 
00034     if (myMeVect_.size() !=0 && myMeVect_.size()==myDetIds_.size() ) myVector= myDetIds_;
00035 
00036     return myVector;
00037   }
00038 
00039 
00040   protected:
00041  
00042   void getMEs(const edm::EventSetup& iSetup, const std::string & prefixDir, const std::string & MEName ,  DQMStore* dbe){
00043 
00044 
00045  
00046     edm::ESHandle<RPCGeometry> rpcGeo;
00047     iSetup.get<MuonGeometryRecord>().get(rpcGeo);
00048  
00049     //loop on all geometry and get all histos
00050     for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
00051       if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
00052  
00053         RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 
00054         std::vector< const RPCRoll*> roles = (ch->rolls());
00055         //Loop on rolls in given chamber
00056         for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
00057           RPCDetId detId = (*r)->id();
00058         
00059           //Get Occupancy ME for roll
00060           RPCGeomServ RPCname(detId);      
00061           RPCBookFolderStructure *  folderStr = new RPCBookFolderStructure();
00062           MonitorElement * myMe = dbe->get(prefixDir+"/"+ folderStr->folderStructure(detId)+"/"+MEName+ "_"+RPCname.name()); 
00063           if (!myMe)continue;
00064 
00065           myMeVect_.push_back(myMe);
00066           myDetIds_.push_back(detId);
00067           myRollNames_.push_back(RPCname.name());
00068 
00069         }
00070       }
00071     }//end loop on all geometry and get all histos  
00072   }
00073   
00074  
00075   
00076   private:
00077   std::vector<MonitorElement *>  myMeVect_;
00078   std::vector<RPCDetId>   myDetIds_;
00079   std::vector<std::string>    myRollNames_;
00080 
00081 
00082   };
00083 }
00084 
00085 #endif