CMS 3D CMS Logo

cscdqm::EventProcessor Class Reference

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

#include <DQM/CSCMonitorModule/interface/CSCDQM_EventProcessor.h>

List of all members.

Public Member Functions

 EventProcessor (Configuration *const p_config)
void init ()
void updateEfficiencyHistos ()
void updateFractionAndEfficiencyHistos ()
void updateFractionHistos ()
 ~EventProcessor ()

Private Member Functions

void calcEMUFractionHisto (const HistoId &result, const HistoId &set, const HistoId &subset)
 Calculate fractional histogram.
const bool getCSCFromMap (const unsigned int &crateId, const unsigned int &dmbId, unsigned int &cscType, unsigned int &cscPosition) const
const bool getCSCHisto (const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, const HwId &adId, MonitorObject *&me)
const bool getCSCHisto (const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
const bool getDDUHisto (const HistoId &histo, const HwId &dduID, MonitorObject *&me)
const bool getEMUHisto (const HistoId &histo, MonitorObject *&me)
const bool getParHisto (const HistoId &histo, MonitorObject *&me)
void processCSC (const CSCEventData &data, const int dduID)
void processDDU (const CSCDDUEventData &data)
void processExaminer (const uint16_t *data, const uint32_t dataSize, bool &eventDenied)

Private Attributes

bool bCSCEventCounted
CSCDCCExaminer binChecker
uint32_t BXN
Configurationconfig
std::map< std::string,
CSCCounters
cscCntrs
bool fCloseL1As
bool fFirstEvent
uint32_t L1ANumber
std::map< uint32_t, uint32_t > L1ANumbers
std::map< std::string, uint32_t > nDMBEvents
Summary summary


Detailed Description

Object used to process Events and compute statistics.

Definition at line 57 of file CSCDQM_EventProcessor.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file CSCDQM_EventProcessor.cc.

References config, fCloseL1As, and fFirstEvent.

00024                                                               {
00025 
00026     config = p_config;
00027     fFirstEvent = true;
00028     fCloseL1As = true;
00029 
00030   }

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

Definition at line 66 of file CSCDQM_EventProcessor.h.

00066 { }


Member Function Documentation

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

Calculate fractional histogram.

Parameters:
result Histogram to write results to
set Histogram of the set
subset Histogram of the subset
Returns:

Definition at line 86 of file CSCDQM_EventProcessor_updateFracHistos.cc.

References getEMUHisto(), cscdqm::MonitorObject::getTH1Lock(), mo1, mo2, cscdqm::MonitorObject::SetMaximum(), and cscdqm::Lock::unlock().

Referenced by updateFractionHistos().

00086                                                                                                             {
00087 
00088     MonitorObject *mo = 0, *mo1 = 0, *mo2 = 0;
00089 
00090     if (getEMUHisto(result, mo) && getEMUHisto(set, mo2) && getEMUHisto(subset, mo1)) {
00091       TH1* th = mo->getTH1Lock();
00092       th->Reset();
00093       th->Divide(mo1->getTH1(), mo2->getTH1());
00094       mo->unlock();
00095       mo->SetMaximum(1.);
00096     }
00097 
00098   }

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

Definition at line 88 of file CSCDQM_EventProcessor.cc.

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

Referenced by processCSC(), and processExaminer().

00088                                                                                                                                                          {
00089 
00090     if (crateId < 1 || crateId > 60 || dmbId < 1 || dmbId > 10) return false;
00091 
00092     CSCDetId cid = config->fnGetCSCDetId(crateId, dmbId);
00093     cscPosition  = cid.chamber();
00094     int iring    = cid.ring();
00095     int istation = cid.station();
00096     int iendcap  = cid.endcap();
00097     std::string tlabel = cscdqm::Utility::getCSCTypeLabel(iendcap, istation, iring);
00098     cscType = cscdqm::Utility::getCSCTypeBin(tlabel);
00099 
00100     return true;
00101 
00102   }

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

Definition at line 73 of file CSCDQM_EventProcessor.cc.

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

00073                                                                                                                                              {
00074     if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, adId, me)) return (me != NULL);
00075     CSCHistoDef histoD(histo, crateID, dmbSlot, adId);
00076     if (config->fnGetHisto(histoD, me)) return (me != NULL);
00077     return false;
00078   }

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

Definition at line 65 of file CSCDQM_EventProcessor.cc.

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

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

00065                                                                                                                            {
00066     if (config->fnGetCacheCSCHisto(histo, crateID, dmbSlot, 0, me)) return (me != NULL);
00067     CSCHistoDef histoD(histo, crateID, dmbSlot);
00068     if (config->fnGetHisto(histoD, me)) return (me != NULL);
00069     return false;
00070   }

const bool cscdqm::EventProcessor::getDDUHisto ( const HistoId histo,
const HwId dduID,
MonitorObject *&  me 
) [private]

Definition at line 57 of file CSCDQM_EventProcessor.cc.

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

Referenced by processDDU().

00057                                                                                                     {
00058     if (config->fnGetCacheDDUHisto(histo, dduID, me)) return (me != NULL);
00059     DDUHistoDef histoD(histo, dduID);
00060     if (config->fnGetHisto(histoD, me)) return (me != NULL);
00061     return false;
00062   }

const bool cscdqm::EventProcessor::getEMUHisto ( const HistoId histo,
MonitorObject *&  me 
) [private]

Definition at line 49 of file CSCDQM_EventProcessor.cc.

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

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

00049                                                                                  {
00050     if (config->fnGetCacheEMUHisto(histo, me)) return (me != NULL);
00051     EMUHistoDef histoD(histo);
00052     if (config->fnGetHisto(histoD, me)) return (me != NULL);
00053     return false;
00054   }

const bool cscdqm::EventProcessor::getParHisto ( const HistoId histo,
MonitorObject *&  me 
) [private]

Definition at line 81 of file CSCDQM_EventProcessor.cc.

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

Referenced by updateEfficiencyHistos().

00081                                                                                  {
00082     if (config->fnGetCacheParHisto(histo, me)) return (me != NULL);
00083     ParHistoDef histoD(histo);
00084     if (config->fnGetHisto(histoD, me)) return (me != NULL);
00085     return false;
00086   }

void cscdqm::EventProcessor::init ( void   ) 

Definition at line 32 of file CSCDQM_EventProcessor.cc.

References binChecker, config, CSCDCCExaminer::crcALCT(), CSCDCCExaminer::crcCFEB(), CSCDCCExaminer::crcTMB(), CSCDCCExaminer::modeDDU(), CSCDCCExaminer::output1(), and CSCDCCExaminer::output2().

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

00032                             {
00033 
00034     binChecker.crcALCT(config->getBINCHECKER_CRC_ALCT());
00035     binChecker.crcTMB(config->getBINCHECKER_CRC_CLCT());
00036     binChecker.crcCFEB(config->getBINCHECKER_CRC_CFEB());
00037     binChecker.modeDDU(config->getBINCHECKER_MODE_DDU());
00038 
00039     if (config->getBINCHECKER_OUTPUT()) {
00040       binChecker.output1().show();
00041       binChecker.output2().show();
00042     } else {
00043       binChecker.output1().hide();
00044       binChecker.output2().hide();
00045     }
00046 
00047   }

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

Definition at line 24 of file CSCDQM_EventProcessor_processCSC.cc.

References a, funct::abs(), CSCDMBTrailer::alct_empty, CSCDMBTrailer::alct_endtimeout, CSCDMBTrailer::alct_full, CSCDMBTrailer::alct_half, CSCDMBTrailer::alct_timeout, CSCEventData::alctData(), CSCALCTHeader::ALCTDigis(), CSCEventData::alctHeader(), CSCTMBHeader::ALCTMatchTime(), CSCTMBHeader::ALCTOnly(), CSCEventData::alctTrailer(), b, b1, b2, binChecker, BXN, CSCTMBHeader::Bxn0Diff(), CSCDMBHeader::bxn12(), CSCTMBHeader::Bxn1Diff(), CSCALCTHeader::BXNCount(), CSCTMBHeader::BXNCount(), CSCDMBTrailer::cfeb_empty, CSCDMBTrailer::cfeb_endtimeout, CSCDMBTrailer::cfeb_full, CSCDMBTrailer::cfeb_half, CSCDMBTrailer::cfeb_starttimeout, CSCDMBHeader::cfebActive(), CSCDMBHeader::cfebAvailable(), CSCEventData::cfebData(), CSCDMBHeader::cfebMovlp(), CSCCLCTData::check(), HcalDataFrameFilter_impl::check(), CSCEventData::clctData(), CSCTMBHeader::CLCTDigis(), CSCTMBHeader::CLCTOnly(), CSCCLCTData::comparatorDigis(), config, CSCDMBHeader::crateID(), cscCntrs, CSCDMBTrailer::dmb_l1pipe, CSCDMBHeader::dmbCfebSync(), CSCEventData::dmbHeader(), CSCDMBHeader::dmbID(), CSCEventData::dmbTrailer(), cscdqm::StripClusterFinder::DoAction(), HLT_VtxMuL3::errors, CSCDCCExaminer::errorsForChamber(), fCloseL1As, cscdqm::MonitorObject::Fill(), first, cscdqm::Configuration::fnGetCSCDetId, cscdqm::MonitorObject::GetBinContent(), cscdqm::MonitorObject::GetBinError(), cscdqm::StripClusterFinder::getClusters(), getCSCFromMap(), getCSCHisto(), getEMUHisto(), cscdqm::MonitorObject::GetEntries(), cscdqm::MonitorObject::GetMaximumBin(), cscdqm::Configuration::getNEvents(), cscdqm::CSCHistoDef::getPath(), i, int, j, k, CSCDMBHeader::l1a(), CSCALCTHeader::L1Acc(), CSCTMBHeader::L1ANumber(), L1ANumber, LOG_ERROR, LOG_WARN, n, CSCDMBHeader::nalct(), CSCEventData::nalct(), CSCDMBHeader::nclct(), CSCEventData::nclct(), nDMBEvents, norm, NULL, edm::second(), cscdqm::MonitorObject::SetAxisRange(), cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetBinError(), cscdqm::MonitorObject::SetEntries(), cscdqm::MonitorObject::SetNormFactor(), CSCCFEBData::timeSlice(), CSCDMBTrailer::tmb_empty, CSCDMBTrailer::tmb_endtimeout, CSCDMBTrailer::tmb_full, CSCDMBTrailer::tmb_half, CSCDMBTrailer::tmb_timeout, CSCEventData::tmbData(), CSCTMBData::tmbHeader(), CSCTMBHeader::TMBMatch(), CSCTMBData::tmbTrailer(), CSCCFEBSCAControllerWord::trig_time, CSCAnodeData::wireDigis(), CSCALCTTrailer::wordCount(), and CSCTMBTrailer::wordCount().

Referenced by processDDU().

00024                                                                            {
00025 
00026     if (&data == 0) {
00027       LOG_ERROR << "Zero pointer. DMB data are not available for unpacking"; //KK is->are
00028       return;
00029     }
00030 
00031     int FEBunpacked   = 0;
00032     int alct_unpacked = 0;
00033     int tmb_unpacked  = 0;
00034     int cfeb_unpacked = 0;
00035   
00036     int alct_keywg = -1;
00037     int clct_kewdistrip = -1;
00038   
00039     bool L1A_out_of_sync = false;
00040   
00041     MonitorObject* mo = NULL;
00042   
00043     //  DMB Found
00044     //  Unpacking of DMB Header and trailer
00045     const CSCDMBHeader* dmbHeader = data.dmbHeader();
00046     const CSCDMBTrailer* dmbTrailer = data.dmbTrailer();
00047     if (!dmbHeader && !dmbTrailer) {
00048       LOG_ERROR << "Can not unpack DMB Header or/and Trailer";
00049       return;
00050     }
00051   
00052     // Unpacking of Chamber Identification number
00053     unsigned int crateID = 0xFF;
00054     unsigned int dmbID = 0xF;
00055     unsigned int chamberID = 0xFFF;
00056     
00057     crateID = dmbHeader->crateID();
00058     dmbID = dmbHeader->dmbID();
00059     chamberID = (((crateID) << 4) + dmbID) & 0xFFF;
00060   
00061     std::string cscTag = CSCHistoDef::getPath(crateID, dmbID);
00062   
00063     unsigned long errors = binChecker.errorsForChamber(chamberID);
00064     if ((errors & config->getBINCHECK_MASK()) > 0 ) {
00065       LOG_WARN << "Format Errors " << cscTag << ": 0x" << hex << errors << " Skipped CSC Unpacking";
00066       return;
00067     }
00068   
00069     unsigned int cscType = 0;
00070     unsigned int cscPosition = 0;
00071     if (!getCSCFromMap(crateID, dmbID, cscType, cscPosition )) {
00072       LOG_ERROR << "Invalid CSC: " << cscTag << ". Skipping";
00073       return;
00074     }
00075   
00076     uint32_t detRawId = config->fnGetCSCDetId(crateID, dmbID).rawId();
00077     if (!detRawId) {
00078       return;
00079     }
00080     
00081     // if (cscName != "") cscTag+=" ["+cscName+"]";
00082     // nDMBEvents[cscTag]++;
00083     double DMBEvents  = 0.0;
00084     DMBEvents = nDMBEvents[cscTag];  
00085   
00086     CSCCounters& trigCnts = cscCntrs[cscTag];
00087     trigCnts["DMB"] = nDMBEvents[cscTag];
00088   
00089     if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED, mo)){
00090       mo->Fill(cscPosition, cscType);
00091     }
00092   
00093     //    Efficiency of the chamber
00094     float DMBEff = float(DMBEvents) / float(config->getNEvents());
00095     if(DMBEff > 1.0) {
00096       LOG_ERROR <<   cscTag  << " has efficiency " << DMBEff << " which is greater than 1";
00097     }
00098     
00099     // Unpacking L1A number from DMB header
00100     // DMB L1A: 8bits (256)
00101     // DDU L1A: 24bits
00102     int dmbHeaderL1A      = dmbHeader->l1a()%64;
00103     // Calculate difference between L1A numbers from DDU and DMB
00104     int dmb_ddu_l1a_diff  = (int)(dmbHeaderL1A-(int)(L1ANumber%64));
00105     if (dmb_ddu_l1a_diff != 0) L1A_out_of_sync = true;
00106 
00107     //LOG_DEBUG << dmbHeaderL1A << " : DMB L1A - DDU L1A = " << dmb_ddu_l1a_diff;
00108   
00109     if (getCSCHisto(h::CSC_DMB_L1A_DISTRIB, crateID, dmbID, mo)) mo->Fill(dmbHeaderL1A);
00110   
00111     if (getCSCHisto(h::CSC_DMB_DDU_L1A_DIFF, crateID, dmbID, mo)) {
00112       if(dmb_ddu_l1a_diff < -32) {
00113         mo->Fill(dmb_ddu_l1a_diff + 64);
00114       } else {
00115         if(dmb_ddu_l1a_diff > 32) mo->Fill(dmb_ddu_l1a_diff - 64);
00116         else mo->Fill(dmb_ddu_l1a_diff);
00117       }
00118       mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
00119     }
00120   
00121     if (getCSCHisto(h::CSC_DMB_L1A_VS_DDU_L1A, crateID, dmbID, mo)) mo->Fill((int)(L1ANumber & 0xFF), (int)dmbHeaderL1A);
00122   
00123     //    Unpacking BXN number from DMB header
00124     int dmbHeaderBXN      = 0;
00125     int dmb_ddu_bxn_diff  = 0;
00126     
00127     // == DMB BXN: 12bits (4096) call bxn12(), bxn() return 7bits value
00128     // == DDU BXN: 12bits (4096) 
00129   
00130     // == Use 6-bit BXN
00131     dmbHeaderBXN = dmbHeader->bxn12();
00132     // Calculation difference between BXN numbers from DDU and DMB
00133   
00134     //  dmb_ddu_bxn_diff = (int)(dmbHeaderBXN-(int)(BXN&0x7F)); // For older DMB
00135     dmb_ddu_bxn_diff = dmbHeaderBXN%64-BXN%64;
00136     //LOG_DEBUG << dmbHeaderBXN << " : DMB BXN - DDU BXN = " << dmb_ddu_bxn_diff;
00137     if (getCSCHisto(h::CSC_DMB_BXN_DISTRIB, crateID, dmbID, mo)) mo->Fill((int)(dmbHeader->bxn12()));
00138   
00139     if (getCSCHisto(h::CSC_DMB_DDU_BXN_DIFF, crateID, dmbID, mo)) {
00140       if(dmb_ddu_bxn_diff < -32) mo->Fill(dmb_ddu_bxn_diff + 64);
00141       else {
00142         if(dmb_ddu_bxn_diff > 32)  mo->Fill(dmb_ddu_bxn_diff - 64);
00143         else mo->Fill(dmb_ddu_bxn_diff);
00144       }  
00145       mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
00146     }
00147   
00148     //  if (getCSCHisto(h::CSC_DMB_BXN_VS_DDU_BXN, crateID, dmbID, mo)) mo->Fill((int)(BXN), (int)dmbHeaderBXN);
00149     if (getCSCHisto(h::CSC_DMB_BXN_VS_DDU_BXN, crateID, dmbID, mo)) mo->Fill(((int)(BXN)) % 256, ((int)dmbHeaderBXN) % 256);
00150   
00151     //    Unpacking CFEB information from DMB header
00152     int cfeb_dav = 0;
00153     int cfeb_dav_num = 0;
00154     int cfeb_movlp = 0;
00155     int dmb_cfeb_sync = 0;
00156   
00157     cfeb_dav = (int)dmbHeader->cfebAvailable();
00158     for (int i = 0; i < 5; i++) cfeb_dav_num += (cfeb_dav >> i) & 0x1;
00159     cfeb_movlp    = (int)dmbHeader->cfebMovlp();
00160     dmb_cfeb_sync = (int)dmbHeader->dmbCfebSync();
00161   
00162     if (getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbID, mo)) {
00163       for (int i = 0; i < 5; i++) {
00164         int cfeb_present = (cfeb_dav >> i) & 0x1;
00165         if (cfeb_present) {
00166           mo->Fill(i);
00167         }
00168       }
00169     }
00170 
00171     if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbID, mo)) mo->Fill(cfeb_dav_num);
00172     if (getCSCHisto(h::CSC_DMB_CFEB_MOVLP, crateID, dmbID, mo)) mo->Fill(cfeb_movlp);
00173     if (getCSCHisto(h::CSC_DMB_CFEB_SYNC, crateID, dmbID, mo)) mo->Fill(dmb_cfeb_sync);
00174   
00175     if (getEMUHisto(h::EMU_DMB_UNPACKED, mo)) { 
00176       mo->Fill(crateID, dmbID);
00177       //  mo->SetEntries(config->getNEvents());
00178     }
00179   
00180     // if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE, crateID, dmbID, mo) mo->Fill((dmbTrailer->header_1a>>5)&0x1F); //KK
00181     if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebActive()); //KK
00182   
00183     //if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebAvailable(),(int)((dmbTrailer->header_1a>>5)&0x1F)); //KK
00184     // if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebAvailable(),dmbHeader->cfebActive()); //KK
00185   
00186     if (getCSCHisto(h::CSC_DMB_L1_PIPE, crateID, dmbID, mo)) mo->Fill(dmbTrailer->dmb_l1pipe);
00187   
00188     // DMB input (7 in total) FIFO stuff goes here
00189     if (getCSCHisto(h::CSC_DMB_FIFO_STATS, crateID, dmbID, mo)) {
00190       if (dmbTrailer->tmb_empty == 1) mo->Fill(1.0, 0.0); //KK
00191       if (dmbTrailer->tmb_half == 0) mo->Fill(1.0, 1.0);
00192       if (dmbTrailer->tmb_full == 1) mo->Fill(1.0, 2.0); //KK
00193       if (dmbTrailer->alct_empty == 1) mo->Fill(0.0, 0.0);
00194       if (dmbTrailer->alct_half == 0) mo->Fill(0.0, 1.0);
00195       if (dmbTrailer->alct_full == 1) mo->Fill(0.0, 2.0); //KK 0->1
00196       for (int i = 0; i < 5; i++) {
00197         if ((int)((dmbTrailer->cfeb_empty>>i)&0x1) == 1) mo->Fill(i + 2, 0.0);
00198         if ((int)((dmbTrailer->cfeb_half>>i)&0x1) == 0) mo->Fill(i + 2, 1);
00199         if ((int)((dmbTrailer->cfeb_full>>i)&0x1) == 1) {
00200           mo->Fill(i + 2, 2);
00201         }
00202       }
00203       mo->SetEntries((int)DMBEvents);
00204     }
00205   
00206     // DMB input timeout (total 15 bits) goes here
00207     if (getCSCHisto(h::CSC_DMB_FEB_TIMEOUTS, crateID, dmbID, mo)) {
00208       if ((dmbTrailer->tmb_timeout == 0) && (dmbTrailer->alct_timeout == 0) && (dmbTrailer->cfeb_starttimeout == 0) && (dmbTrailer->cfeb_endtimeout == 0)) {
00209         mo->Fill(0.0);
00210       }else{
00211         if (dmbTrailer->alct_timeout) mo->Fill(1);
00212         if (dmbTrailer->tmb_timeout) mo->Fill(2);
00213         if (dmbTrailer->alct_endtimeout) mo->Fill(8); // KK
00214         if (dmbTrailer->tmb_endtimeout) mo->Fill(9);  // KK
00215       }
00216       for (int i = 0; i < 5; i++) {
00217         if ((dmbTrailer->cfeb_starttimeout >> i) & 0x1) {
00218           mo->Fill(i + 3);
00219         }
00220         if ((dmbTrailer->cfeb_endtimeout >> i) & 0x1) {
00221           mo->Fill(i + 10); // KK 8->10
00222         }
00223       }
00224       mo->SetEntries((int)DMBEvents);
00225     }
00226   
00227     //      Get FEBs Data Available Info
00228     int alct_dav  = dmbHeader->nalct();
00229     int tmb_dav   = dmbHeader->nclct();
00230     int cfeb_dav2 = 0;
00231     for (int i = 0; i < 5; i++) cfeb_dav2 = cfeb_dav2 + (int)((dmbHeader->cfebAvailable() >> i) & 0x1);
00232   
00233     //      Fill Hisogram for FEB DAV Efficiency
00234   
00235     if ((alct_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
00236       mo->Fill(0.0);
00237       float alct_dav_number   = mo->GetBinContent(1);
00238       if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
00239         mo->SetBinContent(1, ((float)alct_dav_number / (float)(DMBEvents) * 100.0));
00240         mo->SetEntries((int)DMBEvents);
00241       }
00242     }
00243   
00244     if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
00245       mo->Fill(1.0);
00246       float tmb_dav_number = mo->GetBinContent(2);
00247       if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
00248         mo->SetBinContent(2, ((float)tmb_dav_number / (float)(DMBEvents) * 100.0));
00249         mo->SetEntries((int)DMBEvents);
00250       }
00251     }
00252     
00253     if ((cfeb_dav2 > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
00254       mo->Fill(2.0);
00255       float cfeb_dav2_number = mo->GetBinContent(3);
00256       if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
00257         mo->SetBinContent(3, ((float)cfeb_dav2_number / (float)(DMBEvents) * 100.0));
00258         mo->SetEntries((int)DMBEvents);
00259       }
00260     }
00261   
00262     float feb_combination_dav = -1.0;
00263     //      Fill Hisogram for Different Combinations of FEB DAV Efficiency
00264     if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbID, mo)) {
00265        if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 0.0; // Nothing
00266     if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 1.0; // ALCT Only
00267     if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav2 == 0) feb_combination_dav = 2.0; // TMB Only
00268     if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 >  0) feb_combination_dav = 3.0; // CFEB Only
00269     if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav2 >  0) feb_combination_dav = 4.0; // TMB+CFEB
00270     if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav2 == 0) feb_combination_dav = 5.0; // ALCT+TMB
00271     if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav2 >  0) feb_combination_dav = 6.0; // ALCT+CFEB
00272     if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav2 >  0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
00273       mo->Fill(feb_combination_dav);
00274       float feb_combination_dav_number = mo->GetBinContent((int)(feb_combination_dav + 1.0));
00275       if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_EFFICIENCY, crateID, dmbID, mo)) {
00276         mo->SetBinContent((int)(feb_combination_dav + 1.0), ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
00277         mo->SetEntries((int)DMBEvents);
00278       }
00279     }
00280   
00281     //ALCT Found
00282     if (data.nalct()) {
00283       const CSCALCTHeader* alctHeader = data.alctHeader();
00284       const CSCALCTTrailer* alctTrailer = data.alctTrailer();
00285       const CSCAnodeData* alctData = data.alctData();
00286       if (alctHeader && alctTrailer) {
00287         std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
00288         std::vector<CSCALCTDigi> alctsDatas;
00289   
00290         for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
00291           if (alctsDatasTmp[lct].isValid())
00292             alctsDatas.push_back(alctsDatasTmp[lct]);
00293         }
00294   
00295         FEBunpacked = FEBunpacked + 1;
00296         alct_unpacked = 1;
00297   
00298         // Set number of ALCT-events to third bin
00299         if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) { 
00300           mo->Fill(2);
00301           // trigCnts.ALCTcnt++;
00302           uint32_t ALCTEvent = (uint32_t)mo->GetBinContent(3);
00303           trigCnts["ALCT"] = ALCTEvent;
00304           if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)){
00305             if(config->getNEvents() > 0) {
00306               //KK
00307               //h[hname]->SetBinContent(3, ((float)ALCTEvent/(float)(config->getNEvents()) * 100.0));
00308               mo->SetBinContent(1, ((float)ALCTEvent / (float)(DMBEvents) * 100.0));
00309               //KKend
00310               mo->SetEntries((int)DMBEvents);
00311             }
00312           }
00313         }
00314   
00315         if ((alct_dav >0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
00316           mo->Fill(0.0, 0.0);
00317         }
00318     
00319         // == ALCT2007 L1A: 12bits (4096)
00320         // == ALCT2006 L1A: 4bits (16)
00321         if (getCSCHisto(h::CSC_ALCT_L1A, crateID, dmbID, mo)) mo->Fill((int)(alctHeader->L1Acc()));
00322     
00323         // == Use 6-bit L1A      
00324         if (getCSCHisto(h::CSC_ALCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
00325           // int alct_dmb_l1a_diff = (int)((dmbHeader->l1a()&0xF)-alctHeader->L1Acc());
00326           int alct_dmb_l1a_diff = (int)(alctHeader->L1Acc() % 64 - dmbHeader->l1a() % 64);
00327           if (alct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
00328           if(alct_dmb_l1a_diff < -32) mo->Fill(alct_dmb_l1a_diff + 64);
00329           else {
00330             if(alct_dmb_l1a_diff > 32) mo->Fill(alct_dmb_l1a_diff - 64);
00331             else mo->Fill(alct_dmb_l1a_diff);
00332           }
00333           mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
00334         }
00335   
00336         // if (getCSCHisto(h::CSC_DMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) mo->Fill(alctHeader->L1Acc(),dmbHeader->l1a());
00337         if (getCSCHisto(h::CSC_DMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) mo->Fill(alctHeader->L1Acc() % 256, dmbHeader->l1a());
00338   
00339         // === ALCT BXN: 12bits (4096)
00340         // === Use 6-bit BXN
00341         if (getCSCHisto(h::CSC_ALCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
00342           int alct_dmb_bxn_diff = (int)(alctHeader->BXNCount() % 64 - dmbHeader->bxn12() % 64);
00343           if(alct_dmb_bxn_diff < -32) mo->Fill(alct_dmb_bxn_diff + 64);
00344           else {
00345             if(alct_dmb_bxn_diff > 32)  mo->Fill(alct_dmb_bxn_diff - 64);
00346             else mo->Fill(alct_dmb_bxn_diff);
00347           }
00348           mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
00349         }
00350   
00351         if (getCSCHisto(h::CSC_ALCT_BXN, crateID, dmbID, mo)) mo->Fill(alctHeader->BXNCount());
00352   
00353         // if (getCSCHisto(h::CSC_ALCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount())), (int)(dmbHeader->bxn()));
00354         if (getCSCHisto(h::CSC_ALCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount()) % 256), (int)(dmbHeader->bxn12()) % 256);
00355   
00356         if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
00357           mo->Fill(alctsDatas.size());
00358           int nALCT = (int)mo->GetBinContent((int)(alctsDatas.size() + 1));
00359           if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo)) 
00360             mo->SetBinContent((int)(alctsDatas.size() + 1), (float)(nALCT) / (float)(DMBEvents) * 100.0);
00361         }
00362   
00363         if (getCSCHisto(h::CSC_ALCT_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(alctTrailer->wordCount()));
00364   
00365         //LOG_DEBUG <<  "ALCT Trailer Word Count = " << dec << (int)alctTrailer->wordCount();
00366   
00367         if (alctsDatas.size() == 2) {
00368           if (getCSCHisto(h::CSC_ALCT1_VS_ALCT0_KEYWG, crateID, dmbID, mo)) 
00369             mo->Fill(alctsDatas[0].getKeyWG(),alctsDatas[1].getKeyWG());
00370         }
00371   
00372         for (uint32_t lct = 0; lct < alctsDatas.size(); lct++) {
00373           // TODO: Add support for more than 2 ALCTs
00374           if (lct >= 2) continue;       
00375           if (getCSCHisto(h::CSC_ALCTXX_KEYWG, crateID, dmbID, lct, mo)) 
00376             mo->Fill(alctsDatas[lct].getKeyWG());
00377           if(lct == 0) alct_keywg  = alctsDatas[lct].getKeyWG();
00378           int alct_dtime = (int)(alctsDatas[lct].getBX() - (alctHeader->BXNCount() & 0x1F));
00379           if (getCSCHisto(h::CSC_ALCTXX_DTIME, crateID, dmbID, lct, mo)) {
00380             if(alct_dtime < -16) {
00381               mo->Fill(alct_dtime + 32);
00382             } else {
00383               if(alct_dtime > 16)  mo->Fill(alct_dtime - 32);
00384               else mo->Fill(alct_dtime);
00385             }
00386             mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
00387           }
00388   
00389           if (getCSCHisto(h::CSC_ALCTXX_DTIME_VS_KEYWG, crateID, dmbID, lct, mo)) {
00390             if(alct_dtime < -16) {
00391               mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
00392             } else {
00393               if(alct_dtime > 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
00394               else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
00395             }
00396           }
00397   
00398           if (getCSCHisto(h::CSC_ALCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
00399             if(alct_dtime < -16) {
00400               mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
00401             } else {
00402               if(alct_dtime > 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
00403               else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
00404             }
00405           }
00406     
00407           if (getCSCHisto(h::CSC_ALCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getBX());
00408     
00409           if (getCSCHisto(h::CSC_ALCTXX_QUALITY, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
00410   
00411           if (getCSCHisto(h::CSC_ALCTXX_QUALITY_PROFILE, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
00412   
00413           if (getCSCHisto(h::CSC_ALCTXX_PATTERN, crateID, dmbID, lct, mo)) {
00414             int pattern = (alctsDatas[lct].getAccelerator() << 1) + alctsDatas[lct].getCollisionB();
00415             int keywg = alctsDatas[lct].getKeyWG();
00416             mo->Fill(keywg, pattern );
00417           }
00418         }
00419 
00420         int NumberOfLayersWithHitsInALCT = 0;
00421         int NumberOfWireGroupsWithHitsInALCT = 0;
00422 
00423         if (alctData) {
00424           for (int nLayer=1; nLayer<=6; nLayer++) {
00425             int wg_previous   = -1;
00426             int tbin_previous = -1;
00427             bool CheckLayerALCT = true;
00428             std::vector<CSCWireDigi> wireDigis = alctData->wireDigis(nLayer);
00429             for (std::vector<CSCWireDigi>:: iterator wireDigisItr = wireDigis.begin(); wireDigisItr != wireDigis.end(); ++wireDigisItr) {
00430               int wg = wireDigisItr->getWireGroup();
00431               // int tbin = wireDigisItr->getBeamCrossingTag();
00432               std::vector<int> tbins = wireDigisItr->getTimeBinsOn();
00433               int tbin = wireDigisItr->getTimeBin();
00434               if(CheckLayerALCT) {
00435                 NumberOfLayersWithHitsInALCT = NumberOfLayersWithHitsInALCT + 1;
00436                 CheckLayerALCT = false;
00437               }
00438               for (uint32_t n=0; n < tbins.size(); n++) {
00439                 tbin = tbins[n];
00440                 if(wg != wg_previous || (tbin != tbin_previous + 1 && tbin != tbin_previous - 1) ) {
00441                   if (getCSCHisto(h::CSC_ALCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(wg, tbin);
00442                   if (getCSCHisto(h::CSC_ALCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(wg, tbin);
00443                   if (getCSCHisto(h::CSC_ALCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) { 
00444                     mo->Fill(wg);
00445                     int number_wg = (int)(mo->GetBinContent(wg+1));
00446                     Double_t Number_of_entries_ALCT = mo->GetEntries();
00447                     if (getCSCHisto(h::CSC_ALCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
00448                       mo->SetBinContent(wg + 1, ((float) number_wg));
00449                       if((Double_t)(DMBEvents) > 0.0) {
00450                         mo->SetNormFactor(100.0*Number_of_entries_ALCT/(Double_t)(DMBEvents));
00451                       } else {
00452                         mo->SetNormFactor(100.0);
00453                       }
00454                       mo->SetEntries((int)DMBEvents);
00455                     }
00456                   }
00457                 }
00458                 if(wg != wg_previous) {
00459                   NumberOfWireGroupsWithHitsInALCT = NumberOfWireGroupsWithHitsInALCT + 1;
00460                 }
00461   
00462                 wg_previous   = wg;
00463                 tbin_previous = tbin;
00464               }
00465             }
00466           }
00467         } else {
00468           LOG_ERROR << cscTag << " Can not unpack Anode Data";
00469         }
00470         if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) mo->Fill(NumberOfLayersWithHitsInALCT);    
00471         if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_WIREGROUPS_WITH_HITS, crateID, dmbID, mo)) mo->Fill(NumberOfWireGroupsWithHitsInALCT);
00472       } else {
00473         LOG_ERROR << cscTag << " Can not unpack ALCT Header or/and Trailer";
00474       }
00475     } else {
00476       //  ALCT not found
00477   
00478       if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) { 
00479         mo->Fill(0);
00480         int nALCT = (int)mo->GetBinContent(1);
00481         if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo)) 
00482           mo->SetBinContent(1, (float)(nALCT) / (float)(DMBEvents) * 100.0);
00483       }
00484   
00485       if ((alct_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
00486         mo->Fill(0.0, 1.0);
00487       }
00488     }
00489   
00490     //ALCT and CLCT coinsidence
00491     if(data.nclct() && data.nalct()) {
00492     
00493       CSCALCTHeader* alctHeader = data.alctHeader();
00494       
00495       if (alctHeader) {
00496         std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
00497         std::vector<CSCALCTDigi> alctsDatas;
00498   
00499         for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
00500           if (alctsDatasTmp[lct].isValid())
00501             alctsDatas.push_back(alctsDatasTmp[lct]);
00502         }
00503   
00504         CSCTMBData* tmbData = data.tmbData();
00505         if (tmbData) {
00506           CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
00507           if (tmbHeader) {
00508             // if (getCSCHisto(h::CSC_TMB_BXN_VS_ALCT_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount())),(int)(tmbHeader->BXNCount()));
00509             if (getCSCHisto(h::CSC_TMB_BXN_VS_ALCT_BXN, crateID, dmbID, mo))
00510               mo->Fill( ((int)(alctHeader->BXNCount())) % 256, ((int)(tmbHeader->BXNCount())) % 256 );
00511   
00512             if (getCSCHisto(h::CSC_TMB_ALCT_BXN_DIFF, crateID, dmbID, mo)) {
00513               int clct_alct_bxn_diff = (int)(alctHeader->BXNCount() - tmbHeader->BXNCount());
00514               if(clct_alct_bxn_diff < -2048) mo->Fill(clct_alct_bxn_diff + 4096);
00515               else {
00516                 if(clct_alct_bxn_diff > 2048) mo->Fill(clct_alct_bxn_diff - 4096);
00517                 else mo->Fill(clct_alct_bxn_diff);
00518               }
00519               mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
00520             }
00521   
00522             if (getCSCHisto(h::CSC_TMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) 
00523               mo->Fill((int)(alctHeader->L1Acc()%256),(int)(tmbHeader->L1ANumber()%256));
00524   
00525             if (getCSCHisto(h::CSC_TMB_ALCT_L1A_DIFF, crateID, dmbID, mo)) {
00526               int clct_alct_l1a_diff = (int)(tmbHeader->L1ANumber() - alctHeader->L1Acc());
00527               if(clct_alct_l1a_diff < -2048) mo->Fill(clct_alct_l1a_diff + 4096);
00528               else {
00529                 if(clct_alct_l1a_diff > 2048)  mo->Fill(clct_alct_l1a_diff - 4096);
00530                 else mo->Fill(clct_alct_l1a_diff);
00531               }
00532               mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
00533             }
00534           } else {
00535             LOG_ERROR << cscTag << " Can not unpack TMB Header";
00536           }
00537     
00538         } else {
00539           LOG_ERROR << cscTag << " Can not unpack TMB Data";
00540         }
00541       } else {
00542         LOG_ERROR << cscTag << " Can not unpack ALCT Header";
00543       }
00544     }
00545   
00546     //CLCT Found
00547     if (data.nclct()) {
00548   
00549       //LOG_WARN << "TMB CRC calc: 0x" << hex << data.tmbData().TMBCRCcalc() << " trailer: 0x" << hex << data.tmbData().tmbTrailer().crc22();
00550   
00551       CSCTMBData* tmbData = data.tmbData();
00552       if (tmbData) {
00553   
00554         CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
00555         CSCTMBTrailer* tmbTrailer = tmbData->tmbTrailer();
00556   
00557         if (tmbHeader && tmbTrailer) {
00558   
00559           CSCCLCTData* clctData = data.clctData();
00560   
00561           std::vector<CSCCLCTDigi> clctsDatasTmp = tmbHeader->CLCTDigis(detRawId);
00562           std::vector<CSCCLCTDigi> clctsDatas;
00563   
00564           for (uint32_t lct = 0; lct < clctsDatasTmp.size(); lct++) {
00565             if (clctsDatasTmp[lct].isValid()) clctsDatas.push_back(clctsDatasTmp[lct]);
00566           }
00567   
00568           FEBunpacked = FEBunpacked +1;
00569           tmb_unpacked = 1;
00570   
00571           if (getCSCHisto(h::CSC_ALCT_MATCH_TIME, crateID, dmbID, mo)) mo->Fill(tmbHeader->ALCTMatchTime());
00572   
00573           if (getCSCHisto(h::CSC_LCT_MATCH_STATUS, crateID, dmbID, mo)) {
00574             if (tmbHeader->CLCTOnly()) mo->Fill(0.0,0.0);
00575             if (tmbHeader->ALCTOnly()) mo->Fill(0.0,1.0);
00576             if (tmbHeader->TMBMatch()) mo->Fill(0.0,2.0);
00577           }
00578     
00579           if (getCSCHisto(h::CSC_LCT0_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn0Diff());
00580           if (getCSCHisto(h::CSC_LCT1_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn1Diff());
00581   
00582           if ((tmb_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
00583             mo->Fill(1.0, 0.0);
00584           }
00585   
00586           // Set number of CLCT-events to forth bin
00587           if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
00588             mo->Fill(3);
00589             uint32_t CLCTEvent = (uint32_t)mo->GetBinContent(4);
00590             trigCnts["CLCT"] = CLCTEvent;
00591             if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
00592               if(config->getNEvents() > 0) {
00593                 mo->SetBinContent(2,((float)CLCTEvent/(float)(DMBEvents)*100.0));
00594                 mo->SetEntries(DMBEvents);
00595               }
00596             }
00597           }
00598   
00599           if (getCSCHisto(h::CSC_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber());
00600   
00601           // Use 6-bit L1A
00602           if (getCSCHisto(h::CSC_CLCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
00603             int clct_dmb_l1a_diff = (int)((tmbHeader->L1ANumber() % 64)-dmbHeader->l1a() % 64);
00604             if (clct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
00605             if(clct_dmb_l1a_diff < -32) mo->Fill(clct_dmb_l1a_diff + 64);
00606             else {
00607               if(clct_dmb_l1a_diff > 32)  mo->Fill(clct_dmb_l1a_diff - 64);
00608               else mo->Fill(clct_dmb_l1a_diff);
00609             }
00610             mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
00611           }
00612   
00613           // if (getCSCHisto(h::CSC_DMB_L1A_VS_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber(),dmbHeader->l1a());
00614           if (getCSCHisto(h::CSC_DMB_L1A_VS_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber()%256,dmbHeader->l1a());
00615   
00616           if (getCSCHisto(h::CSC_CLCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
00617             int clct_dmb_bxn_diff = (int)(tmbHeader->BXNCount()%64-dmbHeader->bxn12()%64);
00618             if(clct_dmb_bxn_diff < -32) mo->Fill(clct_dmb_bxn_diff + 64);
00619             else {
00620               if(clct_dmb_bxn_diff > 32)  mo->Fill(clct_dmb_bxn_diff - 64);
00621               else mo->Fill(clct_dmb_bxn_diff);
00622             }
00623             mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
00624           }
00625   
00626           if (getCSCHisto(h::CSC_CLCT_BXN, crateID, dmbID, mo)) mo->Fill((int)(tmbHeader->BXNCount()));
00627   
00628           // if (getCSCHisto(h::CSC_CLCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill(tmbHeader->BXNCount(),dmbHeader->bxn());
00629           if (getCSCHisto(h::CSC_CLCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill(tmbHeader->BXNCount()%256,dmbHeader->bxn12()%256);
00630   
00631           if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
00632             mo->Fill(clctsDatas.size());
00633             int nCLCT = (int)mo->GetBinContent((int)(clctsDatas.size()+1));
00634             if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent((int)(clctsDatas.size() + 1), (float)(nCLCT) / (float)(DMBEvents) * 100.0);
00635           }
00636     
00637           if (clctsDatas.size() == 1) {
00638             if (getCSCHisto(h::CSC_CLCT0_CLSSIFICATION, crateID, dmbID, mo)) {
00639               if (clctsDatas[0].getStripType()) mo->Fill(0.0);
00640               else mo->Fill(1.0);
00641             }
00642           }
00643       
00644           if (clctsDatas.size() == 2) {
00645             if (getCSCHisto(h::CSC_CLCT1_VS_CLCT0_KEY_STRIP, crateID, dmbID, mo)) 
00646               mo->Fill(clctsDatas[0].getKeyStrip(),clctsDatas[1].getKeyStrip());
00647             if (getCSCHisto(h::CSC_CLCT0_CLCT1_CLSSIFICATION, crateID, dmbID, mo)) {
00648               if ( clctsDatas[0].getStripType() &&  clctsDatas[1].getStripType())       mo->Fill(0.0);
00649               if ( clctsDatas[0].getStripType() && !clctsDatas[1].getStripType())       mo->Fill(1.0);
00650               if (!clctsDatas[0].getStripType() &&  clctsDatas[1].getStripType())       mo->Fill(2.0);
00651               if (!clctsDatas[0].getStripType() &&  !clctsDatas[1].getStripType())      mo->Fill(3.0);
00652             }
00653           }
00654   
00655           if (getCSCHisto(h::CSC_TMB_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(tmbTrailer->wordCount()));
00656           //LOG_DEBUG <<  "TMB Trailer Word Count = " << dec << (int)tmbTrailer->wordCount();
00657     
00658           for (uint32_t lct = 0; lct < clctsDatas.size(); lct++) {
00659   
00660           if (getCSCHisto(h::CSC_CLCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getBX());
00661   
00662           int clct_dtime = (int)(clctsDatas[lct].getBX() - (tmbHeader->BXNCount()&0x3));
00663           if (getCSCHisto(h::CSC_CLCTXX_DTIME, crateID, dmbID, lct, mo)) {
00664               if(clct_dtime < -2) mo->Fill(clct_dtime + 4);
00665             else {
00666               if(clct_dtime > 2)  mo->Fill(clct_dtime - 4);
00667               else mo->Fill(clct_dtime);
00668             }
00669             mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
00670           }
00671   
00672           //LOG_DEBUG << "CLCT BX = " << clctsDatas[lct].getBX() << " TMB BX = " << tmbHeader->BXNCount() << " 03 = " << (int)(tmbHeader->BXNCount()&0x3);
00673           //LOG_DEBUG <<  "diff = " << clctsDatas[lct].getBX()-(tmbHeader->BXNCount()&0x3);
00674           //LOG_DEBUG <<  "LCT:" << lct << " Type:" << clctsDatas[lct].getStripType() << " Strip:" << clctsDatas[lct].getKeyStrip();
00675           
00676           if (clctsDatas[lct].getStripType()) { // HalfStrip Type
00677             if (getCSCHisto(h::CSC_CLCTXX_KEYHALFSTRIP, crateID, dmbID, lct, mo)) 
00678               mo->Fill(clctsDatas[lct].getKeyStrip());
00679             if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_HALF_STRIP, crateID, dmbID, lct, mo)) {
00680               if(clct_dtime < -2) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 4);
00681               else {
00682                 if(clct_dtime > 2) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 4);
00683                 else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
00684               }
00685             }
00686     
00687             if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_PATTERN, crateID, dmbID, lct, mo)) {
00688               int pattern_clct = clctsDatas[lct].getPattern();
00689               // int pattern_clct = (int)((clctsDatas[lct].getPattern()>>1)&0x3);
00690               // pattern_clct = Number of patterns in CLCT
00691               // Last (left) bit is bend. Positive bend = 1, negative bend = 0
00692               double tbin = -1;
00693               switch (pattern_clct) {
00694                 case 0:  tbin=0.; break;
00695                 case 1:  tbin=1.; break;
00696                 case 2:  tbin=2.; break;
00697                 case 3:  tbin=10.; break;
00698                 case 4:  tbin=3.; break;
00699                 case 5:  tbin=9.; break;
00700                 case 6:  tbin=4.; break;
00701                 case 7:  tbin=8.; break;
00702                 case 8:  tbin=5.; break;
00703                 case 9:  tbin=7.; break;
00704                 case 10: tbin=6.; break;
00705               }
00706               if (tbin >= 0) mo->Fill(clctsDatas[lct].getKeyStrip(), tbin);
00707             }
00708   
00709             if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY, crateID, dmbID, lct, mo)) 
00710               mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
00711   
00712             if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
00713               mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
00714   
00715           } else { // DiStrip Type
00716   
00717             if (getCSCHisto(h::CSC_CLCTXX_KEYDISTRIP, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getKeyStrip());
00718     
00719             if(lct == 0) clct_kewdistrip = clctsDatas[lct].getKeyStrip();
00720   
00721             if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_DISTRIP, crateID, dmbID, lct, mo)) {
00722               if(clct_dtime < -2) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 4);
00723               else {
00724                 if(clct_dtime > 2) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 4);
00725                 else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
00726               }
00727             }
00728     
00729             if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_PATTERN, crateID, dmbID, lct, mo)) {
00730               int pattern_clct = (int)((clctsDatas[lct].getPattern() >> 1) & 0x3);
00731               // pattern_clct = Number of patterns in CLCT
00732               // Last (left) bit is bend. Positive bend = 1, negative bend = 0
00733               if(pattern_clct == 1) mo->Fill(clctsDatas[lct].getKeyStrip(), 7.0);
00734               if(pattern_clct == 3) mo->Fill(clctsDatas[lct].getKeyStrip(), 6.0);
00735               if(pattern_clct == 5) mo->Fill(clctsDatas[lct].getKeyStrip(), 5.0);
00736               if(pattern_clct == 7) mo->Fill(clctsDatas[lct].getKeyStrip(), 4.0);
00737               if(pattern_clct == 6) mo->Fill(clctsDatas[lct].getKeyStrip(), 3.0);
00738               if(pattern_clct == 4) mo->Fill(clctsDatas[lct].getKeyStrip(), 2.0);
00739               if(pattern_clct == 2) mo->Fill(clctsDatas[lct].getKeyStrip(), 1.0);
00740               if(pattern_clct == 0) mo->Fill(clctsDatas[lct].getKeyStrip(), 0.0);
00741             }
00742   
00743             if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY, crateID, dmbID, lct, mo)) 
00744               mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
00745   
00746             if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
00747               mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
00748           }
00749         }
00750       
00751         int N_CFEBs = 5;
00752   
00753         int NumberOfLayersWithHitsInCLCT = 0;
00754         int NumberOfHalfStripsWithHitsInCLCT = 0;
00755 
00756         if (clctData && clctData->check()) {
00757           for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {   
00758             for (int nLayer = 1; nLayer <= 6; nLayer++) {
00759               int hstrip_previous    = -1;
00760               int tbin_clct_previous = -1;
00761               bool CheckLayerCLCT = true;
00762               std::vector<CSCComparatorDigi> compOutData = clctData->comparatorDigis(nLayer, nCFEB);
00763               for (std::vector<CSCComparatorDigi>::iterator compOutDataItr = compOutData.begin(); compOutDataItr != compOutData.end(); ++compOutDataItr) {
00764                 // =VB= Fix to get right hafstrip
00765                 int hstrip = 2 * (compOutDataItr->getStrip() - 1) + compOutDataItr->getComparator();
00766                 std::vector<int> tbins_clct = compOutDataItr->getTimeBinsOn();
00767                 int tbin_clct = (int)compOutDataItr->getTimeBin();
00768                 if(CheckLayerCLCT) {
00769                   NumberOfLayersWithHitsInCLCT = NumberOfLayersWithHitsInCLCT + 1;
00770                   CheckLayerCLCT = false;
00771                 }
00772   
00773                 for (uint32_t n=0; n < tbins_clct.size(); n++) {
00774                   tbin_clct = tbins_clct[n];
00775                   if(hstrip != hstrip_previous || (tbin_clct != tbin_clct_previous + 1 && tbin_clct != tbin_clct_previous - 1) ) {
00776                     if (getCSCHisto(h::CSC_CLCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);
00777                     if (getCSCHisto(h::CSC_CLCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);
00778                     if (getCSCHisto(h::CSC_CLCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) { 
00779                       mo->Fill(hstrip);
00780   
00781                       double number_hstrip = mo->GetBinContent(hstrip+1);
00782                       double Number_of_entries_CLCT = mo->GetEntries();
00783        
00784                       if (getCSCHisto(h::CSC_CLCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
00785                         mo->SetBinContent(hstrip + 1, number_hstrip);
00786                         if(DMBEvents > 0) {
00787                           double norm = (100.0 * Number_of_entries_CLCT) / ((double)(DMBEvents));
00788                           // if (norm < 1.0) norm=1;
00789                           mo->SetNormFactor(norm);
00790                         } else {
00791                           mo->SetNormFactor(100.0);
00792                         }
00793                         mo->SetEntries(DMBEvents);
00794                       }
00795                     }
00796                   }
00797       
00798                   if(hstrip != hstrip_previous) {
00799                     NumberOfHalfStripsWithHitsInCLCT = NumberOfHalfStripsWithHitsInCLCT + 1;
00800                   }
00801                   hstrip_previous    = hstrip;
00802                   tbin_clct_previous = tbin_clct;
00803                 }
00804               }
00805             }
00806           }
00807         } else {
00808           LOG_ERROR << cscTag << " Can not unpack CLCT Data";
00809         }
00810 
00811         if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) 
00812           mo->Fill(NumberOfLayersWithHitsInCLCT);
00813         if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_HALFSTRIPS_WITH_HITS, crateID, dmbID, mo)) 
00814           mo->Fill(NumberOfHalfStripsWithHitsInCLCT);
00815         } else {
00816           LOG_ERROR << cscTag << " Can not unpack TMB Header or/and Trailer";
00817         }
00818       } else {
00819         LOG_ERROR << cscTag << " Can not unpack TMB Data";
00820       }
00821   
00822     } else {
00823       //  CLCT not found
00824   
00825       if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
00826         mo->Fill(0);
00827         int nCLCT = (int)mo->GetBinContent(1);
00828         if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent(1, (float)(nCLCT) / (float)(DMBEvents) * 100.0);
00829       }    
00830       if ((tmb_dav  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
00831         mo->Fill(1.0, 1.0);
00832       }
00833     }
00834 
00835     // CFEB found
00836     int NumberOfUnpackedCFEBs = 0;
00837     const int N_CFEBs = 5, N_Samples = 16, N_Layers = 6, N_Strips = 16;
00838     int ADC = 0, OutOffRange, Threshold = 30;
00839     // bool DebugCFEB = false;
00840     CSCCFEBData * cfebData[5];
00841     CSCCFEBTimeSlice *  timeSlice[5][16];
00842     CSCCFEBDataWord * timeSample[5][16][6][16];
00843     int Pedestal[5][6][16];
00844     std::pair<int,int> CellPeak[5][6][16];
00845     memset(CellPeak, 0, sizeof(CellPeak));
00846     float PedestalError[5][6][16];
00847     CSCCFEBSCAControllerWord scaControllerWord[5][16][6];
00848     bool CheckCFEB = true;
00849     //--------------B
00850     float Clus_Sum_Charge;
00851     int TrigTime, L1APhase, UnpackedTrigTime, LCTPhase, SCA_BLK, NmbTimeSamples;
00852     // int NmbCell, SCA_Nmb_FC;
00853     int  FreeCells, LCT_Pipe_Empty, LCT_Pipe_Full, LCT_Pipe_Count, L1_Pipe_Empty, L1_Pipe_Full, Buffer_Count;
00854     //--------------E
00855   
00856     bool CheckThresholdStripInTheLayer[6][80];
00857     for(int i=0; i<6; i++) {
00858       for(int j = 0; j < 80; j++) CheckThresholdStripInTheLayer[i][j] = true;
00859     }
00860     
00861     bool CheckOutOffRangeStripInTheLayer[6][80];  
00862     for(int i=0; i<6; i++) {
00863       for(int j=0; j<80; j++) CheckOutOffRangeStripInTheLayer[i][j] = true;
00864     }
00865   
00866     //--------------B
00867     float cscdata[N_CFEBs * 16][N_Samples][N_Layers];
00868   //  int TrigTimeData[N_CFEBs*16][N_Samples][N_Layers];
00869     int SCABlockData[N_CFEBs * 16][N_Samples][N_Layers];
00870     memset(cscdata, 0, sizeof(cscdata));
00871   //  memset(TrigTimeData, 0, sizeof(TrigTimeData));
00872     memset(SCABlockData, 0, sizeof(SCABlockData));
00873     //--------------E
00874     
00875     char hbuf[255];
00876     memset(hbuf, 0, sizeof(hbuf));
00877   
00878     for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {
00879       cfebData[nCFEB] = data.cfebData(nCFEB);
00880       if (cfebData[nCFEB] !=0) {
00881         if (!cfebData[nCFEB]->check()) continue;
00882         //                        CFEB Found
00883         FEBunpacked = FEBunpacked +1; // Increment number of unpacked FED
00884         NumberOfUnpackedCFEBs = NumberOfUnpackedCFEBs + 1; // Increment number of unpaked CFEB
00885         cfeb_unpacked = 1;
00886         if(CheckCFEB == true){
00887           if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
00888             mo->Fill(4);
00889             uint32_t CFEBEvent = (uint32_t)mo->GetBinContent(5);
00890             trigCnts["CFEB"] = CFEBEvent;
00891             if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
00892               if(config->getNEvents() > 0) {
00893                 mo->SetBinContent(3, ((float)CFEBEvent/(float)(DMBEvents)*100.0));
00894                 mo->SetEntries((int)DMBEvents);
00895               }
00896             }
00897           }
00898   
00899           if ((cfeb_dav2  > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
00900             mo->Fill(2.0, 0.0);
00901           }
00902           CheckCFEB = false;
00903         }
00904         //-------------B
00905         NmbTimeSamples= (cfebData[nCFEB])->nTimeSamples();
00906         //-------------E
00907         //LOG_DEBUG <<  "NEvents = " << config->getNEvents();
00908         //LOG_DEBUG <<  "Chamber ID = "<< cscTag << " Crate ID = "<< crateID << " DMB ID = " << dmbID << "nCFEB =" << nCFEB;
00909   
00910         // =VB= Optimizations for faster histogram object access 
00911         MonitorObject* mo_CFEB_SCA_Block_Occupancy = 0;
00912         getCSCHisto(h::CSC_CFEBXX_SCA_BLOCK_OCCUPANCY, crateID, dmbID, nCFEB, mo_CFEB_SCA_Block_Occupancy);
00913         MonitorObject*  mo_CFEB_Free_SCA_Cells = 0;      
00914         getCSCHisto(h::CSC_CFEBXX_FREE_SCA_CELLS, crateID, dmbID, nCFEB, mo_CFEB_Free_SCA_Cells);
00915         MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTs = 0;
00916         getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTS, crateID, dmbID, nCFEB, mo_CFEB_SCA_Blocks_Locked_by_LCTs);
00917         MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTxL1 = 0;
00918         getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTXL1, crateID, dmbID, nCFEB, mo_CFEB_SCA_Blocks_Locked_by_LCTxL1);
00919         MonitorObject* mo_CFEB_DMB_L1A_diff = 0;
00920         getCSCHisto(h::CSC_CFEBXX_DMB_L1A_DIFF, crateID, dmbID, nCFEB, mo_CFEB_DMB_L1A_diff);
00921         
00922         //LOG_DEBUG << " nSample = " << nSample;
00923   
00924         for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
00925           //  =VB= Optimizations for faster histogram object access
00926           MonitorObject * mo_CFEB_Out_Off_Range_Strips = 0;
00927           getCSCHisto(h::CSC_CFEB_OUT_OFF_RANGE_STRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_Out_Off_Range_Strips);
00928           MonitorObject * mo_CFEB_Active_Samples_vs_Strip = 0;
00929           getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip);
00930           MonitorObject * mo_CFEB_Active_Samples_vs_Strip_Profile = 0;
00931           getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX_PROFILE, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip_Profile);
00932           MonitorObject * mo_CFEB_ActiveStrips = 0;
00933           getCSCHisto(h::CSC_CFEB_ACTIVESTRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_ActiveStrips);
00934           MonitorObject * mo_CFEB_SCA_Cell_Peak = 0;
00935           getCSCHisto(h::CSC_CFEB_SCA_CELL_PEAK_LY_XX, crateID, dmbID, nLayer, mo_CFEB_SCA_Cell_Peak);
00936   
00937           MonitorObject * mo_CFEB_Pedestal_withEMV_Sample = 0;
00938           getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHEMV_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withEMV_Sample);
00939           MonitorObject * mo_CFEB_Pedestal_withRMS_Sample = 0;
00940           getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withRMS_Sample);
00941           MonitorObject * mo_CFEB_PedestalRMS_Sample = 0;
00942           getCSCHisto(h::CSC_CFEB_PEDESTALRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_PedestalRMS_Sample);
00943   
00944           for(int nSample = 0; nSample < NmbTimeSamples; ++nSample) {
00945             timeSlice[nCFEB][nSample] = (CSCCFEBTimeSlice * )((cfebData[nCFEB])->timeSlice(nSample));
00946             if (timeSlice[nCFEB][nSample] == 0) {
00947               LOG_WARN <<  "CFEB" << nCFEB << " nSample: " << nSample << " - B-Word";
00948               continue;
00949             }
00950   
00951             if (mo_CFEB_DMB_L1A_diff && !fCloseL1As ) {
00952               // if (mo_CFEB_DMB_L1A_diff) 
00953               int cfeb_dmb_l1a_diff = (int)((timeSlice[nCFEB][nSample]->get_L1A_number())-dmbHeader->l1a()%64);
00954               if (cfeb_dmb_l1a_diff != 0) { 
00955                 L1A_out_of_sync = true;
00956               }
00957               if(cfeb_dmb_l1a_diff < -32) mo->Fill(cfeb_dmb_l1a_diff + 64);
00958               else {
00959                 if(cfeb_dmb_l1a_diff > 32) mo->Fill(cfeb_dmb_l1a_diff - 64);
00960                 else mo_CFEB_DMB_L1A_diff->Fill(cfeb_dmb_l1a_diff);
00961               }
00962               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");
00963             }
00964     
00965             // LOG_DEBUG <<  " nSample = " << nSample;
00966             // for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) 
00967             scaControllerWord[nCFEB][nSample][nLayer-1] = (timeSlice[nCFEB][nSample])->scaControllerWord(nLayer);
00968   
00969             TrigTime = (int)(scaControllerWord[nCFEB][nSample][nLayer-1]).trig_time;
00970             //--------------B
00971             FreeCells = (timeSlice[nCFEB][nSample])->get_n_free_sca_blocks();
00972             LCT_Pipe_Empty = (timeSlice[nCFEB][nSample])->get_lctpipe_empty();
00973             LCT_Pipe_Full = (timeSlice[nCFEB][nSample])->get_lctpipe_full();
00974             LCT_Pipe_Count = (timeSlice[nCFEB][nSample])->get_lctpipe_count();
00975             L1_Pipe_Empty = (timeSlice[nCFEB][nSample])->get_l1pipe_empty();
00976             L1_Pipe_Full = (timeSlice[nCFEB][nSample])->get_l1pipe_full();
00977             // L1_Pipe_Count = (timeSlice[nCFEB][nSample])->get_L1A_number();
00978             Buffer_Count = (timeSlice[nCFEB][nSample])->get_buffer_count();
00979       
00980             SCA_BLK  = (int)(scaControllerWord[nCFEB][nSample][nLayer-1]).sca_blk;
00981             // LOG_DEBUG <<  "SCA BLOCK: Chamber=" << chamberID << " CFEB=" << nCFEB + 1
00982             //  <<" TRIGTIME="<<TrigTime<<" TimeSlice="<<nSample+1<<" Layer="<<nLayer<<" SCA_BLK="<<SCA_BLK;
00983       
00984             for(int nStrip = 0; nStrip < N_Strips; ++nStrip) {
00985               SCABlockData[nCFEB*16+nStrip][nSample][nLayer-1] = SCA_BLK;
00986               // if(res<=1) TrigTimeData[nCFEB*16+nStrip][nSample][nLayer-1] = TrigTime;
00987             }
00988             //LOG_DEBUG << "*********"<<" TRIGTIME="<<TrigTime<<" BIT COUNT="<<bit_count;
00989   
00990             // SCA Block Occupancy Histograms
00991             // if (getCSCHisto(h::CSC_CFEBXX_SCA_BLOCK_OCCUPANCY, crateID, dmbID, nCFEB, mo)) mo->Fill(SCA_BLK);
00992             if (mo_CFEB_SCA_Block_Occupancy) mo_CFEB_SCA_Block_Occupancy->Fill(SCA_BLK);
00993   
00994             // Free SCA Cells
00995             // if (getCSCHisto(h::CSC_CFEBXX_FREE_SCA_CELLS, crateID, dmbID, nCFEB, mo)) 
00996             if (mo_CFEB_Free_SCA_Cells) {
00997               if (scaControllerWord[nCFEB][nSample][nLayer-1].sca_full == 1) mo_CFEB_Free_SCA_Cells->Fill(-1);
00998               mo_CFEB_Free_SCA_Cells->Fill(FreeCells);
00999             }
01000   
01001             // Number of SCA Blocks Locked by LCTs
01002             // if (getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTS, crateID, dmbID, nCFEB, mo)) 
01003             if (mo_CFEB_SCA_Blocks_Locked_by_LCTs) {
01004               if (LCT_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(-0.5);
01005               if (LCT_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(16.5);
01006               mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(LCT_Pipe_Count);
01007             }
01008   
01009             // Number of SCA Blocks Locked by LCTxL1
01010             // if (getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTXL1, crateID, dmbID, nCFEB, mo)) 
01011             if (mo_CFEB_SCA_Blocks_Locked_by_LCTxL1) {
01012               if (L1_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(-0.5);
01013               if (L1_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(31.5);
01014               mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(Buffer_Count);
01015             }
01016   
01017             //--------------E
01018             // LOG_DEBUG <<  "nCFEB " << nCFEB << " nSample " << nSample << " nLayer " << nLayer << " TrigTime " << TrigTime;
01019             if(nSample == 0 && nLayer == 1) {
01020               TrigTime = (int)(scaControllerWord[nCFEB][nSample][nLayer - 1]).trig_time;
01021               int k = 1;
01022               while (((TrigTime >> (k-1)) & 0x1) != 1 && k <= 8) {
01023                 k = k + 1;
01024               }
01025               L1APhase = (int)(((scaControllerWord[nCFEB][nSample][nLayer - 1]).l1a_phase) & 0x1);
01026               UnpackedTrigTime = ((k << 1) & 0xE) + L1APhase;
01027   
01028               if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME, crateID, dmbID, nCFEB, mo)) 
01029                 mo->Fill((int)UnpackedTrigTime);
01030               LCTPhase = (int)(((scaControllerWord[nCFEB][nSample][nLayer-1]).lct_phase)&0x1);
01031   
01032               if (getCSCHisto(h::CSC_CFEBXX_LCT_PHASE_VS_L1A_PHASE, crateID, dmbID, nCFEB, mo)) 
01033                 mo->Fill(LCTPhase, L1APhase);
01034   
01035               // LOG_DEBUG <<  "L1APhase " << L1APhase << " UnpackedTrigTime " << UnpackedTrigTime;
01036   
01037               if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_VS_DMB, crateID, dmbID, nCFEB, mo))  
01038                 mo->Fill((int)(dmbHeader->dmbCfebSync()), (int)UnpackedTrigTime);
01039   
01040               if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_DMB_DIFF, crateID, dmbID, nCFEB, mo)) {
01041                 int cfeb_dmb_L1A_sync_time = (int)(dmbHeader->dmbCfebSync()) - (int)UnpackedTrigTime;
01042                 if(cfeb_dmb_L1A_sync_time < -8) mo->Fill(cfeb_dmb_L1A_sync_time+16);
01043                 else {
01044                   if(cfeb_dmb_L1A_sync_time > 8) mo->Fill(cfeb_dmb_L1A_sync_time-16);
01045                   else mo->Fill(cfeb_dmb_L1A_sync_time);
01046                 }
01047                 mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
01048               }
01049   
01050             }
01051   
01052   
01053             for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
01054               timeSample[nCFEB][nSample][nLayer - 1][nStrip - 1]=(data.cfebData(nCFEB)->timeSlice(nSample))->timeSample(nLayer,nStrip);
01055               ADC = (int) ((timeSample[nCFEB][nSample][nLayer - 1][nStrip - 1]->adcCounts) & 0xFFF);
01056               // LOG_DEBUG <<  " nStrip="<< dec << nStrip << " ADC=" << hex << ADC;
01057               OutOffRange = (int) ((timeSample[nCFEB][nSample][nLayer - 1][nStrip - 1]->adcOverflow) & 0x1);
01058   
01059               if(nSample == 0) { // nSample == 0
01060                 CellPeak[nCFEB][nLayer-1][nStrip-1] = std::make_pair(nSample,ADC);
01061                 Pedestal[nCFEB][nLayer-1][nStrip-1] = ADC;
01062                 // LOG_DEBUG <<  " nStrip="<< dec << nStrip << " Pedestal=" << hex << Pedestal[nCFEB][nLayer-1][nStrip-1];
01063               }
01064     
01065               if(OutOffRange == 1 && CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
01066                 // if (getCSCHisto(h::CSC_CFEB_OUT_OFF_RANGE_STRIPS_LYXX, crateID, dmbID, nLayer, mo)) 
01067                 if ( mo_CFEB_Out_Off_Range_Strips)
01068                   mo_CFEB_Out_Off_Range_Strips->Fill((int)(nCFEB * 16 + nStrip));
01069                 CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
01070               }
01071               if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold && OutOffRange != 1) {             
01072                 // if (getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX, crateID, dmbID, nLayer, mo))
01073                 if (mo_CFEB_Active_Samples_vs_Strip)
01074                   mo_CFEB_Active_Samples_vs_Strip->Fill((int)(nCFEB * 16 + nStrip), nSample);
01075   
01076                 // if (getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX_PROFILE, crateID, dmbID, nLayer, mo))
01077                 if (mo_CFEB_Active_Samples_vs_Strip_Profile)
01078                   mo_CFEB_Active_Samples_vs_Strip_Profile->Fill((int)(nCFEB * 16 + nStrip), nSample);
01079   
01080                 if(CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
01081                 // if (getCSCHisto(h::CSC_CFEB_ACTIVESTRIPS_LYXX, crateID, dmbID, nLayer, mo))
01082                   if (mo_CFEB_ActiveStrips)
01083                     mo_CFEB_ActiveStrips->Fill((int)(nCFEB * 16 + nStrip));
01084                   CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
01085                 }
01086                 //--------------B
01087                 if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold) {
01088                   // LOG_DEBUG <<  "Layer="<<nLayer<<" Strip="<<nCFEB*16+nStrip<<" Time="<<nSample << " ADC-PEDEST = "<<ADC - Pedestal[nCFEB][nLayer-1][nStrip-1];
01089                   cscdata[nCFEB * 16 + nStrip - 1][nSample][nLayer - 1] = ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1];
01090                 }       
01091                 //--------------E
01092                 if(ADC > CellPeak[nCFEB][nLayer - 1][nStrip - 1].second) { 
01093                   CellPeak[nCFEB][nLayer - 1][nStrip - 1].first = nSample;
01094                   CellPeak[nCFEB][nLayer - 1][nStrip - 1].second = ADC;
01095                 }
01096               }
01097               // continue;
01098               //--------------B
01099               if(nSample == 1) {
01100                 int channel_threshold = 40;
01101                 if (abs(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1]) < channel_threshold) {
01102                   // if (getCSCHisto(h::CSC_CFEB_PEDESTAL__WITHEMV__SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo))
01103                   if (mo_CFEB_Pedestal_withEMV_Sample)
01104                     mo_CFEB_Pedestal_withEMV_Sample->Fill((int)(nCFEB * 16 + nStrip), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
01105   
01106                   //if (getCSCHisto(h::CSC_CFEB_PEDESTAL__WITHRMS__SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo)) 
01107                   if (mo_CFEB_Pedestal_withRMS_Sample) {  
01108                     mo_CFEB_Pedestal_withRMS_Sample->Fill((int)(nCFEB * 16 + nStrip), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
01109                     PedestalError[nCFEB][nLayer - 1][nStrip - 1] = mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip);
01110   
01111                     // if (getCSCHisto(h::CSC_CFEB_PEDESTALRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo)) 
01112                     if (mo_CFEB_PedestalRMS_Sample) {
01113                       mo_CFEB_PedestalRMS_Sample->SetBinContent(nCFEB * 16 + nStrip,PedestalError[nCFEB][nLayer - 1][nStrip - 1]);
01114                       mo_CFEB_PedestalRMS_Sample->SetBinError(nCFEB * 16 + nStrip, 0.00000000001);
01115                     }
01116                   }
01117                 }
01118               }
01119               //--------------E
01120             }
01121           }
01122 
01123           for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
01124             if (mo_CFEB_SCA_Cell_Peak && CellPeak[nCFEB][nLayer - 1][nStrip - 1].first) 
01125               mo_CFEB_SCA_Cell_Peak->Fill((int)(nCFEB * 16 + nStrip), CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
01126           }
01127 
01128         }
01129       }
01130 
01131       //--------------B
01132       // Refactored for performance (VR)
01133       const int a = N_CFEBs * N_Strips;
01134       const int b = a * N_Samples;
01135       float Cathodes[b * N_Layers];
01136       for(int i = 0; i < N_Layers; ++i) {
01137         const int b1 = i * b;
01138         for(int j = 0; j < a; ++j) {
01139           const int b2 = b1 + j;
01140           for(int k = 0; k < N_Samples; ++k) {
01141             Cathodes[b2 + a * k] = cscdata[j][k][i];
01142           }
01143         }
01144       }
01145       std::vector<StripCluster> Clus;
01146       Clus.clear();
01147       StripClusterFinder ClusterFinder(N_Layers, N_Samples, N_CFEBs, N_Strips);
01148   
01149       for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
01150       
01151         // StripClusterFinder *ClusterFinder = new StripClusterFinder(N_Layers, N_Samples, N_CFEBs, N_Strips);
01152       
01153         ClusterFinder.DoAction(nLayer - 1, Cathodes);
01154         Clus = ClusterFinder.getClusters();
01155 
01156         // LOG_DEBUG <<  "***  CATHODE PART  DEBUG: Layer=" << nLayer <<"  Number of Clusters=" << Clus.size() << "      ***";
01157         // Number of Clusters Histograms
01158         if (getCSCHisto(h::CSC_CFEB_NUMBER_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
01159           if(Clus.size() >= 0)  mo->Fill(Clus.size());
01160         }
01161   
01162         for(uint32_t u = 0; u < Clus.size(); u++){
01163           Clus_Sum_Charge = 0.0;
01164           for(uint32_t k = 0;k < Clus[u].ClusterPulseMapHeight.size(); k++) {
01165             // LOG_DEBUG <<  "Strip: " << Clus[u].ClusterPulseMapHeight[k].channel_+1;
01166             for(int n=Clus[u].LFTBNDTime; n < Clus[u].IRTBNDTime; n++) {
01167               Clus_Sum_Charge = Clus_Sum_Charge + Clus[u].ClusterPulseMapHeight[k].height_[n];
01168             }
01169           }
01170   
01171           // Clusters Charge Histograms
01172           if (getCSCHisto(h::CSC_CFEB_CLUSTERS_CHARGE_LY_XX, crateID, dmbID, nLayer, mo)) 
01173             mo->Fill(Clus_Sum_Charge);
01174   
01175           // Width of Clusters Histograms
01176           if (getCSCHisto(h::CSC_CFEB_WIDTH_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) 
01177             mo->Fill(Clus[u].IRTBNDStrip - Clus[u].LFTBNDStrip + 1);
01178   
01179           // Cluster Duration Histograms
01180           if (getCSCHisto(h::CSC_CFEB_CLUSTER_DURATION_LY_XX, crateID, dmbID, nLayer, mo)) 
01181             mo->Fill(Clus[u].IRTBNDTime - Clus[u].LFTBNDTime + 1);
01182         }
01183   
01184         Clus.clear();
01185     
01186         // delete ClusterFinder;
01187       }
01188     
01189       //--------------E
01190   
01191       // Fill Hisogram for Different Combinations of FEBs Unpacked vs DAV
01192       if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_UNPACKED_VS_DAV, crateID, dmbID, mo)) {
01193         float feb_combination_unpacked = -1.0;
01194         if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 0.0;
01195         if(alct_unpacked >  0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 1.0;
01196         if(alct_unpacked == 0 && tmb_unpacked >  0 && cfeb_unpacked == 0) feb_combination_unpacked = 2.0;
01197         if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked >  0) feb_combination_unpacked = 3.0;
01198         if(alct_unpacked >  0 && tmb_unpacked >  0 && cfeb_unpacked == 0) feb_combination_unpacked = 4.0;
01199         if(alct_unpacked >  0 && tmb_unpacked == 0 && cfeb_unpacked >  0) feb_combination_unpacked = 5.0;
01200         if(alct_unpacked == 0 && tmb_unpacked >  0 && cfeb_unpacked >  0) feb_combination_unpacked = 6.0;
01201         if(alct_unpacked >  0 && tmb_unpacked >  0 && cfeb_unpacked >  0) feb_combination_unpacked = 7.0;
01202         mo->Fill(feb_combination_dav, feb_combination_unpacked);
01203       }
01204   
01205       if((clct_kewdistrip > -1 && alct_keywg > -1) && (getCSCHisto(h::CSC_CLCT0_KEYDISTRIP_VS_ALCT0_KEYWIREGROUP, crateID, dmbID, mo))) {
01206         mo->Fill(alct_keywg, clct_kewdistrip);
01207       }
01208   
01209       if (L1A_out_of_sync && cscType && cscPosition && getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, mo)){
01210         mo->Fill(cscPosition, cscType);
01211       }
01212   
01213       if (L1A_out_of_sync && getEMUHisto(h::EMU_DMB_L1A_OUT_OF_SYNC, mo)){
01214         mo->Fill(crateID, dmbID);
01215       }
01216 
01217     }
01218 
01219   }

void cscdqm::EventProcessor::processDDU ( const CSCDDUEventData data  )  [private]

Definition at line 23 of file CSCDQM_EventProcessor_processDDU.cc.

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

00023                                                                 {
00024     
00025     CSCDDUHeader dduHeader  = dduData.header();
00026     CSCDDUTrailer dduTrailer = dduData.trailer();
00027     if (!dduTrailer.check()) {
00028       // LOG4CPLUS_WARN(logger_,eTag << "Skipped because of DDU Trailer check failed.");
00029       return;
00030     }
00031 
00032     // Only 8bits are significant; format of DDU id is Dxx
00033     int dduID = dduHeader.source_id()&0xFF;
00034 
00035     MonitorObject* mo = 0;
00036 
00037     if (getEMUHisto(h::EMU_ALL_DDUS_IN_READOUT, mo)) {
00038       mo->Fill(dduID);
00039     }
00040 
00041     std::string dduTag = DDUHistoDef::getPath(dduID);
00042 
00043     if (getDDUHisto(h::DDU_BUFFER_SIZE, dduID, mo)) mo->Fill(dduData.size());
00044 
00045     // DDU word counter
00046     int trl_word_count = 0;
00047     trl_word_count = dduTrailer.wordcount();
00048     if (getDDUHisto(h::DDU_WORD_COUNT, dduID, mo)) mo->Fill(trl_word_count );
00049   
00050     //LOG4CPLUS_DEBUG(logger_,dduTag << " Trailer Word (64 bits) Count = " << std::dec << trl_word_count);
00051   
00052     if (trl_word_count > 0) { 
00053       if (getEMUHisto(h::EMU_ALL_DDUS_EVENT_SIZE, mo)) {
00054         mo->Fill(dduID, log10((double)trl_word_count));
00055       }
00056     }
00057     if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_EVENT_SIZE, mo)) {
00058       mo->Fill(dduID, trl_word_count);
00059     }
00060 
00061     fCloseL1As = dduTrailer.reserved() & 0x1; // Get status if Close L1As bit
00062     // if (fCloseL1As) LOG4CPLUS_DEBUG(logger_,eTag << " Close L1As bit is set");
00063 
00064     // DDU Header bunch crossing number (BXN)
00065     BXN = dduHeader.bxnum();
00066     // LOG4CPLUS_WARN(logger_,dduTag << " DDU Header BXN Number = " << std::dec << BXN);
00067     if (getDDUHisto(h::DDU_BXN, dduID, mo)) mo->Fill(BXN);
00068 
00069     // L1A number from DDU Header
00070     int L1ANumber_previous_event = L1ANumbers[dduID];
00071     L1ANumbers[dduID] = (int)(dduHeader.lvl1num());
00072     L1ANumber = L1ANumbers[dduID];
00073     //LOG4CPLUS_DEBUG(logger_,dduTag << " Header L1A Number = " << std::dec << L1ANumber);
00074     int L1A_inc = L1ANumber - L1ANumber_previous_event;
00075     if (!fFirstEvent) {
00076       if (getDDUHisto(h::DDU_L1A_INCREMENT, dduID, mo)) mo->Fill(L1A_inc);
00077       if (getEMUHisto(h::EMU_ALL_DDUS_L1A_INCREMENT, mo)) {
00078         if      (L1A_inc > 100000){ L1A_inc = 19;}
00079         else if (L1A_inc > 30000) { L1A_inc = 18;}
00080         else if (L1A_inc > 10000) { L1A_inc = 17;}
00081         else if (L1A_inc > 3000)  { L1A_inc = 16;}
00082         else if (L1A_inc > 1000)  { L1A_inc = 15;}
00083         else if (L1A_inc > 300)   { L1A_inc = 14;}
00084         else if (L1A_inc > 100)   { L1A_inc = 13;}
00085         else if (L1A_inc > 30)    { L1A_inc = 12;}
00086         else if (L1A_inc > 10)    { L1A_inc = 11;}
00087         mo->Fill(dduID, L1A_inc);
00088       }
00089     }
00090 
00091     // ==     Occupancy and number of DMB (CSC) with Data available (DAV) in header of particular DDU
00092     int dmb_dav_header      = 0;
00093     int dmb_dav_header_cnt  = 0;
00094   
00095     int ddu_connected_inputs= 0;
00096     int ddu_connected_inputs_cnt = 0;
00097   
00098     int csc_error_state     = 0;
00099     int csc_warning_state   = 0;
00100   
00101     //  ==    Number of active DMB (CSC) in header of particular DDU
00102     int dmb_active_header   = 0;
00103   
00104     dmb_dav_header       = dduHeader.dmb_dav();
00105     dmb_active_header    = (int)(dduHeader.ncsc() & 0xF);
00106     csc_error_state      = dduTrailer.dmb_full()  & 0x7FFF; // Only 15 inputs for DDU
00107     csc_warning_state    = dduTrailer.dmb_warn()  & 0x7FFF; // Only 15 inputs for DDU
00108     ddu_connected_inputs = dduHeader.live_cscs();
00109   
00110     //LOG4CPLUS_DEBUG(logger_,dduTag << " Header DMB DAV = 0x" << std::hex << dmb_dav_header);
00111     //LOG4CPLUS_DEBUG(logger_,dduTag << " Header Number of Active DMB = " << std::dec << dmb_active_header);
00112   
00113     double freq = 0;
00114     for (int i = 0; i < 15; ++i) {
00115       if ((dmb_dav_header >> i) & 0x1) {
00116         dmb_dav_header_cnt++;      
00117         if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY_RATE, dduID, mo)) {
00118         mo->Fill(i + 1);
00119         freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
00120           if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo)) 
00121             mo->SetBinContent(i+1,freq);
00122         }
00123         if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WITH_DATA, mo)) {
00124           mo->Fill(dduID, i);
00125         }
00126       }
00127   
00128       if( (ddu_connected_inputs >> i) & 0x1 ){
00129         ddu_connected_inputs_cnt++;
00130         if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS_RATE, dduID, mo)) {
00131         mo->Fill(i + 1);
00132         freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
00133         if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo))
00134             mo->SetBinContent(i + 1, freq);
00135         }
00136         if (getEMUHisto(h::EMU_ALL_DDUS_LIVE_INPUTS, mo)) {
00137           mo->Fill(dduID, i);
00138         }
00139       }
00140   
00141       if( (csc_error_state >> i) & 0x1 ){
00142         if (getDDUHisto(h::DDU_CSC_ERRORS_RATE, dduID, mo)) {
00143         mo->Fill(i + 1);
00144         freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
00145         if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo)) 
00146             mo->SetBinContent(i + 1, freq);
00147         }
00148         if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_ERRORS, mo)) {
00149           mo->Fill(dduID, i + 2);
00150         }
00151       }
00152         
00153       if((csc_warning_state >> i) & 0x1 ){
00154         if (getDDUHisto(h::DDU_CSC_WARNINGS_RATE, dduID, mo)) {
00155         mo->Fill(i + 1);
00156         freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
00157         if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetBinContent(i + 1, freq);
00158         }
00159         if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WARNINGS, mo)) {
00160           mo->Fill(dduID, i + 2);
00161         }
00162       }
00163     }
00164   
00165     if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_LIVE_INPUTS, mo)) {
00166       mo->Fill(dduID, ddu_connected_inputs_cnt);
00167     }
00168   
00169     if (getEMUHisto(h::EMU_ALL_DDUS_AVERAGE_INPUTS_WITH_DATA, mo)) {
00170       mo->Fill(dduID, dmb_dav_header_cnt);
00171     }
00172   
00173     if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_ERRORS, mo)) {
00174       if (csc_error_state > 0) {
00175         mo->Fill(dduID, 1); // Any Input
00176       } else {
00177         mo->Fill(dduID, 0); // No errors
00178       }
00179     }
00180   
00181     if (getEMUHisto(h::EMU_ALL_DDUS_INPUTS_WARNINGS, mo)) {
00182       if (csc_warning_state > 0) {
00183         mo->Fill(dduID, 1); // Any Input
00184       } else { 
00185         mo->Fill(dduID, 0); // No errors
00186       }
00187     }
00188   
00189     if (getDDUHisto(h::DDU_DMB_DAV_HEADER_OCCUPANCY, dduID, mo)) mo->SetEntries(config->getNEvents());
00190     if (getDDUHisto(h::DDU_DMB_CONNECTED_INPUTS, dduID, mo)) mo->SetEntries(config->getNEvents());
00191     if (getDDUHisto(h::DDU_CSC_ERRORS, dduID, mo)) mo->SetEntries(config->getNEvents());
00192     if (getDDUHisto(h::DDU_CSC_WARNINGS, dduID, mo)) mo->SetEntries(config->getNEvents());
00193     if (getDDUHisto(h::DDU_DMB_ACTIVE_HEADER_COUNT, dduID, mo)) mo->Fill(dmb_active_header);
00194     if (getDDUHisto(h::DDU_DMB_DAV_HEADER_COUNT_VS_DMB_ACTIVE_HEADER_COUNT, dduID, mo)) 
00195       mo->Fill(dmb_active_header,dmb_dav_header_cnt);
00196   
00197     // Check binary Error status at DDU Trailer
00198     uint32_t trl_errorstat = dduTrailer.errorstat();
00199     if (dmb_dav_header_cnt == 0) trl_errorstat &= ~0x20000000; // Ignore No Good DMB CRC bit of no DMB is present
00200     // LOG4CPLUS_DEBUG(logger_,dduTag << " Trailer Error Status = 0x" << std::hex << trl_errorstat);
00201     for (int i = 0; i < 32; i++) {
00202       if ((trl_errorstat >> i) & 0x1) {
00203         if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_RATE, dduID, mo)) { 
00204         mo->Fill(i);
00205         double freq = (100.0 * mo->GetBinContent(i + 1)) / config->getNEvents();
00206         if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo)) 
00207             mo->SetBinContent(i+1, freq);
00208         }
00209         if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo)) 
00210           mo->Fill(0.,i);
00211       }
00212     }
00213     if (getEMUHisto(h::EMU_ALL_DDUS_TRAILER_ERRORS, mo)) {
00214       if (trl_errorstat) {
00215         mo->Fill(dduID, 1); // Any Error
00216         for (int i = 0; i < 32; i++) {  
00217         if ((trl_errorstat >> i) & 0x1) {
00218           mo->Fill(dduID, i + 2);
00219         }
00220         }
00221       } else {
00222         mo->Fill(dduID, 0); // No Errors
00223       }
00224     }
00225         
00226     if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_TABLE, dduID, mo)) mo->SetEntries(config->getNEvents());
00227     if (getDDUHisto(h::DDU_TRAILER_ERRORSTAT_FREQUENCY, dduID, mo)) mo->SetEntries(config->getNEvents());
00228   
00229     // Unpack all found CSC
00230     if (config->getPROCESS_CSC()) { 
00231 
00232       std::vector<CSCEventData> chamberDatas;
00233       chamberDatas.clear();
00234       chamberDatas = dduData.cscData();
00235   
00236       int nCSCs = chamberDatas.size();
00237   
00238       for(int i = 0; i < nCSCs; i++) {
00239         config->incNUnpackedDMB();
00240         processCSC(chamberDatas[i], dduID);
00241       }
00242 
00243     }
00244   
00245     if (getDDUHisto(h::DDU_DMB_UNPACKED_VS_DAV, dduID, mo)) mo->Fill(dmb_active_header, config->getNUnpackedDMB());
00246   
00247     fFirstEvent = false;
00248   
00249   }

void cscdqm::EventProcessor::processExaminer ( const uint16_t *  data,
const uint32_t  dataSize,
bool eventDenied 
) [private]

Definition at line 23 of file CSCDQM_EventProcessor_processExaminer.cc.

References binChecker, CSCDCCExaminer::check(), config, cscCntrs, CSCDCCExaminer::dduSourceID(), CSCDCCExaminer::errors(), CSCDCCExaminer::errorsDetailed(), CSCDCCExaminer::errorsForDDU(), cscdqm::MonitorObject::Fill(), cscdqm::MonitorObject::GetBinContent(), getCSCFromMap(), getCSCHisto(), getEMUHisto(), cscdqm::CSCHistoDef::getPath(), i, cscdqm::Configuration::incNEventsBad(), CSCDCCExaminer::listOfDDUs(), mo1, mo2, nDMBEvents, CSCDCCExaminer::nERRORS, CSCDCCExaminer::nSTATUSES, CSCDCCExaminer::payloadDetailed(), cscdqm::MonitorObject::SetBinContent(), cscdqm::MonitorObject::SetEntries(), CSCDCCExaminer::setMask(), cscdqm::MonitorObject::SetMaximum(), CSCDCCExaminer::statusDetailed(), tmp, and CSCDCCExaminer::warnings().

00023                                                                                                        {
00024     
00025     binChecker.setMask(config->getBINCHECK_MASK());
00026     
00027     if (binChecker.check(data, dataSize) < 0) {
00028       // No ddu trailer found - force checker to summarize errors by adding artificial trailer
00029       const uint16_t dduTrailer[4] = { 0x8000, 0x8000, 0xFFFF, 0x8000 };
00030       const uint16_t *tmp = dduTrailer;
00031       binChecker.check(tmp, uint32_t(4));
00032     }
00033 
00034     uint32_t binErrorStatus = binChecker.errors();
00035     uint32_t binWarningStatus = binChecker.warnings();
00036 
00037     MonitorObject* mo = 0;
00038     if (getEMUHisto(h::EMU_ALL_DDUS_FORMAT_ERRORS, mo)) {
00039 
00040       std::vector<int> DDUs = binChecker.listOfDDUs();
00041       for (std::vector<int>::iterator ddu_itr = DDUs.begin(); ddu_itr != DDUs.end(); ++ddu_itr) {
00042         if (*ddu_itr != 0xFFF) {
00043           long errs = binChecker.errorsForDDU(*ddu_itr);
00044           int dduID = (*ddu_itr)&0xFF;
00045           if (errs != 0) {
00046             for(int i = 0; i < binChecker.nERRORS; i++) { 
00047               if ((errs >> i) & 0x1 ) {
00048                 mo->Fill(dduID, i + 1);
00049               }
00050             }
00051           }
00052         }
00053       }
00054 
00055       /* Temporary tweak for cases when there were no DDU errors  */
00056       if (binChecker.errors() == 0) {
00057         int dduID = binChecker.dduSourceID() & 0xFF;
00058         mo->Fill(dduID, 0);
00059       }
00060 
00061     }
00062         
00063     if ((binErrorStatus & config->getDDU_BINCHECK_MASK()) > 0) {
00064       eventDenied = true;
00065     }
00066 
00067     if ( (binErrorStatus != 0) || (binWarningStatus != 0) ) {
00068       config->incNEventsBad();
00069     }
00070 
00071     std::map<int,long> payloads = binChecker.payloadDetailed();
00072 
00073     for(std::map<int,long>::const_iterator chamber=payloads.begin(); chamber!=payloads.end(); chamber++) {
00074 
00075       int chamberID = chamber->first;
00076       int crateID = (chamberID >> 4) & 0xFF;
00077       int dmbSlot = chamberID & 0xF;
00078       
00079       std::string cscTag = CSCHistoDef::getPath(crateID, dmbSlot);
00080 
00081       if (crateID == 255) { continue; }
00082 
00083       // Update counters
00084       nDMBEvents[cscTag]++;
00085       CSCCounters& trigCnts = cscCntrs[cscTag];
00086       trigCnts["DMB"] = nDMBEvents[cscTag];
00087 
00088       long DMBEvents = nDMBEvents[cscTag];
00089 
00090       if (getEMUHisto(h::EMU_DMB_REPORTING, mo)) {
00091         mo->Fill(crateID, dmbSlot);
00092       }
00093 
00094       unsigned int cscType   = 0;
00095       unsigned int cscPosition = 0;
00096       if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
00097 
00098       if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_REPORTING, mo)) {
00099         mo->Fill(cscPosition, cscType);
00100       }
00101 
00102       // Get FEBs Data Available Info
00103       long payload = chamber->second;
00104       int cfeb_dav = (payload >> 7) & 0x1F;
00105       int cfeb_active = payload & 0x1F;
00106       int alct_dav = (payload >> 5) & 0x1;
00107       int tmb_dav = (payload >> 6) & 0x1; 
00108       int cfeb_dav_num = 0;
00109       
00110       if (alct_dav == 0) {
00111         if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_ALCT, mo)) {
00112           mo->Fill(cscPosition, cscType);
00113         }
00114         if (getEMUHisto(h::EMU_DMB_WO_ALCT, mo)) {
00115           mo->Fill(crateID, dmbSlot);
00116         }
00117       }
00118      
00119       if (tmb_dav == 0) {
00120         if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CLCT, mo)) {
00121           mo->Fill(cscPosition, cscType);
00122         }
00123         if (getEMUHisto(h::EMU_DMB_WO_CLCT, mo)) {
00124           mo->Fill(crateID, dmbSlot);
00125         }
00126       }
00127 
00128       if (cfeb_dav == 0) {
00129         if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CFEB, mo)) {
00130           mo->Fill(cscPosition, cscType);
00131         }
00132         if (getEMUHisto(h::EMU_DMB_WO_CFEB, mo)) {
00133           mo->Fill(crateID, dmbSlot);
00134         }
00135       }
00136       
00137       MonitorObject *mof = 0, *mo1 = 0, *mo2 = 0;
00138       if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, crateID, dmbSlot, mo)
00139           && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, crateID, dmbSlot, mof)) {
00140         if (getCSCHisto(h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
00141             && getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbSlot, mo2)) {
00142           for (int i=1; i<=5; i++) {
00143             double actual_dav_num = mo->GetBinContent(i);
00144             double unpacked_dav_num = mo2->GetBinContent(i);
00145             if (actual_dav_num){
00146               mo1->SetBinContent(i,1, 100.*(1-unpacked_dav_num/actual_dav_num));
00147             }                              
00148             mo1->SetEntries((int)DMBEvents);
00149           }
00150         }       
00151         for (int i=0; i<5;i++) {
00152           int cfeb_present = (cfeb_dav>>i) & 0x1;
00153           cfeb_dav_num += cfeb_present;
00154           if (cfeb_present) {
00155             mo->Fill(i);
00156           }
00157           float cfeb_entries = mo->GetBinContent(i+1);
00158           mof->SetBinContent(i+1, ((float)cfeb_entries/(float)(DMBEvents)*100.0));
00159         }
00160         mof->SetEntries((int)DMBEvents);
00161 
00162       }
00163       
00164       if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_RATE, crateID, dmbSlot, mo)
00165           && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_FREQUENCY, crateID, dmbSlot, mof)) {
00166         for (unsigned short i = 1; i < 7; i++) {
00167           float cfeb_entries =  mo->GetBinContent(i);
00168           mof->SetBinContent(i, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
00169         }
00170         mof->SetEntries((int)DMBEvents);
00171 
00172         if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
00173             && getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbSlot, mo2)) {     
00174           for (unsigned short i = 1; i < 7; i++) {
00175             float actual_dav_num = mo->GetBinContent(i);
00176             float unpacked_dav_num = mo2->GetBinContent(i);
00177             if (actual_dav_num){
00178               mo1->SetBinContent(i, 1, 100. * (1-unpacked_dav_num/actual_dav_num));
00179             }                              
00180             mo1->SetEntries((int)DMBEvents);
00181           }
00182         }       
00183         mo->Fill(cfeb_dav_num);
00184       }
00185 
00186       if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbSlot, mo)) mo->Fill(cfeb_dav, cfeb_active);
00187 
00188       // Fill Histogram for FEB DAV Efficiency
00189       if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo)) {
00190         if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
00191           for (int i = 1; i < 4; i++) {
00192             float dav_num = mo->GetBinContent(i);
00193             mo1->SetBinContent(i, ((float)dav_num / (float)(DMBEvents) * 100.0));
00194           }
00195           mo1->SetEntries((int)DMBEvents);
00196 
00197           if (getCSCHisto(h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
00198               && getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo2)) {    
00199             for (int i = 1; i < 4; i++) {
00200               float actual_dav_num = mo->GetBinContent(i);
00201               float unpacked_dav_num = mo2->GetBinContent(i);
00202               if (actual_dav_num){
00203                 mof->SetBinContent(i,1, 100. * (1 - unpacked_dav_num / actual_dav_num));
00204               }                            
00205               mof->SetEntries((int)DMBEvents);
00206               mof->SetMaximum(100.0);
00207             }
00208           }       
00209         }
00210 
00211         if (alct_dav > 0) {
00212           mo->Fill(0.0);
00213         }
00214         if (tmb_dav > 0) {
00215           mo->Fill(1.0);
00216         }
00217         if (cfeb_dav > 0) {
00218           mo->Fill(2.0);
00219         }
00220       }
00221       
00222 
00223       float feb_combination_dav = -1.0;
00224       // Fill Histogram for Different Combinations of FEB DAV Efficiency
00225       if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo)) {
00226         if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 0.0; // Nothing
00227         if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 1.0; // ALCT Only
00228         if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav == 0) feb_combination_dav = 2.0; // TMB Only
00229         if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav >  0) feb_combination_dav = 3.0; // CFEB Only
00230         if(alct_dav == 0 && tmb_dav >  0 && cfeb_dav >  0) feb_combination_dav = 4.0; // TMB+CFEB
00231         if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav == 0) feb_combination_dav = 5.0; // ALCT+TMB
00232         if(alct_dav >  0 && tmb_dav == 0 && cfeb_dav >  0) feb_combination_dav = 6.0; // ALCT+CFEB
00233         if(alct_dav >  0 && tmb_dav >  0 && cfeb_dav >  0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
00234         // mo->Fill(feb_combination_dav);
00235 
00236         if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
00237           for (int i = 1; i < 9; i++) {
00238             float feb_combination_dav_number = mo->GetBinContent(i);
00239             mo1->SetBinContent(i, ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
00240           }
00241           mo1->SetEntries(DMBEvents);
00242           
00243           if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
00244               && getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo2)) {       
00245             for (int i = 1; i < 9; i++) {
00246               float actual_dav_num = mo->GetBinContent(i);
00247               float unpacked_dav_num = mo2->GetBinContent(i);
00248               if (actual_dav_num){
00249                 mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
00250               }                            
00251               mof->SetEntries((int)DMBEvents);
00252               mof->SetMaximum(100.0);
00253             }
00254           }
00255           
00256         }
00257         mo->Fill(feb_combination_dav);
00258       }
00259       
00260     }
00261 
00262   // === Check and fill CSC Data Flow Problems
00263   std::map<int,long> statuses = binChecker.statusDetailed();
00264   for(std::map<int,long>::const_iterator chamber = statuses.begin(); chamber != statuses.end(); chamber++)
00265     {
00266       int chamberID = chamber->first;
00267 
00268       unsigned int crateID = (chamberID >> 4) & 0xFF;
00269       unsigned int dmbSlot = chamberID & 0xF;
00270       std::string cscTag = CSCHistoDef::getPath(crateID, dmbSlot);
00271 
00272       if (crateID == 255) { continue; }
00273 
00274       unsigned int cscType   = 0;
00275       unsigned int cscPosition = 0;
00276       if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
00277 
00278       if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateID, dmbSlot, mo)) {
00279         for(int bit = 0; bit < binChecker.nSTATUSES; bit++)
00280           if( chamber->second & (1 << bit) ) {
00281             mo->Fill(0., bit);
00282           }
00283         mo->SetEntries(nDMBEvents[cscTag]);
00284       }
00285 
00286       
00287       int anyInputFull = chamber->second & 0x3F;
00288       if(anyInputFull){
00289         if(cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, mo)){
00290           mo->Fill(cscPosition, cscType);
00291         }
00292         if (getEMUHisto(h::EMU_DMB_INPUT_FIFO_FULL, mo)) {
00293           mo->Fill(crateID, dmbSlot);
00294         }
00295       }
00296 
00297 
00298       int anyInputTO = (chamber->second >> 7) & 0x3FFF;
00299       if(anyInputTO){
00300         if(cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, mo)){
00301           mo->Fill(cscPosition, cscType);
00302         }
00303         if (getEMUHisto(h::EMU_DMB_INPUT_TIMEOUT, mo)) {
00304           mo->Fill(crateID, dmbSlot);
00305         }
00306       }
00307       
00308       if (chamber->second & (1 << 22)) {
00309         if (getEMUHisto(h::EMU_DMB_FORMAT_WARNINGS, mo)) {
00310           mo->Fill(crateID, dmbSlot);
00311         }
00312   
00313         if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, mo)) {
00314           mo->Fill(cscPosition, cscType);
00315         }
00316         
00317       }
00318     }
00319 
00320   // Check and fill CSC Format Errors 
00321   std::map<int,long> checkerErrors = binChecker.errorsDetailed();
00322   for(std::map<int,long>::const_iterator chamber = checkerErrors.begin(); chamber != checkerErrors.end(); chamber++) {
00323 
00324       unsigned int chamberID = chamber->first;
00325       unsigned int crateID = (chamberID >> 4) & 0xFF;
00326       unsigned int dmbSlot = chamberID & 0xF;
00327 
00328       std::string cscTag = CSCHistoDef::getPath(crateID , dmbSlot);
00329 
00330       if ((crateID ==255) || 
00331           (chamber->second & 0x80)) { continue; } // = Skip chamber detection if DMB header is missing (Error code 6)
00332 
00333       if (crateID>60 || dmbSlot>10) {
00334         //LOG4CPLUS_WARN(logger_, eTag << "Invalid CSC: " << cscTag << ". Skipping");
00335         continue;
00336       }
00337  
00338       if ((chamber->second & config->getBINCHECK_MASK()) != 0) {
00339         // nDMBEvents[cscTag]++;        
00340         CSCCounters& trigCnts = cscCntrs[cscTag];
00341         trigCnts["BAD"]++; 
00342       }
00343 
00344       bool isCSCError = false;
00345 
00346       if (getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateID, dmbSlot, mo)) {
00347         for(int bit = 5; bit < 24; bit++) {
00348           if( chamber->second & (1 << bit) ) {
00349             isCSCError = true;
00350             mo->Fill(0., bit - 5);
00351           }
00352           mo->SetEntries(nDMBEvents[cscTag]);
00353         }
00354       }
00355 
00356       if (isCSCError) {
00357 
00358         //LOG4CPLUS_WARN(logger_,eTag << "Format Errors "<< cscTag << ": 0x" << std::hex << chamber->second);
00359 
00360         if (getEMUHisto(h::EMU_DMB_FORMAT_ERRORS, mo)) {
00361           mo->Fill(crateID, dmbSlot);
00362         }
00363 
00364         if (!eventDenied  && getEMUHisto(h::EMU_DMB_UNPACKED_WITH_ERRORS, mo)) {
00365           mo->Fill(crateID, dmbSlot);
00366         }
00367 
00368         unsigned int cscType   = 0;
00369         unsigned int cscPosition = 0;
00370         if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
00371 
00372         if ( cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, mo)) {
00373           mo->Fill(cscPosition, cscType);
00374         }
00375 
00376         if (!eventDenied  && cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED_WITH_ERRORS, mo)) {
00377           mo->Fill(cscPosition, cscType);
00378         }
00379       }
00380 
00381     }
00382 
00383   }

void cscdqm::EventProcessor::updateEfficiencyHistos (  ) 

Definition at line 23 of file CSCDQM_EventProcessor_updateEffHistos.cc.

References cscdqm::AddressMask::cfeb, cscdqm::CFEB_BWORDS, cscdqm::AddressMask::chamber, config, err, cscdqm::FIFOFULL_ERR, cscdqm::MonitorObject::Fill(), cscdqm::FORMAT_ERR, cscdqm::Summary::getDetector(), cscdqm::Summary::GetEfficiencyHW(), getEMUHisto(), getParHisto(), cscdqm::MonitorObject::getRefRootObject(), cscdqm::MonitorObject::getTH1(), cscdqm::MonitorObject::getTH1Lock(), cscdqm::AddressMask::hv, HWSTATUSERRORBITS, cscdqm::INPUTTO_ERR, cscdqm::L1SYNC_ERR, cscdqm::AddressMask::layer, cscdqm::Address::mask, me, N_SIDES, N_STATIONS, cscdqm::NODATA_ALCT, cscdqm::NODATA_CFEB, cscdqm::NODATA_CLCT, cscdqm::Detector::NumberOfRings(), python::trackProbabilityAnalysis_cff::parameters, cscdqm::Summary::ReadErrorChambers(), cscdqm::Summary::ReadReportingChambers(), cscdqm::Summary::ReadReportingChambersRef(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, summary, tmp, cscdqm::Lock::unlock(), cscdqm::Summary::Write(), cscdqm::Summary::WriteChamberState(), and cscdqm::Summary::WriteMap().

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

00023                                               {
00024 
00025     MonitorObject *me = 0, *me1 = 0;
00026 
00027     if (getEMUHisto(h::EMU_CSC_REPORTING, me)) {
00028 
00029       const TH2* rep = dynamic_cast<const TH2*>(me->getTH1());
00030 
00031       // Get CSC Reporting reference histogram
00032       const TObject *tobj = me->getRefRootObject();
00033        
00034       // If reference for CSC_Reporting is defined - use it
00035       // Else - do it flat way
00036        
00037       if (tobj) {
00038         const TH2* ref = dynamic_cast<const TH2*>(tobj);
00039         summary.ReadReportingChambersRef(rep, ref, config->getEFF_COLD_THRESHOLD(), config->getEFF_COLD_SIGFAIL(), config->getEFF_HOT_THRESHOLD(), config->getEFF_HOT_SIGFAIL());
00040       } else {
00041         summary.ReadReportingChambers(rep, 1.0);
00042       }
00043 
00044       if (getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, me1)) {
00045         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00046         summary.ReadErrorChambers(rep, err, FORMAT_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
00047       }
00048 
00049       if (getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, me1)) {
00050         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00051         summary.ReadErrorChambers(rep, err, L1SYNC_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
00052       }
00053 
00054       if (getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, me1)) {
00055         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00056         summary.ReadErrorChambers(rep, err, FIFOFULL_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
00057       }
00058 
00059       if (getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, me1)) {
00060         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00061         summary.ReadErrorChambers(rep, err, INPUTTO_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
00062       }
00063 
00064       if (getEMUHisto(h::EMU_CSC_WO_ALCT, me1)) {
00065         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00066         summary.ReadErrorChambers(rep, err, NODATA_ALCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
00067       }
00068 
00069       if (getEMUHisto(h::EMU_CSC_WO_CLCT, me1)) {
00070         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00071         summary.ReadErrorChambers(rep, err, NODATA_CLCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
00072       }
00073 
00074       if (getEMUHisto(h::EMU_CSC_WO_CFEB, me1)) {
00075         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00076         summary.ReadErrorChambers(rep, err, NODATA_CFEB, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
00077       }
00078 
00079       if (getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, me1)) {
00080         const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
00081         summary.ReadErrorChambers(rep, err, CFEB_BWORDS, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
00082       }
00083 
00084     }
00085 
00086     if (getEMUHisto(h::EMU_CSC_STATS_SUMMARY, me)) {
00087       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00088       summary.WriteChamberState(tmp, 0x1, 3, true, false);
00089       summary.WriteChamberState(tmp, HWSTATUSERRORBITS, 2, false, true);
00090       me->unlock();
00091     }
00092 
00093     if (getEMUHisto(h::EMU_CSC_STATS_OCCUPANCY, me)){
00094       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00095       summary.WriteChamberState(tmp, 0x4, 2, true, false);
00096       summary.WriteChamberState(tmp, 0x8, 4, false, false);
00097       me->unlock();
00098     }
00099 
00100     if (getEMUHisto(h::EMU_CSC_STATS_FORMAT_ERR, me)){
00101       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00102       summary.WriteChamberState(tmp, 0x10, 2, true, false);
00103       me->unlock();
00104     }
00105 
00106     if (getEMUHisto(h::EMU_CSC_STATS_L1SYNC_ERR, me)){
00107       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00108       summary.WriteChamberState(tmp, 0x20, 2, true, false);
00109       me->unlock();
00110     }
00111 
00112     if (getEMUHisto(h::EMU_CSC_STATS_FIFOFULL_ERR, me)){
00113       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00114       summary.WriteChamberState(tmp, 0x40, 2, true, false);
00115       me->unlock();
00116     }
00117 
00118     if (getEMUHisto(h::EMU_CSC_STATS_INPUTTO_ERR, me)){
00119       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00120       summary.WriteChamberState(tmp, 0x80, 2, true, false);
00121       me->unlock();
00122     }
00123 
00124     if (getEMUHisto(h::EMU_CSC_STATS_WO_ALCT, me)){
00125       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00126       summary.WriteChamberState(tmp, 0x100, 2, true, false);
00127       me->unlock();
00128     }
00129 
00130     if (getEMUHisto(h::EMU_CSC_STATS_WO_CLCT, me)){
00131       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00132       summary.WriteChamberState(tmp, 0x200, 2, true, false);
00133       me->unlock();
00134     }
00135 
00136     if (getEMUHisto(h::EMU_CSC_STATS_WO_CFEB, me)){
00137       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00138       summary.WriteChamberState(tmp, 0x400, 2, true, false);
00139       me->unlock();
00140     }
00141 
00142     if (getEMUHisto(h::EMU_CSC_STATS_CFEB_BWORDS, me)){
00143       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00144       summary.WriteChamberState(tmp, 0x800, 2, true, false);
00145       me->unlock();
00146     }
00147     
00148     //
00149     // Write summary information
00150     //
00151 
00152     if (getEMUHisto(h::EMU_PHYSICS_ME1, me)){
00153       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00154       summary.Write(tmp, 1);
00155       me->unlock();
00156     }
00157   
00158     if (getEMUHisto(h::EMU_PHYSICS_ME2, me)){
00159       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00160       summary.Write(tmp, 2);
00161       me->unlock();
00162     }
00163 
00164     if (getEMUHisto(h::EMU_PHYSICS_ME3, me)){
00165       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00166       summary.Write(tmp, 3);
00167       me->unlock();
00168     }
00169 
00170     if (getEMUHisto(h::EMU_PHYSICS_ME4, me)){
00171       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00172       summary.Write(tmp, 4);
00173       me->unlock();
00174     }
00175 
00176     if (getEMUHisto(h::EMU_PHYSICS_EMU, me)) {
00177       TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
00178       summary.WriteMap(tmp);
00179       me->unlock();
00180     }
00181 
00182     // Looping via addresses (scope: side->station->ring) and
00183     // filling in HW efficiencies
00184     
00185     if (config->getPROCESS_EFF_PARAMETERS()) {
00186 
00187       Address adr;
00188       adr.mask.side = adr.mask.station = adr.mask.ring = true;
00189       adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00190   
00191       double e_detector = 0.0, e_side = 0.0, e_station = 0.0, e_ring = 0.0;
00192       
00193       const HistoId parameters [] = {
00194         h::PAR_CSC_SIDEMINUS_STATION01_RING01,
00195         h::PAR_CSC_SIDEMINUS_STATION01_RING02,
00196         h::PAR_CSC_SIDEMINUS_STATION01_RING03,
00197         h::PAR_CSC_SIDEMINUS_STATION01,
00198         h::PAR_CSC_SIDEMINUS_STATION02_RING01,
00199         h::PAR_CSC_SIDEMINUS_STATION02_RING02,
00200         h::PAR_CSC_SIDEMINUS_STATION02,
00201         h::PAR_CSC_SIDEMINUS_STATION03_RING01,
00202         h::PAR_CSC_SIDEMINUS_STATION03_RING02,
00203         h::PAR_CSC_SIDEMINUS_STATION03,
00204         h::PAR_CSC_SIDEMINUS_STATION04,
00205         h::PAR_CSC_SIDEMINUS,
00206         h::PAR_CSC_SIDEPLUS_STATION01_RING01,
00207         h::PAR_CSC_SIDEPLUS_STATION01_RING02,
00208         h::PAR_CSC_SIDEPLUS_STATION01_RING03,
00209         h::PAR_CSC_SIDEPLUS_STATION01,
00210         h::PAR_CSC_SIDEPLUS_STATION02_RING01,
00211         h::PAR_CSC_SIDEPLUS_STATION02_RING02,
00212         h::PAR_CSC_SIDEPLUS_STATION02,
00213         h::PAR_CSC_SIDEPLUS_STATION03_RING01,
00214         h::PAR_CSC_SIDEPLUS_STATION03_RING02,
00215         h::PAR_CSC_SIDEPLUS_STATION03,
00216         h::PAR_CSC_SIDEPLUS_STATION04,
00217         h::PAR_CSC_SIDEPLUS
00218       };
00219 
00220       unsigned int parameter = 0;
00221 
00222       for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
00223         e_side = 0;
00224         adr.mask.station = true;
00225         for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
00226           e_station = 0;
00227           adr.mask.ring = true;
00228           for (adr.ring = 1; adr.ring <= summary.getDetector().NumberOfRings(adr.station); adr.ring++) {
00229             e_ring = summary.GetEfficiencyHW(adr);
00230             e_station += e_ring;
00231             if (summary.getDetector().NumberOfRings(adr.station) > 1) {
00232               if (getParHisto(parameters[parameter], me)) me->Fill(e_ring);
00233               parameter++;
00234             }
00235           }
00236           adr.mask.ring = false;
00237           e_station = e_station / summary.getDetector().NumberOfRings(adr.station);
00238           if (getParHisto(parameters[parameter], me)) me->Fill(e_station);
00239           parameter++;
00240           e_side += e_station;
00241         }
00242         adr.mask.station = false;
00243         e_side = e_side / N_STATIONS;
00244         if (getParHisto(parameters[parameter], me)) me->Fill(e_side);
00245         parameter++;
00246         e_detector += e_side; 
00247       }
00248       e_detector = e_detector / N_SIDES;
00249       if (getParHisto(h::PAR_REPORT_SUMMARY, me)) me->Fill(e_detector);
00250 
00251     }
00252 
00253   }

void cscdqm::EventProcessor::updateFractionAndEfficiencyHistos (  )  [inline]

Definition at line 71 of file CSCDQM_EventProcessor.h.

References updateEfficiencyHistos(), and updateFractionHistos().

00071                                                {
00072         updateFractionHistos();
00073         updateEfficiencyHistos();
00074       }

void cscdqm::EventProcessor::updateFractionHistos (  ) 

Definition at line 23 of file CSCDQM_EventProcessor_updateFracHistos.cc.

References calcEMUFractionHisto(), config, cscdqm::Configuration::fnNextBookedCSC, getCSCHisto(), cscdqm::CSCHistoDef::getPath(), cscdqm::MonitorObject::getTH1(), iter, nDMBEvents, and cscdqm::MonitorObject::SetEntries().

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

00023                                             {
00024 
00025     calcEMUFractionHisto(h::EMU_DMB_FORMAT_ERRORS_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_FORMAT_ERRORS);
00026     calcEMUFractionHisto(h::EMU_CSC_FORMAT_ERRORS_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_FORMAT_ERRORS);
00027     calcEMUFractionHisto(h::EMU_DMB_FORMAT_WARNINGS_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_FORMAT_WARNINGS);
00028     calcEMUFractionHisto(h::EMU_CSC_FORMAT_WARNINGS_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_FORMAT_WARNINGS);
00029     calcEMUFractionHisto(h::EMU_DMB_UNPACKED_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_UNPACKED);
00030     calcEMUFractionHisto(h::EMU_CSC_UNPACKED_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_UNPACKED);
00031     calcEMUFractionHisto(h::EMU_DMB_WO_ALCT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_ALCT);
00032     calcEMUFractionHisto(h::EMU_CSC_WO_ALCT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_ALCT);
00033     calcEMUFractionHisto(h::EMU_DMB_WO_CLCT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_CLCT);
00034     calcEMUFractionHisto(h::EMU_CSC_WO_CLCT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_CLCT);
00035     calcEMUFractionHisto(h::EMU_DMB_WO_CFEB_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_WO_CFEB);
00036     calcEMUFractionHisto(h::EMU_CSC_WO_CFEB_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_WO_CFEB);
00037     calcEMUFractionHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_DMB_INPUT_FIFO_FULL);
00038     calcEMUFractionHisto(h::EMU_DMB_INPUT_FIFO_FULL_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_INPUT_FIFO_FULL);
00039     calcEMUFractionHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_DMB_INPUT_TIMEOUT);
00040     calcEMUFractionHisto(h::EMU_DMB_INPUT_TIMEOUT_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_INPUT_TIMEOUT);
00041     calcEMUFractionHisto(h::EMU_CSC_L1A_OUT_OF_SYNC_FRACT, h::EMU_CSC_REPORTING, h::EMU_CSC_L1A_OUT_OF_SYNC);
00042     calcEMUFractionHisto(h::EMU_DMB_L1A_OUT_OF_SYNC_FRACT, h::EMU_DMB_REPORTING, h::EMU_DMB_L1A_OUT_OF_SYNC);
00043 
00044     unsigned int iter = 0, crateId = 0, dmbId = 0;
00045     MonitorObject *mo = 0, *mof = 0;
00046     while (config->fnNextBookedCSC(iter, crateId, dmbId)) {
00047 
00048       std::string cscTag = CSCHistoDef::getPath(crateId, dmbId);
00049 
00050       if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateId, dmbId, mo) && 
00051           getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_FREQUENCY, crateId, dmbId, mof)) {
00052         TH1* th = mof->getTH1Lock();
00053         th->Reset();
00054         th->Add(mo->getTH1());
00055         th->Scale(1. / (nDMBEvents[cscTag]));
00056         mof->unlock();
00057         mof->SetMaximum(1.);
00058         mof->SetEntries(nDMBEvents[cscTag]);
00059         mo->SetEntries(nDMBEvents[cscTag]);
00060       }
00061 
00062       if (getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateId, dmbId, mo) && 
00063           getCSCHisto(h::CSC_BINCHECK_ERRORS_FREQUENCY, crateId, dmbId, mof)) {
00064         TH1* th = mof->getTH1Lock();
00065         th->Reset();
00066         th->Add(mo->getTH1());
00067         th->Scale(1. / (nDMBEvents[cscTag]));
00068         mof->unlock();
00069         mof->SetMaximum(1.);
00070         mof->SetEntries(nDMBEvents[cscTag]);
00071         mo->SetEntries(nDMBEvents[cscTag]);
00072       }
00073 
00074     }
00075 
00076   }


Member Data Documentation

bool cscdqm::EventProcessor::bCSCEventCounted [private]

Definition at line 95 of file CSCDQM_EventProcessor.h.

CSCDCCExaminer cscdqm::EventProcessor::binChecker [private]

Definition at line 100 of file CSCDQM_EventProcessor.h.

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

uint32_t cscdqm::EventProcessor::BXN [private]

Definition at line 104 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processDDU().

Configuration* cscdqm::EventProcessor::config [private]

Definition at line 92 of file CSCDQM_EventProcessor.h.

Referenced by EventProcessor(), getCSCFromMap(), getCSCHisto(), getDDUHisto(), getEMUHisto(), getParHisto(), init(), processCSC(), processDDU(), processExaminer(), updateEfficiencyHistos(), and updateFractionHistos().

std::map<std::string, CSCCounters> cscdqm::EventProcessor::cscCntrs [private]

Definition at line 98 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processExaminer().

bool cscdqm::EventProcessor::fCloseL1As [private]

Definition at line 106 of file CSCDQM_EventProcessor.h.

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

bool cscdqm::EventProcessor::fFirstEvent [private]

Definition at line 105 of file CSCDQM_EventProcessor.h.

Referenced by EventProcessor(), and processDDU().

uint32_t cscdqm::EventProcessor::L1ANumber [private]

Definition at line 103 of file CSCDQM_EventProcessor.h.

Referenced by processCSC(), and processDDU().

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

Definition at line 102 of file CSCDQM_EventProcessor.h.

Referenced by processDDU().

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

Definition at line 97 of file CSCDQM_EventProcessor.h.

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

Summary cscdqm::EventProcessor::summary [private]

Definition at line 93 of file CSCDQM_EventProcessor.h.

Referenced by updateEfficiencyHistos().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:36:57 2009 for CMSSW by  doxygen 1.5.4