Skip to content
Snippets Groups Projects
Commit 21872a94 authored by Shaun Roe's avatar Shaun Roe Committed by Frank Winklmeier
Browse files

main-cleanup-SCT_Cabling

main-cleanup-SCT_Cabling
parent 5cec0cf4
No related branches found
No related tags found
27 merge requests!78241Draft: FPGATrackSim: GenScan code refactor,!78236Draft: Switching Streams https://its.cern.ch/jira/browse/ATR-27417,!78056AFP monitoring: new synchronization and cleaning,!78041AFP monitoring: new synchronization and cleaning,!77990Updating TRT chip masks for L1TRT trigger simulation - ATR-28372,!77733Draft: add new HLT NN JVT, augmented with additional tracking information,!77731Draft: Updates to ZDC reconstruction,!77728Draft: updates to ZDC reconstruction,!77522Draft: sTGC Pad Trigger Emulator,!76725ZdcNtuple: Fix cppcheck warning.,!76611L1CaloFEXByteStream: Fix out-of-bounds array accesses.,!76475Punchthrough AF3 implementation in FastG4,!76474Punchthrough AF3 implementation in FastG4,!75729New implementation of ZDC nonlinear FADC correction.,!75703Draft: Update to HI han config for HLT jets,!75184Draft: Update file heavyions_run.config,!74430Draft: Fixing upper bound for Delayed Jet Triggers,!73963Changing the path of the histograms to "Expert" area,!73875updating ID ART reference plots,!73874AtlasCLHEP_RandomGenerators: Fix cppcheck warnings.,!73449Add muon detectors to DarkJetPEBTLA partial event building,!73343Draft: [TrigEgamma] Add photon ringer chains on bootstrap mechanism,!72336Fixed TRT calibration crash,!72176Draft: Improving L1TopoOnline chain that now gets no-empty plots. Activating it by default,!72012Draft: Separate JiveXMLConfig.py into Config files,!71876Fix MET trigger name in MissingETMonitoring,!71858main-cleanup-SCT_Cabling
......@@ -34,3 +34,16 @@ atlas_add_test( SCT_OnlineId_test
POST_EXEC_SCRIPT nopost.sh
)
atlas_add_test( SCT_CablingCondAlgFromText_test
SOURCES test/SCT_CablingCondAlgFromText_test.cxx src/SCT_CablingCondAlgFromText.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} TestTools AthenaBaseComps GaudiKernel
AthenaPoolUtilities PathResolver StoreGateLib IdDictParser SCT_CablingLib
InDetIdentifier
POST_EXEC_SCRIPT "nopost.sh"
)
atlas_install_joboptions(share/*.txt)
atlas_install_runtime(share/*.dat)
ApplicationMgr.ExtSvc += { "StoreGateSvc", "StoreGateSvc/ConditionStore" };
MessageSvc.OutputLevel = 3;
SCT_CablingCondAlgFromText.OutputLevel = 1;
<?xml version="1.0"?>
<SCT_textFile>
<textList name="SCT Rod-Rob mapping" headings="RodId RobId">
0x240100 0x240100
</textList>
<textList name="SCT cabling mapping" headings="Rod Fibre Bec LayerDisk Eta Phi Side RobId Sn">
79 36 -2 0 0 0 0 0x240100 20220250000070
79 37 -2 0 0 0 1 0x240100 20220250000070
79 12 -2 0 1 0 0 0x240100 20220240100431
79 13 -2 0 1 0 1 0x240100 20220240100431
79 38 -2 0 0 1 0 0x240100 20220130000521
79 39 -2 0 0 1 1 0x240100 20220130000521
79 14 -2 0 1 1 0 0x240100 20220240100586
79 15 -2 0 1 1 1 0x240100 20220240100586
79 40 -2 0 0 2 0 0x240100 20220130000564
79 41 -2 0 0 2 1 0x240100 20220130000564
79 16 -2 0 1 2 0 0x240100 20220240100598
79 17 -2 0 1 2 1 0x240100 20220240100598
79 42 -2 0 0 3 0 0x240100 20220240100666
79 43 -2 0 0 3 1 0x240100 20220240100666
79 18 -2 0 1 3 0 0x240100 20220240100605
79 19 -2 0 1 3 1 0x240100 20220240100605
79 44 -2 0 0 4 0 0x240100 20220130000355
79 45 -2 0 0 4 1 0x240100 20220130000355
79 20 -2 0 1 4 0 0x240100 20220240100573
79 21 -2 0 1 4 1 0x240100 20220240100573
79 46 -2 0 0 5 0 0x240100 20220130000183
79 47 -2 0 0 5 1 0x240100 20220130000183
79 22 -2 0 1 5 0 0x240100 20220240100607
79 23 -2 0 1 5 1 0x240100 20220240100607
79 0 -2 0 0 6 0 0x240100 20220130000181
79 1 -2 0 0 6 1 0x240100 20220130000181
79 2 -2 0 1 6 0 0x240100 20220240100329
79 3 -2 0 1 6 1 0x240100 20220240100329
79 24 -2 0 0 7 0 0x240100 20220240100682
79 25 -2 0 0 7 1 0x240100 20220240100682
79 4 -2 0 1 7 0 0x240100 20220240100599
79 5 -2 0 1 7 1 0x240100 20220240100599
79 26 -2 0 0 8 0 0x240100 20220130000499
79 27 -2 0 0 8 1 0x240100 20220130000499
79 6 -2 0 1 8 0 0x240100 20220240100621
79 7 -2 0 1 8 1 0x240100 20220240100621
79 28 -2 0 0 9 0 0x240100 20220130000562
79 29 -2 0 0 9 1 0x240100 20220130000562
79 8 -2 0 1 9 0 0x240100 20220240100594
79 9 -2 0 1 9 1 0x240100 20220240100594
79 30 -2 0 0 10 0 0x240100 20220240100692
79 31 -2 0 0 10 1 0x240100 20220240100692
79 32 -2 0 0 11 0 0x240100 20220130000500
79 33 -2 0 0 11 1 0x240100 20220130000500
79 34 -2 0 0 12 0 0x240100 20220240100684
79 35 -2 0 0 12 1 0x240100 20220240100684
79 60 -2 1 0 0 0 0x240100 20220390001007
79 61 -2 1 0 0 1 0x240100 20220390001007
79 62 -2 1 0 1 0 0x240100 20220390001079
79 63 -2 1 0 1 1 0x240100 20220390001079
79 64 -2 1 0 2 0 0x240100 20220390001051
79 65 -2 1 0 2 1 0x240100 20220390001051
79 66 -2 1 0 3 0 0x240100 20220390001040
79 67 -2 1 0 3 1 0x240100 20220390001040
79 68 -2 1 0 4 0 0x240100 20220390001029
79 69 -2 1 0 4 1 0x240100 20220390001029
79 70 -2 1 0 5 0 0x240100 20220390001102
79 71 -2 1 0 5 1 0x240100 20220390001102
79 48 -2 1 0 7 0 0x240100 20220390001106
79 49 -2 1 0 7 1 0x240100 20220390001106
79 50 -2 1 0 8 0 0x240100 20220390001095
79 51 -2 1 0 8 1 0x240100 20220390001095
79 52 -2 1 0 9 0 0x240100 20220390001085
79 53 -2 1 0 9 1 0x240100 20220390001085
79 54 -2 1 0 10 0 0x240100 20220390001038
79 55 -2 1 0 10 1 0x240100 20220390001038
79 56 -2 1 0 11 0 0x240100 20220390001024
79 57 -2 1 0 11 1 0x240100 20220390001024
79 58 -2 1 0 12 0 0x240100 20220390001117
79 59 -2 1 0 12 1 0x240100 20220390001117
79 84 -2 2 0 0 0 0x240100 20220390001031
79 85 -2 2 0 0 1 0x240100 20220390001031
79 86 -2 2 0 1 0 0x240100 20220390001065
79 87 -2 2 0 1 1 0x240100 20220390001065
79 88 -2 2 0 2 0 0x240100 20220390001055
79 89 -2 2 0 2 1 0x240100 20220390001055
79 90 -2 2 0 3 0 0x240100 20220390001087
79 91 -2 2 0 3 1 0x240100 20220390001087
79 92 -2 2 0 4 0 0x240100 20220390001064
79 93 -2 2 0 4 1 0x240100 20220390001064
79 94 -2 2 0 5 0 0x240100 20220390001122
79 95 -2 2 0 5 1 0x240100 20220390001122
79 72 -2 2 0 7 0 0x240100 20220390001021
79 73 -2 2 0 7 1 0x240100 20220390001021
79 74 -2 2 0 8 0 0x240100 20220390001107
79 75 -2 2 0 8 1 0x240100 20220390001107
79 76 -2 2 0 9 0 0x240100 20220390001046
79 77 -2 2 0 9 1 0x240100 20220390001046
79 78 -2 2 0 10 0 0x240100 20220390001121
79 79 -2 2 0 10 1 0x240100 20220390001121
79 80 -2 2 0 11 0 0x240100 20220390001004
79 81 -2 2 0 11 1 0x240100 20220390001004
79 82 -2 2 0 12 0 0x240100 20220390001012
79 83 -2 2 0 12 1 0x240100 20220390001012
</textList>
</SCT_textFile>
\ No newline at end of file
/*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file SCT_Cabling/test/SCT_CablingCondAlgFromText_test.cxx
* @author Shaun Roe
* @date May 2024
* @brief Some tests for SCT_CablingCondAlgFromText in the Boost framework
*/
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#define BOOST_TEST_MODULE TEST_SCT_Cabling
#include <boost/test/unit_test.hpp>
//
#include "AthenaKernel/ExtendedEventContext.h"
#include "GaudiKernel/EventContext.h"
#include "GaudiKernel/ServiceLocatorHelper.h"
//
#include "CxxUtils/checker_macros.h"
#include "TestTools/initGaudi.h"
#include "TInterpreter.h"
#include "CxxUtils/ubsan_suppress.h"
#include "CxxUtils/checker_macros.h"
#include "IdDictParser/IdDictParser.h"
#include "InDetIdentifier/SCT_ID.h"
#include "src/SCT_CablingCondAlgFromText.h"
#include "StoreGate/ReadHandleKey.h"
#include <string>
#include <memory>
namespace utf = boost::unit_test;
ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
struct GaudiKernelFixture{
static ISvcLocator* svcLoc;
const std::string jobOpts{};
GaudiKernelFixture(const std::string & jobOptionFile = "SCT_CablingCondAlgFromText_test.txt"):jobOpts(jobOptionFile){
CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); } );
if (svcLoc==nullptr){
std::string fullJobOptsName="SCT_Cabling/" + jobOpts;
Athena_test::initGaudi(fullJobOptsName, svcLoc);
}
}
};
ISvcLocator* GaudiKernelFixture::svcLoc = nullptr;
static const std::string sctDictFilename{"InDetIdDictFiles/IdDictInnerDetector_IBL3D25-03.xml"};
//from EventIDBase
typedef unsigned int number_type;
typedef uint64_t event_number_t;
std::pair <EventIDBase, EventContext>
getEvent(number_type runNumber, number_type timeStamp){
event_number_t eventNumber(0);
EventIDBase eid(runNumber, eventNumber, timeStamp);
EventContext ctx;
ctx.setEventID (eid);
return {eid, ctx};
}
std::pair<const SCT_CablingData *, CondCont<SCT_CablingData> *>
getData(const EventIDBase & eid, ServiceHandle<StoreGateSvc> & conditionStore){
CondCont<SCT_CablingData> * cc{};
const SCT_CablingData* data = nullptr;
const EventIDRange* range2p = nullptr;
if (not conditionStore->retrieve (cc, "SCT_CablingData").isSuccess()){
return {nullptr, nullptr};
}
cc->find (eid, data, &range2p);
return {data,cc};
}
bool
canRetrieveSCT_CablingData(ServiceHandle<StoreGateSvc> & conditionStore){
CondCont<SCT_CablingData> * cc{};
if (not conditionStore->retrieve (cc, "SCT_CablingData").isSuccess()){
return false;
}
return true;
}
BOOST_AUTO_TEST_SUITE(SCT_CablingCondAlgFromTextTest )
GaudiKernelFixture g;
BOOST_AUTO_TEST_CASE( SanityCheck ){
const bool svcLocatorIsOk=(g.svcLoc != nullptr);
BOOST_TEST(svcLocatorIsOk);
}
//https://acode-browser.usatlas.bnl.gov/lxr/source/athena/InnerDetector/InDetDetDescr/InDetIdentifier/test/SCT_ID_test.cxx
BOOST_AUTO_TEST_CASE(ExecuteOptions){
{//This is just to setup the SCT_ID with a valid set of identifiers
const ServiceLocatorHelper helper{*(g.svcLoc), "HELPER"};
IService* iSvc{helper.service("StoreGateSvc/DetectorStore", true /*quiet*/ , true /*createIf*/)};
StoreGateSvc* detStore{dynamic_cast<StoreGateSvc*>(iSvc)};
IdDictParser parser;
parser.register_external_entity("InnerDetector", sctDictFilename);
IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
auto pSctId=std::make_unique<SCT_ID>();
BOOST_TEST(pSctId->initialize_from_dictionary(idd)==0);
BOOST_TEST(detStore->record(std::move(pSctId), "SCT_ID").isSuccess());
}//Now the SCT_ID is in StoreGate, ready to be used by the cabling
SCT_CablingCondAlgFromText a("MyAlg", g.svcLoc);
a.addRef();
//add property definitions for later (normally in job opts)
BOOST_TEST(a.setProperty("DataSource","SCT_Cabling_svc.dat").isSuccess());
//
BOOST_TEST(a.sysInitialize().isSuccess() );
ServiceHandle<StoreGateSvc> conditionStore ("ConditionStore", "SCT_CablingData");
CondCont<SCT_CablingData> * cc{};
BOOST_TEST( canRetrieveSCT_CablingData(conditionStore));
//execute for the following event:
EventContext ctx;
//
number_type runNumber(222222 - 100);//run 1
event_number_t eventNumber(0);
number_type timeStamp(0);
EventIDBase eidRun1 (runNumber, eventNumber, timeStamp);
ctx.setEventID (eidRun1);
BOOST_TEST(a.execute(ctx).isSuccess());
//now we have something in store to retrieve
BOOST_TEST( conditionStore->retrieve (cc, "SCT_CablingData").isSuccess() );
const SCT_CablingData* data = nullptr;
const EventIDRange* range2p = nullptr;
BOOST_TEST (cc->find (eidRun1, data, &range2p));
//
BOOST_TEST(conditionStore->removeDataAndProxy(cc).isSuccess());
BOOST_TEST(a.sysFinalize().isSuccess() );
}
BOOST_AUTO_TEST_SUITE_END();
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