Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "DQM/L1TMonitor/interface/L1TLTC.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012
00013 using namespace std;
00014 using namespace edm;
00015
00016 L1TLTC::L1TLTC(const ParameterSet& ps)
00017 {
00018
00019
00020 verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00021
00022 if(verbose_) cout << "L1TLTC: constructor...." << endl;
00023
00024
00025 dbe = NULL;
00026 if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
00027 {
00028 dbe = Service<DQMStore>().operator->();
00029 dbe->setVerbose(0);
00030 }
00031
00032 outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
00033 if ( outputFile_.size() != 0 ) {
00034 cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
00035 }
00036
00037 bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
00038 if(disable){
00039 outputFile_="";
00040 }
00041
00042
00043 if ( dbe !=NULL ) {
00044 dbe->setCurrentFolder("L1T/L1TLTC");
00045 }
00046
00047
00048 }
00049
00050 L1TLTC::~L1TLTC()
00051 {
00052 }
00053
00054 void L1TLTC::beginJob(void)
00055 {
00056
00057 nev_ = 0;
00058
00059
00060 DQMStore* dbe = 0;
00061 dbe = Service<DQMStore>().operator->();
00062
00063 if ( dbe ) {
00064 dbe->setCurrentFolder("L1T/L1TLTC");
00065 dbe->rmdir("L1T/L1TLTC");
00066 }
00067
00068
00069 if ( dbe )
00070 {
00071 dbe->setCurrentFolder("L1T/L1TLTC");
00072 h1 = dbe->book1D("Bunch", "Bunch Number", 100, -0.5, 5000.) ;
00073 h2 = dbe->book1D("Orbit", "Orbit Number", 100, -0.5, 100000. ) ;
00074 h3 = dbe->book1D("Triggers", "Triggers", 8, -0.5, 7.5 ) ;
00075
00076 overlaps = dbe->book2D("olaps", "Trigger Overlaps", 8, -0.5, 7.5 ,
00077 8, -0.5, 7.5);
00078
00079 n_inhibit = dbe->bookInt("n_inhibit");
00080 run = dbe->bookInt("run");
00081 event = dbe->bookInt("event");
00082 gps_time = dbe->bookInt("gps_time");
00083 }
00084 }
00085
00086
00087 void L1TLTC::endJob(void)
00088 {
00089 if(verbose_) cout << "L1TLTC: end job...." << endl;
00090 LogInfo("EndJob") << "analyzed " << nev_ << " events";
00091
00092 if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
00093
00094 return;
00095 }
00096
00097 void L1TLTC::analyze(const Event& e, const EventSetup& c)
00098 {
00099 nev_++;
00100 if(verbose_) cout << "L1TLTC: analyze...." << endl;
00101 Handle< LTCDigiCollection > digis ;
00102 e.getByType(digis);
00103
00104 if (!digis.isValid()) {
00105 edm::LogInfo("DataNotFound") << "can't find LTCDigiCollection ";
00106 return;
00107 }
00108
00109 for( LTCDigiCollection::const_iterator digiItr = digis->begin() ;
00110 digiItr != digis->end() ;
00111 ++digiItr )
00112 {
00113 h1->Fill( digiItr->bunchNumber() ) ;
00114 h2->Fill( digiItr->orbitNumber() ) ;
00115
00116 for( int i = 0 ; i < 6 ; ++i ) {
00117 h3->Fill( i, ( digiItr->HasTriggered( i ) ? 1 : 0 ) ) ;
00118 }
00119
00120 h3->Fill( 6, digiItr->ramTrigger() ) ;
00121 h3->Fill( 7, digiItr->vmeTrigger() ) ;
00122
00123 unsigned int setbits = digiItr->externTriggerMask();
00124
00125 if ( digiItr->ramTrigger() ) {
00126 setbits |= (0x1UL<<7);
00127 }
00128 if ( digiItr->vmeTrigger() ) {
00129 setbits |= (0x1UL<<8);
00130 }
00131 for ( int i = 0; i < 8; ++i ) {
00132 if ( setbits & (0x1UL<<i) ) {
00133 for ( int j = i; j < 8; ++j ) {
00134 if ( setbits & (0x1UL<<j) ) {
00135 overlaps->Fill(i,j);
00136 overlaps->Fill(j,i);
00137 }
00138 }
00139 }
00140 }
00141
00142 n_inhibit->Fill(digiItr->triggerInhibitNumber());
00143 run ->Fill(digiItr->runNumber());
00144 event ->Fill(digiItr->eventNumber());
00145 gps_time ->Fill(digiItr->bstGpsTime());
00146 }
00147
00148 }
00149