Skip to content
Snippets Groups Projects
Commit 72f37583 authored by Pavol Strizenec's avatar Pavol Strizenec Committed by Walter Lampl
Browse files

Fix splash test

parent 51eb8dd3
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
...@@ -16,6 +16,11 @@ def LArRawDataReadingCfg(configFlags, **kwargs): ...@@ -16,6 +16,11 @@ def LArRawDataReadingCfg(configFlags, **kwargs):
kwargs.setdefault("LArDigitKey", configFlags.Overlay.BkgPrefix + "FREE") kwargs.setdefault("LArDigitKey", configFlags.Overlay.BkgPrefix + "FREE")
kwargs.setdefault("LArRawChannelKey", "") kwargs.setdefault("LArRawChannelKey", "")
print('LArRawDataReadingCfg configFlags.LAr.RawChannelSource ',configFlags.LAr.RawChannelSource)
if configFlags.LAr.RawChannelSource=="calculated":
kwargs.setdefault("LArRawChannelKey", "")
kwargs.setdefault("FailOnCorruption",False) kwargs.setdefault("FailOnCorruption",False)
acc.addEventAlgo(LArRawDataReadingAlg(**kwargs)) acc.addEventAlgo(LArRawDataReadingAlg(**kwargs))
......
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
#include "LArRawDataReadingAlg.h" #include "LArRawDataReadingAlg.h"
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "eformat/Version.h" #include "eformat/Version.h"
#include "eformat/index.h" #include "eformat/index.h"
#include "LArByteStream/LArRodBlockTransparentV0.h"
#include "LArByteStream/LArRodBlockCalibrationV3.h"
#include "LArByteStream/LArRodBlockStructure.h" #include "LArByteStream/LArRodBlockStructure.h"
#include "LArByteStream/LArRodBlockPhysicsV5.h" #include "LArByteStream/LArRodBlockPhysicsV5.h"
#include "LArByteStream/LArRodBlockPhysicsV6.h" #include "LArByteStream/LArRodBlockPhysicsV6.h"
...@@ -121,7 +123,20 @@ StatusCode LArRawDataReadingAlg::execute(const EventContext& ctx) const { ...@@ -121,7 +123,20 @@ StatusCode LArRawDataReadingAlg::execute(const EventContext& ctx) const {
return m_failOnCorruption ? StatusCode::FAILURE : StatusCode::SUCCESS; return m_failOnCorruption ? StatusCode::FAILURE : StatusCode::SUCCESS;
}// end switch(rodMinorVersion) }// end switch(rodMinorVersion)
}//end of rodBlockType==4 }//end of rodBlockType==4
else { else if (rodBlockType==2) { //Transparent mode
switch(rodMinorVersion) {
case 4:
rodBlock.reset(new LArRodBlockTransparentV0<LArRodBlockHeaderTransparentV0>);
break;
case 12:
rodBlock.reset(new LArRodBlockCalibrationV3);
break;
default:
ATH_MSG_ERROR("Found unsupported ROD Block version " << rodMinorVersion
<< " of ROD block type " << rodBlockType);
return m_failOnCorruption ? StatusCode::FAILURE : StatusCode::SUCCESS;
}
} else {
if(rob.rod_source_id()& 0x1000 ){ if(rob.rod_source_id()& 0x1000 ){
ATH_MSG_DEBUG(" skip Latome fragment with source ID "<< std::hex << rob.rod_source_id()); ATH_MSG_DEBUG(" skip Latome fragment with source ID "<< std::hex << rob.rod_source_id());
rodBlock=nullptr; rodBlock=nullptr;
......
/* /*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
#include "LArROD/LArRawChannelBuilderAlg.h" #include "LArROD/LArRawChannelBuilderAlg.h"
...@@ -109,11 +109,14 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { ...@@ -109,11 +109,14 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
const auto& adc2mev=adc2MeVs->ADC2MEV(id,gain); const auto& adc2mev=adc2MeVs->ADC2MEV(id,gain);
//Sanity check on input conditions data: //Sanity check on input conditions data:
if(ATH_UNLIKELY(ofca.size()!=nSamples)) { // FIXME: fix to get splash test running, should implement the iterations later
size_t len=nSamples;
if(ATH_UNLIKELY(ofca.size()<nSamples)) {
if (!connected) continue; //No conditions for disconencted channel, who cares? if (!connected) continue; //No conditions for disconencted channel, who cares?
ATH_MSG_ERROR("Number of OFC a's doesn't match number of samples for conencted channel " << m_onlineId->channel_name(id) ATH_MSG_DEBUG("Number of OFC a's doesn't match number of samples for conencted channel " << m_onlineId->channel_name(id)
<< " gain " << gain << ". OFC size=" << ofca.size() << ", nbr ADC samples=" << nSamples); << " gain " << gain << ". OFC size=" << ofca.size() << ", nbr ADC samples=" << nSamples);
return StatusCode::FAILURE; //return StatusCode::FAILURE;
len=ofca.size();
} }
if (ATH_UNLIKELY(p==ILArPedestal::ERRORCODE)) { if (ATH_UNLIKELY(p==ILArPedestal::ERRORCODE)) {
...@@ -134,7 +137,7 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { ...@@ -134,7 +137,7 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
//Apply OFCs to get amplitude //Apply OFCs to get amplitude
float A=0; float A=0;
bool saturated=false; bool saturated=false;
for (size_t i=0;i<nSamples;++i) { for (size_t i=0;i<len;++i) {
A+=(samples[i]-p)*ofca[i]; A+=(samples[i]-p)*ofca[i];
if (samples[i]==4096 || samples[i]==0) saturated=true; if (samples[i]==4096 || samples[i]==0) saturated=true;
} }
...@@ -173,7 +176,7 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { ...@@ -173,7 +176,7 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
//Get time by applying OFC-b coefficients: //Get time by applying OFC-b coefficients:
const auto& ofcb=ofcs->OFC_b(id,gain); const auto& ofcb=ofcs->OFC_b(id,gain);
float At=0; float At=0;
for (size_t i=0;i<nSamples;++i) { for (size_t i=0;i<len;++i) {
At+=(samples[i]-p)*ofcb[i]; At+=(samples[i]-p)*ofcb[i];
} }
//Divide A*t/A to get time //Divide A*t/A to get time
...@@ -189,12 +192,15 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { ...@@ -189,12 +192,15 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
} }
} }
// FIXME: fix to get splash test running, should implement the iterations later
len=nSamples;
if (ATH_UNLIKELY(fullShape.size()<nSamples+firstSample)) { if (ATH_UNLIKELY(fullShape.size()<nSamples+firstSample)) {
if (!connected) continue; //No conditions for disconnected channel, who cares? if (!connected) continue; //No conditions for disconnected channel, who cares?
ATH_MSG_ERROR("No valid shape for channel " << m_onlineId->channel_name(id) ATH_MSG_DEBUG("No valid shape for channel " << m_onlineId->channel_name(id)
<< " gain " << gain); << " gain " << gain);
ATH_MSG_ERROR("Got size " << fullShape.size() << ", expected at least " << nSamples+firstSample); ATH_MSG_DEBUG("Got size " << fullShape.size() << ", expected at least " << nSamples+firstSample);
return StatusCode::FAILURE; //return StatusCode::FAILURE;
len=fullShape.size()-firstSample;
} }
const float* shape=&*fullShape.begin()+firstSample; const float* shape=&*fullShape.begin()+firstSample;
...@@ -203,20 +209,20 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { ...@@ -203,20 +209,20 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
if (m_useShapeDer) { if (m_useShapeDer) {
const auto& fullshapeDer=shapes->ShapeDer(id,gain); const auto& fullshapeDer=shapes->ShapeDer(id,gain);
if (ATH_UNLIKELY(fullshapeDer.size()<nSamples+firstSample)) { if (ATH_UNLIKELY(fullshapeDer.size()<nSamples+firstSample)) {
ATH_MSG_ERROR("No valid shape derivative for channel " << m_onlineId->channel_name(id) ATH_MSG_DEBUG("No valid shape derivative for channel " << m_onlineId->channel_name(id)
<< " gain " << gain); << " gain " << gain);
ATH_MSG_ERROR("Got size " << fullshapeDer.size() << ", expected at least " << nSamples+firstSample); ATH_MSG_DEBUG("Got size " << fullshapeDer.size() << ", expected at least " << nSamples+firstSample);
return StatusCode::FAILURE; //return StatusCode::FAILURE;
} }
const float* shapeDer=&*fullshapeDer.begin()+firstSample; const float* shapeDer=&*fullshapeDer.begin()+firstSample;
for (size_t i=0;i<nSamples;++i) { for (size_t i=0;i<len;++i) {
q += std::pow((A*(shape[i]-tau*shapeDer[i])-(samples[i]-p)),2); q += std::pow((A*(shape[i]-tau*shapeDer[i])-(samples[i]-p)),2);
} }
}//end if useShapeDer }//end if useShapeDer
else { else {
//Q-factor w/o shape derivative //Q-factor w/o shape derivative
for (size_t i=0;i<nSamples;++i) { for (size_t i=0;i<len;++i) {
q += std::pow((A*shape[i]-(samples[i]-p)),2); q += std::pow((A*shape[i]-(samples[i]-p)),2);
} }
} }
......
...@@ -33,7 +33,14 @@ if rec.doMuon(): ...@@ -33,7 +33,14 @@ if rec.doMuon():
if DetFlags.readRDOBS.LAr_on(): if DetFlags.readRDOBS.LAr_on():
from LArByteStream.LArByteStreamConf import LArRawDataReadingAlg from LArByteStream.LArByteStreamConf import LArRawDataReadingAlg
topSequence+=LArRawDataReadingAlg(FailOnCorruption=False) from LArConditionsCommon.LArRunFormat import getLArFormatForRun
from RecExConfig.AutoConfiguration import GetRunNumber
runNum = GetRunNumber()
lri=getLArFormatForRun(runNum)
if lri.runType()==0:
topSequence+=LArRawDataReadingAlg(FailOnCorruption=True,LArRawChannelKey="",OutputLevel=DEBUG)
else:
topSequence+=LArRawDataReadingAlg(FailOnCorruption=False)
if DetFlags.readRDOBS.Tile_on(): if DetFlags.readRDOBS.Tile_on():
svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
......
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