CMS 3D CMS Logo

Public Member Functions | Private Attributes

RPCLinkSynchroHistoMaker Class Reference

#include <RPCLinkSynchroHistoMaker.h>

List of all members.

Public Member Functions

void fill (TH1F *hDelay, TH2F *hDelaySpread, TH2F *hTopOccup, TH2F *hTopSpread) const
void fillDelayHisto (TH1F *histo)
void fillDelaySpreadHisto (TH2F *histo)
 RPCLinkSynchroHistoMaker (const RPCLinkSynchroStat &a)

Private Attributes

const RPCLinkSynchroStattheLinkStat

Detailed Description

Definition at line 14 of file RPCLinkSynchroHistoMaker.h.


Constructor & Destructor Documentation

RPCLinkSynchroHistoMaker::RPCLinkSynchroHistoMaker ( const RPCLinkSynchroStat a) [inline]

Definition at line 16 of file RPCLinkSynchroHistoMaker.h.

: theLinkStat(a) {}

Member Function Documentation

void RPCLinkSynchroHistoMaker::fill ( TH1F *  hDelay,
TH2F *  hDelaySpread,
TH2F *  hTopOccup,
TH2F *  hTopSpread 
) const

Definition at line 15 of file RPCLinkSynchroHistoMaker.cc.

References i, plotscripts::rms(), theLinkStat, and RPCLinkSynchroStat::theLinkStatMap.

Referenced by RPCMonitorLinkSynchro::endLuminosityBlock().

{
  hDelay->Reset();
  hDelaySpread->Reset();
  hTopOccup->Reset();
  hTopSpread->Reset();

  typedef std::vector< std::pair<unsigned int, unsigned int> > TopOccup;
  typedef std::vector< std::pair<double, unsigned int> > TopSpread;
  TopOccup topOccup(10,std::make_pair(0,0));  
  TopSpread topSpread(10,std::make_pair(0.,0));

  for (unsigned int idx=0; idx < theLinkStat.theLinkStatMap.size(); ++idx) {
    const RPCLinkSynchroStat::BoardAndCounts & bc = theLinkStat.theLinkStatMap[idx]; 

    int sum = bc.second.sum();
    double rms =  bc.second.rms();

    hDelaySpread->Fill(bc.second.mean()-3.,bc.second.rms());

    if (sum==0) continue; 
    for (int i=0; i<=7; ++i) hDelay->Fill(i-3,bc.second.counts()[i]);

    std::pair<unsigned int, unsigned int> canOccup =  std::make_pair(sum, idx);
    std::pair<double, unsigned int>      canSpread =  std::make_pair(rms, idx);
    TopOccup::iterator io = upper_bound(topOccup.begin(), topOccup.end(), canOccup, OrderLbOccup()); 
    TopSpread::iterator is = upper_bound(topSpread.begin(), topSpread.end(), canSpread, OrderLbSpread()); 
    if (io != topOccup.end()) { 
      topOccup.insert(io,canOccup);
      topOccup.erase(topOccup.end()-1);
    }
    if (is != topSpread.end()) {
      topSpread.insert(is,canSpread);
      topSpread.erase(topSpread.end()-1);
    }
  }

  for (int itop=0; itop<10; itop++) {
    const RPCLinkSynchroStat::BoardAndCounts & occup  = theLinkStat.theLinkStatMap[topOccup[itop].second];
    const RPCLinkSynchroStat::BoardAndCounts & spread = theLinkStat.theLinkStatMap[topSpread[itop].second];
    hTopOccup->GetYaxis()->SetBinLabel(itop+1,occup.first.name().c_str());
    hTopSpread->GetYaxis()->SetBinLabel(itop+1,spread.first.name().c_str());
    for (unsigned int icount=0; icount<occup.second.counts().size(); icount++) {
      hTopOccup->SetBinContent(icount+1, itop+1, float(occup.second.counts()[icount]));
      hTopSpread->SetBinContent(icount+1, itop+1, float(spread.second.counts()[icount]));
    }
  }
//  for (int j=0; j<10; j++) { cout <<"topSpread["<<j<<"] = "<<topSpread[j].first<<endl; }
//  for (int j=0; j<10; j++) { cout <<"topOccup["<<j<<"] = "<<topOccup[j].first<<endl; }

}
void RPCLinkSynchroHistoMaker::fillDelayHisto ( TH1F *  histo)
void RPCLinkSynchroHistoMaker::fillDelaySpreadHisto ( TH2F *  histo)

Member Data Documentation

Definition at line 22 of file RPCLinkSynchroHistoMaker.h.

Referenced by fill().