CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes

L1TGT Class Reference

#include <L1TGT.h>

Inheritance diagram for L1TGT:
edm::EDAnalyzer

List of all members.

Public Member Functions

 L1TGT (const edm::ParameterSet &ps)
virtual ~L1TGT ()

Private Types

enum  activeDAQ {
  FDL = 0, PSB9, PSB13, PSB14,
  PSB15, PSB19, PSB20, PSB21,
  GMT
}
enum  activeEVM { TCS, FDLEVM }
typedef std::vector< std::pair
< int, int > >::const_iterator 
CItVecPair

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
void bookHistograms ()
 book all histograms for the module
virtual void endJob ()
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 end section
virtual void endRun (const edm::Run &, const edm::EventSetup &)
bool isActive (int word, int bit)

Private Attributes

MonitorElementalgo_bits
MonitorElementalgo_bits_corr
MonitorElementalgo_bits_lumi
MonitorElementalgo_tt_bits_corr
MonitorElementBST_beamMode
MonitorElementBST_beamMomentum
MonitorElementBST_intensityBeam1
MonitorElementBST_intensityBeam2
MonitorElementBST_lhcFillNumber
MonitorElementBST_MasterStatus
MonitorElementBST_turnCountNumber
MonitorElementdbx_module
MonitorElementevent_lumi
MonitorElementevent_number
MonitorElementevent_type
MonitorElementevnum_trignum_lumi
MonitorElementgpsfreq
MonitorElementgpsfreqlum
MonitorElementgpsfreqwide
edm::InputTag gtEvmSource_
 input tag for L1 GT EVM readout record
MonitorElementgtfe_bx
edm::InputTag gtSource_
 input parameters
DQMStorem_dbe
 internal members
std::string m_histFolder
 histogram folder for L1 GT plots
MonitorElementm_monL1PfIndicesPerLs
MonitorElementm_monL1PrescaleFactorSet
MonitorElementm_monLsNrDiffTcsFdlEvm
MonitorElementm_monLsNrDiffTcsFdlEvmLs
MonitorElementm_monOrbitNrDiffTcsFdlEvm
MonitorElementm_monOrbitNrDiffTcsFdlEvmLs
int m_nrEvJob
 number of events processed
int m_nrEvRun
std::vector< std::pair< int,
int > > 
m_pairLsNumberPfIndex
int m_previousLS
int m_previousPfIndex
MonitorElementorbit_lumi
std::string outputFile_
 file name for ROOT output
boost::uint64_t preGps_
boost::uint64_t preOrb_
MonitorElementsetupversion_lumi
MonitorElementtrigger_lumi
MonitorElementtrigger_number
MonitorElementtt_bits
MonitorElementtt_bits_corr
MonitorElementtt_bits_lumi
bool verbose_
 verbosity switch

Static Private Attributes

static const int MaxLsNrDiffTcsFdlEvm = 24
static const int MaxOrbitNrDiffTcsFdlEvm = 24

Detailed Description

Description: DQM for L1 Global Trigger.

Author:
J. Berryhill, I. Mikulec
Vasile Mihai Ghete - HEPHY Vienna
Date:
2012/04/04 09:56:36
Revision:
1.11

Description: DQM for L1 Global Trigger.

Author:
J. Berryhill, I. Mikulec
Vasile Mihai Ghete - HEPHY Vienna
Date:
2012/04/04 09:56:36
Revision:
1.23

Definition at line 42 of file L1TGT.h.


Member Typedef Documentation

typedef std::vector<std::pair<int, int> >::const_iterator L1TGT::CItVecPair [private]

Definition at line 184 of file L1TGT.h.


Member Enumeration Documentation

enum L1TGT::activeDAQ [private]
Enumerator:
FDL 
PSB9 
PSB13 
PSB14 
PSB15 
PSB19 
PSB20 
PSB21 
GMT 

Definition at line 84 of file L1TGT.h.

                   {
        FDL = 0, PSB9, PSB13, PSB14, PSB15, PSB19, PSB20, PSB21, GMT
    };
enum L1TGT::activeEVM [private]
Enumerator:
TCS 
FDLEVM 

Definition at line 90 of file L1TGT.h.

                   {
        TCS, FDLEVM
    };

Constructor & Destructor Documentation

L1TGT::L1TGT ( const edm::ParameterSet ps)

Definition at line 22 of file L1TGT.cc.

References edm::ParameterSet::getUntrackedParameter(), m_dbe, m_histFolder, m_pairLsNumberPfIndex, and cppFunctionSkipper::operator.

                                      :
            gtSource_(ps.getParameter<edm::InputTag> ("gtSource")),
            gtEvmSource_(ps.getParameter<edm::InputTag> ("gtEvmSource")),
            verbose_(ps.getUntrackedParameter<bool> ("verbose", false)),
            m_dbe(0),
            //
            m_nrEvJob(0), m_nrEvRun(0),
            preGps_(0ULL), preOrb_(0ULL),
            m_previousLS(-1),
            m_previousPfIndex(-1)
{

    m_histFolder = ps.getUntrackedParameter<std::string> ("HistFolder",
            "L1T/L1TGT");

    m_dbe = edm::Service<DQMStore>().operator->();
    if (m_dbe == 0) {
        edm::LogInfo("L1TGT") << "\n Unable to get DQMStore service.";
    } else {

        m_dbe->setVerbose(0);
        m_dbe->setCurrentFolder(m_histFolder);

    }

    // reserve space for 1000 LS
    m_pairLsNumberPfIndex.reserve(1000);
}
L1TGT::~L1TGT ( ) [virtual]

Definition at line 51 of file L1TGT.cc.

              {

    // empty
}

Member Function Documentation

void L1TGT::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
) [private, virtual]

get Global Trigger algo and technical trigger bit statistics

Implements edm::EDAnalyzer.

Definition at line 102 of file L1TGT.cc.

References L1GtfeWord::activeBoards(), algo_bits, algo_bits_corr, algo_bits_lumi, L1GtfeExtWord::beamMode(), L1GtfeExtWord::beamMomentum(), BST_beamMode, BST_beamMomentum, BST_intensityBeam1, BST_intensityBeam2, BST_lhcFillNumber, BST_MasterStatus, BST_turnCountNumber, L1GtfeExtWord::bstMasterStatus(), L1GtfeWord::bxNr(), L1GtPsbWord::bxNr(), L1TcsWord::bxNr(), L1GtFdlWord::bxNr(), dbx_module, event_lumi, event_number, event_type, L1TcsWord::eventNr(), evnum_trignum_lumi, FDL, MonitorElement::Fill(), spr::find(), edm::Event::getByLabel(), GMT, gpsfreq, gpsfreqlum, gpsfreqwide, L1GtfeExtWord::gpsTime(), gtEvmSource_, gtfe_bx, L1GtFdlWord::gtPrescaleFactorIndexAlgo(), gtSource_, i, isActive(), edm::HandleBase::isValid(), j, edm::InputTag::label(), L1GtfeExtWord::lhcFillNumber(), L1GtPsbWord::localBxNr(), L1GtFdlWord::localBxNr(), edm::EventBase::luminosityBlock(), L1TcsWord::luminositySegmentNr(), L1GtFdlWord::lumiSegmentNr(), m_monL1PrescaleFactorSet, m_monLsNrDiffTcsFdlEvm, m_monLsNrDiffTcsFdlEvmLs, m_monOrbitNrDiffTcsFdlEvm, m_monOrbitNrDiffTcsFdlEvmLs, m_nrEvJob, m_pairLsNumberPfIndex, m_previousLS, m_previousPfIndex, funct::master(), MaxLsNrDiffTcsFdlEvm, MaxOrbitNrDiffTcsFdlEvm, orbit_lumi, L1TcsWord::orbitNr(), L1GtFdlWord::orbitNr(), edm::EventBase::orbitNumber(), L1TcsWord::partTrigNr(), preGps_, preOrb_, PSB9, L1GtfeWord::setupVersion(), setupversion_lumi, TCS, L1GtfeExtWord::totalIntensityBeam1(), L1GtfeExtWord::totalIntensityBeam2(), trigger_lumi, trigger_number, L1TcsWord::triggerType(), tt_bits, tt_bits_corr, tt_bits_lumi, L1GtfeExtWord::turnCountNumber(), and verbose_.

                                                                        {

    m_nrEvJob++;

    if (verbose_) {
        edm::LogInfo("L1TGT") << "L1TGT: analyze...." << std::endl;
    }

    // initialize Bx, orbit number, luminosity segment number to invalid value
    int tcsBx = -1;
    int gtfeEvmBx = -1;

    long long int orbitTcs = -1;
    int orbitEvmFdl = -1;

    int lsTcs = -1;
    int lsEvmFdl = -1;

    // get once only the LS block number, to be used in many histograms
    const int lsNumber = iEvent.luminosityBlock();

    // open EVM readout record if available
    edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord;
    iEvent.getByLabel(gtEvmSource_, gtEvmReadoutRecord);

    if (!gtEvmReadoutRecord.isValid()) {
        edm::LogInfo("L1TGT")
                << "can't find L1GlobalTriggerEvmReadoutRecord with label "
                << gtSource_.label();
    } else {

        // get all info from the EVM record if available and fill the histograms

        const L1GtfeWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
        const L1GtfeExtWord& gtfeEvmExtWord = gtEvmReadoutRecord->gtfeWord();

        gtfeEvmBx = gtfeEvmWord.bxNr();
        int gtfeEvmActiveBoards = gtfeEvmWord.activeBoards();

        if (isActive(gtfeEvmActiveBoards, TCS)) { // if TCS present in the record

            const L1TcsWord& tcsWord = gtEvmReadoutRecord->tcsWord();

            tcsBx = tcsWord.bxNr();
            orbitTcs = tcsWord.orbitNr();
            lsTcs = tcsWord.luminositySegmentNr();

            event_type->Fill(tcsWord.triggerType());
            orbit_lumi->Fill(lsNumber, orbitTcs);

            trigger_number->Fill(tcsWord.partTrigNr());
            event_number->Fill(tcsWord.eventNr());

            trigger_lumi->Fill(lsNumber, tcsWord.partTrigNr());
            event_lumi->Fill(lsNumber, tcsWord.eventNr());
            evnum_trignum_lumi->Fill(lsNumber,
                    double(tcsWord.eventNr()) / double(tcsWord.partTrigNr()));

            boost::uint16_t master = gtfeEvmExtWord.bstMasterStatus();
            boost::uint32_t turnCount = gtfeEvmExtWord.turnCountNumber();
            boost::uint32_t lhcFill = gtfeEvmExtWord.lhcFillNumber();
            boost::uint16_t beam = gtfeEvmExtWord.beamMode();
            boost::uint16_t momentum = gtfeEvmExtWord.beamMomentum();
            boost::uint32_t intensity1 = gtfeEvmExtWord.totalIntensityBeam1();
            boost::uint32_t intensity2 = gtfeEvmExtWord.totalIntensityBeam2();

            BST_MasterStatus->Fill(lsNumber, (float) (master));
            BST_turnCountNumber->Fill(lsNumber, (float) (turnCount));
            BST_lhcFillNumber->Fill((float) (lhcFill % 1000));
            BST_beamMode->Fill(lsNumber, (float) (beam));

            BST_beamMomentum->Fill(lsNumber, (float) (momentum));
            BST_intensityBeam1->Fill(lsNumber, (float) (intensity1));
            BST_intensityBeam2->Fill(lsNumber, (float) (intensity2));

            if (verbose_) {
                edm::LogInfo("L1TGT") << " check mode = " << beam << "    momentum " << momentum
                        << " int2 " << intensity2 << std::endl;
            }

            boost::uint64_t gpsr = gtfeEvmExtWord.gpsTime();
            boost::uint64_t gpshi = (gpsr >> 32) & 0xffffffff;
            boost::uint64_t gpslo = gpsr & 0xffffffff;
            boost::uint64_t gps = gpshi * 1000000 + gpslo;
            //  edm::LogInfo("L1TGT") << "  gpsr = " << std::hex << gpsr << " hi=" << gpshi << " lo=" << gpslo << " gps=" << gps << std::endl;

            Long64_t delorb = orbitTcs - preOrb_;
            Long64_t delgps = gps - preGps_;
            Double_t freq = -1.;

            if (delgps > 0) {
                freq = ((Double_t)(delorb)) * 3564. / ((Double_t)(delgps));
            }

            if (delorb > 0) {
                gpsfreq->Fill(freq);
                gpsfreqwide->Fill(freq);
                gpsfreqlum->Fill(lsNumber, freq);
                if (verbose_) {
                    if (freq > 200.) {
                        edm::LogInfo("L1TGT") << " preOrb_ = " << preOrb_ << " orbitTcs=" << orbitTcs
                                << " delorb=" << delorb << std::hex << " preGps_="
                                << preGps_ << " gps=" << gps << std::dec
                                << " delgps=" << delgps << " freq=" << freq
                                << std::endl;

                    }
                }
            }

            preGps_ = gps;
            preOrb_ = orbitTcs;

        }

        // get info from FDL if active
        if (isActive(gtfeEvmActiveBoards, FDL)) {
            const L1GtFdlWord& fdlWord = gtEvmReadoutRecord->gtFdlWord();

            orbitEvmFdl = fdlWord.orbitNr();
            lsEvmFdl = fdlWord.lumiSegmentNr();
        }

        if ((orbitTcs >= 0) && (orbitEvmFdl >= 0)) {

            int diffOrbit = static_cast<float> (orbitTcs - orbitEvmFdl);
            edm::LogInfo("L1TGT") << "\n orbitTcs = " << orbitTcs << " orbitEvmFdl = "
                    << orbitEvmFdl << " diffOrbit = " << diffOrbit
                    << " orbitEvent = " << iEvent.orbitNumber() << std::endl;

            if (diffOrbit >= MaxOrbitNrDiffTcsFdlEvm) {
                m_monOrbitNrDiffTcsFdlEvm->Fill(MaxOrbitNrDiffTcsFdlEvm);

            } else if (diffOrbit <= -MaxOrbitNrDiffTcsFdlEvm) {
                m_monOrbitNrDiffTcsFdlEvm->Fill(-MaxOrbitNrDiffTcsFdlEvm);

            } else {
                m_monOrbitNrDiffTcsFdlEvm->Fill(diffOrbit);
                m_monOrbitNrDiffTcsFdlEvmLs->Fill(lsNumber,
                        diffOrbit);

            }

        } else {

            if (orbitTcs >= 0) {
                // EVM_FDL error
                m_monOrbitNrDiffTcsFdlEvm->Fill(MaxOrbitNrDiffTcsFdlEvm);
            } else if (orbitEvmFdl >= 0) {
                // TCS error
                m_monOrbitNrDiffTcsFdlEvm->Fill(-MaxOrbitNrDiffTcsFdlEvm);

            } else {
                // TCS and EVM_FDL error
                m_monOrbitNrDiffTcsFdlEvm->Fill(-MaxOrbitNrDiffTcsFdlEvm);
                m_monOrbitNrDiffTcsFdlEvm->Fill(MaxOrbitNrDiffTcsFdlEvm);
            }
        }

        if ((lsTcs >= 0) && (lsEvmFdl >= 0)) {

            int diffLs = static_cast<float> (lsTcs - lsEvmFdl);
            edm::LogInfo("L1TGT") << "\n lsTcs = " << lsTcs << " lsEvmFdl = " << lsEvmFdl
                    << " diffLs = " << diffLs << " lsEvent = "
                    << lsNumber << std::endl;

            if (diffLs >= MaxLsNrDiffTcsFdlEvm) {
                m_monLsNrDiffTcsFdlEvm->Fill(MaxLsNrDiffTcsFdlEvm);

            } else if (diffLs <= -MaxLsNrDiffTcsFdlEvm) {
                m_monLsNrDiffTcsFdlEvm->Fill(-MaxLsNrDiffTcsFdlEvm);

            } else {
                m_monLsNrDiffTcsFdlEvm->Fill(diffLs);
                m_monLsNrDiffTcsFdlEvmLs->Fill(lsNumber, diffLs);

            }

        } else {

            if (lsTcs >= 0) {
                // EVM_FDL error
                m_monLsNrDiffTcsFdlEvm->Fill(MaxLsNrDiffTcsFdlEvm);
            } else if (lsEvmFdl >= 0) {
                // TCS error
                m_monLsNrDiffTcsFdlEvm->Fill(-MaxLsNrDiffTcsFdlEvm);

            } else {
                // TCS and EVM_FDL error
                m_monLsNrDiffTcsFdlEvm->Fill(-MaxLsNrDiffTcsFdlEvm);
                m_monLsNrDiffTcsFdlEvm->Fill(MaxLsNrDiffTcsFdlEvm);
            }
        }

    }

    // open GT DAQ readout record - exit if failed
    edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
    iEvent.getByLabel(gtSource_, gtReadoutRecord);

    if (!gtReadoutRecord.isValid()) {
        edm::LogInfo("L1TGT")
                << "can't find L1GlobalTriggerReadoutRecord with label "
                << gtSource_.label();
        return;
    }

    // initialize bx's to invalid value
    int gtfeBx = -1;
    int fdlBx[2] = { -1, -1 };
    int psbBx[2][7] = { { -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1,
            -1, -1 } };
    int gmtBx = -1;

    // get info from GTFE DAQ record
    const L1GtfeWord& gtfeWord = gtReadoutRecord->gtfeWord();
    gtfeBx = gtfeWord.bxNr();
    gtfe_bx->Fill(gtfeBx);
    setupversion_lumi->Fill(lsNumber, gtfeWord.setupVersion());
    int gtfeActiveBoards = gtfeWord.activeBoards();

    // look for GMT readout collection from the same source if GMT active
    if (isActive(gtfeActiveBoards, GMT)) {
        edm::Handle<L1MuGMTReadoutCollection> gmtReadoutCollection;
        iEvent.getByLabel(gtSource_, gmtReadoutCollection);

        if (gmtReadoutCollection.isValid()) {
            gmtBx = gmtReadoutCollection->getRecord().getBxNr();
        }
    }

    // get info from FDL if active (including decision word)
    if (isActive(gtfeActiveBoards, FDL)) {
        const L1GtFdlWord& fdlWord = gtReadoutRecord->gtFdlWord();
        fdlBx[0] = fdlWord.bxNr();
        fdlBx[1] = fdlWord.localBxNr();

        const DecisionWord& gtDecisionWord = gtReadoutRecord->decisionWord();
        const TechnicalTriggerWord& gtTTWord =
                gtReadoutRecord->technicalTriggerWord();

        int dbitNumber = 0;
        DecisionWord::const_iterator GTdbitItr;
        algo_bits->Fill(-1.); // fill underflow to normalize
        for (GTdbitItr = gtDecisionWord.begin(); GTdbitItr
                != gtDecisionWord.end(); GTdbitItr++) {
            if (*GTdbitItr) {
                algo_bits->Fill(dbitNumber);
                algo_bits_lumi->Fill(lsNumber, dbitNumber);
                int dbitNumber1 = 0;
                DecisionWord::const_iterator GTdbitItr1;
                for (GTdbitItr1 = gtDecisionWord.begin(); GTdbitItr1
                        != gtDecisionWord.end(); GTdbitItr1++) {
                    if (*GTdbitItr1)
                        algo_bits_corr->Fill(dbitNumber, dbitNumber1);
                    dbitNumber1++;
                }
                int tbitNumber1 = 0;
                TechnicalTriggerWord::const_iterator GTtbitItr1;
                for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1
                        != gtTTWord.end(); GTtbitItr1++) {
                    if (*GTtbitItr1)
                        tt_bits_corr->Fill(dbitNumber, tbitNumber1);
                    tbitNumber1++;
                }
            }
            dbitNumber++;
        }

        int tbitNumber = 0;
        TechnicalTriggerWord::const_iterator GTtbitItr;
        tt_bits->Fill(-1.); // fill underflow to normalize
        for (GTtbitItr = gtTTWord.begin(); GTtbitItr != gtTTWord.end(); GTtbitItr++) {
            if (*GTtbitItr) {
                tt_bits->Fill(tbitNumber);
                tt_bits_lumi->Fill(lsNumber, tbitNumber);
                int tbitNumber1 = 0;
                TechnicalTriggerWord::const_iterator GTtbitItr1;
                for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1
                        != gtTTWord.end(); GTtbitItr1++) {
                    if (*GTtbitItr1)
                        tt_bits_corr->Fill(tbitNumber, tbitNumber1);
                    tbitNumber1++;
                }
            }
            tbitNumber++;
        }


        // fill the index of actual prescale factor set
        // the index for technical triggers and algorithm trigger is the same (constraint in L1 GT TS)
        // so we read only pfIndexAlgoTrig (boost::uint16_t)

        const int pfIndexAlgoTrig = fdlWord.gtPrescaleFactorIndexAlgo();
        m_monL1PrescaleFactorSet->Fill(lsNumber,
                static_cast<float> (pfIndexAlgoTrig));

        //

        // check that the combination (pfIndex, lsNumber) is not already included
        // to avoid fake entries due to different event order

        std::pair<int, int> pairLsPfi = std::make_pair(lsNumber,
                pfIndexAlgoTrig);

        CItVecPair cIt = find(m_pairLsNumberPfIndex.begin(),
                m_pairLsNumberPfIndex.end(), pairLsPfi);

        if (cIt == m_pairLsNumberPfIndex.end()) {

            m_pairLsNumberPfIndex.push_back(pairLsPfi);

            m_previousPfIndex = pfIndexAlgoTrig;
            m_previousLS = lsNumber;
        }

    }

    // get info from active PSB's
    int ibit = PSB9; // first psb
    // for now hardcode psb id's - TODO - get them from Vasile's board maps...
    int psbID[7] = { 0xbb09, 0xbb0d, 0xbb0e, 0xbb0f, 0xbb13, 0xbb14, 0xbb15 };
    for (int i = 0; i < 7; i++) {
        if (isActive(gtfeActiveBoards, ibit)) {
            L1GtPsbWord psbWord = gtReadoutRecord->gtPsbWord(psbID[i]);
            psbBx[0][i] = psbWord.bxNr();
            psbBx[1][i] = psbWord.localBxNr();
        }
        ibit++;
    }

    //fill the dbx histo
    if (gtfeEvmBx > -1)
        dbx_module->Fill(0., gtfeEvmBx - gtfeBx);
    if (tcsBx > -1)
        dbx_module->Fill(1., tcsBx - gtfeBx);
    for (int i = 0; i < 2; i++) {
        if (fdlBx[i] > -1)
            dbx_module->Fill(2. + i, fdlBx[i] - gtfeBx);
    }
    for (int j = 0; j < 7; j++) {
        for (int i = 0; i < 2; i++) {
            if (psbBx[i][j] > -1)
                dbx_module->Fill(4. + i + 2 * j, psbBx[i][j] - gtfeBx);
        }
    }
    if (gmtBx > -1)
        dbx_module->Fill(18., gmtBx - gtfeBx);

}
void L1TGT::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file L1TGT.cc.

References m_nrEvJob, preGps_, and preOrb_.

                     {

    m_nrEvJob = 0;

    preGps_ = 0ULL;
    preOrb_ = 0ULL;

}
void L1TGT::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup evSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 93 of file L1TGT.cc.

                                      {

    //

}
void L1TGT::beginRun ( const edm::Run iRun,
const edm::EventSetup evSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file L1TGT.cc.

References bookHistograms(), DQMStore::dirExists(), m_dbe, m_histFolder, m_nrEvRun, m_pairLsNumberPfIndex, cppFunctionSkipper::operator, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

                                                                     {

    m_nrEvRun = 0;

    m_dbe = edm::Service<DQMStore>().operator->();

    if (m_dbe == 0) {
        edm::LogInfo("L1TGT") << "\n Unable to get DQMStore service.";
    } else {

        // clean up directory
        m_dbe->setCurrentFolder(m_histFolder);
        if (m_dbe->dirExists(m_histFolder)) {
            m_dbe->rmdir(m_histFolder);
        }

        m_dbe->setCurrentFolder(m_histFolder);

    }

    // book histograms
    bookHistograms();

    // clear bookkeeping for prescale factor change
    m_pairLsNumberPfIndex.clear();

}
void L1TGT::bookHistograms ( ) [private]

book all histograms for the module

Definition at line 505 of file L1TGT.cc.

References algo_bits, algo_bits_corr, algo_bits_lumi, algo_tt_bits_corr, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), BST_beamMode, BST_beamMomentum, BST_intensityBeam1, BST_intensityBeam2, BST_lhcFillNumber, BST_MasterStatus, BST_turnCountNumber, dbx_module, event_lumi, event_number, event_type, evnum_trignum_lumi, gpsfreq, gpsfreqlum, gpsfreqwide, gtfe_bx, m_dbe, m_histFolder, m_monL1PfIndicesPerLs, m_monL1PrescaleFactorSet, m_monLsNrDiffTcsFdlEvm, m_monLsNrDiffTcsFdlEvmLs, m_monOrbitNrDiffTcsFdlEvm, m_monOrbitNrDiffTcsFdlEvmLs, MaxLsNrDiffTcsFdlEvm, MaxOrbitNrDiffTcsFdlEvm, orbit_lumi, MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), setupversion_lumi, trigger_lumi, trigger_number, tt_bits, tt_bits_corr, and tt_bits_lumi.

Referenced by beginRun().

                           {

    const int TotalNrBinsLs = 1000;
    const double totalNrBinsLs = static_cast<double>(TotalNrBinsLs);

    if (m_dbe) {
        m_dbe->setCurrentFolder(m_histFolder);

        algo_bits = m_dbe->book1D("algo_bits", "GT algo bits", 128, -0.5, 127.5);
        algo_bits->setAxisTitle("algorithm bits", 1);

        algo_bits_corr = m_dbe->book2D("algo_bits_corr",
                "GT algo bit correlation",
                128, -0.5, 127.5, 128, -0.5, 127.5);
        algo_bits_corr->setAxisTitle("algorithm bits", 1);
        algo_bits_corr->setAxisTitle("algorithm bits", 2);

        tt_bits = m_dbe->book1D("tt_bits",
                "GT technical trigger bits",
                64, -0.5, 63.5);
        tt_bits->setAxisTitle("technical trigger bits", 1);

        tt_bits_corr = m_dbe->book2D("tt_bits_corr",
                "GT tech. trig. bit correlation",
                64, -0.5, 63.5, 64, -0.5, 63.5);
        tt_bits_corr->setAxisTitle("technical trigger bits", 1);
        tt_bits_corr->setAxisTitle("technical trigger bits", 2);

        algo_tt_bits_corr = m_dbe->book2D("algo_tt_bits_corr",
                "GT algo tech. trig. bit correlation",
                128, -0.5, 127.5, 64, -0.5, 63.5);
        algo_tt_bits_corr->setAxisTitle("algorithm bits", 1);
        algo_tt_bits_corr->setAxisTitle("technical trigger bits", 2);

        algo_bits_lumi = m_dbe->book2D("algo_bits_lumi",
                "GT algo bit rate per lumi segment",
                TotalNrBinsLs, 0., totalNrBinsLs, 128, -0.5, 127.5);
        algo_bits_lumi->setAxisTitle("Luminosity segment", 1);
        algo_bits_lumi->setAxisTitle("Algorithm bits", 2);

        tt_bits_lumi = m_dbe->book2D("tt_bits_lumi",
                "GT tech. trig. bit rate per lumi segment",
                TotalNrBinsLs, 0., totalNrBinsLs, 64, -0.5, 63.5);
        tt_bits_lumi->setAxisTitle("Luminosity segment", 1);
        tt_bits_lumi->setAxisTitle("Technical trigger bits", 2);

        event_type = m_dbe->book1D("event_type", "GT event type", 10, -0.5, 9.5);
        event_type->setAxisTitle("event type", 1);
        event_type->setBinLabel(2, "Physics", 1);
        event_type->setBinLabel(3, "Calibration", 1);
        event_type->setBinLabel(4, "Random", 1);
        event_type->setBinLabel(6, "Traced", 1);
        event_type->setBinLabel(7, "Test", 1);
        event_type->setBinLabel(8, "Error", 1);

        event_number = m_dbe->book1D("event_number",
                "GT Event number (from last resync)",
                100, 0., 50000.);
        event_number->setAxisTitle("event number", 1);

        event_lumi = m_dbe->bookProfile("event_lumi",
                "GT Event number (from last resync) vs lumi section",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15, "s");
        event_lumi->setAxisTitle("Luminosity segment", 1);
        event_lumi->setAxisTitle("event number", 2);

        trigger_number = m_dbe->book1D("trigger_number",
                "GT Trigger number (from start run)",
                100, 0., 50000.);
        trigger_number->setAxisTitle("trigger number", 1);

        trigger_lumi = m_dbe->bookProfile("trigger_lumi",
                "GT Trigger number (from start run) vs lumi section",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15, "s");
        trigger_lumi->setAxisTitle("Luminosity segment", 1);
        trigger_lumi->setAxisTitle("Trigger number", 2);

        evnum_trignum_lumi = m_dbe->bookProfile("evnum_trignum_lumi",
                "GT Event/Trigger number ratio vs lumi section",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 2., "s");
        evnum_trignum_lumi->setAxisTitle("Luminosity segment", 1);
        evnum_trignum_lumi->setAxisTitle("Event/trigger number ratio", 2);

        orbit_lumi = m_dbe->bookProfile("orbit_lumi",
                "GT orbit number vs lumi section",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15, "s");
        orbit_lumi->setAxisTitle("Luminosity segment", 1);
        orbit_lumi->setAxisTitle("Orbit number", 2);

        setupversion_lumi = m_dbe->bookProfile("setupversion_lumi",
                "GT setup version vs lumi section",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e10, "i");
        setupversion_lumi->setAxisTitle("Luminosity segment", 1);
        setupversion_lumi->setAxisTitle("Setup version", 2);

        gtfe_bx = m_dbe->book1D("gtfe_bx", "GTFE Bx number", 3600, 0., 3600.);
        gtfe_bx->setAxisTitle("GTFE BX number", 1);

        dbx_module = m_dbe->bookProfile("dbx_module",
                "delta Bx of GT modules wrt. GTFE",
                20, 0., 20., 100, -4000., 4000., "i");
        dbx_module->setAxisTitle("GT crate module", 1);
        dbx_module->setAxisTitle("Module Bx - GTFE Bx", 2);
        dbx_module->setBinLabel(1, "GTFEevm", 1);
        dbx_module->setBinLabel(2, "TCS", 1);
        dbx_module->setBinLabel(3, "FDL", 1);
        dbx_module->setBinLabel(4, "FDLloc", 1);
        dbx_module->setBinLabel(5, "PSB9", 1);
        dbx_module->setBinLabel(6, "PSB9loc", 1);
        dbx_module->setBinLabel(7, "PSB13", 1);
        dbx_module->setBinLabel(8, "PSB13loc", 1);
        dbx_module->setBinLabel(9, "PSB14", 1);
        dbx_module->setBinLabel(10, "PSB14loc", 1);
        dbx_module->setBinLabel(11, "PSB15", 1);
        dbx_module->setBinLabel(12, "PSB15loc", 1);
        dbx_module->setBinLabel(13, "PSB19", 1);
        dbx_module->setBinLabel(14, "PSB19loc", 1);
        dbx_module->setBinLabel(15, "PSB20", 1);
        dbx_module->setBinLabel(16, "PSB20loc", 1);
        dbx_module->setBinLabel(17, "PSB21", 1);
        dbx_module->setBinLabel(18, "PSB21loc", 1);
        dbx_module->setBinLabel(19, "GMT", 1);

        BST_MasterStatus = m_dbe->book2D("BST_MasterStatus",
                "BST master status over lumi segment",
                TotalNrBinsLs, 0., totalNrBinsLs, 6, -1., 5.);
        BST_MasterStatus->setAxisTitle("Luminosity segment", 1);
        BST_MasterStatus->setAxisTitle("BST master status", 2);
        BST_MasterStatus->setBinLabel(2, "Master Beam 1", 2);
        BST_MasterStatus->setBinLabel(3, "Master Beam 2", 2);

        BST_turnCountNumber = m_dbe->book2D("BST_turnCountNumber",
                "BST turn count over lumi segment",
                TotalNrBinsLs, 0., totalNrBinsLs, 250, 0., 4.3e9);
        BST_turnCountNumber->setAxisTitle("Luminosity segment", 1);
        BST_turnCountNumber->setAxisTitle("BST turn count number", 2);

        BST_lhcFillNumber = m_dbe->book1D("BST_lhcFillNumber",
                "BST LHC fill number % 1000", 1000, 0., 1000.);
        BST_lhcFillNumber->setAxisTitle("BST LHC fill number modulo 1000");

        BST_beamMode = m_dbe->book2D("BST_beamMode",
                "BST beam mode over lumi segment",
                TotalNrBinsLs, 0., totalNrBinsLs, 25, 1., 26.);
        BST_beamMode->setAxisTitle("Luminosity segment", 1);
        BST_beamMode->setAxisTitle("mode", 2);
        BST_beamMode->setBinLabel(1, "no mode", 2);
        BST_beamMode->setBinLabel(2, "setup", 2);
        BST_beamMode->setBinLabel(3, "inj pilot", 2);
        BST_beamMode->setBinLabel(4, "inj intr", 2);
        BST_beamMode->setBinLabel(5, "inj nomn", 2);
        BST_beamMode->setBinLabel(6, "pre ramp", 2);
        BST_beamMode->setBinLabel(7, "ramp", 2);
        BST_beamMode->setBinLabel(8, "flat top", 2);
        BST_beamMode->setBinLabel(9, "squeeze", 2);
        BST_beamMode->setBinLabel(10, "adjust", 2);
        BST_beamMode->setBinLabel(11, "stable", 2);
        BST_beamMode->setBinLabel(12, "unstable", 2);
        BST_beamMode->setBinLabel(13, "beam dump", 2);
        BST_beamMode->setBinLabel(14, "ramp down", 2);
        BST_beamMode->setBinLabel(15, "recovery", 2);
        BST_beamMode->setBinLabel(16, "inj dump", 2);
        BST_beamMode->setBinLabel(17, "circ dump", 2);
        BST_beamMode->setBinLabel(18, "abort", 2);
        BST_beamMode->setBinLabel(19, "cycling", 2);
        BST_beamMode->setBinLabel(20, "warn beam dump", 2);
        BST_beamMode->setBinLabel(21, "no beam", 2);

        BST_beamMomentum = m_dbe->book2D("BST_beamMomentum",
                "BST beam momentum",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, 0., 7200.);
        BST_beamMomentum->setAxisTitle("Luminosity segment", 1);
        BST_beamMomentum->setAxisTitle("Beam momentum", 2);

        gpsfreq = m_dbe->book1D("gpsfreq", "clock frequency measured by GPS",
                1000, 39.95, 40.2);
        gpsfreq->setAxisTitle("CMS clock frequency (MHz)");

        gpsfreqwide = m_dbe->book1D("gpsfreqwide",
                "clock frequency measured by GPS", 1000, -2., 200.);
        gpsfreqwide->setAxisTitle("CMS clock frequency (MHz)");

        gpsfreqlum = m_dbe->book2D("gpsfreqlum",
                "clock frequency measured by GPS",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, 39.95, 40.2);
        gpsfreqlum->setAxisTitle("Luminosity segment", 1);
        gpsfreqlum->setAxisTitle("CMS clock frequency (MHz)", 2);

        BST_intensityBeam1 = m_dbe->book2D("BST_intensityBeam1",
                "intensity beam 1",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, 0., 100.);
        BST_intensityBeam1->setAxisTitle("Luminosity segment", 1);
        BST_intensityBeam1->setAxisTitle("Beam intensity", 2);

        BST_intensityBeam2 = m_dbe->book2D("BST_intensityBeam2",
                "intensity beam 2",
                TotalNrBinsLs, 0., totalNrBinsLs, 100, 0., 100.);
        BST_intensityBeam2->setAxisTitle("Luminosity segment", 1);
        BST_intensityBeam2->setAxisTitle("Beam intensity", 2);

        // prescale factor index monitoring

        m_monL1PrescaleFactorSet = m_dbe->book2D("L1PrescaleFactorSet",
                "Index of L1 prescale factor set",
                TotalNrBinsLs, 0., totalNrBinsLs, 25, 0., 25.);
        m_monL1PrescaleFactorSet->setAxisTitle("Luminosity segment", 1);
        m_monL1PrescaleFactorSet->setAxisTitle("L1 PF set index", 2);

        m_monL1PfIndicesPerLs = m_dbe->book1D("L1PfIndicesPerLs",
                "Number of prescale factor indices used per LS", 10, 0., 10.);
        m_monL1PfIndicesPerLs->setAxisTitle("Number of PF indices used per LS", 1);
        m_monL1PfIndicesPerLs->setAxisTitle("Entries/run", 2);


        // TCS vs FDL common quantity monitoring

        m_dbe->setCurrentFolder(m_histFolder + "/TCSvsEvmFDL");

        //    orbit number
        m_monOrbitNrDiffTcsFdlEvm = m_dbe->book1D("OrbitNrDiffTcsFdlEvm",
                        "Orbit number difference (TCS - EVM_FDL)",
                        2 * MaxOrbitNrDiffTcsFdlEvm + 1,
                        static_cast<float>(-(MaxOrbitNrDiffTcsFdlEvm + 1)),
                        static_cast<float>(MaxOrbitNrDiffTcsFdlEvm + 1));
        m_monOrbitNrDiffTcsFdlEvm->setAxisTitle("Orbit number difference", 1);
        m_monOrbitNrDiffTcsFdlEvm->setAxisTitle("Entries/run", 2);

        m_monLsNrDiffTcsFdlEvm = m_dbe->book1D("LsNrDiffTcsFdlEvm",
                        "LS number difference (TCS - EVM_FDL)",
                        2 * MaxLsNrDiffTcsFdlEvm + 1,
                        static_cast<float>(-(MaxLsNrDiffTcsFdlEvm + 1)),
                        static_cast<float>(MaxLsNrDiffTcsFdlEvm + 1));
        m_monLsNrDiffTcsFdlEvm->setAxisTitle("LS number difference", 1);
        m_monLsNrDiffTcsFdlEvm->setAxisTitle("Entries/run", 2);

        //    LS number

        m_monOrbitNrDiffTcsFdlEvmLs = m_dbe->book2D("OrbitNrDiffTcsFdlEvmLs",
                "Orbit number difference (TCS - EVM_FDL)",
                TotalNrBinsLs, 0., totalNrBinsLs,
                2 * MaxOrbitNrDiffTcsFdlEvm + 1,
                static_cast<float>(-(MaxOrbitNrDiffTcsFdlEvm + 1)),
                static_cast<float>(MaxOrbitNrDiffTcsFdlEvm + 1));
        m_monOrbitNrDiffTcsFdlEvmLs->setAxisTitle("Luminosity segment", 1);
        m_monOrbitNrDiffTcsFdlEvmLs->setAxisTitle("Orbit number difference (TCS - EVM_FDL)", 2);

        m_monLsNrDiffTcsFdlEvmLs = m_dbe->book2D("LsNrDiffTcsFdlEvmLs",
                "LS number difference (TCS - EVM_FDL)",
                TotalNrBinsLs, 0., totalNrBinsLs,
                2 * MaxLsNrDiffTcsFdlEvm + 1,
                static_cast<float>(-(MaxLsNrDiffTcsFdlEvm + 1)),
                static_cast<float>(MaxLsNrDiffTcsFdlEvm + 1));
        m_monLsNrDiffTcsFdlEvmLs->setAxisTitle("Luminosity segment", 1);
        m_monLsNrDiffTcsFdlEvmLs->setAxisTitle("LS number difference (TCS - EVM_FDL)", 2);

        m_dbe->setCurrentFolder(m_histFolder);
   }



}
void L1TGT::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 494 of file L1TGT.cc.

References m_nrEvJob, and verbose_.

                   {

    if (verbose_) {
        edm::LogInfo("L1TGT") << "\n Analyzed " << m_nrEvJob << " events";
    }

    return;
}
void L1TGT::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup evSetup 
) [private, virtual]

end section

Reimplemented from edm::EDAnalyzer.

Definition at line 456 of file L1TGT.cc.

References m_pairLsNumberPfIndex, and python::multivaluedict::sort().

                                      {

    edm::LogInfo("L1TGT")
            << "\n  endLuminosityBlock:: Prescale factor indices used in a LS "
            << std::endl;
    for (CItVecPair cIt = m_pairLsNumberPfIndex.begin(); cIt
            != m_pairLsNumberPfIndex.end(); ++cIt) {

        edm::LogVerbatim("L1TGT") << "  lsNumber = " << (*cIt).first
                << " pfIndex = " << (*cIt).second << std::endl;
    }
    edm::LogVerbatim("L1TGT") << std::endl;

    // sort the vector (for pairs: sort after first argument, then after the second argument)
    std::sort(m_pairLsNumberPfIndex.begin(), m_pairLsNumberPfIndex.end());

}
void L1TGT::endRun ( const edm::Run iRrun,
const edm::EventSetup evSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 475 of file L1TGT.cc.

References m_pairLsNumberPfIndex.

                                                                    {

    edm::LogInfo("L1TGT")
            << "\n  endRun:: Prescale factor indices used in a LS "
            << std::endl;
    for (CItVecPair cIt = m_pairLsNumberPfIndex.begin(); cIt
            != m_pairLsNumberPfIndex.end(); ++cIt) {

        edm::LogVerbatim("L1TGT") << "  lsNumber = " << (*cIt).first
                << " pfIndex = " << (*cIt).second << std::endl;
    }
    edm::LogVerbatim("L1TGT") << std::endl;

    // clear the content of the vector
    m_pairLsNumberPfIndex.clear();

}
bool L1TGT::isActive ( int  word,
int  bit 
) [private]

Definition at line 769 of file L1TGT.cc.

Referenced by analyze().

                                      {
    if (word & (1 << bit))
        return true;
    return false;
}

Member Data Documentation

Definition at line 112 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 113 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 117 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 116 of file L1TGT.h.

Referenced by bookHistograms().

Definition at line 135 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 136 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 137 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 138 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 134 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 132 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 133 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 130 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 122 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 121 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 119 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 125 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 139 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 141 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 140 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

input tag for L1 GT EVM readout record

Definition at line 102 of file L1TGT.h.

Referenced by analyze().

Definition at line 129 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

input parameters

input tag for L1 GT DAQ readout record

Definition at line 99 of file L1TGT.h.

Referenced by analyze().

DQMStore* L1TGT::m_dbe [private]

internal members

Definition at line 167 of file L1TGT.h.

Referenced by beginRun(), bookHistograms(), and L1TGT().

std::string L1TGT::m_histFolder [private]

histogram folder for L1 GT plots

Definition at line 174 of file L1TGT.h.

Referenced by beginRun(), bookHistograms(), and L1TGT().

Definition at line 144 of file L1TGT.h.

Referenced by bookHistograms().

Definition at line 143 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 147 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 159 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 146 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 158 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

int L1TGT::m_nrEvJob [private]

number of events processed

Definition at line 170 of file L1TGT.h.

Referenced by analyze(), beginJob(), and endJob().

int L1TGT::m_nrEvRun [private]

Definition at line 171 of file L1TGT.h.

Referenced by beginRun().

std::vector<std::pair<int,int> > L1TGT::m_pairLsNumberPfIndex [private]

Definition at line 183 of file L1TGT.h.

Referenced by analyze(), beginRun(), endLuminosityBlock(), endRun(), and L1TGT().

int L1TGT::m_previousLS [private]

Definition at line 180 of file L1TGT.h.

Referenced by analyze().

int L1TGT::m_previousPfIndex [private]

Definition at line 181 of file L1TGT.h.

Referenced by analyze().

const int L1TGT::MaxLsNrDiffTcsFdlEvm = 24 [static, private]

Definition at line 156 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

const int L1TGT::MaxOrbitNrDiffTcsFdlEvm = 24 [static, private]

Definition at line 155 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 126 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

std::string L1TGT::outputFile_ [private]

file name for ROOT output

Definition at line 108 of file L1TGT.h.

boost::uint64_t L1TGT::preGps_ [private]

Definition at line 176 of file L1TGT.h.

Referenced by analyze(), and beginJob().

boost::uint64_t L1TGT::preOrb_ [private]

Definition at line 177 of file L1TGT.h.

Referenced by analyze(), and beginJob().

Definition at line 127 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 124 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 123 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 114 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 115 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

Definition at line 118 of file L1TGT.h.

Referenced by analyze(), and bookHistograms().

bool L1TGT::verbose_ [private]

verbosity switch

Definition at line 105 of file L1TGT.h.

Referenced by analyze(), and endJob().