CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DQM/SiStripMonitorCluster/src/MonitorLTC.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    SiStripMonitorCluster
00004 // Class:      MonitorLTC
00005 // 
00006 //class MonitorLTC MonitorLTC.cc DQM/SiStripMonitorCluster/src/MonitorLTC.cc
00007 #include <vector>
00008 
00009 #include <numeric>
00010 #include <iostream>
00011 
00012 
00013 
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 
00016 #include "DQM/SiStripMonitorCluster/interface/MonitorLTC.h"
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018 
00019 #include "DataFormats/LTCDigi/interface/LTCDigi.h"
00020 
00021 MonitorLTC::MonitorLTC(const edm::ParameterSet& iConfig) :
00022   ltcDigiCollectionTag_(iConfig.getParameter<edm::InputTag>("ltcDigiCollectionTag"))
00023 {
00024   HLTDirectory="HLTResults";
00025   dqmStore_  = edm::Service<DQMStore>().operator->();
00026   conf_ = iConfig;
00027 }
00028 
00029 
00030 void MonitorLTC::beginJob(){
00031   dqmStore_->setCurrentFolder(HLTDirectory);
00032   // 0 DT
00033   // 1 CSC
00034   // 2 RBC1 (RPC techn. cosmic trigger for wheel +1, sector 10)
00035   // 3 RBC2 (RPC techn. cosmic trigger for wheel +2, sector 10)
00036   // 4 RPCTB (RPC Trigger Board trigger, covering both sectors 10 of both wheels, but with different geometrical acceptance ("pointing"))
00037   // 5 unused 
00038 //  edm::CurrentProcessingContext const* current_processing_context = currentContext();
00039 //  std::string const* the_label = moduleLabel();
00040   std::string the_label = conf_.getParameter<std::string>("@module_label");
00041   std::string ltctitle = the_label + "_LTCTriggerDecision";
00042   LTCTriggerDecision_all = dqmStore_->book1D(ltctitle, ltctitle, 8, -0.5, 7.5);
00043   LTCTriggerDecision_all->setBinLabel(1, "DT");
00044   LTCTriggerDecision_all->setBinLabel(2, "CSC");
00045   LTCTriggerDecision_all->setBinLabel(3, "RBC1");
00046   LTCTriggerDecision_all->setBinLabel(4, "RBC2");
00047   LTCTriggerDecision_all->setBinLabel(5, "RPCTB");
00048 }
00049 
00050 void MonitorLTC::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00051 {
00052   edm::Handle<LTCDigiCollection> ltcdigis; iEvent.getByLabel(ltcDigiCollectionTag_, ltcdigis);
00053 //  unsigned int ltc_run;
00054 //  unsigned int ltc_event;
00055 //  unsigned int ltc_triggerNumber;
00056 //  unsigned int ltc_mask; // eight bits
00057 //  unsigned long long int ltc_gpstime;
00058 //  unsigned int ltc_orbit;
00059 //  unsigned int ltc_bunch;
00060 //  unsigned int ltc_inhibit;
00061   for( LTCDigiCollection::const_iterator ltcdigiItr = ltcdigis->begin() ; ltcdigiItr != ltcdigis->end() ; ++ltcdigiItr ) {
00062 //    ltc_run = ltcdigiItr->runNumber();
00063 //    ltc_event = ltcdigiItr->eventNumber();
00064 //    ltc_triggerNumber = ltcdigiItr->eventID();
00065 //    ltc_bunch = ltcdigiItr->bunchNumber();
00066 //    ltc_orbit = ltcdigiItr->orbitNumber();
00067 //    ltc_inhibit = ltcdigiItr->triggerInhibitNumber();
00068 //    ltc_mask = (unsigned int)(ltcdigiItr->externTriggerMask());
00069 //    ltc_gpstime = ltcdigiItr->bstGpsTime();
00070     for ( int ibit = 0; ibit < 7; ++ibit ) {
00071       if ( ltcdigiItr->HasTriggered(ibit) ) {
00072        LTCTriggerDecision_all->Fill(ibit,1.);
00073       }
00074     }
00075     //
00076 //    std::cout << "XXX: "
00077 //              << ltcdigiItr->runNumber() << " "
00078 //              << ltcdigiItr->eventNumber() << " "
00079 //              << ltcdigiItr->bunchNumber() << " "
00080 //              << ltcdigiItr->orbitNumber() << " "
00081 //              << "0x" << std::hex
00082 //              << int(ltcdigiItr->externTriggerMask()) << " "
00083 //              << std::dec
00084 //              << ltcdigiItr->triggerInhibitNumber() << " "
00085 //              << ltcdigiItr->bstGpsTime() << " "
00086 //              << std::endl;
00087 //    std::cout << (*ltcdigiItr) << std::endl;
00088   }
00089 
00090 }
00091 
00092 void MonitorLTC::endJob(void){
00093   bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
00094   std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00095   if(outputMEsInRootFile){
00096     dqmStore_->save(outputFileName);
00097   }
00098 }
00099