CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/L1TMonitor/src/L1TGT.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TGT.cc
00003  *
00004  * $Date: 2010/07/09 18:12:25 $
00005  * $Revision: 1.21 $
00006  * \author J. Berryhill, I. Mikulec
00007  *
00008  */
00009 
00010 #include "DQM/L1TMonitor/interface/L1TGT.h"
00011 
00012 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00013 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00014 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
00015 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
00016 
00017 using namespace std;
00018 using namespace edm;
00019 
00020 L1TGT::L1TGT(const ParameterSet& ps) :
00021     gtSource_(ps.getParameter<InputTag> ("gtSource")),
00022     gtEvmSource_(ps.getParameter<InputTag> ("gtEvmSource")) {
00023 
00024     // verbosity switch
00025     verbose_ = ps.getUntrackedParameter<bool> ("verbose", false);
00026 
00027     if (verbose_)
00028         cout << "L1TGT: constructor...." << endl;
00029 
00030     dbe = NULL;
00031     if (ps.getUntrackedParameter<bool> ("DQMStore", false)) {
00032         dbe = Service<DQMStore> ().operator->();
00033         dbe->setVerbose(0);
00034     }
00035 
00036     outputFile_ = ps.getUntrackedParameter<string> ("outputFile", "");
00037     if (outputFile_.size() != 0) {
00038         cout << "L1T Monitoring histograms will be saved to "
00039                 << outputFile_.c_str() << endl;
00040     }
00041 
00042     bool disable = ps.getUntrackedParameter<bool> ("disableROOToutput", false);
00043     if (disable) {
00044         outputFile_ = "";
00045     }
00046 
00047     if (dbe != NULL) {
00048         dbe->setCurrentFolder("L1T/L1TGT");
00049     }
00050 
00051 }
00052 
00053 L1TGT::~L1TGT() {
00054 
00055     // empty
00056 }
00057 
00058 void L1TGT::beginJob() {
00059 
00060     nev_ = 0;
00061     preGps_ = 0;
00062     preOrb_ = 0;
00063 
00064     // get hold of back-end interface
00065     DQMStore* dbe = 0;
00066     dbe = Service<DQMStore> ().operator->();
00067 
00068     if (dbe) {
00069         dbe->setCurrentFolder("L1T/L1TGT");
00070         dbe->rmdir("L1T/L1TGT");
00071     }
00072 
00073     if (dbe) {
00074         dbe->setCurrentFolder("L1T/L1TGT");
00075 
00076         algo_bits = dbe->book1D("algo_bits", "GT algo bits", 128, -0.5, 127.5);
00077         algo_bits->setAxisTitle("algorithm bits", 1);
00078 
00079         algo_bits_corr = dbe->book2D("algo_bits_corr",
00080                 "GT algo bit correlation",
00081                 128, -0.5, 127.5, 128, -0.5, 127.5);
00082         algo_bits_corr->setAxisTitle("algorithm bits", 1);
00083         algo_bits_corr->setAxisTitle("algorithm bits", 2);
00084 
00085         tt_bits = dbe->book1D("tt_bits",
00086                 "GT technical trigger bits",
00087                 64, -0.5, 63.5);
00088         tt_bits->setAxisTitle("technical trigger bits", 1);
00089 
00090         tt_bits_corr = dbe->book2D("tt_bits_corr",
00091                 "GT tech. trig. bit correlation",
00092                 64, -0.5, 63.5, 64, -0.5, 63.5);
00093         tt_bits_corr->setAxisTitle("technical trigger bits", 1);
00094         tt_bits_corr->setAxisTitle("technical trigger bits", 2);
00095 
00096         algo_tt_bits_corr = dbe->book2D("algo_tt_bits_corr",
00097                 "GT algo tech. trig. bit correlation",
00098                 128, -0.5, 127.5, 64, -0.5, 63.5);
00099         algo_tt_bits_corr->setAxisTitle("algorithm bits", 1);
00100         algo_tt_bits_corr->setAxisTitle("technical trigger bits", 2);
00101 
00102         algo_bits_lumi = dbe->book2D("algo_bits_lumi",
00103                 "GT algo bit rate per lumi segment",
00104                 250, 0., 250., 128, -0.5, 127.5);
00105         algo_bits_lumi->setAxisTitle("luminosity segment", 1);
00106         algo_bits_lumi->setAxisTitle("algorithm bits", 2);
00107 
00108         tt_bits_lumi = dbe->book2D("tt_bits_lumi",
00109                 "GT tech. trig. bit rate per lumi segment",
00110                 250, 0., 250., 64, -0.5, 63.5);
00111         tt_bits_lumi->setAxisTitle("luminosity segment", 1);
00112         tt_bits_lumi->setAxisTitle("technical trigger bits", 2);
00113 
00114         event_type = dbe->book1D("event_type", "GT event type", 10, -0.5, 9.5);
00115         event_type->setAxisTitle("event type", 1);
00116         event_type->setBinLabel(2, "Physics", 1);
00117         event_type->setBinLabel(3, "Calibration", 1);
00118         event_type->setBinLabel(4, "Random", 1);
00119         event_type->setBinLabel(6, "Traced", 1);
00120         event_type->setBinLabel(7, "Test", 1);
00121         event_type->setBinLabel(8, "Error", 1);
00122 
00123         event_number = dbe->book1D("event_number",
00124                 "GT Event number (from last resync)",
00125                 100, 0., 50000.);
00126         event_number->setAxisTitle("event number", 1);
00127 
00128         event_lumi = dbe->bookProfile("event_lumi",
00129                 "GT Event number (from last resync) vs lumi section",
00130                 250, 0., 250., 100, -0.1, 1.e15, "s");
00131         event_lumi->setAxisTitle("luminosity segment", 1);
00132         event_lumi->setAxisTitle("event number", 2);
00133 
00134         trigger_number = dbe->book1D("trigger_number",
00135                 "GT Trigger number (from start run)",
00136                 100, 0., 50000.);
00137         trigger_number->setAxisTitle("trigger number", 1);
00138 
00139         trigger_lumi = dbe->bookProfile("trigger_lumi",
00140                 "GT Trigger number (from start run) vs lumi section",
00141                 250, 0., 250., 100, -0.1, 1.e15, "s");
00142         trigger_lumi->setAxisTitle("luminosity segment", 1);
00143         trigger_lumi->setAxisTitle("trigger number", 2);
00144 
00145         evnum_trignum_lumi = dbe->bookProfile("evnum_trignum_lumi",
00146                 "GT Event/Trigger number ratio vs lumi section",
00147                 250, 0., 250., 100, -0.1, 2., "s");
00148         evnum_trignum_lumi->setAxisTitle("luminosity segment", 1);
00149         evnum_trignum_lumi->setAxisTitle("event/trigger number ratio", 2);
00150 
00151         orbit_lumi = dbe->bookProfile("orbit_lumi",
00152                 "GT orbit number vs lumi section",
00153                 250, 0., 250., 100, -0.1, 1.e15, "s");
00154         orbit_lumi->setAxisTitle("luminosity segment", 1);
00155         orbit_lumi->setAxisTitle("orbit number", 2);
00156 
00157         setupversion_lumi = dbe->bookProfile("setupversion_lumi",
00158                 "GT setup version vs lumi section",
00159                 250, 0., 250., 100, -0.1, 1.e10, "i");
00160         setupversion_lumi->setAxisTitle("luminosity segment", 1);
00161         setupversion_lumi->setAxisTitle("prescale stup version", 2);
00162 
00163         gtfe_bx = dbe->book1D("gtfe_bx", "GTFE Bx number", 3600, 0., 3600.);
00164         gtfe_bx->setAxisTitle("GTFE BX number", 1);
00165 
00166         dbx_module = dbe->bookProfile("dbx_module",
00167                 "delta Bx of GT modules wrt. GTFE",
00168                 20, 0., 20., 100, -4000., 4000., "i");
00169         dbx_module->setAxisTitle("GT crate module", 1);
00170         dbx_module->setAxisTitle("Module Bx - GTFE Bx", 2);
00171         dbx_module->setBinLabel(1, "GTFEevm", 1);
00172         dbx_module->setBinLabel(2, "TCS", 1);
00173         dbx_module->setBinLabel(3, "FDL", 1);
00174         dbx_module->setBinLabel(4, "FDLloc", 1);
00175         dbx_module->setBinLabel(5, "PSB9", 1);
00176         dbx_module->setBinLabel(6, "PSB9loc", 1);
00177         dbx_module->setBinLabel(7, "PSB13", 1);
00178         dbx_module->setBinLabel(8, "PSB13loc", 1);
00179         dbx_module->setBinLabel(9, "PSB14", 1);
00180         dbx_module->setBinLabel(10, "PSB14loc", 1);
00181         dbx_module->setBinLabel(11, "PSB15", 1);
00182         dbx_module->setBinLabel(12, "PSB15loc", 1);
00183         dbx_module->setBinLabel(13, "PSB19", 1);
00184         dbx_module->setBinLabel(14, "PSB19loc", 1);
00185         dbx_module->setBinLabel(15, "PSB20", 1);
00186         dbx_module->setBinLabel(16, "PSB20loc", 1);
00187         dbx_module->setBinLabel(17, "PSB21", 1);
00188         dbx_module->setBinLabel(18, "PSB21loc", 1);
00189         dbx_module->setBinLabel(19, "GMT", 1);
00190 
00191         BST_MasterStatus = dbe->book2D("BST_MasterStatus",
00192                 "BST master status over lumi segment",
00193                 250, 0., 250., 6, -1., 5.);
00194         BST_MasterStatus->setAxisTitle("luminosity segment", 1);
00195         BST_MasterStatus->setAxisTitle("BST master status", 2);
00196         BST_MasterStatus->setBinLabel(2, "Master Beam 1", 2);
00197         BST_MasterStatus->setBinLabel(3, "Master Beam 2", 2);
00198 
00199         BST_turnCountNumber = dbe->book2D("BST_turnCountNumber",
00200                 "BST turn count over lumi segment",
00201                 250, 0., 250., 250, 0., 4.3e9);
00202         BST_turnCountNumber->setAxisTitle("luminosity segment", 1);
00203         BST_turnCountNumber->setAxisTitle("BST turn count number", 2);
00204 
00205         BST_lhcFillNumber = dbe->book1D("BST_lhcFillNumber",
00206                 "BST LHC fill number % 1000", 1000, 0., 1000.);
00207         BST_lhcFillNumber->setAxisTitle("BST LHC fill number modulo 1000");
00208 
00209         BST_beamMode = dbe->book2D("BST_beamMode",
00210                 "BST beam mode over lumi segment",
00211                 250, 0., 250., 25, 1., 26.);
00212         BST_beamMode->setAxisTitle("luminosity segment", 1);
00213         BST_beamMode->setAxisTitle("mode", 2);
00214         BST_beamMode->setBinLabel(1, "no mode", 2);
00215         BST_beamMode->setBinLabel(2, "setup", 2);
00216         BST_beamMode->setBinLabel(3, "inj pilot", 2);
00217         BST_beamMode->setBinLabel(4, "inj intr", 2);
00218         BST_beamMode->setBinLabel(5, "inj nomn", 2);
00219         BST_beamMode->setBinLabel(6, "pre ramp", 2);
00220         BST_beamMode->setBinLabel(7, "ramp", 2);
00221         BST_beamMode->setBinLabel(8, "flat top", 2);
00222         BST_beamMode->setBinLabel(9, "squeeze", 2);
00223         BST_beamMode->setBinLabel(10, "adjust", 2);
00224         BST_beamMode->setBinLabel(11, "stable", 2);
00225         BST_beamMode->setBinLabel(12, "unstable", 2);
00226         BST_beamMode->setBinLabel(13, "beam dump", 2);
00227         BST_beamMode->setBinLabel(14, "ramp down", 2);
00228         BST_beamMode->setBinLabel(15, "recovery", 2);
00229         BST_beamMode->setBinLabel(16, "inj dump", 2);
00230         BST_beamMode->setBinLabel(17, "circ dump", 2);
00231         BST_beamMode->setBinLabel(18, "abort", 2);
00232         BST_beamMode->setBinLabel(19, "cycling", 2);
00233         BST_beamMode->setBinLabel(20, "warn beam dump", 2);
00234         BST_beamMode->setBinLabel(21, "no beam", 2);
00235 
00236         BST_beamMomentum = dbe->book2D("BST_beamMomentum",
00237                 "BST beam momentum",
00238                 250, 0., 250., 100, 0., 7200.);
00239         BST_beamMomentum->setAxisTitle("luminosity segment", 1);
00240         BST_beamMomentum->setAxisTitle("beam momentum", 2);
00241 
00242         gpsfreq = dbe->book1D("gpsfreq", "clock frequency measured by GPS",
00243                 1000, 39.95, 40.2);
00244         gpsfreq->setAxisTitle("CMS clock frequency (MHz)");
00245 
00246         gpsfreqwide = dbe->book1D("gpsfreqwide",
00247                 "clock frequency measured by GPS", 1000, -2., 200.);
00248         gpsfreqwide->setAxisTitle("CMS clock frequency (MHz)");
00249 
00250         gpsfreqlum = dbe->book2D("gpsfreqlum",
00251                 "clock frequency measured by GPS",
00252                 250, 0., 250., 100, 39.95, 40.2);
00253         gpsfreqlum->setAxisTitle("luminosity segment", 1);
00254         gpsfreqlum->setAxisTitle("CMS clock frequency (MHz)", 2);
00255 
00256         BST_intensityBeam1 = dbe->book2D("BST_intensityBeam1",
00257                 "intensity beam 1",
00258                 250, 0., 250., 100, 0., 100.);
00259         BST_intensityBeam1->setAxisTitle("luminosity segment", 1);
00260         BST_intensityBeam1->setAxisTitle("beam intensity", 2);
00261 
00262         BST_intensityBeam2 = dbe->book2D("BST_intensityBeam2",
00263                 "intensity beam 2",
00264                 250, 0., 250., 100, 0., 100.);
00265         BST_intensityBeam2->setAxisTitle("luminosity segment", 1);
00266         BST_intensityBeam2->setAxisTitle("beam intensity", 2);
00267 
00268         m_monL1PrescaleFactorSet = dbe->book2D("L1PrescaleFactorSet",
00269                 "Index of L1 prescale factor set",
00270                 250, 0., 250., 25, 0., 25.);
00271         m_monL1PrescaleFactorSet->setAxisTitle("Luminosity segment", 1);
00272         m_monL1PrescaleFactorSet->setAxisTitle("L1 PF set index", 2);
00273 
00274     }
00275 }
00276 
00277 void L1TGT::endJob(void) {
00278 
00279     if (verbose_) {
00280         cout << "L1TGT: end job...." << endl;
00281     }
00282 
00283     LogInfo("EndJob") << "analyzed " << nev_ << " events";
00284 
00285     if (outputFile_.size() != 0 && dbe)
00286         dbe->save(outputFile_);
00287 
00288     return;
00289 }
00290 
00291 void L1TGT::analyze(const Event& e, const EventSetup& c) {
00292 
00293     nev_++;
00294 
00295     if (verbose_) {
00296         cout << "L1TGT: analyze...." << endl;
00297     }
00298 
00299     // initialize bx's to invalid value
00300     int tcsBx = -1;
00301     int gtfeEvmBx = -1;
00302 
00303     // open EVM readout record if available
00304     Handle<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord;
00305     e.getByLabel(gtEvmSource_, gtEvmReadoutRecord);
00306 
00307     if (!gtEvmReadoutRecord.isValid()) {
00308         edm::LogInfo("DataNotFound")
00309                 << "can't find L1GlobalTriggerEvmReadoutRecord with label "
00310                 << gtSource_.label();
00311     } else {
00312 
00313         // get all info from the EVM record if available and fill the histograms
00314 
00315         const L1GtfeWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
00316         const L1GtfeExtWord& gtfeEvmExtWord = gtEvmReadoutRecord->gtfeWord();
00317 
00318         gtfeEvmBx = gtfeEvmWord.bxNr();
00319         int gtfeEvmActiveBoards = gtfeEvmWord.activeBoards();
00320 
00321         if (isActive(gtfeEvmActiveBoards, TCS)) { // if TCS present in the record
00322 
00323             const L1TcsWord& tcsWord = gtEvmReadoutRecord->tcsWord();
00324             tcsBx = tcsWord.bxNr();
00325 
00326             event_type->Fill(tcsWord.triggerType());
00327             orbit_lumi->Fill(e.luminosityBlock(), tcsWord.orbitNr());
00328 
00329             trigger_number->Fill(tcsWord.partTrigNr());
00330             event_number->Fill(tcsWord.eventNr());
00331 
00332             trigger_lumi->Fill(e.luminosityBlock(), tcsWord.partTrigNr());
00333             event_lumi->Fill(e.luminosityBlock(), tcsWord.eventNr());
00334             evnum_trignum_lumi->Fill(e.luminosityBlock(),
00335                     double(tcsWord.eventNr()) / double(tcsWord.partTrigNr()));
00336 
00337             boost::uint16_t master = gtfeEvmExtWord.bstMasterStatus();
00338             boost::uint32_t turnCount = gtfeEvmExtWord.turnCountNumber();
00339             boost::uint32_t lhcFill = gtfeEvmExtWord.lhcFillNumber();
00340             boost::uint16_t beam = gtfeEvmExtWord.beamMode();
00341             boost::uint16_t momentum = gtfeEvmExtWord.beamMomentum();
00342             boost::uint32_t intensity1 = gtfeEvmExtWord.totalIntensityBeam1();
00343             boost::uint32_t intensity2 = gtfeEvmExtWord.totalIntensityBeam2();
00344 
00345             BST_MasterStatus->Fill(e.luminosityBlock(), (float) (master));
00346             BST_turnCountNumber->Fill(e.luminosityBlock(), (float) (turnCount));
00347             BST_lhcFillNumber->Fill((float) (lhcFill % 1000));
00348             BST_beamMode->Fill(e.luminosityBlock(), (float) (beam));
00349 
00350             BST_beamMomentum->Fill(e.luminosityBlock(), (float) (momentum));
00351             BST_intensityBeam1->Fill(e.luminosityBlock(), (float) (intensity1));
00352             BST_intensityBeam2->Fill(e.luminosityBlock(), (float) (intensity2));
00353 
00354             if (verbose_) {
00355                 cout << " check mode = " << beam << "    momentum " << momentum
00356                         << " int2 " << intensity2 << endl;
00357             }
00358 
00359             boost::uint64_t orb = tcsWord.orbitNr();
00360             boost::uint64_t gpsr = gtfeEvmExtWord.gpsTime();
00361             boost::uint64_t gpshi = (gpsr >> 32) & 0xffffffff;
00362             boost::uint64_t gpslo = gpsr & 0xffffffff;
00363             boost::uint64_t gps = gpshi * 1000000 + gpslo;
00364             //  cout << "  gpsr = " << hex << gpsr << " hi=" << gpshi << " lo=" << gpslo << " gps=" << gps << endl;
00365 
00366             Long64_t delorb = orb - preOrb_;
00367             Long64_t delgps = gps - preGps_;
00368             Double_t freq = -1.;
00369 
00370             if (delgps > 0) {
00371                 freq = ((Double_t)(delorb)) * 3564. / ((Double_t)(delgps));
00372             }
00373 
00374             if (delorb > 0) {
00375                 gpsfreq->Fill(freq);
00376                 gpsfreqwide->Fill(freq);
00377                 gpsfreqlum->Fill(e.luminosityBlock(), freq);
00378                 if (verbose_) {
00379                     if (freq > 200.) {
00380                         cout << " preOrb_ = " << preOrb_ << " orb=" << orb
00381                                 << " delorb=" << delorb << hex << " preGps_="
00382                                 << preGps_ << " gps=" << gps << dec
00383                                 << " delgps=" << delgps << " freq=" << freq
00384                                 << endl;
00385 
00386                     }
00387                 }
00388             }
00389 
00390             preGps_ = gps;
00391             preOrb_ = orb;
00392 
00393         }
00394     }
00395 
00396     // open GT DAQ readout record - exit if failed
00397     Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
00398     e.getByLabel(gtSource_, gtReadoutRecord);
00399 
00400     if (!gtReadoutRecord.isValid()) {
00401         edm::LogInfo("DataNotFound")
00402                 << "can't find L1GlobalTriggerReadoutRecord with label "
00403                 << gtSource_.label();
00404         return;
00405     }
00406 
00407     // initialize bx's to invalid value
00408     int gtfeBx = -1;
00409     int fdlBx[2] = { -1, -1 };
00410     int psbBx[2][7] = { { -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1,
00411             -1, -1 } };
00412     int gmtBx = -1;
00413 
00414     // get info from GTFE DAQ record
00415     const L1GtfeWord& gtfeWord = gtReadoutRecord->gtfeWord();
00416     gtfeBx = gtfeWord.bxNr();
00417     gtfe_bx->Fill(gtfeBx);
00418     setupversion_lumi->Fill(e.luminosityBlock(), gtfeWord.setupVersion());
00419     int gtfeActiveBoards = gtfeWord.activeBoards();
00420 
00421     // look for GMT readout collection from the same source if GMT active
00422     if (isActive(gtfeActiveBoards, GMT)) {
00423         edm::Handle<L1MuGMTReadoutCollection> gmtReadoutCollection;
00424         e.getByLabel(gtSource_, gmtReadoutCollection);
00425 
00426         if (gmtReadoutCollection.isValid()) {
00427             gmtBx = gmtReadoutCollection->getRecord().getBxNr();
00428         }
00429     }
00430 
00431     // get info from FDL if active (including decision word)
00432     if (isActive(gtfeActiveBoards, FDL)) {
00433         const L1GtFdlWord& fdlWord = gtReadoutRecord->gtFdlWord();
00434         fdlBx[0] = fdlWord.bxNr();
00435         fdlBx[1] = fdlWord.localBxNr();
00436 
00438         const DecisionWord& gtDecisionWord = gtReadoutRecord->decisionWord();
00439         const TechnicalTriggerWord& gtTTWord =
00440                 gtReadoutRecord->technicalTriggerWord();
00441 
00442         int dbitNumber = 0;
00443         DecisionWord::const_iterator GTdbitItr;
00444         algo_bits->Fill(-1.); // fill underflow to normalize
00445         for (GTdbitItr = gtDecisionWord.begin(); GTdbitItr
00446                 != gtDecisionWord.end(); GTdbitItr++) {
00447             if (*GTdbitItr) {
00448                 algo_bits->Fill(dbitNumber);
00449                 algo_bits_lumi->Fill(e.luminosityBlock(), dbitNumber);
00450                 int dbitNumber1 = 0;
00451                 DecisionWord::const_iterator GTdbitItr1;
00452                 for (GTdbitItr1 = gtDecisionWord.begin(); GTdbitItr1
00453                         != gtDecisionWord.end(); GTdbitItr1++) {
00454                     if (*GTdbitItr1)
00455                         algo_bits_corr->Fill(dbitNumber, dbitNumber1);
00456                     dbitNumber1++;
00457                 }
00458                 int tbitNumber1 = 0;
00459                 TechnicalTriggerWord::const_iterator GTtbitItr1;
00460                 for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1
00461                         != gtTTWord.end(); GTtbitItr1++) {
00462                     if (*GTtbitItr1)
00463                         tt_bits_corr->Fill(dbitNumber, tbitNumber1);
00464                     tbitNumber1++;
00465                 }
00466             }
00467             dbitNumber++;
00468         }
00469 
00470         int tbitNumber = 0;
00471         TechnicalTriggerWord::const_iterator GTtbitItr;
00472         tt_bits->Fill(-1.); // fill underflow to normalize
00473         for (GTtbitItr = gtTTWord.begin(); GTtbitItr != gtTTWord.end(); GTtbitItr++) {
00474             if (*GTtbitItr) {
00475                 tt_bits->Fill(tbitNumber);
00476                 tt_bits_lumi->Fill(e.luminosityBlock(), tbitNumber);
00477                 int tbitNumber1 = 0;
00478                 TechnicalTriggerWord::const_iterator GTtbitItr1;
00479                 for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1
00480                         != gtTTWord.end(); GTtbitItr1++) {
00481                     if (*GTtbitItr1)
00482                         tt_bits_corr->Fill(tbitNumber, tbitNumber1);
00483                     tbitNumber1++;
00484                 }
00485             }
00486             tbitNumber++;
00487         }
00488 
00489 
00490         // fill the index of actual prescale factor set
00491         // the index for technical triggers and algorithm trigger is the same (constraint in L1 GT TS)
00492         // so we read only pfIndexAlgoTrig (boost::uint16_t)
00493 
00494         const float pfIndexAlgoTrig = static_cast<float>(fdlWord.gtPrescaleFactorIndexAlgo());
00495         m_monL1PrescaleFactorSet->Fill(e.luminosityBlock(), pfIndexAlgoTrig);
00496 
00497 
00498     }
00499 
00500     // get info from active PSB's
00501     int ibit = PSB9; // first psb
00502     // for now hardcode psb id's - TODO - get them from Vasile's board maps...
00503     int psbID[7] = { 0xbb09, 0xbb0d, 0xbb0e, 0xbb0f, 0xbb13, 0xbb14, 0xbb15 };
00504     for (int i = 0; i < 7; i++) {
00505         if (isActive(gtfeActiveBoards, ibit)) {
00506             L1GtPsbWord psbWord = gtReadoutRecord->gtPsbWord(psbID[i]);
00507             psbBx[0][i] = psbWord.bxNr();
00508             psbBx[1][i] = psbWord.localBxNr();
00509         }
00510         ibit++;
00511     }
00512 
00513     //fill the dbx histo
00514     if (gtfeEvmBx > -1)
00515         dbx_module->Fill(0., gtfeEvmBx - gtfeBx);
00516     if (tcsBx > -1)
00517         dbx_module->Fill(1., tcsBx - gtfeBx);
00518     for (int i = 0; i < 2; i++) {
00519         if (fdlBx[i] > -1)
00520             dbx_module->Fill(2. + i, fdlBx[i] - gtfeBx);
00521     }
00522     for (int j = 0; j < 7; j++) {
00523         for (int i = 0; i < 2; i++) {
00524             if (psbBx[i][j] > -1)
00525                 dbx_module->Fill(4. + i + 2 * j, psbBx[i][j] - gtfeBx);
00526         }
00527     }
00528     if (gmtBx > -1)
00529         dbx_module->Fill(18., gmtBx - gtfeBx);
00530 
00531 }
00532 
00534 bool L1TGT::isActive(int word, int bit) {
00535     if (word & (1 << bit))
00536         return true;
00537     return false;
00538 }