CMS 3D CMS Logo

SiStripDaqInfo Class Reference

Description: Checks the # of SiStrip FEDs from DAQ Usage: <usage>. More...

#include <DQM/SiStripMonitorCluster/interface/SiStripDaqInfo.h>

Inheritance diagram for SiStripDaqInfo:

edm::EDAnalyzer

List of all members.

Public Member Functions

 SiStripDaqInfo (const edm::ParameterSet &ps)
 Constructor.
virtual ~SiStripDaqInfo ()
 Destructor.

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
 Analyze.
void beginJob (edm::EventSetup const &eSetup)
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup)
 Begin Of Luminosity.
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 Begin Run.
void readFedIds (const edm::ESHandle< SiStripFedCabling > &fedcabling)
void readSubdetFedFractions (std::vector< int > &fed_ids)

Private Attributes

MonitorElementDaqFraction_
MonitorElementDaqFractionTECB_
MonitorElementDaqFractionTECF_
MonitorElementDaqFractionTIB_
MonitorElementDaqFractionTIDB_
MonitorElementDaqFractionTIDF_
MonitorElementDaqFractionTOB_
DQMStoredqmStore_
unsigned long long m_cacheID_
int nFedTotal
std::map< std::string,
std::vector< unsigned short > > 
subDetFedMap


Detailed Description

Description: Checks the # of SiStrip FEDs from DAQ Usage: <usage>.

Definition at line 40 of file SiStripDaqInfo.h.


Constructor & Destructor Documentation

SiStripDaqInfo::SiStripDaqInfo ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 35 of file SiStripDaqInfo.cc.

References dqmStore_, and nFedTotal.

00035                                                           {
00036   // Create MessageSender
00037   edm::LogInfo( "SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo ";
00038 
00039   // get back-end interface
00040   dqmStore_ = edm::Service<DQMStore>().operator->();
00041   nFedTotal = 0;
00042 }

SiStripDaqInfo::~SiStripDaqInfo (  )  [virtual]

Destructor.

Definition at line 43 of file SiStripDaqInfo.cc.

00043                                 {
00044   edm::LogInfo("SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo ";
00045 
00046 }


Member Function Documentation

void SiStripDaqInfo::analyze ( edm::Event const &  event,
edm::EventSetup const &  eSetup 
) [private, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 94 of file SiStripDaqInfo.cc.

00094                                                                                {
00095 }

void SiStripDaqInfo::beginJob ( edm::EventSetup const &  eSetup  )  [private, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 50 of file SiStripDaqInfo.cc.

References DQMStore::bookFloat(), DaqFraction_, DaqFractionTECB_, DaqFractionTECF_, DaqFractionTIB_, DaqFractionTIDB_, DaqFractionTIDF_, DaqFractionTOB_, dqmStore_, MonitorElement::Fill(), and DQMStore::setCurrentFolder().

00050                                                           {
00051  
00052 
00053   dqmStore_->setCurrentFolder("SiStrip/EventInfo/DAQContents");
00054 
00055   // Book MEs for SiStrip DAQ fractions
00056   DaqFraction_= dqmStore_->bookFloat("SiStripDaqFraction");  
00057   DaqFractionTIB_= dqmStore_->bookFloat("SiStripDaqFraction_TIB");  
00058   DaqFractionTOB_= dqmStore_->bookFloat("SiStripDaqFraction_TOB");  
00059   DaqFractionTIDF_= dqmStore_->bookFloat("SiStripDaqFraction_TIDF");  
00060   DaqFractionTIDB_= dqmStore_->bookFloat("SiStripDaqFraction_TIDB");  
00061   DaqFractionTECF_= dqmStore_->bookFloat("SiStripDaqFraction_TECF");  
00062   DaqFractionTECB_= dqmStore_->bookFloat("SiStripDaqFraction_TECB");
00063 
00064   // Fill them with -1 to start with
00065   DaqFraction_->Fill(-1.0);
00066   DaqFractionTIB_->Fill(-1.0);
00067   DaqFractionTOB_->Fill(-1.0);
00068   DaqFractionTIDF_->Fill(-1.0);
00069   DaqFractionTIDB_->Fill(-1.0);
00070   DaqFractionTECF_->Fill(-1.0);
00071   DaqFractionTECB_->Fill(-1.0);
00072  
00073 }

void SiStripDaqInfo::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  iSetup 
) [private, virtual]

Begin Of Luminosity.

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file SiStripDaqInfo.cc.

References DaqFraction_, MonitorElement::Fill(), edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag< Group >::findType(), edm::EventSetup::get(), FEDNumbering::getSiStripFEDIds(), edm::ESHandle< T >::isValid(), it, nFedTotal, and readSubdetFedFractions().

00100                                                                                                        {
00101   edm::LogInfo ("SiStripDaqInfo") <<"SiStripDaqInfo:: Luminosity Block";
00102 
00103   if (nFedTotal == 0) {
00104    edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::No FEDs Connected!!!";
00105    return;
00106   }
00107 
00108   float nFEDConnected = 0.0;
00109 
00110   const FEDNumbering numbering;
00111   const int siStripFedIdMin = numbering.getSiStripFEDIds().first;
00112   const int siStripFedIdMax = numbering.getSiStripFEDIds().second; 
00113 
00114   edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));
00115   if( eSetup.find( recordKey ) != 0) {
00116 
00117     edm::ESHandle<RunInfo> sumFED;
00118     eSetup.get<RunInfoRcd>().get(sumFED);    
00119     
00120     if ( sumFED.isValid() ) {
00121       std::vector<int> FedsInIds= sumFED->m_fed_in;   
00122       for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
00123         int fedID = FedsInIds[it];     
00124         
00125         if(fedID>=siStripFedIdMin &&  fedID<=siStripFedIdMax)  ++nFEDConnected;
00126       }
00127       edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::Total # of FEDs " << nFedTotal 
00128                                       << " Connected FEDs " << nFEDConnected;
00129       DaqFraction_->Fill(nFEDConnected/nFedTotal);
00130       readSubdetFedFractions(FedsInIds);
00131     }
00132   } 
00133 }

void SiStripDaqInfo::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [private, virtual]

Begin Run.

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file SiStripDaqInfo.cc.

References edm::EventSetup::get(), m_cacheID_, and readFedIds().

00077                                                                             {
00078   edm::LogInfo ("SiStripDaqInfo") <<"SiStripDaqInfo:: Begining of Run";
00079 
00080   // Check latest Fed cabling and create TrackerMapCreator
00081   unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
00082   if (m_cacheID_ != cacheID) {
00083     m_cacheID_ = cacheID;       
00084 
00085     edm::ESHandle< SiStripFedCabling > fed_cabling;
00086     eSetup.get<SiStripFedCablingRcd>().get(fed_cabling); 
00087 
00088     readFedIds(fed_cabling);
00089   }
00090 }

void SiStripDaqInfo::readFedIds ( const edm::ESHandle< SiStripFedCabling > &  fedcabling  )  [private]

Definition at line 137 of file SiStripDaqInfo.cc.

References detId, nFedTotal, TIDDetId::side(), TECDetId::side(), subDetFedMap, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by beginRun().

00137                                                                                 {
00138   const std::vector<uint16_t>& feds = fedcabling->feds(); 
00139 
00140   nFedTotal = feds.size();
00141   for(std::vector<unsigned short>::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++){
00142     const std::vector<FedChannelConnection> fedChannels = fedcabling->connections( *ifed );
00143     for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){
00144       if (!iconn->isConnected()) continue;
00145       uint32_t detId = iconn->detId();
00146       if (detId == 0 || detId == 0xFFFFFFFF)  continue;
00147       StripSubdetector subdet(detId);
00148       std::string subdet_tag;
00149       
00150       
00151       switch (subdet.subdetId()) 
00152         {
00153         case StripSubdetector::TIB:
00154           {
00155             subdet_tag = "TIB";
00156             break;       
00157           }
00158         case StripSubdetector::TID:
00159           {
00160             TIDDetId tidId(detId);
00161             if (tidId.side() == 2) {
00162               subdet_tag = "TIDF";
00163             }  else if (tidId.side() == 1) {
00164               subdet_tag = "TIDB";
00165               }
00166             break;       
00167           }
00168         case StripSubdetector::TOB:
00169           {
00170             subdet_tag = "TOB";         
00171             break;       
00172           }
00173         case StripSubdetector::TEC:
00174           {
00175             TECDetId tecId(detId);
00176             if (tecId.side() == 2) {
00177               subdet_tag = "TECF";
00178             }  else if (tecId.side() == 1) {
00179               subdet_tag = "TECB";
00180             }
00181             break;       
00182           }
00183         }
00184       subDetFedMap[subdet_tag].push_back(*ifed); 
00185       break;
00186     }
00187   }
00188 }

void SiStripDaqInfo::readSubdetFedFractions ( std::vector< int > &  fed_ids  )  [private]

Definition at line 192 of file SiStripDaqInfo.cc.

References DaqFractionTECB_, DaqFractionTECF_, DaqFractionTIB_, DaqFractionTIDB_, DaqFractionTIDF_, DaqFractionTOB_, MonitorElement::Fill(), FEDNumbering::getSiStripFEDIds(), it, python::multivaluedict::map(), name, size, and subDetFedMap.

Referenced by beginLuminosityBlock().

00192                                                                    {
00193 
00194   const FEDNumbering numbering;
00195   const int siStripFedIdMin = numbering.getSiStripFEDIds().first;
00196   const int siStripFedIdMax = numbering.getSiStripFEDIds().second; 
00197 
00198   float  nFEDConnecteTIB,  nFEDConnecteTOB,  nFEDConnecteTIDF,  nFEDConnecteTIDB,  nFEDConnecteTECF,  nFEDConnecteTECB;
00199   nFEDConnecteTIB  = nFEDConnecteTOB  = nFEDConnecteTIDF  = nFEDConnecteTIDB  = nFEDConnecteTECF  = nFEDConnecteTECB  = 0;
00200   for(unsigned int it = 0; it < fed_ids.size(); ++it) {
00201     unsigned short fedID = fed_ids[it];     
00202         
00203     if(fedID>=siStripFedIdMin &&  fedID<=siStripFedIdMax) {
00204 
00205       for (std::map<std::string, std::vector<unsigned short> >::const_iterator it = subDetFedMap.begin();
00206            it != subDetFedMap.end(); it++) {
00207         std::string name = it->first;
00208         std::vector<unsigned short> subdetIds = it->second;
00209         bool fedid_found = false;
00210         for (std::vector<unsigned short>::iterator iv = subdetIds.begin();
00211              iv != subdetIds.end(); iv++) {
00212           if ((*iv) == fedID) {
00213             fedid_found = true;
00214             break;
00215           }
00216         }
00217         if (fedid_found) {
00218           if (name == "TIB") nFEDConnecteTIB++;
00219           else if (name == "TOB") nFEDConnecteTOB++;
00220           else if (name == "TIDF") nFEDConnecteTIDF++;
00221           else if (name == "TIDB") nFEDConnecteTIDB++;
00222           else if (name == "TECF") nFEDConnecteTECF++;
00223           else if (name == "TECB") nFEDConnecteTECB++;
00224           break;
00225         }   
00226       } 
00227     }
00228   }
00229   
00230   DaqFractionTIB_->Fill(nFEDConnecteTIB/subDetFedMap["TIB"].size());
00231   DaqFractionTOB_->Fill(nFEDConnecteTOB/subDetFedMap["TOB"].size());
00232   DaqFractionTIDF_->Fill(nFEDConnecteTIDF/subDetFedMap["TIDF"].size());
00233   DaqFractionTIDB_->Fill(nFEDConnecteTIDB/subDetFedMap["TIDB"].size());
00234   DaqFractionTECF_->Fill(nFEDConnecteTECF/subDetFedMap["TECF"].size());
00235   DaqFractionTECB_->Fill(nFEDConnecteTECB/subDetFedMap["TECB"].size());
00236 
00237 }


Member Data Documentation

MonitorElement* SiStripDaqInfo::DaqFraction_ [private]

Definition at line 76 of file SiStripDaqInfo.h.

Referenced by beginJob(), and beginLuminosityBlock().

MonitorElement* SiStripDaqInfo::DaqFractionTECB_ [private]

Definition at line 82 of file SiStripDaqInfo.h.

Referenced by beginJob(), and readSubdetFedFractions().

MonitorElement* SiStripDaqInfo::DaqFractionTECF_ [private]

Definition at line 81 of file SiStripDaqInfo.h.

Referenced by beginJob(), and readSubdetFedFractions().

MonitorElement* SiStripDaqInfo::DaqFractionTIB_ [private]

Definition at line 77 of file SiStripDaqInfo.h.

Referenced by beginJob(), and readSubdetFedFractions().

MonitorElement* SiStripDaqInfo::DaqFractionTIDB_ [private]

Definition at line 80 of file SiStripDaqInfo.h.

Referenced by beginJob(), and readSubdetFedFractions().

MonitorElement* SiStripDaqInfo::DaqFractionTIDF_ [private]

Definition at line 79 of file SiStripDaqInfo.h.

Referenced by beginJob(), and readSubdetFedFractions().

MonitorElement* SiStripDaqInfo::DaqFractionTOB_ [private]

Definition at line 78 of file SiStripDaqInfo.h.

Referenced by beginJob(), and readSubdetFedFractions().

DQMStore* SiStripDaqInfo::dqmStore_ [private]

Definition at line 75 of file SiStripDaqInfo.h.

Referenced by beginJob(), and SiStripDaqInfo().

unsigned long long SiStripDaqInfo::m_cacheID_ [private]

Definition at line 84 of file SiStripDaqInfo.h.

Referenced by beginRun().

int SiStripDaqInfo::nFedTotal [private]

Definition at line 85 of file SiStripDaqInfo.h.

Referenced by beginLuminosityBlock(), readFedIds(), and SiStripDaqInfo().

std::map<std::string,std::vector<unsigned short> > SiStripDaqInfo::subDetFedMap [private]

Definition at line 73 of file SiStripDaqInfo.h.

Referenced by readFedIds(), and readSubdetFedFractions().


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