#include <DQM/SiStripCommissioningSources/interface/SiStripCommissioningSource.h>
Public Types | |
typedef std::map< unsigned int, CommissioningTask * > | TaskMap |
Map of task objects, identified through FedChanelId. | |
typedef std::vector < CommissioningTask * > | VecOfTasks |
typedef std::vector< VecOfTasks > | VecOfVecOfTasks |
Public Member Functions | |
void | analyze (const edm::Event &, const edm::EventSetup &) |
void | beginJob (edm::EventSetup const &) |
void | endJob () |
SiStripCommissioningSource (const edm::ParameterSet &) | |
~SiStripCommissioningSource () | |
Private Member Functions | |
void | clearCablingTasks () |
void | clearTasks () |
void | createCablingTasks () |
void | createRunNumber () |
void | createTask (const SiStripEventSummary *const, const edm::EventSetup &) |
void | createTasks (sistrip::RunType, const edm::EventSetup &) |
void | directory (std::stringstream &, uint32_t run_number=0) |
DQMStore *const | dqm (std::string method="") const |
void | fillCablingHistos (const SiStripEventSummary *const, const edm::DetSetVector< SiStripRawDigi > &) |
void | fillHistos (const SiStripEventSummary *const, const edm::DetSetVector< SiStripRawDigi > &) |
void | remove () |
SiStripCommissioningSource () | |
Private default constructor. | |
Private Attributes | |
std::string | base_ |
bool | cablingTask_ |
Flag to indicate whether task is FED cabling or not. | |
TaskMap | cablingTasks_ |
Map of cabling task objects (indexed using FEC key). | |
DQMStore * | dqm_ |
Interface to Data Quality Monitoring framework. | |
SiStripFecCabling * | fecCabling_ |
SiStripFedCabling * | fedCabling_ |
std::string | filename_ |
Filename of output root file containing source histos. | |
std::string | inputModuleLabel_ |
Name of digi input module. | |
std::string | inputModuleLabelSummary_ |
uint32_t | run_ |
Run number used for naming of root file. | |
sistrip::RunType | task_ |
Identifies commissioning task. | |
std::string | taskConfigurable_ |
Identifies commissioning task read from cfg file. | |
VecOfVecOfTasks | tasks_ |
Vector of vector of task objects (indexed using FED id.ch. | |
bool | tasksExist_ |
Flag to indicate whether histo objects exist or not. | |
int32_t | time_ |
Record of time used to calculate event rate. | |
int | updateFreq_ |
Update frequency for histograms (ignored for cabling). |
Definition at line 25 of file SiStripCommissioningSource.h.
typedef std::map<unsigned int, CommissioningTask*> SiStripCommissioningSource::TaskMap |
Map of task objects, identified through FedChanelId.
Definition at line 30 of file SiStripCommissioningSource.h.
typedef std::vector<CommissioningTask*> SiStripCommissioningSource::VecOfTasks |
Definition at line 31 of file SiStripCommissioningSource.h.
typedef std::vector<VecOfTasks> SiStripCommissioningSource::VecOfVecOfTasks |
Definition at line 32 of file SiStripCommissioningSource.h.
SiStripCommissioningSource::SiStripCommissioningSource | ( | const edm::ParameterSet & | pset | ) |
Definition at line 56 of file SiStripCommissioningSource.cc.
References LogTrace, sistrip::mlDqmSource_, and tasks_.
00056 : 00057 dqm_(0), 00058 fedCabling_(0), 00059 fecCabling_(0), 00060 inputModuleLabel_( pset.getParameter<std::string>( "InputModuleLabel" ) ), 00061 inputModuleLabelSummary_( pset.getParameter<std::string>( "SummaryInputModuleLabel" ) ), 00062 filename_( pset.getUntrackedParameter<std::string>("RootFileName",sistrip::dqmSourceFileName_) ), 00063 run_(0), 00064 time_(0), 00065 taskConfigurable_( pset.getUntrackedParameter<std::string>("CommissioningTask","UNDEFINED") ), 00066 task_(sistrip::UNDEFINED_RUN_TYPE), 00067 tasks_(), 00068 cablingTasks_(), 00069 tasksExist_(false), 00070 cablingTask_(false), 00071 updateFreq_( pset.getUntrackedParameter<int>("HistoUpdateFreq",1) ), 00072 base_("") 00073 { 00074 LogTrace(mlDqmSource_) 00075 << "[SiStripCommissioningSource::" << __func__ << "]" 00076 << " Constructing object..."; 00077 tasks_.clear(); 00078 tasks_.resize( 1024, VecOfTasks(96,static_cast<CommissioningTask*>(0)) ); 00079 }
SiStripCommissioningSource::~SiStripCommissioningSource | ( | ) |
Definition at line 83 of file SiStripCommissioningSource.cc.
References LogTrace, and sistrip::mlDqmSource_.
00083 { 00084 LogTrace(mlDqmSource_) 00085 << "[SiStripCommissioningSource::" << __func__ << "]" 00086 << " Destructing object..."; 00087 }
SiStripCommissioningSource::SiStripCommissioningSource | ( | ) | [private] |
Private default constructor.
void SiStripCommissioningSource::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | setup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 252 of file SiStripCommissioningSource.cc.
References sistrip::APV_LATENCY, sistrip::APV_TIMING, cablingTask_, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, createRunNumber(), createTask(), sistrip::DAQ_SCOPE_MODE, lat::endl(), sistrip::FAST_CABLING, sistrip::FED_CABLING, sistrip::FED_SCOPE_MODE, sistrip::FED_TIMING, sistrip::FED_VIRGIN_RAW, SiStripEnumsAndStrings::fedReadoutMode(), fillCablingHistos(), fillHistos(), sistrip::FINE_DELAY, edm::Event::id(), inputModuleLabel_, inputModuleLabelSummary_, sistrip::mlDqmSource_, sistrip::NOISE, NULL, sistrip::OPTO_SCAN, sistrip::PEDESTALS, sistrip::PEDS_ONLY, edm::Handle< T >::product(), run_, SiStripEnumsAndStrings::runType(), ss, summary, task_, tasksExist_, time_, sistrip::UNDEFINED_RUN_TYPE, sistrip::UNKNOWN_RUN_TYPE, updateFreq_, and sistrip::VPSP_SCAN.
00253 { 00254 // Retrieve commissioning information from "event summary" 00255 edm::Handle<SiStripEventSummary> summary; 00256 event.getByLabel( inputModuleLabelSummary_, summary ); 00257 00258 // Check if EventSummary has info attached 00259 if ( ( summary->runType() == sistrip::UNDEFINED_RUN_TYPE || 00260 summary->runType() == sistrip::UNKNOWN_RUN_TYPE ) && 00261 summary->nullParams() ) { 00262 edm::LogWarning(mlDqmSource_) 00263 << "[SiStripCommissioningSource::" << __func__ << "]" 00264 << " Unknown/undefined RunType and NULL parameter values!" 00265 << " It may be that the 'trigger FED' object was not found!"; 00266 } 00267 00268 // Check if need to rebuild FED/FEC cabling objects for connection run 00269 //cablingForConnectionRun( summary->runType() ); //@@ do not use! 00270 00271 // Extract run number and forward to client 00272 if ( event.id().run() != run_ ) { 00273 run_ = event.id().run(); 00274 createRunNumber(); 00275 } 00276 00277 // Coarse event rate counter 00278 if ( !(event.id().event()%updateFreq_) ) { 00279 std::stringstream ss; 00280 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00281 << " The last " << updateFreq_ 00282 << " events were processed at a rate of "; 00283 if ( time(NULL) == time_ ) { ss << ">" << updateFreq_ << " Hz"; } 00284 else { ss << (updateFreq_/(time(NULL)-time_)) << " Hz"; } 00285 edm::LogVerbatim(mlDqmSource_) << ss.str(); 00286 time_ = time(NULL); 00287 } 00288 00289 // Create commissioning task objects 00290 if ( !tasksExist_ ) { createTask( summary.product(), setup ); } 00291 00292 // Retrieve raw digis with mode appropriate to task 00293 edm::Handle< edm::DetSetVector<SiStripRawDigi> > raw; 00294 if ( task_ == sistrip::DAQ_SCOPE_MODE ) { 00295 if ( summary->fedReadoutMode() == FED_VIRGIN_RAW ) { 00296 event.getByLabel( inputModuleLabel_, "VirginRaw", raw ); 00297 } else if ( summary->fedReadoutMode() == FED_SCOPE_MODE ) { 00298 event.getByLabel( inputModuleLabel_, "ScopeMode", raw ); 00299 } else { 00300 std::stringstream ss; 00301 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00302 << " Requested DAQ_SCOPE_MODE but unknown FED" 00303 << " readout mode retrieved from SiStripEventSummary: " 00304 << SiStripEnumsAndStrings::fedReadoutMode( summary->fedReadoutMode() ); 00305 edm::LogWarning(mlDqmSource_) << ss.str(); 00306 } 00307 } else if ( task_ == sistrip::FAST_CABLING || 00308 task_ == sistrip::FED_CABLING || 00309 task_ == sistrip::APV_TIMING || 00310 task_ == sistrip::FED_TIMING || 00311 task_ == sistrip::OPTO_SCAN ) { 00312 event.getByLabel( inputModuleLabel_, "ScopeMode", raw ); 00313 } else if ( task_ == sistrip::VPSP_SCAN || 00314 task_ == sistrip::CALIBRATION || 00315 task_ == sistrip::CALIBRATION_DECO || 00316 task_ == sistrip::CALIBRATION_SCAN || 00317 task_ == sistrip::CALIBRATION_SCAN_DECO || 00318 task_ == sistrip::PEDESTALS || 00319 task_ == sistrip::PEDS_ONLY || 00320 task_ == sistrip::NOISE ) { 00321 event.getByLabel( inputModuleLabel_, "VirginRaw", raw ); 00322 } else if ( task_ == sistrip::APV_LATENCY || 00323 task_ == sistrip::FINE_DELAY ) { 00324 event.getByLabel( inputModuleLabel_, "FineDelaySelection", raw ); 00325 } else { 00326 std::stringstream ss; 00327 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00328 << " Unknown CommissioningTask: " 00329 << SiStripEnumsAndStrings::runType( task_ ) 00330 << " Unable to establish FED readout mode and retrieve digi container!" 00331 << " Check if SiStripEventSummary object is found/present in Event"; 00332 edm::LogWarning(mlDqmSource_) << ss.str(); 00333 return; 00334 } 00335 00336 // Check for NULL pointer to digi container 00337 if ( &(*raw) == 0 ) { 00338 std::stringstream ss; 00339 ss << "[SiStripCommissioningSource::" << __func__ << "]" << std::endl 00340 << " NULL pointer to DetSetVector!" << std::endl 00341 << " Unable to fill histograms!"; 00342 edm::LogWarning(mlDqmSource_) << ss.str(); 00343 return; 00344 } 00345 00346 if ( !cablingTask_ ) { fillHistos( summary.product(), *raw ); } 00347 else { fillCablingHistos( summary.product(), *raw ); } 00348 00349 }
void SiStripCommissioningSource::beginJob | ( | edm::EventSetup const & | setup | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 106 of file SiStripCommissioningSource.cc.
References base_, cablingTask_, clearCablingTasks(), clearTasks(), SiStripFecCabling::crates(), dir, directory(), dqm(), dqm_, lat::endl(), fecCabling_, fedCabling_, edm::EventSetup::get(), LogTrace, sistrip::mlDqmSource_, edm::ESHandle< T >::product(), DQMStore::setVerbose(), ss, task_, tasksExist_, and sistrip::UNDEFINED_RUN_TYPE.
00106 { 00107 LogTrace(mlDqmSource_) 00108 << "[SiStripCommissioningSource::" << __func__ << "]" 00109 << " Configuring..." << std::endl; 00110 00111 // ---------- DQM back-end interface ---------- 00112 00113 dqm_ = edm::Service<DQMStore>().operator->(); 00114 edm::LogInfo(mlDqmSource_) 00115 << "[SiStripCommissioningSource::" << __func__ << "]" 00116 << " DQMStore service: " 00117 << dqm_; 00118 dqm(__func__); 00119 dqm()->setVerbose(0); 00120 00121 // ---------- Base directory ---------- 00122 00123 std::stringstream dir(""); 00124 00125 #ifndef USING_NEW_COLLATE_METHODS 00126 dir << "FU_"; 00127 directory(dir); 00128 dir << "/"; 00129 #endif 00130 00131 base_ = dir.str(); 00132 00133 // ---------- FED and FEC cabling ---------- 00134 00135 edm::ESHandle<SiStripFedCabling> fed_cabling; 00136 setup.get<SiStripFedCablingRcd>().get( fed_cabling ); 00137 fedCabling_ = const_cast<SiStripFedCabling*>( fed_cabling.product() ); 00138 fecCabling_ = new SiStripFecCabling( *fed_cabling ); 00139 if ( fecCabling_->crates().empty() ) { 00140 std::stringstream ss; 00141 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00142 << " Empty std::vector returned by FEC cabling object!" 00143 << " Check if database connection failed..."; 00144 edm::LogWarning(mlDqmSource_) << ss.str(); 00145 } 00146 00147 // ---------- Reset ---------- 00148 00149 tasksExist_ = false; 00150 task_ = sistrip::UNDEFINED_RUN_TYPE; 00151 cablingTask_ = false; 00152 00153 remove(); 00154 00155 clearCablingTasks(); 00156 clearTasks(); 00157 00158 }
void SiStripCommissioningSource::clearCablingTasks | ( | ) | [private] |
Definition at line 1023 of file SiStripCommissioningSource.cc.
References cablingTasks_.
Referenced by beginJob().
01023 { 01024 if ( cablingTasks_.empty() ) { return; } 01025 for ( TaskMap::iterator itask = cablingTasks_.begin(); itask != cablingTasks_.end(); itask++ ) { 01026 if ( itask->second ) { delete itask->second; } 01027 } 01028 cablingTasks_.clear(); 01029 }
void SiStripCommissioningSource::clearTasks | ( | ) | [private] |
Definition at line 1033 of file SiStripCommissioningSource.cc.
References tasks_.
Referenced by beginJob().
01033 { 01034 if ( tasks_.empty() ) { return; } 01035 VecOfVecOfTasks::iterator ifed = tasks_.begin(); 01036 for ( ; ifed != tasks_.end(); ifed++ ) { 01037 VecOfTasks::iterator ichan = ifed->begin(); 01038 for ( ; ichan != ifed->end(); ichan++ ) { 01039 if ( *ichan ) { delete *ichan; *ichan = 0; } 01040 } 01041 ifed->resize(96,0); 01042 } 01043 tasks_.resize(1024); 01044 }
void SiStripCommissioningSource::createCablingTasks | ( | ) | [private] |
Definition at line 757 of file SiStripCommissioningSource.cc.
References base_, cablingTasks_, SiStripFecCabling::crates(), dir, dqm(), fecCabling_, sistrip::FED_CABLING, getDQMSummary::key, sistrip::mlDqmSource_, path(), SiStripEnumsAndStrings::runType(), DQMStore::setCurrentFolder(), ss, task_, sistrip::UNDEFINED_RUN_TYPE, and sistrip::UNKNOWN_RUN_TYPE.
Referenced by createTask().
00757 { 00758 00759 // Iterate through FEC cabling and create commissioning task objects 00760 uint16_t booked = 0; 00761 for ( std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->crates().begin(); icrate != fecCabling_->crates().end(); icrate++ ) { 00762 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) { 00763 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) { 00764 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) { 00765 for ( std::vector<SiStripModule>::const_iterator imodule = iccu->modules().begin(); imodule != iccu->modules().end(); imodule++ ) { 00766 00767 // Build FEC key 00768 SiStripFecKey path( icrate->fecCrate(), 00769 ifec->fecSlot(), 00770 iring->fecRing(), 00771 iccu->ccuAddr(), 00772 imodule->ccuChan() ); 00773 00774 // Check if FEC key is invalid 00775 if ( !path.isValid() ) { continue; } 00776 00777 // Set working directory prior to booking histograms 00778 std::string dir = base_ + path.path(); 00779 dqm()->setCurrentFolder( dir ); 00780 00781 // Iterate through all APV pairs for this module 00782 for ( uint16_t ipair = 0; ipair < imodule->nApvPairs(); ipair++ ) { 00783 00784 // Retrieve active APV devices 00785 SiStripModule::PairOfU16 apvs = imodule->activeApvPair( imodule->lldChannel(ipair) ); 00786 00787 // Create connection object to hold all relevant info 00788 FedChannelConnection conn( icrate->fecCrate(), 00789 ifec->fecSlot(), 00790 iring->fecRing(), 00791 iccu->ccuAddr(), 00792 imodule->ccuChan(), 00793 apvs.first, 00794 apvs.second, 00795 imodule->dcuId(), 00796 imodule->detId(), 00797 imodule->nApvPairs() ); 00798 00799 // Define key encoding control path 00800 uint32_t key = SiStripFecKey( icrate->fecCrate(), 00801 ifec->fecSlot(), 00802 iring->fecRing(), 00803 iccu->ccuAddr(), 00804 imodule->ccuChan(), 00805 imodule->lldChannel(ipair) ).key(); 00806 00807 // Check key is non zero 00808 if ( !key ) { 00809 edm::LogWarning(mlDqmSource_) 00810 << "[SiStripCommissioningSource::" << __func__ << "]" 00811 << " Unexpected NULL value for FEC key!"; 00812 continue; 00813 } 00814 00815 // Create cabling task objects if not already existing 00816 if ( cablingTasks_.find( key ) == cablingTasks_.end() ) { 00817 00818 if ( task_ == sistrip::FED_CABLING ) { 00819 cablingTasks_[key] = new FedCablingTask( dqm(), conn ); 00820 } else if ( task_ == sistrip::UNDEFINED_RUN_TYPE ) { 00821 edm::LogWarning(mlDqmSource_) 00822 << "[SiStripCommissioningSource::" << __func__ << "]" 00823 << " Undefined CommissioningTask" 00824 << " Unable to create FedCablingTask object!"; 00825 } else if ( task_ == sistrip::UNKNOWN_RUN_TYPE ) { 00826 edm::LogWarning(mlDqmSource_) 00827 << "[SiStripCommissioningSource::" << __func__ << "]" 00828 << " Unknown CommissioningTask" 00829 << " Unable to create FedCablingTask object!"; 00830 } else { 00831 edm::LogWarning(mlDqmSource_) 00832 << "[SiStripCommissioningSource::" << __func__ << "]" 00833 << " Unexpected CommissioningTask: " 00834 << SiStripEnumsAndStrings::runType( task_ ) 00835 << " Unable to create FedCablingTask object!"; 00836 } 00837 00838 // Check if key is found and, if so, book histos and set update freq 00839 if ( cablingTasks_.find( key ) != cablingTasks_.end() ) { 00840 if ( cablingTasks_[key] ) { 00841 cablingTasks_[key]->bookHistograms(); 00842 cablingTasks_[key]->updateFreq(1); //@@ hardwired to update every event!!! 00843 booked++; 00844 //std::stringstream ss; 00845 //ss << "[SiStripCommissioningSource::" << __func__ << "]" 00846 //<< " Booking histograms for '" << cablingTasks_[key]->myName() 00847 //<< "' object with key 0x" << std::hex << std::setfill('0') << std::setw(8) << key << std::dec 00848 //<< " in directory \"" << dir << "\""; 00849 //LogTrace(mlDqmSource_) << ss.str(); 00850 } else { 00851 std::stringstream ss; 00852 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00853 << " NULL pointer to CommissioningTask for key 0x" 00854 << std::hex << std::setfill('0') << std::setw(8) << key << std::dec 00855 << " in directory " << dir 00856 << " Unable to book histograms!"; 00857 edm::LogWarning(mlDqmSource_) << ss.str(); 00858 } 00859 } else { 00860 std::stringstream ss; 00861 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00862 << " Unable to find CommissioningTask for key 0x" 00863 << std::hex << std::setfill('0') << std::setw(8) << key << std::dec 00864 << " in directory " << dir 00865 << " Unable to book histograms!"; 00866 edm::LogWarning(mlDqmSource_) << ss.str(); 00867 } 00868 00869 } else { 00870 std::stringstream ss; 00871 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00872 << " CommissioningTask object already exists for key 0x" 00873 << std::hex << std::setfill('0') << std::setw(8) << key << std::dec 00874 << " in directory " << dir 00875 << " Unable to create FedCablingTask object!"; 00876 edm::LogWarning(mlDqmSource_) << ss.str(); 00877 } 00878 00879 } // loop through apv pairs 00880 } // loop through modules 00881 } // loop through ccus 00882 } // loop through rings 00883 } // loop through fecs 00884 } // loop through crates 00885 00886 edm::LogVerbatim(mlDqmSource_) 00887 << "[SiStripCommissioningSource::" << __func__ << "]" 00888 << " Created " << booked 00889 << " CommissioningTask objects and booked histograms"; 00890 00891 }
void SiStripCommissioningSource::createRunNumber | ( | ) | [private] |
Definition at line 648 of file SiStripCommissioningSource.cc.
References base_, DQMStore::bookString(), dqm(), sistrip::mlDqmSource_, sistrip::root_, mergeAndRegister_online::run, run_, sistrip::runNumber_, sistrip::sep_, and DQMStore::setCurrentFolder().
Referenced by analyze().
00648 { 00649 00650 // Set commissioning task to default ("undefined") value 00651 if ( !run_ ) { 00652 edm::LogWarning(mlDqmSource_) 00653 << "[SiStripCommissioningSource::" << __func__ << "]" 00654 << " NULL run number!"; 00655 return; 00656 } 00657 00658 // Create MonitorElement that identifies run number 00659 dqm()->setCurrentFolder( base_ + sistrip::root_ ); 00660 std::stringstream run; 00661 run << run_; 00662 dqm()->bookString( sistrip::runNumber_ + sistrip::sep_ + run.str(), run.str() ); 00663 00664 }
void SiStripCommissioningSource::createTask | ( | const SiStripEventSummary * const | summary, | |
const edm::EventSetup & | setup | |||
) | [private] |
Definition at line 668 of file SiStripCommissioningSource.cc.
References base_, DQMStore::bookString(), cablingTask_, createCablingTasks(), createTasks(), dqm(), sistrip::FED_CABLING, LogTrace, sistrip::mlDqmSource_, sistrip::root_, SiStripEventSummary::runType(), SiStripEnumsAndStrings::runType(), sistrip::sep_, DQMStore::setCurrentFolder(), ss, task_, taskConfigurable_, sistrip::taskId_, tasksExist_, sistrip::UNDEFINED_RUN_TYPE, and sistrip::UNKNOWN_RUN_TYPE.
Referenced by analyze().
00668 { 00669 00670 // Set commissioning task to default ("undefined") value 00671 task_ = sistrip::UNDEFINED_RUN_TYPE; 00672 00673 // Retrieve commissioning task from EventSummary 00674 if ( summary ) { 00675 task_ = summary->runType(); 00676 std::stringstream ss; 00677 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00678 << " Identified CommissioningTask from EventSummary to be \"" 00679 << SiStripEnumsAndStrings::runType( task_ ) 00680 << "\""; 00681 LogTrace(mlDqmSource_) << ss.str(); 00682 } else { 00683 task_ = sistrip::UNKNOWN_RUN_TYPE; 00684 std::stringstream ss; 00685 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00686 << " NULL pointer to SiStripEventSummary!" 00687 << " Check SiStripEventSummary is found/present in Event"; 00688 edm::LogWarning(mlDqmSource_) << ss.str(); 00689 } 00690 00691 // Override task with ParameterSet configurable (if defined) 00692 sistrip::RunType configurable = SiStripEnumsAndStrings::runType( taskConfigurable_ ); 00693 if ( configurable != sistrip::UNDEFINED_RUN_TYPE && 00694 configurable != sistrip::UNKNOWN_RUN_TYPE ) { 00695 std::stringstream ss; 00696 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00697 << " Overriding CommissioningTask from EventSummary (\"" 00698 << SiStripEnumsAndStrings::runType( task_ ) 00699 << "\") with value retrieved from .cfg file (\"" 00700 << SiStripEnumsAndStrings::runType( configurable ) 00701 << "\")!"; 00702 LogTrace(mlDqmSource_) << ss.str(); 00703 task_ = configurable; 00704 } 00705 00706 // Create ME (std::string) that identifies commissioning task 00707 dqm()->setCurrentFolder( base_ + sistrip::root_ ); 00708 std::string task_str = SiStripEnumsAndStrings::runType( task_ ); 00709 dqm()->bookString( sistrip::taskId_ + sistrip::sep_ + task_str, task_str ); 00710 00711 // Check commissioning task is known / defined 00712 if ( task_ == sistrip::UNKNOWN_RUN_TYPE || 00713 task_ == sistrip::UNDEFINED_RUN_TYPE ) { 00714 std::stringstream ss; 00715 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00716 << " Unexpected CommissioningTask found (" 00717 << static_cast<uint16_t>(task_) << ") \"" 00718 << SiStripEnumsAndStrings::runType( task_ ) << "\"" 00719 << " Unexpected value found in SiStripEventSummary and/or cfg file" 00720 << " If SiStripEventSummary is not present in Event," 00721 << " check 'CommissioningTask' configurable in cfg file"; 00722 edm::LogWarning(mlDqmSource_) << ss.str(); 00723 return; 00724 } else { 00725 std::stringstream ss; 00726 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00727 << " Identified CommissioningTask to be \"" 00728 << SiStripEnumsAndStrings::runType( task_ ) 00729 << "\""; 00730 LogTrace(mlDqmSource_) << ss.str(); 00731 } 00732 00733 // Check if commissioning task is FED cabling 00734 if ( task_ == sistrip::FED_CABLING ) { cablingTask_ = true; } 00735 else { cablingTask_ = false; } 00736 00737 std::stringstream ss; 00738 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00739 << " CommissioningTask: " 00740 << SiStripEnumsAndStrings::runType( summary->runType() ); 00741 LogTrace(mlDqmSource_) << ss.str(); 00742 00743 edm::LogVerbatim(mlDqmSource_) 00744 << "[SiStripCommissioningSource::" << __func__ << "]" 00745 << " Creating CommissioningTask objects and booking histograms..."; 00746 if ( cablingTask_ ) { createCablingTasks(); } 00747 else { createTasks( task_ , setup ); } 00748 edm::LogVerbatim(mlDqmSource_) 00749 << "[SiStripCommissioningSource::" << __func__ << "]" 00750 << " Finished booking histograms!"; 00751 tasksExist_ = true; 00752 00753 }
void SiStripCommissioningSource::createTasks | ( | sistrip::RunType | run_type, | |
const edm::EventSetup & | setup | |||
) | [private] |
Definition at line 895 of file SiStripCommissioningSource.cc.
References sistrip::APV_LATENCY, sistrip::APV_TIMING, base_, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, SiStripFedCabling::connections(), sistrip::DAQ_SCOPE_MODE, dir, dqm(), sistrip::FAST_CABLING, SiStripFedKey::feChan(), sistrip::FED_TIMING, fedCabling_, SiStripFedCabling::feds(), SiStripFedKey::feUnit(), filename_, sistrip::FINE_DELAY, SiStripKey::key(), sistrip::mlDqmSource_, sistrip::NOISE, sistrip::OPTO_SCAN, SiStripKey::path(), sistrip::PEDESTALS, sistrip::PEDS_ONLY, run_, DQMStore::setCurrentFolder(), ss, task_, tasks_, sistrip::UNDEFINED_RUN_TYPE, updateFreq_, and sistrip::VPSP_SCAN.
Referenced by createTask().
00895 { 00896 00897 // Iterate through FED ids and channels 00898 uint16_t booked = 0; 00899 std::vector<uint16_t>::const_iterator ifed = fedCabling_->feds().begin(); 00900 for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { 00901 00902 // Iterate through connected FED channels 00903 const std::vector<FedChannelConnection>& conns = fedCabling_->connections(*ifed); 00904 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); 00905 for ( ; iconn != conns.end(); iconn++ ) { 00906 00907 // Create FED key and check if non-zero 00908 SiStripFedKey fed_key( iconn->fedId(), 00909 SiStripFedKey::feUnit(iconn->fedCh()), 00910 SiStripFedKey::feChan(iconn->fedCh()) ); 00911 if ( !iconn->isConnected() ) { continue; } 00912 00913 // Create FEC key 00914 SiStripFecKey fec_key( iconn->fecCrate(), 00915 iconn->fecSlot(), 00916 iconn->fecRing(), 00917 iconn->ccuAddr(), 00918 iconn->ccuChan() ); 00919 00920 // Set working directory prior to booking histograms 00921 std::stringstream dir; 00922 dir << base_; 00923 if ( run_type == sistrip::FAST_CABLING ) { dir << fed_key.path(); } 00924 else { dir << fec_key.path(); } 00925 dqm()->setCurrentFolder( dir.str() ); 00926 00927 // Create commissioning task objects 00928 if ( !tasks_[iconn->fedId()][iconn->fedCh()] ) { 00929 if ( task_ == sistrip::FAST_CABLING ) { 00930 tasks_[iconn->fedId()][iconn->fedCh()] = new FastFedCablingTask( dqm(), *iconn ); 00931 } else if ( task_ == sistrip::APV_TIMING ) { 00932 tasks_[iconn->fedId()][iconn->fedCh()] = new ApvTimingTask( dqm(), *iconn ); 00933 } else if ( task_ == sistrip::FED_TIMING ) { 00934 tasks_[iconn->fedId()][iconn->fedCh()] = new FedTimingTask( dqm(), *iconn ); 00935 } else if ( task_ == sistrip::OPTO_SCAN ) { 00936 tasks_[iconn->fedId()][iconn->fedCh()] = new OptoScanTask( dqm(), *iconn ); 00937 } else if ( task_ == sistrip::VPSP_SCAN ) { 00938 tasks_[iconn->fedId()][iconn->fedCh()] = new VpspScanTask( dqm(), *iconn ); 00939 } else if ( task_ == sistrip::PEDESTALS ) { 00940 tasks_[iconn->fedId()][iconn->fedCh()] = new PedestalsTask( dqm(), *iconn ); 00941 } else if ( task_ == sistrip::PEDS_ONLY ) { 00942 tasks_[iconn->fedId()][iconn->fedCh()] = new PedsOnlyTask( dqm(), *iconn ); 00943 } else if ( task_ == sistrip::NOISE ) { 00944 tasks_[iconn->fedId()][iconn->fedCh()] = new NoiseTask( dqm(), *iconn ); 00945 } else if ( task_ == sistrip::DAQ_SCOPE_MODE ) { 00946 tasks_[iconn->fedId()][iconn->fedCh()] = new DaqScopeModeTask( dqm(), *iconn ); 00947 } else if ( task_ == sistrip::APV_LATENCY ) { 00948 tasks_[iconn->fedId()][iconn->fedCh()] = new LatencyTask( dqm(), *iconn ); 00949 } else if ( task_ == sistrip::FINE_DELAY ) { 00950 tasks_[iconn->fedId()][iconn->fedCh()] = new FineDelayTask( dqm(), *iconn ); 00951 } else if ( task_ == sistrip::CALIBRATION_SCAN || 00952 task_ == sistrip::CALIBRATION_SCAN_DECO ) { 00953 tasks_[iconn->fedId()][iconn->fedCh()] = new CalibrationScanTask( dqm(), 00954 *iconn, 00955 task_, 00956 filename_.c_str(), 00957 run_, 00958 setup ); 00959 } else if ( task_ == sistrip::CALIBRATION || 00960 task_ == sistrip::CALIBRATION_DECO ) { 00961 tasks_[iconn->fedId()][iconn->fedCh()] = new CalibrationTask( dqm(), 00962 *iconn, 00963 task_, 00964 filename_.c_str(), 00965 run_, 00966 setup ); 00967 } else if ( task_ == sistrip::UNDEFINED_RUN_TYPE ) { 00968 edm::LogWarning(mlDqmSource_) 00969 << "[SiStripCommissioningSource::" << __func__ << "]" 00970 << " Undefined CommissioningTask" 00971 << " Unable to create CommissioningTask object!"; 00972 } else { 00973 edm::LogWarning(mlDqmSource_) 00974 << "[SiStripCommissioningSource::" << __func__ << "]" 00975 << " Unknown CommissioningTask" 00976 << " Unable to create CommissioningTask object!"; 00977 } 00978 00979 // Check if fed_key is found and, if so, book histos and set update freq 00980 if ( tasks_[iconn->fedId()][iconn->fedCh()] ) { 00981 tasks_[iconn->fedId()][iconn->fedCh()]->eventSetup( &setup ); 00982 tasks_[iconn->fedId()][iconn->fedCh()]->bookHistograms(); 00983 tasks_[iconn->fedId()][iconn->fedCh()]->updateFreq( updateFreq_ ); 00984 booked++; 00985 //std::stringstream ss; 00986 //ss << "[SiStripCommissioningSource::" << __func__ << "]" 00987 //<< " Booking histograms for '" << tasks_[iconn->fedId()][iconn->fedCh()]->myName() 00988 //<< "' object with key 0x" << std::hex << std::setfill('0') << std::setw(8) << fed_key.key() << std::dec 00989 //<< " in directory " << dir.str(); 00990 //LogTrace(mlDqmSource_) << ss.str(); 00991 } else { 00992 std::stringstream ss; 00993 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00994 << " NULL pointer to CommissioningTask for key 0x" 00995 << std::hex << std::setfill('0') << std::setw(8) << fed_key.key() << std::dec 00996 << " in directory " << dir.str() 00997 << " Unable to book histograms!"; 00998 edm::LogWarning(mlDqmSource_) << ss.str(); 00999 } 01000 01001 } else { 01002 std::stringstream ss; 01003 ss << "[SiStripCommissioningSource::" << __func__ << "]" 01004 << " CommissioningTask object already exists for key 0x" 01005 << std::hex << std::setfill('0') << std::setw(8) << fed_key.key() << std::dec 01006 << " in directory " << dir.str() 01007 << " Unable to create CommissioningTask object!"; 01008 edm::LogWarning(mlDqmSource_) << ss.str(); 01009 } 01010 01011 } 01012 } 01013 01014 edm::LogVerbatim(mlDqmSource_) 01015 << "[SiStripCommissioningSource::" << __func__ << "]" 01016 << " Created " << booked 01017 << " CommissioningTask objects and booked histograms"; 01018 01019 }
void SiStripCommissioningSource::directory | ( | std::stringstream & | dir, | |
uint32_t | run_number = 0 | |||
) | [private] |
Definition at line 1059 of file SiStripCommissioningSource.cc.
References gethostname(), and tmp.
Referenced by beginJob(), and endJob().
01060 { 01061 01062 // Get details about host 01063 char hn[256]; 01064 gethostname( hn, sizeof(hn) ); 01065 struct hostent* he; 01066 he = gethostbyname(hn); 01067 01068 // Extract host name and ip 01069 std::string host_name; 01070 std::string host_ip; 01071 if ( he ) { 01072 host_name = std::string(he->h_name); 01073 host_ip = std::string( inet_ntoa( *(struct in_addr*)(he->h_addr) ) ); 01074 } else { 01075 host_name = "unknown.cern.ch"; 01076 host_ip = "255.255.255.255"; 01077 } 01078 01079 // Reformat IP address 01080 std::string::size_type pos = 0; 01081 std::stringstream ip; 01082 //for ( uint16_t ii = 0; ii < 4; ++ii ) { 01083 while ( pos != std::string::npos ) { 01084 std::string::size_type tmp = host_ip.find(".",pos); 01085 if ( tmp != std::string::npos ) { 01086 ip << std::setw(3) 01087 << std::setfill('0') 01088 << host_ip.substr( pos, tmp-pos ) 01089 << "."; 01090 pos = tmp+1; // skip the delimiter "." 01091 } else { 01092 ip << std::setw(3) 01093 << std::setfill('0') 01094 << host_ip.substr( pos ); 01095 pos = std::string::npos; 01096 } 01097 } 01098 01099 // Get pid 01100 pid_t pid = getpid(); 01101 01102 // Construct string 01103 if ( run_number ) { 01104 dir << std::setw(8) 01105 << std::setfill('0') 01106 << run_number 01107 << "_"; 01108 } 01109 dir << ip.str() 01110 << "_" 01111 << std::setw(5) 01112 << std::setfill('0') 01113 << pid; 01114 01115 }
DQMStore *const SiStripCommissioningSource::dqm | ( | std::string | method = "" |
) | const [private] |
Definition at line 91 of file SiStripCommissioningSource.cc.
References dqm_, lat::endl(), sistrip::mlDqmSource_, and ss.
Referenced by beginJob(), createCablingTasks(), createRunNumber(), createTask(), createTasks(), endJob(), and remove().
00091 { 00092 if ( !dqm_ ) { 00093 std::stringstream ss; 00094 if ( method != "" ) { ss << "[SiStripCommissioningSource::" << method << "]" << std::endl; } 00095 else { ss << "[SiStripCommissioningSource]" << std::endl; } 00096 ss << " NULL pointer to DQMStore"; 00097 edm::LogWarning(mlDqmSource_) << ss.str(); 00098 return 0; 00099 } else { return dqm_; } 00100 }
Reimplemented from edm::EDAnalyzer.
Definition at line 162 of file SiStripCommissioningSource.cc.
References cablingTasks_, SiStripFedCabling::connections(), dir, directory(), dqm(), lat::endl(), fecCabling_, fedCabling_, SiStripFedCabling::feds(), filename_, LogTrace, sistrip::mlDqmSource_, name, NULL, run_, DQMStore::save(), ss, and tasks_.
00162 { 00163 LogTrace(mlDqmSource_) 00164 << "[SiStripCommissioningSource::" << __func__ << "]" 00165 << " Halting..." << std::endl; 00166 00167 // ---------- Update histograms ---------- 00168 00169 // Cabling task 00170 for ( TaskMap::iterator itask = cablingTasks_.begin(); itask != cablingTasks_.end(); itask++ ) { 00171 if ( itask->second ) { itask->second->updateHistograms(); } 00172 } 00173 00174 // All tasks except cabling 00175 uint16_t fed_id = 0; 00176 uint16_t fed_ch = 0; 00177 std::vector<uint16_t>::const_iterator ifed = fedCabling_->feds().begin(); 00178 for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { 00179 const std::vector<FedChannelConnection>& conns = fedCabling_->connections(*ifed); 00180 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); 00181 for ( ; iconn != conns.end(); iconn++ ) { 00182 if ( !iconn->isConnected() ) { continue; } 00183 fed_id = iconn->fedId(); 00184 fed_ch = iconn->fedCh(); 00185 if ( tasks_[fed_id][fed_ch] ) { 00186 tasks_[fed_id][fed_ch]->updateHistograms(); 00187 } 00188 } 00189 } 00190 00191 // ---------- Save histos to root file ---------- 00192 00193 // Strip filename of ".root" extension 00194 std::string name; 00195 if ( filename_.find(".root",0) == std::string::npos ) { name = filename_; } 00196 else { name = filename_.substr( 0, filename_.find(".root",0) ); } 00197 00198 // Retrieve SCRATCH directory 00199 std::string scratch = "SCRATCH"; //@@ remove trailing slash!!! 00200 std::string dir = ""; 00201 if ( getenv(scratch.c_str()) != NULL ) { 00202 dir = getenv(scratch.c_str()); 00203 } 00204 00205 // Add directory path 00206 std::stringstream ss; 00207 if ( !dir.empty() ) { ss << dir << "/"; } 00208 else { ss << "/tmp/"; } 00209 00210 // Add filename with run number, host ip, pid and .root extension 00211 ss << name << "_"; 00212 directory(ss,run_); 00213 ss << ".root"; 00214 00215 // Save file with appropriate filename (if run number is known) 00216 if ( !filename_.empty() ) { 00217 if ( run_ != 0 ) { dqm()->save( ss.str() ); } 00218 else { 00219 edm::LogWarning(mlDqmSource_) 00220 << "[SiStripCommissioningSource::" << __func__ << "]" 00221 << " NULL value for RunNumber! No root file saved!"; 00222 } 00223 } else { 00224 edm::LogWarning(mlDqmSource_) 00225 << "[SiStripCommissioningSource::" << __func__ << "]" 00226 << " NULL value for filename! No root file saved!"; 00227 } 00228 00229 LogTrace(mlDqmSource_) 00230 << "[SiStripCommissioningSource::" << __func__ << "]" 00231 << " Saved all histograms to file \"" 00232 << ss.str() << "\""; 00233 00234 // ---------- Delete histograms ---------- 00235 00236 // Remove all MonitorElements in "SiStrip" dir and below 00237 // remove(); 00238 00239 // Delete histogram objects 00240 // clearCablingTasks(); 00241 // clearTasks(); 00242 00243 // ---------- Delete cabling ---------- 00244 00245 if ( fedCabling_ ) { fedCabling_ = 0; } 00246 if ( fecCabling_ ) { delete fecCabling_; fecCabling_ = 0; } 00247 00248 }
void SiStripCommissioningSource::fillCablingHistos | ( | const SiStripEventSummary * const | summary, | |
const edm::DetSetVector< SiStripRawDigi > & | raw | |||
) | [private] |
Definition at line 353 of file SiStripCommissioningSource.cc.
References Averages::add(), average(), cablingTasks_, Averages::calc(), sistrip::CCU_CHAN, SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), SiStripKey::channel(), SiStripEventSummary::dcuId(), SiStripEventSummary::deviceId(), edm::DetSetVector< T >::end(), lat::endl(), fecCabling_, SiStripFecKey::fecCrate(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), fedCabling_, SiStripFedCabling::feds(), edm::DetSetVector< T >::find(), sistrip::invalid_, SiStripModule::key(), LogTrace, Averages::Params::median_, sistrip::mlDqmSource_, sistrip::mlTest_, SiStripFecCabling::module(), params, path(), Averages::Params::rms_, ss, and tmp.
Referenced by analyze().
00354 { 00355 00356 // Create FEC key using DCU id and LLD channel from SiStripEventSummary 00357 const SiStripModule& module = fecCabling_->module( summary->dcuId() ); 00358 uint16_t lld_channel = ( summary->deviceId() & 0x3 ) + 1; 00359 SiStripFecKey key_object( module.key().fecCrate(), 00360 module.key().fecSlot(), 00361 module.key().fecRing(), 00362 module.key().ccuAddr(), 00363 module.key().ccuChan(), 00364 lld_channel ); 00365 uint32_t fec_key = key_object.key(); 00366 std::stringstream sss; 00367 sss << "[SiStripCommissioningSource::" << __func__ << "]" 00368 << " Found DcuId 0x" 00369 << std::hex << std::setw(8) << std::setfill('0') << summary->dcuId() << std::dec 00370 << " with Crate/FEC/Ring/CCU/Module/LLD: " 00371 << module.key().fecCrate() << "/" 00372 << module.key().fecSlot() << "/" 00373 << module.key().fecRing() << "/" 00374 << module.key().ccuAddr() << "/" 00375 << module.key().ccuChan() << "/" 00376 << lld_channel; 00377 edm::LogWarning(mlDqmSource_) << sss.str(); 00378 00379 //LogTrace(mlTest_) << "TEST : " << key_object; 00380 00381 // Check on whether DCU id is found 00382 if ( key_object.isInvalid( sistrip::CCU_CHAN ) ) { 00383 std::stringstream ss; 00384 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00385 << " DcuId 0x" 00386 << std::hex << std::setw(8) << std::setfill('0') << summary->dcuId() << std::dec 00387 << " in 'DAQ register' field not found in cabling map!" 00388 << " (NULL values returned for FEC path)"; 00389 edm::LogWarning(mlDqmSource_) << ss.str(); 00390 return; 00391 } 00392 00393 // Iterate through FED ids 00394 std::vector<uint16_t>::const_iterator ifed = fedCabling_->feds().begin(); 00395 for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { 00396 00397 // Check if FedId is non-zero 00398 if ( *ifed == sistrip::invalid_ ) { continue; } 00399 00400 // Container to hold median signal level for FED cabling task 00401 std::map<uint16_t,float> medians; medians.clear(); 00402 std::map<uint16_t,float> medians1; medians1.clear(); 00403 00404 // Iterate through FED channels 00405 for ( uint16_t ichan = 0; ichan < 96; ichan++ ) { 00406 00407 // // Retrieve digis for given FED key 00408 // uint32_t fed_key = SiStripFedKey( *ifed, 00409 // SiStripFedKey::feUnit(ichan), 00410 // SiStripFedKey::feChan(ichan) ).key(); 00411 00412 // Retrieve digis for given FED key 00413 uint32_t fed_key = ( ( *ifed & sistrip::invalid_ ) << 16 ) | ( ichan & sistrip::invalid_ ); 00414 00415 std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = raw.find( fed_key ); 00416 if ( digis != raw.end() ) { 00417 if ( digis->data.empty() ) { continue; } 00418 00419 // if ( digis->data[0].adc() > 500 ) { 00420 // std::stringstream ss; 00421 // ss << " HIGH SIGNAL " << digis->data[0].adc() << " FOR" 00422 // << " FedKey: 0x" << std::hex << std::setw(8) << std::setfill('0') << fed_key << std::dec 00423 // << " FedId/Ch: " << *ifed << "/" << ichan; 00424 // LogTrace(mlDqmSource_) << ss.str(); 00425 // } 00426 00427 Averages ave; 00428 for ( uint16_t idigi = 0; idigi < digis->data.size(); idigi++ ) { 00429 ave.add( static_cast<uint32_t>(digis->data[idigi].adc()) ); 00430 } 00431 Averages::Params params; 00432 ave.calc(params); 00433 medians[ichan] = params.median_; // Store median signal level 00434 medians1[ichan] = digis->data[0].adc(); 00435 00436 // if ( !digis->data.empty() ) { medians[ichan] = digis->data[0].adc(); } 00437 // else { 00438 // edm::LogWarning(mlTest_) << "TEST : NO DIGIS!"; 00439 // } 00440 00441 // std::stringstream ss; 00442 // ss << "Channel Averages:" << std::endl 00443 // << " nDigis: " << digis->data.size() << std::endl 00444 // << " num/mean/MEDIAN/rms/max/min: " 00445 // << params.num_ << "/" 00446 // << params.mean_ << "/" 00447 // << params.median_ << "/" 00448 // << params.rms_ << "/" 00449 // << params.max_ << "/" 00450 // << params.min_ << std::endl; 00451 // LogTrace(mlDqmSource_) << ss.str(); 00452 00453 } 00454 00455 } // fed channel loop 00456 00457 // Calculate mean and spread on all (median) signal levels 00458 Averages average; 00459 std::map<uint16_t,float>::const_iterator ii = medians.begin(); 00460 for ( ; ii != medians.end(); ii++ ) { average.add( ii->second ); } 00461 Averages::Params tmp; 00462 average.calc(tmp); 00463 00464 // std::stringstream ss; 00465 // ss << "FED Averages:" << std::endl 00466 // << " nChans: " << medians.size() << std::endl 00467 // << " num/mean/median/rms/max/min: " 00468 // << tmp.num_ << "/" 00469 // << tmp.mean_ << "/" 00470 // << tmp.median_ << "/" 00471 // << tmp.rms_ << "/" 00472 // << tmp.max_ << "/" 00473 // << tmp.min_ << std::endl; 00474 // LogTrace(mlDqmSource_) << ss.str(); 00475 00476 // Calculate mean and spread on "filtered" data 00477 Averages truncated; 00478 std::map<uint16_t,float>::const_iterator jj = medians.begin(); 00479 for ( ; jj != medians.end(); jj++ ) { 00480 if ( jj->second < tmp.median_+tmp.rms_ ) { 00481 truncated.add( jj->second ); 00482 } 00483 } 00484 Averages::Params params; 00485 truncated.calc(params); 00486 00487 // std::stringstream ss1; 00488 // ss1 << "Truncated Averages:" << std::endl 00489 // << " nChans: " << medians.size() << std::endl 00490 // << " num/mean/median/rms/max/min: " 00491 // << params.num_ << "/" 00492 // << params.mean_ << "/" 00493 // << params.median_ << "/" 00494 // << params.rms_ << "/" 00495 // << params.max_ << "/" 00496 // << params.min_ << std::endl; 00497 // LogTrace(mlDqmSource_) << ss1.str(); 00498 00499 // Identify channels with signal 00500 std::stringstream ss2; 00501 std::stringstream ss3; 00502 // ss2 << "Number of possible connections: " << medians.size() 00503 // << " channel/signal: "; 00504 std::map<uint16_t,float> channels; 00505 std::map<uint16_t,float>::const_iterator ichan = medians.begin(); 00506 for ( ; ichan != medians.end(); ichan++ ) { 00507 // cout << " mean: " << params.mean_ 00508 // << " rms: " << params.rms_ 00509 // << " thresh: " << params.mean_ + 5.*params.rms_ 00510 // << " value: " << ichan->second 00511 // << " strip: " << ichan->first << std::endl; 00512 //if ( ichan->second > params.mean_ + 5.*params.rms_ ) { 00513 if ( ichan->second > 200. ) { 00514 LogTrace(mlTest_) << "TEST FOUND SIGNAL HIGH: " << *ifed << " " << ichan->first << " " << ichan->second; 00515 channels[ichan->first] = ichan->second; 00516 } 00517 ss2 //<< ichan->first << "/" 00518 << ichan->second << " "; 00519 ss3 //<< ichan->first << "/" 00520 << medians1[ichan->first] << " "; 00521 } 00522 00523 ss2 << std::endl; 00524 ss3 << std::endl; 00525 LogTrace(mlTest_) << "DUMP for FED " << *ifed << ": " << ss2.str(); 00526 LogTrace(mlTest_) << "FIRST ADC VAL " << *ifed << ": " << ss3.str(); 00527 00528 // LogTrace(mlDqmSource_) 00529 // << "[FedCablingTask::" << __func__ << "]" 00530 // << " Found candidate connection between device: 0x" 00531 // << std::setfill('0') << std::setw(8) << std::hex << summary.deviceId() << std::dec 00532 // << " with Crate/FEC/Ring/CCU/Module/LLDchannel: " 00533 // << connection().fecCrate() << "/" 00534 // << connection().fecSlot() << "/" 00535 // << connection().fecRing() << "/" 00536 // << connection().ccuAddr() << "/" 00537 // << connection().ccuChan() << "/" 00538 // << connection().lldChannel() 00539 // << " and FedId/Ch: " 00540 // << fed_id << "/" << ichan->first 00541 // << " with signal " << ichan->second 00542 // << " [adc] over background " << "XXX +/- YYY [adc]" 00543 // << " (S/N = " << "ZZZ" << ")"; 00544 00545 00546 // Fill cabling histograms 00547 if ( cablingTasks_.find(fec_key) != cablingTasks_.end() ) { 00548 if ( !channels.empty() ) { 00549 cablingTasks_[fec_key]->fillHistograms( *summary, *ifed, channels ); 00550 SiStripFecKey path( fec_key ); 00551 std::stringstream ss; 00552 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00553 << " Filled histogram for '" << cablingTasks_[fec_key]->myName() 00554 << "' object with FecKey: 0x" 00555 << std::hex << std::setfill('0') << std::setw(8) << fec_key << std::dec 00556 << " and Crate/FEC/ring/CCU/module/LLDchan: " 00557 << path.fecCrate() << "/" 00558 << path.fecSlot() << "/" 00559 << path.fecRing() << "/" 00560 << path.ccuAddr() << "/" 00561 << path.ccuChan() << "/" 00562 << path.channel(); 00563 LogTrace(mlDqmSource_) << ss.str(); 00564 } 00565 } else { 00566 SiStripFecKey path( fec_key ); 00567 std::stringstream ss; 00568 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00569 << " Unable to find CommissioningTask object with FecKey: 0x" 00570 << std::hex << std::setfill('0') << std::setw(8) << fec_key << std::dec 00571 << " and Crate/FEC/ring/CCU/module/LLDchan: " 00572 << path.fecCrate() << "/" 00573 << path.fecSlot() << "/" 00574 << path.fecRing() << "/" 00575 << path.ccuAddr() << "/" 00576 << path.ccuChan() << "/" 00577 << path.channel(); 00578 edm::LogWarning(mlDqmSource_) << ss.str(); 00579 } 00580 00581 } // fed id loop 00582 00583 }
void SiStripCommissioningSource::fillHistos | ( | const SiStripEventSummary * const | summary, | |
const edm::DetSetVector< SiStripRawDigi > & | raw | |||
) | [private] |
Definition at line 587 of file SiStripCommissioningSource.cc.
References sistrip::APV_LATENCY, SiStripFedCabling::connections(), edm::DetSetVector< T >::end(), fedCabling_, SiStripFedCabling::feds(), edm::DetSetVector< T >::find(), sistrip::FINE_DELAY, sistrip::invalid_, sistrip::mlDqmSource_, ss, task_, tasks_, and sistrip::valid_.
Referenced by analyze().
00588 { 00589 00590 // Iterate through FED ids and channels 00591 std::vector<uint16_t>::const_iterator ifed = fedCabling_->feds().begin(); 00592 for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { 00593 00594 // Iterate through connected FED channels 00595 const std::vector<FedChannelConnection>& conns = fedCabling_->connections(*ifed); 00596 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); 00597 for ( ; iconn != conns.end(); iconn++ ) { 00598 00599 if ( !(iconn->fedId()) || iconn->fedId() > sistrip::valid_ ) { continue; } 00600 00601 // // Create FED key and check if non-zero 00602 // uint32_t fed_key = SiStripFedKey( iconn->fedId(), 00603 // SiStripFedKey::feUnit(iconn->fedCh()), 00604 // SiStripFedKey::feChan(iconn->fedCh()) ).key(); 00605 00606 // Create FED key and check if non-zero 00607 // note: the key is not computed using the same formula as in commissioning histograms. 00608 // beware that changes here must match changes in raw2digi and in SiStripFineDelayHit 00609 uint32_t fed_key = ( ( iconn->fedId() & sistrip::invalid_ ) << 16 ) | ( iconn->fedCh() & sistrip::invalid_ ); 00610 00611 // Retrieve digis for given FED key and check if found 00612 std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = raw.find( fed_key ); 00613 if ( digis != raw.end() ) { 00614 if ( tasks_[iconn->fedId()][iconn->fedCh()] ) { 00615 tasks_[iconn->fedId()][iconn->fedCh()]->fillHistograms( *summary, *digis ); 00616 } else { 00617 std::stringstream ss; 00618 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00619 << " Unable to find CommissioningTask object with FED key " 00620 << std::hex << std::setfill('0') << std::setw(8) << fed_key << std::dec 00621 << " and FED id/ch " 00622 << iconn->fedId() << "/" 00623 << iconn->fedCh() 00624 << " Unable to fill histograms!"; 00625 edm::LogWarning(mlDqmSource_) << ss.str(); 00626 } 00627 } else { 00628 // issue a warning only for standard runs, as latency and fine delay only deliver 00629 // pseudo zero-suppressed data 00630 if ( task_ != sistrip::APV_LATENCY && 00631 task_ != sistrip::FINE_DELAY ) { 00632 std::stringstream ss; 00633 ss << "[SiStripCommissioningSource::" << __func__ << "]" 00634 << " Unable to find any DetSet containing digis for FED key " 00635 << std::hex << std::setfill('0') << std::setw(8) << fed_key << std::dec 00636 << " and FED id/ch " 00637 << iconn->fedId() << "/" 00638 << iconn->fedCh(); 00639 edm::LogWarning(mlDqmSource_) << ss.str(); 00640 } 00641 } 00642 } // fed channel loop 00643 } // fed id loop 00644 }
void SiStripCommissioningSource::remove | ( | ) | [private] |
Definition at line 1048 of file SiStripCommissioningSource.cc.
References DQMStore::cd(), dqm(), DQMStore::removeContents(), DQMStore::rmdir(), and sistrip::root_.
01048 { 01049 dqm()->cd(); 01050 dqm()->removeContents(); 01051 01052 if( dqm()->dirExists(sistrip::root_) ) { 01053 dqm()->rmdir(sistrip::root_); 01054 } 01055 }
std::string SiStripCommissioningSource::base_ [private] |
Definition at line 136 of file SiStripCommissioningSource.h.
Referenced by beginJob(), createCablingTasks(), createRunNumber(), createTask(), and createTasks().
bool SiStripCommissioningSource::cablingTask_ [private] |
Flag to indicate whether task is FED cabling or not.
Definition at line 130 of file SiStripCommissioningSource.h.
Referenced by analyze(), beginJob(), and createTask().
Map of cabling task objects (indexed using FEC key).
Definition at line 124 of file SiStripCommissioningSource.h.
Referenced by clearCablingTasks(), createCablingTasks(), endJob(), and fillCablingHistos().
DQMStore* SiStripCommissioningSource::dqm_ [private] |
Interface to Data Quality Monitoring framework.
Definition at line 89 of file SiStripCommissioningSource.h.
Referenced by beginJob(), and dqm().
Definition at line 95 of file SiStripCommissioningSource.h.
Referenced by beginJob(), createCablingTasks(), endJob(), and fillCablingHistos().
Definition at line 92 of file SiStripCommissioningSource.h.
Referenced by beginJob(), createTasks(), endJob(), fillCablingHistos(), and fillHistos().
std::string SiStripCommissioningSource::filename_ [private] |
Filename of output root file containing source histos.
Definition at line 104 of file SiStripCommissioningSource.h.
Referenced by createTasks(), and endJob().
std::string SiStripCommissioningSource::inputModuleLabel_ [private] |
Name of digi input module.
Definition at line 100 of file SiStripCommissioningSource.h.
Referenced by analyze().
std::string SiStripCommissioningSource::inputModuleLabelSummary_ [private] |
uint32_t SiStripCommissioningSource::run_ [private] |
Run number used for naming of root file.
Definition at line 107 of file SiStripCommissioningSource.h.
Referenced by analyze(), createRunNumber(), createTasks(), and endJob().
Identifies commissioning task.
Definition at line 118 of file SiStripCommissioningSource.h.
Referenced by analyze(), beginJob(), createCablingTasks(), createTask(), createTasks(), and fillHistos().
std::string SiStripCommissioningSource::taskConfigurable_ [private] |
Identifies commissioning task read from cfg file.
Definition at line 115 of file SiStripCommissioningSource.h.
Referenced by createTask().
Vector of vector of task objects (indexed using FED id.ch.
Definition at line 121 of file SiStripCommissioningSource.h.
Referenced by clearTasks(), createTasks(), endJob(), fillHistos(), and SiStripCommissioningSource().
bool SiStripCommissioningSource::tasksExist_ [private] |
Flag to indicate whether histo objects exist or not.
Definition at line 127 of file SiStripCommissioningSource.h.
Referenced by analyze(), beginJob(), and createTask().
int32_t SiStripCommissioningSource::time_ [private] |
Record of time used to calculate event rate.
Definition at line 110 of file SiStripCommissioningSource.h.
Referenced by analyze().
int SiStripCommissioningSource::updateFreq_ [private] |
Update frequency for histograms (ignored for cabling).
Definition at line 133 of file SiStripCommissioningSource.h.
Referenced by analyze(), and createTasks().