Skip to content
Snippets Groups Projects
Commit d6a645a2 authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2:
Browse files

Merge branch 'master' of ssh://gitlab.cern.ch:7999/jojungge/athena into large_d0_muons

parents 5c338ff2 6effd81e
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!36175Add muons built from large d0 tracking.
Showing
with 1208 additions and 1126 deletions
......@@ -5,17 +5,16 @@
/** @file MetaDataSvc.cxx
* @brief This file contains the implementation for the MetaDataSvc class.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: MetaDataSvc.cxx,v 1.46 2008-11-19 23:21:10 gemmeren Exp $
**/
#include "MetaDataSvc.h"
#include "Gaudi/Interfaces/IOptionsSvc.h"
#include "GaudiKernel/IAddressCreator.h"
#include "GaudiKernel/IAlgTool.h"
#include "GaudiKernel/IEvtSelector.h"
#include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/IIoComponentMgr.h"
#include "GaudiKernel/IJobOptionsSvc.h"
#include "GaudiKernel/IOpaqueAddress.h"
#include "GaudiKernel/FileIncident.h"
......@@ -142,21 +141,15 @@ StatusCode MetaDataSvc::initialize() {
ATH_MSG_FATAL("Cannot register myself with the IoComponentMgr.");
return(StatusCode::FAILURE);
}
ServiceHandle<IJobOptionsSvc> joSvc("JobOptionsSvc", name());
ServiceHandle<Gaudi::Interfaces::IOptionsSvc> joSvc("JobOptionsSvc", name());
if (!joSvc.retrieve().isSuccess()) {
ATH_MSG_WARNING("Cannot get JobOptionsSvc.");
} else {
const std::vector<const Gaudi::Details::PropertyBase*>* evtselProps = joSvc->getProperties("EventSelector");
if (evtselProps != nullptr) {
for (std::vector<const Gaudi::Details::PropertyBase*>::const_iterator iter = evtselProps->begin(),
last = evtselProps->end(); iter != last; iter++) {
if ((*iter)->name() == "InputCollections") {
// Get EventSelector to force in-time initialization and FirstInputFile incident
ServiceHandle<IEvtSelector> evtsel("EventSelector", this->name());
if (!evtsel.retrieve().isSuccess()) {
ATH_MSG_WARNING("Cannot get EventSelector.");
}
}
if (joSvc->has("EventSelector.InputCollections")) {
// Get EventSelector to force in-time initialization and FirstInputFile incident
ServiceHandle<IEvtSelector> evtsel("EventSelector", this->name());
if (!evtsel.retrieve().isSuccess()) {
ATH_MSG_WARNING("Cannot get EventSelector.");
}
}
}
......
......@@ -9,22 +9,18 @@
#include "StoreGate/StoreGateSvc.h"
#include "StoreGate/StoreClearedIncident.h"
#include "GaudiKernel/IJobOptionsSvc.h"
#include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/Guards.h"
#include "GaudiKernel/IOpaqueAddress.h"
#include "GaudiKernel/IProperty.h"
#include "AthenaKernel/IOVRange.h"
#include "IOVDbDataModel/IOVMetaDataContainer.h"
#include "AthenaKernel/IAddressProvider.h"
#include "FileCatalog/IFileCatalog.h"
#include "EventInfo/TagInfo.h"
#include "EventInfoUtils/EventIDFromStore.h"
#include "IOVDbParser.h"
#include "IOVDbFolder.h"
#include "IOVDbSvc.h"
......@@ -33,19 +29,6 @@
// helper function for getting jobopt properties
namespace {
template<typename Prop_t>
bool
fetchProp( const std::vector<const Gaudi::Details::PropertyBase*>* properties, Prop_t& p ){
if (properties) {
for ( const auto & pThisProperty: *properties ) {
if ( pThisProperty->name()==p.name() ) {
return (pThisProperty->load(p));
}
}
}
return false;
}
bool
refersToConditionsFolder(const TagInfo::NameTagPair & thisPair){
return thisPair.first.front() == '/';
......@@ -771,22 +754,16 @@ StatusCode IOVDbSvc::checkEventSel() {
// if so, we can set IOV time already to allow conditons retrieval
// in the initialise phase, needed for setting up simulation
// access jobOptionSvc and get properties of EventSelector
ServiceHandle<IJobOptionsSvc> joSvc("JobOptionsSvc",name());
if (!joSvc.retrieve().isSuccess()) {
ATH_MSG_FATAL( "Could not retrieve [" << joSvc.typeAndName() << "]" );
return StatusCode::FAILURE;
}
typedef std::vector<const Gaudi::Details::PropertyBase*> Properties_t;
const Properties_t* evtSelProps=joSvc->getProperties("EventSelector");
// do not return FAILURE if the EventSelector cannot be found, as this
// happens online when we have no EventSelector
if (0==evtSelProps) {
ATH_MSG_DEBUG( "Could not retrieve properties of 'EventSelector' from ["<< joSvc.typeAndName() << "]" );
SmartIF<IProperty> evtSel = service<IProperty>("EventSelector", /*createIf=*/ false);
if (!evtSel.isValid()) {
// do not return FAILURE if the EventSelector cannot be found, as this
// happens online when we have no EventSelector
ATH_MSG_DEBUG( "Could not retrieve 'EventSelector'" );
return StatusCode::SUCCESS;
}
BooleanProperty bprop("OverrideRunNumber",false);
if (fetchProp<BooleanProperty>(evtSelProps,bprop)) {
if (evtSel->getProperty(&bprop)) {
if (bprop.value()) {
// if flag is set, extract Run,LB and time
ATH_MSG_INFO( "Setting run/LB/time from EventSelector override in initialize" );
......@@ -797,21 +774,21 @@ StatusCode IOVDbSvc::checkEventSel() {
m_par_forceLumiblockNumber.value()!=0)
ATH_MSG_WARNING( "forceRunNumber property also set" );
IntegerProperty iprop1("RunNumber",0);
if (fetchProp<IntegerProperty>(evtSelProps,iprop1)) {
if (evtSel->getProperty(&iprop1)) {
run=iprop1.value();
} else {
ATH_MSG_ERROR( "Unable to get RunNumber from EventSelector");
allGood=false;
}
IntegerProperty iprop2("FirstLB",0);
if (fetchProp<IntegerProperty>(evtSelProps,iprop2)) {
if (evtSel->getProperty(&iprop2)) {
lumib=iprop2.value();
} else {
ATH_MSG_ERROR( "Unable to get FirstLB from EventSelector");
allGood=false;
}
IntegerProperty iprop3("InitialTimeStamp",0);
if (fetchProp<IntegerProperty>(evtSelProps,iprop3)) {
if (evtSel->getProperty(&iprop3)) {
time=iprop3.value();
} else {
ATH_MSG_ERROR("Unable to get InitialTimeStamp from EventSelector" );
......
......@@ -52,7 +52,7 @@ if DetFlags.overlay.Truth_on():
if DetFlags.overlay.pixel_on():
outStream.ItemList += ["PixelRDO_Container#*"]
outStream.ItemList += ["InDetBSErrContainer#*"]
outStream.ItemList += ["IDCInDetBSErrContainer#*"]
if DetFlags.overlay.SCT_on():
outStream.ItemList += ["SCT_RDO_Container#*"]
if DetFlags.overlay.TRT_on():
......
......@@ -38,7 +38,7 @@ if DetFlags.overlay.Truth_on():
if DetFlags.overlay.pixel_on():
outStream.ItemList += [ 'InDetSimDataCollection#PixelSDO_Map' ]
if overlayFlags.isDataOverlay():
outStream.ItemList += [ 'InDetBSErrContainer#PixelByteStreamErrs' ]
outStream.ItemList += [ 'IDCInDetBSErrContainer#PixelByteStreamErrs' ]
if DetFlags.overlay.SCT_on():
outStream.ItemList += ['InDetSimDataCollection#SCT_SDO_Map']
......
......@@ -44,7 +44,7 @@ class TrigApp(object):
for p in jobOptSvc.items():
name = p._0
value = p._1
client, prop = name.split('.',1)
client, prop = name.rsplit('.',1)
if reClient.match(client) and reProp.match(prop):
self.log.info("Changing %s.%s from '%s' to '%s'", client, prop, value, newValue)
iprop = iProperty(client)
......
......@@ -109,7 +109,8 @@ StatusCode HltROBDataProviderSvc::initialize()
if ((jobOptionsSvc.retrieve()).isFailure()) {
ATH_MSG_ERROR("Could not find JobOptionsSvc");
} else {
if (m_enabledROBs.fromString(jobOptionsSvc->get("DataFlowConfig.DF_Enabled_ROB_IDs","[]")).isSuccess()) {
if (jobOptionsSvc->has("DataFlowConfig.DF_Enabled_ROB_IDs") &&
m_enabledROBs.fromString(jobOptionsSvc->get("DataFlowConfig.DF_Enabled_ROB_IDs")).isSuccess()) {
robOKSconfigFound = true;
ATH_MSG_INFO(" ---> Read from OKS = "
<< MSG::dec << m_enabledROBs.value().size() << " enabled ROB IDs.");
......
......@@ -1279,11 +1279,11 @@ GeoSimplePolygonBrep* GeoPixelDetailedStaveSupport::computeStaveEnvelopShape( do
double xMid = xVertices[0]-m_width_svc*xDir;
double yMid = yVertices[0]-m_width_svc*yDir+1.;
convexStaveEnvelopShape->addVertex(xMid, yMid);
convexStaveEnvelopShape->addVertex(xMid-2.*delta*m_thicknessN_svc, yMid);
convexStaveEnvelopShape->addVertex(xMid-delta*m_thicknessN_svc, yMid);
xMid = xVertices[0]-m_width_svc*xDir;
yMid = yVertices[0]-m_width_svc*.25*yDir+1.;
convexStaveEnvelopShape->addVertex(xMid-2.*delta*m_thicknessN_svc, yMid);
convexStaveEnvelopShape->addVertex(xMid-delta*m_thicknessN_svc, yMid);
convexStaveEnvelopShape->addVertex(xMid-delta*m_thicknessN_svc*.5, yMid);
convexStaveEnvelopShape->addVertex(xMid-delta*m_thicknessN_svc*.5, yVertices[0]);
......
......@@ -53,7 +53,7 @@ def PixelOverlayAlgCfg(flags, name="PixelOverlay", **kwargs):
if flags.Overlay.DataOverlay:
acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
"InDetBSErrContainer#PixelByteStreamErrs"
"IDCInDetBSErrContainer#PixelByteStreamErrs"
]))
if flags.Output.doWriteRDO_SGNL:
......
......@@ -23,7 +23,6 @@
#include "MagFieldElements/BFieldMeshZR.h"
#include "MagFieldElements/BFieldZone.h"
#include <iostream>
#include <memory>
namespace MagField {
......
......@@ -2,73 +2,63 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
//
// BFieldMeshZR.h
//
// A 2-dim z-r mesh inside the solenoid field map
//
// Masahiro Morii, Harvard University
//
/*
* BFieldMeshZR.h
*
* A 2-dim z-r mesh inside the solenoid field map
*
* Masahiro Morii, Harvard University
*
* AthenaMT : RD Schaffer , Christos Anastopoulos
*/
#ifndef BFIELDMESHZR_H
#define BFIELDMESHZR_H
#include "MagFieldElements/BFieldCacheZR.h"
#include "MagFieldElements/BFieldVectorZR.h"
#include <array>
#include <cmath>
#include <vector>
#include <array>
class BFieldMeshZR
{
public:
// constructor
BFieldMeshZR(double zmin, double zmax, double rmin, double rmax)
{
m_min = { zmin, rmin };
m_max = { zmax, rmax };
}
BFieldMeshZR(double zmin, double zmax, double rmin, double rmax);
// allocate space to vectors
void reserve(int nz, int nr)
{
m_mesh[0].reserve(nz);
m_mesh[1].reserve(nr);
m_field.reserve(nz * nr);
}
void reserve(int nz, int nr);
// add elements to vectors
void appendMesh(int i, double mesh) { m_mesh[i].push_back(mesh); }
void appendField(const BFieldVectorZR& field) { m_field.push_back(field); }
void appendMesh(int i, double mesh);
void appendField(const BFieldVectorZR& field);
// build LUT
void buildLUT();
// test if a point is inside this zone
inline bool inside(double z, double r) const
{
return (z >= zmin() && z <= zmax() && r >= rmin() && r <= rmax());
}
bool inside(double z, double r) const;
// find the bin
inline void getCache(double z,
double r,
BFieldCacheZR& cache,
double scaleFactor = 1.0) const;
// accessors
double min(size_t i) const { return m_min[i]; }
double max(size_t i) const { return m_max[i]; }
double zmin() const { return m_min[0]; }
double zmax() const { return m_max[0]; }
double rmin() const { return m_min[1]; }
double rmax() const { return m_max[1]; }
unsigned nmesh(size_t i) const { return m_mesh[i].size(); }
double mesh(size_t i, size_t j) const { return m_mesh[i][j]; }
unsigned nfield() const { return m_field.size(); }
const BFieldVectorZR& field(size_t i) const { return m_field[i]; }
double min(size_t i) const;
double max(size_t i) const;
double zmin() const;
double zmax() const;
double rmin() const;
double rmax() const;
unsigned nmesh(size_t i) const;
double mesh(size_t i, size_t j) const;
unsigned nfield() const;
const BFieldVectorZR& field(size_t i) const;
int memSize() const;
private:
std::array<double,2> m_min;
std::array<double,2> m_max;
std::array<std::vector<double>,2> m_mesh;
std::array<double, 2> m_min;
std::array<double, 2> m_max;
std::array<std::vector<double>, 2> m_mesh;
std::vector<BFieldVectorZR> m_field;
// look-up table and related variables
std::array<std::vector<int>,2> m_LUT;
std::array<std::vector<int>, 2> m_LUT;
std::array<double, 2> m_invUnit; // inverse unit size in the LUT
int m_zoff;
};
......
......@@ -36,3 +36,89 @@ BFieldMeshZR::getCache(double z,
cache.setField(3, m_field[im0 + m_zoff + 1], scaleFactor);
}
inline BFieldMeshZR::BFieldMeshZR(double zmin,
double zmax,
double rmin,
double rmax)
{
m_min = { zmin, rmin };
m_max = { zmax, rmax };
}
inline void
BFieldMeshZR::reserve(int nz, int nr)
{
m_mesh[0].reserve(nz);
m_mesh[1].reserve(nr);
m_field.reserve(nz * nr);
}
// add elements to vectors
inline void
BFieldMeshZR::appendMesh(int i, double mesh)
{
m_mesh[i].push_back(mesh);
}
inline void
BFieldMeshZR::appendField(const BFieldVectorZR& field)
{
m_field.push_back(field);
}
// test if a point is inside this zone
inline bool
BFieldMeshZR::inside(double z, double r) const
{
return (z >= zmin() && z <= zmax() && r >= rmin() && r <= rmax());
}
inline double
BFieldMeshZR::min(size_t i) const
{
return m_min[i];
}
inline double
BFieldMeshZR::max(size_t i) const
{
return m_max[i];
}
inline double
BFieldMeshZR::zmin() const
{
return m_min[0];
}
inline double
BFieldMeshZR::zmax() const
{
return m_max[0];
}
inline double
BFieldMeshZR::rmin() const
{
return m_min[1];
}
inline double
BFieldMeshZR::rmax() const
{
return m_max[1];
}
inline unsigned
BFieldMeshZR::nmesh(size_t i) const
{
return m_mesh[i].size();
}
inline double
BFieldMeshZR::mesh(size_t i, size_t j) const
{
return m_mesh[i][j];
}
inline unsigned
BFieldMeshZR::nfield() const
{
return m_field.size();
}
inline const BFieldVectorZR&
BFieldMeshZR::field(size_t i) const
{
return m_field[i];
}
......@@ -29,12 +29,7 @@ public:
double rmax,
double phimin,
double phimax,
double scale)
: BFieldMesh<short>(zmin, zmax, rmin, rmax, phimin, phimax, scale)
, m_id(id)
{
;
}
double scale);
// add elements to vectors
void appendCond(const BFieldCond& cond);
// compute Biot-Savart magnetic field and add to B[3]
......@@ -45,10 +40,10 @@ public:
// Scaling is done in cachec
void scaleField(double factor);
// accessors
int id() const { return m_id; }
unsigned ncond() const { return m_cond.size(); }
const BFieldCond& cond(int i) const { return m_cond[i]; }
const std::vector<BFieldCond>* condVector() const { return &m_cond; }
int id() const;
unsigned ncond() const;
const BFieldCond& cond(int i) const;
const std::vector<BFieldCond>* condVector() const;
int memSize() const;
// adjust the min/max edges to a new value
void adjustMin(int i, double x);
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
inline BFieldZone::BFieldZone(int id,
double zmin,
double zmax,
double rmin,
double rmax,
double phimin,
double phimax,
double scale)
: BFieldMesh<short>(zmin, zmax, rmin, rmax, phimin, phimax, scale)
, m_id(id)
{}
inline void
BFieldZone::appendCond(const BFieldCond& cond)
{
......@@ -26,6 +39,30 @@ BFieldZone::addBiotSavart(const double* ATH_RESTRICT xyz,
}
}
inline int
BFieldZone::id() const
{
return m_id;
}
inline unsigned
BFieldZone::ncond() const
{
return m_cond.size();
}
inline const BFieldCond&
BFieldZone::cond(int i) const
{
return m_cond[i];
}
inline const std::vector<BFieldCond>*
BFieldZone::condVector() const
{
return &m_cond;
}
inline int
BFieldZone::memSize() const
{
......
......@@ -11,6 +11,9 @@
//
#include "MagFieldElements/AtlasFieldCache.h"
#include <cmath>
#include <iostream>
void
MagField::AtlasFieldCache::getField(const double* ATH_RESTRICT xyz,
double* ATH_RESTRICT bxyz,
......@@ -89,7 +92,7 @@ MagField::AtlasFieldCache::getFieldZR(const double* ATH_RESTRICT xyz,
const double x = xyz[0];
const double y = xyz[1];
const double z = xyz[2];
const double r = sqrt(x * x + y * y);
const double r = std::sqrt(x * x + y * y);
// test if the cache was initialized and the ZR cache is valid for current
// position
......
......@@ -89,46 +89,30 @@ MagField::AtlasFieldMap::initializeMap(TFile* rootfile,
// }
int id;
double zmin;
double zmax;
double rmin;
double rmax;
double phimin;
double phimax;
double bscale;
int ncond;
bool* finite;
double* p1x;
double* p1y;
double* p1z;
double* p2x;
double* p2y;
double* p2z;
double* curr;
int nmeshz;
int nmeshr;
int nmeshphi;
double* meshz;
double* meshr;
double* meshphi;
int nfield;
short* fieldz;
short* fieldr;
short* fieldphi;
// define the fixed-sized branches first
tree->SetBranchAddress("id", &id);
......
......@@ -5,129 +5,132 @@
#ifndef MUONMOOSEGMENTFINDER_H
#define MUONMOOSEGMENTFINDER_H
#include <map>
#include "AthenaBaseComps/AthAlgTool.h"
#include "CscSegmentMakers/ICscSegmentFinder.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/ServiceHandle.h"
#include "MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h"
#include "CscSegmentMakers/ICscSegmentFinder.h"
#include "MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h"
#include "MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h"
#include "MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h"
#include "MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h"
#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h"
#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
#include "MuonRecHelperTools/IMuonEDMHelperSvc.h"
#include "MuonIdHelpers/IMuonIdHelperSvc.h"
#include "GaudiKernel/ToolHandle.h"
#include "MuonEDM_AssociationObjects/MuonSegmentCombPatternCombAssociationMap.h"
#include "MuonSegment/MuonSegmentCombinationCollection.h"
#include "MuonIdHelpers/IMuonIdHelperSvc.h"
#include "MuonPattern/MuonPatternCombinationCollection.h"
#include "TrkSegment/SegmentCollection.h"
#include "MuonRecHelperTools/IMuonEDMHelperSvc.h"
#include "MuonPrepRawData/CscPrepDataCollection.h"
#include "MuonPrepRawData/MdtPrepDataCollection.h"
#include "MuonPrepRawData/RpcPrepDataCollection.h"
#include "MuonPrepRawData/TgcPrepDataCollection.h"
#include <map>
#include "MuonRecHelperTools/IMuonEDMHelperSvc.h"
#include "MuonRecHelperTools/MuonEDMPrinterTool.h"
#include "MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h"
#include "MuonSegment/MuonSegmentCombinationCollection.h"
#include "MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h"
#include "MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h"
#include "MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h"
#include "MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h"
#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h"
#include "TrkSegment/SegmentCollection.h"
class ICscSegmentFinder;
class MdtIdHelper;
namespace Muon
{
class IMuonHoughPatternFinderTool;
class IMuonPatternSegmentMaker;
class IMuonCurvedSegmentCombiner;
class IMuonSegmentCombinationCleanerTool;
class IMuonSegmentSelectionTool;
class MuonEDMPrinterTool;
/** @class MooSegmentCombinationFinder
@author Edward Moyse <edward.moyse@cern.ch>
*/
class MooSegmentCombinationFinder : virtual public IMooSegmentCombinationFinder, public AthAlgTool
{
public:
MooSegmentCombinationFinder(const std::string&,const std::string&,const IInterface*);
/** default destructor */
virtual ~MooSegmentCombinationFinder () = default;
/** standard Athena-Algorithm method */
virtual StatusCode initialize();
/** standard Athena-Algorithm method */
virtual StatusCode finalize ();
/** This method cannot currently be const, since it needs to call non-const methods of child tools.
However this should be okay for MT as long as this tool is a private tool of the parent Algorithm.*/
void findSegments(const std::vector<const MdtPrepDataCollection*>& mdtCols,
const std::vector<const CscPrepDataCollection*>& cscCols,
const std::vector<const TgcPrepDataCollection*>& tgcCols,
const std::vector<const RpcPrepDataCollection*>& rpcCols,
IMooSegmentCombinationFinder::Output& output);
private:
/** helper functions to print summary output for the different stages */
void printStage( std::string stageTag) const;
void printSummary( std::string stageTag, const MuonSegmentCombinationCollection* col ) const;
void printSummary( std::string stageTag, const MuonPatternCombinationCollection* col ) const;
void printSummary( std::string stageTag, const Trk::SegmentCollection* col ) const;
/** helper functions to write out intermediate results */
void postProcess( MuonSegmentCombinationCollection* col, MuonSegmentCombPatternCombAssociationMap& segmentPatternMap) ;
/** extract a segment collection from a segment combination collection */
void extractSegmentCollection( const MuonSegmentCombinationCollection* combiCol, Trk::SegmentCollection& segments ) const;
/** select segment on quality */
bool goodSegment( const MuonSegment& segment ) const;
std::pair<int,int> hitsInMultilayer( const Muon::MuonSegment& segment ) const;
bool firstIsBest( const Muon::MuonSegment& seg1, const Muon::MuonSegment& seg2 ) const;
Gaudi::Property<bool> m_doSummary {this, "DoSummary", false, "Print summary after each stage"};
Gaudi::Property<bool> m_doCscSegments {this, "DoCscSegments", true, "Run CSC segment finding"};
Gaudi::Property<bool> m_doMdtSegments {this, "DoMdtSegments", true, "Run MDT segment finding"};
Gaudi::Property<bool> m_doSegmentCombinations {this, "DoSegmentCombinations", false, "Run segment combination finding"};
Gaudi::Property<bool> m_doSegmentCombinationCleaning {this, "DoSegmentCombinationCleaning", false, "Run segment combination cleaning"};
Gaudi::Property<bool> m_cloneSegments {this, "CloneSegments", false, ""};
ToolHandle<MuonEDMPrinterTool> m_edmPrinter {"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface" };
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
ToolHandle<ICscSegmentFinder> m_csc2dSegmentFinder{this, "Csc2dSegmentMaker", "Csc2dSegmentMaker/Csc2dSegmentMaker"};
ToolHandle<ICscSegmentFinder> m_csc4dSegmentFinder{this, "Csc4dSegmentMaker", "Csc4dSegmentMaker/Csc4dSegmentMaker"};
ToolHandle<IMuonHoughPatternFinderTool> m_houghPatternFinder;
ToolHandle<IMuonPatternSegmentMaker> m_patternSegmentMaker{this, "MdtSegmentMaker", "Muon::MuonPatternSegmentMaker/MuonPatternSegmentMaker"};
ToolHandle<IMuonCurvedSegmentCombiner> m_curvedSegmentCombiner{this, "SegmentCombiner", "Muon::MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner"};
ToolHandle<IMuonSegmentCombinationCleanerTool> m_segmentCombinationCleaner{this, "SegmentCombinationCleaner","Muon::MuonSegmentCombinationCleanerTool/MuonSegmentCombinationCleanerTool"};
ToolHandle<IMuonSegmentSelectionTool> m_segmentSelector{this, "SegmentSelector", "Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool"};
/** counters */
mutable std::atomic_uint m_nevents{0};
mutable std::atomic_uint m_ncsc2SegmentCombinations{0};
mutable std::atomic_uint m_ncsc4SegmentCombinations{0};
mutable std::atomic_uint m_npatternCombinations{0};
mutable std::atomic_uint m_nmdtSegmentCombinations{0};
mutable std::atomic_uint m_ncombinedSegmentCombinations{0};
mutable std::atomic_uint m_ncleanedSegmentCombinations{0};
mutable std::atomic_uint m_nsegments{0};
mutable std::atomic_uint m_nsegmentsStraight{0};
mutable std::atomic_uint m_nsegmentsCurved{0};
mutable std::atomic_uint m_nremovedBadSegments{0};
};
} // end of namespace
#endif
namespace Muon {
class IMuonHoughPatternFinderTool;
class IMuonPatternSegmentMaker;
class IMuonCurvedSegmentCombiner;
class IMuonSegmentCombinationCleanerTool;
class IMuonSegmentSelectionTool;
class MuonEDMPrinterTool;
/** @class MooSegmentCombinationFinder
@author Edward Moyse <edward.moyse@cern.ch>
*/
class MooSegmentCombinationFinder : virtual public IMooSegmentCombinationFinder, public AthAlgTool {
public:
MooSegmentCombinationFinder(const std::string&, const std::string&, const IInterface*);
/** default destructor */
virtual ~MooSegmentCombinationFinder() = default;
/** standard Athena-Algorithm method */
virtual StatusCode initialize();
/** standard Athena-Algorithm method */
virtual StatusCode finalize();
/** This method cannot currently be const, since it needs to call non-const methods of child tools.
However this should be okay for MT as long as this tool is a private tool of the parent Algorithm.*/
void findSegments(const std::vector<const MdtPrepDataCollection*>& mdtCols,
const std::vector<const CscPrepDataCollection*>& cscCols,
const std::vector<const TgcPrepDataCollection*>& tgcCols,
const std::vector<const RpcPrepDataCollection*>& rpcCols,
IMooSegmentCombinationFinder::Output& output);
private:
/** helper functions to print summary output for the different stages */
void printStage(std::string stageTag) const;
void printSummary(std::string stageTag, const MuonSegmentCombinationCollection* col) const;
void printSummary(std::string stageTag, const MuonPatternCombinationCollection* col) const;
void printSummary(std::string stageTag, const Trk::SegmentCollection* col) const;
/** helper functions to write out intermediate results */
void postProcess(MuonSegmentCombinationCollection* col,
MuonSegmentCombPatternCombAssociationMap& segmentPatternMap);
/** extract a segment collection from a segment combination collection */
void extractSegmentCollection(const MuonSegmentCombinationCollection* combiCol,
Trk::SegmentCollection& segments) const;
/** select segment on quality */
bool goodSegment(const MuonSegment& segment) const;
std::pair<int, int> hitsInMultilayer(const Muon::MuonSegment& segment) const;
bool firstIsBest(const Muon::MuonSegment& seg1, const Muon::MuonSegment& seg2) const;
Gaudi::Property<bool> m_doSummary{this, "DoSummary", false, "Print summary after each stage"};
Gaudi::Property<bool> m_doCscSegments{this, "DoCscSegments", true, "Run CSC segment finding"};
Gaudi::Property<bool> m_doMdtSegments{this, "DoMdtSegments", true, "Run MDT segment finding"};
Gaudi::Property<bool> m_doSegmentCombinations{this, "DoSegmentCombinations", false,
"Run segment combination finding"};
Gaudi::Property<bool> m_doSegmentCombinationCleaning{this, "DoSegmentCombinationCleaning", false,
"Run segment combination cleaning"};
Gaudi::Property<bool> m_cloneSegments{this, "CloneSegments", false, ""};
ToolHandle<MuonEDMPrinterTool> m_edmPrinter{"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface"};
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
ToolHandle<ICscSegmentFinder> m_csc2dSegmentFinder{this, "Csc2dSegmentMaker",
"Csc2dSegmentMaker/Csc2dSegmentMaker"};
ToolHandle<ICscSegmentFinder> m_csc4dSegmentFinder{this, "Csc4dSegmentMaker",
"Csc4dSegmentMaker/Csc4dSegmentMaker"};
ToolHandle<IMuonHoughPatternFinderTool> m_houghPatternFinder{this, "HoughPatternFinder",
"Muon::MuonHoughPatternFinderTool/MuonHoughPatternFinderTool"};
ToolHandle<IMuonPatternSegmentMaker> m_patternSegmentMaker{this, "MdtSegmentMaker",
"Muon::MuonPatternSegmentMaker/MuonPatternSegmentMaker"};
ToolHandle<IMuonCurvedSegmentCombiner> m_curvedSegmentCombiner{
this, "SegmentCombiner", "Muon::MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner"};
ToolHandle<IMuonSegmentCombinationCleanerTool> m_segmentCombinationCleaner{
this, "SegmentCombinationCleaner", "Muon::MuonSegmentCombinationCleanerTool/MuonSegmentCombinationCleanerTool"};
ToolHandle<IMuonSegmentSelectionTool> m_segmentSelector{this, "SegmentSelector",
"Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool"};
/** counters */
mutable std::atomic_uint m_nevents{0};
mutable std::atomic_uint m_ncsc2SegmentCombinations{0};
mutable std::atomic_uint m_ncsc4SegmentCombinations{0};
mutable std::atomic_uint m_npatternCombinations{0};
mutable std::atomic_uint m_nmdtSegmentCombinations{0};
mutable std::atomic_uint m_ncombinedSegmentCombinations{0};
mutable std::atomic_uint m_ncleanedSegmentCombinations{0};
mutable std::atomic_uint m_nsegments{0};
mutable std::atomic_uint m_nsegmentsStraight{0};
mutable std::atomic_uint m_nsegmentsCurved{0};
mutable std::atomic_uint m_nremovedBadSegments{0};
};
} // namespace Muon
#endif
......@@ -3,156 +3,148 @@
*/
#include "MooSegmentFinderAlg.h"
#include "MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h"
#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h"
#include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h"
#include "MuonSegment/MuonSegment.h"
#include "MuonPrepRawData/MuonPrepDataContainer.h"
#include "MuonSegment/MuonSegment.h"
#include "MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h"
#include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h"
MooSegmentFinderAlg::MooSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator):
AthAlgorithm(name,pSvcLocator),
m_keyTgc("TGC_Measurements"),
m_keyTgcPriorBC( "TGC_MeasurementsPriorBC"),
m_keyTgcNextBC("TGC_MeasurementsNextBC"),
m_keyRpc("RPC_Measurements"),
m_keyCsc( "CSC_Clusters"),
m_keyMdt("MDT_DriftCircles"),
m_patternCombiLocation("MuonHoughPatternCombinations"),
m_segmentLocation("MooreSegments"),
m_segmentFinder("Muon::MooSegmentCombinationFinder/MooSegmentCombinationFinder", this),
m_clusterSegMaker("Muon::MuonClusterSegmentFinder/MuonClusterSegmentFinder", this),
m_overlapRemovalTool("Muon::MuonSegmentOverlapRemovalTool/MuonSegmentOverlapRemovalTool", this)
MooSegmentFinderAlg::MooSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator)
: AthAlgorithm(name, pSvcLocator),
m_keyTgc("TGC_Measurements"),
m_keyTgcPriorBC("TGC_MeasurementsPriorBC"),
m_keyTgcNextBC("TGC_MeasurementsNextBC"),
m_keyRpc("RPC_Measurements"),
m_keyCsc("CSC_Clusters"),
m_keyMdt("MDT_DriftCircles"),
m_patternCombiLocation("MuonHoughPatternCombinations"),
m_segmentLocation("MooreSegments")
{
declareProperty("UseRPC",m_useRpc = true);
declareProperty("UseTGC",m_useTgc = true);
declareProperty("UseTGCPriorBC",m_useTgcPriorBC = false);
declareProperty("UseTGCNextBC",m_useTgcNextBC = false);
declareProperty("UseCSC",m_useCsc = true);
declareProperty("UseMDT",m_useMdt = true);
declareProperty("doTGCClust",m_doTGCClust = false);
declareProperty("doRPCClust",m_doRPCClust = false);
declareProperty("doClusterTruth",m_doClusterTruth=false);
declareProperty("CscPrepDataContainer", m_keyCsc);
declareProperty("MdtPrepDataContainer", m_keyMdt);
declareProperty("RpcPrepDataContainer", m_keyRpc);
declareProperty("TgcPrepDataContainer", m_keyTgc);
declareProperty("TgcPrepDataContainerPriorBC", m_keyTgcPriorBC);
declareProperty("TgcPrepDataContainerNextBC", m_keyTgcNextBC);
declareProperty("MuonPatternCombinationLocation", m_patternCombiLocation);
declareProperty("MuonSegmentOutputLocation", m_segmentLocation );
declareProperty("SegmentFinder", m_segmentFinder );
declareProperty("MuonClusterSegmentFinderTool",m_clusterSegMaker);
declareProperty("SegmentOverlapRemovalTool", m_overlapRemovalTool, "tool to removal overlaps in segment combinations" );
declareProperty("UseRPC", m_useRpc = true);
declareProperty("UseTGC", m_useTgc = true);
declareProperty("UseTGCPriorBC", m_useTgcPriorBC = false);
declareProperty("UseTGCNextBC", m_useTgcNextBC = false);
declareProperty("UseCSC", m_useCsc = true);
declareProperty("UseMDT", m_useMdt = true);
declareProperty("doTGCClust", m_doTGCClust = false);
declareProperty("doRPCClust", m_doRPCClust = false);
declareProperty("doClusterTruth", m_doClusterTruth = false);
declareProperty("CscPrepDataContainer", m_keyCsc);
declareProperty("MdtPrepDataContainer", m_keyMdt);
declareProperty("RpcPrepDataContainer", m_keyRpc);
declareProperty("TgcPrepDataContainer", m_keyTgc);
declareProperty("TgcPrepDataContainerPriorBC", m_keyTgcPriorBC);
declareProperty("TgcPrepDataContainerNextBC", m_keyTgcNextBC);
declareProperty("MuonPatternCombinationLocation", m_patternCombiLocation);
declareProperty("MuonSegmentOutputLocation", m_segmentLocation);
}
MooSegmentFinderAlg::~MooSegmentFinderAlg()
{
}
MooSegmentFinderAlg::~MooSegmentFinderAlg() {}
StatusCode MooSegmentFinderAlg::initialize()
StatusCode
MooSegmentFinderAlg::initialize()
{
ATH_CHECK( m_segmentFinder.retrieve() );
ATH_CHECK( m_clusterSegMaker.retrieve() );
ATH_CHECK( m_overlapRemovalTool.retrieve() );
ATH_CHECK( m_keyMdt.initialize(m_useMdt) ); //Nullify key from scheduler if not needed
ATH_CHECK( m_keyCsc.initialize(m_useCsc) );
ATH_CHECK( m_keyRpc.initialize(m_useRpc) );
ATH_CHECK( m_keyTgcPriorBC.initialize(m_useTgcPriorBC) );
ATH_CHECK( m_keyTgcNextBC.initialize(m_useTgcNextBC) );
ATH_CHECK( m_keyTgc.initialize(m_useTgc) );
ATH_CHECK( m_tgcTruth.initialize(m_doClusterTruth) );
ATH_CHECK( m_rpcTruth.initialize(m_doClusterTruth) );
ATH_CHECK( m_patternCombiLocation.initialize() );
ATH_CHECK( m_segmentLocation.initialize() );
ATH_CHECK( m_houghDataPerSectorVecKey.initialize() );
return StatusCode::SUCCESS;
ATH_CHECK(m_segmentFinder.retrieve());
ATH_CHECK(m_clusterSegMaker.retrieve());
ATH_CHECK(m_overlapRemovalTool.retrieve());
ATH_CHECK(m_keyMdt.initialize(m_useMdt)); // Nullify key from scheduler if not needed
ATH_CHECK(m_keyCsc.initialize(m_useCsc));
ATH_CHECK(m_keyRpc.initialize(m_useRpc));
ATH_CHECK(m_keyTgcPriorBC.initialize(m_useTgcPriorBC));
ATH_CHECK(m_keyTgcNextBC.initialize(m_useTgcNextBC));
ATH_CHECK(m_keyTgc.initialize(m_useTgc));
ATH_CHECK(m_tgcTruth.initialize(m_doClusterTruth));
ATH_CHECK(m_rpcTruth.initialize(m_doClusterTruth));
ATH_CHECK(m_patternCombiLocation.initialize());
ATH_CHECK(m_segmentLocation.initialize());
ATH_CHECK(m_houghDataPerSectorVecKey.initialize());
return StatusCode::SUCCESS;
}
StatusCode MooSegmentFinderAlg::execute()
StatusCode
MooSegmentFinderAlg::execute()
{
std::vector<const Muon::MdtPrepDataCollection*> mdtCols;
std::vector<const Muon::CscPrepDataCollection*> cscCols;
std::vector<const Muon::TgcPrepDataCollection*> tgcCols;
std::vector<const Muon::RpcPrepDataCollection*> rpcCols;
if( m_useMdt ) retrieveCollections(mdtCols,m_keyMdt);
if( m_useCsc ) retrieveCollections(cscCols,m_keyCsc);
if( m_useTgc ) retrieveCollections(tgcCols,m_keyTgc);
if( m_useTgcPriorBC ) retrieveCollections(tgcCols,m_keyTgcPriorBC);
if( m_useTgcNextBC ) retrieveCollections(tgcCols,m_keyTgcNextBC);
if( m_useRpc ) retrieveCollections(rpcCols,m_keyRpc);
Muon::IMooSegmentCombinationFinder::Output output;
SG::WriteHandle<Trk::SegmentCollection> segHandle(m_segmentLocation);
if (segHandle.record(std::make_unique<Trk::SegmentCollection>()).isSuccess() ){
ATH_MSG_VERBOSE("stored MuonSegmentCollection at "<<m_segmentLocation.key());
}else{
ATH_MSG_ERROR("Failed to store MuonSegmentCollection ");
}
output.segmentCollection=segHandle.ptr();
SG::WriteHandle<MuonPatternCombinationCollection> patHandle(m_patternCombiLocation);
m_segmentFinder->findSegments( mdtCols, cscCols, tgcCols, rpcCols, output );
if(output.patternCombinations){
if( patHandle.record(std::unique_ptr<MuonPatternCombinationCollection>(output.patternCombinations)).isSuccess() ){
ATH_MSG_VERBOSE("stored MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
}else{
ATH_MSG_ERROR("Failed to store MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
std::vector<const Muon::MdtPrepDataCollection*> mdtCols;
std::vector<const Muon::CscPrepDataCollection*> cscCols;
std::vector<const Muon::TgcPrepDataCollection*> tgcCols;
std::vector<const Muon::RpcPrepDataCollection*> rpcCols;
if (m_useMdt) retrieveCollections(mdtCols, m_keyMdt);
if (m_useCsc) retrieveCollections(cscCols, m_keyCsc);
if (m_useTgc) retrieveCollections(tgcCols, m_keyTgc);
if (m_useTgcPriorBC) retrieveCollections(tgcCols, m_keyTgcPriorBC);
if (m_useTgcNextBC) retrieveCollections(tgcCols, m_keyTgcNextBC);
if (m_useRpc) retrieveCollections(rpcCols, m_keyRpc);
Muon::IMooSegmentCombinationFinder::Output output;
SG::WriteHandle<Trk::SegmentCollection> segHandle(m_segmentLocation);
if (segHandle.record(std::make_unique<Trk::SegmentCollection>()).isSuccess()) {
ATH_MSG_VERBOSE("stored MuonSegmentCollection at " << m_segmentLocation.key());
} else {
ATH_MSG_ERROR("Failed to store MuonSegmentCollection ");
}
output.segmentCollection = segHandle.ptr();
SG::WriteHandle<MuonPatternCombinationCollection> patHandle(m_patternCombiLocation);
m_segmentFinder->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output);
if (output.patternCombinations) {
if (patHandle.record(std::unique_ptr<MuonPatternCombinationCollection>(output.patternCombinations)).isSuccess())
{
ATH_MSG_VERBOSE("stored MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
} else {
ATH_MSG_ERROR("Failed to store MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
}
output.patternCombinations = nullptr;
} else {
if (patHandle.record(std::make_unique<MuonPatternCombinationCollection>()).isSuccess()) {
ATH_MSG_VERBOSE("stored MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
} else {
ATH_MSG_ERROR("Failed to store MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
}
}
output.patternCombinations = nullptr;
}
else{
if( patHandle.record(std::make_unique<MuonPatternCombinationCollection>()).isSuccess() ){
ATH_MSG_VERBOSE("stored MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
}else{
ATH_MSG_ERROR("Failed to store MuonPatternCombinationCollection at " << m_patternCombiLocation.key());
// write hough data to SG
if (output.houghDataPerSectorVec) {
SG::WriteHandle<Muon::HoughDataPerSectorVec> handle{m_houghDataPerSectorVecKey};
ATH_CHECK(handle.record(std::move(output.houghDataPerSectorVec)));
} else {
ATH_MSG_VERBOSE("HoughDataPerSectorVec was empty, key: " << m_houghDataPerSectorVecKey.key());
}
}
// write hough data to SG
if (output.houghDataPerSectorVec) {
SG::WriteHandle<Muon::HoughDataPerSectorVec> handle {m_houghDataPerSectorVecKey};
ATH_CHECK(handle.record(std::move(output.houghDataPerSectorVec)));
} else {
ATH_MSG_VERBOSE("HoughDataPerSectorVec was empty, key: " << m_houghDataPerSectorVecKey.key());
}
//do cluster based segment finding
if (m_doTGCClust || m_doRPCClust){
const PRD_MultiTruthCollection* tgcTruthColl=0;
const PRD_MultiTruthCollection* rpcTruthColl=0;
if(m_doClusterTruth){
SG::ReadHandle<PRD_MultiTruthCollection> tgcTruth(m_tgcTruth);
SG::ReadHandle<PRD_MultiTruthCollection> rpcTruth(m_rpcTruth);
tgcTruthColl=tgcTruth.cptr();
rpcTruthColl=rpcTruth.cptr();
// do cluster based segment finding
if (m_doTGCClust || m_doRPCClust) {
const PRD_MultiTruthCollection* tgcTruthColl = 0;
const PRD_MultiTruthCollection* rpcTruthColl = 0;
if (m_doClusterTruth) {
SG::ReadHandle<PRD_MultiTruthCollection> tgcTruth(m_tgcTruth);
SG::ReadHandle<PRD_MultiTruthCollection> rpcTruth(m_rpcTruth);
tgcTruthColl = tgcTruth.cptr();
rpcTruthColl = rpcTruth.cptr();
}
SG::ReadHandle<Muon::MdtPrepDataContainer> mdth(m_keyMdt);
m_clusterSegMaker->getClusterSegments(mdth.cptr(), m_doTGCClust ? &tgcCols : 0, m_doRPCClust ? &rpcCols : 0,
tgcTruthColl, rpcTruthColl, segHandle.ptr());
}
SG::ReadHandle<Muon::MdtPrepDataContainer> mdth(m_keyMdt);
m_clusterSegMaker->getClusterSegments(mdth.cptr(), m_doTGCClust ? &tgcCols : 0, m_doRPCClust ? &rpcCols : 0, tgcTruthColl, rpcTruthColl, segHandle.ptr());
}
m_overlapRemovalTool->removeDuplicates(segHandle.ptr());
m_overlapRemovalTool->removeDuplicates(segHandle.ptr());
return StatusCode::SUCCESS;
} // execute
return StatusCode::SUCCESS;
} // execute
StatusCode MooSegmentFinderAlg::finalize()
StatusCode
MooSegmentFinderAlg::finalize()
{
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
......@@ -7,96 +7,108 @@
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "MuonPattern/MuonPatternCombinationCollection.h"
#include "MuonPrepRawData/CscPrepDataCollection.h"
#include "MuonPrepRawData/MdtPrepDataCollection.h"
#include "MuonPrepRawData/MuonPrepDataContainer.h"
#include "MuonPrepRawData/RpcPrepDataCollection.h"
#include "MuonPrepRawData/TgcPrepDataCollection.h"
#include "TrkTruthData/PRD_MultiTruthCollection.h"
#include "MuonRecToolInterfaces/HoughDataPerSec.h"
#include "MuonSegment/MuonSegmentCombinationCollection.h"
#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h"
#include "TrkSegment/SegmentCollection.h"
#include "MuonPrepRawData/MuonPrepDataContainer.h"
#include "MuonPattern/MuonPatternCombinationCollection.h"
#include "MuonRecToolInterfaces/HoughDataPerSec.h"
#include "TrkTruthData/PRD_MultiTruthCollection.h"
class MsgStream;
namespace Muon {
class IMuonClusterSegmentFinder;
class IMooSegmentCombinationFinder;
class IMuonSegmentOverlapRemovalTool;
}
class MooSegmentFinderAlg : public AthAlgorithm
{
public:
MooSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~MooSegmentFinderAlg();
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
private:
template<class T, class Y>
void retrieveCollections( std::vector<const T*>& cols, SG::ReadHandleKey<Y>& key );
/** extract segments from a MuonSegmentCombinationCollection */
Trk::SegmentCollection* extractSegmentCollection( const MuonSegmentCombinationCollection& segmentCombinations ) const;
/** selection flags for all four technologies */
bool m_useTgc;
bool m_useTgcPriorBC;
bool m_useTgcNextBC;
bool m_useRpc;
bool m_useCsc;
bool m_useMdt;
/** selection flags for cluster based segment finding */
bool m_doTGCClust;
bool m_doRPCClust;
bool m_doClusterTruth;
/** storegate location of the MuonPrepDataContainer for all four technologies */
SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgc;
SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgcPriorBC;
SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgcNextBC;
SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_keyRpc;
SG::ReadHandleKey<Muon::CscPrepDataContainer> m_keyCsc;
SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_keyMdt;
SG::ReadHandleKey<PRD_MultiTruthCollection> m_tgcTruth{this,"TGCTruth","TGC_TruthMap","TGC PRD Multi-truth Collection"};
SG::ReadHandleKey<PRD_MultiTruthCollection> m_rpcTruth{this,"RPCTruth","RPC_TruthMap","RPC PRD Multi-truth Collection"};
SG::WriteHandleKey<MuonPatternCombinationCollection> m_patternCombiLocation;
SG::WriteHandleKey<Trk::SegmentCollection> m_segmentLocation;
SG::WriteHandleKey<Muon::HoughDataPerSectorVec> m_houghDataPerSectorVecKey {this,
"Key_MuonLayerHoughToolHoughDataPerSectorVec", "HoughDataPerSectorVec", "HoughDataPerSectorVec key"};
ToolHandle<Muon::IMooSegmentCombinationFinder> m_segmentFinder; //<! pointer to the segment finder
ToolHandle<Muon::IMuonClusterSegmentFinder> m_clusterSegMaker;
ToolHandle<Muon::IMuonSegmentOverlapRemovalTool> m_overlapRemovalTool;
class IMooSegmentCombinationFinder;
class IMuonSegmentOverlapRemovalTool;
} // namespace Muon
class MooSegmentFinderAlg : public AthAlgorithm {
public:
MooSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~MooSegmentFinderAlg();
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
private:
template <class T, class Y>
void retrieveCollections(std::vector<const T*>& cols, SG::ReadHandleKey<Y>& key);
/** extract segments from a MuonSegmentCombinationCollection */
Trk::SegmentCollection* extractSegmentCollection(const MuonSegmentCombinationCollection& segmentCombinations) const;
/** selection flags for all four technologies */
bool m_useTgc;
bool m_useTgcPriorBC;
bool m_useTgcNextBC;
bool m_useRpc;
bool m_useCsc;
bool m_useMdt;
/** selection flags for cluster based segment finding */
bool m_doTGCClust;
bool m_doRPCClust;
bool m_doClusterTruth;
/** storegate location of the MuonPrepDataContainer for all four technologies */
SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgc;
SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgcPriorBC;
SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgcNextBC;
SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_keyRpc;
SG::ReadHandleKey<Muon::CscPrepDataContainer> m_keyCsc;
SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_keyMdt;
SG::ReadHandleKey<PRD_MultiTruthCollection> m_tgcTruth{this, "TGCTruth", "TGC_TruthMap",
"TGC PRD Multi-truth Collection"};
SG::ReadHandleKey<PRD_MultiTruthCollection> m_rpcTruth{this, "RPCTruth", "RPC_TruthMap",
"RPC PRD Multi-truth Collection"};
SG::WriteHandleKey<MuonPatternCombinationCollection> m_patternCombiLocation;
SG::WriteHandleKey<Trk::SegmentCollection> m_segmentLocation;
SG::WriteHandleKey<Muon::HoughDataPerSectorVec> m_houghDataPerSectorVecKey{
this, "Key_MuonLayerHoughToolHoughDataPerSectorVec", "HoughDataPerSectorVec", "HoughDataPerSectorVec key"};
ToolHandle<Muon::IMooSegmentCombinationFinder> m_segmentFinder{
this,
"SegmentFinder",
"Muon::MooSegmentCombinationFinder/MooSegmentCombinationFinder",
}; //<! pointer to the segment finder
ToolHandle<Muon::IMuonClusterSegmentFinder> m_clusterSegMaker{
this,
"MuonClusterSegmentFinderTool",
"Muon::MuonClusterSegmentFinder/MuonClusterSegmentFinder",
};
ToolHandle<Muon::IMuonSegmentOverlapRemovalTool> m_overlapRemovalTool{
this,
"SegmentOverlapRemovalTool",
"Muon::MuonSegmentOverlapRemovalTool/MuonSegmentOverlapRemovalTool",
"tool to removal overlaps in segment combinations",
};
};
template <class T, class Y>
void MooSegmentFinderAlg::retrieveCollections( std::vector<const T*>& cols, SG::ReadHandleKey<Y>& key ) {
SG::ReadHandle<Y> cscPrds (key);
if (cscPrds.isValid()==false) {
ATH_MSG_ERROR("Cannot retrieve Container " << key.key() << " accessing via collections ");
}else{
const Y* ptr = cscPrds.cptr();
cols.reserve(cols.size()+ptr->size());
for(auto p : *ptr) if(!p->empty()) cols.push_back(p);
ATH_MSG_VERBOSE("Retrieved " << cscPrds.key() << " Container " << cols.size());
}
}
void
MooSegmentFinderAlg::retrieveCollections(std::vector<const T*>& cols, SG::ReadHandleKey<Y>& key)
{
SG::ReadHandle<Y> cscPrds(key);
if (cscPrds.isValid() == false) {
ATH_MSG_ERROR("Cannot retrieve Container " << key.key() << " accessing via collections ");
} else {
const Y* ptr = cscPrds.cptr();
cols.reserve(cols.size() + ptr->size());
for (auto p : *ptr)
if (!p->empty()) cols.push_back(p);
ATH_MSG_VERBOSE("Retrieved " << cscPrds.key() << " Container " << cols.size());
}
}
#endif
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