Commit a4733e40 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (MuonTrackValidation-00-00-04)

parent 4fcb9e89
################################################################################
# Package: MuonTrackValidation
################################################################################
# Declare the package name:
atlas_subdir( MuonTrackValidation )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PRIVATE
Control/AthenaBaseComps
GaudiKernel
MuonSpectrometer/MuonIdHelpers
Tracking/TrkEvent/TrkEventPrimitives
Tracking/TrkEvent/TrkEventUtils
Tracking/TrkValidation/TrkValInterfaces )
# External dependencies:
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
# Component(s) in the package:
atlas_add_component( MuonTrackValidation
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MuonIdHelpersLib TrkEventPrimitives TrkEventUtils TrkValInterfaces )
package MuonTrackValidation
author Wolfgang Liebig <wolfgang.liebig -at- cern.ch>
public
use AtlasPolicy AtlasPolicy-*
apply_pattern component_library
library MuonTrackValidation *.cxx components/*.cxx
private
use AtlasROOT AtlasROOT-* External
use GaudiInterface GaudiInterface-* External
use TrkEventUtils TrkEventUtils-* Tracking/TrkEvent
use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent
use AthenaBaseComps AthenaBaseComps-* Control
use TrkValInterfaces TrkValInterfaces-* Tracking/TrkValidation
use MuonIdHelpers MuonIdHelpers-* MuonSpectrometer
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage MuonTrackValidation Package
>> Please enter an overview of the created package here: What does it contain?
@author Wolfgang Liebig <wolfgang.liebig -at- cern.ch>
@section MuonTrackValidationIntro Introduction
>> Please enter a brief description of the package here.
@section MuonTrackValidationReq Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// MuonStationNtupleHelperTool.cxx, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#include "MuonStationNtupleHelperTool.h"
#include "TrkEventUtils/IdentifierExtractor.h"
#include "TTree.h"
#include "TrkEventPrimitives/TrackStateDefs.h"
//#include "MuonIdHelpers/RpcIdHelper.h"
//================ Constructor =================================================
Muon::MuonStationNtupleHelperTool::MuonStationNtupleHelperTool(const std::string& t,
const std::string& n,
const IInterface* p )
:
AthAlgTool(t,n,p),
m_mdtSectorIx(0),
m_mdtStationIx(0),
m_rpcSectorIx(0),
m_rpcStationIx(0),
m_rpcMeasuresPhi(0),
m_tgcStationIx(0),
m_tgcMeasuresPhi(0)
{
declareInterface<Trk::IValidationNtupleHelperTool>(this);
// template for property decalration
//declareProperty("PropertyName", m_propertyName);
}
//================ Destructor =================================================
Muon::MuonStationNtupleHelperTool::~MuonStationNtupleHelperTool()
{}
//================ Initialisation =================================================
StatusCode Muon::MuonStationNtupleHelperTool::initialize()
{
StatusCode sc = AlgTool::initialize();
if (sc.isFailure()) return sc;
/*
if (detStore()->retrieve(m_rpcId).isFailure()) {
ATH_MSG_WARNING ("Could not get RPC ID helper !");
return StatusCode::FAILURE;
}*/
if (m_muonIdHelperTool.retrieve().isFailure()) {
ATH_MSG_WARNING ("Could not get muon custom ID helper !");
return StatusCode::FAILURE;
}
m_mdtSectorIx = new std::vector<int>();
m_mdtStationIx = new std::vector<int>();
m_rpcSectorIx = new std::vector<int>();
m_rpcStationIx = new std::vector<int>();
m_rpcMeasuresPhi = new std::vector<int>();
m_tgcStationIx = new std::vector<int>();
m_tgcMeasuresPhi = new std::vector<int>();
ATH_MSG_INFO ("initialize() successful in " << name());
return StatusCode::SUCCESS;
}
//================ Finalisation =================================================
StatusCode Muon::MuonStationNtupleHelperTool::finalize()
{
delete m_mdtSectorIx; m_mdtSectorIx=0;
delete m_mdtStationIx; m_mdtStationIx=0;
delete m_rpcSectorIx; m_rpcSectorIx=0;
delete m_rpcStationIx; m_rpcStationIx=0;
delete m_rpcMeasuresPhi; m_rpcMeasuresPhi=0;
delete m_tgcStationIx; m_tgcStationIx=0;
delete m_tgcMeasuresPhi; m_tgcMeasuresPhi=0;
StatusCode sc = AlgTool::finalize();
return sc;
}
///////////////////////////////////////
/// addNtupleItems
///////////////////////////////////////
StatusCode Muon::MuonStationNtupleHelperTool::addNtupleItems (
TTree* tree,
const int& detectorType) const {
// add items to the ntuple
if (detectorType==Trk::TrackState::MDT) {
tree->Branch("MdtSectorIndex", &m_mdtSectorIx);
tree->Branch("MdtStationIndex", &m_mdtStationIx);
}
if (detectorType==Trk::TrackState::RPC) {
tree->Branch("RpcSectorIndex", &m_rpcSectorIx);
tree->Branch("RpcStationIndex", &m_rpcStationIx);
tree->Branch("RpcMeasuresPhi", &m_rpcMeasuresPhi);
}
if (detectorType==Trk::TrackState::TGC) {
// TGC sectors are not defined, will cause warning if tried to compute from helper
tree->Branch("TgcStationIndex", &m_tgcStationIx);
tree->Branch("TgcMeasuresPhi", &m_tgcMeasuresPhi);
}
ATH_MSG_VERBOSE ("added items to ntuple.");
return StatusCode::SUCCESS;
}
////////////////////////////////////////
/// fill hit position data
////////////////////////////////////////
StatusCode Muon::MuonStationNtupleHelperTool::fillMeasurementData (
const Trk::MeasurementBase* hit,
const Trk::TrackParameters* ,
const int& detectorType,
const bool& /*isOutlier*/) const {
// todo is this actually called for outliers?
// identify the detector type:
Identifier id = Trk::IdentifierExtractor::extract(hit);
if (detectorType==Trk::TrackState::MDT) {
m_mdtSectorIx->push_back(m_muonIdHelperTool->sector(id));
m_mdtStationIx->push_back(m_muonIdHelperTool->stationIndex(id));
}
if (detectorType==Trk::TrackState::RPC) {
m_rpcSectorIx->push_back(m_muonIdHelperTool->sector(id));
m_rpcStationIx->push_back(m_muonIdHelperTool->stationIndex(id));
m_rpcMeasuresPhi->push_back(m_muonIdHelperTool->measuresPhi(id));
}
if (detectorType==Trk::TrackState::TGC) {
m_tgcStationIx->push_back(m_muonIdHelperTool->stationIndex(id));
m_tgcMeasuresPhi->push_back(m_muonIdHelperTool->measuresPhi(id));
}
return StatusCode::SUCCESS;
}
StatusCode Muon::MuonStationNtupleHelperTool::resetVariables (
const int& detectorType ) const {
if (detectorType==Trk::TrackState::MDT) {
m_mdtSectorIx->clear();
m_mdtStationIx->clear();
}
if (detectorType==Trk::TrackState::RPC) {
m_rpcSectorIx->clear();
m_rpcStationIx->clear();
m_rpcMeasuresPhi->clear();
}
if (detectorType==Trk::TrackState::TGC) {
m_tgcStationIx->clear();
m_tgcMeasuresPhi->clear();
}
return StatusCode::SUCCESS;
}
StatusCode Muon::MuonStationNtupleHelperTool::fillHoleData (
const Trk::TrackStateOnSurface&,
const int&) const {
// we do nothing with holes
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// MuonStationNtupleHelperTool.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef MUONMUONSTATIONNTUPLEHELPERTOOL_H
#define MUONMUONSTATIONNTUPLEHELPERTOOL_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrkValInterfaces/IValidationNtupleHelperTool.h"
#include "MuonIdHelpers/MuonIdHelperTool.h" // this tool is not correctly interfaced
#include "GaudiKernel/ToolHandle.h"
// class MdtIdHelper;
// class TgcIdHelper;
// class CscIdHelper;
// class MdtIdHelper;
namespace Muon
{
/** @class MuonStationNtupleHelperTool
This is for the Doxygen-Documentation.
Please delete these lines and fill in information about
the Algorithm!
Please precede every member function declaration with a
short Doxygen comment stating the purpose of this function.
@author Wolfgang Liebig <wolfgang.liebig -at- cern.ch>
*/
class MuonStationNtupleHelperTool : virtual public Trk::IValidationNtupleHelperTool, public AthAlgTool
{
public:
MuonStationNtupleHelperTool(const std::string&,const std::string&,const IInterface*);
/** default destructor */
virtual ~MuonStationNtupleHelperTool ();
/** standard Athena-Algorithm method */
virtual StatusCode initialize();
/** standard Athena-Algorithm method */
virtual StatusCode finalize ();
//! fill hit position data
virtual StatusCode fillMeasurementData (
const Trk::MeasurementBase*,
const Trk::TrackParameters*,
const int& detectorType,
const bool& isOutlier ) const;
//! fill special data about holes on track (here: do nothing)
virtual StatusCode fillHoleData (
const Trk::TrackStateOnSurface&,
const int&) const;
/** add items to the ntuple and configure the helper tool:
should be called once (per detector type) by the steering tool (Trk::IValidationNtupleTool) */
virtual StatusCode addNtupleItems (
TTree* tree,
const int& detectorType ) const;
//! reset ntuple variables
virtual StatusCode resetVariables (
const int& detectorType ) const;
private:
ToolHandle<MuonIdHelperTool> m_muonIdHelperTool;
mutable std::vector<int>* m_mdtSectorIx; //!< sector number 1-16, odd=large, even=small
mutable std::vector<int>* m_mdtStationIx; //!< describe
mutable std::vector<int>* m_rpcSectorIx; //!< sector number 1-16, odd=large, even=small
mutable std::vector<int>* m_rpcStationIx; //!< describe
mutable std::vector<int>* m_rpcMeasuresPhi; //!< describe
mutable std::vector<int>* m_tgcSectorIx; //!< sector number 1-16, odd=large, even=small
mutable std::vector<int>* m_tgcStationIx; //!< describe
mutable std::vector<int>* m_tgcMeasuresPhi; //!< describe
};
} // end of namespace
#endif
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "../MuonStationNtupleHelperTool.h"
DECLARE_NAMESPACE_TOOL_FACTORY( Muon, MuonStationNtupleHelperTool )
DECLARE_FACTORY_ENTRIES( MuonTrackValidation )
{
DECLARE_NAMESPACE_TOOL( Muon, MuonStationNtupleHelperTool )
}
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES( MuonTrackValidation )
Supports Markdown
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