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
 Data Format version (2005, 2013) More...
 
std::map< uint32_t, bool > fNotFirstEvent
 
edm::EDGetTokenT
< FEDRawDataCollection
frdtoken
 
uint32_t L1ANumber
 
std::map< uint32_t, uint32_t > L1ANumbers
 
Summary summary
 
uint16_t theFormatVersion
 Total Number of TMBs per event from DMB DAV. More...
 

Detailed Description

Object used to process Events and compute statistics.

Definition at line 113 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 27 of file CSCDQM_EventProcessor.cc.

References config, and fCloseL1As.

27  {
28 
29  config = p_config;
30  // fFirstEvent = true;
31  fCloseL1As = true;
32 
33  }
bool fCloseL1As
Data Format version (2005, 2013)
cscdqm::EventProcessor::~EventProcessor ( )
inline

Destructor.

Definition at line 132 of file CSCDQM_EventProcessor.h.

132 { }

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.
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 159 of file CSCDQM_EventProcessor.cc.

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

Referenced by processCSC(), and processExaminer().

159  {
160  bool result = false;
161 
162  CSCDetId cid;
163  if (config->fnGetCSCDetId(crateId, dmbId, cid)) {
164  cscPosition = cid.chamber();
165  int iring = cid.ring();
166  int istation = cid.station();
167  int iendcap = cid.endcap();
168  std::string tlabel = cscdqm::Utility::getCSCTypeLabel(iendcap, istation, iring);
169  cscType = cscdqm::Utility::getCSCTypeBin(tlabel);
170  result = true;
171  }
172 
173  /*
174  if (!result) {
175  LOG_ERROR << "Event #" << config->getNEvents() << ": Invalid CSC=" << CSCHistoDef::getPath(crateId, dmbId);
176  }
177  */
178 
179  return result;
180 
181  }
int chamber() const
Definition: CSCDetId.h:81
int endcap() const
Definition: CSCDetId.h:106
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:88
int station() const
Definition: CSCDetId.h:99
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 114 of file CSCDQM_EventProcessor.cc.

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

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

114  {
115  if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, 0, me)) return (me != NULL);
116  CSCHistoDef histoD(histo, crateID, dmbSlot);
117  if (config->fnGetHisto(histoD, me)) return (me != NULL);
118  return false;
119  }
#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 131 of file CSCDQM_EventProcessor.cc.

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

131  {
132  if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, adId, me)) return (me != NULL);
133  CSCHistoDef histoD(histo, crateID, dmbSlot, adId);
134  if (config->fnGetHisto(histoD, me)) return (me != NULL);
135  return false;
136  }
#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 99 of file CSCDQM_EventProcessor.cc.

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

Referenced by processDDU().

99  {
100  if (config->fnGetCacheDDUHisto(histo, dduID, me)) return (me != NULL);
101  DDUHistoDef histoD(histo, dduID);
102  if (config->fnGetHisto(histoD, me)) return (me != NULL);
103  return false;
104  }
#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 71 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().

71  {
72  if (config->fnGetCacheEMUHisto(histo, me)) return (me != NULL);
73  EMUHistoDef histoD(histo);
74  if (config->fnGetHisto(histoD, me)) return (me != NULL);
75  return false;
76  }
#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 85 of file CSCDQM_EventProcessor.cc.

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

85  {
86  if (config->fnGetCacheFEDHisto(histo, fedID, me)) return (me != NULL);
87  FEDHistoDef histoD(histo, fedID);
88  if (config->fnGetHisto(histoD, me)) return (me != NULL);
89  return false;
90  }
#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 144 of file CSCDQM_EventProcessor.cc.

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

Referenced by updateEfficiencyHistos().

144  {
145  if (config->fnGetCacheParHisto(histo, me)) return (me != NULL);
146  ParHistoDef histoD(histo);
147  if (config->fnGetHisto(histoD, me)) return (me != NULL);
148  return false;
149  }
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 61 of file CSCDQM_EventProcessor.cc.

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

61  {
62 
63  }
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 189 of file CSCDQM_EventProcessor.cc.

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

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

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

New CSC readout without DCCs. CMS CSC DDU ID range 830-869

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 28 of file CSCDQM_EventProcessor_processDDU.cc.

References BXN, CSCDDUHeader::bxnum(), CSCDDUTrailer::check(), config, CSCDDUEventData::cscData(), cscdqm::h::DDU_BUFFER_SIZE, cscdqm::h::DDU_BXN, cscdqm::h::DDU_CSC_ERRORS, cscdqm::h::DDU_CSC_ERRORS_RATE, cscdqm::h::DDU_CSC_WARNINGS, cscdqm::h::DDU_CSC_WARNINGS_RATE, cscdqm::h::DDU_DMB_ACTIVE_HEADER_COUNT, cscdqm::h::DDU_DMB_CONNECTED_INPUTS, cscdqm::h::DDU_DMB_CONNECTED_INPUTS_RATE, cscdqm::h::DDU_DMB_DAV_HEADER_COUNT_VS_DMB_ACTIVE_HEADER_COUNT, cscdqm::h::DDU_DMB_DAV_HEADER_OCCUPANCY, cscdqm::h::DDU_DMB_DAV_HEADER_OCCUPANCY_RATE, cscdqm::h::DDU_DMB_UNPACKED_VS_DAV, cscdqm::h::DDU_L1A_INCREMENT, cscdqm::h::DDU_TRAILER_ERRORSTAT_FREQUENCY, cscdqm::h::DDU_TRAILER_ERRORSTAT_RATE, cscdqm::h::DDU_TRAILER_ERRORSTAT_TABLE, cscdqm::h::DDU_WORD_COUNT, CSCDDUHeader::dmb_dav(), CSCDDUTrailer::dmb_full(), CSCDDUTrailer::dmb_warn(), cscdqm::h::EMU_ALL_DDUS_AVERAGE_EVENT_SIZE, cscdqm::h::EMU_ALL_DDUS_AVERAGE_INPUTS_WITH_DATA, cscdqm::h::EMU_ALL_DDUS_AVERAGE_LIVE_INPUTS, cscdqm::h::EMU_ALL_DDUS_EVENT_SIZE, cscdqm::h::EMU_ALL_DDUS_IN_READOUT, cscdqm::h::EMU_ALL_DDUS_INPUTS_ERRORS, cscdqm::h::EMU_ALL_DDUS_INPUTS_WARNINGS, cscdqm::h::EMU_ALL_DDUS_INPUTS_WITH_DATA, cscdqm::h::EMU_ALL_DDUS_L1A_INCREMENT, cscdqm::h::EMU_ALL_DDUS_LIVE_INPUTS, cscdqm::h::EMU_ALL_DDUS_TRAILER_ERRORS, cscdqm::h::EMU_DDU_BXN, CSCDDUTrailer::errorstat(), fCloseL1As, cscdqm::MonitorObject::Fill(), fNotFirstEvent, cscdqm::MonitorObject::GetBinContent(), getDDUHisto(), getEMUHisto(), cscdqm::Configuration::getNEvents(), cscdqm::DDUHistoDef::getPath(), cscdqm::Utility::getRUIfromDDUId(), CSCDDUEventData::header(), i, L1ANumber, L1ANumbers, CSCDDUHeader::live_cscs(), LOG_WARN, CSCDDUHeader::lvl1num(), FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MINCSCDDUFEDID, CSCDDUHeader::ncsc(), processCSC(), CSCDDUTrailer::reserved(), cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetEntries(), CSCDDUEventData::sizeInWords(), CSCDDUHeader::source_id(), AlCaHLTBitMon_QueryRunRegistry::string, CSCDDUEventData::trailer(), and CSCDDUTrailer::wordcount().

29 {
30 
31  CSCDDUHeader dduHeader = dduData.header();
32  CSCDDUTrailer dduTrailer = dduData.trailer();
33  if (!dduTrailer.check())
34  {
36  return;
37  }
38 
39  int dduID = dduHeader.source_id();
40 
41  if ( (dduID >= FEDNumbering::MINCSCDDUFEDID) && (dduID <= FEDNumbering::MAXCSCDDUFEDID) )
42  {
43  // dduID -= (FEDNumbering::MINCSCDDUFEDID - 1); /// TODO: Can require DDU-RUI remapping for actual system
44  dduID = cscdqm::Utility::getRUIfromDDUId(dduHeader.source_id());
45  if (dduID < 0) {
46  LOG_WARN << "DDU source ID (" << dduHeader.source_id() << ") is out of valid range. Remapping to DDU ID 1.";
47  dduID = 1;
48  }
49  }
50  else
51  {
52 
54  dduID = dduID & 0xFF;
55  }
56 
57 
58  MonitorObject* mo = 0;
59 
61  {
62  mo->Fill(dduID);
63  }
64 
65  std::string dduTag = DDUHistoDef::getPath(dduID);
66 
67  uint32_t dduEvtSize = dduData.sizeInWords()*2;
68 
69  // if (dduEvtSize > 48)
70  {
71 
73  int trl_word_count = 0;
74  trl_word_count = dduTrailer.wordcount();
75 
76  if (getDDUHisto(h::DDU_BUFFER_SIZE, dduID, mo)) mo->Fill(dduEvtSize);
77 
78  if (getDDUHisto(h::DDU_WORD_COUNT, dduID, mo)) mo->Fill(trl_word_count );
79 
82  if (trl_word_count > 0)
83  {
85  {
86  mo->Fill(dduID, log10((double)trl_word_count));
87  }
88  }
89 
91  {
92  mo->Fill(dduID, trl_word_count);
93  }
94 
95  }
96 
97  fCloseL1As = dduTrailer.reserved() & 0x1; // Get status if Close L1As bit
101  BXN = dduHeader.bxnum();
103  if (getEMUHisto(h::EMU_DDU_BXN, mo)) mo->Fill(BXN);
104  if (getDDUHisto(h::DDU_BXN, dduID, mo)) mo->Fill(BXN);
105 
107  int L1ANumber_previous_event = L1ANumbers[dduID];
108  L1ANumbers[dduID] = (int)(dduHeader.lvl1num());
109  L1ANumber = L1ANumbers[dduID];
111  int L1A_inc = L1ANumber - L1ANumber_previous_event;
112 
114  if ( L1A_inc < 0 ) L1A_inc = 0xFFFFFF + L1A_inc;
115 
116  // if (!fFirstEvent) {
117  if (fNotFirstEvent[dduID])
118  {
119  if (getDDUHisto(h::DDU_L1A_INCREMENT, dduID, mo)) mo->Fill(L1A_inc);
121  {
122  if (L1A_inc > 100000)
123  {
124  L1A_inc = 19;
125  }
126  else if (L1A_inc > 30000)
127  {
128  L1A_inc = 18;
129  }
130  else if (L1A_inc > 10000)
131  {
132  L1A_inc = 17;
133  }
134  else if (L1A_inc > 3000)
135  {
136  L1A_inc = 16;
137  }
138  else if (L1A_inc > 1000)
139  {
140  L1A_inc = 15;
141  }
142  else if (L1A_inc > 300)
143  {
144  L1A_inc = 14;
145  }
146  else if (L1A_inc > 100)
147  {
148  L1A_inc = 13;
149  }
150  else if (L1A_inc > 30)
151  {
152  L1A_inc = 12;
153  }
154  else if (L1A_inc > 10)
155  {
156  L1A_inc = 11;
157  }
158  mo->Fill(dduID, L1A_inc);
159  }
160  }
161 
163  int dmb_dav_header = 0;
164  int dmb_dav_header_cnt = 0;
165 
166  int ddu_connected_inputs= 0;
167  int ddu_connected_inputs_cnt = 0;
168 
169  int csc_error_state = 0;
170  int csc_warning_state = 0;
171 
173  int dmb_active_header = 0;
174 
175  dmb_dav_header = dduHeader.dmb_dav();
176  dmb_active_header = (int)(dduHeader.ncsc() & 0xF);
177  csc_error_state = dduTrailer.dmb_full() & 0x7FFF; // Only 15 inputs for DDU
178  csc_warning_state = dduTrailer.dmb_warn() & 0x7FFF; // Only 15 inputs for DDU
179  ddu_connected_inputs = dduHeader.live_cscs();
180 
184  double freq = 0;
185  for (int i = 0;
186  i < 15;
187  ++i)
188  {
189  if ((dmb_dav_header >> i) & 0x1)
190  {
191  dmb_dav_header_cnt++;
193  {
194  mo->Fill(i + 1);
195  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
197  mo->SetBinContent(i+1,freq);
198  }
200  {
201  mo->Fill(dduID, i);
202  }
203  }
204 
205  if ( (ddu_connected_inputs >> i) & 0x1 )
206  {
207  ddu_connected_inputs_cnt++;
209  {
210  mo->Fill(i + 1);
211  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
213  mo->SetBinContent(i + 1, freq);
214  }
216  {
217  mo->Fill(dduID, i);
218  }
219  }
220 
221  if ( (csc_error_state >> i) & 0x1 )
222  {
223  if (getDDUHisto(h::DDU_CSC_ERRORS_RATE, dduID, mo))
224  {
225  mo->Fill(i + 1);
226  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
227  if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo))
228  mo->SetBinContent(i + 1, freq);
229  }
231  {
232  mo->Fill(dduID, i + 2);
233  }
234  }
235 
236  if ((csc_warning_state >> i) & 0x1 )
237  {
238  if (getDDUHisto(h::DDU_CSC_WARNINGS_RATE, dduID, mo))
239  {
240  mo->Fill(i + 1);
241  freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
242  if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetBinContent(i + 1, freq);
243  }
245  {
246  mo->Fill(dduID, i + 2);
247  }
248  }
249  }
250 
252  {
253  mo->Fill(dduID, ddu_connected_inputs_cnt);
254  }
255 
256  // if (dduEvtSize > 48)
257  {
259  {
260  mo->Fill(dduID, dmb_dav_header_cnt);
261  }
262  }
263 
265  {
266  if (csc_error_state > 0)
267  {
268  mo->Fill(dduID, 1); // Any Input
269  }
270  else
271  {
272  mo->Fill(dduID, 0); // No errors
273  }
274  }
275 
277  {
278  if (csc_warning_state > 0)
279  {
280  mo->Fill(dduID, 1); // Any Input
281  }
282  else
283  {
284  mo->Fill(dduID, 0); // No errors
285  }
286  }
287 
288  if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo)) mo->SetEntries(config->getNEvents());
289  if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo)) mo->SetEntries(config->getNEvents());
290  if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo)) mo->SetEntries(config->getNEvents());
291  if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetEntries(config->getNEvents());
292  if (getDDUHisto(h::DDU_DMB_ACTIVE_HEADER_COUNT, dduID, mo)) mo->Fill(dmb_active_header);
294  mo->Fill(dmb_active_header, dmb_dav_header_cnt);
295 
297  uint32_t trl_errorstat = dduTrailer.errorstat();
298  if (dmb_dav_header_cnt == 0) trl_errorstat &= ~0x20000000; // Ignore No Good DMB CRC bit of no DMB is present
300  for (int i = 0; i < 32; i++)
301  {
302  if ((trl_errorstat >> i) & 0x1)
303  {
305  {
306  mo->Fill(i);
307  double freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
309  mo->SetBinContent(i+1, freq);
310  }
312  mo->Fill(0.,i);
313  }
314  }
316  {
317  if (trl_errorstat)
318  {
319  mo->Fill(dduID, 1); // Any Error
320  for (int i = 0; i < 32; i++)
321  {
322  if ((trl_errorstat >> i) & 0x1)
323  {
324  mo->Fill(dduID, i + 2);
325  }
326  }
327  }
328  else
329  {
330  mo->Fill(dduID, 0); // No Errors
331  }
332  }
333 
334  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo)) mo->SetEntries(config->getNEvents());
335  if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo)) mo->SetEntries(config->getNEvents());
336 
337 
338  uint32_t nCSCs = 0;
339 
341  if (config->getPROCESS_CSC())
342  {
343 
344  std::vector<CSCEventData> chamberDatas;
345  chamberDatas.clear();
346  chamberDatas = dduData.cscData();
347 
348  nCSCs = chamberDatas.size();
349 
350  for (uint32_t i = 0; i < nCSCs; i++)
351  {
352  processCSC(chamberDatas[i], dduID, binChecker);
353  }
354 
355  }
356 
357  if (getDDUHisto(h::DDU_DMB_UNPACKED_VS_DAV, dduID, mo)) mo->Fill(dmb_active_header, nCSCs);
358 
359  // fFirstEvent = false;
360 
362  fNotFirstEvent[dduID] = true;
363 
364 }
int i
Definition: DBlmapReader.cc:9
CSCDDUHeader header() const
const unsigned long getNEvents() const
int lvl1num() const
Definition: CSCDDUHeader.h:25
const bool getDDUHisto(const HistoId &histo, const HwId &dduID, MonitorObject *&me)
Get DDU Level Monitoring Object.
unsigned errorstat() const
Definition: CSCDDUTrailer.h:41
static int getRUIfromDDUId(unsigned ddu_id)
Get RUI Number from DDU source ID for post LS1 configuration.
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:24
int dmb_dav() const
Definition: CSCDDUHeader.h:28
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
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
CSCDDUTrailer trailer() const
bool fCloseL1As
Data Format version (2005, 2013)
unsigned wordcount() const
Definition: CSCDDUTrailer.h:42
int ncsc() const
Definition: CSCDDUHeader.h:27
int source_id() const
Definition: CSCDDUHeader.h:23
int live_cscs() const
Definition: CSCDDUHeader.h:30
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

New CSC readout without DCCs. CMS CSC DDU ID range 830-869

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 28 of file CSCDQM_EventProcessor_processExaminer.cc.

References cscdqm::BAD_EVENTS, cscd2r::chamberID(), cntALCTs, cntCFEBs, cntDMBs, cntTMBs, config, cscdqm::Configuration::copyChamberCounterValue(), cscdqm::h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, cscdqm::h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_FREQUENCY, cscdqm::h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_RATE, cscdqm::h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, cscdqm::h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_FREQUENCY, cscdqm::h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, cscdqm::h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, cscdqm::h::CSC_ACTUAL_DMB_FEB_DAV_RATE, cscdqm::h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, cscdqm::h::CSC_BINCHECK_ERRORSTAT_TABLE, cscdqm::h::CSC_DMB_CFEB_ACTIVE_VS_DAV, cscdqm::h::CSC_DMB_CFEB_DAV, cscdqm::h::CSC_DMB_CFEB_DAV_MULTIPLICITY, cscdqm::h::CSC_DMB_CFEB_DAV_MULTIPLICITY_UNPACKING_INEFFICIENCY, cscdqm::h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, cscdqm::h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, cscdqm::h::CSC_DMB_FEB_COMBINATIONS_DAV_UNPACKING_INEFFICIENCY, cscdqm::h::CSC_DMB_FEB_DAV_RATE, cscdqm::h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, cscdqm::DMB_EVENTS, cscdqm::DMB_TRIGGERS, cscdqm::h::EMU_ALL_DDUS_FORMAT_ERRORS, cscdqm::h::EMU_CSC_DMB_INPUT_FIFO_FULL, cscdqm::h::EMU_CSC_DMB_INPUT_TIMEOUT, cscdqm::h::EMU_CSC_FORMAT_ERRORS, cscdqm::h::EMU_CSC_FORMAT_WARNINGS, cscdqm::h::EMU_CSC_REPORTING, cscdqm::h::EMU_CSC_UNPACKED_WITH_ERRORS, cscdqm::h::EMU_CSC_WO_ALCT, cscdqm::h::EMU_CSC_WO_CFEB, cscdqm::h::EMU_CSC_WO_CLCT, cscdqm::h::EMU_DMB_FORMAT_ERRORS, cscdqm::h::EMU_DMB_FORMAT_WARNINGS, cscdqm::h::EMU_DMB_INPUT_FIFO_FULL, cscdqm::h::EMU_DMB_INPUT_TIMEOUT, cscdqm::h::EMU_DMB_REPORTING, cscdqm::h::EMU_DMB_UNPACKED_WITH_ERRORS, cscdqm::h::EMU_DMB_WO_ALCT, cscdqm::h::EMU_DMB_WO_CFEB, cscdqm::h::EMU_DMB_WO_CLCT, 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(), cscdqm::Utility::getRUIfromDDUId(), i, cscdqm::Configuration::incChamberCounter(), cscdqm::Configuration::incNEventsBad(), LOG_WARN, FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MINCSCDDUFEDID, CSCDCCFormatStatusDigi::nextCSCWithError(), CSCDCCFormatStatusDigi::nextCSCWithPayload(), CSCDCCFormatStatusDigi::nextCSCWithStatus(), CSCDCCExaminer::nSTATUSES, cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetEntries(), and cscdqm::MonitorObject::SetMaximum().

29 {
30 
31  bool eventAccepted = true;
32  MonitorObject* mo = 0;
33 
34  uint32_t binErrorStatus = digi.getDDUSummaryErrors();
35 
37  {
38 
39  const std::set<DDUIdType> DDUs = digi.getListOfDDUs();
40  for (std::set<DDUIdType>::const_iterator ddu_itr = DDUs.begin(); ddu_itr != DDUs.end(); ++ddu_itr)
41  {
42  ExaminerStatusType errs = digi.getDDUErrors(*ddu_itr);
43  int dduID = (*ddu_itr)&0xFF;
44  if ( ((*ddu_itr) >= FEDNumbering::MINCSCDDUFEDID) && ((*ddu_itr) <= FEDNumbering::MAXCSCDDUFEDID) )
45  {
46  // dduID = (*ddu_itr) - FEDNumbering::MINCSCDDUFEDID + 1; /// TODO: Can require DDU-RUI remapping for actual system
47  dduID = cscdqm::Utility::getRUIfromDDUId((*ddu_itr));
48  if (dduID < 0) {
49  LOG_WARN << "DDU source ID (" << (*ddu_itr) << ") is out of valid range. Remapping to DDU ID 1.";
50  dduID = 1;
51  }
52  }
53  if (errs != 0)
54  {
55  for (int i = 0; i < 29; i++)
56  {
57  if ((errs >> i) & 0x1 )
58  {
59  mo->Fill(dduID, i + 1);
60  }
61  }
62  }
63  else
64  {
65  mo->Fill(dduID, 0);
66  }
67  }
68 
69  }
70 
71  // =VB= We want to use DCC level check mask as in CSCDCCUnpacker and not DDU mask
72  // Otherwise whole DCC event could be skipped because of a single chamber error
73  unsigned long dccBinCheckMask = 0x06080016;
74 // if ((binErrorStatus & config->getDDU_BINCHECK_MASK()) > 0) {
75  if ((binErrorStatus & dccBinCheckMask) > 0)
76  {
77  eventAccepted = false;
78  }
79 
80  if (binErrorStatus != 0)
81  {
83  }
84 
87  {
88  uint32_t i = 0;
89  CSCIdType chamberID = 0;
90  while (digi.nextCSCWithPayload(i, chamberID))
91  {
92 
93  int crateID = (chamberID >> 4) & 0xFF;
94  int dmbSlot = chamberID & 0xF;
95 
96  if (crateID == 255)
97  {
98  continue;
99  }
100  if ((crateID > 60) || (dmbSlot > 10) || (crateID <= 0) || (dmbSlot <= 0) )
101  {
102  continue;
103  }
104 
105  // Check if in standby!
106  {
107  CSCDetId cid;
108  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid))
109  {
110  continue;
111  }
112  }
113 
115  config->incChamberCounter(DMB_EVENTS, crateID, dmbSlot);
116  long DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot);
118  cntDMBs++;
119 
121  {
122  mo->Fill(crateID, dmbSlot);
123  }
124 
125  unsigned int cscType = 0;
126  unsigned int cscPosition = 0;
127  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
128 
129  if (cscPosition && getEMUHisto(h::EMU_CSC_REPORTING, mo))
130  {
131  mo->Fill(cscPosition, cscType);
132  }
133 
135  long payload = digi.getCSCPayload(chamberID);
136  int cfeb_dav = (payload >> 7) & 0x7F;
137  int cfeb_active = payload & 0x1F;
138  cfeb_active |= ((payload >> 14) &0x03) << 5;
139  int alct_dav = (payload >> 5) & 0x1;
140  int tmb_dav = (payload >> 6) & 0x1;
141  int cfeb_dav_num = 0;
142 
143  if (alct_dav == 0)
144  {
145  if (cscPosition && getEMUHisto(h::EMU_CSC_WO_ALCT, mo))
146  {
147  mo->Fill(cscPosition, cscType);
148  }
150  {
151  mo->Fill(crateID, dmbSlot);
152  }
153  }
154 
155  if (tmb_dav == 0)
156  {
157  if (cscPosition && getEMUHisto(h::EMU_CSC_WO_CLCT, mo))
158  {
159  mo->Fill(cscPosition, cscType);
160  }
162  {
163  mo->Fill(crateID, dmbSlot);
164  }
165  }
166 
167  if (cfeb_dav == 0)
168  {
169  if (cscPosition && getEMUHisto(h::EMU_CSC_WO_CFEB, mo))
170  {
171  mo->Fill(cscPosition, cscType);
172  }
174  {
175  mo->Fill(crateID, dmbSlot);
176  }
177  }
178 
180  for (int i=0; i<7; i++)
181  {
182  if ((cfeb_dav>>i) & 0x1) cntCFEBs++;
183  }
184 
185  if (alct_dav > 0)
186  {
187  cntALCTs++;
188  }
189 
190  if (tmb_dav > 0)
191  {
192  cntTMBs++;
193  }
194 
195 
196  MonitorObject *mof = 0, *mo1 = 0, *mo2 = 0;
197  if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, crateID, dmbSlot, mo)
198  && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, crateID, dmbSlot, mof))
199  {
200  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
201  && getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbSlot, mo2))
202  {
203  for (int i=1; i<=7; i++)
204  {
205  double actual_dav_num = mo->GetBinContent(i);
206  double unpacked_dav_num = mo2->GetBinContent(i);
207  if (actual_dav_num)
208  {
209  mo1->SetBinContent(i,1, 100.*(1-unpacked_dav_num/actual_dav_num));
210  }
211  mo1->SetEntries((int)DMBEvents);
212  }
213  }
214  for (int i=0; i<7; i++)
215  {
216  int cfeb_present = (cfeb_dav>>i) & 0x1;
217  cfeb_dav_num += cfeb_present;
218  if (cfeb_present)
219  {
220  mo->Fill(i);
221  }
222  float cfeb_entries = mo->GetBinContent(i+1);
223  mof->SetBinContent(i+1, ((float)cfeb_entries/(float)(DMBEvents)*100.0));
224  }
225  mof->SetEntries((int)DMBEvents);
226  }
227 
230  {
231  for (unsigned short i = 1; i < 7; i++)
232  {
233  float cfeb_entries = mo->GetBinContent(i);
234  mof->SetBinContent(i, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
235  }
236  mof->SetEntries((int)DMBEvents);
237 
239  && getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbSlot, mo2))
240  {
241  for (unsigned short i = 1; i < 9; i++)
242  {
243  float actual_dav_num = mo->GetBinContent(i);
244  float unpacked_dav_num = mo2->GetBinContent(i);
245  if (actual_dav_num)
246  {
247  mo1->SetBinContent(i, 1, 100. * (1-unpacked_dav_num/actual_dav_num));
248  }
249  mo1->SetEntries((int)DMBEvents);
250  }
251  }
252  mo->Fill(cfeb_dav_num);
253  }
254 
255  if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbSlot, mo)) mo->Fill(cfeb_dav, cfeb_active);
256 
258  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo))
259  {
260  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, crateID, dmbSlot, mo1))
261  {
262  for (int i = 1; i < 4; i++)
263  {
264  float dav_num = mo->GetBinContent(i);
265  mo1->SetBinContent(i, ((float)dav_num / (float)(DMBEvents) * 100.0));
266  }
267  mo1->SetEntries((int)DMBEvents);
268 
269  if (getCSCHisto(h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
270  && getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo2))
271  {
272  for (int i = 1; i < 4; i++)
273  {
274  float actual_dav_num = mo->GetBinContent(i);
275  float unpacked_dav_num = mo2->GetBinContent(i);
276  if (actual_dav_num)
277  {
278  mof->SetBinContent(i,1, 100. * (1 - unpacked_dav_num / actual_dav_num));
279  }
280  mof->SetEntries((int)DMBEvents);
281  mof->SetMaximum(100.0);
282  }
283  }
284  }
285 
286  if (alct_dav > 0)
287  {
288  mo->Fill(0.0);
289  }
290  if (tmb_dav > 0)
291  {
292  mo->Fill(1.0);
293  }
294  if (cfeb_dav > 0)
295  {
296  mo->Fill(2.0);
297  }
298  }
299 
300 
301  float feb_combination_dav = -1.0;
303  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo))
304  {
305  if (alct_dav == 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 0.0; // Nothing
306  if (alct_dav > 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 1.0; // ALCT Only
307  if (alct_dav == 0 && tmb_dav > 0 && cfeb_dav == 0) feb_combination_dav = 2.0; // TMB Only
308  if (alct_dav == 0 && tmb_dav == 0 && cfeb_dav > 0) feb_combination_dav = 3.0; // CFEB Only
309  if (alct_dav == 0 && tmb_dav > 0 && cfeb_dav > 0) feb_combination_dav = 4.0; // TMB+CFEB
310  if (alct_dav > 0 && tmb_dav > 0 && cfeb_dav == 0) feb_combination_dav = 5.0; // ALCT+TMB
311  if (alct_dav > 0 && tmb_dav == 0 && cfeb_dav > 0) feb_combination_dav = 6.0; // ALCT+CFEB
312  if (alct_dav > 0 && tmb_dav > 0 && cfeb_dav > 0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
313  // mo->Fill(feb_combination_dav);
314 
316  {
317  for (int i = 1; i < 9; i++)
318  {
319  float feb_combination_dav_number = mo->GetBinContent(i);
320  mo1->SetBinContent(i, ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
321  }
322  mo1->SetEntries(DMBEvents);
323 
325  && getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo2))
326  {
327  for (int i = 1; i < 9; i++)
328  {
329  float actual_dav_num = mo->GetBinContent(i);
330  float unpacked_dav_num = mo2->GetBinContent(i);
331  if (actual_dav_num)
332  {
333  mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
334  }
335  mof->SetEntries((int)DMBEvents);
336  mof->SetMaximum(100.0);
337  }
338  }
339 
340  }
341  mo->Fill(feb_combination_dav);
342  }
343 
344  }
345  }
346 
349  {
350  uint32_t i = 0;
351  CSCIdType chamberID = 0;
352  while (digi.nextCSCWithStatus(i, chamberID))
353  {
354 
355  unsigned int crateID = (chamberID >> 4) & 0xFF;
356  unsigned int dmbSlot = chamberID & 0xF;
357  ExaminerStatusType chStatus = digi.getCSCStatus(chamberID);
358 
359  if (crateID == 255)
360  {
361  continue;
362  }
363  if ((crateID > 60) || (dmbSlot > 10) || (crateID <= 0) || (dmbSlot <= 0) )
364  {
365  continue;
366  }
367 
368  // Check if in standby!
369  {
370  CSCDetId cid;
371  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid))
372  {
373  continue;
374  }
375  }
376 
377  unsigned int cscType = 0;
378  unsigned int cscPosition = 0;
379  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
380 
381  if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateID, dmbSlot, mo))
382  {
383  for (int bit = 0; bit < binChecker.nSTATUSES; bit++)
384  {
385  if (chStatus & (1<<bit) )
386  {
387  mo->Fill(0., bit);
388  }
389  }
390  mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot));
391  }
392 
393 
394  int anyInputFull = chStatus & 0x3F;
395  if (anyInputFull)
396  {
397  if (cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, mo))
398  {
399  mo->Fill(cscPosition, cscType);
400  }
402  {
403  mo->Fill(crateID, dmbSlot);
404  }
405  }
406 
407  int anyInputTO = (chStatus >> 7) & 0x3FFF;
408  if (anyInputTO)
409  {
410  if (cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, mo))
411  {
412  mo->Fill(cscPosition, cscType);
413  }
415  {
416  mo->Fill(crateID, dmbSlot);
417  }
418  }
419 
420  if (digi.getCSCStatus(chamberID) & (1 << 22))
421  {
423  {
424  mo->Fill(crateID, dmbSlot);
425  }
426 
427  if (cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, mo))
428  {
429  mo->Fill(cscPosition, cscType);
430  }
431 
432  }
433  }
434 
435  }
436 
439  {
440  uint32_t i = 0;
441  CSCIdType chamberID = 0;
442  while (digi.nextCSCWithError(i, chamberID))
443  {
444 
445  const unsigned int crateID = (chamberID >> 4) & 0xFF;
446  const unsigned int dmbSlot = chamberID & 0xF;
447  const ExaminerStatusType chErr = digi.getCSCErrors(chamberID);
448 
449  if ((crateID ==255) || (chErr & 0x80))
450  {
451  continue; // = Skip chamber detection if DMB header is missing (Error code 6)
452  }
453  if ((crateID > 60) || (dmbSlot > 10) || (crateID <= 0) || (dmbSlot <= 0) )
454  {
455  continue;
456  }
457 
458 
459  // Check if in standby!
460  {
461  CSCDetId cid;
462  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid))
463  {
464  continue;
465  }
466  }
467 
468  if ((chErr & config->getBINCHECK_MASK()) != 0)
469  {
470  config->incChamberCounter(BAD_EVENTS, crateID , dmbSlot);
471  }
472 
473  bool isCSCError = false;
474  bool fillBC = getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateID, dmbSlot, mo);
475 
476  for (int bit = 5; bit < 24; bit++)
477  {
478 
479  if (chErr & (1 << bit) )
480  {
481  isCSCError = true;
482  if (fillBC)
483  {
484  mo->Fill(0., bit - 5);
485  }
486  else
487  {
488  break;
489  }
490  }
491 
492  if (fillBC)
493  {
494  mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID , dmbSlot));
495  }
496 
497  }
498 
499  if (isCSCError)
500  {
501 
503  {
504  mo->Fill(crateID, dmbSlot);
505  }
506 
507  if (eventAccepted && getEMUHisto(h::EMU_DMB_UNPACKED_WITH_ERRORS, mo))
508  {
509  mo->Fill(crateID, dmbSlot);
510  }
511 
512  unsigned int cscType = 0;
513  unsigned int cscPosition = 0;
514  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
515 
516  if ( cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, mo))
517  {
518  mo->Fill(cscPosition, cscType);
519  }
520 
521  if (eventAccepted && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED_WITH_ERRORS, mo))
522  {
523  mo->Fill(cscPosition, cscType);
524  }
525  }
526 
527  }
528  }
529 
530  return eventAccepted;
531 
532 }
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
static int getRUIfromDDUId(unsigned ddu_id)
Get RUI Number from DDU source ID for post LS1 configuration.
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:31
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.
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
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 cscdqm::h::EMU_EVENT_DISPLAY_ANODE, cscdqm::h::EMU_EVENT_DISPLAY_CATHODE, cscdqm::h::EMU_EVENT_DISPLAY_XY, EmuEventDisplayWasReset, getEMUHisto(), and cscdqm::MonitorObject::getTH1Lock().

Referenced by setEmuEventDisplayBit().

56  {
58 
59  // Reseting EMU level Event displays
60  MonitorObject* mo = 0;
62  mo->getTH1Lock()->Reset("");
63  }
64 
66  mo->getTH1Lock()->Reset("");
67  }
68 
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.
Definition: DDAxes.h:10
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, cscdqm::h::EMU_CSC_STANDBY, 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;
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::h::EMU_CSC_DMB_INPUT_FIFO_FULL, cscdqm::h::EMU_CSC_DMB_INPUT_TIMEOUT, cscdqm::h::EMU_CSC_FORMAT_ERRORS, cscdqm::h::EMU_CSC_FORMAT_WARNINGS, cscdqm::h::EMU_CSC_L1A_OUT_OF_SYNC, cscdqm::h::EMU_CSC_REPORTING, cscdqm::h::EMU_CSC_WO_ALCT, cscdqm::h::EMU_CSC_WO_CFEB, cscdqm::h::EMU_CSC_WO_CLCT, cscdqm::h::EMU_PHYSICS_EMU, cscdqm::h::EMU_PHYSICS_ME1, cscdqm::h::EMU_PHYSICS_ME2, cscdqm::h::EMU_PHYSICS_ME3, cscdqm::h::EMU_PHYSICS_ME4, 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(), cscdqm::h::PAR_CSC_SIDEMINUS, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01_RING02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01_RING03, cscdqm::h::PAR_CSC_SIDEMINUS_STATION02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION02_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION02_RING02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION03, cscdqm::h::PAR_CSC_SIDEMINUS_STATION03_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION03_RING02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION04, cscdqm::h::PAR_CSC_SIDEMINUS_STATION04_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION04_RING02, cscdqm::h::PAR_CSC_SIDEPLUS, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01_RING02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01_RING03, cscdqm::h::PAR_CSC_SIDEPLUS_STATION02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION02_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION02_RING02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION03, cscdqm::h::PAR_CSC_SIDEPLUS_STATION03_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION03_RING02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION04, cscdqm::h::PAR_CSC_SIDEPLUS_STATION04_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION04_RING02, cscdqm::h::PAR_REPORT_SUMMARY, Parameters::parameters, cscdqm::Summary::ReadErrorChambers(), cscdqm::Summary::ReadReportingChambers(), cscdqm::Summary::ReadReportingChambersRef(), cuy::rep, 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 
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 
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 
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 
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 
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 
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 
98  LockType lock(me->mutex);
99  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
100  summary.Write(tmp, 1);
101  }
102 
104  LockType lock(me->mutex);
105  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
106  summary.Write(tmp, 2);
107  }
108 
110  LockType lock(me->mutex);
111  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
112  summary.Write(tmp, 3);
113  }
114 
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 [] = {
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  }
string rep
Definition: cuy.py:1188
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:152
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::h::CSC_BINCHECK_DATAFLOW_PROBLEMS_FREQUENCY, cscdqm::h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, cscdqm::h::CSC_BINCHECK_ERRORS_FREQUENCY, cscdqm::h::CSC_BINCHECK_ERRORSTAT_TABLE, cscdqm::DMB_EVENTS, cscdqm::h::EMU_CSC_DMB_INPUT_FIFO_FULL, cscdqm::h::EMU_CSC_DMB_INPUT_FIFO_FULL_FRACT, cscdqm::h::EMU_CSC_DMB_INPUT_TIMEOUT, cscdqm::h::EMU_CSC_DMB_INPUT_TIMEOUT_FRACT, cscdqm::h::EMU_CSC_FORMAT_ERRORS, cscdqm::h::EMU_CSC_FORMAT_ERRORS_FRACT, cscdqm::h::EMU_CSC_FORMAT_WARNINGS, cscdqm::h::EMU_CSC_FORMAT_WARNINGS_FRACT, cscdqm::h::EMU_CSC_L1A_OUT_OF_SYNC, cscdqm::h::EMU_CSC_L1A_OUT_OF_SYNC_FRACT, cscdqm::h::EMU_CSC_REPORTING, cscdqm::h::EMU_CSC_UNPACKED, cscdqm::h::EMU_CSC_UNPACKED_FRACT, cscdqm::h::EMU_CSC_WO_ALCT, cscdqm::h::EMU_CSC_WO_ALCT_FRACT, cscdqm::h::EMU_CSC_WO_CFEB, cscdqm::h::EMU_CSC_WO_CFEB_FRACT, cscdqm::h::EMU_CSC_WO_CLCT, cscdqm::h::EMU_CSC_WO_CLCT_FRACT, cscdqm::h::EMU_DMB_FORMAT_ERRORS, cscdqm::h::EMU_DMB_FORMAT_ERRORS_FRACT, cscdqm::h::EMU_DMB_FORMAT_WARNINGS, cscdqm::h::EMU_DMB_FORMAT_WARNINGS_FRACT, cscdqm::h::EMU_DMB_INPUT_FIFO_FULL, cscdqm::h::EMU_DMB_INPUT_FIFO_FULL_FRACT, cscdqm::h::EMU_DMB_INPUT_TIMEOUT, cscdqm::h::EMU_DMB_INPUT_TIMEOUT_FRACT, cscdqm::h::EMU_DMB_L1A_OUT_OF_SYNC, cscdqm::h::EMU_DMB_L1A_OUT_OF_SYNC_FRACT, cscdqm::h::EMU_DMB_REPORTING, cscdqm::h::EMU_DMB_UNPACKED, cscdqm::h::EMU_DMB_UNPACKED_FRACT, cscdqm::h::EMU_DMB_WO_ALCT, cscdqm::h::EMU_DMB_WO_ALCT_FRACT, cscdqm::h::EMU_DMB_WO_CFEB, cscdqm::h::EMU_DMB_WO_CFEB_FRACT, cscdqm::h::EMU_DMB_WO_CLCT, cscdqm::h::EMU_DMB_WO_CLCT_FRACT, cscdqm::h::EMU_FED_DDU_L1A_MISMATCH, cscdqm::h::EMU_FED_DDU_L1A_MISMATCH_FRACT, cscdqm::h::EMU_FED_DDU_L1A_MISMATCH_WITH_CSC_DATA, cscdqm::h::EMU_FED_DDU_L1A_MISMATCH_WITH_CSC_DATA_FRACT, cscdqm::h::EMU_FED_ENTRIES, cscdqm::Configuration::fnNextBookedCSC, cscdqm::Configuration::getChamberCounterValue(), getCSCHisto(), cscdqm::MonitorObject::getTH1(), getDQMSummary::iter, CommonMethods::lock(), and cscdqm::MonitorObject::SetEntries().

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

26  {
27 
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) &&
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 dqmd_manager::COLOR_BLUE, dqmd_manager::COLOR_GREEN, dqmd_manager::COLOR_RED, config, cscdqm::h::EMU_CSC_STATS_CFEB_BWORDS, cscdqm::h::EMU_CSC_STATS_FIFOFULL_ERR, cscdqm::h::EMU_CSC_STATS_FORMAT_ERR, cscdqm::h::EMU_CSC_STATS_INPUTTO_ERR, cscdqm::h::EMU_CSC_STATS_L1SYNC_ERR, cscdqm::h::EMU_CSC_STATS_OCCUPANCY, cscdqm::h::EMU_CSC_STATS_SUMMARY, cscdqm::h::EMU_CSC_STATS_WO_ALCT, cscdqm::h::EMU_CSC_STATS_WO_CFEB, cscdqm::h::EMU_CSC_STATS_WO_CLCT, 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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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
string COLOR_GREEN
Definition: dqmd_manager.py:10
string COLOR_RED
Definition: dqmd_manager.py:12
string COLOR_BLUE
Definition: dqmd_manager.py:9
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 173 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 176 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 175 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

uint32_t cscdqm::EventProcessor::cntDMBs
private

Definition at line 174 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 177 of file CSCDQM_EventProcessor.h.

Referenced by processExaminer().

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

Definition at line 185 of file CSCDQM_EventProcessor.h.

Referenced by preProcessEvent(), and resetEmuEventDisplays().

bool cscdqm::EventProcessor::fCloseL1As
private

Data Format version (2005, 2013)

Definition at line 184 of file CSCDQM_EventProcessor.h.

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

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

Definition at line 171 of file CSCDQM_EventProcessor.h.

Referenced by processDDU().

edm::EDGetTokenT<FEDRawDataCollection> cscdqm::EventProcessor::frdtoken
private

Definition at line 188 of file CSCDQM_EventProcessor.h.

uint32_t cscdqm::EventProcessor::L1ANumber
private

Definition at line 172 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processDDU().

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

Definition at line 170 of file CSCDQM_EventProcessor.h.

Referenced by processDDU().

Summary cscdqm::EventProcessor::summary
private

Detector efficiency manipulation object

Definition at line 168 of file CSCDQM_EventProcessor.h.

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

uint16_t cscdqm::EventProcessor::theFormatVersion
private

Total Number of TMBs per event from DMB DAV.

Definition at line 180 of file CSCDQM_EventProcessor.h.

Referenced by processCSC().