CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DTDCSByLumiTask Class Reference

#include <DTDCSByLumiTask.h>

Inheritance diagram for DTDCSByLumiTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DTDCSByLumiTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~DTDCSByLumiTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob ()
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 By Lumi DCS DB Operation.
void beginRun (const edm::Run &, const edm::EventSetup &)
 Begin Run.
void bookHistos ()
 Book Monitor Elements.
void endJob ()
 Endjob.
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &setup)
 By Lumi DCS DB Operation.

Private Member Functions

std::string topFolder () const

Private Attributes

bool DTHVRecordFound
std::vector< MonitorElement * > hActiveUnits
edm::ESHandle< DTHVStatushvStatus
DQMStoretheDQMStore
edm::ESHandle< DTGeometrytheDTGeom
int theEvents
int theLumis

Detailed Description

Definition at line 32 of file DTDCSByLumiTask.h.


Constructor & Destructor Documentation

DTDCSByLumiTask::DTDCSByLumiTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file DTDCSByLumiTask.cc.

References LogTrace, cppFunctionSkipper::operator, and theDQMStore.

                                                          : theEvents(0) , theLumis(0) {

  theDQMStore = Service<DQMStore>().operator->();
  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
    << "[DTDCSByLumiTask]: Constructor" << endl;

  // If needed put getParameter here
  // dtDCSByLumiLabel = ps.getParameter<InputTag>("dtDCSByLumiLabel");

}
DTDCSByLumiTask::~DTDCSByLumiTask ( ) [virtual]

Destructor.

Definition at line 51 of file DTDCSByLumiTask.cc.

References LogTrace, theEvents, and theLumis.

                                 {

  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
    << "DTDCSByLumiTask: processed " << theEvents << 
    " events in " << theLumis << " lumi sections" << endl;

}

Member Function Documentation

void DTDCSByLumiTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 188 of file DTDCSByLumiTask.cc.

References theEvents.

                                                                           {

  theEvents++;

}
void DTDCSByLumiTask::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file DTDCSByLumiTask.cc.

References LogTrace.

                              {

  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
    <<"[DTDCSByLumiTask]: BeginJob"<<endl;

}
void DTDCSByLumiTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [protected, virtual]

By Lumi DCS DB Operation.

Reimplemented from edm::EDAnalyzer.

Definition at line 102 of file DTDCSByLumiTask.cc.

References hActiveUnits, edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), and theLumis.

                                                                                                    {

  theLumis++;

  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
    << "[DTDCSByLumiTask]: Begin of processed lumi # " << lumiSeg.id().luminosityBlock() 
    << " " << theLumis << " lumi processed by this job" <<  endl;

  for(int wheel=0; wheel <5; wheel++) {
    hActiveUnits[wheel]->Reset(); // Cb by lumi histo need to be resetted in between lumi boundaries
  } 

}
void DTDCSByLumiTask::beginRun ( const edm::Run run,
const edm::EventSetup context 
) [protected, virtual]

Begin Run.

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file DTDCSByLumiTask.cc.

References bookHistos(), DTHVRecordFound, edm::EventSetup::fillAvailableRecordKeys(), spr::find(), edm::typelookup::findType(), edm::EventSetup::get(), LogTrace, and theDTGeom.

                                                                              {

  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
    << "[DTDCSByLumiTask]: begin run" << endl;

  bookHistos();

  context.get<MuonGeometryRecord>().get(theDTGeom);

  DTHVRecordFound=true;

  eventsetup::EventSetupRecordKey recordKey(eventsetup::EventSetupRecordKey::TypeTag::findType("DTHVStatusRcd"));

  std::vector<eventsetup::EventSetupRecordKey> recordKeys;
  context.fillAvailableRecordKeys(recordKeys);
  vector<eventsetup::EventSetupRecordKey>::iterator it = find(recordKeys.begin(),recordKeys.end(),recordKey);

  if( it == recordKeys.end() ) {
    //record not found
    LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")<<"Record DTHVStatusRcd does not exist "<<std::endl;

    DTHVRecordFound=false;
  }

}
void DTDCSByLumiTask::bookHistos ( ) [protected]

Book Monitor Elements.

Definition at line 171 of file DTDCSByLumiTask.cc.

References DQMStore::book1D(), hActiveUnits, DQMStore::setCurrentFolder(), MonitorElement::setLumiFlag(), theDQMStore, and topFolder().

Referenced by beginRun().

                                 {

  // Book bylumi histo (# of bins as reduced as possible)
  theDQMStore->setCurrentFolder(topFolder());

  for(int wheel=-2; wheel <=2; wheel++) {

    stringstream wheel_str; wheel_str << wheel; 

    MonitorElement* ME = theDQMStore->book1D("hActiveUnits"+wheel_str.str(),"Active Untis x LS Wh"+wheel_str.str(),2,0.5,2.5);
    ME->setLumiFlag();// Set LumiFlag in order to save histo every LS

    hActiveUnits.push_back(ME);
  }

}
void DTDCSByLumiTask::endJob ( void  ) [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file DTDCSByLumiTask.cc.

References LogTrace.

                            {

  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
    <<"[DTDCSByLumiTask] endjob called!"<<endl;

}
void DTDCSByLumiTask::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup setup 
) [protected, virtual]

By Lumi DCS DB Operation.

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file DTDCSByLumiTask.cc.

References DTHVRecordFound, first, edm::EventSetup::get(), hActiveUnits, hvStatus, prof2calltree::last, and theDTGeom.

                                                                                                        {


  if(DTHVRecordFound) context.get<DTHVStatusRcd>().get(hvStatus);

  vector<DTLayer*>::const_iterator layersIt  = theDTGeom->layers().begin();
  vector<DTLayer*>::const_iterator layersEnd = theDTGeom->layers().end();

  for(; layersIt!=layersEnd; ++layersIt) {

    int wheel = (*layersIt)->id().wheel();

    int nWiresLayer = (*layersIt)->specificTopology().channels();

    hActiveUnits[wheel+2]->Fill(1,nWiresLayer); // CB first bin is # of layers
    int nActiveWires = nWiresLayer;

    int flagA = -100;
    int flagC = -100;
    int flagS = -100;
    int first = -100;
    int last  = -100;

    // CB info is not stored if HV is ON -> in this case get returns 1
    // process all other cases and removed wires with "BAD HV" from active
    // wires list

    if( DTHVRecordFound ) {
      if ( !hvStatus->get((*layersIt)->id(),0,first,last,flagA,flagC,flagS) 
          && (flagA || flagC || flagS) ) {
        nActiveWires -= (last - first + 1);
      }    

      if ( !hvStatus->get((*layersIt)->id(),1,first,last,flagA,flagC,flagS) 
          && (flagA || flagC || flagS) ) {
        nActiveWires -= (last - first + 1);
      }
    } else {
      nActiveWires=-1.;
    }

    hActiveUnits[wheel+2]->Fill(2,nActiveWires); // CB 2nd bin is the list of wires wit HV ON

  }

  /* LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") 
     << "[DTDCSByLumiTask]: processed lumi # : " << lumiSeg.id().luminosityBlock()  
     << "\t# of wires " << hActiveUnits->getBinContent(1) 
     << "\t# of Active wires (anodes && cathodes && strips ON) : " 
     << hActiveUnits->getBinContent(2) << endl; 
   */
}
string DTDCSByLumiTask::topFolder ( ) const [private]

Definition at line 195 of file DTDCSByLumiTask.cc.

Referenced by bookHistos().

                                        {

  return string("DT/EventInfo/DCSContents");

}

Member Data Documentation

Definition at line 72 of file DTDCSByLumiTask.h.

Referenced by beginRun(), and endLuminosityBlock().

Definition at line 79 of file DTDCSByLumiTask.h.

Referenced by beginLuminosityBlock(), bookHistos(), and endLuminosityBlock().

Definition at line 77 of file DTDCSByLumiTask.h.

Referenced by endLuminosityBlock().

Definition at line 74 of file DTDCSByLumiTask.h.

Referenced by bookHistos(), and DTDCSByLumiTask().

Definition at line 75 of file DTDCSByLumiTask.h.

Referenced by beginRun(), and endLuminosityBlock().

Definition at line 69 of file DTDCSByLumiTask.h.

Referenced by analyze(), and ~DTDCSByLumiTask().

Definition at line 70 of file DTDCSByLumiTask.h.

Referenced by beginLuminosityBlock(), and ~DTDCSByLumiTask().