Skip to content
Snippets Groups Projects
Commit 4bbfe4e8 authored by Eric Torrence's avatar Eric Torrence Committed by Graeme Stewart
Browse files

Fix muToLumi value, switch for online default mu values (LumiBlockComps-01-00-27)

	* Fix missing muToLumi value for offline-only lumi algorithms
	* Add switch to allow online to get invalid lumi values
	* Tag as LumiBlockComps-01-00-27

2016-02-24 Will Buttinger <will@cern.ch>
      * cmt/requirements: made getLumi compile after main library, to stop cmt failure in nightlies
      * Tagging as LumiBlockComps-01-00-26

2016-02-22 Will Buttinger <will@cern.ch>
       * Root/LumiBlockMetaDataTool: reduced verbosity of some of the logging messages
       * util/getLumi.cxx : new standalone application to get the lumi of a set of xAOD or D3PD
       * Tagging as LumiBlockComps-01-00-25


Former-commit-id: 7737dd0d05f3ad81475f2b6ac2df3028fd97bd9a
parent 50d804a4
No related merge requests found
......@@ -10,6 +10,7 @@ atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Control/AthenaKernel
Control/StoreGate
Control/xAODRootAccess
Database/AthenaPOOL/AthenaPoolKernel
Database/CoolLumiUtilities
Event/xAOD/xAODLuminosity
......@@ -48,6 +49,11 @@ atlas_add_dictionary( LumiBlockCompsDict
INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests CoolLumiUtilitiesLib xAODLuminosity GaudiKernel LumiBlockCoolQuery GoodRunsListsLib AthenaPoolUtilities DBDataModel EventInfo LumiBlockCompsLib )
atlas_add_executable( getLumi
util/getLumi.cxx
INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests CoolLumiUtilitiesLib xAODLuminosity GaudiKernel LumiBlockCoolQuery GoodRunsListsLib AthenaPoolUtilities DBDataModel EventInfo LumiBlockCompsLib )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
......
......@@ -138,9 +138,17 @@ class LuminosityTool: public AthAlgTool, virtual public ILuminosityTool {
// Channel to use to get muToLumi from calibration tool
unsigned int m_calibChannel;
// Backup channel in case calibChannel doesn't exist in online calibration folder
unsigned int m_calibBackupChannel;
// Flag to control whether invalid data is skipped (True - default) returning a zero luminosity,
// or whether the available luminosity values are returned anyways (False).
bool m_skipInvalid;
};
#endif
#endif
\ No newline at end of file
#endif
......@@ -5,7 +5,7 @@
/** Modified from @file ReadMeta.cxx
* @brief The LumiBlockMetaDataTool reads luminosity metadata from input files and transfers it to output files
* @author Marjorie Shapiro <mdshapiro@lbl.gov> based on work from Peter van Gemmeren <gemmeren@anl.gov>
* $Id: LumiBlockMetaDataTool.cxx 716108 2015-12-29 03:49:11Z ssnyder $
* $Id: LumiBlockMetaDataTool.cxx 725529 2016-02-22 16:07:11Z will $
**/
#include "LumiBlockComps/LumiBlockMetaDataTool.h"
......@@ -244,7 +244,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
//
// stop() is called whenever the event loop is finished.
// ======================================================
ATH_MSG_INFO( " finishUp: write lumiblocks to meta data store " );
ATH_MSG_VERBOSE( " finishUp: write lumiblocks to meta data store " );
xAOD::LumiBlockRangeContainer* piovComplete = new xAOD::LumiBlockRangeContainer();
xAOD::LumiBlockRangeAuxContainer* piovCompleteAux = new xAOD::LumiBlockRangeAuxContainer();
......@@ -261,7 +261,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
xAOD::LumiBlockRangeContainer::const_iterator it;
if(m_cacheSuspectOutputRangeContainer->size()>0) {
msg(MSG::INFO) << "Suspect OutputRangeCollection with size " << m_cacheSuspectOutputRangeContainer->size() << endreq;
ATH_MSG_VERBOSE("Suspect OutputRangeCollection with size " << m_cacheSuspectOutputRangeContainer->size());
for(it=m_cacheSuspectOutputRangeContainer->begin(); it!=m_cacheSuspectOutputRangeContainer->end(); it++) {
xAOD::LumiBlockRange* iovr = new xAOD::LumiBlockRange(*(*it));
piovSuspect->push_back(iovr);
......@@ -269,7 +269,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
}
if(m_cacheOutputRangeContainer->size()>0) {
msg(MSG::INFO) << "OutputRangeCollection with size " << m_cacheOutputRangeContainer->size() << endreq;
ATH_MSG_VERBOSE("OutputRangeCollection with size " << m_cacheOutputRangeContainer->size());
m_cacheOutputRangeContainer->sort(xAOD::SortLumiBlockRangeByStart());
// Use tmp collection to do the merging
......@@ -284,7 +284,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
xAOD::LumiBlockRangeContainer::const_iterator ilast = m_cacheOutputRangeContainer->begin();
xAOD::LumiBlockRange* iovr = new xAOD::LumiBlockRange(*(*i));
p_tempLBColl->push_back(iovr);
ATH_MSG_INFO( "Push_back tmpLBColl with run "
ATH_MSG_VERBOSE( "Push_back tmpLBColl with run "
<< (*i)->startRunNumber() << " LB " << (*i)->startLumiBlockNumber() << " events seen "
<< (*ilast)->eventsSeen() << " expected " << (*i)->eventsExpected());
i++;
......@@ -299,7 +299,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
<< (*ilast)->eventsExpected() << " and " << (*i)->eventsExpected() );
}
else {
ATH_MSG_INFO( "Merge Run " << (*i)->startRunNumber() << " LB " << (*i)->startLumiBlockNumber()
ATH_MSG_VERBOSE( "Merge Run " << (*i)->startRunNumber() << " LB " << (*i)->startLumiBlockNumber()
<< " events seen " << iovr->eventsSeen() << "+"
<< (*i)->eventsSeen() << " and events expected "
<< iovr->eventsExpected() );
......@@ -310,7 +310,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
else {
iovr = new xAOD::LumiBlockRange(*(*i));
ATH_MSG_INFO( "Push_back tmpLBColl with run "
ATH_MSG_VERBOSE( "Push_back tmpLBColl with run "
<< iovr->startRunNumber() << " LB " << iovr->startLumiBlockNumber() << " events seen "
<< iovr->eventsSeen() << " expected " << iovr->eventsExpected());
......@@ -333,7 +333,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
if(piovComplete->size()>0) {
ATH_MSG_INFO( "Number of Complete LumiBlocks:" << piovComplete->size() );
ATH_MSG_DEBUG( "Number of Complete LumiBlocks:" << piovComplete->size() );
xAOD::LumiBlockRangeContainer::const_iterator it;
for(it=piovComplete->begin(); it!=piovComplete->end(); it++) {
msg(MSG::INFO) << "\t [ ("
......@@ -348,7 +348,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
}
if(piovUnfinished->size()>0) {
ATH_MSG_INFO( "Number of Unfinished LumiBlocks:" << piovUnfinished->size() );
ATH_MSG_DEBUG( "Number of Unfinished LumiBlocks:" << piovUnfinished->size() );
xAOD::LumiBlockRangeContainer::const_iterator it;
for(it=piovUnfinished->begin(); it!=piovUnfinished->end(); it++) {
msg(MSG::INFO) << "\t [ ("
......@@ -362,7 +362,7 @@ StatusCode LumiBlockMetaDataTool::finishUp() {
}
}
if(piovSuspect->size()>0) {
ATH_MSG_INFO( "Number of Suspect LumiBlocks:" << piovSuspect->size() );
ATH_MSG_DEBUG( "Number of Suspect LumiBlocks:" << piovSuspect->size() );
xAOD::LumiBlockRangeContainer::const_iterator it;
for(it=piovSuspect->begin(); it!=piovSuspect->end(); it++) {
msg(MSG::INFO) << "\t [ ("
......
......@@ -31,6 +31,7 @@ use CoraCool CoraCool-* Database -no_auto_imports
use DBDataModel DBDataModel-* Database/AthenaPOOL
use EventInfo EventInfo-* Event
use GoodRunsLists GoodRunsLists-* DataQuality
end_private
# Create a dual_use library since the lcgdict pattern doesn't work with component libraries using cmake.
# This pollutes the linkopts for clients, but is otherwise harmless.
......@@ -44,6 +45,11 @@ apply_pattern declare_joboptions files="*.py"
# Create dictionary for LumiBlockComps
private
use AtlasReflex AtlasReflex-* External
apply_pattern lcgdict dict=LumiBlockComps selectionfile=selection.xml headerfiles="../LumiBlockComps/LumiBlockCompsDict.h"
end_private
use_if tag=AthAnalysisBase pkg=xAODRootAccess ver=xAODRootAccess-* root=Control
application getLumi ../util/getLumi.cxx
macro_append getLumi_dependencies " GoodRunsLists LumiBlockCompsLib "
......@@ -159,6 +159,9 @@ class LuminosityToolOnline(LuminosityTool):
super (LuminosityToolOnline, self).__init__(name)
mlog = logging.getLogger(name)
# Keep values for invalid data
self.SkipInvalid = False
from IOVDbSvc.CondDB import conddb
if conddb.dbdata == "COMP200": # Run1
......
......@@ -38,7 +38,9 @@ LuminosityTool::LuminosityTool(const std::string& type,
m_preferredChannel(0),
m_luminousBunches(0),
m_bunchInstLumiBlob(NULL),
m_calibChannel(0)
m_calibChannel(0),
m_calibBackupChannel(112),
m_skipInvalid(true)
{
declareInterface<ILuminosityTool>(this);
declareProperty("LumiFolderName", m_lumiFolderName);
......@@ -48,6 +50,8 @@ LuminosityTool::LuminosityTool(const std::string& type,
declareProperty("BunchGroupTool", m_bunchGroupTool);
declareProperty("OnlineLumiCalibrationTool", m_onlineLumiCalibrationTool);
declareProperty("LBLBFolderName", m_lblbFolderName);
declareProperty("CalibBackupChannel", m_calibBackupChannel);
declareProperty("SkipInvalid", m_skipInvalid);
m_LBAvInstLumi = 0.;
m_LBAvEvtsPerBX = 0.;
......@@ -291,15 +295,19 @@ LuminosityTool::updateAvgLumi( IOVSVC_CALLBACK_ARGS_P(/*idx*/, /*keys*/) )
}
if (attrList["Valid"].isNull()) {
ATH_MSG_WARNING( " NULL validity information ... set lumi to 0" );
return StatusCode::SUCCESS;
ATH_MSG_WARNING( " NULL validity information ... set lumi to 0" );
return StatusCode::SUCCESS;
}
// Check validity (don't bother continuing if invalid)
m_Valid = attrList["Valid"].data<cool::UInt32>();
if (m_Valid & 0x01) {
ATH_MSG_WARNING( " Invalid LB Average luminosity ... set lumi to 0" );
return StatusCode::SUCCESS;
if (m_skipInvalid) {
ATH_MSG_WARNING( " Invalid LB Average luminosity ... set lumi to 0" );
return StatusCode::SUCCESS;
} else {
ATH_MSG_WARNING( " Invalid LB Average luminosity ... continuing because skipInvalid == FALSE" );
}
}
// Get preferred channel (needed for per-BCID calculation)
......@@ -350,7 +358,7 @@ LuminosityTool::updateAvgLumi( IOVSVC_CALLBACK_ARGS_P(/*idx*/, /*keys*/) )
// Check validity of per-BCID luminosity (will issue warning in recalcPerBCIDLumi
int perBcidValid = (m_Valid/10) % 10;
if (perBcidValid > 0) {
if ((perBcidValid > 0) && m_skipInvalid) {
return StatusCode::SUCCESS;
}
......@@ -427,6 +435,20 @@ LuminosityTool::recalculatePerBCIDLumi()
// This is the only correct way to do this!
// The division below gives average mu (over all bunches) to total lumi
m_MuToLumi = m_onlineLumiCalibrationTool->getMuToLumi(m_calibChannel);
// Check if this is reasonable
if (m_MuToLumi < 0.) {
ATH_MSG_INFO(" Found muToLumi = " << m_MuToLumi << " for channel " << m_calibChannel << ". Try backup channel..." );
m_MuToLumi = m_onlineLumiCalibrationTool->getMuToLumi(m_calibBackupChannel);
ATH_MSG_INFO(" Found muToLumi = " << m_MuToLumi << " for channel " << m_calibBackupChannel);
if (m_MuToLumi < 0.) {
ATH_MSG_WARNING(" Found invalid muToLumi = " << m_MuToLumi << " for backup channel " << m_calibBackupChannel << "!");
m_MuToLumi = 0.;
}
}
//} else if (m_LBAvEvtsPerBX > 0.) {
//m_MuToLumi = m_LBAvInstLumi / m_LBAvEvtsPerBX;
} else {
......@@ -609,4 +631,4 @@ LuminosityTool::recalculatePerBCIDLumi()
return;
}
#endif
\ No newline at end of file
#endif
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment