Skip to content
Snippets Groups Projects
Commit bbf6ba3a authored by Nabil Garroum's avatar Nabil Garroum Committed by Roel Aaij
Browse files

Add DD4HEP for SciFi DumpFTGeometry

 fot# Please enter the commit message for your changes. Lines starting
parent 8c78b45e
No related branches found
No related tags found
1 merge request!855Add DD4HEP support for Allen converters that deal with SciFi, Velo, Calo, Magnetic field polarity and the Beamline position
......@@ -13,6 +13,7 @@ gaudi_add_library(BinaryDumpers
Gaudi::GaudiKernel
LHCb::DAQEventLib
LHCb::MagnetLib
LHCb::FTDetLib
LHCb::MuonDAQLib)
gaudi_add_module(BinaryDumpersModule
......
......@@ -16,7 +16,8 @@ from PyConf.Algorithms import (
DumpBeamline,
DumpCaloGeometry,
DumpMagneticField,
DumpVPGeometry
DumpVPGeometry,
DumpFTGeometry
)
from threading import Thread
from time import sleep
......@@ -197,7 +198,7 @@ config.add(
'SIMCOND': options.conddb_tag,
}))
converters = [DumpBeamline(), DumpCaloGeometry(), DumpVPGeometry(), DumpMagneticField()]
converters = [DumpBeamline(), DumpCaloGeometry(), DumpVPGeometry(), DumpMagneticField(), DumpFTGeometry()]
producers = []
for converter in converters:
converter_id = converter.type.getDefaultProperties()['ID']
......
// FIXME: LoH: will not work with DD4HEP as is
/*****************************************************************************\
* (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration *
\*****************************************************************************/
......@@ -7,9 +6,26 @@
#include <tuple>
#include <vector>
#include "DumpFTGeometry.h"
//#include "DumpFTGeometry.h"
#include "DumpGeometry.h"
#include <FTDet/DeFTDetector.h>
#include "FTDAQ/FTReadoutMap.h"
#include "Detector/FT/FTChannelID.h"
#include <Dumpers/Utils.h>
//#include "Kernel/FTChannelID.h"
// LHCb
#include <DetDesc/Condition.h>
#include <DetDesc/ConditionAccessorHolder.h>
#include "DetDesc/IConditionDerivationMgr.h"
#include <LHCbAlgs/Transformer.h>
// Gaudi
//#include "GaudiAlg/Transformer.h"
#include <Dumpers/Identifiers.h>
namespace {
using std::ios;
......@@ -17,12 +33,68 @@ namespace {
using std::string;
using std::tuple;
using std::vector;
inline const std::string FTconditionLocation = "/dd/Conditions/ReadoutConf/FT/ReadoutMap";
} // namespace
/** @class DumpCaloGeometry
* Dump Calo Geometry.
*
* @author Nabil Garroum
* @date 2022-04-23
*/
class DumpFTGeometry final
: public LHCb::Algorithm::MultiTransformer<std::tuple<std::vector<char>, std::string>(
const DeFT& , const FTReadoutMap<DumpFTGeometry>&),
LHCb::DetDesc::usesBaseAndConditions<GaudiAlgorithm, FTReadoutMap<DumpFTGeometry>, DeFT>> {
public:
DumpFTGeometry( const std::string& name, ISvcLocator* pSvcLocator );
std::tuple<std::vector<char>, std::string> operator()( const DeFT& DeFT , const FTReadoutMap<DumpFTGeometry>& readoutMap) const override;
StatusCode initialize() override;
Gaudi::Property<std::string> m_id{this, "ID", Allen::NonEventData::SciFiGeometry::id};
private:
Gaudi::Property<std::string> m_mapLocation{this, "ReadoutMapLocation", "/dd/Conditions/ReadoutConf/FT/ReadoutMap"};
};
DECLARE_COMPONENT(DumpFTGeometry)
DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
DumpFTGeometry::DumpFTGeometry( const std::string& name, ISvcLocator* pSvcLocator )
: MultiTransformer{
name,
pSvcLocator,
{KeyValue{"FTLocation", DeFTDetectorLocation::Default},
KeyValue{"ReadoutMapStorage", "AlgorithmSpecific-" + name + "-ReadoutMap"}},
{KeyValue{"Converted", "Allen/NonEventData/DeFT"},
KeyValue{"OutputID", "Allen/NonEventData/DeFTID"}}} {}
StatusCode DumpFTGeometry::initialize()
{
return MultiTransformer::initialize().andThen(
[&] { FTReadoutMap<DumpFTGeometry>::addConditionDerivation( this, inputLocation<FTReadoutMap<DumpFTGeometry>>() ); } );
}
// Add the operator() call
std::tuple<std::vector<char>, std::string> DumpFTGeometry::operator()( const DeFT& det , const FTReadoutMap<DumpFTGeometry>& readoutMap ) const
{
// Detector and mat geometry
#ifdef USE_DD4HEP
// const auto& det = detector();
......@@ -33,7 +105,7 @@ DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
uint32_t number_of_quarters = number_of_quarters_per_layer * number_of_layers;
vector<uint32_t> number_of_modules(number_of_quarters);
#else
const auto& det = detector();
// const auto& det = detector();
const auto& stations = det.stations();
const auto& layersFirstStation = stations[0]->layers();
const auto& quartersFirstLayer = layersFirstStation[0]->quarters();
......@@ -109,10 +181,7 @@ DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
}
}
#endif
// Raw bank layout (from FTReadoutTool)
string conditionLocation = "/dd/Conditions/ReadoutConf/FT/ReadoutMap";
Condition* rInfo = getDet<Condition>(conditionLocation);
auto readoutMap = FTReadoutMap {this, *rInfo};
DumpUtils::Writer output {};
auto comp = readoutMap.compatibleVersions();
......@@ -155,6 +224,7 @@ DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
Gaudi::Utils::toStream(comp, s);
throw GaudiException {"Unsupported conditions compatible with " + s.str(), __FILE__, StatusCode::FAILURE};
}
return {{tuple {output.buffer(), "scifi_geometry", Allen::NonEventData::SciFiGeometry::id}}};
return {{tuple {output.buffer(), "scifi_geometry", Allen::NonEventData::SciFiGeometry::id}}};
// return {{tuple {output.buffer(), "scifi_geometry", Allen::NonEventData::SciFiGeometry::id}}};
return std::tuple {output.buffer(), m_id};
}
......@@ -29,7 +29,7 @@ def setup_allen_non_event_data_service(dump_geometry=False,
# DumpCaloGeometry, name="DumpEcal", Location=ecal_location)
producers = [
p(DumpToFile=dump_geometry, OutputDirectory=out_dir)
for p in (DumpUTGeometry, DumpFTGeometry,
for p in (DumpUTGeometry,
DumpMuonGeometry, DumpMuonTable,
DumpUTLookupTables)
]
......
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