CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

RPCDqmClient Class Reference

#include <RPCDqmClient.h>

Inheritance diagram for RPCDqmClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 Analyze.
void beginJob ()
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 Begin Lumi block.
void beginRun (const edm::Run &, const edm::EventSetup &)
void endJob ()
 Endjob.
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 End Lumi Block.
void endRun (const edm::Run &, const edm::EventSetup &)
 RPCDqmClient (const edm::ParameterSet &ps)
 Constructor.
virtual ~RPCDqmClient ()
 Destructor.

Protected Member Functions

void getMonitorElements (const edm::Run &, const edm::EventSetup &)
void makeClientMap (void)

Private Attributes

std::vector< std::string > clientHisto_
std::vector< std::string > clientList_
std::vector< RPCClient * > clientModules_
std::vector< std::string > clientNames_
std::vector< int > clientTag_
DQMStoredbe_
bool enableDQMClients_
std::string globalFolder_
bool init_
int lumiCounter_
int minimumEvents_
int numLumBlock_
bool offlineDQM_
edm::ParameterSet parameters_
std::string prefixDir_
int prescaleGlobalFactor_
MonitorElementRPCEvents_
bool useRollInfo_

Detailed Description

Definition at line 14 of file RPCDqmClient.h.


Constructor & Destructor Documentation

RPCDqmClient::RPCDqmClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 21 of file RPCDqmClient.cc.

References clientList_, enableDQMClients_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, makeClientMap(), minimumEvents_, offlineDQM_, parameters_, prefixDir_, prescaleGlobalFactor_, and useRollInfo_.

                                                        {

  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: Constructor";

  parameters_ = iConfig;

  offlineDQM_ = parameters_.getUntrackedParameter<bool> ("OfflineDQM",true); 
  useRollInfo_=  parameters_.getUntrackedParameter<bool>("UseRollInfo", false);
  //check enabling
  enableDQMClients_ =parameters_.getUntrackedParameter<bool> ("EnableRPCDqmClient",true); 
  minimumEvents_= parameters_.getUntrackedParameter<int>("MinimumRPCEvents", 10000);

  std::string subsystemFolder = parameters_.getUntrackedParameter<std::string>("RPCFolder", "RPC");
  std::string recHitTypeFolder= parameters_.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
  std::string summaryFolder = parameters_.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
  
  prefixDir_ =   subsystemFolder+ "/"+ recHitTypeFolder;
  globalFolder_ = subsystemFolder + "/"+ recHitTypeFolder + "/"+ summaryFolder;

  //get prescale factor
  prescaleGlobalFactor_ = parameters_.getUntrackedParameter<int>("DiagnosticGlobalPrescale", 5);

 

  //make default client list  
  clientList_.push_back("RPCMultiplicityTest");
  clientList_.push_back("RPCDeadChannelTest");
  clientList_.push_back("RPCClusterSizeTest");
  clientList_= parameters_.getUntrackedParameter<std::vector<std::string> >("RPCDqmClientList",clientList_);


  //get all the possible RPC DQM clients 
  this->makeClientMap();
}
RPCDqmClient::~RPCDqmClient ( ) [virtual]

Destructor.

Definition at line 56 of file RPCDqmClient.cc.

References dbe_.

{dbe_ = 0;}

Member Function Documentation

void RPCDqmClient::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 174 of file RPCDqmClient.cc.

References clientModules_, and enableDQMClients_.

                                                                             {

 if (!enableDQMClients_) return;

 for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
    (*it)->analyze( iEvent,iSetup);
}
void RPCDqmClient::beginJob ( void  ) [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file RPCDqmClient.cc.

References clientModules_, dbe_, enableDQMClients_, globalFolder_, cppFunctionSkipper::operator, and DQMStore::setVerbose().

                           {

  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: Begin Job";
  if (!enableDQMClients_) return;                 ;

  dbe_ = edm::Service<DQMStore>().operator->();
  dbe_->setVerbose(0);
  

  //Do whatever the begin jobs of all client modules do
  for(std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
    (*it)->beginJob(dbe_, globalFolder_);
  
}
void RPCDqmClient::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [virtual]

Begin Lumi block.

Reimplemented from edm::EDAnalyzer.

Definition at line 167 of file RPCDqmClient.cc.

References clientModules_, and enableDQMClients_.

                                                                                                       {
  if (!enableDQMClients_) return;

  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
    (*it)->beginLuminosityBlock(lumiSeg,context);
}
void RPCDqmClient::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file RPCDqmClient.cc.

References clientModules_, enableDQMClients_, getMonitorElements(), init_, lumiCounter_, offlineDQM_, and prescaleGlobalFactor_.

                                                                   {

  if (!enableDQMClients_) return;

  
  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
    (*it)->beginRun(r,c);
  }

  if(!offlineDQM_) this->getMonitorElements(r, c);
  
  lumiCounter_ = prescaleGlobalFactor_;
  init_ = false;
}
void RPCDqmClient::endJob ( void  ) [virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 221 of file RPCDqmClient.cc.

References clientModules_, and enableDQMClients_.

                          {
  if (!enableDQMClients_) return;
  
  for ( std::vector<RPCClient*>::iterator it= clientModules_.begin(); it!=clientModules_.end(); it++ )
    (*it)->endJob();
}
void RPCDqmClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [virtual]

End Lumi Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 183 of file RPCDqmClient.cc.

References clientModules_, enableDQMClients_, MonitorElement::getBinContent(), init_, lumiCounter_, minimumEvents_, offlineDQM_, prescaleGlobalFactor_, and RPCEvents_.

                                                                                              {
 
  if (!enableDQMClients_ ) return;

  if(offlineDQM_) return;

  edm::LogVerbatim ("rpcdqmclient") <<"[RPCDqmClient]: End of LS ";

  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
    (*it)->endLuminosityBlock( lumiSeg, c);
  
  float   rpcevents = minimumEvents_;
  if(RPCEvents_) rpcevents = RPCEvents_ ->getBinContent(1);
  
  if( rpcevents < minimumEvents_) return;

  if( !init_ ){

    for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
      (*it)->clientOperation(c);
    }
    init_ = true;
    return;
  }

  lumiCounter_++;

  if (lumiCounter_%prescaleGlobalFactor_ != 0) return;


  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
    (*it)->clientOperation(c);
  }

}
void RPCDqmClient::endRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file RPCDqmClient.cc.

References clientModules_, enableDQMClients_, MonitorElement::getBinContent(), getMonitorElements(), minimumEvents_, offlineDQM_, and RPCEvents_.

                                                                 {
  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: End Run";

  if (!enableDQMClients_) return;

  if(offlineDQM_) this->getMonitorElements(r, c);

  float   rpcevents = minimumEvents_;
  if(RPCEvents_) rpcevents = RPCEvents_ ->getBinContent(1);
  
  if(rpcevents < minimumEvents_) return;
  
  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
    (*it)->clientOperation(c);
    (*it)->endRun(r,c);
  }
}
void RPCDqmClient::getMonitorElements ( const edm::Run r,
const edm::EventSetup c 
) [protected]

Definition at line 110 of file RPCDqmClient.cc.

References RPCGeomServ::chambername(), cl, clientHisto_, clientModules_, clientTag_, dbe_, RPCBookFolderStructure::folderStructure(), edm::EventSetup::get(), DQMStore::get(), RPCGeomServ::name(), NULL, prefixDir_, alignCSCRings::r, RPCChamber::rolls(), RPCEvents_, DQMStore::tag(), and useRollInfo_.

Referenced by beginRun(), and endRun().

                                                                             {
 
  std::vector<MonitorElement *>  myMeVect;
  std::vector<RPCDetId>   myDetIds;
   
  edm::ESHandle<RPCGeometry> rpcGeo;
  c.get<MuonGeometryRecord>().get(rpcGeo);
  
  //dbe_->setCurrentFolder(prefixDir_);
  RPCBookFolderStructure *  folderStr = new RPCBookFolderStructure();
  MonitorElement * myMe = NULL;
  //loop on all geometry and get all histos
  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
    if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
       
       RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 
       std::vector< const RPCRoll*> roles = (ch->rolls());
       //Loop on rolls in given chamber
       for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
         RPCDetId detId = (*r)->id();
         
         //Get Occupancy ME for roll
         RPCGeomServ RPCname(detId);       
         std::string rollName= "";
         //loop on clients
         for( unsigned int cl = 0; cl<clientModules_.size(); cl++ ){
           if(useRollInfo_) rollName =  RPCname.name();
           else     rollName =  RPCname.chambername();
             
           myMe = NULL;
           myMe = dbe_->get(prefixDir_ +"/"+ folderStr->folderStructure(detId)+"/"+clientHisto_[cl]+ "_"+rollName); 

          if (!myMe)continue;

          dbe_->tag(myMe, clientTag_[cl]);

          myMeVect.push_back(myMe);
          myDetIds.push_back(detId);
        }//end loop on clients
      }//end loop on roll in given chamber
    }
  }//end loop on all geometry and get all histos  
  

  RPCEvents_ = dbe_->get(prefixDir_ +"/RPCEvents");  
  

  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
    (*it)->getMonitorElements(myMeVect, myDetIds);
  }

  delete folderStr;
 
}
void RPCDqmClient::makeClientMap ( void  ) [protected]

Definition at line 229 of file RPCDqmClient.cc.

References clientHisto_, clientList_, clientModules_, clientTag_, rpcdqm::CLUSTERSIZE, i, rpcdqm::MULTIPLICITY, rpcdqm::OCCUPANCY, and parameters_.

Referenced by RPCDqmClient().

                                 {

  for(unsigned int i = 0; i<clientList_.size(); i++){
    
    if( clientList_[i] == "RPCMultiplicityTest" ) {
      clientHisto_.push_back("Multiplicity");
      clientTag_.push_back(rpcdqm::MULTIPLICITY);
      clientModules_.push_back( new RPCMultiplicityTest(parameters_));
    } else if ( clientList_[i] == "RPCDeadChannelTest" ){
      clientHisto_.push_back("Occupancy");
      clientModules_.push_back( new RPCDeadChannelTest(parameters_));
      clientTag_.push_back(rpcdqm::OCCUPANCY);
    } else if ( clientList_[i] == "RPCClusterSizeTest" ){
      clientHisto_.push_back("ClusterSize");
      clientModules_.push_back( new RPCClusterSizeTest(parameters_));
      clientTag_.push_back(rpcdqm::CLUSTERSIZE);
    } else if ( clientList_[i] == "RPCOccupancyTest" ){
      clientHisto_.push_back("Occupancy");
      clientModules_.push_back( new RPCOccupancyTest(parameters_));
      clientTag_.push_back(rpcdqm::OCCUPANCY);
    } else if ( clientList_[i] == "RPCNoisyStripTest" ){
      clientHisto_.push_back("Occupancy");
      clientModules_.push_back( new RPCNoisyStripTest(parameters_));
      clientTag_.push_back(rpcdqm::OCCUPANCY);
    }
  }

  return;

}

Member Data Documentation

std::vector<std::string> RPCDqmClient::clientHisto_ [private]

Definition at line 61 of file RPCDqmClient.h.

Referenced by getMonitorElements(), and makeClientMap().

std::vector<std::string> RPCDqmClient::clientList_ [private]

Definition at line 56 of file RPCDqmClient.h.

Referenced by makeClientMap(), and RPCDqmClient().

std::vector<RPCClient*> RPCDqmClient::clientModules_ [private]
std::vector<std::string> RPCDqmClient::clientNames_ [private]

Definition at line 61 of file RPCDqmClient.h.

std::vector<int> RPCDqmClient::clientTag_ [private]

Definition at line 64 of file RPCDqmClient.h.

Referenced by getMonitorElements(), and makeClientMap().

Definition at line 68 of file RPCDqmClient.h.

Referenced by beginJob(), getMonitorElements(), and ~RPCDqmClient().

std::string RPCDqmClient::globalFolder_ [private]

Definition at line 55 of file RPCDqmClient.h.

Referenced by beginJob(), and RPCDqmClient().

bool RPCDqmClient::init_ [private]

Definition at line 53 of file RPCDqmClient.h.

Referenced by beginRun(), and endLuminosityBlock().

Definition at line 57 of file RPCDqmClient.h.

Referenced by beginRun(), and endLuminosityBlock().

Definition at line 51 of file RPCDqmClient.h.

Referenced by endLuminosityBlock(), endRun(), and RPCDqmClient().

Definition at line 51 of file RPCDqmClient.h.

bool RPCDqmClient::offlineDQM_ [private]

Definition at line 50 of file RPCDqmClient.h.

Referenced by beginRun(), endLuminosityBlock(), endRun(), and RPCDqmClient().

Definition at line 66 of file RPCDqmClient.h.

Referenced by makeClientMap(), and RPCDqmClient().

std::string RPCDqmClient::prefixDir_ [private]

Definition at line 54 of file RPCDqmClient.h.

Referenced by getMonitorElements(), and RPCDqmClient().

Definition at line 51 of file RPCDqmClient.h.

Referenced by beginRun(), endLuminosityBlock(), and RPCDqmClient().

Definition at line 58 of file RPCDqmClient.h.

Referenced by endLuminosityBlock(), endRun(), and getMonitorElements().

Definition at line 53 of file RPCDqmClient.h.

Referenced by getMonitorElements(), and RPCDqmClient().