CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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>

Public Member Functions

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

Private Member Functions

void calcEMUFractionHisto (const HistoId &result, const HistoId &set, const HistoId &subset)
 Calculate fractional histogram. More...
 
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. More...
 
const bool getCSCHisto (const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
 Get CSC (Chamber) Level Monitoring Object. More...
 
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. More...
 
const bool getDDUHisto (const HistoId &histo, const HwId &dduID, MonitorObject *&me)
 Get DDU Level Monitoring Object. More...
 
const bool getEMUHisto (const HistoId &histo, MonitorObject *&me)
 Get EMU (Top Level) Monitoring Object. More...
 
const bool getFEDHisto (const HistoId &histo, const HwId &fedID, MonitorObject *&me)
 Get FED Level Monitoring Object. More...
 
const bool getParHisto (const HistoId &histo, MonitorObject *&me)
 Get Parameter Monitoring Object. More...
 
void preProcessEvent ()
 Common Local and Global DQM function to be called before processing Event. More...
 
void processCSC (const CSCEventData &data, const int dduID, const CSCDCCExaminer &binChecker)
 Process Chamber Data and fill MOs. More...
 
void processDDU (const CSCDDUEventData &data, const CSCDCCExaminer &binChecker)
 Process DDU output and fill MOs. More...
 
bool processExaminer (const CSCDCCExaminer &binChecker)
 
bool processExaminer (const CSCDCCExaminer &binChecker, const CSCDCCFormatStatusDigi &digi)
 Fill monitor elements with CSCDCCFormatStatusDigi information. More...
 
void resetEmuEventDisplays ()
 Reset Emu level EventDisplay histograms once per event. More...
 
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. More...
 

Private Attributes

uint32_t BXN
 
uint32_t cntALCTs
 Total Number of CFEBs per event from DMB DAV. More...
 
uint32_t cntCFEBs
 Total Number of DMBs per event from DDU Header DAV. More...
 
uint32_t cntDMBs
 
uint32_t cntTMBs
 Total Number of ALCTs per event from DMB DAV. More...
 
Configurationconfig
 
bool EmuEventDisplayWasReset
 
bool fCloseL1As
 Total Number of TMBs per event from DMB DAV. More...
 
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.

28  {
29 
30  config = p_config;
31  // fFirstEvent = true;
32  fCloseL1As = true;
33 
34  }
bool fCloseL1As
Total Number of TMBs per event from DMB DAV.
cscdqm::EventProcessor::~EventProcessor ( )
inline

Destructor.

Definition at line 124 of file CSCDQM_EventProcessor.h.

124 { }

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().

90  {
91 
92  MonitorObject *mo = 0, *mo1 = 0, *mo2 = 0;
93 
94  if (getEMUHisto(result, mo) && getEMUHisto(set, mo2) && getEMUHisto(subset, mo1)) {
95  LockType lock(mo->mutex);
96  TH1* th = mo->getTH1Lock();
97  th->Reset();
98  th->Divide(mo1->getTH1(), mo2->getTH1());
99  mo->SetMaximum(1.);
100  }
101 
102  }
tuple result
Definition: query.py:137
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
void set(const std::string &name, int value)
set the flag, with a run-time name
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().

137  {
138  bool result = false;
139 
140  CSCDetId cid;
141  if (config->fnGetCSCDetId(crateId, dmbId, cid)) {
142  cscPosition = cid.chamber();
143  int iring = cid.ring();
144  int istation = cid.station();
145  int iendcap = cid.endcap();
146  std::string tlabel = cscdqm::Utility::getCSCTypeLabel(iendcap, istation, iring);
147  cscType = cscdqm::Utility::getCSCTypeBin(tlabel);
148  result = true;
149  }
150 
151  /*
152  if (!result) {
153  LOG_ERROR << "Event #" << config->getNEvents() << ": Invalid CSC=" << CSCHistoDef::getPath(crateId, dmbId);
154  }
155  */
156 
157  return result;
158 
159  }
int chamber() const
Definition: CSCDetId.h:70
int endcap() const
Definition: CSCDetId.h:95
tuple result
Definition: query.py:137
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
static std::string getCSCTypeLabel(int endcap, int station, int ring)
Get CSC label from CSC parameters.
static int getCSCTypeBin(const std::string &cstr)
Get CSC y-axis position from chamber string.
int ring() const
Definition: CSCDetId.h:77
int station() const
Definition: CSCDetId.h:88
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().

92  {
93  if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, 0, me)) return (me != NULL);
94  CSCHistoDef histoD(histo, crateID, dmbSlot);
95  if (config->fnGetHisto(histoD, me)) return (me != NULL);
96  return false;
97  }
#define NULL
Definition: scimark2.h:8
boost::function< bool(const HistoId id, const HwId &id1, const HwId &id2, const HwId &id3, MonitorObject *&mo) > fnGetCacheCSCHisto
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
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.

109  {
110  if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, adId, me)) return (me != NULL);
111  CSCHistoDef histoD(histo, crateID, dmbSlot, adId);
112  if (config->fnGetHisto(histoD, me)) return (me != NULL);
113  return false;
114  }
#define NULL
Definition: scimark2.h:8
boost::function< bool(const HistoId id, const HwId &id1, const HwId &id2, const HwId &id3, MonitorObject *&mo) > fnGetCacheCSCHisto
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
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().

77  {
78  if (config->fnGetCacheDDUHisto(histo, dduID, me)) return (me != NULL);
79  DDUHistoDef histoD(histo, dduID);
80  if (config->fnGetHisto(histoD, me)) return (me != NULL);
81  return false;
82  }
#define NULL
Definition: scimark2.h:8
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheDDUHisto
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().

49  {
50  if (config->fnGetCacheEMUHisto(histo, me)) return (me != NULL);
51  EMUHistoDef histoD(histo);
52  if (config->fnGetHisto(histoD, me)) return (me != NULL);
53  return false;
54  }
#define NULL
Definition: scimark2.h:8
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheEMUHisto
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.

63  {
64  if (config->fnGetCacheFEDHisto(histo, fedID, me)) return (me != NULL);
65  FEDHistoDef histoD(histo, fedID);
66  if (config->fnGetHisto(histoD, me)) return (me != NULL);
67  return false;
68  }
#define NULL
Definition: scimark2.h:8
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheFEDHisto
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().

122  {
123  if (config->fnGetCacheParHisto(histo, me)) return (me != NULL);
124  ParHistoDef histoD(histo);
125  if (config->fnGetHisto(histoD, me)) return (me != NULL);
126  return false;
127  }
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheParHisto
#define NULL
Definition: scimark2.h:8
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
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().

39  {
40 
41  }
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().

167  {
168  unsigned int masked = summary.setMaskedHWElements(tokens);
169  LOG_INFO << masked << " HW Elements masked";
170  return masked;
171  }
const unsigned int setMaskedHWElements(std::vector< std::string > &tokens)
Read HW element masks (strings), create Address and apply to detector map.
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
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().

28 {
29 
30  config->incNEvents();
32 
33 }
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(), CSCTMBHeader::BXNCount(), CSCALCTHeader::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(), CSCCFEBData::check(), CSCCLCTData::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(), CSCTMBHeader::L1ANumber(), L1ANumber, LOG_ERROR, LOG_INFO, LOG_WARN, n, CSCDMBHeader::nalct(), CSCEventData::nalct(), CSCDMBHeader::nclct(), CSCEventData::nclct(), 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(), CSCTMBTrailer::wordCount(), and CSCALCTTrailer::wordCount().

Referenced by processDDU().

83  {
84 
86 
87  if (&data == 0) {
88  LOG_ERROR << "Zero pointer. DMB data are not available for unpacking"; //KK is->are
89  return;
90  }
91 
92  int FEBunpacked = 0;
93  int alct_unpacked = 0;
94  int tmb_unpacked = 0;
95  int cfeb_unpacked = 0;
96 
97  int alct_keywg = -1;
98  int clct_kewdistrip = -1;
99 
100  bool L1A_out_of_sync = false;
101 
102  MonitorObject* mo = NULL;
103 
106  const CSCDMBHeader* dmbHeader = data.dmbHeader();
107  const CSCDMBTrailer* dmbTrailer = data.dmbTrailer();
108  if (!dmbHeader && !dmbTrailer) {
109  LOG_ERROR << "Can not unpack DMB Header or/and Trailer";
110  return;
111  }
112 
114  unsigned int crateID = 0xFF;
115  unsigned int dmbID = 0xF;
116  unsigned int chamberID = 0xFFF;
117 
118  crateID = dmbHeader->crateID();
119  dmbID = dmbHeader->dmbID();
120  chamberID = (((crateID) << 4) + dmbID) & 0xFFF;
121 
122  const std::string cscTag = CSCHistoDef::getPath(crateID, dmbID);
123 
124  unsigned long errors = binChecker.errorsForChamber(chamberID);
125  if ((errors & config->getBINCHECK_MASK()) > 0 ) {
126  LOG_WARN << "Format Errors " << cscTag << ": 0x" << std::hex << errors << " Skipped CSC Unpacking";
127  return;
128  }
129 
130  unsigned int cscType = 0;
131  unsigned int cscPosition = 0;
132  if (!getCSCFromMap(crateID, dmbID, cscType, cscPosition )) return;
133 
134  CSCDetId cid;
135  if (!config->fnGetCSCDetId(crateID, dmbID, cid)) {
136  return;
137  }
138 
139  // Check if in standby!
140  if (summary.isChamberStandby(cid)) {
141  return;
142  }
143 
144  double DMBEvents = 0.0;
145  DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbID);
146 
147  // Get Event display plot number and next plot object
148  uint32_t evDisplNo = config->getChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID);
149  evDisplNo += 1;
150  if (evDisplNo >= 5) {
151  config->setChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID, 0);
152  } else {
153  config->setChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID, evDisplNo);
154  }
155  MonitorObject* mo_EventDisplay = 0;
156  if (getCSCHisto(h::CSC_EVENT_DISPLAY_NOXX, crateID, dmbID, evDisplNo, mo_EventDisplay)) {
157  mo_EventDisplay->getTH1Lock()->Reset("");
158  }
159 
160  // Receiving EMU Event displays
161  MonitorObject *mo_Emu_EventDisplay_Anode = 0, *mo_Emu_EventDisplay_Cathode = 0, *mo_Emu_EventDisplay_XY = 0;
162  getEMUHisto(h::EMU_EVENT_DISPLAY_ANODE, mo_Emu_EventDisplay_Anode);
163  getEMUHisto(h::EMU_EVENT_DISPLAY_CATHODE, mo_Emu_EventDisplay_Cathode);
164  getEMUHisto(h::EMU_EVENT_DISPLAY_XY, mo_Emu_EventDisplay_XY);
165 
166  // Global chamber index
167  uint32_t glChamberIndex = 0;
168 
169  if (mo_EventDisplay) {
170  mo_EventDisplay->SetBinContent(1, 1, cid.endcap());
171  mo_EventDisplay->SetBinContent(1, 2, cid.station());
172  mo_EventDisplay->SetBinContent(1, 3, cid.ring());
173  mo_EventDisplay->SetBinContent(1, 4, cscPosition);
174  mo_EventDisplay->SetBinContent(1, 5, crateID);
175  mo_EventDisplay->SetBinContent(1, 6, dmbID);
176  mo_EventDisplay->SetBinContent(1, 7, dmbHeader->l1a());
177  if (mo_Emu_EventDisplay_Anode || mo_Emu_EventDisplay_Cathode || mo_Emu_EventDisplay_XY) {
178  glChamberIndex = summary.getDetector().GlobalChamberIndex(cid.endcap(), cid.station(), cid.ring(), cscPosition);
179  }
180  }
181 
183 
184  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED, mo)){
185  mo->Fill(cscPosition, cscType);
186  }
187 
189  float DMBEff = float(DMBEvents) / float(config->getNEvents());
190  if(DMBEff > 1.0) {
191  LOG_ERROR << cscTag << " has efficiency " << DMBEff << " which is greater than 1";
192  }
193 
197  int dmbHeaderL1A = dmbHeader->l1a()%64;
199  int dmb_ddu_l1a_diff = (int)(dmbHeaderL1A-(int)(L1ANumber%64));
200  if (dmb_ddu_l1a_diff != 0) L1A_out_of_sync = true;
201 
204  if (getCSCHisto(h::CSC_DMB_L1A_DISTRIB, crateID, dmbID, mo)) mo->Fill(dmbHeaderL1A);
205 
206  if (getCSCHisto(h::CSC_DMB_DDU_L1A_DIFF, crateID, dmbID, mo)) {
207  if(dmb_ddu_l1a_diff < -32) {
208  mo->Fill(dmb_ddu_l1a_diff + 64);
209  } else {
210  if(dmb_ddu_l1a_diff >= 32) mo->Fill(dmb_ddu_l1a_diff - 64);
211  else mo->Fill(dmb_ddu_l1a_diff);
212  }
213  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
214  }
215 
216  if (getCSCHisto(h::CSC_DMB_L1A_VS_DDU_L1A, crateID, dmbID, mo)) mo->Fill((int)(L1ANumber & 0xFF), (int)dmbHeaderL1A);
217 
219  int dmbHeaderBXN = 0;
220  int dmb_ddu_bxn_diff = 0;
221 
226  dmbHeaderBXN = dmbHeader->bxn12();
230  dmb_ddu_bxn_diff = dmbHeaderBXN%64-BXN%64;
232  if (getCSCHisto(h::CSC_DMB_BXN_DISTRIB, crateID, dmbID, mo)) mo->Fill((int)(dmbHeader->bxn12()));
233 
234  if (getCSCHisto(h::CSC_DMB_DDU_BXN_DIFF, crateID, dmbID, mo)) {
235  if(dmb_ddu_bxn_diff < -32) mo->Fill(dmb_ddu_bxn_diff + 64);
236  else {
237  if(dmb_ddu_bxn_diff >= 32) mo->Fill(dmb_ddu_bxn_diff - 64);
238  else mo->Fill(dmb_ddu_bxn_diff);
239  }
240  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
241  }
242 
244  if (getCSCHisto(h::CSC_DMB_BXN_VS_DDU_BXN, crateID, dmbID, mo)) mo->Fill(((int)(BXN)) % 256, ((int)dmbHeaderBXN) % 256);
245 
247  int cfeb_dav = 0;
248  int cfeb_dav_num = 0;
249  int cfeb_movlp = 0;
250  int dmb_cfeb_sync = 0;
251 
252  cfeb_dav = (int)dmbHeader->cfebAvailable();
253  for (int i = 0; i < 5; i++) cfeb_dav_num += (cfeb_dav >> i) & 0x1;
254  cfeb_movlp = (int)dmbHeader->cfebMovlp();
255  dmb_cfeb_sync = (int)dmbHeader->dmbCfebSync();
256 
257  if (getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbID, mo)) {
258  for (int i = 0; i < 5; i++) {
259  int cfeb_present = (cfeb_dav >> i) & 0x1;
260  if (cfeb_present) {
261  mo->Fill(i);
262  }
263  }
264  }
265 
266  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbID, mo)) mo->Fill(cfeb_dav_num);
267  if (getCSCHisto(h::CSC_DMB_CFEB_MOVLP, crateID, dmbID, mo)) mo->Fill(cfeb_movlp);
268  if (getCSCHisto(h::CSC_DMB_CFEB_SYNC, crateID, dmbID, mo)) mo->Fill(dmb_cfeb_sync);
269 
270  if (getEMUHisto(h::EMU_DMB_UNPACKED, mo)) {
271  mo->Fill(crateID, dmbID);
273  }
274 
276  if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebActive()); //KK
277 
281  if (getCSCHisto(h::CSC_DMB_L1_PIPE, crateID, dmbID, mo)) mo->Fill(dmbTrailer->dmb_l1pipe);
282 
284  if (getCSCHisto(h::CSC_DMB_FIFO_STATS, crateID, dmbID, mo)) {
285  if (dmbTrailer->tmb_empty == 1) mo->Fill(1.0, 0.0); //KK
286  if (dmbTrailer->tmb_half == 0) mo->Fill(1.0, 1.0);
287  if (dmbTrailer->tmb_full == 1) mo->Fill(1.0, 2.0); //KK
288  if (dmbTrailer->alct_empty == 1) mo->Fill(0.0, 0.0);
289  if (dmbTrailer->alct_half == 0) mo->Fill(0.0, 1.0);
290  if (dmbTrailer->alct_full == 1) mo->Fill(0.0, 2.0); //KK 0->1
291  for (int i = 0; i < 5; i++) {
292  if ((int)((dmbTrailer->cfeb_empty>>i)&0x1) == 1) mo->Fill(i + 2, 0.0);
293  if ((int)((dmbTrailer->cfeb_half>>i)&0x1) == 0) mo->Fill(i + 2, 1);
294  if ((int)((dmbTrailer->cfeb_full>>i)&0x1) == 1) {
295  mo->Fill(i + 2, 2);
296  }
297  }
298  mo->SetEntries((int)DMBEvents);
299  }
300 
302  if (getCSCHisto(h::CSC_DMB_FEB_TIMEOUTS, crateID, dmbID, mo)) {
303  if ((dmbTrailer->tmb_timeout == 0) && (dmbTrailer->alct_timeout == 0) && (dmbTrailer->cfeb_starttimeout == 0) && (dmbTrailer->cfeb_endtimeout == 0)) {
304  mo->Fill(0.0);
305  }else{
306  if (dmbTrailer->alct_timeout) mo->Fill(1);
307  if (dmbTrailer->tmb_timeout) mo->Fill(2);
308  if (dmbTrailer->alct_endtimeout) mo->Fill(8); // KK
309  if (dmbTrailer->tmb_endtimeout) mo->Fill(9); // KK
310  }
311  for (int i = 0; i < 5; i++) {
312  if ((dmbTrailer->cfeb_starttimeout >> i) & 0x1) {
313  mo->Fill(i + 3);
314  }
315  if ((dmbTrailer->cfeb_endtimeout >> i) & 0x1) {
316  mo->Fill(i + 10); // KK 8->10
317  }
318  }
319  mo->SetEntries((int)DMBEvents);
320  }
321 
323  int alct_dav = dmbHeader->nalct();
324  int tmb_dav = dmbHeader->nclct();
325  int cfeb_dav2 = 0;
326  for (int i = 0; i < 5; i++) cfeb_dav2 = cfeb_dav2 + (int)((dmbHeader->cfebAvailable() >> i) & 0x1);
327 
330  if ((alct_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
331  mo->Fill(0.0);
332  float alct_dav_number = mo->GetBinContent(1);
333  if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
334  mo->SetBinContent(1, ((float)alct_dav_number / (float)(DMBEvents) * 100.0));
335  mo->SetEntries((int)DMBEvents);
336  }
337  }
338 
339  if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
340  mo->Fill(1.0);
341  float tmb_dav_number = mo->GetBinContent(2);
342  if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
343  mo->SetBinContent(2, ((float)tmb_dav_number / (float)(DMBEvents) * 100.0));
344  mo->SetEntries((int)DMBEvents);
345  }
346  }
347 
348  if ((cfeb_dav2 > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
349  mo->Fill(2.0);
350  float cfeb_dav2_number = mo->GetBinContent(3);
351  if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
352  mo->SetBinContent(3, ((float)cfeb_dav2_number / (float)(DMBEvents) * 100.0));
353  mo->SetEntries((int)DMBEvents);
354  }
355  }
356 
357  float feb_combination_dav = -1.0;
359  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbID, mo)) {
360  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 0.0; // Nothing
361  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 1.0; // ALCT Only
362  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav2 == 0) feb_combination_dav = 2.0; // TMB Only
363  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 > 0) feb_combination_dav = 3.0; // CFEB Only
364  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav2 > 0) feb_combination_dav = 4.0; // TMB+CFEB
365  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav2 == 0) feb_combination_dav = 5.0; // ALCT+TMB
366  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav2 > 0) feb_combination_dav = 6.0; // ALCT+CFEB
367  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav2 > 0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
368  mo->Fill(feb_combination_dav);
369  float feb_combination_dav_number = mo->GetBinContent((int)(feb_combination_dav + 1.0));
370  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_EFFICIENCY, crateID, dmbID, mo)) {
371  mo->SetBinContent((int)(feb_combination_dav + 1.0), ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
372  mo->SetEntries((int)DMBEvents);
373  }
374  }
375 
377  if (data.nalct()) {
378 
379  const CSCALCTHeader* alctHeader = data.alctHeader();
380  int fwVersion = alctHeader->alctFirmwareVersion();
381  const CSCALCTTrailer* alctTrailer = data.alctTrailer();
382  const CSCAnodeData* alctData = data.alctData();
383 
384  if (alctHeader && alctTrailer) {
385 
386  std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
387  std::vector<CSCALCTDigi> alctsDatas;
388 
389  for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
390  if (alctsDatasTmp[lct].isValid()) alctsDatas.push_back(alctsDatasTmp[lct]);
391  }
392 
393  FEBunpacked = FEBunpacked + 1;
394  alct_unpacked = 1;
395 
397  if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
398  mo->Fill(2);
399  uint32_t ALCTEvent = (uint32_t)mo->GetBinContent(3);
400  config->setChamberCounterValue(ALCT_TRIGGERS, crateID, dmbID, ALCTEvent);
401  if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)){
402  if(config->getNEvents() > 0) {
405  mo->SetBinContent(1, ((float)ALCTEvent / (float)(DMBEvents) * 100.0));
407  mo->SetEntries((int)DMBEvents);
408  }
409  }
410  }
411 
412  if ((alct_dav >0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
413  mo->Fill(0.0, 0.0);
414  }
415 
418  if (getCSCHisto(h::CSC_ALCT_L1A, crateID, dmbID, mo)) mo->Fill((int)(alctHeader->L1Acc()));
419 
421  if (getCSCHisto(h::CSC_ALCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
423  int alct_dmb_l1a_diff = (int)(alctHeader->L1Acc() % 64 - dmbHeader->l1a() % 64);
424  if (alct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
425  if(alct_dmb_l1a_diff < -32) mo->Fill(alct_dmb_l1a_diff + 64);
426  else {
427  if(alct_dmb_l1a_diff >= 32) mo->Fill(alct_dmb_l1a_diff - 64);
428  else mo->Fill(alct_dmb_l1a_diff);
429  }
430  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
431  }
432 
434  if (getCSCHisto(h::CSC_DMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) mo->Fill(alctHeader->L1Acc() % 256, dmbHeader->l1a());
435 
438  if (getCSCHisto(h::CSC_ALCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
439  int alct_dmb_bxn_diff = (int)(alctHeader->BXNCount()-dmbHeader->bxn12());
440  if (alct_dmb_bxn_diff > 0) alct_dmb_bxn_diff -= 3564;
441  alct_dmb_bxn_diff %= 64;
442  mo->Fill(alct_dmb_bxn_diff);
443  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
444  }
445 
446  if (getCSCHisto(h::CSC_ALCT_BXN, crateID, dmbID, mo)) mo->Fill(alctHeader->BXNCount());
447 
449  if (getCSCHisto(h::CSC_ALCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount()) % 256), (int)(dmbHeader->bxn12()) % 256);
450 
451  if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
452  mo->Fill(alctsDatas.size());
453  int nALCT = (int)mo->GetBinContent((int)(alctsDatas.size() + 1));
454  if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo))
455  mo->SetBinContent((int)(alctsDatas.size() + 1), (float)(nALCT) / (float)(DMBEvents) * 100.0);
456  }
457 
458  if (getCSCHisto(h::CSC_ALCT_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(alctTrailer->wordCount()));
459 
462  if (alctsDatas.size() == 2) {
463  if (getCSCHisto(h::CSC_ALCT1_VS_ALCT0_KEYWG, crateID, dmbID, mo))
464  mo->Fill(alctsDatas[0].getKeyWG(),alctsDatas[1].getKeyWG());
465  }
466 
467  MonitorObject* mo_CSC_ALCT0_BXN_mean = 0;
468  getEMUHisto(h::EMU_CSC_ALCT0_BXN_MEAN, mo_CSC_ALCT0_BXN_mean);
469 
470  MonitorObject* mo_CSC_ALCT0_BXN_rms = 0;
471  getEMUHisto(h::EMU_CSC_ALCT0_BXN_RMS, mo_CSC_ALCT0_BXN_rms);
472 
473  MonitorObject* mo_CSC_Plus_endcap_ALCT0_dTime = 0;
474  getEMUHisto(h::EMU_CSC_ALCT0_ENDCAP_PLUS_DTIME, mo_CSC_Plus_endcap_ALCT0_dTime);
475 
476  MonitorObject* mo_CSC_Minus_endcap_ALCT0_dTime = 0;
477  getEMUHisto(h::EMU_CSC_ALCT0_ENDCAP_MINUS_DTIME, mo_CSC_Minus_endcap_ALCT0_dTime);
478 
479  for (uint32_t lct = 0; lct < alctsDatas.size(); lct++) {
480 
482  if (lct >= 2) continue;
483 
484  if (getCSCHisto(h::CSC_ALCTXX_KEYWG, crateID, dmbID, lct, mo)) {
485  mo->Fill(alctsDatas[lct].getKeyWG());
486  }
487 
488  if(lct == 0) alct_keywg = alctsDatas[lct].getKeyWG();
489 
490  int alct_dtime = 0;
491  if (fwVersion == 2007) {
492  alct_dtime = alctsDatas[lct].getBX();
493  } else {
494  // Older 2006 Format
495  alct_dtime = (int) (alctsDatas[lct].getBX() - (alctHeader->BXNCount()&0x1F));
496  }
497 
498  if (getCSCHisto(h::CSC_ALCTXX_DTIME, crateID, dmbID, lct, mo)) {
499 
500  if(alct_dtime < -16) {
501  mo->Fill(alct_dtime + 32);
502  } else {
503  if(alct_dtime >= 16) mo->Fill(alct_dtime - 32);
504  else mo->Fill(alct_dtime);
505  }
506 
507  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
508 
509  double dTime_mean = mo->getTH1()->GetMean();
510  double dTime_rms = mo->getTH1()->GetRMS();
511 
512  // == For ALCT0 Fill Summary dTime Histograms
513  if (lct == 0) {
514  if (cid.endcap() == 1) {
515  if (mo_CSC_Plus_endcap_ALCT0_dTime) mo_CSC_Plus_endcap_ALCT0_dTime->Fill(alct_dtime);
516  }
517  if (cid.endcap() == 2) {
518  if (mo_CSC_Minus_endcap_ALCT0_dTime) mo_CSC_Minus_endcap_ALCT0_dTime->Fill(alct_dtime);
519  }
520  if (cscPosition && cscType && mo_CSC_ALCT0_BXN_mean) {
521  mo_CSC_ALCT0_BXN_mean->SetBinContent(cscPosition, cscType + 1, dTime_mean);
522  }
523  if (cscPosition && cscType && mo_CSC_ALCT0_BXN_rms) {
524  mo_CSC_ALCT0_BXN_rms->SetBinContent(cscPosition, cscType + 1, dTime_rms);
525  }
526  }
527 
528  }
529 
530  if (getCSCHisto(h::CSC_ALCTXX_DTIME_VS_KEYWG, crateID, dmbID, lct, mo)) {
531  if(alct_dtime < -16) {
532  mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
533  } else {
534  if(alct_dtime >= 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
535  else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
536  }
537  }
538 
539  if (getCSCHisto(h::CSC_ALCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
540  if(alct_dtime < -16) {
541  mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
542  } else {
543  if (alct_dtime >= 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
544  else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
545  }
546  }
547 
548  int alct_bxn = alctsDatas[lct].getBX();
549  if (fwVersion == 2007) {
550  alct_bxn = (alct_bxn + alctHeader->BXNCount())&0x1F;
551  }
552 
553  if (getCSCHisto(h::CSC_ALCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(alct_bxn);
554 
555  if (getCSCHisto(h::CSC_ALCTXX_QUALITY, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
556 
557  if (mo_EventDisplay) {
558  mo_EventDisplay->SetBinContent(2, alctsDatas[lct].getKeyWG(), alct_bxn + 1 );
559  mo_EventDisplay->SetBinContent(3, alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
560  }
561 
562  if (getCSCHisto(h::CSC_ALCTXX_QUALITY_DISTR, crateID, dmbID, lct, mo)) {
563  mo->Fill(alctsDatas[lct].getQuality());
564  if (lct == 0) {
565  MonitorObject* mo1 = 0;
566  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT0_QUALITY, mo1)) {
567  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
568  }
569  }
570  }
571 
572  if (getCSCHisto(h::CSC_ALCTXX_QUALITY_PROFILE, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
573 
574  if (getCSCHisto(h::CSC_ALCTXX_PATTERN, crateID, dmbID, lct, mo)) {
575  int pattern = (alctsDatas[lct].getAccelerator() << 1) + alctsDatas[lct].getCollisionB();
576  int keywg = alctsDatas[lct].getKeyWG();
577  mo->Fill(keywg, pattern );
578  }
579 
580  if (getCSCHisto(h::CSC_ALCTXX_PATTERN_DISTR, crateID, dmbID, lct, mo)) {
581  int pattern = (alctsDatas[lct].getAccelerator()<<1) + alctsDatas[lct].getCollisionB();
582  mo->Fill(pattern);
583  }
584 
585  }
586 
587  int NumberOfLayersWithHitsInALCT = 0;
588  int NumberOfWireGroupsWithHitsInALCT = 0;
589 
590  if (alctData) {
591 
592  MonitorObject* mo_AFEB_RawHits_TimeBins = 0;
593  getCSCHisto(h::CSC_CFEB_AFEB_RAWHITS_TIMEBINS, crateID, dmbID, mo_AFEB_RawHits_TimeBins);
594 
595  MonitorObject* mo_CSC_Plus_endcap_AFEB_RawHits_Time = 0;
596  getEMUHisto(h::EMU_CSC_AFEB_ENDCAP_PLUS_RAWHITS_TIME, mo_CSC_Plus_endcap_AFEB_RawHits_Time);
597 
598  MonitorObject* mo_CSC_Minus_endcap_AFEB_RawHits_Time = 0;
599  getEMUHisto(h::EMU_CSC_AFEB_ENDCAP_MINUS_RAWHITS_TIME, mo_CSC_Minus_endcap_AFEB_RawHits_Time);
600 
601  MonitorObject* mo_CSC_AFEB_RawHits_Time_mean = 0;
602  getEMUHisto(h::EMU_CSC_AFEB_RAWHITS_TIME_MEAN, mo_CSC_AFEB_RawHits_Time_mean);
603 
604  MonitorObject* mo_CSC_AFEB_RawHits_Time_rms = 0;
605  getEMUHisto(h::EMU_CSC_AFEB_RAWHITS_TIME_RMS, mo_CSC_AFEB_RawHits_Time_rms);
606 
607  for (int nLayer = 1; nLayer <= 6; nLayer++) {
608 
609  int wg_previous = -1;
610  int tbin_previous = -1;
611  bool CheckLayerALCT = true;
612 
613  std::vector<CSCWireDigi> wireDigis = alctData->wireDigis(nLayer);
614  for (std::vector<CSCWireDigi>::iterator wireDigisItr = wireDigis.begin(); wireDigisItr != wireDigis.end(); ++wireDigisItr) {
615 
616  int wg = wireDigisItr->getWireGroup();
618  std::vector<int> tbins = wireDigisItr->getTimeBinsOn();
619  int tbin = wireDigisItr->getTimeBin();
620 
621  if (mo_EventDisplay) {
622  mo_EventDisplay->SetBinContent(nLayer + 3, wg - 1, tbin + 1);
623  setEmuEventDisplayBit(mo_Emu_EventDisplay_Anode, glChamberIndex, wg - 1, nLayer - 1);
624  setEmuEventDisplayBit(mo_Emu_EventDisplay_XY, glChamberIndex, wg - 1, nLayer - 1);
625  }
626 
627  if (CheckLayerALCT) {
628  NumberOfLayersWithHitsInALCT = NumberOfLayersWithHitsInALCT + 1;
629  CheckLayerALCT = false;
630  }
631 
632  for (uint32_t n = 0; n < tbins.size(); n++) {
633 
634  tbin = tbins[n];
635  if(wg != wg_previous || (tbin != tbin_previous + 1 && tbin != tbin_previous - 1) ) {
636 
637  if (getCSCHisto(h::CSC_ALCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(wg - 1, tbin);
638 
639  if (getCSCHisto(h::CSC_ALCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(wg - 1, tbin);
640 
641  if (mo_AFEB_RawHits_TimeBins) mo_AFEB_RawHits_TimeBins->Fill(tbin);
642 
643  if (cid.endcap() == 1) {
644  if (mo_CSC_Plus_endcap_AFEB_RawHits_Time) mo_CSC_Plus_endcap_AFEB_RawHits_Time->Fill(tbin);
645  }
646  if (cid.endcap() == 2) {
647  if (mo_CSC_Minus_endcap_AFEB_RawHits_Time) mo_CSC_Minus_endcap_AFEB_RawHits_Time->Fill(tbin);
648  }
649 
650  if (getCSCHisto(h::CSC_ALCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) {
651  mo->Fill(wg - 1);
652  int number_wg = (int)(mo->GetBinContent(wg));
653  Double_t Number_of_entries_ALCT = mo->GetEntries();
654  if (getCSCHisto(h::CSC_ALCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
655  mo->SetBinContent(wg, ((float) number_wg));
656  if((Double_t)(DMBEvents) > 0.0) {
657  mo->SetNormFactor(100.0*Number_of_entries_ALCT/(Double_t)(DMBEvents));
658  } else {
659  mo->SetNormFactor(100.0);
660  }
661  mo->SetEntries((int)DMBEvents);
662  }
663  }
664  }
665  if(wg != wg_previous) {
666  NumberOfWireGroupsWithHitsInALCT = NumberOfWireGroupsWithHitsInALCT + 1;
667  }
668 
669  wg_previous = wg;
670  tbin_previous = tbin;
671  }
672  }
673 
674  // Fill Summary Anode Raw Hits Timing Plots
675  if (mo_AFEB_RawHits_TimeBins) {
676 
677  double rawhits_time_mean = mo_AFEB_RawHits_TimeBins->getTH1()->GetMean();
678  double rawhits_time_rms = mo_AFEB_RawHits_TimeBins->getTH1()->GetRMS();
679 
680  if (cscType && cscPosition && mo_CSC_AFEB_RawHits_Time_mean) {
681  mo_CSC_AFEB_RawHits_Time_mean->SetBinContent(cscPosition, cscType + 1, rawhits_time_mean);
682  }
683 
684  if (cscType && cscPosition && mo_CSC_AFEB_RawHits_Time_rms) {
685  mo_CSC_AFEB_RawHits_Time_rms->SetBinContent(cscPosition, cscType + 1, rawhits_time_rms);
686  }
687 
688  }
689 
690  }
691 
692  } else {
693  LOG_ERROR << cscTag << " Can not unpack Anode Data";
694  }
695 
696  if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) {
697  mo->Fill(NumberOfLayersWithHitsInALCT);
698  MonitorObject* mo1 = 0;
699  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_PLANES_WITH_HITS, mo1)) {
700  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
701  }
702  }
703 
704  if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_WIREGROUPS_WITH_HITS, crateID, dmbID, mo)) mo->Fill(NumberOfWireGroupsWithHitsInALCT);
705 
706  } else {
707  LOG_ERROR << cscTag << " Can not unpack ALCT Header or/and Trailer";
708  }
709  } else {
712  if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
713  mo->Fill(0);
714  int nALCT = (int)mo->GetBinContent(1);
715  if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo))
716  mo->SetBinContent(1, (float)(nALCT) / (float)(DMBEvents) * 100.0);
717  }
718 
719  if ((alct_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
720  mo->Fill(0.0, 1.0);
721  }
722  }
723 
725  if(data.nclct() && data.nalct()) {
726 
727  CSCALCTHeader* alctHeader = data.alctHeader();
728 
729  if (alctHeader) {
730  std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
731  std::vector<CSCALCTDigi> alctsDatas;
732 
733  for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
734  if (alctsDatasTmp[lct].isValid())
735  alctsDatas.push_back(alctsDatasTmp[lct]);
736  }
737 
738  CSCTMBData* tmbData = data.tmbData();
739  if (tmbData) {
740  CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
741  if (tmbHeader) {
743  if (getCSCHisto(h::CSC_TMB_BXN_VS_ALCT_BXN, crateID, dmbID, mo))
744  mo->Fill( ((int)(alctHeader->BXNCount())) % 256, ((int)(tmbHeader->BXNCount())) % 256 );
745 
746  if (getCSCHisto(h::CSC_TMB_ALCT_BXN_DIFF, crateID, dmbID, mo)) {
747  int clct_alct_bxn_diff = (int)(alctHeader->BXNCount() - tmbHeader->BXNCount());
748  if(clct_alct_bxn_diff < -2048) mo->Fill(clct_alct_bxn_diff + 4096);
749  else {
750  if(clct_alct_bxn_diff > 2048) mo->Fill(clct_alct_bxn_diff - 4096);
751  else mo->Fill(clct_alct_bxn_diff);
752  }
753  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
754  }
755 
756  if (getCSCHisto(h::CSC_TMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo))
757  mo->Fill((int)(alctHeader->L1Acc()%256),(int)(tmbHeader->L1ANumber()%256));
758 
759  if (getCSCHisto(h::CSC_TMB_ALCT_L1A_DIFF, crateID, dmbID, mo)) {
760  int clct_alct_l1a_diff = (int)(tmbHeader->L1ANumber() - alctHeader->L1Acc());
761  if(clct_alct_l1a_diff < -2048) mo->Fill(clct_alct_l1a_diff + 4096);
762  else {
763  if(clct_alct_l1a_diff > 2048) mo->Fill(clct_alct_l1a_diff - 4096);
764  else mo->Fill(clct_alct_l1a_diff);
765  }
766  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
767  }
768  } else {
769  LOG_ERROR << cscTag << " Can not unpack TMB Header";
770  }
771 
772  } else {
773  LOG_ERROR << cscTag << " Can not unpack TMB Data";
774  }
775  } else {
776  LOG_ERROR << cscTag << " Can not unpack ALCT Header";
777  }
778  }
779 
781  if (data.nclct()) {
782 
785  CSCTMBData* tmbData = data.tmbData();
786  if (tmbData) {
787 
788  CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
789  CSCTMBTrailer* tmbTrailer = tmbData->tmbTrailer();
790 
791  if (tmbHeader && tmbTrailer) {
792 
793  CSCCLCTData* clctData = data.clctData();
794 
795  std::vector<CSCCLCTDigi> clctsDatasTmp = tmbHeader->CLCTDigis(cid.rawId());
796  std::vector<CSCCLCTDigi> clctsDatas;
797 
798  for (uint32_t lct = 0; lct < clctsDatasTmp.size(); lct++) {
799  if (clctsDatasTmp[lct].isValid()) clctsDatas.push_back(clctsDatasTmp[lct]);
800  }
801 
802  FEBunpacked = FEBunpacked +1;
803  tmb_unpacked = 1;
804 
805  if (getCSCHisto(h::CSC_ALCT_MATCH_TIME, crateID, dmbID, mo)) {
806 
807  mo->Fill(tmbHeader->ALCTMatchTime());
808  double alct_match_mean = mo->getTH1()->GetMean();
809  double alct_match_rms = mo->getTH1()->GetRMS();
810  MonitorObject* mo1 = 0;
811 
812  if (cid.endcap() == 1) {
813  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_ALCT_CLCT_MATCH_TIME, mo1)) {
814  mo1->Fill(tmbHeader->ALCTMatchTime());
815  }
816  }
817 
818  if (cid.endcap() == 2) {
819  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_ALCT_CLCT_MATCH_TIME, mo1)) {
820  mo1->Fill(tmbHeader->ALCTMatchTime());
821  }
822  }
823 
824  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_CLCT_MATCH_MEAN, mo1)) {
825  mo1->SetBinContent(cscPosition, cscType + 1, alct_match_mean);
826  }
827 
828  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_CLCT_MATCH_RMS, mo1)) {
829  mo1->SetBinContent(cscPosition, cscType + 1, alct_match_rms);
830  }
831 
832  }
833 
834  if (getCSCHisto(h::CSC_LCT_MATCH_STATUS, crateID, dmbID, mo)) {
835  if (tmbHeader->CLCTOnly()) mo->Fill(0.0,0.0);
836  if (tmbHeader->ALCTOnly()) mo->Fill(0.0,1.0);
837  if (tmbHeader->TMBMatch()) mo->Fill(0.0,2.0);
838  }
839 
840  if (getCSCHisto(h::CSC_LCT0_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn0Diff());
841  if (getCSCHisto(h::CSC_LCT1_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn1Diff());
842 
843  if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
844  mo->Fill(1.0, 0.0);
845  }
846 
848  if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
849  mo->Fill(3);
850  uint32_t CLCTEvent = (uint32_t)mo->GetBinContent(4);
851  config->setChamberCounterValue(CLCT_TRIGGERS, crateID, dmbID, CLCTEvent);
852  if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
853  if(config->getNEvents() > 0) {
854  mo->SetBinContent(2,((float)CLCTEvent/(float)(DMBEvents)*100.0));
855  mo->SetEntries(DMBEvents);
856  }
857  }
858  }
859 
860  if (getCSCHisto(h::CSC_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber());
861 
863  if (getCSCHisto(h::CSC_CLCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
864  int clct_dmb_l1a_diff = (int)((tmbHeader->L1ANumber() % 64)-dmbHeader->l1a() % 64);
865  if (clct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
866  if(clct_dmb_l1a_diff < -32) mo->Fill(clct_dmb_l1a_diff + 64);
867  else {
868  if(clct_dmb_l1a_diff >= 32) mo->Fill(clct_dmb_l1a_diff - 64);
869  else mo->Fill(clct_dmb_l1a_diff);
870  }
871  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
872  }
873 
875  if (getCSCHisto(h::CSC_DMB_L1A_VS_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber()%256,dmbHeader->l1a());
876 
877  if (getCSCHisto(h::CSC_CLCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
878  int clct_dmb_bxn_diff = (int)(tmbHeader->BXNCount()%64-dmbHeader->bxn12()%64);
879  if(clct_dmb_bxn_diff < -32) mo->Fill(clct_dmb_bxn_diff + 64);
880  else {
881  if(clct_dmb_bxn_diff >= 32) mo->Fill(clct_dmb_bxn_diff - 64);
882  else mo->Fill(clct_dmb_bxn_diff);
883  }
884  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
885  }
886 
887  if (getCSCHisto(h::CSC_CLCT_BXN, crateID, dmbID, mo)) mo->Fill((int)(tmbHeader->BXNCount()));
888 
890  if (getCSCHisto(h::CSC_CLCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill(tmbHeader->BXNCount()%256,dmbHeader->bxn12()%256);
891 
892  if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
893  mo->Fill(clctsDatas.size());
894  int nCLCT = (int)mo->GetBinContent((int)(clctsDatas.size()+1));
895  if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent((int)(clctsDatas.size() + 1), (float)(nCLCT) / (float)(DMBEvents) * 100.0);
896  }
897 
898  if (clctsDatas.size() == 1) {
899  if (getCSCHisto(h::CSC_CLCT0_CLSSIFICATION, crateID, dmbID, mo)) {
900  if (clctsDatas[0].getStripType()) mo->Fill(0.0);
901  else mo->Fill(1.0);
902  }
903  }
904 
905  if (clctsDatas.size() == 2) {
906  if (getCSCHisto(h::CSC_CLCT1_VS_CLCT0_KEY_STRIP, crateID, dmbID, mo))
907  mo->Fill(clctsDatas[0].getKeyStrip(),clctsDatas[1].getKeyStrip());
908  if (getCSCHisto(h::CSC_CLCT0_CLCT1_CLSSIFICATION, crateID, dmbID, mo)) {
909  if ( clctsDatas[0].getStripType() && clctsDatas[1].getStripType()) mo->Fill(0.0);
910  if ( clctsDatas[0].getStripType() && !clctsDatas[1].getStripType()) mo->Fill(1.0);
911  if (!clctsDatas[0].getStripType() && clctsDatas[1].getStripType()) mo->Fill(2.0);
912  if (!clctsDatas[0].getStripType() && !clctsDatas[1].getStripType()) mo->Fill(3.0);
913  }
914  }
915 
916  if (getCSCHisto(h::CSC_TMB_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(tmbTrailer->wordCount()));
919  MonitorObject* mo_CSC_Plus_endcap_CLCT0_dTime = 0;
920  getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_CLCT0_DTIME, mo_CSC_Plus_endcap_CLCT0_dTime);
921 
922  MonitorObject* mo_CSC_Minus_endcap_CLCT0_dTime = 0;
923  getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_CLCT0_DTIME, mo_CSC_Minus_endcap_CLCT0_dTime);
924 
925  MonitorObject* mo_CSC_CLCT0_BXN_mean = 0;
926  getEMUHisto(h::EMU_CSC_CLCT0_BXN_MEAN, mo_CSC_CLCT0_BXN_mean);
927 
928  MonitorObject* mo_CSC_CLCT0_BXN_rms = 0;
929  getEMUHisto(h::EMU_CSC_CLCT0_BXN_RMS, mo_CSC_CLCT0_BXN_rms);
930 
931  for (uint32_t lct = 0; lct < clctsDatas.size(); lct++) {
932 
933  if (getCSCHisto(h::CSC_CLCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getFullBX()%64);
934 
935  int clct_dtime = clctsDatas[lct].getFullBX() - tmbHeader->BXNCount();
936  if (clct_dtime > 0) {
937  clct_dtime -= 3564;
938  }
939 
940  if (getCSCHisto(h::CSC_CLCTXX_DTIME, crateID, dmbID, lct, mo)) {
941  int dTime = clct_dtime;
942  /*
943  if (clct_dtime < -16) {
944  dTime = clct_dtime + 32;
945  } else {
946  if (clct_dtime > 16) dTime = clct_dtime - 32;
947  }
948  */
949 
950  mo->Fill(dTime);
951  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
952 
953  double dTime_mean = mo->getTH1()->GetMean();
954  double dTime_rms = mo->getTH1()->GetRMS();
955 
956  // == For CLCT0 Fill Summary dTime Histograms
957  if (lct == 0) {
958  if (cid.endcap() == 1) {
959  if (mo_CSC_Plus_endcap_CLCT0_dTime) mo_CSC_Plus_endcap_CLCT0_dTime->Fill(dTime);
960  }
961  if (cid.endcap() == 2) {
962  if (mo_CSC_Minus_endcap_CLCT0_dTime) mo_CSC_Minus_endcap_CLCT0_dTime->Fill(dTime);
963  }
964  if ( cscType && cscPosition && mo_CSC_CLCT0_BXN_mean) {
965  mo_CSC_CLCT0_BXN_mean->SetBinContent(cscPosition, cscType + 1, dTime_mean);
966  }
967  if (cscType && cscPosition && mo_CSC_CLCT0_BXN_rms) {
968  mo_CSC_CLCT0_BXN_rms->SetBinContent(cscPosition, cscType + 1, dTime_rms);
969  }
970  }
971 
972  }
973 
976  LOG_DEBUG << "LCT:" << lct << " Type:" << clctsDatas[lct].getStripType() << " Strip:" << clctsDatas[lct].getKeyStrip();
977 
978  if (clctsDatas[lct].getStripType()) { // HalfStrip Type
979 
980  if (getCSCHisto(h::CSC_CLCTXX_KEYHALFSTRIP, crateID, dmbID, lct, mo))
981  mo->Fill(clctsDatas[lct].getKeyStrip());
982 
983  if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_HALF_STRIP, crateID, dmbID, lct, mo)) {
984  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
985  /*
986  if (clct_dtime < -16) {
987  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
988  } else {
989  if (clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
990  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
991  }
992  */
993  }
994 
995  if (getCSCHisto(h::CSC_CLCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
996  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
997  /*
998  if (clct_dtime < -16) {
999  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
1000  } else {
1001  if (clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
1002  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
1003  }
1004  */
1005  }
1006 
1007  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_PATTERN, crateID, dmbID, lct, mo)) {
1008 
1009  int pattern_clct = clctsDatas[lct].getPattern();
1013  double tbin = -1;
1014 
1015  switch (pattern_clct) {
1016  case 0: tbin=0.; break;
1017  case 1: tbin=1.; break;
1018  case 2: tbin=2.; break;
1019  case 3: tbin=10.; break;
1020  case 4: tbin=3.; break;
1021  case 5: tbin=9.; break;
1022  case 6: tbin=4.; break;
1023  case 7: tbin=8.; break;
1024  case 8: tbin=5.; break;
1025  case 9: tbin=7.; break;
1026  case 10: tbin=6.; break;
1027  }
1028 
1029  if (tbin >= 0) mo->Fill(clctsDatas[lct].getKeyStrip(), tbin);
1030 
1031  MonitorObject* mo1 = 0;
1032  if (getCSCHisto(h::CSC_CLCT_HALF_STRIP_PATTERN_DISTR, crateID, dmbID, lct, mo1)) mo1->Fill(tbin);
1033 
1034  }
1035 
1036  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY, crateID, dmbID, lct, mo))
1037  mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
1038 
1039  if (mo_EventDisplay) {
1040  mo_EventDisplay->SetBinContent(10, clctsDatas[lct].getKeyStrip(), clct_dtime);
1041  mo_EventDisplay->SetBinContent(11, clctsDatas[lct].getKeyStrip(), clctsDatas[lct].getQuality());
1042  }
1043 
1044  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_DISTR, crateID, dmbID, lct, mo)) {
1045  mo->Fill((int)(clctsDatas[lct].getQuality()));
1046  if (lct == 0) {
1047  MonitorObject* mo1 = 0;
1048  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_CLCT0_QUALITY, mo1))
1049  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
1050  }
1051  }
1052 
1053  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
1054  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
1055 
1056  } else { // DiStrip Type
1057 
1058  LOG_INFO << "Entering block!";
1059 
1060  if (getCSCHisto(h::CSC_CLCTXX_KEYDISTRIP, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getKeyStrip());
1061  else LOG_ERROR << "Not found h::CSC_CLCTXX_KEYDISTRIP = " << h::CSC_CLCTXX_KEYDISTRIP;
1062 
1063  if(lct == 0) clct_kewdistrip = clctsDatas[lct].getKeyStrip();
1064 
1065  if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_DISTRIP, crateID, dmbID, lct, mo)) {
1066  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
1067  /*
1068  if(clct_dtime < -16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
1069  else {
1070  if(clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
1071  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
1072  }
1073  */
1074  }
1075 
1076  if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_PATTERN, crateID, dmbID, lct, mo)) {
1077  int pattern_clct = (int)((clctsDatas[lct].getPattern() >> 1) & 0x3);
1080  if(pattern_clct == 1) mo->Fill(clctsDatas[lct].getKeyStrip(), 7.0);
1081  if(pattern_clct == 3) mo->Fill(clctsDatas[lct].getKeyStrip(), 6.0);
1082  if(pattern_clct == 5) mo->Fill(clctsDatas[lct].getKeyStrip(), 5.0);
1083  if(pattern_clct == 7) mo->Fill(clctsDatas[lct].getKeyStrip(), 4.0);
1084  if(pattern_clct == 6) mo->Fill(clctsDatas[lct].getKeyStrip(), 3.0);
1085  if(pattern_clct == 4) mo->Fill(clctsDatas[lct].getKeyStrip(), 2.0);
1086  if(pattern_clct == 2) mo->Fill(clctsDatas[lct].getKeyStrip(), 1.0);
1087  if(pattern_clct == 0) mo->Fill(clctsDatas[lct].getKeyStrip(), 0.0);
1088  }
1089 
1090  if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY, crateID, dmbID, lct, mo))
1091  mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
1092 
1093  if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
1094  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
1095  }
1096  }
1097 
1098  int N_CFEBs = 5;
1099 
1100  int NumberOfLayersWithHitsInCLCT = 0;
1101  int NumberOfHalfStripsWithHitsInCLCT = 0;
1102 
1103  if (clctData && clctData->check()) {
1104 
1105  MonitorObject* mo_CFEB_Comparators_TimeSamples = 0;
1106  getCSCHisto(h::CSC_CFEB_COMPARATORS_TIMESAMPLES, crateID, dmbID, mo_CFEB_Comparators_TimeSamples);
1107 
1108  MonitorObject* mo_CSC_Plus_endcap_CFEB_Comparators_Time = 0;
1109  getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_CFEB_COMPARATORS_TIME, mo_CSC_Plus_endcap_CFEB_Comparators_Time);
1110 
1111  MonitorObject* mo_CSC_Minus_endcap_CFEB_Comparators_Time = 0;
1112  getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_CFEB_COMPARATORS_TIME, mo_CSC_Minus_endcap_CFEB_Comparators_Time);
1113 
1114  MonitorObject* mo_CSC_CFEB_Comparators_Time_mean = 0;
1115  getEMUHisto(h::EMU_CSC_CFEB_COMPARATORS_TIME_MEAN, mo_CSC_CFEB_Comparators_Time_mean);
1116 
1117  MonitorObject* mo_CSC_CFEB_Comparators_Time_rms = 0;
1118  getEMUHisto(h::EMU_CSC_CFEB_COMPARATORS_TIME_RMS, mo_CSC_CFEB_Comparators_Time_rms);
1119 
1120  for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {
1121  for (int nLayer = 1; nLayer <= 6; nLayer++) {
1122 
1123  int hstrip_previous = -1;
1124  int tbin_clct_previous = -1;
1125  bool CheckLayerCLCT = true;
1126 
1127  std::vector<CSCComparatorDigi> compOutData = clctData->comparatorDigis(nLayer, nCFEB);
1128 
1129  for (std::vector<CSCComparatorDigi>::iterator compOutDataItr = compOutData.begin(); compOutDataItr != compOutData.end(); ++compOutDataItr) {
1131  int hstrip = 2 * (compOutDataItr->getStrip() - 1) + compOutDataItr->getComparator();
1132  std::vector<int> tbins_clct = compOutDataItr->getTimeBinsOn();
1133  int tbin_clct = (int)compOutDataItr->getTimeBin();
1134 
1135  if (mo_EventDisplay) {
1136  mo_EventDisplay->SetBinContent(nLayer + 11, hstrip, tbin_clct + 1);
1137  setEmuEventDisplayBit(mo_Emu_EventDisplay_Anode, glChamberIndex, 160 + hstrip, nLayer - 1);
1138  setEmuEventDisplayBit(mo_Emu_EventDisplay_XY, glChamberIndex, 160 + hstrip, nLayer - 1);
1139  }
1140 
1141  if(CheckLayerCLCT) {
1142  NumberOfLayersWithHitsInCLCT = NumberOfLayersWithHitsInCLCT + 1;
1143  CheckLayerCLCT = false;
1144  }
1145 
1146  for (uint32_t n=0; n < tbins_clct.size(); n++) {
1147  tbin_clct = tbins_clct[n];
1148  if(hstrip != hstrip_previous || (tbin_clct != tbin_clct_previous + 1 && tbin_clct != tbin_clct_previous - 1) ) {
1149 
1150  if (getCSCHisto(h::CSC_CLCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);
1151 
1152  if (mo_CFEB_Comparators_TimeSamples) mo_CFEB_Comparators_TimeSamples->Fill(tbin_clct);
1153 
1154  if (cid.endcap() == 1) {
1155  if (mo_CSC_Plus_endcap_CFEB_Comparators_Time) mo_CSC_Plus_endcap_CFEB_Comparators_Time->Fill(tbin_clct);
1156  }
1157 
1158  if (cid.endcap() == 2) {
1159  if (mo_CSC_Minus_endcap_CFEB_Comparators_Time) mo_CSC_Minus_endcap_CFEB_Comparators_Time->Fill(tbin_clct);
1160  }
1161 
1162  if (getCSCHisto(h::CSC_CLCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);
1163 
1164  if (getCSCHisto(h::CSC_CLCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) {
1165 
1166  mo->Fill(hstrip);
1167 
1168  double number_hstrip = mo->GetBinContent(hstrip+1);
1169  double Number_of_entries_CLCT = mo->GetEntries();
1170 
1171  if (getCSCHisto(h::CSC_CLCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
1172  mo->SetBinContent(hstrip + 1, number_hstrip);
1173  if(DMBEvents > 0) {
1174  double norm = (100.0 * Number_of_entries_CLCT) / ((double)(DMBEvents));
1176  mo->SetNormFactor(norm);
1177  } else {
1178  mo->SetNormFactor(100.0);
1179  }
1180  mo->SetEntries(DMBEvents);
1181  }
1182  }
1183  }
1184 
1185  if(hstrip != hstrip_previous) {
1186  NumberOfHalfStripsWithHitsInCLCT = NumberOfHalfStripsWithHitsInCLCT + 1;
1187  }
1188  hstrip_previous = hstrip;
1189  tbin_clct_previous = tbin_clct;
1190  }
1191  }
1192  }
1193  }
1194 
1195  if (mo_CFEB_Comparators_TimeSamples) {
1196 
1197  double comps_time_mean = mo_CFEB_Comparators_TimeSamples->getTH1()->GetMean();
1198  double comps_time_rms = mo_CFEB_Comparators_TimeSamples->getTH1()->GetRMS();
1199 
1200  if ( cscType && cscPosition && mo_CSC_CFEB_Comparators_Time_mean) {
1201  mo_CSC_CFEB_Comparators_Time_mean->SetBinContent(cscPosition, cscType + 1, comps_time_mean);
1202  }
1203  if ( cscType && cscPosition && mo_CSC_CFEB_Comparators_Time_rms) {
1204  mo_CSC_CFEB_Comparators_Time_rms->SetBinContent(cscPosition, cscType + 1, comps_time_rms);
1205  }
1206 
1207  }
1208 
1209  } else {
1210  LOG_ERROR << cscTag << " Can not unpack CLCT Data";
1211  }
1212 
1213  if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) {
1214  mo->Fill(NumberOfLayersWithHitsInCLCT);
1215  MonitorObject* mo1 = 0;
1216  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_CLCT_PLANES_WITH_HITS, mo1)) {
1217  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
1218  }
1219  }
1220 
1221  if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_HALFSTRIPS_WITH_HITS, crateID, dmbID, mo))
1222  mo->Fill(NumberOfHalfStripsWithHitsInCLCT);
1223  } else {
1224  LOG_ERROR << cscTag << " Can not unpack TMB Header or/and Trailer";
1225  }
1226  } else {
1227  LOG_ERROR << cscTag << " Can not unpack TMB Data";
1228  }
1229 
1230  } else {
1233  if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
1234  mo->Fill(0);
1235  int nCLCT = (int)mo->GetBinContent(1);
1236  if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent(1, (float)(nCLCT) / (float)(DMBEvents) * 100.0);
1237  }
1238  if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
1239  mo->Fill(1.0, 1.0);
1240  }
1241  }
1242 
1244  int NumberOfUnpackedCFEBs = 0;
1245  const int N_CFEBs = 5, N_Samples = 16, N_Layers = 6, N_Strips = 16;
1246  int ADC = 0, OutOffRange, Threshold = 30;
1248 // CSCCFEBData * cfebData[5];
1249 // CSCCFEBTimeSlice * timeSlice[5][16];
1250 // CSCCFEBDataWord * timeSample[5][16][6][16];
1251  int Pedestal[5][6][16];
1252  std::pair<int,int> CellPeak[5][6][16];
1253  memset(CellPeak, 0, sizeof(CellPeak));
1254 // float PedestalError[5][6][16];
1255 // CSCCFEBSCAControllerWord scaControllerWord[5][16][6];
1256  bool CheckCFEB = true;
1258  float Clus_Sum_Charge;
1259  int TrigTime, L1APhase, UnpackedTrigTime, LCTPhase, SCA_BLK, NmbTimeSamples;
1261  int FreeCells, LCT_Pipe_Empty, LCT_Pipe_Full, LCT_Pipe_Count, L1_Pipe_Empty, L1_Pipe_Full, Buffer_Count;
1264  bool CheckThresholdStripInTheLayer[6][80];
1265  for(int i=0; i<6; i++) {
1266  for(int j = 0; j < 80; j++) CheckThresholdStripInTheLayer[i][j] = true;
1267  }
1268 
1269  bool CheckOutOffRangeStripInTheLayer[6][80];
1270  for(int i=0; i<6; i++) {
1271  for(int j=0; j<80; j++) CheckOutOffRangeStripInTheLayer[i][j] = true;
1272  }
1273 
1275  float cscdata[N_CFEBs * 16][N_Samples][N_Layers];
1277  int SCABlockData[N_CFEBs * 16][N_Samples][N_Layers];
1278  memset(cscdata, 0, sizeof(cscdata));
1280  memset(SCABlockData, 0, sizeof(SCABlockData));
1283  char hbuf[255];
1284  memset(hbuf, 0, sizeof(hbuf));
1285 
1286  MonitorObject* mo_CFEB_SCA_CellPeak_Time = 0;
1287  getCSCHisto(h::CSC_CFEB_SCA_CELLPEAK_TIME, crateID, dmbID, mo_CFEB_SCA_CellPeak_Time);
1288 
1289  MonitorObject* mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time = 0;
1290  getEMUHisto(h::EMU_CSC_PLUS_ENDCAP_CFEB_SCA_CELLPEAK_TIME, mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time);
1291 
1292  MonitorObject* mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time = 0;
1293  getEMUHisto(h::EMU_CSC_MINUS_ENDCAP_CFEB_SCA_CELLPEAK_TIME, mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time);
1294 
1295  MonitorObject* mo_CSC_CFEB_SCA_CellPeak_Time_mean = 0;
1296  getEMUHisto(h::EMU_CSC_CFEB_SCA_CELLPEAK_TIME_MEAN, mo_CSC_CFEB_SCA_CellPeak_Time_mean);
1297 
1298  MonitorObject* mo_CSC_CFEB_SCA_CellPeak_Time_rms = 0;
1299  getEMUHisto(h::EMU_CSC_CFEB_SCA_CELLPEAK_TIME_RMS, mo_CSC_CFEB_SCA_CellPeak_Time_rms);
1300 
1301  for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {
1302 
1303 // cfebData[nCFEB] = data.cfebData(nCFEB);
1304  if (data.cfebData(nCFEB) !=0) {
1305  if (!data.cfebData(nCFEB)->check()) continue;
1307  FEBunpacked = FEBunpacked +1; // Increment number of unpacked FED
1308  NumberOfUnpackedCFEBs = NumberOfUnpackedCFEBs + 1; // Increment number of unpaked CFEB
1309  cfeb_unpacked = 1;
1310  if(CheckCFEB == true){
1311  if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
1312  mo->Fill(4);
1313  uint32_t CFEBEvent = (uint32_t)mo->GetBinContent(5);
1314  config->setChamberCounterValue(CFEB_TRIGGERS, crateID, dmbID, CFEBEvent);
1315  if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
1316  if(config->getNEvents() > 0) {
1317  mo->SetBinContent(3, ((float)CFEBEvent/(float)(DMBEvents)*100.0));
1318  mo->SetEntries((int)DMBEvents);
1319  }
1320  }
1321  }
1322 
1323  if ((cfeb_dav2 > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
1324  mo->Fill(2.0, 0.0);
1325  }
1326  CheckCFEB = false;
1327  }
1329  NmbTimeSamples= (data.cfebData(nCFEB))->nTimeSamples();
1335  MonitorObject* mo_CFEB_SCA_Block_Occupancy = 0;
1336  getCSCHisto(h::CSC_CFEBXX_SCA_BLOCK_OCCUPANCY, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Block_Occupancy);
1337  MonitorObject* mo_CFEB_Free_SCA_Cells = 0;
1338  getCSCHisto(h::CSC_CFEBXX_FREE_SCA_CELLS, crateID, dmbID, nCFEB + 1, mo_CFEB_Free_SCA_Cells);
1339  MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTs = 0;
1340  getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTS, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Blocks_Locked_by_LCTs);
1341  MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTxL1 = 0;
1342  getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTXL1, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Blocks_Locked_by_LCTxL1);
1343  MonitorObject* mo_CFEB_DMB_L1A_diff = 0;
1344  getCSCHisto(h::CSC_CFEBXX_DMB_L1A_DIFF, crateID, dmbID, nCFEB + 1, mo_CFEB_DMB_L1A_diff);
1345 
1348  for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
1350  MonitorObject * mo_CFEB_Out_Off_Range_Strips = 0;
1351  getCSCHisto(h::CSC_CFEB_OUT_OFF_RANGE_STRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_Out_Off_Range_Strips);
1352  MonitorObject * mo_CFEB_Active_Samples_vs_Strip = 0;
1353  getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip);
1354  MonitorObject * mo_CFEB_Active_Samples_vs_Strip_Profile = 0;
1355  getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX_PROFILE, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip_Profile);
1356  MonitorObject * mo_CFEB_ActiveStrips = 0;
1357  getCSCHisto(h::CSC_CFEB_ACTIVESTRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_ActiveStrips);
1358  MonitorObject * mo_CFEB_SCA_Cell_Peak = 0;
1359  getCSCHisto(h::CSC_CFEB_SCA_CELL_PEAK_LY_XX, crateID, dmbID, nLayer, mo_CFEB_SCA_Cell_Peak);
1360 
1361  MonitorObject * mo_CFEB_Pedestal_withEMV_Sample = 0;
1362  getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHEMV_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withEMV_Sample);
1363  MonitorObject * mo_CFEB_Pedestal_withRMS_Sample = 0;
1364  getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withRMS_Sample);
1365  MonitorObject * mo_CFEB_PedestalRMS_Sample = 0;
1366  getCSCHisto(h::CSC_CFEB_PEDESTALRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_PedestalRMS_Sample);
1367 
1368  for(int nSample = 0; nSample < NmbTimeSamples; ++nSample) {
1369 // timeSlice[nCFEB][nSample] = (CSCCFEBTimeSlice * )((cfebData[nCFEB])->timeSlice(nSample));
1370  if (timeSlice(data, nCFEB, nSample) == 0) {
1371  LOG_WARN << "CFEB" << nCFEB << " nSample: " << nSample << " - B-Word";
1372  continue;
1373  }
1374 
1375  if (mo_CFEB_DMB_L1A_diff && !fCloseL1As ) {
1377  int cfeb_dmb_l1a_diff = (int)((timeSlice(data, nCFEB, nSample)->get_L1A_number())-dmbHeader->l1a()%64);
1378  if (cfeb_dmb_l1a_diff != 0) {
1379  L1A_out_of_sync = true;
1380  }
1381  if(cfeb_dmb_l1a_diff < -32) mo->Fill(cfeb_dmb_l1a_diff + 64);
1382  else {
1383  if(cfeb_dmb_l1a_diff >= 32) mo->Fill(cfeb_dmb_l1a_diff - 64);
1384  else mo_CFEB_DMB_L1A_diff->Fill(cfeb_dmb_l1a_diff);
1385  }
1386  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");
1387  }
1388 
1391 // scaControllerWord[nCFEB][nSample][nLayer-1] = timeSlice(cfebData, nCFEB, nSample)->scaControllerWord(nLayer);
1392 
1393  TrigTime = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).trig_time);
1395  FreeCells = timeSlice(data, nCFEB, nSample)->get_n_free_sca_blocks();
1396  LCT_Pipe_Empty = timeSlice(data, nCFEB, nSample)->get_lctpipe_empty();
1397  LCT_Pipe_Full = timeSlice(data, nCFEB, nSample)->get_lctpipe_full();
1398  LCT_Pipe_Count = timeSlice(data, nCFEB, nSample)->get_lctpipe_count();
1399  L1_Pipe_Empty = timeSlice(data, nCFEB, nSample)->get_l1pipe_empty();
1400  L1_Pipe_Full = timeSlice(data, nCFEB, nSample)->get_l1pipe_full();
1402  Buffer_Count = timeSlice(data, nCFEB, nSample)->get_buffer_count();
1403 
1404  SCA_BLK = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).sca_blk);
1408  for(int nStrip = 0; nStrip < N_Strips; ++nStrip) {
1409  SCABlockData[nCFEB*16+nStrip][nSample][nLayer-1] = SCA_BLK;
1411  }
1416  if (mo_CFEB_SCA_Block_Occupancy) mo_CFEB_SCA_Block_Occupancy->Fill(SCA_BLK);
1417 
1420  if (mo_CFEB_Free_SCA_Cells) {
1421  if (timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).sca_full == 1) mo_CFEB_Free_SCA_Cells->Fill(-1);
1422  mo_CFEB_Free_SCA_Cells->Fill(FreeCells);
1423  }
1424 
1427  if (mo_CFEB_SCA_Blocks_Locked_by_LCTs) {
1428  if (LCT_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(-0.5);
1429  if (LCT_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(16.5);
1430  mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(LCT_Pipe_Count);
1431  }
1432 
1435  if (mo_CFEB_SCA_Blocks_Locked_by_LCTxL1) {
1436  if (L1_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(-0.5);
1437  if (L1_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(31.5);
1438  mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(Buffer_Count);
1439  }
1440 
1443  if(nSample == 0 && nLayer == 1) {
1444  TrigTime = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).trig_time);
1445  int k = 1;
1446  while (((TrigTime >> (k-1)) & 0x1) != 1 && k <= 8) {
1447  k = k + 1;
1448  }
1449  L1APhase = (int)((timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).l1a_phase) & 0x1);
1450  UnpackedTrigTime = ((k << 1) & 0xE) + L1APhase;
1451 
1452  if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME, crateID, dmbID, nCFEB + 1, mo))
1453  mo->Fill((int)UnpackedTrigTime);
1454  LCTPhase = (int)((timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).lct_phase)&0x1);
1455 
1456  if (getCSCHisto(h::CSC_CFEBXX_LCT_PHASE_VS_L1A_PHASE, crateID, dmbID, nCFEB + 1, mo))
1457  mo->Fill(LCTPhase, L1APhase);
1458 
1461  if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_VS_DMB, crateID, dmbID, nCFEB + 1, mo))
1462  mo->Fill((int)(dmbHeader->dmbCfebSync()), (int)UnpackedTrigTime);
1463 
1464  if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_DMB_DIFF, crateID, dmbID, nCFEB + 1, mo)) {
1465  int cfeb_dmb_L1A_sync_time = (int)(dmbHeader->dmbCfebSync()) - (int)UnpackedTrigTime;
1466  if(cfeb_dmb_L1A_sync_time < -8) mo->Fill(cfeb_dmb_L1A_sync_time+16);
1467  else {
1468  if(cfeb_dmb_L1A_sync_time >= 8) mo->Fill(cfeb_dmb_L1A_sync_time-16);
1469  else mo->Fill(cfeb_dmb_L1A_sync_time);
1470  }
1471  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
1472  }
1473 
1474  }
1475 
1476 
1477  for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
1478 // timeSample[nCFEB][nSample][nLayer - 1][nStrip - 1]=(data.cfebData(nCFEB)->timeSlice(nSample))->timeSample(nLayer,nStrip);
1479  ADC = (int) ((timeSample(data, nCFEB, nSample, nLayer, nStrip)->adcCounts) & 0xFFF);
1481  OutOffRange = (int) ((timeSample(data, nCFEB, nSample, nLayer, nStrip)->adcOverflow) & 0x1);
1482 
1483  if(nSample == 0) { // nSample == 0
1484  CellPeak[nCFEB][nLayer-1][nStrip-1] = std::make_pair(nSample,ADC);
1485  Pedestal[nCFEB][nLayer-1][nStrip-1] = ADC;
1487  }
1488 
1489  if(OutOffRange == 1 && CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
1491  if ( mo_CFEB_Out_Off_Range_Strips)
1492  mo_CFEB_Out_Off_Range_Strips->Fill((int)(nCFEB * 16 + nStrip - 1));
1493  CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
1494  }
1495  if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold && OutOffRange != 1) {
1497  if (mo_CFEB_Active_Samples_vs_Strip)
1498  mo_CFEB_Active_Samples_vs_Strip->Fill((int)(nCFEB * 16 + nStrip - 1), nSample);
1499 
1501  if (mo_CFEB_Active_Samples_vs_Strip_Profile)
1502  mo_CFEB_Active_Samples_vs_Strip_Profile->Fill((int)(nCFEB * 16 + nStrip - 1), nSample);
1503 
1504  if(CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
1506  if (mo_CFEB_ActiveStrips)
1507  mo_CFEB_ActiveStrips->Fill((int)(nCFEB * 16 + nStrip));
1508  CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
1509  }
1511  if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold) {
1513  cscdata[nCFEB * 16 + nStrip - 1][nSample][nLayer - 1] = ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1];
1514  }
1516  if(ADC > CellPeak[nCFEB][nLayer - 1][nStrip - 1].second) {
1517  CellPeak[nCFEB][nLayer - 1][nStrip - 1].first = nSample;
1518  CellPeak[nCFEB][nLayer - 1][nStrip - 1].second = ADC;
1519  }
1520  }
1523  if(nSample == 1) {
1524  int channel_threshold = 40;
1525  if (std::abs(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1]) < channel_threshold) {
1527  if (mo_CFEB_Pedestal_withEMV_Sample)
1528  mo_CFEB_Pedestal_withEMV_Sample->Fill((int)(nCFEB * 16 + nStrip - 1), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
1529 
1531  if (mo_CFEB_Pedestal_withRMS_Sample) {
1532  mo_CFEB_Pedestal_withRMS_Sample->Fill((int)(nCFEB * 16 + nStrip - 1), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
1533 // PedestalError[nCFEB][nLayer - 1][nStrip - 1] = mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip);
1534 
1536  if (mo_CFEB_PedestalRMS_Sample) {
1537  mo_CFEB_PedestalRMS_Sample->SetBinContent(nCFEB * 16 + nStrip - 1, mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip));
1538  mo_CFEB_PedestalRMS_Sample->SetBinError(nCFEB * 16 + nStrip - 1, 0.00000000001);
1539  }
1540  }
1541  }
1542  Pedestal[nCFEB][nLayer-1][nStrip-1] += ADC;
1543  Pedestal[nCFEB][nLayer-1][nStrip-1] /= 2;
1544  }
1546  }
1547  }
1548 
1549  for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
1550  if (mo_CFEB_SCA_Cell_Peak && CellPeak[nCFEB][nLayer - 1][nStrip - 1].first) {
1551  mo_CFEB_SCA_Cell_Peak->Fill((int)(nCFEB * 16 + nStrip - 1), CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1552  if (mo_CFEB_SCA_CellPeak_Time) {
1553  mo_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1554  }
1555 
1556  if (mo_EventDisplay) {
1557  int peak_sample = CellPeak[nCFEB][nLayer-1][nStrip-1].first;
1558  int peak_adc = CellPeak[nCFEB][nLayer-1][nStrip-1].second;
1559  int pedestal = Pedestal[nCFEB][nLayer-1][nStrip-1];
1560  int peak_sca_charge = peak_adc - pedestal;
1561 
1562  if (peak_adc - pedestal > Threshold) {
1563  if (peak_sample >=1) {
1564  peak_sca_charge += ((timeSample(data, nCFEB, peak_sample-1, nLayer, nStrip)->adcCounts)&0xFFF)-pedestal;
1565  }
1566  if (peak_sample < NmbTimeSamples-1) {
1567  peak_sca_charge += ((timeSample(data, nCFEB, peak_sample+1, nLayer, nStrip)->adcCounts)&0xFFF)-pedestal;
1568  }
1569  mo_EventDisplay->SetBinContent(nLayer + 17, nCFEB * 16 + nStrip - 1, peak_sca_charge);
1570  setEmuEventDisplayBit(mo_Emu_EventDisplay_Cathode, glChamberIndex, nCFEB * 16 + nStrip - 1, nLayer - 1);
1571  }
1572  }
1573 
1574  if (cid.endcap() == 1) {
1575  if (mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time)
1576  mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1577  }
1578  if (cid.endcap() == 2) {
1579  if (mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time)
1580  mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1581  }
1582  }
1583  }
1584 
1585  }
1586  }
1587 
1588  }
1589 
1590  // Fill Summary CFEB Raw Hits Timing Plots
1591  if (mo_CFEB_SCA_CellPeak_Time) {
1592  double cellpeak_time_mean = mo_CFEB_SCA_CellPeak_Time->getTH1()->GetMean();
1593  double cellpeak_time_rms = mo_CFEB_SCA_CellPeak_Time->getTH1()->GetRMS();
1594  if (cscType && cscPosition && mo_CSC_CFEB_SCA_CellPeak_Time_mean) {
1595  mo_CSC_CFEB_SCA_CellPeak_Time_mean->SetBinContent(cscPosition, cscType + 1, cellpeak_time_mean);
1596  }
1597  if (cscType && cscPosition && mo_CSC_CFEB_SCA_CellPeak_Time_rms) {
1598  mo_CSC_CFEB_SCA_CellPeak_Time_rms->SetBinContent(cscPosition, cscType + 1 ,cellpeak_time_rms);
1599  }
1600  }
1601 
1604  const int a = N_CFEBs * N_Strips;
1605  const int b = a * N_Samples;
1606  float Cathodes[b * N_Layers];
1607  for(int i = 0; i < N_Layers; ++i) {
1608  const int b1 = i * b;
1609  for(int j = 0; j < a; ++j) {
1610  const int b2 = b1 + j;
1611  for(int k = 0; k < N_Samples; ++k) {
1612  Cathodes[b2 + a * k] = cscdata[j][k][i];
1613  }
1614  }
1615  }
1616 
1617  std::vector<StripCluster> Clus;
1618  Clus.clear();
1619  StripClusterFinder ClusterFinder(N_Layers, N_Samples, N_CFEBs, N_Strips);
1620 
1621  for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
1622 
1625  ClusterFinder.DoAction(nLayer - 1, Cathodes);
1626  Clus = ClusterFinder.getClusters();
1627 
1630  if (getCSCHisto(h::CSC_CFEB_NUMBER_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
1631  // Allways true because Clus.size() = unsigned
1632  // if (Clus.size() >= 0)
1633  mo->Fill(Clus.size());
1634  }
1635 
1636  for(uint32_t u = 0; u < Clus.size(); u++){
1637 
1638  Clus_Sum_Charge = 0.0;
1639 
1640  for(uint32_t k = 0;k < Clus[u].ClusterPulseMapHeight.size(); k++) {
1641 
1644  for(int n = Clus[u].LFTBNDTime; n < Clus[u].IRTBNDTime; n++) {
1645  Clus_Sum_Charge = Clus_Sum_Charge + Clus[u].ClusterPulseMapHeight[k].height_[n];
1646  }
1647 
1648  }
1649 
1651  if (getCSCHisto(h::CSC_CFEB_CLUSTERS_CHARGE_LY_XX, crateID, dmbID, nLayer, mo)) {
1652  mo->Fill(Clus_Sum_Charge);
1653  }
1654 
1656  if (getCSCHisto(h::CSC_CFEB_WIDTH_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
1657  mo->Fill(Clus[u].IRTBNDStrip - Clus[u].LFTBNDStrip + 1);
1658  }
1659 
1661  if (getCSCHisto(h::CSC_CFEB_CLUSTER_DURATION_LY_XX, crateID, dmbID, nLayer, mo)) {
1662  mo->Fill(Clus[u].IRTBNDTime - Clus[u].LFTBNDTime + 1);
1663  }
1664 
1665  }
1666 
1667  Clus.clear();
1668 
1670  }
1671 
1675  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_UNPACKED_VS_DAV, crateID, dmbID, mo)) {
1676  float feb_combination_unpacked = -1.0;
1677  if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 0.0;
1678  if(alct_unpacked > 0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 1.0;
1679  if(alct_unpacked == 0 && tmb_unpacked > 0 && cfeb_unpacked == 0) feb_combination_unpacked = 2.0;
1680  if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked > 0) feb_combination_unpacked = 3.0;
1681  if(alct_unpacked > 0 && tmb_unpacked > 0 && cfeb_unpacked == 0) feb_combination_unpacked = 4.0;
1682  if(alct_unpacked > 0 && tmb_unpacked == 0 && cfeb_unpacked > 0) feb_combination_unpacked = 5.0;
1683  if(alct_unpacked == 0 && tmb_unpacked > 0 && cfeb_unpacked > 0) feb_combination_unpacked = 6.0;
1684  if(alct_unpacked > 0 && tmb_unpacked > 0 && cfeb_unpacked > 0) feb_combination_unpacked = 7.0;
1685  mo->Fill(feb_combination_dav, feb_combination_unpacked);
1686  }
1687 
1688  if((clct_kewdistrip > -1 && alct_keywg > -1) && (getCSCHisto(h::CSC_CLCT0_KEYDISTRIP_VS_ALCT0_KEYWIREGROUP, crateID, dmbID, mo))) {
1689  mo->Fill(alct_keywg, clct_kewdistrip);
1690  }
1691 
1692  if (L1A_out_of_sync && cscType && cscPosition && getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, mo)){
1693  mo->Fill(cscPosition, cscType);
1694  }
1695 
1696  if (L1A_out_of_sync && getEMUHisto(h::EMU_DMB_L1A_OUT_OF_SYNC, mo)){
1697  mo->Fill(crateID, dmbID);
1698  }
1699 
1700  }
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:36
CSCTMBTrailer * tmbTrailer()
Definition: CSCTMBData.h:49
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.
int i
Definition: DBlmapReader.cc:9
int wordCount() const
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:87
unsigned l1a() const
Definition: CSCDMBHeader.cc:74
const unsigned long getNEvents() const
unsigned alct_endtimeout
Definition: CSCDMBTrailer.h:47
unsigned nclct() const
Definition: CSCDMBHeader.cc:46
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
unsigned cfeb_half
Definition: CSCDMBTrailer.h:32
unsigned short adcOverflow
unsigned tmb_endtimeout
Definition: CSCDMBTrailer.h:46
unsigned cfebActive() const
Definition: CSCDMBHeader.h:31
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:112
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:42
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:59
unsigned tmb_timeout
Definition: CSCDMBTrailer.h:38
unsigned get_l1pipe_full() const
unsigned alct_full
Definition: CSCDMBTrailer.h:55
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:55
unsigned cfeb_full
Definition: CSCDMBTrailer.h:53
ExaminerStatusType errorsForChamber(CSCIdType chamber) const
unsigned nalct() const
Definition: CSCDMBHeader.cc:41
#define abs(x)
Definition: mlp_lapack.h:159
#define NULL
Definition: scimark2.h:8
const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
unsigned cfebMovlp() const
Definition: CSCDMBHeader.cc:18
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...
CSCAnodeData * alctData() const
user must check if nalct &gt; 0
CSCALCTHeader * alctHeader() const
user must check if nalct &gt; 0
bool check() const
makes sure each time slice has a trailer
Definition: CSCCFEBData.cc:290
CSCCFEBSCAControllerWord scaControllerWord(int layer) const
unpacked from the controller words for each channel in the layer
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:84
int wordCount() const
const bool getCSCHisto(const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
Get CSC (Chamber) Level Monitoring Object.
unsigned get_buffer_count() const
unsigned cfeb_empty
Definition: CSCDMBTrailer.h:52
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int endcap() const
Definition: CSCDetId.h:95
U second(std::pair< T, U > const &p)
CSCCLCTData * clctData() const
user must check if nclct &gt; 0
CSCALCTTrailer * alctTrailer() const
user must check if nalct &gt; 0
unsigned get_lctpipe_empty() const
unsigned alct_timeout
Definition: CSCDMBTrailer.h:39
unsigned cfeb_starttimeout
Definition: CSCDMBTrailer.h:45
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:45
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
int j
Definition: DBlmapReader.cc:9
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:52
unsigned alct_empty
Definition: CSCDMBTrailer.h:41
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:32
void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
Set Chamber counter value.
const Detector getDetector() const
unsigned tmb_half
Definition: CSCDMBTrailer.h:33
bool first
Definition: L1TdeRCT.cc:94
unsigned bxn12() const
Definition: CSCDMBHeader.cc:66
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:39
std::vector< CSCComparatorDigi > comparatorDigis(int layer)
layers count from one
Definition: CSCCLCTData.cc:167
unsigned get_n_free_sca_blocks() const
int k[5][pyjets_maxn]
unsigned get_l1pipe_empty() const
std::vector< CSCALCTDigi > ALCTDigis() const
int ring() const
Definition: CSCDetId.h:77
unsigned crateID() const
Definition: CSCDMBHeader.cc:51
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:80
unsigned short int alctFirmwareVersion() const
Definition: CSCALCTHeader.h:86
unsigned dmb_l1pipe
Definition: CSCDMBTrailer.h:42
unsigned short int L1Acc() const
Definition: CSCALCTHeader.h:68
std::vector< CSCWireDigi > wireDigis(int layer) const
input layer is from 1 to 6
Definition: CSCAnodeData.h:24
unsigned cfeb_endtimeout
Definition: CSCDMBTrailer.h:48
double b
Definition: hdecay.h:120
bool check() const
Definition: CSCCLCTData.cc:212
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
CSCCFEBTimeSlice const *const timeSlice(T const &data, int nCFEB, int nSample)
void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId)
Copy Chamber counter value from one counter to another.
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
unsigned tmb_full
Definition: CSCDMBTrailer.h:54
unsigned dmbID() const
Definition: CSCDMBHeader.cc:56
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:38
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:48
CSCCFEBDataWord const *const timeSample(T const &data, int nCFEB, int nSample, int nLayer, int nStrip)
double a
Definition: hdecay.h:121
CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
bool fCloseL1As
Total Number of TMBs per event from DMB DAV.
int station() const
Definition: CSCDetId.h:88
unsigned int GlobalChamberIndex(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Return global chamber index on his geometric location.
unsigned alct_half
Definition: CSCDMBTrailer.h:34
unsigned tmb_empty
Definition: CSCDMBTrailer.h:40
unsigned short adcCounts
struct ADC ADC
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:55
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:90
unsigned dmbCfebSync() const
Definition: CSCDMBHeader.cc:24
unsigned get_lctpipe_count() const
bool cfebAvailable(unsigned icfeb)
counts from zero
#define LOG_ERROR
Definition: CSCDQM_Logger.h:41
unsigned get_lctpipe_full() const
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().

27  {
28 
29  CSCDDUHeader dduHeader = dduData.header();
30  CSCDDUTrailer dduTrailer = dduData.trailer();
31  if (!dduTrailer.check()) {
33  return;
34  }
35 
37  int dduID = dduHeader.source_id() & 0xFF;
38 
39  MonitorObject* mo = 0;
40 
41  if (getEMUHisto(h::EMU_ALL_DDUS_IN_READOUT, mo)) {
42  mo->Fill(dduID);
43  }
44 
45  std::string dduTag = DDUHistoDef::getPath(dduID);
46 
47  uint32_t dduEvtSize = dduData.sizeInWords()*2;
48 
49  // if (dduEvtSize > 48)
50  {
51 
53  int trl_word_count = 0;
54  trl_word_count = dduTrailer.wordcount();
55 
56  if (getDDUHisto(h::DDU_BUFFER_SIZE, dduID, mo)) mo->Fill(dduEvtSize);
57 
58  if (getDDUHisto(h::DDU_WORD_COUNT, dduID, mo)) mo->Fill(trl_word_count );
59 
62  if (trl_word_count > 0) {
63  if (getEMUHisto(h::EMU_ALL_DDUS_EVENT_SIZE, mo)) {
64  mo->Fill(dduID, log10((double)trl_word_count));
65  }
66  }
67 
68  if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_EVENT_SIZE, mo)) {
69  mo->Fill(dduID, trl_word_count);
70  }
71 
72  }
73 
74  fCloseL1As = dduTrailer.reserved() & 0x1; // Get status if Close L1As bit
78  BXN = dduHeader.bxnum();
80  if (getEMUHisto(h::EMU_DDU_BXN, mo)) mo->Fill(BXN);
81  if (getDDUHisto(h::DDU_BXN, dduID, mo)) mo->Fill(BXN);
82 
84  int L1ANumber_previous_event = L1ANumbers[dduID];
85  L1ANumbers[dduID] = (int)(dduHeader.lvl1num());
86  L1ANumber = L1ANumbers[dduID];
88  int L1A_inc = L1ANumber - L1ANumber_previous_event;
89 
91  if ( L1A_inc < 0 ) L1A_inc = 0xFFFFFF + L1A_inc;
92 
93  // if (!fFirstEvent) {
94  if (fNotFirstEvent[dduID]) {
95  if (getDDUHisto(h::DDU_L1A_INCREMENT, dduID, mo)) mo->Fill(L1A_inc);
96  if (getEMUHisto(h::EMU_ALL_DDUS_L1A_INCREMENT, mo)) {
97  if (L1A_inc > 100000){ L1A_inc = 19;}
98  else if (L1A_inc > 30000) { L1A_inc = 18;}
99  else if (L1A_inc > 10000) { L1A_inc = 17;}
100  else if (L1A_inc > 3000) { L1A_inc = 16;}
101  else if (L1A_inc > 1000) { L1A_inc = 15;}
102  else if (L1A_inc > 300) { L1A_inc = 14;}
103  else if (L1A_inc > 100) { L1A_inc = 13;}
104  else if (L1A_inc > 30) { L1A_inc = 12;}
105  else if (L1A_inc > 10) { L1A_inc = 11;}
106  mo->Fill(dduID, L1A_inc);
107  }
108  }
109 
111  int dmb_dav_header = 0;
112  int dmb_dav_header_cnt = 0;
113 
114  int ddu_connected_inputs= 0;
115  int ddu_connected_inputs_cnt = 0;
116 
117  int csc_error_state = 0;
118  int csc_warning_state = 0;
119 
121  int dmb_active_header = 0;
122 
123  dmb_dav_header = dduHeader.dmb_dav();
124  dmb_active_header = (int)(dduHeader.ncsc() & 0xF);
125  csc_error_state = dduTrailer.dmb_full() & 0x7FFF; // Only 15 inputs for DDU
126  csc_warning_state = dduTrailer.dmb_warn() & 0x7FFF; // Only 15 inputs for DDU
127  ddu_connected_inputs = dduHeader.live_cscs();
128 
132  double freq = 0;
133  for (int i = 0; i < 15; ++i) {
134  if ((dmb_dav_header >> i) & 0x1) {
135  dmb_dav_header_cnt++;
136  if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY_RATE, dduID, mo)) {
137  mo->Fill(i + 1);
138  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
139  if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo))
140  mo->SetBinContent(i+1,freq);
141  }
142  if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WITH_DATA, mo)) {
143  mo->Fill(dduID, i);
144  }
145  }
146 
147  if( (ddu_connected_inputs >> i) & 0x1 ){
148  ddu_connected_inputs_cnt++;
149  if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS_RATE, dduID, mo)) {
150  mo->Fill(i + 1);
151  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
152  if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo))
153  mo->SetBinContent(i + 1, freq);
154  }
155  if (getEMUHisto(h::EMU_ALL_DDUS_LIVE_INPUTS, mo)) {
156  mo->Fill(dduID, i);
157  }
158  }
159 
160  if( (csc_error_state >> i) & 0x1 ){
161  if (getDDUHisto(h::DDU_CSC_ERRORS_RATE, dduID, mo)) {
162  mo->Fill(i + 1);
163  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
164  if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo))
165  mo->SetBinContent(i + 1, freq);
166  }
167  if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_ERRORS, mo)) {
168  mo->Fill(dduID, i + 2);
169  }
170  }
171 
172  if((csc_warning_state >> i) & 0x1 ){
173  if (getDDUHisto(h::DDU_CSC_WARNINGS_RATE, dduID, mo)) {
174  mo->Fill(i + 1);
175  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
176  if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetBinContent(i + 1, freq);
177  }
178  if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WARNINGS, mo)) {
179  mo->Fill(dduID, i + 2);
180  }
181  }
182  }
183 
184  if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_LIVE_INPUTS, mo)) {
185  mo->Fill(dduID, ddu_connected_inputs_cnt);
186  }
187 
188  // if (dduEvtSize > 48)
189  {
190  if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_INPUTS_WITH_DATA, mo)) {
191  mo->Fill(dduID, dmb_dav_header_cnt);
192  }
193  }
194 
195  if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_ERRORS, mo)) {
196  if (csc_error_state > 0) {
197  mo->Fill(dduID, 1); // Any Input
198  } else {
199  mo->Fill(dduID, 0); // No errors
200  }
201  }
202 
203  if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WARNINGS, mo)) {
204  if (csc_warning_state > 0) {
205  mo->Fill(dduID, 1); // Any Input
206  } else {
207  mo->Fill(dduID, 0); // No errors
208  }
209  }
210 
211  if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo)) mo->SetEntries(config->getNEvents());
212  if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo)) mo->SetEntries(config->getNEvents());
213  if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo)) mo->SetEntries(config->getNEvents());
214  if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetEntries(config->getNEvents());
215  if (getDDUHisto(h::DDU_DMB_ACTIVE_HEADER_COUNT, dduID, mo)) mo->Fill(dmb_active_header);
216  if (getDDUHisto(h::DDU_DMB_DAV_HEADER_COUNT_VS_DMB_ACTIVE_HEADER_COUNT, dduID, mo))
217  mo->Fill(dmb_active_header, dmb_dav_header_cnt);
218 
220  uint32_t trl_errorstat = dduTrailer.errorstat();
221  if (dmb_dav_header_cnt == 0) trl_errorstat &= ~0x20000000; // Ignore No Good DMB CRC bit of no DMB is present
223  for (int i = 0; i < 32; i++) {
224  if ((trl_errorstat >> i) & 0x1) {
225  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_RATE, dduID, mo)) {
226  mo->Fill(i);
227  double freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
228  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo))
229  mo->SetBinContent(i+1, freq);
230  }
231  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo))
232  mo->Fill(0.,i);
233  }
234  }
235  if (getEMUHisto(h::EMU_ALL_DDUS_TRAILER_ERRORS, mo)) {
236  if (trl_errorstat) {
237  mo->Fill(dduID, 1); // Any Error
238  for (int i = 0; i < 32; i++) {
239  if ((trl_errorstat >> i) & 0x1) {
240  mo->Fill(dduID, i + 2);
241  }
242  }
243  } else {
244  mo->Fill(dduID, 0); // No Errors
245  }
246  }
247 
248  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo)) mo->SetEntries(config->getNEvents());
249  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo)) mo->SetEntries(config->getNEvents());
250 
251 
252  uint32_t nCSCs = 0;
253 
255  if (config->getPROCESS_CSC()) {
256 
257  std::vector<CSCEventData> chamberDatas;
258  chamberDatas.clear();
259  chamberDatas = dduData.cscData();
260 
261  nCSCs = chamberDatas.size();
262 
263  for(uint32_t i = 0; i < nCSCs; i++) {
264  processCSC(chamberDatas[i], dduID, binChecker);
265  }
266 
267  }
268 
269  if (getDDUHisto(h::DDU_DMB_UNPACKED_VS_DAV, dduID, mo)) mo->Fill(dmb_active_header, nCSCs);
270 
271  // fFirstEvent = false;
272 
274  fNotFirstEvent[dduID] = true;
275 
276  }
int i
Definition: DBlmapReader.cc:9
CSCDDUHeader header() const
const unsigned long getNEvents() const
int lvl1num() const
Definition: CSCDDUHeader.h:23
const bool getDDUHisto(const HistoId &histo, const HwId &dduID, MonitorObject *&me)
Get DDU Level Monitoring Object.
unsigned errorstat() const
Definition: CSCDDUTrailer.h:41
void processCSC(const CSCEventData &data, const int dduID, const CSCDCCExaminer &binChecker)
Process Chamber Data and fill MOs.
unsigned dmb_warn() const
Definition: CSCDDUTrailer.h:46
std::map< uint32_t, uint32_t > L1ANumbers
int bxnum() const
Definition: CSCDDUHeader.h:22
int dmb_dav() const
Definition: CSCDDUHeader.h:26
unsigned reserved() const
Definition: CSCDDUTrailer.h:48
bool check() const
Definition: CSCDDUTrailer.h:30
const std::vector< CSCEventData > & cscData() const
accessor to data
const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
unsigned dmb_full() const
Definition: CSCDDUTrailer.h:47
CSCDDUTrailer trailer() const
bool fCloseL1As
Total Number of TMBs per event from DMB DAV.
unsigned wordcount() const
Definition: CSCDDUTrailer.h:42
int ncsc() const
Definition: CSCDDUHeader.h:25
int source_id() const
Definition: CSCDDUHeader.h:21
int live_cscs() const
Definition: CSCDDUHeader.h:29
std::map< uint32_t, bool > fNotFirstEvent
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
int sizeInWords() const
bool cscdqm::EventProcessor::processExaminer ( const CSCDCCExaminer binChecker)
private
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().

27  {
28 
29  bool eventAccepted = true;
30  MonitorObject* mo = 0;
31 
32  uint32_t binErrorStatus = digi.getDDUSummaryErrors();
33 
34  if (getEMUHisto(h::EMU_ALL_DDUS_FORMAT_ERRORS, mo)) {
35 
36  const std::set<DDUIdType> DDUs = digi.getListOfDDUs();
37  for (std::set<DDUIdType>::const_iterator ddu_itr = DDUs.begin(); ddu_itr != DDUs.end(); ++ddu_itr) {
38  ExaminerStatusType errs = digi.getDDUErrors(*ddu_itr);
39  int dduID = (*ddu_itr)&0xFF;
40  if (errs != 0) {
41  for(int i = 0; i < 29; i++) {
42  if ((errs >> i) & 0x1 ) {
43  mo->Fill(dduID, i + 1);
44  }
45  }
46  } else {
47  mo->Fill(dduID, 0);
48  }
49  }
50 
51  }
52 
53  // =VB= We want to use DCC level check mask as in CSCDCCUnpacker and not DDU mask
54  // Otherwise whole DCC event could be skipped because of a single chamber error
55  unsigned long dccBinCheckMask = 0x06080016;
56 // if ((binErrorStatus & config->getDDU_BINCHECK_MASK()) > 0) {
57  if ((binErrorStatus & dccBinCheckMask) > 0) {
58  eventAccepted = false;
59  }
60 
61  if (binErrorStatus != 0) {
63  }
64 
67  {
68  uint32_t i = 0;
69  CSCIdType chamberID = 0;
70  while (digi.nextCSCWithPayload(i, chamberID)) {
71 
72  int crateID = (chamberID >> 4) & 0xFF;
73  int dmbSlot = chamberID & 0xF;
74 
75  if (crateID == 255) { continue; }
76 
77  // Check if in standby!
78  {
79  CSCDetId cid;
80  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
81  continue;
82  }
83  }
84 
86  config->incChamberCounter(DMB_EVENTS, crateID, dmbSlot);
87  long DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot);
89  cntDMBs++;
90 
91  if (getEMUHisto(h::EMU_DMB_REPORTING, mo)) {
92  mo->Fill(crateID, dmbSlot);
93  }
94 
95  unsigned int cscType = 0;
96  unsigned int cscPosition = 0;
97  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
98 
99  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_REPORTING, mo)) {
100  mo->Fill(cscPosition, cscType);
101  }
102 
104  long payload = digi.getCSCPayload(chamberID);
105  int cfeb_dav = (payload >> 7) & 0x1F;
106  int cfeb_active = payload & 0x1F;
107  int alct_dav = (payload >> 5) & 0x1;
108  int tmb_dav = (payload >> 6) & 0x1;
109  int cfeb_dav_num = 0;
110 
111  if (alct_dav == 0) {
112  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_ALCT, mo)) {
113  mo->Fill(cscPosition, cscType);
114  }
115  if (getEMUHisto(h::EMU_DMB_WO_ALCT, mo)) {
116  mo->Fill(crateID, dmbSlot);
117  }
118  }
119 
120  if (tmb_dav == 0) {
121  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CLCT, mo)) {
122  mo->Fill(cscPosition, cscType);
123  }
124  if (getEMUHisto(h::EMU_DMB_WO_CLCT, mo)) {
125  mo->Fill(crateID, dmbSlot);
126  }
127  }
128 
129  if (cfeb_dav == 0) {
130  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CFEB, mo)) {
131  mo->Fill(cscPosition, cscType);
132  }
133  if (getEMUHisto(h::EMU_DMB_WO_CFEB, mo)) {
134  mo->Fill(crateID, dmbSlot);
135  }
136  }
137 
139  for (int i=0; i<5;i++) {
140  if ((cfeb_dav>>i) & 0x1) cntCFEBs++;
141  }
142 
143  if (alct_dav > 0) {
144  cntALCTs++;
145  }
146 
147  if (tmb_dav > 0) {
148  cntTMBs++;
149  }
150 
151 
152  MonitorObject *mof = 0, *mo1 = 0, *mo2 = 0;
153  if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, crateID, dmbSlot, mo)
154  && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, crateID, dmbSlot, mof)) {
155  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
156  && getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbSlot, mo2)) {
157  for (int i=1; i<=5; i++) {
158  double actual_dav_num = mo->GetBinContent(i);
159  double unpacked_dav_num = mo2->GetBinContent(i);
160  if (actual_dav_num){
161  mo1->SetBinContent(i,1, 100.*(1-unpacked_dav_num/actual_dav_num));
162  }
163  mo1->SetEntries((int)DMBEvents);
164  }
165  }
166  for (int i=0; i<5;i++) {
167  int cfeb_present = (cfeb_dav>>i) & 0x1;
168  cfeb_dav_num += cfeb_present;
169  if (cfeb_present) {
170  mo->Fill(i);
171  }
172  float cfeb_entries = mo->GetBinContent(i+1);
173  mof->SetBinContent(i+1, ((float)cfeb_entries/(float)(DMBEvents)*100.0));
174  }
175  mof->SetEntries((int)DMBEvents);
176  }
177 
178  if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_RATE, crateID, dmbSlot, mo)
179  && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_FREQUENCY, crateID, dmbSlot, mof)) {
180  for (unsigned short i = 1; i < 7; i++) {
181  float cfeb_entries = mo->GetBinContent(i);
182  mof->SetBinContent(i, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
183  }
184  mof->SetEntries((int)DMBEvents);
185 
186  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
187  && getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbSlot, mo2)) {
188  for (unsigned short i = 1; i < 7; i++) {
189  float actual_dav_num = mo->GetBinContent(i);
190  float unpacked_dav_num = mo2->GetBinContent(i);
191  if (actual_dav_num){
192  mo1->SetBinContent(i, 1, 100. * (1-unpacked_dav_num/actual_dav_num));
193  }
194  mo1->SetEntries((int)DMBEvents);
195  }
196  }
197  mo->Fill(cfeb_dav_num);
198  }
199 
200  if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbSlot, mo)) mo->Fill(cfeb_dav, cfeb_active);
201 
203  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo)) {
204  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
205  for (int i = 1; i < 4; i++) {
206  float dav_num = mo->GetBinContent(i);
207  mo1->SetBinContent(i, ((float)dav_num / (float)(DMBEvents) * 100.0));
208  }
209  mo1->SetEntries((int)DMBEvents);
210 
211  if (getCSCHisto(h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
212  && getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo2)) {
213  for (int i = 1; i < 4; i++) {
214  float actual_dav_num = mo->GetBinContent(i);
215  float unpacked_dav_num = mo2->GetBinContent(i);
216  if (actual_dav_num){
217  mof->SetBinContent(i,1, 100. * (1 - unpacked_dav_num / actual_dav_num));
218  }
219  mof->SetEntries((int)DMBEvents);
220  mof->SetMaximum(100.0);
221  }
222  }
223  }
224 
225  if (alct_dav > 0) {
226  mo->Fill(0.0);
227  }
228  if (tmb_dav > 0) {
229  mo->Fill(1.0);
230  }
231  if (cfeb_dav > 0) {
232  mo->Fill(2.0);
233  }
234  }
235 
236 
237  float feb_combination_dav = -1.0;
239  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo)) {
240  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 0.0; // Nothing
241  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 1.0; // ALCT Only
242  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav == 0) feb_combination_dav = 2.0; // TMB Only
243  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav > 0) feb_combination_dav = 3.0; // CFEB Only
244  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav > 0) feb_combination_dav = 4.0; // TMB+CFEB
245  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav == 0) feb_combination_dav = 5.0; // ALCT+TMB
246  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav > 0) feb_combination_dav = 6.0; // ALCT+CFEB
247  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav > 0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
248  // mo->Fill(feb_combination_dav);
249 
250  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
251  for (int i = 1; i < 9; i++) {
252  float feb_combination_dav_number = mo->GetBinContent(i);
253  mo1->SetBinContent(i, ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
254  }
255  mo1->SetEntries(DMBEvents);
256 
257  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
258  && getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo2)) {
259  for (int i = 1; i < 9; i++) {
260  float actual_dav_num = mo->GetBinContent(i);
261  float unpacked_dav_num = mo2->GetBinContent(i);
262  if (actual_dav_num){
263  mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
264  }
265  mof->SetEntries((int)DMBEvents);
266  mof->SetMaximum(100.0);
267  }
268  }
269 
270  }
271  mo->Fill(feb_combination_dav);
272  }
273 
274  }
275  }
276 
279  {
280  uint32_t i = 0;
281  CSCIdType chamberID = 0;
282  while (digi.nextCSCWithStatus(i, chamberID)) {
283 
284  unsigned int crateID = (chamberID >> 4) & 0xFF;
285  unsigned int dmbSlot = chamberID & 0xF;
286  ExaminerStatusType chStatus = digi.getCSCStatus(chamberID);
287 
288  if (crateID == 255) { continue; }
289 
290  // Check if in standby!
291  {
292  CSCDetId cid;
293  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
294  continue;
295  }
296  }
297 
298  unsigned int cscType = 0;
299  unsigned int cscPosition = 0;
300  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
301 
302  if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateID, dmbSlot, mo)) {
303  for (int bit = 0; bit < binChecker.nSTATUSES; bit++) {
304  if (chStatus & (1<<bit) ) {
305  mo->Fill(0., bit);
306  }
307  }
308  mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot));
309  }
310 
311 
312  int anyInputFull = chStatus & 0x3F;
313  if (anyInputFull) {
314  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, mo)) {
315  mo->Fill(cscPosition, cscType);
316  }
317  if (getEMUHisto(h::EMU_DMB_INPUT_FIFO_FULL, mo)) {
318  mo->Fill(crateID, dmbSlot);
319  }
320  }
321 
322  int anyInputTO = (chStatus >> 7) & 0x3FFF;
323  if (anyInputTO) {
324  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, mo)) {
325  mo->Fill(cscPosition, cscType);
326  }
327  if (getEMUHisto(h::EMU_DMB_INPUT_TIMEOUT, mo)) {
328  mo->Fill(crateID, dmbSlot);
329  }
330  }
331 
332  if (digi.getCSCStatus(chamberID) & (1 << 22)) {
333  if (getEMUHisto(h::EMU_DMB_FORMAT_WARNINGS, mo)) {
334  mo->Fill(crateID, dmbSlot);
335  }
336 
337  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, mo)) {
338  mo->Fill(cscPosition, cscType);
339  }
340 
341  }
342  }
343 
344  }
345 
348  {
349  uint32_t i = 0;
350  CSCIdType chamberID = 0;
351  while (digi.nextCSCWithError(i, chamberID)) {
352 
353  const unsigned int crateID = (chamberID >> 4) & 0xFF;
354  const unsigned int dmbSlot = chamberID & 0xF;
355  const ExaminerStatusType chErr = digi.getCSCErrors(chamberID);
356 
357  if ((crateID ==255) || (chErr & 0x80)) { continue; } // = Skip chamber detection if DMB header is missing (Error code 6)
358 
359  if (crateID > 60 || dmbSlot > 10) { continue; }
360 
361  // Check if in standby!
362  {
363  CSCDetId cid;
364  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
365  continue;
366  }
367  }
368 
369  if ((chErr & config->getBINCHECK_MASK()) != 0) {
370  config->incChamberCounter(BAD_EVENTS, crateID , dmbSlot);
371  }
372 
373  bool isCSCError = false;
374  bool fillBC = getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateID, dmbSlot, mo);
375 
376  for (int bit = 5; bit < 24; bit++) {
377 
378  if (chErr & (1 << bit) ) {
379  isCSCError = true;
380  if (fillBC) {
381  mo->Fill(0., bit - 5);
382  } else {
383  break;
384  }
385  }
386 
387  if (fillBC) {
388  mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID , dmbSlot));
389  }
390 
391  }
392 
393  if (isCSCError) {
394 
395  if (getEMUHisto(h::EMU_DMB_FORMAT_ERRORS, mo)) {
396  mo->Fill(crateID, dmbSlot);
397  }
398 
399  if (eventAccepted && getEMUHisto(h::EMU_DMB_UNPACKED_WITH_ERRORS, mo)) {
400  mo->Fill(crateID, dmbSlot);
401  }
402 
403  unsigned int cscType = 0;
404  unsigned int cscPosition = 0;
405  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
406 
407  if ( cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, mo)) {
408  mo->Fill(cscPosition, cscType);
409  }
410 
411  if (eventAccepted && cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED_WITH_ERRORS, mo)) {
412  mo->Fill(cscPosition, cscType);
413  }
414  }
415 
416  }
417  }
418 
419  return eventAccepted;
420 
421  }
const uint16_t nSTATUSES
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.
int i
Definition: DBlmapReader.cc:9
uint32_t cntCFEBs
Total Number of DMBs per event from DDU Header DAV.
void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId)
Increment Chamber counter by 1.
int32_t CSCIdType
ExaminerStatusType getDDUSummaryErrors() const
std::set< DDUIdType > getListOfDDUs() const
ExaminerStatusType getCSCStatus(const CSCIdType CSCId) const
bool nextCSCWithStatus(uint32_t &iterator, CSCIdType &CSCId) const
CSC with status iteration procedure.
ExaminerStatusType getCSCErrors(const CSCIdType CSCId) const
ExaminerStatusType getDDUErrors(const DDUIdType DDUId) const
bool nextCSCWithError(uint32_t &iterator, CSCIdType &CSCId) const
CSC with error iteration procedure. Usage: unsigned int i = 0; CSCIdType cscId; while (c...
const bool getCSCHisto(const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
Get CSC (Chamber) Level Monitoring Object.
uint32_t cntTMBs
Total Number of ALCTs per event from DMB DAV.
uint32_t cntALCTs
Total Number of CFEBs per event from DMB DAV.
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:32
ExaminerStatusType getCSCPayload(const CSCIdType CSCId) const
uint32_t ExaminerStatusType
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId)
Copy Chamber counter value from one counter to another.
bool nextCSCWithPayload(uint32_t &iterator, CSCIdType &CSCId) const
CSC with payload iteration procedure.
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
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().

56  {
58 
59  // Reseting EMU level Event displays
60  MonitorObject* mo = 0;
61  if (getEMUHisto(h::EMU_EVENT_DISPLAY_ANODE, mo)) {
62  mo->getTH1Lock()->Reset("");
63  }
64 
65  if (getEMUHisto(h::EMU_EVENT_DISPLAY_CATHODE, mo)) {
66  mo->getTH1Lock()->Reset("");
67  }
68 
69  if (getEMUHisto(h::EMU_EVENT_DISPLAY_XY, mo)) {
70  mo->getTH1Lock()->Reset("");
71  }
72 
74 
75  }
76  }
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
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().

43  {
44  if (mo && x) {
46  int bitset = (int) mo->GetBinContent(x, y);
47  bitset |= 1 << bit;
48  mo->SetBinContent(x, y, bitset);
49  }
50  }
void resetEmuEventDisplays()
Reset Emu level EventDisplay histograms once per event.
x
Definition: VDTMath.h:216
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::AddressMask::side, cscdqm::Address::side, cscdqm::STANDBY, cscdqm::AddressMask::station, summary, tmp, cscdqm::WAS_ON, and cscdqm::Summary::WriteChamberState().

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

366  {
367 
368  Address adr;
369  adr.mask.side = true;
370  adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
371 
372  adr.side = 1;
373  summary.SetValue(adr, STANDBY, (standby.MeP ? 1 : 0));
374  if (!standby.MeP) {
375  summary.SetValue(adr, WAS_ON);
376  }
377 
378  adr.side = 2;
379  summary.SetValue(adr, STANDBY, (standby.MeM ? 1 : 0));
380  if (!standby.MeM) {
381  summary.SetValue(adr, WAS_ON);
382  }
383 
384  MonitorObject *me = 0;
385  if (getEMUHisto(h::EMU_CSC_STANDBY, me)){
386  LockType lock(me->mutex);
387  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
388 
389  // All standby
390  summary.WriteChamberState(tmp, 0x1000, 5);
391 
392  // Temporary in standby (was ON)
393  summary.WriteChamberState(tmp, 0x3000, 1, false);
394 
395  }
396 
397  }
HW element in standby mode.
Data with CFEB BWORDS.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void WriteChamberState(TH2 *&h2, const int mask, const int value=1, const bool reset=true, const bool op_any=false) const
Write State information to chamber histogram.
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
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::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, cscdqm::Address::station, summary, tmp, cscdqm::Summary::Write(), cscdqm::Summary::WriteMap(), and writeShifterHistograms().

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

26  {
27 
28  MonitorObject *me = 0, *me1 = 0;
29 
30  if (config->getNEvents() > 0) {
31 
32  if (getEMUHisto(h::EMU_CSC_REPORTING, me)) {
33 
34  const TH2* rep = dynamic_cast<const TH2*>(me->getTH1());
35 
37  const TObject *tobj = me->getRefRootObject();
38 
42  if (tobj) {
43  const TH2* ref = dynamic_cast<const TH2*>(tobj);
44  summary.ReadReportingChambersRef(rep, ref, config->getEFF_COLD_THRESHOLD(), config->getEFF_COLD_SIGFAIL(), config->getEFF_HOT_THRESHOLD(), config->getEFF_HOT_SIGFAIL());
45  } else {
47  }
48 
49  if (getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, me1)) {
50  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
51  summary.ReadErrorChambers(rep, err, FORMAT_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
52  }
53 
54  if (getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, me1)) {
55  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
56  summary.ReadErrorChambers(rep, err, L1SYNC_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
57  }
58 
59  if (getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, me1)) {
60  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
61  summary.ReadErrorChambers(rep, err, FIFOFULL_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
62  }
63 
64  if (getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, me1)) {
65  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
66  summary.ReadErrorChambers(rep, err, INPUTTO_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
67  }
68 
69  if (getEMUHisto(h::EMU_CSC_WO_ALCT, me1)) {
70  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
71  summary.ReadErrorChambers(rep, err, NODATA_ALCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
72  }
73 
74  if (getEMUHisto(h::EMU_CSC_WO_CLCT, me1)) {
75  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
76  summary.ReadErrorChambers(rep, err, NODATA_CLCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
77  }
78 
79  if (getEMUHisto(h::EMU_CSC_WO_CFEB, me1)) {
80  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
81  summary.ReadErrorChambers(rep, err, NODATA_CFEB, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
82  }
83 
84  if (getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, me1)) {
85  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
86  summary.ReadErrorChambers(rep, err, CFEB_BWORDS, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
87  }
88 
89  }
90 
92 
97  if (getEMUHisto(h::EMU_PHYSICS_ME1, me)){
98  LockType lock(me->mutex);
99  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
100  summary.Write(tmp, 1);
101  }
102 
103  if (getEMUHisto(h::EMU_PHYSICS_ME2, me)){
104  LockType lock(me->mutex);
105  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
106  summary.Write(tmp, 2);
107  }
108 
109  if (getEMUHisto(h::EMU_PHYSICS_ME3, me)){
110  LockType lock(me->mutex);
111  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
112  summary.Write(tmp, 3);
113  }
114 
115  if (getEMUHisto(h::EMU_PHYSICS_ME4, me)){
116  LockType lock(me->mutex);
117  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
118  summary.Write(tmp, 4);
119  }
120 
121  if (getEMUHisto(h::EMU_PHYSICS_EMU, me)) {
122  LockType lock(me->mutex);
123  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
124  summary.WriteMap(tmp);
125  }
126 
127  }
128 
133  if (config->getPROCESS_EFF_PARAMETERS()) {
134 
135  { // Compute DQM information parameters
136 
137  Address adr;
138  adr.mask.side = adr.mask.station = adr.mask.ring = true;
139  adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
140 
141  double e_detector = 0.0, e_side = 0.0, e_station = 0.0, e_ring = 0.0;
142  uint32_t e_detector_ch = 0, e_side_ch = 0, e_station_ch = 0;
143 
144  const HistoId parameters [] = {
145  h::PAR_CSC_SIDEPLUS_STATION01_RING01,
146  h::PAR_CSC_SIDEPLUS_STATION01_RING02,
147  h::PAR_CSC_SIDEPLUS_STATION01_RING03,
148  h::PAR_CSC_SIDEPLUS_STATION01,
149  h::PAR_CSC_SIDEPLUS_STATION02_RING01,
150  h::PAR_CSC_SIDEPLUS_STATION02_RING02,
151  h::PAR_CSC_SIDEPLUS_STATION02,
152  h::PAR_CSC_SIDEPLUS_STATION03_RING01,
153  h::PAR_CSC_SIDEPLUS_STATION03_RING02,
154  h::PAR_CSC_SIDEPLUS_STATION03,
155  h::PAR_CSC_SIDEPLUS_STATION04_RING01,
156  h::PAR_CSC_SIDEPLUS_STATION04_RING02,
157  h::PAR_CSC_SIDEPLUS_STATION04,
158  h::PAR_CSC_SIDEPLUS,
159  h::PAR_CSC_SIDEMINUS_STATION01_RING01,
160  h::PAR_CSC_SIDEMINUS_STATION01_RING02,
161  h::PAR_CSC_SIDEMINUS_STATION01_RING03,
162  h::PAR_CSC_SIDEMINUS_STATION01,
163  h::PAR_CSC_SIDEMINUS_STATION02_RING01,
164  h::PAR_CSC_SIDEMINUS_STATION02_RING02,
165  h::PAR_CSC_SIDEMINUS_STATION02,
166  h::PAR_CSC_SIDEMINUS_STATION03_RING01,
167  h::PAR_CSC_SIDEMINUS_STATION03_RING02,
168  h::PAR_CSC_SIDEMINUS_STATION03,
169  h::PAR_CSC_SIDEMINUS_STATION04_RING01,
170  h::PAR_CSC_SIDEMINUS_STATION04_RING02,
171  h::PAR_CSC_SIDEMINUS_STATION04,
172  h::PAR_CSC_SIDEMINUS
173  };
174 
175  bool calc = (config->getNEvents() > 0);
176 
177  if (!calc) {
178  e_detector = e_side = e_station = e_ring = -1.0;
179  }
180 
181  unsigned int parameter = 0;
182  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
183 
184  if (calc) {
185  e_side = 0.0;
186  e_side_ch = 0;
187  }
188 
189  adr.mask.station = true;
190  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
191 
192  if (calc) {
193  e_station = 0.0;
194  e_station_ch = 0;
195  }
196 
197  adr.mask.ring = true;
198  for (adr.ring = 1; adr.ring <= summary.getDetector().NumberOfRings(adr.station); adr.ring++) {
199 
200  if (calc) {
201  e_ring = summary.GetEfficiencyHW(adr);
202  uint32_t ch = summary.getDetector().NumberOfChambers(adr.station, adr.ring);
203  e_station += (e_ring * ch);
204  e_station_ch += ch;
205  }
206 
207  if (summary.getDetector().NumberOfRings(adr.station) > 1) {
208  if (getParHisto(parameters[parameter++], me)) me->Fill(e_ring);
209  }
210 
211  }
212 
213  adr.mask.ring = false;
214  if (calc) {
215  e_side += e_station;
216  e_side_ch += e_station_ch;
217  e_station = e_station / e_station_ch;
218  }
219 
220  if (getParHisto(parameters[parameter++], me)) me->Fill(e_station);
221 
222  }
223 
224  adr.mask.station = false;
225  if (calc) {
226  e_detector += e_side;
227  e_detector_ch += e_side_ch;
228  e_side = e_side / e_side_ch;
229  }
230 
231  if (getParHisto(parameters[parameter++], me)) me->Fill(e_side);
232 
233  }
234 
235  if (calc) {
236  e_detector = e_detector / e_detector_ch;
237  }
238 
239  if (getParHisto(h::PAR_REPORT_SUMMARY, me)) me->Fill(e_detector);
240 
241  }
242 
243  }
244 
245  }
dictionary parameters
Definition: Parameters.py:2
void ReadReportingChambers(const TH2 *&h2, const double threshold=1.0)
Read Reporting Chamber histogram and fill in detector map.
rval mask
Definition: vlib.h:153
const unsigned long getNEvents() const
void Write(TH2 *&h2, const unsigned int station) const
Write detector map to H1 histogram (linear data) for the selected adr.station.
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
HW element is cold comparing with reference histogram.
Format errors.
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
unsigned int HistoId
void ReadReportingChambersRef(const TH2 *&h2, const TH2 *&refh2, const double cold_coef=0.1, const double cold_Sfail=5.0, const double hot_coef=2.0, const double hot_Sfail=5.0)
Read Reporting Chamber histogram and fill in detector map based on reference histogram.
const bool getParHisto(const HistoId &histo, MonitorObject *&me)
Get Parameter Monitoring Object.
void WriteMap(TH2 *&h2)
Write PhysicsReady Map to H2 histogram.
const Detector getDetector() const
#define N_STATIONS
No CFEB data.
DMB Input timeout error.
void ReadErrorChambers(const TH2 *&evs, const TH2 *&err, const HWStatusBit bit, const double eps_max=0.1, const double Sfail=5.0)
Read Error data for Chambers.
L1A out of sync errors.
#define N_SIDES
DMB FIFO full error.
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
No CLCT data.
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
No ALCT data.
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().

26  {
27 
28  calcEMUFractionHisto(h::EMU_DMB_FORMAT_ERRORS_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_FORMAT_ERRORS);
29  calcEMUFractionHisto(h::EMU_CSC_FORMAT_ERRORS_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_FORMAT_ERRORS);
30  calcEMUFractionHisto(h::EMU_DMB_FORMAT_WARNINGS_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_FORMAT_WARNINGS);
31  calcEMUFractionHisto(h::EMU_CSC_FORMAT_WARNINGS_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_FORMAT_WARNINGS);
32  calcEMUFractionHisto(h::EMU_DMB_UNPACKED_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_UNPACKED);
33  calcEMUFractionHisto(h::EMU_CSC_UNPACKED_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_UNPACKED);
34  calcEMUFractionHisto(h::EMU_DMB_WO_ALCT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_ALCT);
35  calcEMUFractionHisto(h::EMU_CSC_WO_ALCT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_ALCT);
36  calcEMUFractionHisto(h::EMU_DMB_WO_CLCT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_CLCT);
37  calcEMUFractionHisto(h::EMU_CSC_WO_CLCT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_CLCT);
38  calcEMUFractionHisto(h::EMU_DMB_WO_CFEB_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_CFEB);
39  calcEMUFractionHisto(h::EMU_CSC_WO_CFEB_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_CFEB);
40  calcEMUFractionHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_DMB_INPUT_FIFO_FULL);
41  calcEMUFractionHisto(h::EMU_DMB_INPUT_FIFO_FULL_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_INPUT_FIFO_FULL);
42  calcEMUFractionHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_DMB_INPUT_TIMEOUT);
43  calcEMUFractionHisto(h::EMU_DMB_INPUT_TIMEOUT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_INPUT_TIMEOUT);
44  calcEMUFractionHisto(h::EMU_CSC_L1A_OUT_OF_SYNC_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_L1A_OUT_OF_SYNC);
45  calcEMUFractionHisto(h::EMU_DMB_L1A_OUT_OF_SYNC_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_L1A_OUT_OF_SYNC);
46  calcEMUFractionHisto(h::EMU_FED_DDU_L1A_MISMATCH_FRACT, h::EMU_FED_ENTRIES, h::EMU_FED_DDU_L1A_MISMATCH);
47  calcEMUFractionHisto(h::EMU_FED_DDU_L1A_MISMATCH_WITH_CSC_DATA_FRACT, h::EMU_FED_ENTRIES, h::EMU_FED_DDU_L1A_MISMATCH_WITH_CSC_DATA);
48 
49  unsigned int iter = 0, crateId = 0, dmbId = 0;
50  MonitorObject *mo = 0, *mof = 0;
51  while (config->fnNextBookedCSC(iter, crateId, dmbId)) {
52 
53  uint32_t dmbEvents = config->getChamberCounterValue(DMB_EVENTS, crateId, dmbId);
54 
55  if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateId, dmbId, mo) &&
56  getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_FREQUENCY, crateId, dmbId, mof)) {
57 
58  LockType lock(mof->mutex);
59  TH1* th = mof->getTH1Lock();
60  th->Reset();
61  th->Add(mo->getTH1());
62  th->Scale(1. / dmbEvents);
63  mof->SetMaximum(1.);
64  mof->SetEntries(dmbEvents);
65  mo->SetEntries(dmbEvents);
66  }
67 
68  if (getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateId, dmbId, mo) &&
69  getCSCHisto(h::CSC_BINCHECK_ERRORS_FREQUENCY, crateId, dmbId, mof)) {
70  LockType lock(mof->mutex);
71  TH1* th = mof->getTH1Lock();
72  th->Reset();
73  th->Add(mo->getTH1());
74  th->Scale(1. / dmbEvents);
75  mof->SetMaximum(1.);
76  mof->SetEntries(dmbEvents);
77  mo->SetEntries(dmbEvents);
78  }
79 
80  }
81 
82  }
const bool getCSCHisto(const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
Get CSC (Chamber) Level Monitoring Object.
boost::function< bool(unsigned int &, unsigned int &, unsigned int &) > fnNextBookedCSC
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
void calcEMUFractionHisto(const HistoId &result, const HistoId &set, const HistoId &subset)
Calculate fractional histogram.
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().

247  {
248 
249  MonitorObject *me = 0;
250 
251  //const int COLOR_WHITE = 0;
252  const int COLOR_GREEN = 1;
253  const int COLOR_RED = 2;
254  const int COLOR_BLUE = 3;
255  const int COLOR_GREY = 4;
256  const int COLOR_STANDBY = 5;
257 
258  if (getEMUHisto(h::EMU_CSC_STATS_SUMMARY, me)) {
259  LockType lock(me->mutex);
260  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
261  if (!config->getIN_FULL_STANDBY()) {
262  summary.WriteChamberState(tmp, 0x1, COLOR_GREEN, true, false);
263  summary.WriteChamberState(tmp, HWSTATUSERRORBITS, COLOR_RED, false, true);
264  }
265  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
266  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false);
267  }
268 
269  if (getEMUHisto(h::EMU_CSC_STATS_OCCUPANCY, me)){
270  LockType lock(me->mutex);
271  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
272  if (!config->getIN_FULL_STANDBY()) {
273  summary.WriteChamberState(tmp, 0x4, COLOR_RED, true, false);
274  summary.WriteChamberState(tmp, 0x8, COLOR_BLUE, false, false);
275  }
276  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
277  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
278  }
279 
280  if (getEMUHisto(h::EMU_CSC_STATS_FORMAT_ERR, me)){
281  LockType lock(me->mutex);
282  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
283  if (!config->getIN_FULL_STANDBY()) {
284  summary.WriteChamberState(tmp, 0x10, COLOR_RED, true, false);
285  }
286  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
287  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
288  }
289 
290  if (getEMUHisto(h::EMU_CSC_STATS_L1SYNC_ERR, me)){
291  LockType lock(me->mutex);
292  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
293  if (!config->getIN_FULL_STANDBY()) {
294  summary.WriteChamberState(tmp, 0x20, COLOR_RED, true, false);
295  }
296  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
297  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
298  }
299 
300  if (getEMUHisto(h::EMU_CSC_STATS_FIFOFULL_ERR, me)){
301  LockType lock(me->mutex);
302  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
303  if (!config->getIN_FULL_STANDBY()) {
304  summary.WriteChamberState(tmp, 0x40, COLOR_RED, true, false);
305  }
306  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
307  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
308  }
309 
310  if (getEMUHisto(h::EMU_CSC_STATS_INPUTTO_ERR, me)){
311  LockType lock(me->mutex);
312  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
313  if (!config->getIN_FULL_STANDBY()) {
314  summary.WriteChamberState(tmp, 0x80, COLOR_RED, true, false);
315  }
316  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
317  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
318  }
319 
320  if (getEMUHisto(h::EMU_CSC_STATS_WO_ALCT, me)){
321  LockType lock(me->mutex);
322  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
323  if (!config->getIN_FULL_STANDBY()) {
324  summary.WriteChamberState(tmp, 0x100, COLOR_RED, true, false);
325  }
326  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
327  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
328  }
329 
330  if (getEMUHisto(h::EMU_CSC_STATS_WO_CLCT, me)){
331  LockType lock(me->mutex);
332  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
333  if (!config->getIN_FULL_STANDBY()) {
334  summary.WriteChamberState(tmp, 0x200, COLOR_RED, true, false);
335  }
336  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
337  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
338  }
339 
340  if (getEMUHisto(h::EMU_CSC_STATS_WO_CFEB, me)){
341  LockType lock(me->mutex);
342  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
343  if (!config->getIN_FULL_STANDBY()) {
344  summary.WriteChamberState(tmp, 0x400, COLOR_RED, true, false);
345  }
346  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
347  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
348  }
349 
350  if (getEMUHisto(h::EMU_CSC_STATS_CFEB_BWORDS, me)){
351  LockType lock(me->mutex);
352  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
353  if (!config->getIN_FULL_STANDBY()) {
354  summary.WriteChamberState(tmp, 0x800, COLOR_RED, true, false);
355  }
356  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
357  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
358  }
359 
360  }
#define HWSTATUSERRORBITS
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void WriteChamberState(TH2 *&h2, const int mask, const int value=1, const bool reset=true, const bool op_any=false) const
Write State information to chamber histogram.
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.

Member Data Documentation

uint32_t cscdqm::EventProcessor::BXN
private

Definition at line 165 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processDDU().

uint32_t cscdqm::EventProcessor::cntALCTs
private

Total Number of CFEBs per event from DMB DAV.

Definition at line 168 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

uint32_t cscdqm::EventProcessor::cntCFEBs
private

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().

Configuration* cscdqm::EventProcessor::config
private
bool cscdqm::EventProcessor::EmuEventDisplayWasReset
private

Definition at line 174 of file CSCDQM_EventProcessor.h.

Referenced by preProcessEvent(), and resetEmuEventDisplays().

bool cscdqm::EventProcessor::fCloseL1As
private

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().

uint32_t cscdqm::EventProcessor::L1ANumber
private

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().

Summary cscdqm::EventProcessor::summary
private

Detector efficiency manipulation object

Definition at line 160 of file CSCDQM_EventProcessor.h.

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