Commit 11513436 authored by Tamara Vazquez Schroeder's avatar Tamara Vazquez Schroeder Committed by Atlas Nightlybuild
Browse files

Merge branch 'FixHepMCWeightSvc-21.0' into '21.0'

Attempted fix for ATLASSIM-3482: If there is only one attributeList, then just…

See merge request !6163
parent 7af728bf
......@@ -70,15 +70,23 @@ StatusCode HepMCWeightSvc::loadWeights() {
//only look a the first one, assuming it exists, and within that only look at the first channel;
if(! (cont->payloadContainer()->size()>0 && cont->payloadContainer()->at(0)->size()>0) ) return StatusCode::FAILURE;
//need to retrieve the EventStreamInfo to get at the channel number
const EventStreamInfo* esi = 0;
CHECK( inputMetaStore->retrieve(esi) );
if(esi->getEventTypes().size() == 0) return StatusCode::FAILURE;
int chanNum = esi->getEventTypes().begin()->mc_channel_number();
if(chanNum==0) {
//perhaps channel number not set yet, use the first run number instead
if(esi->getRunNumbers().size()==0) return StatusCode::FAILURE;
chanNum = *esi->getRunNumbers().begin();
int chanNum(0);
//if there is only one collection of weights, then we just load that one
if(cont->payloadContainer()->at(0)->size()==1) {
chanNum = cont->payloadContainer()->at(0)->chanNum(0);
} else {
ATH_MSG_DEBUG("Multiple /Generation/Parameters attributeLists found ... using EventStreamInfo to determine which to use");
//need to retrieve the EventStreamInfo to get at the channel number
const EventStreamInfo* esi = 0;
CHECK( inputMetaStore->retrieve(esi) );
if(esi->getEventTypes().size() == 0) return StatusCode::FAILURE;
chanNum = esi->getEventTypes().begin()->mc_channel_number();
if(chanNum==0) {
//perhaps channel number not set yet, use the first run number instead
if(esi->getRunNumbers().size()==0) return StatusCode::FAILURE;
chanNum = *esi->getRunNumbers().begin();
}
}
const coral::Attribute& attr = cont->payloadContainer()->at(0)->attributeList(chanNum)["HepMCWeightNames"];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment