CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

cscdqm::EventProcessor Class Reference

Object used to process Events and compute statistics. More...

#include <CSCDQM_EventProcessor.h>

List of all members.

Public Member Functions

 EventProcessor (Configuration *const p_config)
 Constructor.
void init ()
 Initialize EventProcessor: reading out config information.
unsigned int maskHWElements (std::vector< std::string > &tokens)
 Mask HW elements from the efficiency calculations. Can be applied on runtime!
void standbyEfficiencyHistos (HWStandbyType &standby)
 apply standby flags/parameters
void updateEfficiencyHistos ()
 Update Efficiency MOs.
void updateFractionHistos ()
 Update Fractional MOs.
void writeShifterHistograms ()
 ~EventProcessor ()
 Destructor.

Private Member Functions

void calcEMUFractionHisto (const HistoId &result, const HistoId &set, const HistoId &subset)
 Calculate fractional histogram.
const bool getCSCFromMap (const unsigned int &crateId, const unsigned int &dmbId, unsigned int &cscType, unsigned int &cscPosition) const
 Get CSC type and position from crate and dmb identifiers.
const bool getCSCHisto (const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
 Get CSC (Chamber) Level Monitoring Object.
const bool getCSCHisto (const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, const HwId &adId, MonitorObject *&me)
 Get CSC (Chamber) Level Monitoring Object with additional identifier.
const bool getDDUHisto (const HistoId &histo, const HwId &dduID, MonitorObject *&me)
 Get DDU Level Monitoring Object.
const bool getEMUHisto (const HistoId &histo, MonitorObject *&me)
 Get EMU (Top Level) Monitoring Object.
const bool getFEDHisto (const HistoId &histo, const HwId &fedID, MonitorObject *&me)
 Get FED Level Monitoring Object.
const bool getParHisto (const HistoId &histo, MonitorObject *&me)
 Get Parameter Monitoring Object.
void preProcessEvent ()
 Common Local and Global DQM function to be called before processing Event.
void processCSC (const CSCEventData &data, const int dduID, const CSCDCCExaminer &binChecker)
 Process Chamber Data and fill MOs.
void processDDU (const CSCDDUEventData &data, const CSCDCCExaminer &binChecker)
 Process DDU output and fill MOs.
bool processExaminer (const CSCDCCExaminer &binChecker, const CSCDCCFormatStatusDigi &digi)
 Fill monitor elements with CSCDCCFormatStatusDigi information.
bool processExaminer (const CSCDCCExaminer &binChecker)
void resetEmuEventDisplays ()
 Reset Emu level EventDisplay histograms once per event.
void setEmuEventDisplayBit (MonitorObject *&mo, const unsigned int x, const unsigned int y, const unsigned int bit)
 Set a single bit in the 3D Histogram (aka EMU level event display). Checks if mo and x != null.

Private Attributes

uint32_t BXN
uint32_t cntALCTs
 Total Number of CFEBs per event from DMB DAV.
uint32_t cntCFEBs
 Total Number of DMBs per event from DDU Header DAV.
uint32_t cntDMBs
uint32_t cntTMBs
 Total Number of ALCTs per event from DMB DAV.
Configurationconfig
bool EmuEventDisplayWasReset
bool fCloseL1As
 Total Number of TMBs per event from DMB DAV.
std::map< uint32_t, bool > fNotFirstEvent
uint32_t L1ANumber
std::map< uint32_t, uint32_t > L1ANumbers
Summary summary

Detailed Description

Object used to process Events and compute statistics.

Definition at line 111 of file CSCDQM_EventProcessor.h.


Constructor & Destructor Documentation

cscdqm::EventProcessor::EventProcessor ( Configuration *const  p_config)

Constructor.

Parameters:
p_configPointer to Global Configuration.

Definition at line 28 of file CSCDQM_EventProcessor.cc.

References config, and fCloseL1As.

                                                              {

    config = p_config;
    // fFirstEvent = true;
    fCloseL1As = true;

  }
cscdqm::EventProcessor::~EventProcessor ( ) [inline]

Destructor.

Definition at line 124 of file CSCDQM_EventProcessor.h.

{ }

Member Function Documentation

void cscdqm::EventProcessor::calcEMUFractionHisto ( const HistoId result,
const HistoId set,
const HistoId subset 
) [private]

Calculate fractional histogram.

Parameters:
resultHistogram to write results to
setHistogram of the set
subsetHistogram of the subset

Definition at line 90 of file CSCDQM_EventProcessor_updateFracHistos.cc.

References getEMUHisto(), cscdqm::MonitorObject::getTH1Lock(), CommonMethods::lock(), cscdqm::Lock::mutex, and cscdqm::MonitorObject::SetMaximum().

Referenced by updateFractionHistos().

                                                                                                            {

    MonitorObject *mo = 0, *mo1 = 0, *mo2 = 0;

    if (getEMUHisto(result, mo) && getEMUHisto(set, mo2) && getEMUHisto(subset, mo1)) {
      LockType lock(mo->mutex);
      TH1* th = mo->getTH1Lock();
      th->Reset();
      th->Divide(mo1->getTH1(), mo2->getTH1());
      mo->SetMaximum(1.);
    }

  }
const bool cscdqm::EventProcessor::getCSCFromMap ( const unsigned int &  crateId,
const unsigned int &  dmbId,
unsigned int &  cscType,
unsigned int &  cscPosition 
) const [private]

Get CSC type and position from crate and dmb identifiers.

Parameters:
crateIdCSC crate identifier
dmbIdCSC DMB identifier
cscTypeCSC Type identifier to return
cscPositionCSC Position identifier to return
Returns:
true if parameters where found and filled, false - otherwise

Definition at line 137 of file CSCDQM_EventProcessor.cc.

References CSCDetId::chamber(), config, CSCDetId::endcap(), cscdqm::Configuration::fnGetCSCDetId, cscdqm::Utility::getCSCTypeBin(), cscdqm::Utility::getCSCTypeLabel(), query::result, CSCDetId::ring(), and CSCDetId::station().

Referenced by processCSC(), and processExaminer().

                                                                                                                                                         {
    bool result = false;

    CSCDetId cid;
    if (config->fnGetCSCDetId(crateId, dmbId, cid)) {
      cscPosition  = cid.chamber();
      int iring    = cid.ring();
      int istation = cid.station();
      int iendcap  = cid.endcap();
      std::string tlabel = cscdqm::Utility::getCSCTypeLabel(iendcap, istation, iring);
      cscType = cscdqm::Utility::getCSCTypeBin(tlabel);
      result = true;
    }
    
    /*
    if (!result) {
      LOG_ERROR << "Event #" << config->getNEvents() << ": Invalid CSC=" << CSCHistoDef::getPath(crateId, dmbId);
    }
    */

    return result;

  }
const bool cscdqm::EventProcessor::getCSCHisto ( const HistoId histo,
const HwId crateID,
const HwId dmbSlot,
const HwId adId,
MonitorObject *&  me 
) [private]

Get CSC (Chamber) Level Monitoring Object with additional identifier.

Parameters:
histoMO identification
crateIDChamber Crate identifier
dmbSlotChamber DMB identifier
adIdAdditional identifier, i.e. Layer number, CLCT number, etc.
meMO to return
Returns:
true if MO was found, false - otherwise

Definition at line 109 of file CSCDQM_EventProcessor.cc.

References config, cscdqm::Configuration::fnGetCacheCSCHisto, cscdqm::Configuration::fnGetHisto, and NULL.

                                                                                                                                             {
    if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, adId, me)) return (me != NULL);
    CSCHistoDef histoD(histo, crateID, dmbSlot, adId);
    if (config->fnGetHisto(histoD, me)) return (me != NULL);
    return false;
  }
const bool cscdqm::EventProcessor::getCSCHisto ( const HistoId histo,
const HwId crateID,
const HwId dmbSlot,
MonitorObject *&  me 
) [private]

Get CSC (Chamber) Level Monitoring Object.

Parameters:
histoMO identification
crateIDChamber Crate identifier
dmbSlotChamber DMB identifier
meMO to return
Returns:
true if MO was found, false - otherwise

Definition at line 92 of file CSCDQM_EventProcessor.cc.

References config, cscdqm::Configuration::fnGetCacheCSCHisto, cscdqm::Configuration::fnGetHisto, and NULL.

Referenced by processCSC(), processExaminer(), and updateFractionHistos().

                                                                                                                           {
    if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, 0, me)) return (me != NULL);
    CSCHistoDef histoD(histo, crateID, dmbSlot);
    if (config->fnGetHisto(histoD, me)) return (me != NULL);
    return false;
  }
const bool cscdqm::EventProcessor::getDDUHisto ( const HistoId histo,
const HwId dduID,
MonitorObject *&  me 
) [private]

Get DDU Level Monitoring Object.

Parameters:
histoMO identification
dduIDDDU identifier
meMO to return
Returns:
true if MO was found, false - otherwise

Definition at line 77 of file CSCDQM_EventProcessor.cc.

References config, cscdqm::Configuration::fnGetCacheDDUHisto, cscdqm::Configuration::fnGetHisto, and NULL.

Referenced by processDDU().

                                                                                                    {
    if (config->fnGetCacheDDUHisto(histo, dduID, me)) return (me != NULL);
    DDUHistoDef histoD(histo, dduID);
    if (config->fnGetHisto(histoD, me)) return (me != NULL);
    return false;
  }
const bool cscdqm::EventProcessor::getEMUHisto ( const HistoId histo,
MonitorObject *&  me 
) [private]

Get EMU (Top Level) Monitoring Object.

Parameters:
histoMO identification
meMO to return
Returns:
true if MO was found, false - otherwise

Definition at line 49 of file CSCDQM_EventProcessor.cc.

References config, cscdqm::Configuration::fnGetCacheEMUHisto, cscdqm::Configuration::fnGetHisto, and NULL.

Referenced by calcEMUFractionHisto(), processCSC(), processDDU(), processExaminer(), resetEmuEventDisplays(), standbyEfficiencyHistos(), updateEfficiencyHistos(), and writeShifterHistograms().

                                                                                 {
    if (config->fnGetCacheEMUHisto(histo, me)) return (me != NULL);
    EMUHistoDef histoD(histo);
    if (config->fnGetHisto(histoD, me)) return (me != NULL);
    return false;
  }
const bool cscdqm::EventProcessor::getFEDHisto ( const HistoId histo,
const HwId fedID,
MonitorObject *&  me 
) [private]

Get FED Level Monitoring Object.

Parameters:
histoMO identification
fedIDFED identifier
meMO to return
Returns:
true if MO was found, false - otherwise

Definition at line 63 of file CSCDQM_EventProcessor.cc.

References config, cscdqm::Configuration::fnGetCacheFEDHisto, cscdqm::Configuration::fnGetHisto, and NULL.

                                                                                                    {
    if (config->fnGetCacheFEDHisto(histo, fedID, me)) return (me != NULL);
    FEDHistoDef histoD(histo, fedID);
    if (config->fnGetHisto(histoD, me)) return (me != NULL);
    return false;
  }
const bool cscdqm::EventProcessor::getParHisto ( const HistoId histo,
MonitorObject *&  me 
) [private]

Get Parameter Monitoring Object.

Parameters:
histoMO identification
meMO to return
Returns:
true if MO was found, false - otherwise

Definition at line 122 of file CSCDQM_EventProcessor.cc.

References config, cscdqm::Configuration::fnGetCacheParHisto, cscdqm::Configuration::fnGetHisto, and NULL.

Referenced by updateEfficiencyHistos().

                                                                                 {
    if (config->fnGetCacheParHisto(histo, me)) return (me != NULL);
    ParHistoDef histoD(histo);
    if (config->fnGetHisto(histoD, me)) return (me != NULL);
    return false;
  }
void cscdqm::EventProcessor::init ( void  )

Initialize EventProcessor: reading out config information.

Definition at line 39 of file CSCDQM_EventProcessor.cc.

Referenced by cscdqm::Dispatcher::init().

                            {

  }
unsigned int cscdqm::EventProcessor::maskHWElements ( std::vector< std::string > &  tokens)

Mask HW elements from the efficiency calculations. Can be applied on runtime!

Parameters:
tokensString tokens of the HW elements
Returns:
elements masked

Definition at line 167 of file CSCDQM_EventProcessor.cc.

References LOG_INFO, cscdqm::Summary::setMaskedHWElements(), and summary.

Referenced by cscdqm::EventProcessorMutex::maskHWElements().

                                                                          {
    unsigned int masked = summary.setMaskedHWElements(tokens);
    LOG_INFO << masked << " HW Elements masked";
    return masked;
  }
void cscdqm::EventProcessor::preProcessEvent ( ) [private]

Common Local and Global DQM function to be called before processing Event.

Definition at line 27 of file CSCDQM_EventProcessor_processEvent.cc.

References config, EmuEventDisplayWasReset, and cscdqm::Configuration::incNEvents().

{

  config->incNEvents();
  EmuEventDisplayWasReset = false;

}
void cscdqm::EventProcessor::processCSC ( const CSCEventData data,
const int  dduID,
const CSCDCCExaminer binChecker 
) [private]

Process Chamber Data and fill MOs.

Parameters:
dataChamber data to process
dduIDDDU identifier

DMB Found

Unpacking of DMB Header and trailer

Unpacking of Chamber Identification number

Efficiency of the chamber

Unpacking L1A number from DMB header

DMB L1A: 8bits (256)

DDU L1A: 24bits

Calculate difference between L1A numbers from DDU and DMB

LOG_DEBUG << dmbHeaderL1A << " : DMB L1A - DDU L1A = " << dmb_ddu_l1a_diff;

Unpacking BXN number from DMB header

== DMB BXN: 12bits (4096) call bxn12(), bxn() return 7bits value

== DDU BXN: 12bits (4096)

== Use 6-bit BXN

Calculation difference between BXN numbers from DDU and DMB

dmb_ddu_bxn_diff = (int)(dmbHeaderBXN-(int)(BXN&0x7F)); // For older DMB

LOG_DEBUG << dmbHeaderBXN << " : DMB BXN - DDU BXN = " << dmb_ddu_bxn_diff;

if (getCSCHisto(h::CSC_DMB_BXN_VS_DDU_BXN, crateID, dmbID, mo)) mo->Fill((int)(BXN), (int)dmbHeaderBXN);

Unpacking CFEB information from DMB header

mo->SetEntries(config->getNEvents());

if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE, crateID, dmbID, mo) mo->Fill((dmbTrailer->header_1a>>5)&0x1F); //KK

if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebAvailable(),(int)((dmbTrailer->header_1a>>5)&0x1F)); //KK

if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebAvailable(),dmbHeader->cfebActive()); //KK

DMB input (7 in total) FIFO stuff goes here

DMB input timeout (total 15 bits) goes here

Get FEBs Data Available Info

Fill Hisogram for FEB DAV Efficiency

Fill Hisogram for Different Combinations of FEB DAV Efficiency

ALCT Found

Set number of ALCT-events to third bin

KK

h[hname]->SetBinContent(3, ((float)ALCTEvent/(float)(config->getNEvents()) * 100.0));

KKend

== ALCT2007 L1A: 12bits (4096)

== ALCT2006 L1A: 4bits (16)

== Use 6-bit L1A

int alct_dmb_l1a_diff = (int)((dmbHeader->l1a()&0xF)-alctHeader->L1Acc());

if (getCSCHisto(h::CSC_DMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) mo->Fill(alctHeader->L1Acc(),dmbHeader->l1a());

=== ALCT BXN: 12bits (4096)

=== Use 6-bit BXN

if (getCSCHisto(h::CSC_ALCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount())), (int)(dmbHeader->bxn()));

LOG_DEBUG << "ALCT Trailer Word Count = " << dec << (int)alctTrailer->wordCount();

TODO: Add support for more than 2 ALCTs

int tbin = wireDigisItr->getBeamCrossingTag();

ALCT not found

ALCT and CLCT coinsidence

if (getCSCHisto(h::CSC_TMB_BXN_VS_ALCT_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount())),(int)(tmbHeader->BXNCount()));

CLCT Found

LOG_WARN << "TMB CRC calc: 0x" << std::hex << data.tmbData().TMBCRCcalc() << " trailer: 0x" << std::hex << data.tmbData().tmbTrailer().crc22();

Set number of CLCT-events to forth bin

Use 6-bit L1A

if (getCSCHisto(h::CSC_DMB_L1A_VS_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber(),dmbHeader->l1a());

if (getCSCHisto(h::CSC_CLCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill(tmbHeader->BXNCount(),dmbHeader->bxn());

LOG_DEBUG << "TMB Trailer Word Count = " << dec << (int)tmbTrailer->wordCount();

LOG_DEBUG << "CLCT BX = " << clctsDatas[lct].getBX() << " TMB BX = " << tmbHeader->BXNCount() << " 03 = " << (int)(tmbHeader->BXNCount()&0x3);

LOG_DEBUG << "diff = " << clctsDatas[lct].getBX()-(tmbHeader->BXNCount()&0x3);

int pattern_clct = (int)((clctsDatas[lct].getPattern()>>1)&0x3);

pattern_clct = Number of patterns in CLCT

Last (left) bit is bend. Positive bend = 1, negative bend = 0

pattern_clct = Number of patterns in CLCT

Last (left) bit is bend. Positive bend = 1, negative bend = 0

=VB= Fix to get right hafstrip

if (norm < 1.0) norm=1;

CLCT not found

CFEB found

bool DebugCFEB = false;

--------------B

int NmbCell, SCA_Nmb_FC;

--------------E

--------------B

int TrigTimeData[N_CFEBs*16][N_Samples][N_Layers];

memset(TrigTimeData, 0, sizeof(TrigTimeData));

--------------E

CFEB Found

-------------B

-------------E

LOG_DEBUG << "NEvents = " << config->getNEvents();

LOG_DEBUG << "Chamber ID = "<< cscTag << " Crate ID = "<< crateID << " DMB ID = " << dmbID << "nCFEB =" << nCFEB;

=VB= Optimizations for faster histogram object access

LOG_DEBUG << " nSample = " << nSample;

=VB= Optimizations for faster histogram object access

if (mo_CFEB_DMB_L1A_diff)

LOG_DEBUG << " nSample = " << nSample;

for(int nLayer = 1; nLayer <= N_Layers; ++nLayer)

--------------B

L1_Pipe_Count = (timeSlice[nCFEB][nSample])->get_L1A_number();

LOG_DEBUG << "SCA BLOCK: Chamber=" << chamberID << " CFEB=" << nCFEB + 1

<<" TRIGTIME="<<TrigTime<<" TimeSlice="<<nSample+1<<" Layer="<<nLayer<<" SCA_BLK="<<SCA_BLK;

if(res<=1) TrigTimeData[nCFEB*16+nStrip][nSample][nLayer-1] = TrigTime;

LOG_DEBUG << "*********"<<" TRIGTIME="<<TrigTime<<" BIT COUNT="<<bit_count;

SCA Block Occupancy Histograms

if (getCSCHisto(h::CSC_CFEBXX_SCA_BLOCK_OCCUPANCY, crateID, dmbID, nCFEB + 1, mo)) mo->Fill(SCA_BLK);

Free SCA Cells

if (getCSCHisto(h::CSC_CFEBXX_FREE_SCA_CELLS, crateID, dmbID, nCFEB + 1, mo))

Number of SCA Blocks Locked by LCTs

if (getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTS, crateID, dmbID, nCFEB + 1, mo))

Number of SCA Blocks Locked by LCTxL1

if (getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTXL1, crateID, dmbID, nCFEB + 1, mo))

--------------E

LOG_DEBUG << "nCFEB " << nCFEB << " nSample " << nSample << " nLayer " << nLayer << " TrigTime " << TrigTime;

LOG_DEBUG << "L1APhase " << L1APhase << " UnpackedTrigTime " << UnpackedTrigTime;

LOG_DEBUG << " nStrip="<< dec << nStrip << " ADC=" << std::hex << ADC;

LOG_DEBUG << " nStrip="<< dec << nStrip << " Pedestal=" << std::hex << Pedestal[nCFEB][nLayer-1][nStrip-1];

if (getCSCHisto(h::CSC_CFEB_OUT_OFF_RANGE_STRIPS_LYXX, crateID, dmbID, nLayer, mo))

if (getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX, crateID, dmbID, nLayer, mo))

if (getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX_PROFILE, crateID, dmbID, nLayer, mo))

if (getCSCHisto(h::CSC_CFEB_ACTIVESTRIPS_LYXX, crateID, dmbID, nLayer, mo))

--------------B

LOG_DEBUG << "Layer="<<nLayer<<" Strip="<<nCFEB*16+nStrip<<" Time="<<nSample << " ADC-PEDEST = "<<ADC - Pedestal[nCFEB][nLayer-1][nStrip-1];

--------------E

continue;

--------------B

if (getCSCHisto(h::CSC_CFEB_PEDESTAL__WITHEMV__SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo))

if (getCSCHisto(h::CSC_CFEB_PEDESTAL__WITHRMS__SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo))

if (getCSCHisto(h::CSC_CFEB_PEDESTALRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo))

--------------E

--------------B

Refactored for performance (VR)

StripClusterFinder *ClusterFinder = new StripClusterFinder(N_Layers, N_Samples, N_CFEBs, N_Strips);

LOG_DEBUG << "*** CATHODE PART DEBUG: Layer=" << nLayer <<" Number of Clusters=" << Clus.size() << " ***";

Number of Clusters Histograms

LOG_DEBUG << "Strip: " << Clus[u].ClusterPulseMapHeight[k].channel_+1;

Clusters Charge Histograms

Width of Clusters Histograms

Cluster Duration Histograms

delete ClusterFinder;

--------------E

Fill Hisogram for Different Combinations of FEBs Unpacked vs DAV

Definition at line 83 of file CSCDQM_EventProcessor_processCSC.cc.

References a, abs, CSCCFEBDataWord::adcCounts, CSCCFEBDataWord::adcOverflow, CSCDMBTrailer::alct_empty, CSCDMBTrailer::alct_endtimeout, CSCDMBTrailer::alct_full, CSCDMBTrailer::alct_half, CSCDMBTrailer::alct_timeout, cscdqm::ALCT_TRIGGERS, CSCEventData::alctData(), CSCALCTHeader::ALCTDigis(), CSCALCTHeader::alctFirmwareVersion(), CSCEventData::alctHeader(), CSCTMBHeader::ALCTMatchTime(), CSCTMBHeader::ALCTOnly(), CSCEventData::alctTrailer(), b, BXN, CSCTMBHeader::Bxn0Diff(), CSCDMBHeader::bxn12(), CSCTMBHeader::Bxn1Diff(), CSCALCTHeader::BXNCount(), CSCTMBHeader::BXNCount(), CSCDMBTrailer::cfeb_empty, CSCDMBTrailer::cfeb_endtimeout, CSCDMBTrailer::cfeb_full, CSCDMBTrailer::cfeb_half, CSCDMBTrailer::cfeb_starttimeout, cscdqm::CFEB_TRIGGERS, CSCDMBHeader::cfebActive(), CSCDMBHeader::cfebAvailable(), CSCEventData::cfebData(), CSCDMBHeader::cfebMovlp(), cscd2r::chamberID(), CSCCLCTData::check(), CSCCFEBData::check(), cscdqm::CLCT_TRIGGERS, CSCEventData::clctData(), CSCTMBHeader::CLCTDigis(), CSCTMBHeader::CLCTOnly(), CSCCLCTData::comparatorDigis(), config, cscdqm::Configuration::copyChamberCounterValue(), CSCDMBHeader::crateID(), cscdqm::DMB_EVENTS, CSCDMBTrailer::dmb_l1pipe, cscdqm::DMB_TRIGGERS, CSCDMBHeader::dmbCfebSync(), CSCEventData::dmbHeader(), CSCDMBHeader::dmbID(), CSCEventData::dmbTrailer(), cscdqm::StripClusterFinder::DoAction(), CSCDetId::endcap(), benchmark_cfg::errors, CSCDCCExaminer::errorsForChamber(), cscdqm::EVENT_DISPLAY_PLOT, fCloseL1As, cscdqm::MonitorObject::Fill(), first, cscdqm::Configuration::fnGetCSCDetId, CSCCFEBTimeSlice::get_buffer_count(), CSCCFEBTimeSlice::get_l1pipe_empty(), CSCCFEBTimeSlice::get_l1pipe_full(), CSCCFEBTimeSlice::get_lctpipe_count(), CSCCFEBTimeSlice::get_lctpipe_empty(), CSCCFEBTimeSlice::get_lctpipe_full(), CSCCFEBTimeSlice::get_n_free_sca_blocks(), cscdqm::MonitorObject::GetBinContent(), cscdqm::MonitorObject::GetBinError(), cscdqm::Configuration::getChamberCounterValue(), cscdqm::StripClusterFinder::getClusters(), getCSCFromMap(), getCSCHisto(), cscdqm::Summary::getDetector(), getEMUHisto(), cscdqm::MonitorObject::GetEntries(), cscdqm::MonitorObject::GetMaximumBin(), cscdqm::Configuration::getNEvents(), cscdqm::CSCHistoDef::getPath(), cscdqm::MonitorObject::getTH1(), cscdqm::MonitorObject::getTH1Lock(), cscdqm::Detector::GlobalChamberIndex(), i, cscdqm::Configuration::incNUnpackedCSC(), cscdqm::Summary::isChamberStandby(), j, gen::k, CSCDMBHeader::l1a(), CSCCFEBSCAControllerWord::l1a_phase, CSCALCTHeader::L1Acc(), L1ANumber, CSCTMBHeader::L1ANumber(), LOG_ERROR, LOG_INFO, LOG_WARN, n, CSCDMBHeader::nalct(), CSCEventData::nalct(), CSCDMBHeader::nclct(), CSCEventData::nclct(), lumiNorm::norm, NULL, listBenchmarks::pattern, DetId::rawId(), CSCDetId::ring(), CSCCFEBSCAControllerWord::sca_blk, CSCCFEBTimeSlice::scaControllerWord(), edm::second(), cscdqm::MonitorObject::SetAxisRange(), cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetBinError(), cscdqm::Configuration::setChamberCounterValue(), setEmuEventDisplayBit(), cscdqm::MonitorObject::SetEntries(), cscdqm::MonitorObject::SetNormFactor(), CSCDetId::station(), summary, cscdqm::timeSample(), cscdqm::timeSlice(), CSCDMBTrailer::tmb_empty, CSCDMBTrailer::tmb_endtimeout, CSCDMBTrailer::tmb_full, CSCDMBTrailer::tmb_half, CSCDMBTrailer::tmb_timeout, CSCEventData::tmbData(), CSCTMBData::tmbHeader(), CSCTMBHeader::TMBMatch(), CSCTMBData::tmbTrailer(), CSCCFEBSCAControllerWord::trig_time, CSCAnodeData::wireDigis(), CSCALCTTrailer::wordCount(), and CSCTMBTrailer::wordCount().

Referenced by processDDU().

                                                                                                             {

    config->incNUnpackedCSC();

    if (&data == 0) {
      LOG_ERROR << "Zero pointer. DMB data are not available for unpacking"; //KK is->are
      return;
    }

    int FEBunpacked   = 0;
    int alct_unpacked = 0;
    int tmb_unpacked  = 0;
    int cfeb_unpacked = 0;

    int alct_keywg = -1;
    int clct_kewdistrip = -1;

    bool L1A_out_of_sync = false;

    MonitorObject* mo = NULL;

    const CSCDMBHeader* dmbHeader = data.dmbHeader();
    const CSCDMBTrailer* dmbTrailer = data.dmbTrailer();
    if (!dmbHeader && !dmbTrailer) {
      LOG_ERROR << "Can not unpack DMB Header or/and Trailer";
      return;
    }

    unsigned int crateID = 0xFF;
    unsigned int dmbID = 0xF;
    unsigned int chamberID = 0xFFF;

    crateID = dmbHeader->crateID();
    dmbID = dmbHeader->dmbID();
    chamberID = (((crateID) << 4) + dmbID) & 0xFFF;

    const std::string cscTag = CSCHistoDef::getPath(crateID, dmbID);

    unsigned long errors = binChecker.errorsForChamber(chamberID);
    if ((errors & config->getBINCHECK_MASK()) > 0 ) {
      LOG_WARN << "Format Errors " << cscTag << ": 0x" << std::hex << errors << " Skipped CSC Unpacking";
      return;
    }

    unsigned int cscType = 0;
    unsigned int cscPosition = 0;
    if (!getCSCFromMap(crateID, dmbID, cscType, cscPosition )) return;

    CSCDetId cid;
    if (!config->fnGetCSCDetId(crateID, dmbID, cid)) {
      return;
    }

    // Check if in standby!
    if (summary.isChamberStandby(cid)) {
      return;
    }

    double DMBEvents  = 0.0;
    DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbID);

    // Get Event display plot number and next plot object
    uint32_t evDisplNo = config->getChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID);
    evDisplNo += 1;
    if (evDisplNo >= 5) {
      config->setChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID, 0);
    } else {
      config->setChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID, evDisplNo);
    }
    MonitorObject* mo_EventDisplay = 0;
    if (getCSCHisto(h::CSC_EVENT_DISPLAY_NOXX, crateID, dmbID, evDisplNo, mo_EventDisplay)) {
      mo_EventDisplay->getTH1Lock()->Reset("");
    }

    // Receiving EMU Event displays 
    MonitorObject *mo_Emu_EventDisplay_Anode = 0, *mo_Emu_EventDisplay_Cathode = 0, *mo_Emu_EventDisplay_XY = 0;
    getEMUHisto(h::EMU_EVENT_DISPLAY_ANODE, mo_Emu_EventDisplay_Anode);
    getEMUHisto(h::EMU_EVENT_DISPLAY_CATHODE, mo_Emu_EventDisplay_Cathode);
    getEMUHisto(h::EMU_EVENT_DISPLAY_XY, mo_Emu_EventDisplay_XY);

    // Global chamber index
    uint32_t glChamberIndex = 0;

    if (mo_EventDisplay) {
      mo_EventDisplay->SetBinContent(1, 1, cid.endcap());
      mo_EventDisplay->SetBinContent(1, 2, cid.station());
      mo_EventDisplay->SetBinContent(1, 3, cid.ring());
      mo_EventDisplay->SetBinContent(1, 4, cscPosition);
      mo_EventDisplay->SetBinContent(1, 5, crateID);
      mo_EventDisplay->SetBinContent(1, 6, dmbID);
      mo_EventDisplay->SetBinContent(1, 7, dmbHeader->l1a());
      if (mo_Emu_EventDisplay_Anode || mo_Emu_EventDisplay_Cathode || mo_Emu_EventDisplay_XY) {
        glChamberIndex = summary.getDetector().GlobalChamberIndex(cid.endcap(), cid.station(), cid.ring(), cscPosition);
      }
    }

    config->copyChamberCounterValue(DMB_EVENTS, DMB_TRIGGERS, crateID, dmbID);

    if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED, mo)){
      mo->Fill(cscPosition, cscType);
    }

    float DMBEff = float(DMBEvents) / float(config->getNEvents());
    if(DMBEff > 1.0) {
      LOG_ERROR <<   cscTag  << " has efficiency " << DMBEff << " which is greater than 1";
    }

    int dmbHeaderL1A      = dmbHeader->l1a()%64;
    int dmb_ddu_l1a_diff  = (int)(dmbHeaderL1A-(int)(L1ANumber%64));
    if (dmb_ddu_l1a_diff != 0) L1A_out_of_sync = true;

    if (getCSCHisto(h::CSC_DMB_L1A_DISTRIB, crateID, dmbID, mo)) mo->Fill(dmbHeaderL1A);

    if (getCSCHisto(h::CSC_DMB_DDU_L1A_DIFF, crateID, dmbID, mo)) {
      if(dmb_ddu_l1a_diff < -32) {
        mo->Fill(dmb_ddu_l1a_diff + 64);
      } else {
        if(dmb_ddu_l1a_diff >= 32) mo->Fill(dmb_ddu_l1a_diff - 64);
        else mo->Fill(dmb_ddu_l1a_diff);
      }
      mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
    }

    if (getCSCHisto(h::CSC_DMB_L1A_VS_DDU_L1A, crateID, dmbID, mo)) mo->Fill((int)(L1ANumber & 0xFF), (int)dmbHeaderL1A);

    int dmbHeaderBXN      = 0;
    int dmb_ddu_bxn_diff  = 0;

    dmbHeaderBXN = dmbHeader->bxn12();
    dmb_ddu_bxn_diff = dmbHeaderBXN%64-BXN%64;
    if (getCSCHisto(h::CSC_DMB_BXN_DISTRIB, crateID, dmbID, mo)) mo->Fill((int)(dmbHeader->bxn12()));

    if (getCSCHisto(h::CSC_DMB_DDU_BXN_DIFF, crateID, dmbID, mo)) {
      if(dmb_ddu_bxn_diff < -32) mo->Fill(dmb_ddu_bxn_diff + 64);
      else {
        if(dmb_ddu_bxn_diff >= 32)  mo->Fill(dmb_ddu_bxn_diff - 64);
        else mo->Fill(dmb_ddu_bxn_diff);
      }
      mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
    }

    if (getCSCHisto(h::CSC_DMB_BXN_VS_DDU_BXN, crateID, dmbID, mo)) mo->Fill(((int)(BXN)) % 256, ((int)dmbHeaderBXN) % 256);

    int cfeb_dav = 0;
    int cfeb_dav_num = 0;
    int cfeb_movlp = 0;
    int dmb_cfeb_sync = 0;

    cfeb_dav = (int)dmbHeader->cfebAvailable();
    for (int i = 0; i < 5; i++) cfeb_dav_num += (cfeb_dav >> i) & 0x1;
    cfeb_movlp    = (int)dmbHeader->cfebMovlp();
    dmb_cfeb_sync = (int)dmbHeader->dmbCfebSync();

    if (getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbID, mo)) {
      for (int i = 0; i < 5; i++) {
        int cfeb_present = (cfeb_dav >> i) & 0x1;
        if (cfeb_present) {
          mo->Fill(i);
        }
      }
    }

    if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbID, mo)) mo->Fill(cfeb_dav_num);
    if (getCSCHisto(h::CSC_DMB_CFEB_MOVLP, crateID, dmbID, mo)) mo->Fill(cfeb_movlp);
    if (getCSCHisto(h::CSC_DMB_CFEB_SYNC, crateID, dmbID, mo)) mo->Fill(dmb_cfeb_sync);

    if (getEMUHisto(h::EMU_DMB_UNPACKED, mo)) {
      mo->Fill(crateID, dmbID);
    }

    if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebActive()); //KK

    if (getCSCHisto(h::CSC_DMB_L1_PIPE, crateID, dmbID, mo)) mo->Fill(dmbTrailer->dmb_l1pipe);

    if (getCSCHisto(h::CSC_DMB_FIFO_STATS, crateID, dmbID, mo)) {
      if (dmbTrailer->tmb_empty == 1) mo->Fill(1.0, 0.0); //KK
      if (dmbTrailer->tmb_half == 0) mo->Fill(1.0, 1.0);
      if (dmbTrailer->tmb_full == 1) mo->Fill(1.0, 2.0); //KK
      if (dmbTrailer->alct_empty == 1) mo->Fill(0.0, 0.0);
      if (dmbTrailer->alct_half == 0) mo->Fill(0.0, 1.0);
      if (dmbTrailer->alct_full == 1) mo->Fill(0.0, 2.0); //KK 0->1
      for (int i = 0; i < 5; i++) {
        if ((int)((dmbTrailer->cfeb_empty>>i)&0x1) == 1) mo->Fill(i + 2, 0.0);
        if ((int)((dmbTrailer->cfeb_half>>i)&0x1) == 0) mo->Fill(i + 2, 1);
        if ((int)((dmbTrailer->cfeb_full>>i)&0x1) == 1) {
          mo->Fill(i + 2, 2);
        }
      }
      mo->SetEntries((int)DMBEvents);
    }

    if (getCSCHisto(h::CSC_DMB_FEB_TIMEOUTS, crateID, dmbID, mo)) {
      if ((dmbTrailer->tmb_timeout == 0) && (dmbTrailer->alct_timeout == 0) && (dmbTrailer->cfeb_starttimeout == 0) && (dmbTrailer->cfeb_endtimeout == 0)) {
        mo->Fill(0.0);
      }else{
        if (dmbTrailer->alct_timeout) mo->Fill(1);
        if (dmbTrailer->tmb_timeout) mo->Fill(2);
        if (dmbTrailer->alct_endtimeout) mo->Fill(8); // KK
        if (dmbTrailer->tmb_endtimeout) mo->Fill(9);  // KK
      }
      for (int i = 0; i < 5; i++) {
        if ((dmbTrailer->cfeb_starttimeout >> i) & 0x1) {
          mo->Fill(i + 3);
        }
        if ((dmbTrailer->cfeb_endtimeout >> i) & 0x1) {
          mo->Fill(i + 10); // KK 8->10
        }
      }
      mo->SetEntries((int)DMBEvents);
    }

    int alct_dav  = dmbHeader->nalct();
    int tmb_dav   = dmbHeader->nclct();
    int cfeb_dav2 = 0;
    for (int i = 0; i < 5; i++) cfeb_dav2 = cfeb_dav2 + (int)((dmbHeader->cfebAvailable() >> i) & 0x1);

    if ((alct_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
      mo->Fill(0.0);
      float alct_dav_number   = mo->GetBinContent(1);
      if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
        mo->SetBinContent(1, ((float)alct_dav_number / (float)(DMBEvents) * 100.0));
        mo->SetEntries((int)DMBEvents);
      }
    }

    if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
      mo->Fill(1.0);
      float tmb_dav_number = mo->GetBinContent(2);
      if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
        mo->SetBinContent(2, ((float)tmb_dav_number / (float)(DMBEvents) * 100.0));
        mo->SetEntries((int)DMBEvents);
      }
    }

    if ((cfeb_dav2 > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
      mo->Fill(2.0);
      float cfeb_dav2_number = mo->GetBinContent(3);
      if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
        mo->SetBinContent(3, ((float)cfeb_dav2_number / (float)(DMBEvents) * 100.0));
        mo->SetEntries((int)DMBEvents);
      }
    }

    float feb_combination_dav = -1.0;
    if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbID, mo)) {
       if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 0.0; // Nothing
    if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 1.0; // ALCT Only
    if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav2 == 0) feb_combination_dav = 2.0; // TMB Only
    if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 >  0) feb_combination_dav = 3.0; // CFEB Only
    if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav2 >  0) feb_combination_dav = 4.0; // TMB+CFEB
    if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav2 == 0) feb_combination_dav = 5.0; // ALCT+TMB
    if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav2 >  0) feb_combination_dav = 6.0; // ALCT+CFEB
    if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav2 >  0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
      mo->Fill(feb_combination_dav);
      float feb_combination_dav_number = mo->GetBinContent((int)(feb_combination_dav + 1.0));
      if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_EFFICIENCY, crateID, dmbID, mo)) {
        mo->SetBinContent((int)(feb_combination_dav + 1.0), ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
        mo->SetEntries((int)DMBEvents);
      }
    }

    if (data.nalct()) {

      const CSCALCTHeader* alctHeader = data.alctHeader();
      int fwVersion = alctHeader->alctFirmwareVersion();
      const CSCALCTTrailer* alctTrailer = data.alctTrailer();
      const CSCAnodeData* alctData = data.alctData();

      if (alctHeader && alctTrailer) {

        std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
        std::vector<CSCALCTDigi> alctsDatas;

        for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
          if (alctsDatasTmp[lct].isValid()) alctsDatas.push_back(alctsDatasTmp[lct]);
        }

        FEBunpacked = FEBunpacked + 1;
        alct_unpacked = 1;

        if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
          mo->Fill(2);
          uint32_t ALCTEvent = (uint32_t)mo->GetBinContent(3);
          config->setChamberCounterValue(ALCT_TRIGGERS, crateID, dmbID, ALCTEvent);
          if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)){
            if(config->getNEvents() > 0) {
              mo->SetBinContent(1, ((float)ALCTEvent / (float)(DMBEvents) * 100.0));
              mo->SetEntries((int)DMBEvents);
            }
          }
        }

        if ((alct_dav >0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
          mo->Fill(0.0, 0.0);
        }

        if (getCSCHisto(h::CSC_ALCT_L1A, crateID, dmbID, mo)) mo->Fill((int)(alctHeader->L1Acc()));

        if (getCSCHisto(h::CSC_ALCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
          int alct_dmb_l1a_diff = (int)(alctHeader->L1Acc() % 64 - dmbHeader->l1a() % 64);
          if (alct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
          if(alct_dmb_l1a_diff < -32) mo->Fill(alct_dmb_l1a_diff + 64);
          else {
            if(alct_dmb_l1a_diff >= 32) mo->Fill(alct_dmb_l1a_diff - 64);
            else mo->Fill(alct_dmb_l1a_diff);
          }
          mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
        }

        if (getCSCHisto(h::CSC_DMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) mo->Fill(alctHeader->L1Acc() % 256, dmbHeader->l1a());

        if (getCSCHisto(h::CSC_ALCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
          int alct_dmb_bxn_diff = (int)(alctHeader->BXNCount()-dmbHeader->bxn12());
          if (alct_dmb_bxn_diff > 0) alct_dmb_bxn_diff -= 3564;
          alct_dmb_bxn_diff %= 64;
          mo->Fill(alct_dmb_bxn_diff);
          mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
        }

        if (getCSCHisto(h::CSC_ALCT_BXN, crateID, dmbID, mo)) mo->Fill(alctHeader->BXNCount());

        if (getCSCHisto(h::CSC_ALCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount()) % 256), (int)(dmbHeader->bxn12()) % 256);

        if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
          mo->Fill(alctsDatas.size());
          int nALCT = (int)mo->GetBinContent((int)(alctsDatas.size() + 1));
          if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo))
            mo->SetBinContent((int)(alctsDatas.size() + 1), (float)(nALCT) / (float)(DMBEvents) * 100.0);
        }

        if (getCSCHisto(h::CSC_ALCT_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(alctTrailer->wordCount()));

        if (alctsDatas.size() == 2) {
          if (getCSCHisto(h::CSC_ALCT1_VS_ALCT0_KEYWG, crateID, dmbID, mo))
            mo->Fill(alctsDatas[0].getKeyWG(),alctsDatas[1].getKeyWG());
        }

        MonitorObject* mo_CSC_ALCT0_BXN_mean = 0;
        getEMUHisto(h::EMU_CSC_ALCT0_BXN_MEAN, mo_CSC_ALCT0_BXN_mean);

        MonitorObject* mo_CSC_ALCT0_BXN_rms = 0;
        getEMUHisto(h::EMU_CSC_ALCT0_BXN_RMS, mo_CSC_ALCT0_BXN_rms);

        MonitorObject* mo_CSC_Plus_endcap_ALCT0_dTime = 0;
        getEMUHisto(h::EMU_CSC_ALCT0_ENDCAP_PLUS_DTIME, mo_CSC_Plus_endcap_ALCT0_dTime);

        MonitorObject* mo_CSC_Minus_endcap_ALCT0_dTime = 0;
        getEMUHisto(h::EMU_CSC_ALCT0_ENDCAP_MINUS_DTIME, mo_CSC_Minus_endcap_ALCT0_dTime);

        for (uint32_t lct = 0; lct < alctsDatas.size(); lct++) {

          if (lct >= 2) continue;       

          if (getCSCHisto(h::CSC_ALCTXX_KEYWG, crateID, dmbID, lct, mo)) {
            mo->Fill(alctsDatas[lct].getKeyWG());
          }

          if(lct == 0) alct_keywg  = alctsDatas[lct].getKeyWG();

          int alct_dtime = 0;
          if (fwVersion == 2007) {
            alct_dtime = alctsDatas[lct].getBX();
          } else {
            // Older 2006 Format
            alct_dtime = (int) (alctsDatas[lct].getBX() - (alctHeader->BXNCount()&0x1F));
          }

          if (getCSCHisto(h::CSC_ALCTXX_DTIME, crateID, dmbID, lct, mo)) {

            if(alct_dtime < -16) {
              mo->Fill(alct_dtime + 32);
            } else {
              if(alct_dtime >= 16) mo->Fill(alct_dtime - 32);
              else mo->Fill(alct_dtime);
            }

            mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");

            double dTime_mean = mo->getTH1()->GetMean();
            double dTime_rms = mo->getTH1()->GetRMS();

            // == For ALCT0 Fill Summary dTime Histograms
            if (lct == 0) {
              if (cid.endcap() == 1) {
                if (mo_CSC_Plus_endcap_ALCT0_dTime) mo_CSC_Plus_endcap_ALCT0_dTime->Fill(alct_dtime);
              }
              if (cid.endcap() == 2) {
                if (mo_CSC_Minus_endcap_ALCT0_dTime) mo_CSC_Minus_endcap_ALCT0_dTime->Fill(alct_dtime);
              }
              if (cscPosition && cscType && mo_CSC_ALCT0_BXN_mean) {
                mo_CSC_ALCT0_BXN_mean->SetBinContent(cscPosition, cscType + 1, dTime_mean);
              }
              if (cscPosition && cscType && mo_CSC_ALCT0_BXN_rms) {
                mo_CSC_ALCT0_BXN_rms->SetBinContent(cscPosition, cscType + 1, dTime_rms);
              }
            }

          }

          if (getCSCHisto(h::CSC_ALCTXX_DTIME_VS_KEYWG, crateID, dmbID, lct, mo)) {
            if(alct_dtime < -16) {
              mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
            } else {
              if(alct_dtime >= 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
              else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
            }
          }

          if (getCSCHisto(h::CSC_ALCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
            if(alct_dtime < -16) {
              mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
            } else {
              if (alct_dtime >= 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
              else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
            }
          }

          int alct_bxn = alctsDatas[lct].getBX();
          if (fwVersion == 2007) {
            alct_bxn = (alct_bxn + alctHeader->BXNCount())&0x1F;
          }

          if (getCSCHisto(h::CSC_ALCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(alct_bxn);

          if (getCSCHisto(h::CSC_ALCTXX_QUALITY, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());

          if (mo_EventDisplay) {
            mo_EventDisplay->SetBinContent(2, alctsDatas[lct].getKeyWG(), alct_bxn + 1 );
            mo_EventDisplay->SetBinContent(3, alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
          }

          if (getCSCHisto(h::CSC_ALCTXX_QUALITY_DISTR, crateID, dmbID, lct, mo)) {
            mo->Fill(alctsDatas[lct].getQuality());
            if (lct == 0) {
              MonitorObject* mo1 = 0;
              if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT0_QUALITY, mo1)) {
                mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
              }
            }
          }

          if (getCSCHisto(h::CSC_ALCTXX_QUALITY_PROFILE, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());

          if (getCSCHisto(h::CSC_ALCTXX_PATTERN, crateID, dmbID, lct, mo)) {
            int pattern = (alctsDatas[lct].getAccelerator() << 1) + alctsDatas[lct].getCollisionB();
            int keywg = alctsDatas[lct].getKeyWG();
            mo->Fill(keywg, pattern );
          }

          if (getCSCHisto(h::CSC_ALCTXX_PATTERN_DISTR, crateID, dmbID, lct, mo)) {
            int pattern = (alctsDatas[lct].getAccelerator()<<1) + alctsDatas[lct].getCollisionB();
            mo->Fill(pattern);
          }

        }

        int NumberOfLayersWithHitsInALCT = 0;
        int NumberOfWireGroupsWithHitsInALCT = 0;

        if (alctData) {

          MonitorObject* mo_AFEB_RawHits_TimeBins  = 0;
          getCSCHisto(h::CSC_CFEB_AFEB_RAWHITS_TIMEBINS, crateID, dmbID, mo_AFEB_RawHits_TimeBins);

          MonitorObject* mo_CSC_Plus_endcap_AFEB_RawHits_Time = 0;
          getEMUHisto(h::EMU_CSC_AFEB_ENDCAP_PLUS_RAWHITS_TIME, mo_CSC_Plus_endcap_AFEB_RawHits_Time);

          MonitorObject* mo_CSC_Minus_endcap_AFEB_RawHits_Time = 0;
          getEMUHisto(h::EMU_CSC_AFEB_ENDCAP_MINUS_RAWHITS_TIME, mo_CSC_Minus_endcap_AFEB_RawHits_Time);

          MonitorObject* mo_CSC_AFEB_RawHits_Time_mean = 0;
          getEMUHisto(h::EMU_CSC_AFEB_RAWHITS_TIME_MEAN, mo_CSC_AFEB_RawHits_Time_mean);

          MonitorObject* mo_CSC_AFEB_RawHits_Time_rms = 0;
          getEMUHisto(h::EMU_CSC_AFEB_RAWHITS_TIME_RMS, mo_CSC_AFEB_RawHits_Time_rms);

          for (int nLayer = 1; nLayer <= 6; nLayer++) {

            int wg_previous = -1;
            int tbin_previous = -1;
            bool CheckLayerALCT = true;

            std::vector<CSCWireDigi> wireDigis = alctData->wireDigis(nLayer);
            for (std::vector<CSCWireDigi>::iterator wireDigisItr = wireDigis.begin(); wireDigisItr != wireDigis.end(); ++wireDigisItr) {

              int wg = wireDigisItr->getWireGroup();
              std::vector<int> tbins = wireDigisItr->getTimeBinsOn();
              int tbin = wireDigisItr->getTimeBin();

              if (mo_EventDisplay) {
                mo_EventDisplay->SetBinContent(nLayer + 3, wg - 1, tbin + 1);
                setEmuEventDisplayBit(mo_Emu_EventDisplay_Anode, glChamberIndex, wg - 1, nLayer - 1);
                setEmuEventDisplayBit(mo_Emu_EventDisplay_XY, glChamberIndex, wg - 1, nLayer - 1);
              }

              if (CheckLayerALCT) {
                NumberOfLayersWithHitsInALCT = NumberOfLayersWithHitsInALCT + 1;
                CheckLayerALCT = false;
              }

              for (uint32_t n = 0; n < tbins.size(); n++) {

                tbin = tbins[n];
                if(wg != wg_previous || (tbin != tbin_previous + 1 && tbin != tbin_previous - 1) ) {

                  if (getCSCHisto(h::CSC_ALCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(wg - 1, tbin);

                  if (getCSCHisto(h::CSC_ALCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(wg - 1, tbin);

                  if (mo_AFEB_RawHits_TimeBins) mo_AFEB_RawHits_TimeBins->Fill(tbin);

                  if (cid.endcap() == 1) {
                    if (mo_CSC_Plus_endcap_AFEB_RawHits_Time) mo_CSC_Plus_endcap_AFEB_RawHits_Time->Fill(tbin);
                  }
                  if (cid.endcap() == 2) {
                    if (mo_CSC_Minus_endcap_AFEB_RawHits_Time) mo_CSC_Minus_endcap_AFEB_RawHits_Time->Fill(tbin);
                  }

                  if (getCSCHisto(h::CSC_ALCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) {
                    mo->Fill(wg - 1);
                    int number_wg = (int)(mo->GetBinContent(wg));
                    Double_t Number_of_entries_ALCT = mo->GetEntries();
                    if (getCSCHisto(h::CSC_ALCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
                      mo->SetBinContent(wg, ((float) number_wg));
                      if((Double_t)(DMBEvents) > 0.0) {
                        mo->SetNormFactor(100.0*Number_of_entries_ALCT/(Double_t)(DMBEvents));
                      } else {
                        mo->SetNormFactor(100.0);
                      }
                      mo->SetEntries((int)DMBEvents);
                    }
                  }
                }
                if(wg != wg_previous) {
                  NumberOfWireGroupsWithHitsInALCT = NumberOfWireGroupsWithHitsInALCT + 1;
                }

                wg_previous   = wg;
                tbin_previous = tbin;
              }
            }

            // Fill Summary Anode Raw Hits Timing Plots
            if (mo_AFEB_RawHits_TimeBins) {

              double rawhits_time_mean = mo_AFEB_RawHits_TimeBins->getTH1()->GetMean();
              double rawhits_time_rms = mo_AFEB_RawHits_TimeBins->getTH1()->GetRMS();

              if (cscType && cscPosition && mo_CSC_AFEB_RawHits_Time_mean) {
                mo_CSC_AFEB_RawHits_Time_mean->SetBinContent(cscPosition, cscType + 1, rawhits_time_mean);
              }

              if (cscType && cscPosition && mo_CSC_AFEB_RawHits_Time_rms) {
                mo_CSC_AFEB_RawHits_Time_rms->SetBinContent(cscPosition, cscType + 1, rawhits_time_rms);
              }

            }

          }

        } else {
          LOG_ERROR << cscTag << " Can not unpack Anode Data";
        }

        if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) {
          mo->Fill(NumberOfLayersWithHitsInALCT);
          MonitorObject* mo1 = 0;
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_PLANES_WITH_HITS, mo1)) {
            mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
          }
        }

        if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_WIREGROUPS_WITH_HITS, crateID, dmbID, mo)) mo->Fill(NumberOfWireGroupsWithHitsInALCT);

      } else {
        LOG_ERROR << cscTag << " Can not unpack ALCT Header or/and Trailer";
      }
    } else {
      if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
        mo->Fill(0);
        int nALCT = (int)mo->GetBinContent(1);
        if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo))
          mo->SetBinContent(1, (float)(nALCT) / (float)(DMBEvents) * 100.0);
      }

      if ((alct_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
        mo->Fill(0.0, 1.0);
      }
    }

    if(data.nclct() && data.nalct()) {

      CSCALCTHeader* alctHeader = data.alctHeader();

      if (alctHeader) {
        std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
        std::vector<CSCALCTDigi> alctsDatas;

        for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
          if (alctsDatasTmp[lct].isValid())
            alctsDatas.push_back(alctsDatasTmp[lct]);
        }

        CSCTMBData* tmbData = data.tmbData();
        if (tmbData) {
          CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
          if (tmbHeader) {
            if (getCSCHisto(h::CSC_TMB_BXN_VS_ALCT_BXN, crateID, dmbID, mo))
              mo->Fill( ((int)(alctHeader->BXNCount())) % 256, ((int)(tmbHeader->BXNCount())) % 256 );

            if (getCSCHisto(h::CSC_TMB_ALCT_BXN_DIFF, crateID, dmbID, mo)) {
              int clct_alct_bxn_diff = (int)(alctHeader->BXNCount() - tmbHeader->BXNCount());
              if(clct_alct_bxn_diff < -2048) mo->Fill(clct_alct_bxn_diff + 4096);
              else {
                if(clct_alct_bxn_diff > 2048) mo->Fill(clct_alct_bxn_diff - 4096);
                else mo->Fill(clct_alct_bxn_diff);
              }
              mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
            }

            if (getCSCHisto(h::CSC_TMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo))
              mo->Fill((int)(alctHeader->L1Acc()%256),(int)(tmbHeader->L1ANumber()%256));

            if (getCSCHisto(h::CSC_TMB_ALCT_L1A_DIFF, crateID, dmbID, mo)) {
              int clct_alct_l1a_diff = (int)(tmbHeader->L1ANumber() - alctHeader->L1Acc());
              if(clct_alct_l1a_diff < -2048) mo->Fill(clct_alct_l1a_diff + 4096);
              else {
                if(clct_alct_l1a_diff > 2048)  mo->Fill(clct_alct_l1a_diff - 4096);
                else mo->Fill(clct_alct_l1a_diff);
              }
              mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
            }
          } else {
            LOG_ERROR << cscTag << " Can not unpack TMB Header";
          }

        } else {
          LOG_ERROR << cscTag << " Can not unpack TMB Data";
        }
      } else {
        LOG_ERROR << cscTag << " Can not unpack ALCT Header";
      }
    }

    if (data.nclct()) {

      CSCTMBData* tmbData = data.tmbData();
      if (tmbData) {

        CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
        CSCTMBTrailer* tmbTrailer = tmbData->tmbTrailer();

        if (tmbHeader && tmbTrailer) {

          CSCCLCTData* clctData = data.clctData();

          std::vector<CSCCLCTDigi> clctsDatasTmp = tmbHeader->CLCTDigis(cid.rawId());
          std::vector<CSCCLCTDigi> clctsDatas;

          for (uint32_t lct = 0; lct < clctsDatasTmp.size(); lct++) {
            if (clctsDatasTmp[lct].isValid()) clctsDatas.push_back(clctsDatasTmp[lct]);
          }

          FEBunpacked = FEBunpacked +1;
          tmb_unpacked = 1;

          if (getCSCHisto(h::CSC_ALCT_MATCH_TIME, crateID, dmbID, mo)) {

            mo->Fill(tmbHeader->ALCTMatchTime());
            double alct_match_mean = mo->getTH1()->GetMean();
            double alct_match_rms = mo->getTH1()->GetRMS();
            MonitorObject*  mo1 = 0;
                            
            if (cid.endcap() == 1) {
              if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_ALCT_CLCT_MATCH_TIME, mo1)) {
                mo1->Fill(tmbHeader->ALCTMatchTime());
              }
            }

            if (cid.endcap() == 2) {
              if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_ALCT_CLCT_MATCH_TIME, mo1)) {
                mo1->Fill(tmbHeader->ALCTMatchTime());
              }
            }
             
            if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_CLCT_MATCH_MEAN, mo1)) {              
              mo1->SetBinContent(cscPosition, cscType + 1, alct_match_mean);
            }

            if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_CLCT_MATCH_RMS, mo1)) {
              mo1->SetBinContent(cscPosition, cscType + 1, alct_match_rms);
            }

          }

          if (getCSCHisto(h::CSC_LCT_MATCH_STATUS, crateID, dmbID, mo)) {
            if (tmbHeader->CLCTOnly()) mo->Fill(0.0,0.0);
            if (tmbHeader->ALCTOnly()) mo->Fill(0.0,1.0);
            if (tmbHeader->TMBMatch()) mo->Fill(0.0,2.0);
          }

          if (getCSCHisto(h::CSC_LCT0_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn0Diff());
          if (getCSCHisto(h::CSC_LCT1_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn1Diff());

          if ((tmb_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
            mo->Fill(1.0, 0.0);
          }

          if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
            mo->Fill(3);
            uint32_t CLCTEvent = (uint32_t)mo->GetBinContent(4);
            config->setChamberCounterValue(CLCT_TRIGGERS, crateID, dmbID, CLCTEvent);
            if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
              if(config->getNEvents() > 0) {
                mo->SetBinContent(2,((float)CLCTEvent/(float)(DMBEvents)*100.0));
                mo->SetEntries(DMBEvents);
              }
            }
          }

          if (getCSCHisto(h::CSC_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber());

          if (getCSCHisto(h::CSC_CLCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
            int clct_dmb_l1a_diff = (int)((tmbHeader->L1ANumber() % 64)-dmbHeader->l1a() % 64);
            if (clct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
            if(clct_dmb_l1a_diff < -32) mo->Fill(clct_dmb_l1a_diff + 64);
            else {
              if(clct_dmb_l1a_diff >= 32)  mo->Fill(clct_dmb_l1a_diff - 64);
              else mo->Fill(clct_dmb_l1a_diff);
            }
            mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
          }

          if (getCSCHisto(h::CSC_DMB_L1A_VS_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber()%256,dmbHeader->l1a());

          if (getCSCHisto(h::CSC_CLCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
            int clct_dmb_bxn_diff = (int)(tmbHeader->BXNCount()%64-dmbHeader->bxn12()%64);
            if(clct_dmb_bxn_diff < -32) mo->Fill(clct_dmb_bxn_diff + 64);
            else {
              if(clct_dmb_bxn_diff >= 32)  mo->Fill(clct_dmb_bxn_diff - 64);
              else mo->Fill(clct_dmb_bxn_diff);
            }
            mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
          }

          if (getCSCHisto(h::CSC_CLCT_BXN, crateID, dmbID, mo)) mo->Fill((int)(tmbHeader->BXNCount()));

          if (getCSCHisto(h::CSC_CLCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill(tmbHeader->BXNCount()%256,dmbHeader->bxn12()%256);

          if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
            mo->Fill(clctsDatas.size());
            int nCLCT = (int)mo->GetBinContent((int)(clctsDatas.size()+1));
            if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent((int)(clctsDatas.size() + 1), (float)(nCLCT) / (float)(DMBEvents) * 100.0);
          }

          if (clctsDatas.size() == 1) {
            if (getCSCHisto(h::CSC_CLCT0_CLSSIFICATION, crateID, dmbID, mo)) {
              if (clctsDatas[0].getStripType()) mo->Fill(0.0);
              else mo->Fill(1.0);
            }
          }

          if (clctsDatas.size() == 2) {
            if (getCSCHisto(h::CSC_CLCT1_VS_CLCT0_KEY_STRIP, crateID, dmbID, mo))
              mo->Fill(clctsDatas[0].getKeyStrip(),clctsDatas[1].getKeyStrip());
            if (getCSCHisto(h::CSC_CLCT0_CLCT1_CLSSIFICATION, crateID, dmbID, mo)) {
              if ( clctsDatas[0].getStripType() &&  clctsDatas[1].getStripType())       mo->Fill(0.0);
              if ( clctsDatas[0].getStripType() && !clctsDatas[1].getStripType())       mo->Fill(1.0);
              if (!clctsDatas[0].getStripType() &&  clctsDatas[1].getStripType())       mo->Fill(2.0);
              if (!clctsDatas[0].getStripType() &&  !clctsDatas[1].getStripType())      mo->Fill(3.0);
            }
          }

          if (getCSCHisto(h::CSC_TMB_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(tmbTrailer->wordCount()));
          MonitorObject* mo_CSC_Plus_endcap_CLCT0_dTime = 0;
          getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_CLCT0_DTIME, mo_CSC_Plus_endcap_CLCT0_dTime);

          MonitorObject*  mo_CSC_Minus_endcap_CLCT0_dTime = 0;
          getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_CLCT0_DTIME, mo_CSC_Minus_endcap_CLCT0_dTime);

          MonitorObject*  mo_CSC_CLCT0_BXN_mean = 0;
          getEMUHisto(h::EMU_CSC_CLCT0_BXN_MEAN, mo_CSC_CLCT0_BXN_mean);

          MonitorObject*  mo_CSC_CLCT0_BXN_rms = 0;
          getEMUHisto(h::EMU_CSC_CLCT0_BXN_RMS, mo_CSC_CLCT0_BXN_rms);

          for (uint32_t lct = 0; lct < clctsDatas.size(); lct++) {

            if (getCSCHisto(h::CSC_CLCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getFullBX()%64);

            int clct_dtime = clctsDatas[lct].getFullBX() - tmbHeader->BXNCount();
            if (clct_dtime > 0) {
              clct_dtime -= 3564;
            }

            if (getCSCHisto(h::CSC_CLCTXX_DTIME, crateID, dmbID, lct, mo)) {
              int dTime = clct_dtime;
              /*
              if (clct_dtime < -16) {
                dTime = clct_dtime + 32;
              } else {
                if (clct_dtime > 16) dTime = clct_dtime - 32;
              }
              */

              mo->Fill(dTime);
              mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");

              double dTime_mean = mo->getTH1()->GetMean();
              double dTime_rms = mo->getTH1()->GetRMS();

              // == For CLCT0 Fill Summary dTime Histograms
              if (lct == 0) {
                if (cid.endcap() == 1) {
                  if (mo_CSC_Plus_endcap_CLCT0_dTime) mo_CSC_Plus_endcap_CLCT0_dTime->Fill(dTime);
                }
                if (cid.endcap() == 2) {
                  if (mo_CSC_Minus_endcap_CLCT0_dTime) mo_CSC_Minus_endcap_CLCT0_dTime->Fill(dTime);
                }
                if ( cscType && cscPosition && mo_CSC_CLCT0_BXN_mean) {
                  mo_CSC_CLCT0_BXN_mean->SetBinContent(cscPosition, cscType + 1, dTime_mean);
                }
                if (cscType && cscPosition && mo_CSC_CLCT0_BXN_rms) {
                  mo_CSC_CLCT0_BXN_rms->SetBinContent(cscPosition, cscType + 1, dTime_rms);
                }
              }

            }

            LOG_DEBUG <<  "LCT:" << lct << " Type:" << clctsDatas[lct].getStripType() << " Strip:" << clctsDatas[lct].getKeyStrip();

            if (clctsDatas[lct].getStripType()) { // HalfStrip Type

              if (getCSCHisto(h::CSC_CLCTXX_KEYHALFSTRIP, crateID, dmbID, lct, mo))
                mo->Fill(clctsDatas[lct].getKeyStrip());

              if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_HALF_STRIP, crateID, dmbID, lct, mo)) {
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
                /*
                if (clct_dtime < -16) {
                  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
                } else {
                  if (clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
                  else                 mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
                }
                */
              }

              if (getCSCHisto(h::CSC_CLCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
                /*
                if (clct_dtime < -16) {
                  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
                } else {
                  if (clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
                  else                 mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
                }
                */
              }

              if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_PATTERN, crateID, dmbID, lct, mo)) {

                int pattern_clct = clctsDatas[lct].getPattern();
                double tbin = -1;

                switch (pattern_clct) {
                  case 0:  tbin=0.; break;
                  case 1:  tbin=1.; break;
                  case 2:  tbin=2.; break;
                  case 3:  tbin=10.; break;
                  case 4:  tbin=3.; break;
                  case 5:  tbin=9.; break;
                  case 6:  tbin=4.; break;
                  case 7:  tbin=8.; break;
                  case 8:  tbin=5.; break;
                  case 9:  tbin=7.; break;
                  case 10: tbin=6.; break;
                }

                if (tbin >= 0) mo->Fill(clctsDatas[lct].getKeyStrip(), tbin);
  
                MonitorObject* mo1 = 0;
                if (getCSCHisto(h::CSC_CLCT_HALF_STRIP_PATTERN_DISTR, crateID, dmbID, lct, mo1)) mo1->Fill(tbin);

              }

              if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY, crateID, dmbID, lct, mo))
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
  
              if (mo_EventDisplay) {
                mo_EventDisplay->SetBinContent(10, clctsDatas[lct].getKeyStrip(), clct_dtime);
                mo_EventDisplay->SetBinContent(11, clctsDatas[lct].getKeyStrip(), clctsDatas[lct].getQuality());
              }

              if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_DISTR, crateID, dmbID, lct, mo)) {
                mo->Fill((int)(clctsDatas[lct].getQuality()));
                if (lct == 0) {
                  MonitorObject* mo1 = 0;
                  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_CLCT0_QUALITY, mo1))
                    mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
                }
              }

              if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));

            } else { // DiStrip Type

              LOG_INFO << "Entering block!";

              if (getCSCHisto(h::CSC_CLCTXX_KEYDISTRIP, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getKeyStrip());
              else LOG_ERROR << "Not found h::CSC_CLCTXX_KEYDISTRIP = " << h::CSC_CLCTXX_KEYDISTRIP;

              if(lct == 0) clct_kewdistrip = clctsDatas[lct].getKeyStrip();

              if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_DISTRIP, crateID, dmbID, lct, mo)) {
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
                /*
                if(clct_dtime < -16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
                else {
                  if(clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
                  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
                }
                */
              }

              if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_PATTERN, crateID, dmbID, lct, mo)) {
                int pattern_clct = (int)((clctsDatas[lct].getPattern() >> 1) & 0x3);
                if(pattern_clct == 1) mo->Fill(clctsDatas[lct].getKeyStrip(), 7.0);
                if(pattern_clct == 3) mo->Fill(clctsDatas[lct].getKeyStrip(), 6.0);
                if(pattern_clct == 5) mo->Fill(clctsDatas[lct].getKeyStrip(), 5.0);
                if(pattern_clct == 7) mo->Fill(clctsDatas[lct].getKeyStrip(), 4.0);
                if(pattern_clct == 6) mo->Fill(clctsDatas[lct].getKeyStrip(), 3.0);
                if(pattern_clct == 4) mo->Fill(clctsDatas[lct].getKeyStrip(), 2.0);
                if(pattern_clct == 2) mo->Fill(clctsDatas[lct].getKeyStrip(), 1.0);
                if(pattern_clct == 0) mo->Fill(clctsDatas[lct].getKeyStrip(), 0.0);
              }

              if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY, crateID, dmbID, lct, mo))
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));

              if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
                mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
            }
        }

        int N_CFEBs = 5;

        int NumberOfLayersWithHitsInCLCT = 0;
        int NumberOfHalfStripsWithHitsInCLCT = 0;

        if (clctData && clctData->check()) {

          MonitorObject* mo_CFEB_Comparators_TimeSamples  = 0;
          getCSCHisto(h::CSC_CFEB_COMPARATORS_TIMESAMPLES, crateID, dmbID, mo_CFEB_Comparators_TimeSamples);

          MonitorObject*  mo_CSC_Plus_endcap_CFEB_Comparators_Time = 0;
          getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_CFEB_COMPARATORS_TIME, mo_CSC_Plus_endcap_CFEB_Comparators_Time);

          MonitorObject*  mo_CSC_Minus_endcap_CFEB_Comparators_Time = 0;
          getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_CFEB_COMPARATORS_TIME, mo_CSC_Minus_endcap_CFEB_Comparators_Time);

          MonitorObject*  mo_CSC_CFEB_Comparators_Time_mean = 0;
          getEMUHisto(h::EMU_CSC_CFEB_COMPARATORS_TIME_MEAN, mo_CSC_CFEB_Comparators_Time_mean);
          
          MonitorObject*  mo_CSC_CFEB_Comparators_Time_rms = 0;
          getEMUHisto(h::EMU_CSC_CFEB_COMPARATORS_TIME_RMS, mo_CSC_CFEB_Comparators_Time_rms);

          for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {
            for (int nLayer = 1; nLayer <= 6; nLayer++) {

              int hstrip_previous    = -1;
              int tbin_clct_previous = -1;
              bool CheckLayerCLCT = true;

              std::vector<CSCComparatorDigi> compOutData = clctData->comparatorDigis(nLayer, nCFEB);

              for (std::vector<CSCComparatorDigi>::iterator compOutDataItr = compOutData.begin(); compOutDataItr != compOutData.end(); ++compOutDataItr) {
                int hstrip = 2 * (compOutDataItr->getStrip() - 1) + compOutDataItr->getComparator();
                std::vector<int> tbins_clct = compOutDataItr->getTimeBinsOn();
                int tbin_clct = (int)compOutDataItr->getTimeBin();

                if (mo_EventDisplay) {
                  mo_EventDisplay->SetBinContent(nLayer + 11, hstrip, tbin_clct + 1);
                  setEmuEventDisplayBit(mo_Emu_EventDisplay_Anode, glChamberIndex, 160 + hstrip, nLayer - 1);
                  setEmuEventDisplayBit(mo_Emu_EventDisplay_XY, glChamberIndex, 160 + hstrip, nLayer - 1);
                }

                if(CheckLayerCLCT) {
                  NumberOfLayersWithHitsInCLCT = NumberOfLayersWithHitsInCLCT + 1;
                  CheckLayerCLCT = false;
                }

                for (uint32_t n=0; n < tbins_clct.size(); n++) {
                  tbin_clct = tbins_clct[n];
                  if(hstrip != hstrip_previous || (tbin_clct != tbin_clct_previous + 1 && tbin_clct != tbin_clct_previous - 1) ) {

                    if (getCSCHisto(h::CSC_CLCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);

                    if (mo_CFEB_Comparators_TimeSamples) mo_CFEB_Comparators_TimeSamples->Fill(tbin_clct);

                    if (cid.endcap() == 1) {
                      if (mo_CSC_Plus_endcap_CFEB_Comparators_Time) mo_CSC_Plus_endcap_CFEB_Comparators_Time->Fill(tbin_clct);
                    }

                    if (cid.endcap() == 2) {
                      if (mo_CSC_Minus_endcap_CFEB_Comparators_Time) mo_CSC_Minus_endcap_CFEB_Comparators_Time->Fill(tbin_clct);
                    }

                    if (getCSCHisto(h::CSC_CLCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);

                    if (getCSCHisto(h::CSC_CLCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) {

                      mo->Fill(hstrip);

                      double number_hstrip = mo->GetBinContent(hstrip+1);
                      double Number_of_entries_CLCT = mo->GetEntries();

                      if (getCSCHisto(h::CSC_CLCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
                        mo->SetBinContent(hstrip + 1, number_hstrip);
                        if(DMBEvents > 0) {
                          double norm = (100.0 * Number_of_entries_CLCT) / ((double)(DMBEvents));
                          mo->SetNormFactor(norm);
                        } else {
                          mo->SetNormFactor(100.0);
                        }
                        mo->SetEntries(DMBEvents);
                      }
                    }
                  }

                  if(hstrip != hstrip_previous) {
                    NumberOfHalfStripsWithHitsInCLCT = NumberOfHalfStripsWithHitsInCLCT + 1;
                  }
                  hstrip_previous    = hstrip;
                  tbin_clct_previous = tbin_clct;
                }
              }
            }
          }

          if (mo_CFEB_Comparators_TimeSamples) {

            double comps_time_mean = mo_CFEB_Comparators_TimeSamples->getTH1()->GetMean();
            double comps_time_rms = mo_CFEB_Comparators_TimeSamples->getTH1()->GetRMS();

            if ( cscType && cscPosition && mo_CSC_CFEB_Comparators_Time_mean) {
              mo_CSC_CFEB_Comparators_Time_mean->SetBinContent(cscPosition, cscType + 1, comps_time_mean);
            }
            if ( cscType && cscPosition && mo_CSC_CFEB_Comparators_Time_rms) {
              mo_CSC_CFEB_Comparators_Time_rms->SetBinContent(cscPosition, cscType + 1, comps_time_rms);
            }

          }

        } else {
          LOG_ERROR << cscTag << " Can not unpack CLCT Data";
        }

        if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) {
          mo->Fill(NumberOfLayersWithHitsInCLCT);
          MonitorObject* mo1 = 0;
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_CLCT_PLANES_WITH_HITS, mo1)) {
            mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
          }
        }

        if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_HALFSTRIPS_WITH_HITS, crateID, dmbID, mo))
          mo->Fill(NumberOfHalfStripsWithHitsInCLCT);
        } else {
          LOG_ERROR << cscTag << " Can not unpack TMB Header or/and Trailer";
        }
      } else {
        LOG_ERROR << cscTag << " Can not unpack TMB Data";
      }

    } else {
      if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
        mo->Fill(0);
        int nCLCT = (int)mo->GetBinContent(1);
        if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent(1, (float)(nCLCT) / (float)(DMBEvents) * 100.0);
      }
      if ((tmb_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
        mo->Fill(1.0, 1.0);
      }
    }

    int NumberOfUnpackedCFEBs = 0;
    const int N_CFEBs = 5, N_Samples = 16, N_Layers = 6, N_Strips = 16;
    int ADC = 0, OutOffRange, Threshold = 30;
//     CSCCFEBData * cfebData[5];
//     CSCCFEBTimeSlice *  timeSlice[5][16];
//     CSCCFEBDataWord * timeSample[5][16][6][16];
    int Pedestal[5][6][16];
    std::pair<int,int> CellPeak[5][6][16];
    memset(CellPeak, 0, sizeof(CellPeak));
//     float PedestalError[5][6][16];
//     CSCCFEBSCAControllerWord scaControllerWord[5][16][6];
    bool CheckCFEB = true;
    float Clus_Sum_Charge;
    int TrigTime, L1APhase, UnpackedTrigTime, LCTPhase, SCA_BLK, NmbTimeSamples;
    int  FreeCells, LCT_Pipe_Empty, LCT_Pipe_Full, LCT_Pipe_Count, L1_Pipe_Empty, L1_Pipe_Full, Buffer_Count;
    bool CheckThresholdStripInTheLayer[6][80];
    for(int i=0; i<6; i++) {
      for(int j = 0; j < 80; j++) CheckThresholdStripInTheLayer[i][j] = true;
    }

    bool CheckOutOffRangeStripInTheLayer[6][80];
    for(int i=0; i<6; i++) {
      for(int j=0; j<80; j++) CheckOutOffRangeStripInTheLayer[i][j] = true;
    }

    float cscdata[N_CFEBs * 16][N_Samples][N_Layers];
    int SCABlockData[N_CFEBs * 16][N_Samples][N_Layers];
    memset(cscdata, 0, sizeof(cscdata));
    memset(SCABlockData, 0, sizeof(SCABlockData));
    char hbuf[255];
    memset(hbuf, 0, sizeof(hbuf));

    MonitorObject* mo_CFEB_SCA_CellPeak_Time  = 0;
    getCSCHisto(h::CSC_CFEB_SCA_CELLPEAK_TIME, crateID, dmbID, mo_CFEB_SCA_CellPeak_Time);
             
    MonitorObject*  mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time = 0;
    getEMUHisto(h::EMU_CSC_PLUS_ENDCAP_CFEB_SCA_CELLPEAK_TIME, mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time);

    MonitorObject*  mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time = 0;
    getEMUHisto(h::EMU_CSC_MINUS_ENDCAP_CFEB_SCA_CELLPEAK_TIME, mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time);

    MonitorObject*  mo_CSC_CFEB_SCA_CellPeak_Time_mean = 0;
    getEMUHisto(h::EMU_CSC_CFEB_SCA_CELLPEAK_TIME_MEAN, mo_CSC_CFEB_SCA_CellPeak_Time_mean);

    MonitorObject*  mo_CSC_CFEB_SCA_CellPeak_Time_rms = 0;
    getEMUHisto(h::EMU_CSC_CFEB_SCA_CELLPEAK_TIME_RMS, mo_CSC_CFEB_SCA_CellPeak_Time_rms);

    for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {

//       cfebData[nCFEB] = data.cfebData(nCFEB);
      if (data.cfebData(nCFEB) !=0) {
        if (!data.cfebData(nCFEB)->check()) continue;
        FEBunpacked = FEBunpacked +1; // Increment number of unpacked FED
        NumberOfUnpackedCFEBs = NumberOfUnpackedCFEBs + 1; // Increment number of unpaked CFEB
        cfeb_unpacked = 1;
        if(CheckCFEB == true){
          if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
            mo->Fill(4);
            uint32_t CFEBEvent = (uint32_t)mo->GetBinContent(5);
            config->setChamberCounterValue(CFEB_TRIGGERS, crateID, dmbID, CFEBEvent);
            if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
              if(config->getNEvents() > 0) {
                mo->SetBinContent(3, ((float)CFEBEvent/(float)(DMBEvents)*100.0));
                mo->SetEntries((int)DMBEvents);
              }
            }
          }

          if ((cfeb_dav2  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
            mo->Fill(2.0, 0.0);
          }
          CheckCFEB = false;
        }
        NmbTimeSamples= (data.cfebData(nCFEB))->nTimeSamples();
        MonitorObject* mo_CFEB_SCA_Block_Occupancy = 0;
        getCSCHisto(h::CSC_CFEBXX_SCA_BLOCK_OCCUPANCY, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Block_Occupancy);
        MonitorObject*  mo_CFEB_Free_SCA_Cells = 0;
        getCSCHisto(h::CSC_CFEBXX_FREE_SCA_CELLS, crateID, dmbID, nCFEB + 1, mo_CFEB_Free_SCA_Cells);
        MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTs = 0;
        getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTS, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Blocks_Locked_by_LCTs);
        MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTxL1 = 0;
        getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTXL1, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Blocks_Locked_by_LCTxL1);
        MonitorObject* mo_CFEB_DMB_L1A_diff = 0;
        getCSCHisto(h::CSC_CFEBXX_DMB_L1A_DIFF, crateID, dmbID, nCFEB + 1, mo_CFEB_DMB_L1A_diff);

        for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
          MonitorObject * mo_CFEB_Out_Off_Range_Strips = 0;
          getCSCHisto(h::CSC_CFEB_OUT_OFF_RANGE_STRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_Out_Off_Range_Strips);
          MonitorObject * mo_CFEB_Active_Samples_vs_Strip = 0;
          getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip);
          MonitorObject * mo_CFEB_Active_Samples_vs_Strip_Profile = 0;
          getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX_PROFILE, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip_Profile);
          MonitorObject * mo_CFEB_ActiveStrips = 0;
          getCSCHisto(h::CSC_CFEB_ACTIVESTRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_ActiveStrips);
          MonitorObject * mo_CFEB_SCA_Cell_Peak = 0;
          getCSCHisto(h::CSC_CFEB_SCA_CELL_PEAK_LY_XX, crateID, dmbID, nLayer, mo_CFEB_SCA_Cell_Peak);

          MonitorObject * mo_CFEB_Pedestal_withEMV_Sample = 0;
          getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHEMV_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withEMV_Sample);
          MonitorObject * mo_CFEB_Pedestal_withRMS_Sample = 0;
          getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withRMS_Sample);
          MonitorObject * mo_CFEB_PedestalRMS_Sample = 0;
          getCSCHisto(h::CSC_CFEB_PEDESTALRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_PedestalRMS_Sample);

          for(int nSample = 0; nSample < NmbTimeSamples; ++nSample) {
//             timeSlice[nCFEB][nSample] = (CSCCFEBTimeSlice * )((cfebData[nCFEB])->timeSlice(nSample));
            if (timeSlice(data, nCFEB, nSample) == 0) {
              LOG_WARN <<  "CFEB" << nCFEB << " nSample: " << nSample << " - B-Word";
              continue;
            }

            if (mo_CFEB_DMB_L1A_diff && !fCloseL1As ) {
              int cfeb_dmb_l1a_diff = (int)((timeSlice(data, nCFEB, nSample)->get_L1A_number())-dmbHeader->l1a()%64);
              if (cfeb_dmb_l1a_diff != 0) {
                L1A_out_of_sync = true;
              }
              if(cfeb_dmb_l1a_diff < -32) mo->Fill(cfeb_dmb_l1a_diff + 64);
              else {
                if(cfeb_dmb_l1a_diff >= 32) mo->Fill(cfeb_dmb_l1a_diff - 64);
                else mo_CFEB_DMB_L1A_diff->Fill(cfeb_dmb_l1a_diff);
              }
              mo_CFEB_DMB_L1A_diff->SetAxisRange(0.1, 1.1*(1.0+mo_CFEB_DMB_L1A_diff->GetBinContent(mo_CFEB_DMB_L1A_diff->GetMaximumBin())), "Y");
            }

//             scaControllerWord[nCFEB][nSample][nLayer-1] = timeSlice(cfebData, nCFEB, nSample)->scaControllerWord(nLayer);

            TrigTime = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).trig_time);
            FreeCells = timeSlice(data, nCFEB, nSample)->get_n_free_sca_blocks();
            LCT_Pipe_Empty = timeSlice(data, nCFEB, nSample)->get_lctpipe_empty();
            LCT_Pipe_Full = timeSlice(data, nCFEB, nSample)->get_lctpipe_full();
            LCT_Pipe_Count = timeSlice(data, nCFEB, nSample)->get_lctpipe_count();
            L1_Pipe_Empty = timeSlice(data, nCFEB, nSample)->get_l1pipe_empty();
            L1_Pipe_Full = timeSlice(data, nCFEB, nSample)->get_l1pipe_full();
            Buffer_Count = timeSlice(data, nCFEB, nSample)->get_buffer_count();

            SCA_BLK  = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).sca_blk);
            for(int nStrip = 0; nStrip < N_Strips; ++nStrip) {
              SCABlockData[nCFEB*16+nStrip][nSample][nLayer-1] = SCA_BLK;
            }
            if (mo_CFEB_SCA_Block_Occupancy) mo_CFEB_SCA_Block_Occupancy->Fill(SCA_BLK);

            if (mo_CFEB_Free_SCA_Cells) {
              if (timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).sca_full == 1) mo_CFEB_Free_SCA_Cells->Fill(-1);
              mo_CFEB_Free_SCA_Cells->Fill(FreeCells);
            }

            if (mo_CFEB_SCA_Blocks_Locked_by_LCTs) {
              if (LCT_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(-0.5);
              if (LCT_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(16.5);
              mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(LCT_Pipe_Count);
            }

            if (mo_CFEB_SCA_Blocks_Locked_by_LCTxL1) {
              if (L1_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(-0.5);
              if (L1_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(31.5);
              mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(Buffer_Count);
            }

            if(nSample == 0 && nLayer == 1) {
              TrigTime = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).trig_time);
              int k = 1;
              while (((TrigTime >> (k-1)) & 0x1) != 1 && k <= 8) {
                k = k + 1;
              }
              L1APhase = (int)((timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).l1a_phase) & 0x1);
              UnpackedTrigTime = ((k << 1) & 0xE) + L1APhase;

              if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME, crateID, dmbID, nCFEB + 1, mo))
                mo->Fill((int)UnpackedTrigTime);
              LCTPhase = (int)((timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).lct_phase)&0x1);

              if (getCSCHisto(h::CSC_CFEBXX_LCT_PHASE_VS_L1A_PHASE, crateID, dmbID, nCFEB + 1, mo))
                mo->Fill(LCTPhase, L1APhase);

              if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_VS_DMB, crateID, dmbID, nCFEB + 1, mo))
                mo->Fill((int)(dmbHeader->dmbCfebSync()), (int)UnpackedTrigTime);

              if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_DMB_DIFF, crateID, dmbID, nCFEB + 1, mo)) {
                int cfeb_dmb_L1A_sync_time = (int)(dmbHeader->dmbCfebSync()) - (int)UnpackedTrigTime;
                if(cfeb_dmb_L1A_sync_time < -8) mo->Fill(cfeb_dmb_L1A_sync_time+16);
                else {
                  if(cfeb_dmb_L1A_sync_time >= 8) mo->Fill(cfeb_dmb_L1A_sync_time-16);
                  else mo->Fill(cfeb_dmb_L1A_sync_time);
                }
                mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
              }

            }


            for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
//               timeSample[nCFEB][nSample][nLayer - 1][nStrip - 1]=(data.cfebData(nCFEB)->timeSlice(nSample))->timeSample(nLayer,nStrip);
              ADC = (int) ((timeSample(data, nCFEB, nSample, nLayer, nStrip)->adcCounts) & 0xFFF);
              OutOffRange = (int) ((timeSample(data, nCFEB, nSample, nLayer, nStrip)->adcOverflow) & 0x1);

              if(nSample == 0) { // nSample == 0
                CellPeak[nCFEB][nLayer-1][nStrip-1] = std::make_pair(nSample,ADC);
                Pedestal[nCFEB][nLayer-1][nStrip-1] = ADC;
              }

              if(OutOffRange == 1 && CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
                if ( mo_CFEB_Out_Off_Range_Strips)
                  mo_CFEB_Out_Off_Range_Strips->Fill((int)(nCFEB * 16 + nStrip - 1));
                CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
              }
              if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold && OutOffRange != 1) {       
                if (mo_CFEB_Active_Samples_vs_Strip)
                  mo_CFEB_Active_Samples_vs_Strip->Fill((int)(nCFEB * 16 + nStrip - 1), nSample);

                if (mo_CFEB_Active_Samples_vs_Strip_Profile)
                  mo_CFEB_Active_Samples_vs_Strip_Profile->Fill((int)(nCFEB * 16 + nStrip - 1), nSample);

                if(CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
                  if (mo_CFEB_ActiveStrips)
                    mo_CFEB_ActiveStrips->Fill((int)(nCFEB * 16 + nStrip));
                  CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
                }
                if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold) {
                  cscdata[nCFEB * 16 + nStrip - 1][nSample][nLayer - 1] = ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1];
                }       
                if(ADC > CellPeak[nCFEB][nLayer - 1][nStrip - 1].second) {
                  CellPeak[nCFEB][nLayer - 1][nStrip - 1].first = nSample;
                  CellPeak[nCFEB][nLayer - 1][nStrip - 1].second = ADC;
                }
              }
              if(nSample == 1) {
                int channel_threshold = 40;
                if (std::abs(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1]) < channel_threshold) {
                  if (mo_CFEB_Pedestal_withEMV_Sample)
                    mo_CFEB_Pedestal_withEMV_Sample->Fill((int)(nCFEB * 16 + nStrip - 1), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);

                  if (mo_CFEB_Pedestal_withRMS_Sample) {
                    mo_CFEB_Pedestal_withRMS_Sample->Fill((int)(nCFEB * 16 + nStrip - 1), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
//                     PedestalError[nCFEB][nLayer - 1][nStrip - 1] = mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip);

                    if (mo_CFEB_PedestalRMS_Sample) {
                      mo_CFEB_PedestalRMS_Sample->SetBinContent(nCFEB * 16 + nStrip - 1, mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip));
                      mo_CFEB_PedestalRMS_Sample->SetBinError(nCFEB * 16 + nStrip - 1, 0.00000000001);
                    }
                  }
                }
                Pedestal[nCFEB][nLayer-1][nStrip-1] += ADC;
                Pedestal[nCFEB][nLayer-1][nStrip-1] /= 2;
              }
            }
          }

          for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
            if (mo_CFEB_SCA_Cell_Peak && CellPeak[nCFEB][nLayer - 1][nStrip - 1].first) {
              mo_CFEB_SCA_Cell_Peak->Fill((int)(nCFEB * 16 + nStrip - 1), CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
              if (mo_CFEB_SCA_CellPeak_Time) {
                mo_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
              }

              if (mo_EventDisplay) {
                int peak_sample = CellPeak[nCFEB][nLayer-1][nStrip-1].first;
                int peak_adc = CellPeak[nCFEB][nLayer-1][nStrip-1].second;
                int pedestal = Pedestal[nCFEB][nLayer-1][nStrip-1];
                int peak_sca_charge = peak_adc - pedestal;
                                                                                        
                if (peak_adc - pedestal > Threshold) {
                  if (peak_sample >=1) {
                    peak_sca_charge += ((timeSample(data, nCFEB, peak_sample-1, nLayer, nStrip)->adcCounts)&0xFFF)-pedestal;
                  }
                  if (peak_sample < NmbTimeSamples-1) {
                    peak_sca_charge += ((timeSample(data, nCFEB, peak_sample+1, nLayer, nStrip)->adcCounts)&0xFFF)-pedestal;
                  }
                  mo_EventDisplay->SetBinContent(nLayer + 17, nCFEB * 16 + nStrip - 1, peak_sca_charge);
                  setEmuEventDisplayBit(mo_Emu_EventDisplay_Cathode, glChamberIndex, nCFEB * 16 + nStrip - 1, nLayer - 1);
                }
              }

              if (cid.endcap() == 1) {
                if (mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time) 
                  mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
              }
              if (cid.endcap() == 2) {
                if (mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time) 
                  mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
              }
            }
          }

        }
      }

    }

    // Fill Summary CFEB Raw Hits Timing Plots
    if (mo_CFEB_SCA_CellPeak_Time) {
      double cellpeak_time_mean = mo_CFEB_SCA_CellPeak_Time->getTH1()->GetMean();
      double cellpeak_time_rms = mo_CFEB_SCA_CellPeak_Time->getTH1()->GetRMS();
      if (cscType && cscPosition && mo_CSC_CFEB_SCA_CellPeak_Time_mean) {
        mo_CSC_CFEB_SCA_CellPeak_Time_mean->SetBinContent(cscPosition, cscType + 1, cellpeak_time_mean);
      }
      if (cscType && cscPosition && mo_CSC_CFEB_SCA_CellPeak_Time_rms) {
        mo_CSC_CFEB_SCA_CellPeak_Time_rms->SetBinContent(cscPosition, cscType + 1 ,cellpeak_time_rms);
      }
    }

    const int a = N_CFEBs * N_Strips;
    const int b = a * N_Samples;
    float Cathodes[b * N_Layers];
    for(int i = 0; i < N_Layers; ++i) {
      const int b1 = i * b;
      for(int j = 0; j < a; ++j) {
        const int b2 = b1 + j;
        for(int k = 0; k < N_Samples; ++k) {
          Cathodes[b2 + a * k] = cscdata[j][k][i];
        }
      }
    }

    std::vector<StripCluster> Clus;
    Clus.clear();
    StripClusterFinder ClusterFinder(N_Layers, N_Samples, N_CFEBs, N_Strips);

    for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {

      ClusterFinder.DoAction(nLayer - 1, Cathodes);
      Clus = ClusterFinder.getClusters();

      if (getCSCHisto(h::CSC_CFEB_NUMBER_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
        // Allways true because Clus.size() = unsigned
        // if (Clus.size() >= 0)  
        mo->Fill(Clus.size());
      }

      for(uint32_t u = 0; u < Clus.size(); u++){

        Clus_Sum_Charge = 0.0;

        for(uint32_t k = 0;k < Clus[u].ClusterPulseMapHeight.size(); k++) {

          for(int n = Clus[u].LFTBNDTime; n < Clus[u].IRTBNDTime; n++) {
            Clus_Sum_Charge = Clus_Sum_Charge + Clus[u].ClusterPulseMapHeight[k].height_[n];
          }

        }

        if (getCSCHisto(h::CSC_CFEB_CLUSTERS_CHARGE_LY_XX, crateID, dmbID, nLayer, mo)) {
          mo->Fill(Clus_Sum_Charge);
        }

        if (getCSCHisto(h::CSC_CFEB_WIDTH_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
          mo->Fill(Clus[u].IRTBNDStrip - Clus[u].LFTBNDStrip + 1);
        }

        if (getCSCHisto(h::CSC_CFEB_CLUSTER_DURATION_LY_XX, crateID, dmbID, nLayer, mo)) {
          mo->Fill(Clus[u].IRTBNDTime - Clus[u].LFTBNDTime + 1);
        }

      }

      Clus.clear();

    }

    if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_UNPACKED_VS_DAV, crateID, dmbID, mo)) {
      float feb_combination_unpacked = -1.0;
      if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 0.0;
      if(alct_unpacked >  0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 1.0;
      if(alct_unpacked == 0 && tmb_unpacked >  0 && cfeb_unpacked == 0) feb_combination_unpacked = 2.0;
      if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked >  0) feb_combination_unpacked = 3.0;
      if(alct_unpacked >  0 && tmb_unpacked >  0 && cfeb_unpacked == 0) feb_combination_unpacked = 4.0;
      if(alct_unpacked >  0 && tmb_unpacked == 0 && cfeb_unpacked >  0) feb_combination_unpacked = 5.0;
      if(alct_unpacked == 0 && tmb_unpacked >  0 && cfeb_unpacked >  0) feb_combination_unpacked = 6.0;
      if(alct_unpacked >  0 && tmb_unpacked >  0 && cfeb_unpacked >  0) feb_combination_unpacked = 7.0;
      mo->Fill(feb_combination_dav, feb_combination_unpacked);
    }

    if((clct_kewdistrip > -1 && alct_keywg > -1) && (getCSCHisto(h::CSC_CLCT0_KEYDISTRIP_VS_ALCT0_KEYWIREGROUP, crateID, dmbID, mo))) {
      mo->Fill(alct_keywg, clct_kewdistrip);
    }

    if (L1A_out_of_sync && cscType && cscPosition && getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, mo)){
      mo->Fill(cscPosition, cscType);
    }

    if (L1A_out_of_sync && getEMUHisto(h::EMU_DMB_L1A_OUT_OF_SYNC, mo)){
      mo->Fill(crateID, dmbID);
    }

  }
void cscdqm::EventProcessor::processDDU ( const CSCDDUEventData dduData,
const CSCDCCExaminer binChecker 
) [private]

Process DDU output and fill MOs.

Parameters:
dduDataDDU object to process

LOG4CPLUS_WARN(logger_,eTag << "Skipped because of DDU Trailer check failed.");

Only 8bits are significant; format of DDU id is Dxx

DDU word counter

LOG4CPLUS_DEBUG(logger_,dduTag << " Trailer Word (64 bits) Count = " << std::dec << trl_word_count);

if (fCloseL1As) LOG4CPLUS_DEBUG(logger_,eTag << " Close L1As bit is set");

DDU Header bunch crossing number (BXN)

LOG4CPLUS_WARN(logger_,dduTag << " DDU Header BXN Number = " << std::dec << BXN);

L1A number from DDU Header

LOG4CPLUS_DEBUG(logger_,dduTag << " Header L1A Number = " << std::dec << L1ANumber);

Handle 24-bit L1A roll-over maximum value case

== Occupancy and number of DMB (CSC) with Data available (DAV) in header of particular DDU

== Number of active DMB (CSC) in header of particular DDU

LOG4CPLUS_DEBUG(logger_,dduTag << " Header DMB DAV = 0x" << std::hex << dmb_dav_header);

LOG4CPLUS_DEBUG(logger_,dduTag << " Header Number of Active DMB = " << std::dec << dmb_active_header);

Check binary Error status at DDU Trailer

LOG4CPLUS_DEBUG(logger_,dduTag << " Trailer Error Status = 0x" << std::hex << trl_errorstat);

Unpack all found CSC

First event per DDU

Definition at line 27 of file CSCDQM_EventProcessor_processDDU.cc.

References BXN, CSCDDUHeader::bxnum(), CSCDDUTrailer::check(), config, CSCDDUEventData::cscData(), CSCDDUHeader::dmb_dav(), CSCDDUTrailer::dmb_full(), CSCDDUTrailer::dmb_warn(), CSCDDUTrailer::errorstat(), fCloseL1As, cscdqm::MonitorObject::Fill(), fNotFirstEvent, cscdqm::MonitorObject::GetBinContent(), getDDUHisto(), getEMUHisto(), cscdqm::Configuration::getNEvents(), cscdqm::DDUHistoDef::getPath(), CSCDDUEventData::header(), i, L1ANumber, L1ANumbers, CSCDDUHeader::live_cscs(), CSCDDUHeader::lvl1num(), CSCDDUHeader::ncsc(), processCSC(), CSCDDUTrailer::reserved(), cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetEntries(), CSCDDUEventData::sizeInWords(), CSCDDUHeader::source_id(), CSCDDUEventData::trailer(), and CSCDDUTrailer::wordcount().

                                                                                                  {
    
    CSCDDUHeader dduHeader  = dduData.header();
    CSCDDUTrailer dduTrailer = dduData.trailer();
    if (!dduTrailer.check()) {
      return;
    }

    int dduID = dduHeader.source_id() & 0xFF;

    MonitorObject* mo = 0;

    if (getEMUHisto(h::EMU_ALL_DDUS_IN_READOUT, mo)) {
      mo->Fill(dduID);
    }

    std::string dduTag = DDUHistoDef::getPath(dduID);

    uint32_t dduEvtSize = dduData.sizeInWords()*2; 

    // if (dduEvtSize > 48) 
    { 

    int trl_word_count = 0;
    trl_word_count = dduTrailer.wordcount();

    if (getDDUHisto(h::DDU_BUFFER_SIZE, dduID, mo)) mo->Fill(dduEvtSize);

    if (getDDUHisto(h::DDU_WORD_COUNT, dduID, mo)) mo->Fill(trl_word_count );
  
    if (trl_word_count > 0) { 
      if (getEMUHisto(h::EMU_ALL_DDUS_EVENT_SIZE, mo)) {
        mo->Fill(dduID, log10((double)trl_word_count));
      }
    }

    if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_EVENT_SIZE, mo)) {
      mo->Fill(dduID, trl_word_count);
    }

    }

    fCloseL1As = dduTrailer.reserved() & 0x1; // Get status if Close L1As bit
    BXN = dduHeader.bxnum();
    if (getEMUHisto(h::EMU_DDU_BXN, mo)) mo->Fill(BXN);
    if (getDDUHisto(h::DDU_BXN, dduID, mo)) mo->Fill(BXN);

    int L1ANumber_previous_event = L1ANumbers[dduID];
    L1ANumbers[dduID] = (int)(dduHeader.lvl1num());
    L1ANumber = L1ANumbers[dduID];
    int L1A_inc = L1ANumber - L1ANumber_previous_event;

    if ( L1A_inc < 0 ) L1A_inc = 0xFFFFFF + L1A_inc;

    // if (!fFirstEvent) {
    if (fNotFirstEvent[dduID]) {
      if (getDDUHisto(h::DDU_L1A_INCREMENT, dduID, mo)) mo->Fill(L1A_inc);
      if (getEMUHisto(h::EMU_ALL_DDUS_L1A_INCREMENT, mo)) {
        if      (L1A_inc > 100000){ L1A_inc = 19;}
        else if (L1A_inc > 30000) { L1A_inc = 18;}
        else if (L1A_inc > 10000) { L1A_inc = 17;}
        else if (L1A_inc > 3000)  { L1A_inc = 16;}
        else if (L1A_inc > 1000)  { L1A_inc = 15;}
        else if (L1A_inc > 300)   { L1A_inc = 14;}
        else if (L1A_inc > 100)   { L1A_inc = 13;}
        else if (L1A_inc > 30)    { L1A_inc = 12;}
        else if (L1A_inc > 10)    { L1A_inc = 11;}
        mo->Fill(dduID, L1A_inc);
      }
    }

    int dmb_dav_header      = 0;
    int dmb_dav_header_cnt  = 0;
  
    int ddu_connected_inputs= 0;
    int ddu_connected_inputs_cnt = 0;
  
    int csc_error_state     = 0;
    int csc_warning_state   = 0;
  
    int dmb_active_header   = 0;
  
    dmb_dav_header       = dduHeader.dmb_dav();
    dmb_active_header    = (int)(dduHeader.ncsc() & 0xF);
    csc_error_state      = dduTrailer.dmb_full()  & 0x7FFF; // Only 15 inputs for DDU
    csc_warning_state    = dduTrailer.dmb_warn()  & 0x7FFF; // Only 15 inputs for DDU
    ddu_connected_inputs = dduHeader.live_cscs();
  
    double freq = 0;
    for (int i = 0; i < 15; ++i) {
      if ((dmb_dav_header >> i) & 0x1) {
        dmb_dav_header_cnt++;      
        if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY_RATE, dduID, mo)) {
        mo->Fill(i + 1);
        freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
          if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo)) 
            mo->SetBinContent(i+1,freq);
        }
        if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WITH_DATA, mo)) {
          mo->Fill(dduID, i);
        }
      }
  
      if( (ddu_connected_inputs >> i) & 0x1 ){
        ddu_connected_inputs_cnt++;
        if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS_RATE, dduID, mo)) {
        mo->Fill(i + 1);
        freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
        if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo))
            mo->SetBinContent(i + 1, freq);
        }
        if (getEMUHisto(h::EMU_ALL_DDUS_LIVE_INPUTS, mo)) {
          mo->Fill(dduID, i);
        }
      }
  
      if( (csc_error_state >> i) & 0x1 ){
        if (getDDUHisto(h::DDU_CSC_ERRORS_RATE, dduID, mo)) {
        mo->Fill(i + 1);
        freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
        if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo)) 
            mo->SetBinContent(i + 1, freq);
        }
        if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_ERRORS, mo)) {
          mo->Fill(dduID, i + 2);
        }
      }
        
      if((csc_warning_state >> i) & 0x1 ){
        if (getDDUHisto(h::DDU_CSC_WARNINGS_RATE, dduID, mo)) {
        mo->Fill(i + 1);
        freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
        if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetBinContent(i + 1, freq);
        }
        if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WARNINGS, mo)) {
          mo->Fill(dduID, i + 2);
        }
      }
    }
  
    if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_LIVE_INPUTS, mo)) {
      mo->Fill(dduID, ddu_connected_inputs_cnt);
    }
 
   // if (dduEvtSize > 48) 
   {   
    if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_INPUTS_WITH_DATA, mo)) {
      mo->Fill(dduID, dmb_dav_header_cnt);
    }
   }
  
    if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_ERRORS, mo)) {
      if (csc_error_state > 0) {
        mo->Fill(dduID, 1); // Any Input
      } else {
        mo->Fill(dduID, 0); // No errors
      }
    }
  
    if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WARNINGS, mo)) {
      if (csc_warning_state > 0) {
        mo->Fill(dduID, 1); // Any Input
      } else { 
        mo->Fill(dduID, 0); // No errors
      }
    }
  
    if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo)) mo->SetEntries(config->getNEvents());
    if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo)) mo->SetEntries(config->getNEvents());
    if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo)) mo->SetEntries(config->getNEvents());
    if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetEntries(config->getNEvents());
    if (getDDUHisto(h::DDU_DMB_ACTIVE_HEADER_COUNT, dduID, mo)) mo->Fill(dmb_active_header);
    if (getDDUHisto(h::DDU_DMB_DAV_HEADER_COUNT_VS_DMB_ACTIVE_HEADER_COUNT, dduID, mo)) 
      mo->Fill(dmb_active_header, dmb_dav_header_cnt);
  
    uint32_t trl_errorstat = dduTrailer.errorstat();
    if (dmb_dav_header_cnt == 0) trl_errorstat &= ~0x20000000; // Ignore No Good DMB CRC bit of no DMB is present
    for (int i = 0; i < 32; i++) {
      if ((trl_errorstat >> i) & 0x1) {
        if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_RATE, dduID, mo)) { 
        mo->Fill(i);
        double freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
        if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo)) 
            mo->SetBinContent(i+1, freq);
        }
        if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo)) 
          mo->Fill(0.,i);
      }
    }
    if (getEMUHisto(h::EMU_ALL_DDUS_TRAILER_ERRORS, mo)) {
      if (trl_errorstat) {
        mo->Fill(dduID, 1); // Any Error
        for (int i = 0; i < 32; i++) {  
        if ((trl_errorstat >> i) & 0x1) {
          mo->Fill(dduID, i + 2);
        }
        }
      } else {
        mo->Fill(dduID, 0); // No Errors
      }
    }
        
    if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo)) mo->SetEntries(config->getNEvents());
    if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo)) mo->SetEntries(config->getNEvents());
  

    uint32_t nCSCs = 0;

    if (config->getPROCESS_CSC()) { 

      std::vector<CSCEventData> chamberDatas;
      chamberDatas.clear();
      chamberDatas = dduData.cscData();
  
      nCSCs = chamberDatas.size();

      for(uint32_t i = 0; i < nCSCs; i++) {
        processCSC(chamberDatas[i], dduID, binChecker);
      }

    }
  
    if (getDDUHisto(h::DDU_DMB_UNPACKED_VS_DAV, dduID, mo)) mo->Fill(dmb_active_header, nCSCs);
  
    // fFirstEvent = false;

    fNotFirstEvent[dduID] = true;
  
  }
bool cscdqm::EventProcessor::processExaminer ( const CSCDCCExaminer binChecker,
const CSCDCCFormatStatusDigi digi 
) [private]

Fill monitor elements with CSCDCCFormatStatusDigi information.

Returns:
true if this buffer (event) was accepted by Examiner else otherwise

Check and fill CSC Payload information

Update counters

Get FEBs Data Available Info

Increment total number of CFEBs, ALCTs, TMBs

Fill Histogram for FEB DAV Efficiency

Fill Histogram for Different Combinations of FEB DAV Efficiency

Check and fill CSC Data Flow Problems

Check and fill CSC Format Errors

Definition at line 27 of file CSCDQM_EventProcessor_processExaminer.cc.

References cscdqm::BAD_EVENTS, cscd2r::chamberID(), cntALCTs, cntCFEBs, cntDMBs, cntTMBs, config, cscdqm::Configuration::copyChamberCounterValue(), cscdqm::DMB_EVENTS, cscdqm::DMB_TRIGGERS, cscdqm::MonitorObject::Fill(), cscdqm::Configuration::fnGetCSCDetId, cscdqm::MonitorObject::GetBinContent(), cscdqm::Configuration::getChamberCounterValue(), CSCDCCFormatStatusDigi::getCSCErrors(), getCSCFromMap(), getCSCHisto(), CSCDCCFormatStatusDigi::getCSCPayload(), CSCDCCFormatStatusDigi::getCSCStatus(), CSCDCCFormatStatusDigi::getDDUErrors(), CSCDCCFormatStatusDigi::getDDUSummaryErrors(), getEMUHisto(), CSCDCCFormatStatusDigi::getListOfDDUs(), i, cscdqm::Configuration::incChamberCounter(), cscdqm::Configuration::incNEventsBad(), CSCDCCFormatStatusDigi::nextCSCWithError(), CSCDCCFormatStatusDigi::nextCSCWithPayload(), CSCDCCFormatStatusDigi::nextCSCWithStatus(), CSCDCCExaminer::nSTATUSES, cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetEntries(), and cscdqm::MonitorObject::SetMaximum().

                                                                                                           {

    bool eventAccepted = true;
    MonitorObject* mo = 0;

    uint32_t binErrorStatus = digi.getDDUSummaryErrors();

    if (getEMUHisto(h::EMU_ALL_DDUS_FORMAT_ERRORS, mo)) {

      const std::set<DDUIdType> DDUs = digi.getListOfDDUs();
      for (std::set<DDUIdType>::const_iterator ddu_itr = DDUs.begin(); ddu_itr != DDUs.end(); ++ddu_itr) {
        ExaminerStatusType errs = digi.getDDUErrors(*ddu_itr);
        int dduID = (*ddu_itr)&0xFF;
        if (errs != 0) {
          for(int i = 0; i < 29; i++) { 
            if ((errs >> i) & 0x1 ) {
              mo->Fill(dduID, i + 1);
            }
          }
        } else {
          mo->Fill(dduID, 0);
        }
      }

    }
  
    // =VB= We want to use DCC level check mask as in CSCDCCUnpacker and not DDU mask
    //      Otherwise whole DCC event could be skipped because of a single chamber error
    unsigned long dccBinCheckMask = 0x06080016;
//    if ((binErrorStatus & config->getDDU_BINCHECK_MASK()) > 0) {
    if ((binErrorStatus & dccBinCheckMask) > 0) {
      eventAccepted = false;
    }

    if (binErrorStatus != 0) {
      config->incNEventsBad();
    }

    {
      uint32_t i = 0;
      CSCIdType chamberID = 0;
      while (digi.nextCSCWithPayload(i, chamberID)) {

        int crateID = (chamberID >> 4) & 0xFF;
        int dmbSlot = chamberID & 0xF;
      
        if (crateID == 255) { continue; }

        // Check if in standby!
        { 
          CSCDetId cid;
          if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
            continue;
          } 
        }

        config->incChamberCounter(DMB_EVENTS, crateID, dmbSlot);
        long DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot);
        config->copyChamberCounterValue(DMB_EVENTS, DMB_TRIGGERS, crateID, dmbSlot);
        cntDMBs++;

        if (getEMUHisto(h::EMU_DMB_REPORTING, mo)) {
          mo->Fill(crateID, dmbSlot);
        }

        unsigned int cscType   = 0;
        unsigned int cscPosition = 0;
        if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;

        if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_REPORTING, mo)) {
          mo->Fill(cscPosition, cscType);
        }

        long payload = digi.getCSCPayload(chamberID);
        int cfeb_dav = (payload >> 7) & 0x1F;
        int cfeb_active = payload & 0x1F;
        int alct_dav = (payload >> 5) & 0x1;
        int tmb_dav = (payload >> 6) & 0x1; 
        int cfeb_dav_num = 0;
      
        if (alct_dav == 0) {
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_ALCT, mo)) {
            mo->Fill(cscPosition, cscType);
          }
          if (getEMUHisto(h::EMU_DMB_WO_ALCT, mo)) {
            mo->Fill(crateID, dmbSlot);
          }
        }
     
        if (tmb_dav == 0) {
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CLCT, mo)) {
            mo->Fill(cscPosition, cscType);
          }
          if (getEMUHisto(h::EMU_DMB_WO_CLCT, mo)) {
            mo->Fill(crateID, dmbSlot);
          }
        }

        if (cfeb_dav == 0) {
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CFEB, mo)) {
            mo->Fill(cscPosition, cscType);
          }
          if (getEMUHisto(h::EMU_DMB_WO_CFEB, mo)) {
            mo->Fill(crateID, dmbSlot);
          }
        }

        for (int i=0; i<5;i++) {
            if ((cfeb_dav>>i) & 0x1) cntCFEBs++;
        }
        
        if (alct_dav > 0) {
            cntALCTs++;
        }

        if (tmb_dav > 0) {
            cntTMBs++;
        }

 
        MonitorObject *mof = 0, *mo1 = 0, *mo2 = 0;
        if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, crateID, dmbSlot, mo)
          && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, crateID, dmbSlot, mof)) {
          if (getCSCHisto(h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
            && getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbSlot, mo2)) {
            for (int i=1; i<=5; i++) {
              double actual_dav_num = mo->GetBinContent(i);
              double unpacked_dav_num = mo2->GetBinContent(i);
              if (actual_dav_num){
                mo1->SetBinContent(i,1, 100.*(1-unpacked_dav_num/actual_dav_num));
              }                            
              mo1->SetEntries((int)DMBEvents);
            }
          }     
          for (int i=0; i<5;i++) {
            int cfeb_present = (cfeb_dav>>i) & 0x1;
            cfeb_dav_num += cfeb_present;
            if (cfeb_present) {
              mo->Fill(i);
            }
            float cfeb_entries = mo->GetBinContent(i+1);
            mof->SetBinContent(i+1, ((float)cfeb_entries/(float)(DMBEvents)*100.0));
          }
          mof->SetEntries((int)DMBEvents);
        }
      
        if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_RATE, crateID, dmbSlot, mo)
          && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_FREQUENCY, crateID, dmbSlot, mof)) {
          for (unsigned short i = 1; i < 7; i++) {
            float cfeb_entries =  mo->GetBinContent(i);
            mof->SetBinContent(i, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
          }
          mof->SetEntries((int)DMBEvents);

          if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
            && getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbSlot, mo2)) {     
            for (unsigned short i = 1; i < 7; i++) {
              float actual_dav_num = mo->GetBinContent(i);
              float unpacked_dav_num = mo2->GetBinContent(i);
              if (actual_dav_num){
                mo1->SetBinContent(i, 1, 100. * (1-unpacked_dav_num/actual_dav_num));
              }                            
              mo1->SetEntries((int)DMBEvents);
            }
          }     
          mo->Fill(cfeb_dav_num);
        }

        if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbSlot, mo)) mo->Fill(cfeb_dav, cfeb_active);

        if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo)) {
          if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
            for (int i = 1; i < 4; i++) {
              float dav_num = mo->GetBinContent(i);
              mo1->SetBinContent(i, ((float)dav_num / (float)(DMBEvents) * 100.0));
            }
            mo1->SetEntries((int)DMBEvents);

            if (getCSCHisto(h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
              && getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo2)) {    
              for (int i = 1; i < 4; i++) {
                float actual_dav_num = mo->GetBinContent(i);
                float unpacked_dav_num = mo2->GetBinContent(i);
                if (actual_dav_num){
                  mof->SetBinContent(i,1, 100. * (1 - unpacked_dav_num / actual_dav_num));
                }                                  
                mof->SetEntries((int)DMBEvents);
                mof->SetMaximum(100.0);
              }
            }     
          }

          if (alct_dav > 0) {
            mo->Fill(0.0);
          }
          if (tmb_dav > 0) {
            mo->Fill(1.0);
          }
          if (cfeb_dav > 0) {
            mo->Fill(2.0);
          }
        }
      

        float feb_combination_dav = -1.0;
        if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo)) {
          if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 0.0; // Nothing
          if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 1.0; // ALCT Only
          if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav == 0) feb_combination_dav = 2.0; // TMB Only
          if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav >  0) feb_combination_dav = 3.0; // CFEB Only
          if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav >  0) feb_combination_dav = 4.0; // TMB+CFEB
          if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav == 0) feb_combination_dav = 5.0; // ALCT+TMB
          if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav >  0) feb_combination_dav = 6.0; // ALCT+CFEB
          if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav >  0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
          // mo->Fill(feb_combination_dav);

          if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
            for (int i = 1; i < 9; i++) {
              float feb_combination_dav_number = mo->GetBinContent(i);
              mo1->SetBinContent(i, ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
            }
            mo1->SetEntries(DMBEvents);
          
            if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
              && getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo2)) {       
              for (int i = 1; i < 9; i++) {
                float actual_dav_num = mo->GetBinContent(i);
                float unpacked_dav_num = mo2->GetBinContent(i);
                if (actual_dav_num){
                  mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
                }                                  
                mof->SetEntries((int)DMBEvents);
                mof->SetMaximum(100.0);
              }
            }
          
          }
          mo->Fill(feb_combination_dav);
        }
      
      }
    }

    {
      uint32_t i = 0;
      CSCIdType chamberID = 0;
      while (digi.nextCSCWithStatus(i, chamberID)) {

        unsigned int crateID = (chamberID >> 4) & 0xFF;
        unsigned int dmbSlot = chamberID & 0xF;
        ExaminerStatusType chStatus = digi.getCSCStatus(chamberID);

        if (crateID == 255) { continue; }
         
        // Check if in standby!
        { 
          CSCDetId cid;
          if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
            continue;
          } 
        }

        unsigned int cscType   = 0;
        unsigned int cscPosition = 0;
        if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;

        if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateID, dmbSlot, mo)) {
          for (int bit = 0; bit < binChecker.nSTATUSES; bit++) {
            if (chStatus & (1<<bit) ) {
              mo->Fill(0., bit);
            }
          }
          mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot));
        }

      
        int anyInputFull = chStatus & 0x3F;
        if (anyInputFull) {
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, mo)) {
            mo->Fill(cscPosition, cscType);
          }
          if (getEMUHisto(h::EMU_DMB_INPUT_FIFO_FULL, mo)) {
            mo->Fill(crateID, dmbSlot);
          }
        }

        int anyInputTO = (chStatus >> 7) & 0x3FFF;
        if (anyInputTO) {
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, mo)) {
            mo->Fill(cscPosition, cscType);
          }
          if (getEMUHisto(h::EMU_DMB_INPUT_TIMEOUT, mo)) {
            mo->Fill(crateID, dmbSlot);
          }
        }
      
        if (digi.getCSCStatus(chamberID) & (1 << 22)) {
          if (getEMUHisto(h::EMU_DMB_FORMAT_WARNINGS, mo)) {
            mo->Fill(crateID, dmbSlot);
          }
  
          if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, mo)) {
            mo->Fill(cscPosition, cscType);
          }
          
        }
      }

    }

    {
      uint32_t i = 0;
      CSCIdType chamberID = 0;
      while (digi.nextCSCWithError(i, chamberID)) {

        const unsigned int crateID = (chamberID >> 4) & 0xFF;
        const unsigned int dmbSlot = chamberID & 0xF;
        const ExaminerStatusType chErr = digi.getCSCErrors(chamberID);

        if ((crateID ==255) || (chErr & 0x80)) { continue; } // = Skip chamber detection if DMB header is missing (Error code 6)

        if (crateID > 60 || dmbSlot > 10) { continue; }
 
        // Check if in standby!
        { 
          CSCDetId cid;
          if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
            continue;
          } 
        }

        if ((chErr & config->getBINCHECK_MASK()) != 0) {
          config->incChamberCounter(BAD_EVENTS, crateID , dmbSlot);
        }

        bool isCSCError = false;
        bool fillBC = getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateID, dmbSlot, mo);

        for (int bit = 5; bit < 24; bit++) {

          if (chErr & (1 << bit) ) {
            isCSCError = true;
            if (fillBC) {
              mo->Fill(0., bit - 5);
            } else {
              break;
            }
          }

          if (fillBC) {
            mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID , dmbSlot));
          }

        }

        if (isCSCError) {

          if (getEMUHisto(h::EMU_DMB_FORMAT_ERRORS, mo)) {
            mo->Fill(crateID, dmbSlot);
          }

          if (eventAccepted && getEMUHisto(h::EMU_DMB_UNPACKED_WITH_ERRORS, mo)) {
            mo->Fill(crateID, dmbSlot);
          }

          unsigned int cscType   = 0;
          unsigned int cscPosition = 0;
          if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;

          if ( cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, mo)) {
            mo->Fill(cscPosition, cscType);
          }

          if (eventAccepted  && cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED_WITH_ERRORS, mo)) {
            mo->Fill(cscPosition, cscType);
          }
        }

      }
    }

    return eventAccepted;

  }
bool cscdqm::EventProcessor::processExaminer ( const CSCDCCExaminer binChecker) [private]
void cscdqm::EventProcessor::resetEmuEventDisplays ( ) [private]

Reset Emu level EventDisplay histograms once per event.

Definition at line 56 of file CSCDQM_EventProcessor_processCSC.cc.

References EmuEventDisplayWasReset, getEMUHisto(), and cscdqm::MonitorObject::getTH1Lock().

Referenced by setEmuEventDisplayBit().

                                             {
    if (!EmuEventDisplayWasReset) {

      // Reseting EMU level Event displays
      MonitorObject* mo = 0;
      if (getEMUHisto(h::EMU_EVENT_DISPLAY_ANODE, mo)) {
        mo->getTH1Lock()->Reset("");
      }

      if (getEMUHisto(h::EMU_EVENT_DISPLAY_CATHODE, mo)) {
        mo->getTH1Lock()->Reset("");
      }

      if (getEMUHisto(h::EMU_EVENT_DISPLAY_XY, mo)) {
        mo->getTH1Lock()->Reset("");
      }

      EmuEventDisplayWasReset = true;

    }
  }
void cscdqm::EventProcessor::setEmuEventDisplayBit ( MonitorObject *&  mo,
const unsigned int  x,
const unsigned int  y,
const unsigned int  bit 
) [private]

Set a single bit in the 3D Histogram (aka EMU level event display). Checks if mo and x != null.

Parameters:
eventNumbernumber of event
moHistogram
xX bin number
yY bin number
bitbit number to set

Definition at line 43 of file CSCDQM_EventProcessor_processCSC.cc.

References cscdqm::MonitorObject::GetBinContent(), resetEmuEventDisplays(), and cscdqm::MonitorObject::SetBinContent().

Referenced by processCSC().

                                                                                                                                   {
    if (mo && x) {
      resetEmuEventDisplays();
      int bitset = (int) mo->GetBinContent(x, y);
      bitset |= 1 << bit;
      mo->SetBinContent(x, y, bitset);
    }
  }
void cscdqm::EventProcessor::standbyEfficiencyHistos ( HWStandbyType standby)

apply standby flags/parameters

Parameters:
standbystandby flags

Definition at line 366 of file CSCDQM_EventProcessor_updateEffHistos.cc.

References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, getEMUHisto(), cscdqm::MonitorObject::getTH1Lock(), cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, CommonMethods::lock(), cscdqm::Address::mask, cscdqm::HWStandbyType::MeM, cscdqm::HWStandbyType::MeP, cscdqm::Lock::mutex, cscdqm::AddressMask::ring, cscdqm::Summary::SetValue(), cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::STANDBY, cscdqm::AddressMask::station, summary, tmp, cscdqm::WAS_ON, and cscdqm::Summary::WriteChamberState().

Referenced by cscdqm::EventProcessorMutex::processStandby().

                                                                     {

    Address adr;
    adr.mask.side = true;
    adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;

    adr.side = 1;
    summary.SetValue(adr, STANDBY, (standby.MeP ? 1 : 0));
    if (!standby.MeP) {
      summary.SetValue(adr, WAS_ON);
    }

    adr.side = 2;
    summary.SetValue(adr, STANDBY, (standby.MeM ? 1 : 0));
    if (!standby.MeM) {
      summary.SetValue(adr, WAS_ON);
    }

    MonitorObject *me = 0;
    if (getEMUHisto(h::EMU_CSC_STANDBY, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());

      // All standby
      summary.WriteChamberState(tmp, 0x1000, 5);
       
      // Temporary in standby (was ON)
      summary.WriteChamberState(tmp, 0x3000, 1, false);

    }

  }
void cscdqm::EventProcessor::updateEfficiencyHistos ( )

Update Efficiency MOs.

Get CSC Reporting reference histogram

If reference for CSC_Reporting is defined - use it Else - do it flat way

Write summary information

Looping via addresses (scope: side->station->ring) and filling in HW efficiencies

Definition at line 26 of file CSCDQM_EventProcessor_updateEffHistos.cc.

References cscdqm::AddressMask::cfeb, cscdqm::CFEB_BWORDS, cscdqm::AddressMask::chamber, config, cscdqm::FIFOFULL_ERR, cscdqm::MonitorObject::Fill(), cscdqm::FORMAT_ERR, cscdqm::Summary::getDetector(), cscdqm::Summary::GetEfficiencyHW(), getEMUHisto(), cscdqm::Configuration::getNEvents(), getParHisto(), cscdqm::MonitorObject::getRefRootObject(), cscdqm::MonitorObject::getTH1(), cscdqm::MonitorObject::getTH1Lock(), cscdqm::AddressMask::hv, cscdqm::INPUTTO_ERR, cscdqm::L1SYNC_ERR, cscdqm::AddressMask::layer, CommonMethods::lock(), cscdqm::Address::mask, cscdqm::Lock::mutex, N_SIDES, N_STATIONS, cscdqm::NODATA_ALCT, cscdqm::NODATA_CFEB, cscdqm::NODATA_CLCT, cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), Parameters::parameters, cscdqm::Summary::ReadErrorChambers(), cscdqm::Summary::ReadReportingChambers(), cscdqm::Summary::ReadReportingChambersRef(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, summary, tmp, cscdqm::Summary::Write(), cscdqm::Summary::WriteMap(), and writeShifterHistograms().

Referenced by cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos().

                                              {

    MonitorObject *me = 0, *me1 = 0;

    if (config->getNEvents() > 0) {

      if (getEMUHisto(h::EMU_CSC_REPORTING, me)) {
  
        const TH2* rep = dynamic_cast<const TH2*>(me->getTH1());
  
        const TObject *tobj = me->getRefRootObject();
         
        if (tobj) {
          const TH2* ref = dynamic_cast<const TH2*>(tobj);
          summary.ReadReportingChambersRef(rep, ref, config->getEFF_COLD_THRESHOLD(), config->getEFF_COLD_SIGFAIL(), config->getEFF_HOT_THRESHOLD(), config->getEFF_HOT_SIGFAIL());
        } else {
          summary.ReadReportingChambers(rep, 1.0);
        }
  
        if (getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, FORMAT_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, L1SYNC_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, FIFOFULL_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, INPUTTO_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_WO_ALCT, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, NODATA_ALCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_WO_CLCT, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, NODATA_CLCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_WO_CFEB, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, NODATA_CFEB, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
        }
  
        if (getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, me1)) {
          const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
          summary.ReadErrorChambers(rep, err, CFEB_BWORDS, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
        }
  
      }

      writeShifterHistograms();
  
      if (getEMUHisto(h::EMU_PHYSICS_ME1, me)){
        LockType lock(me->mutex);
        TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
        summary.Write(tmp, 1);
      }
    
      if (getEMUHisto(h::EMU_PHYSICS_ME2, me)){
        LockType lock(me->mutex);
        TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
        summary.Write(tmp, 2);
      }
  
      if (getEMUHisto(h::EMU_PHYSICS_ME3, me)){
        LockType lock(me->mutex);
        TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
        summary.Write(tmp, 3);
      }
  
      if (getEMUHisto(h::EMU_PHYSICS_ME4, me)){
        LockType lock(me->mutex);
        TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
        summary.Write(tmp, 4);
      }
  
      if (getEMUHisto(h::EMU_PHYSICS_EMU, me)) {
        LockType lock(me->mutex);
        TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
        summary.WriteMap(tmp);
      }

    }

    if (config->getPROCESS_EFF_PARAMETERS()) {

      { // Compute DQM information parameters

        Address adr;
        adr.mask.side = adr.mask.station = adr.mask.ring = true;
        adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
  
        double   e_detector = 0.0, e_side = 0.0, e_station = 0.0, e_ring = 0.0;
        uint32_t e_detector_ch = 0, e_side_ch = 0, e_station_ch = 0;
      
        const HistoId parameters [] = {
          h::PAR_CSC_SIDEPLUS_STATION01_RING01,
          h::PAR_CSC_SIDEPLUS_STATION01_RING02,
          h::PAR_CSC_SIDEPLUS_STATION01_RING03,
          h::PAR_CSC_SIDEPLUS_STATION01,
          h::PAR_CSC_SIDEPLUS_STATION02_RING01,
          h::PAR_CSC_SIDEPLUS_STATION02_RING02,
          h::PAR_CSC_SIDEPLUS_STATION02,
          h::PAR_CSC_SIDEPLUS_STATION03_RING01,
          h::PAR_CSC_SIDEPLUS_STATION03_RING02,
          h::PAR_CSC_SIDEPLUS_STATION03,
          h::PAR_CSC_SIDEPLUS_STATION04_RING01,
          h::PAR_CSC_SIDEPLUS_STATION04_RING02,
          h::PAR_CSC_SIDEPLUS_STATION04,
          h::PAR_CSC_SIDEPLUS,
          h::PAR_CSC_SIDEMINUS_STATION01_RING01,
          h::PAR_CSC_SIDEMINUS_STATION01_RING02,
          h::PAR_CSC_SIDEMINUS_STATION01_RING03,
          h::PAR_CSC_SIDEMINUS_STATION01,
          h::PAR_CSC_SIDEMINUS_STATION02_RING01,
          h::PAR_CSC_SIDEMINUS_STATION02_RING02,
          h::PAR_CSC_SIDEMINUS_STATION02,
          h::PAR_CSC_SIDEMINUS_STATION03_RING01,
          h::PAR_CSC_SIDEMINUS_STATION03_RING02,
          h::PAR_CSC_SIDEMINUS_STATION03,
          h::PAR_CSC_SIDEMINUS_STATION04_RING01,
          h::PAR_CSC_SIDEMINUS_STATION04_RING02,
          h::PAR_CSC_SIDEMINUS_STATION04,
          h::PAR_CSC_SIDEMINUS
        };

        bool calc = (config->getNEvents() > 0);

        if (!calc) {
          e_detector = e_side = e_station = e_ring = -1.0;
        }

        unsigned int parameter = 0;
        for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
          
          if (calc) {
            e_side = 0.0;
            e_side_ch = 0;
          }

          adr.mask.station = true;
          for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
            
            if (calc) {
              e_station = 0.0;
              e_station_ch = 0;
            }
            
            adr.mask.ring = true;
            for (adr.ring = 1; adr.ring <= summary.getDetector().NumberOfRings(adr.station); adr.ring++) {

              if (calc) {
                e_ring = summary.GetEfficiencyHW(adr);
                uint32_t ch = summary.getDetector().NumberOfChambers(adr.station, adr.ring);
                e_station += (e_ring * ch);
                e_station_ch += ch;
              }

              if (summary.getDetector().NumberOfRings(adr.station) > 1) {
                if (getParHisto(parameters[parameter++], me)) me->Fill(e_ring);
              }

            }

            adr.mask.ring = false;
            if (calc) {
              e_side += e_station;
              e_side_ch += e_station_ch;
              e_station = e_station / e_station_ch;
            }

            if (getParHisto(parameters[parameter++], me)) me->Fill(e_station);

          }

          adr.mask.station = false;
          if (calc) {
            e_detector += e_side; 
            e_detector_ch += e_side_ch;
            e_side = e_side / e_side_ch;
          }

          if (getParHisto(parameters[parameter++], me)) me->Fill(e_side);

        }

        if (calc) {
          e_detector = e_detector / e_detector_ch;
        }

        if (getParHisto(h::PAR_REPORT_SUMMARY, me)) me->Fill(e_detector);

      }

    }

  }
void cscdqm::EventProcessor::updateFractionHistos ( )

Update Fractional MOs.

Definition at line 26 of file CSCDQM_EventProcessor_updateFracHistos.cc.

References calcEMUFractionHisto(), config, cscdqm::DMB_EVENTS, cscdqm::Configuration::fnNextBookedCSC, cscdqm::Configuration::getChamberCounterValue(), getCSCHisto(), cscdqm::MonitorObject::getTH1(), CommonMethods::lock(), and cscdqm::MonitorObject::SetEntries().

Referenced by cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos().

                                            {

    calcEMUFractionHisto(h::EMU_DMB_FORMAT_ERRORS_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_FORMAT_ERRORS);
    calcEMUFractionHisto(h::EMU_CSC_FORMAT_ERRORS_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_FORMAT_ERRORS);
    calcEMUFractionHisto(h::EMU_DMB_FORMAT_WARNINGS_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_FORMAT_WARNINGS);
    calcEMUFractionHisto(h::EMU_CSC_FORMAT_WARNINGS_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_FORMAT_WARNINGS);
    calcEMUFractionHisto(h::EMU_DMB_UNPACKED_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_UNPACKED);
    calcEMUFractionHisto(h::EMU_CSC_UNPACKED_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_UNPACKED);
    calcEMUFractionHisto(h::EMU_DMB_WO_ALCT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_ALCT);
    calcEMUFractionHisto(h::EMU_CSC_WO_ALCT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_ALCT);
    calcEMUFractionHisto(h::EMU_DMB_WO_CLCT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_CLCT);
    calcEMUFractionHisto(h::EMU_CSC_WO_CLCT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_CLCT);
    calcEMUFractionHisto(h::EMU_DMB_WO_CFEB_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_CFEB);
    calcEMUFractionHisto(h::EMU_CSC_WO_CFEB_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_CFEB);
    calcEMUFractionHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_DMB_INPUT_FIFO_FULL);
    calcEMUFractionHisto(h::EMU_DMB_INPUT_FIFO_FULL_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_INPUT_FIFO_FULL);
    calcEMUFractionHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_DMB_INPUT_TIMEOUT);
    calcEMUFractionHisto(h::EMU_DMB_INPUT_TIMEOUT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_INPUT_TIMEOUT);
    calcEMUFractionHisto(h::EMU_CSC_L1A_OUT_OF_SYNC_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_L1A_OUT_OF_SYNC);
    calcEMUFractionHisto(h::EMU_DMB_L1A_OUT_OF_SYNC_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_L1A_OUT_OF_SYNC);
    calcEMUFractionHisto(h::EMU_FED_DDU_L1A_MISMATCH_FRACT, h::EMU_FED_ENTRIES, h::EMU_FED_DDU_L1A_MISMATCH);
    calcEMUFractionHisto(h::EMU_FED_DDU_L1A_MISMATCH_WITH_CSC_DATA_FRACT, h::EMU_FED_ENTRIES, h::EMU_FED_DDU_L1A_MISMATCH_WITH_CSC_DATA);

    unsigned int iter = 0, crateId = 0, dmbId = 0;
    MonitorObject *mo = 0, *mof = 0;
    while (config->fnNextBookedCSC(iter, crateId, dmbId)) {

      uint32_t dmbEvents = config->getChamberCounterValue(DMB_EVENTS, crateId, dmbId);

      if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateId, dmbId, mo) && 
          getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_FREQUENCY, crateId, dmbId, mof)) {
        
        LockType lock(mof->mutex);
        TH1* th = mof->getTH1Lock();
        th->Reset();
        th->Add(mo->getTH1());
        th->Scale(1. / dmbEvents);
        mof->SetMaximum(1.);
        mof->SetEntries(dmbEvents);
        mo->SetEntries(dmbEvents);
      }

      if (getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateId, dmbId, mo) && 
          getCSCHisto(h::CSC_BINCHECK_ERRORS_FREQUENCY, crateId, dmbId, mof)) {
        LockType lock(mof->mutex);
        TH1* th = mof->getTH1Lock();
        th->Reset();
        th->Add(mo->getTH1());
        th->Scale(1. / dmbEvents);
        mof->SetMaximum(1.);
        mof->SetEntries(dmbEvents);
        mo->SetEntries(dmbEvents);
      }

    }

  }
void cscdqm::EventProcessor::writeShifterHistograms ( )

Definition at line 247 of file CSCDQM_EventProcessor_updateEffHistos.cc.

References config, getEMUHisto(), cscdqm::MonitorObject::getTH1Lock(), HWSTATUSERRORBITS, CommonMethods::lock(), cscdqm::Lock::mutex, summary, tmp, and cscdqm::Summary::WriteChamberState().

Referenced by cscdqm::EventProcessorMutex::processStandby(), and updateEfficiencyHistos().

                                              {

    MonitorObject *me = 0;

    //const int COLOR_WHITE   = 0;
    const int COLOR_GREEN   = 1;
    const int COLOR_RED     = 2;
    const int COLOR_BLUE    = 3;
    const int COLOR_GREY    = 4;
    const int COLOR_STANDBY = 5;

    if (getEMUHisto(h::EMU_CSC_STATS_SUMMARY, me)) {
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x1, COLOR_GREEN, true, false);
        summary.WriteChamberState(tmp, HWSTATUSERRORBITS, COLOR_RED, false, true);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_OCCUPANCY, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x4, COLOR_RED, true, false);
        summary.WriteChamberState(tmp, 0x8, COLOR_BLUE, false, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_FORMAT_ERR, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x10, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_L1SYNC_ERR, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x20, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_FIFOFULL_ERR, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x40, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_INPUTTO_ERR, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x80, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_WO_ALCT, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x100, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_WO_CLCT, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x200, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_WO_CFEB, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x400, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }

    if (getEMUHisto(h::EMU_CSC_STATS_CFEB_BWORDS, me)){
      LockType lock(me->mutex);
      TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
      if (!config->getIN_FULL_STANDBY()) {
        summary.WriteChamberState(tmp, 0x800, COLOR_RED, true, false);
      }
      summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
      summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
    }
    
  }

Member Data Documentation

uint32_t cscdqm::EventProcessor::BXN [private]

Definition at line 165 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processDDU().

Total Number of CFEBs per event from DMB DAV.

Definition at line 168 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

Total Number of DMBs per event from DDU Header DAV.

Definition at line 167 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

uint32_t cscdqm::EventProcessor::cntDMBs [private]

Definition at line 166 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

uint32_t cscdqm::EventProcessor::cntTMBs [private]

Total Number of ALCTs per event from DMB DAV.

Definition at line 169 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

Definition at line 174 of file CSCDQM_EventProcessor.h.

Referenced by preProcessEvent(), and resetEmuEventDisplays().

Total Number of TMBs per event from DMB DAV.

Definition at line 173 of file CSCDQM_EventProcessor.h.

Referenced by EventProcessor(), processCSC(), and processDDU().

std::map<uint32_t, bool> cscdqm::EventProcessor::fNotFirstEvent [private]

Definition at line 163 of file CSCDQM_EventProcessor.h.

Referenced by processDDU().

Definition at line 164 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processDDU().

std::map<uint32_t, uint32_t> cscdqm::EventProcessor::L1ANumbers [private]

Definition at line 162 of file CSCDQM_EventProcessor.h.

Referenced by processDDU().

Detector efficiency manipulation object

Definition at line 160 of file CSCDQM_EventProcessor.h.

Referenced by maskHWElements(), processCSC(), standbyEfficiencyHistos(), updateEfficiencyHistos(), and writeShifterHistograms().