CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/DTMonitorModule/src/DTTriggerCheck.cc

Go to the documentation of this file.
00001 
00002 /*
00003  *  See header file for a description of this class.
00004  *
00005  *  \author S.Bologensi - INFN Torino
00006  */
00007 
00008 #include "DQM/DTMonitorModule/interface/DTTriggerCheck.h"
00009 
00010 #include "FWCore/Framework/interface/Event.h"
00011 
00012 #include "DataFormats/LTCDigi/interface/LTCDigi.h"
00013 #include "DQMServices/Core/interface/DQMStore.h"
00014 
00015 #include <iterator>
00016 
00017 using namespace edm;
00018 using namespace std;
00019 
00020 DTTriggerCheck::DTTriggerCheck(const ParameterSet& pset){
00021  theDbe = edm::Service<DQMStore>().operator->();
00022 
00023  debug = pset.getUntrackedParameter<bool>("debug",false);
00024     parameters = pset;
00025 
00026   theDbe->setCurrentFolder("DT/DTTriggerTask");
00027   histo = theDbe->book1D("hNTriggerPerType",
00028                          "# of trigger per type",21, -1, 20);
00029 }
00030 
00031 DTTriggerCheck::~DTTriggerCheck(){
00032 }
00033 
00034 void DTTriggerCheck::beginJob(){
00035 }
00036 
00037 void DTTriggerCheck::endJob(){
00038 
00039   if(debug)
00040     cout<<"[DTTriggerCheck] endjob called!"<<endl;
00041   
00042   theDbe->rmdir("DT/DTTriggerTask");
00043 }
00044 
00045 void DTTriggerCheck::analyze(const Event& event, const EventSetup& setup) {
00046   if(debug)
00047     cout << "[DTTriggerCheck] Analyze #Run: " << event.id().run()
00048          << " #Event: " << event.id().event() << endl;
00049   
00050   //Get the trigger source from ltc digis
00051   edm::Handle<LTCDigiCollection> ltcdigis;
00052   if ( !parameters.getUntrackedParameter<bool>("localrun", true) ) 
00053     {
00054       event.getByType(ltcdigis);
00055       for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
00056         if (((*ltc_it).HasTriggered(0)) || 
00057             ((*ltc_it).HasTriggered(1)) || 
00058             ((*ltc_it).HasTriggered(2)) || 
00059             ((*ltc_it).HasTriggered(3)) || 
00060             ((*ltc_it).HasTriggered(4)))
00061           histo->Fill(-1);
00062         if ((*ltc_it).HasTriggered(0))
00063           histo->Fill(0);
00064         if ((*ltc_it).HasTriggered(1))
00065           histo->Fill(1);
00066         if ((*ltc_it).HasTriggered(2))
00067           histo->Fill(2);
00068         if ((*ltc_it).HasTriggered(3))
00069           histo->Fill(3);
00070         if ((*ltc_it).HasTriggered(4))
00071           histo->Fill(4);
00072       }
00073     }
00074   else
00075     histo->Fill(0);   
00076 }