CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalNZSMonitor Class Reference

#include <HcalNZSMonitor.h>

Inheritance diagram for HcalNZSMonitor:
HcalBaseDQMonitor edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &s)
void beginRun (const edm::Run &run, const edm::EventSetup &c)
void cleanup ()
 HcalNZSMonitor (const edm::ParameterSet &ps)
void processEvent (const FEDRawDataCollection &rawraw, edm::TriggerResults, int bxNum, const edm::TriggerNames &triggerNames)
void reset ()
void setup ()
void unpack (const FEDRawData &raw, const HcalElectronicsMap &emap)
 ~HcalNZSMonitor ()

Private Member Functions

bool isUnsuppressed (HcalHTRData &payload)

Private Attributes

edm::InputTag hltresultsLabel_
MonitorElementmeBXtriggered_
MonitorElementmeFEDsizesNZS_
MonitorElementmeFEDsizeVsLumi_
MonitorElementmeFullCMSdataSize_
MonitorElementmeIsUS_
MonitorElementmeL1evtNumber_
MonitorElementmeTrigFrac_
std::vector< int > nAcc
int nAcc_Total
int nAndAcc
int period_
edm::InputTag rawdataLabel_
std::vector< int > selFEDs_
std::vector< std::string > triggers_
uint64_t UScount [32][15]

Detailed Description

Definition at line 10 of file HcalNZSMonitor.h.


Constructor & Destructor Documentation

HcalNZSMonitor::HcalNZSMonitor ( const edm::ParameterSet ps)

Definition at line 11 of file HcalNZSMonitor.cc.

References HcalBaseDQMonitor::AllowedCalibTypes_, HcalBaseDQMonitor::debug_, HcalBaseDQMonitor::enableCleanup_, edm::ParameterSet::getUntrackedParameter(), hltresultsLabel_, HcalBaseDQMonitor::makeDiagnostics_, HcalBaseDQMonitor::mergeRuns_, HcalBaseDQMonitor::NLumiBlocks_, HcalBaseDQMonitor::Online_, period_, HcalBaseDQMonitor::prefixME_, rawdataLabel_, HcalBaseDQMonitor::skipOutOfOrderLS_, HcalBaseDQMonitor::subdir_, and triggers_.

{
  Online_                = ps.getUntrackedParameter<bool>("online",false);
  mergeRuns_             = ps.getUntrackedParameter<bool>("mergeRuns",false);
  enableCleanup_         = ps.getUntrackedParameter<bool>("enableCleanup",false);
  debug_                 = ps.getUntrackedParameter<int>("debug",0);
  prefixME_              = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
    prefixME_.append("/");
  subdir_                = ps.getUntrackedParameter<std::string>("TaskFolder","NZSMonitor_Hcal"); 
  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
    subdir_.append("/");
  subdir_=prefixME_+subdir_;
  AllowedCalibTypes_     = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
  skipOutOfOrderLS_      = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",false);
  NLumiBlocks_           = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
  makeDiagnostics_       = ps.getUntrackedParameter<bool>("makeDiagnostics",false);

  triggers_=ps.getUntrackedParameter<std::vector<std::string> >("nzsHLTnames"); //["HLT_HcalPhiSym","HLT_HcalNZS_8E29]
  period_=ps.getUntrackedParameter<int>("NZSeventPeriod",4096); //4096
  rawdataLabel_          = ps.getUntrackedParameter<edm::InputTag>("RawDataLabel");
  hltresultsLabel_       = ps.getUntrackedParameter<edm::InputTag>("HLTResultsLabel");

} 
HcalNZSMonitor::~HcalNZSMonitor ( )

Definition at line 36 of file HcalNZSMonitor.cc.

{}

Member Function Documentation

void HcalNZSMonitor::analyze ( edm::Event const &  e,
edm::EventSetup const &  s 
) [virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 132 of file HcalNZSMonitor.cc.

References edm::EventBase::bunchCrossing(), HcalBaseDQMonitor::debug_, edm::Event::getByLabel(), hltresultsLabel_, HcalBaseDQMonitor::IsAllowedCalibType(), HcalBaseDQMonitor::LumiInOrder(), edm::EventBase::luminosityBlock(), processEvent(), rawdataLabel_, and edm::Event::triggerNames().

{
  if (!IsAllowedCalibType()) return;
  if (LumiInOrder(e.luminosityBlock())==false) return;
  
  edm::Handle<FEDRawDataCollection> rawraw;

  if (!(e.getByLabel(rawdataLabel_,rawraw)))
    {
      edm::LogWarning("HcalNZSMonitor")<<" raw data with label "<<rawdataLabel_<<" not available";
      return;
    }

  edm::Handle<edm::TriggerResults> hltRes;
  if (!(e.getByLabel(hltresultsLabel_,hltRes)))
    {
      if (debug_>0) edm::LogWarning("HcalNZSMonitor")<<" Could not get HLT results with tag "<<hltresultsLabel_<<std::endl;
      return;
    }

  const edm::TriggerNames & triggerNames = e.triggerNames(*hltRes);
  // Collections were found; increment counters
  HcalBaseDQMonitor::analyze(e,s);

  processEvent(*rawraw, *hltRes, e.bunchCrossing(), triggerNames);

} // void HcalNZSMonitor::analyze(...)
void HcalNZSMonitor::beginRun ( const edm::Run run,
const edm::EventSetup c 
) [virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 59 of file HcalNZSMonitor.cc.

References gather_cfg::cout, HcalBaseDQMonitor::debug_, HcalBaseDQMonitor::mergeRuns_, reset(), setup(), and HcalBaseDQMonitor::tevt_.

{
  if (debug_>1) std::cout <<"HcalNZSMonitor::beginRun"<<std::endl;
  HcalBaseDQMonitor::beginRun(run,c);

  if (tevt_==0) this->setup(); // set up histograms if they have not been created before
  if (mergeRuns_==false)
    this->reset();

  return;

} // void HcalNZSMonitor::beginRun(...)
void HcalNZSMonitor::cleanup ( void  ) [virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 49 of file HcalNZSMonitor.cc.

References HcalBaseDQMonitor::dbe_, DQMStore::removeContents(), DQMStore::setCurrentFolder(), and HcalBaseDQMonitor::subdir_.

{
  if(dbe_)
    {
      dbe_->setCurrentFolder(subdir_);
      dbe_->removeContents();
    }
}//void HcalNZSMonitor::cleanup()
bool HcalNZSMonitor::isUnsuppressed ( HcalHTRData payload) [private]
void HcalNZSMonitor::processEvent ( const FEDRawDataCollection rawraw,
edm::TriggerResults  trigRes,
int  bxNum,
const edm::TriggerNames triggerNames 
)

Level-1 event number generated by the TTC system

Definition at line 161 of file HcalNZSMonitor.cc.

References edm::HLTGlobalStatus::accept(), gather_cfg::cout, HcalBaseDQMonitor::currentLS, FEDRawData::data(), HcalBaseDQMonitor::dbe_, HcalBaseDQMonitor::debug_, FEDRawDataCollection::FEDData(), MonitorElement::Fill(), HcalDCCHeader::getSpigotData(), HcalDCCHeader::getSpigotPresent(), errorMatrix2Lands::header, i, HcalHTRData::isUnsuppressed(), j, gen::k, prof2calltree::l, FEDNumbering::MAXFEDID, meBXtriggered_, meFEDsizesNZS_, meFEDsizeVsLumi_, meFullCMSdataSize_, meIsUS_, meL1evtNumber_, meTrigFrac_, FEDNumbering::MINTriggerGTPFEDID, nAcc, nAcc_Total, nAndAcc, AlCaHLTBitMon_ParallelJobs::p, period_, selFEDs_, MonitorElement::setBinContent(), FEDRawData::size(), edm::TriggerNames::size(), HcalDCCHeader::SPIGOT_COUNT, edm::TriggerNames::triggerName(), and triggers_.

Referenced by analyze().

{
  if(!dbe_) 
    { 
      if (debug_>0) std::cout <<"HcalNZSMonitor::processEvent DQMStore not instantiated!!!"<<std::endl;  
      return;
    }

  const unsigned int nTrig(triggerNames.size());
 
  std::vector<bool> trigAcc;
  for (unsigned int i=0; i<triggers_.size(); i++) trigAcc.push_back(false);
  
   for (unsigned int k=0; k<nTrig; k++)
     {
       for (unsigned int i=0; i<triggers_.size(); i++)
         {
           if (triggerNames.triggerName(k) == triggers_[i] && trigRes.accept(k)) trigAcc[i]=true;
         }
     }
   bool andAcc=true;
   bool orAcc=false;
   for (unsigned int p=0; p<triggers_.size(); p++)
     {
       if (!trigAcc[p]) andAcc=false;
       if (trigAcc[p]) 
         {
           orAcc=true;
           nAcc[p]++;
         }
     }
   
   if (orAcc)
     {
       nAcc_Total++;
       for (unsigned int l=0; l<triggers_.size(); l++)
         {
           meTrigFrac_->setBinContent(l+1,nAcc[l]/(float)nAcc_Total);
         }
     }

   if (andAcc) 
     {
       nAndAcc++;
       meTrigFrac_->setBinContent(triggers_.size()+1,nAndAcc/(float)nAcc_Total);
     }
   
  bool processevent=false;
  if (orAcc) processevent=true;

  if (!processevent) return;

  meBXtriggered_->Fill(bxNum+0.001,1);

  //calculate full HCAL data size:
  size_t hcalSize=0;
  bool hcalIsZS = false;
  for (unsigned int k=0; k<selFEDs_.size(); k++)
    {
      const FEDRawData & fedData = rawraw.FEDData(selFEDs_[k]);
      hcalSize+=fedData.size();
      meFEDsizesNZS_->Fill(selFEDs_[k]+0.001,fedData.size()/1024);

      const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(fedData.data());
      if (dccHeader==0) continue;  // protection against bad data -- saw this happen in file /store/streamer/Data/A/000/131/540/Data.00131540.0200.A.storageManager.00.0000.dat; not yet sure why -- Jeff, 22 March 2010; this was due to empty (masked?) HO FEDs 724 and 727 -- Grigory, 25/03/2010 

      HcalHTRData htr;
      int nspigot =0; 
      for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) 
        {    
          nspigot++;
          if (!dccHeader->getSpigotPresent(spigot)) continue;
          // Load the given decoder with the pointer and length from this spigot.
          dccHeader->getSpigotData(spigot,htr, fedData.size()); 
          if(k != 20 && nspigot !=14 ) 
            {      
              if ( !htr.isUnsuppressed() ) hcalIsZS = true; 
            }
        }
    }
  
  if (hcalIsZS) meIsUS_->Fill(0,1);
  else meIsUS_->Fill(1,1);

  meFEDsizeVsLumi_->Fill(currentLS+0.001, hcalSize/1024);
  
  size_t fullSize=0;
  for (int j=0; j<=FEDNumbering::MAXFEDID; ++j )
    {
      const FEDRawData & fedData = rawraw.FEDData(j);
      fullSize+=fedData.size();
    }

  meFullCMSdataSize_->Fill(currentLS+0.001,fullSize/1024);
  
  // get Trigger FED-Id
  const FEDRawData& fedData = rawraw.FEDData(FEDNumbering::MINTriggerGTPFEDID) ;
  FEDHeader header(fedData.data()) ;
  
  if (header.lvl1ID()%period_==0) meL1evtNumber_->Fill(1,1);
  else meL1evtNumber_->Fill(0,1);
  return;

} //void HcalNZSMonitor::processEvent(...)
void HcalNZSMonitor::reset ( void  ) [virtual]
void HcalNZSMonitor::setup ( void  ) [virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 73 of file HcalNZSMonitor.cc.

References DQMStore::book1D(), DQMStore::bookProfile(), gather_cfg::cout, HcalBaseDQMonitor::dbe_, HcalBaseDQMonitor::debug_, MonitorElement::getTProfile(), i, gen::k, FEDNumbering::MAXHCALFEDID, meBXtriggered_, meFEDsizesNZS_, meFEDsizeVsLumi_, meFullCMSdataSize_, meIsUS_, meL1evtNumber_, meTrigFrac_, FEDNumbering::MINHCALFEDID, nAcc, nAcc_Total, nAndAcc, HcalBaseDQMonitor::NLumiBlocks_, selFEDs_, MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), HcalBaseDQMonitor::subdir_, and triggers_.

Referenced by beginRun().

{
  HcalBaseDQMonitor::setup();
  
  if(debug_>1) std::cout << "<HcalNZSMonitor::setup> About to pushback fedUnpackList_" << std::endl;

  selFEDs_.clear();
  for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++)
    {
      selFEDs_.push_back(i);
    }

  nAcc.clear();
  for (unsigned int i=0; i<triggers_.size(); i++) nAcc.push_back(0);

  nAndAcc=0;
  nAcc_Total=0;
  
  if (debug_>1) std::cout <<"<HcalNZSMonitor::setup>  Creating histograms"<<std::endl;
  if (dbe_)
    {
      dbe_->setCurrentFolder(subdir_);
      
      meFEDsizesNZS_=dbe_->bookProfile("FED sizes","FED sizes",32,699.5,731.5,100,-1000.0,12000.0,"");
      meFEDsizesNZS_->setAxisTitle("FED number",1);
      meFEDsizesNZS_->setAxisTitle("average size (KB)",2);
      meFEDsizesNZS_->getTProfile()->SetMarkerStyle(22);
      
      meFEDsizeVsLumi_=dbe_->bookProfile("FED_size_Vs_lumi_block_number",
                                         "FED size Vs lumi block number;lumiblock number;average HCAL FED size (kB)",
                                         NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000,"");
      meFEDsizeVsLumi_->getTProfile()->SetMarkerStyle(22);

      meL1evtNumber_=dbe_->book1D("Is_L1_event_number_multiple_of_NZS_period",
                                  "Is L1 event number multiple of NZS period",2,0,2);
      meL1evtNumber_->setBinLabel(1, "NO", 1);
      meL1evtNumber_->setBinLabel(2, "YES", 1);

      meIsUS_=dbe_->book1D("IsUnsuppressed_bit","IsUnsuppressed bit",2,0,2);
      meIsUS_->setBinLabel(1,"NO",1);
      meIsUS_->setBinLabel(2,"YES",1);

      meBXtriggered_=dbe_->book1D("Triggered_BX_number","Triggered BX number",3850,0,3850);
      meBXtriggered_->setAxisTitle("BX number",1);

      meTrigFrac_=dbe_->book1D("HLT_accept_fractions","HLT accept fractions",triggers_.size()+1,0,triggers_.size()+1);
      for (unsigned int k=0; k<triggers_.size(); k++) meTrigFrac_->setBinLabel(k+1,triggers_[k].c_str(),1);
      meTrigFrac_->setBinLabel(triggers_.size()+1,"AND",1);

      meFullCMSdataSize_=dbe_->bookProfile("full_CMS_datasize",
                                           "full CMS data size;lumiblock number;average FEDRawDataCollection size (kB)",
                                           NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000,"");
      meFullCMSdataSize_->getTProfile()->SetMarkerStyle(22);

    } // if (dbe_)
  return;
} // void HcalNZSMonitor::setup()
void HcalNZSMonitor::unpack ( const FEDRawData raw,
const HcalElectronicsMap emap 
)

Member Data Documentation

Definition at line 53 of file HcalNZSMonitor.h.

Referenced by analyze(), and HcalNZSMonitor().

Definition at line 41 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

Definition at line 38 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

Definition at line 36 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

Definition at line 43 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

Definition at line 40 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

Definition at line 39 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

Definition at line 42 of file HcalNZSMonitor.h.

Referenced by processEvent(), reset(), and setup().

std::vector<int> HcalNZSMonitor::nAcc [private]

Definition at line 50 of file HcalNZSMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 49 of file HcalNZSMonitor.h.

Referenced by processEvent(), and setup().

int HcalNZSMonitor::nAndAcc [private]

Definition at line 48 of file HcalNZSMonitor.h.

Referenced by processEvent(), and setup().

int HcalNZSMonitor::period_ [private]

Definition at line 33 of file HcalNZSMonitor.h.

Referenced by HcalNZSMonitor(), and processEvent().

Definition at line 52 of file HcalNZSMonitor.h.

Referenced by analyze(), and HcalNZSMonitor().

std::vector<int> HcalNZSMonitor::selFEDs_ [private]

Definition at line 30 of file HcalNZSMonitor.h.

Referenced by processEvent(), and setup().

std::vector<std::string> HcalNZSMonitor::triggers_ [private]

Definition at line 32 of file HcalNZSMonitor.h.

Referenced by HcalNZSMonitor(), processEvent(), and setup().

uint64_t HcalNZSMonitor::UScount[32][15] [private]

Definition at line 46 of file HcalNZSMonitor.h.