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

Reindentation of the MuonAlignment package

parent 17ccb334
No related branches found
No related tags found
No related merge requests found
Showing
with 1040 additions and 1168 deletions
......@@ -5,87 +5,80 @@
#ifndef MUONALIGNERRORBASE_ALIGNMENTDEVIATION_H
#define MUONALIGNERRORBASE_ALIGNMENTDEVIATION_H
#include "GeoPrimitives/GeoPrimitives.h"
#include <iosfwd>
#include <vector>
#include "GeoPrimitives/GeoPrimitives.h"
namespace Trk {
class RIO_OnTrack;
class RIO_OnTrack;
/**
* An object decorating a track and holding degrees of freedom reflecting alignment accuracy
*/
class AlignmentDeviation {
/**
* An object decorating a track and holding degrees of freedom reflecting alignment accuracy
*/
class AlignmentDeviation {
public:
virtual ~AlignmentDeviation() {}
/**
* The number of free parameters
*/
virtual int nPar() const = 0;
/**
* The error matrix on the free parameters. Track fitters should use this
* to compute a constraint on the free parameters.
*/
virtual double getCovariance(int ipar, int jpar) const = 0;
/**
* Return a Transform in the global coordinate system, given a list of
* parameters.
*/
virtual Amg::Transform3D getTransform(const std::vector<double>& parameters) const = 0;
/**
* Return the list of hits the transform should be applied to.
*/
void getListOfHits(std::vector<const Trk::RIO_OnTrack*>& hits) const;
/**
* Return hash built out of associated hits for fast comparison if deviations have same content
*/
std::size_t getHashOfHits() const;
/**
* Set hash built out of associated hits - cannot be calculated in constructor because of dependencies
*/
void setHashOfHits(std::size_t hash);
/**
* Return if the hash created form associated hits is set
*/
bool hasValidHashOfHits() const;
/**
* Verbose
*/
virtual void print(std::ostream& out) const = 0;
virtual ~AlignmentDeviation() {}
/**
* The number of free parameters
*/
virtual int nPar() const = 0;
/**
* The error matrix on the free parameters. Track fitters should use this
* to compute a constraint on the free parameters.
*/
virtual double getCovariance(int ipar, int jpar) const = 0;
/**
* Return a Transform in the global coordinate system, given a list of
* parameters.
*/
virtual Amg::Transform3D getTransform(const std::vector<double>& parameters) const = 0;
/**
* Return the list of hits the transform should be applied to.
*/
void getListOfHits(std::vector<const Trk::RIO_OnTrack*>& hits) const;
/**
* Return hash built out of associated hits for fast comparison if deviations have same content
*/
std::size_t getHashOfHits() const;
/**
* Set hash built out of associated hits - cannot be calculated in constructor because of dependencies
*/
void setHashOfHits(std::size_t hash);
/**
* Return if the hash created form associated hits is set
*/
bool hasValidHashOfHits() const;
/**
* Verbose
*/
virtual void print(std::ostream& out) const = 0;
protected:
std::vector<const Trk::RIO_OnTrack*> m_hits; // not owned
std::size_t m_hitshash;
bool m_hitshashdone;
};
std::vector<const Trk::RIO_OnTrack*> m_hits; // not owned
std::size_t m_hitshash;
bool m_hitshashdone;
};
inline void AlignmentDeviation::getListOfHits (std::vector<const Trk::RIO_OnTrack*>& hits) const {
hits = m_hits;
}
inline void AlignmentDeviation::getListOfHits(std::vector<const Trk::RIO_OnTrack*>& hits) const { hits = m_hits; }
inline std::size_t AlignmentDeviation::getHashOfHits () const {
return m_hitshash;
}
inline std::size_t AlignmentDeviation::getHashOfHits() const { return m_hitshash; }
inline void AlignmentDeviation::setHashOfHits (std::size_t hash) {
m_hitshash = hash;
m_hitshashdone = true;
}
inline void AlignmentDeviation::setHashOfHits(std::size_t hash) {
m_hitshash = hash;
m_hitshashdone = true;
}
inline bool AlignmentDeviation::hasValidHashOfHits () const {
return m_hitshashdone;
}
inline bool AlignmentDeviation::hasValidHashOfHits() const { return m_hitshashdone; }
}
} // namespace Trk
#endif
......@@ -8,41 +8,40 @@
#include "MuonAlignErrorBase/AlignmentDeviation.h"
namespace MuonAlign {
class AlignmentRotationDeviation : public Trk::AlignmentDeviation {
class AlignmentRotationDeviation : public Trk::AlignmentDeviation {
public:
AlignmentRotationDeviation(Amg::Vector3D center, Amg::Vector3D axis, double sigma,
const std::vector<const Trk::RIO_OnTrack*>& hits);
AlignmentRotationDeviation(Amg::Vector3D center, Amg::Vector3D axis, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits);
virtual ~AlignmentRotationDeviation() = default;
virtual ~AlignmentRotationDeviation()=default;
/**
* The number of free parameters
*/
virtual int nPar() const;
/**
* The number of free parameters
*/
virtual int nPar() const;
/**
* The error matrix on the free parameters. Track fitters should use this
* to compute a constraint on the free parameters.
*/
virtual double getCovariance(int ipar, int jpar) const;
/**
* The error matrix on the free parameters. Track fitters should use this
* to compute a constraint on the free parameters.
*/
virtual double getCovariance(int ipar, int jpar) const;
/**
* Return a Transform in the global coordinate system, given a list of
* parameters.
*/
virtual Amg::Transform3D getTransform(const std::vector<double>& parameters) const;
/**
* Return a Transform in the global coordinate system, given a list of
* parameters.
*/
virtual Amg::Transform3D getTransform(const std::vector<double>& parameters) const;
/**
* Verbose
*/
virtual void print(std::ostream& out) const;
/**
* Verbose
*/
virtual void print(std::ostream& out) const;
private:
Amg::Vector3D m_center;
Amg::Vector3D m_axis;
double m_sigma;
};
}
Amg::Vector3D m_center;
Amg::Vector3D m_axis;
double m_sigma;
};
} // namespace MuonAlign
#endif
......@@ -8,40 +8,38 @@
#include "MuonAlignErrorBase/AlignmentDeviation.h"
namespace MuonAlign {
class AlignmentTranslationDeviation : public Trk::AlignmentDeviation {
class AlignmentTranslationDeviation : public Trk::AlignmentDeviation {
public:
AlignmentTranslationDeviation(Amg::Vector3D u, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits);
AlignmentTranslationDeviation(Amg::Vector3D u, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits);
virtual ~AlignmentTranslationDeviation() = default;
virtual ~AlignmentTranslationDeviation()=default;
/**
* The number of free parameters
*/
virtual int nPar() const;
/**
* The number of free parameters
*/
virtual int nPar() const;
/**
* The error matrix on the free parameters. Track fitters should use this
* to compute a constraint on the free parameters.
*/
virtual double getCovariance(int ipar, int jpar) const;
/**
* The error matrix on the free parameters. Track fitters should use this
* to compute a constraint on the free parameters.
*/
virtual double getCovariance(int ipar, int jpar) const;
/**
* Return a Transform in the global coordinate system, given a list of
* parameters.
*/
virtual Amg::Transform3D getTransform(const std::vector<double>& parameters) const;
/**
* Return a Transform in the global coordinate system, given a list of
* parameters.
*/
virtual Amg::Transform3D getTransform(const std::vector<double>& parameters) const;
/**
* Verbose
*/
virtual void print(std::ostream& out) const;
/**
* Verbose
*/
virtual void print(std::ostream& out) const;
private:
Amg::Vector3D m_u; // unit vector
double m_sigma;
};
}
Amg::Vector3D m_u; // unit vector
double m_sigma;
};
} // namespace MuonAlign
#endif
......@@ -3,39 +3,34 @@
*/
#include "MuonAlignErrorBase/AlignmentRotationDeviation.h"
#include <iostream>
using namespace MuonAlign;
AlignmentRotationDeviation::AlignmentRotationDeviation (Amg::Vector3D center, Amg::Vector3D axis, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits) :
m_center(center),
m_axis(axis),
m_sigma(sigma)
{
m_hits = hits;
m_hitshash = 0;
m_hitshashdone = false;
AlignmentRotationDeviation::AlignmentRotationDeviation(Amg::Vector3D center, Amg::Vector3D axis, double sigma,
const std::vector<const Trk::RIO_OnTrack*>& hits) :
m_center(center), m_axis(axis), m_sigma(sigma) {
m_hits = hits;
m_hitshash = 0;
m_hitshashdone = false;
}
int AlignmentRotationDeviation::nPar () const {
return 1;
}
int AlignmentRotationDeviation::nPar() const { return 1; }
double AlignmentRotationDeviation::getCovariance (int, int) const {
return m_sigma * m_sigma;
}
double AlignmentRotationDeviation::getCovariance(int, int) const { return m_sigma * m_sigma; }
Amg::Transform3D AlignmentRotationDeviation::getTransform (const std::vector<double>& parameters) const {
Amg::Transform3D AlignmentRotationDeviation::getTransform(const std::vector<double>& parameters) const {
Amg::Translation3D transl1(-m_center);
Amg::Translation3D transl2(m_center);
Amg::AngleAxis3D angleaxis = Eigen::AngleAxis<double>(parameters[0], m_axis);
Amg::Transform3D t = transl2 * angleaxis * transl1;
Amg::Translation3D transl1(-m_center);
Amg::Translation3D transl2(m_center);
Amg::AngleAxis3D angleaxis = Eigen::AngleAxis<double>(parameters[0], m_axis);
Amg::Transform3D t = transl2 * angleaxis * transl1;
return t;
return t;
}
void AlignmentRotationDeviation::print (std::ostream& out) const {
out << "A rotation around center = (" << m_center.x() << ", " << m_center.y() << ", " << m_center.z() << ") and axis = (" << m_axis.x() << ", " << m_axis.y() << ", " << m_axis.z() << ") with sigma=" << m_sigma << " mrad applied to " << m_hits.size() << " hits" << std::endl;
void AlignmentRotationDeviation::print(std::ostream& out) const {
out << "A rotation around center = (" << m_center.x() << ", " << m_center.y() << ", " << m_center.z() << ") and axis = (" << m_axis.x()
<< ", " << m_axis.y() << ", " << m_axis.z() << ") with sigma=" << m_sigma << " mrad applied to " << m_hits.size() << " hits"
<< std::endl;
}
......@@ -3,33 +3,29 @@
*/
#include "MuonAlignErrorBase/AlignmentTranslationDeviation.h"
#include <iostream>
using namespace MuonAlign;
AlignmentTranslationDeviation::AlignmentTranslationDeviation (Amg::Vector3D u, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits)
: m_u(u.unit()),
m_sigma(sigma)
{
m_hits = hits;
m_hitshash = 0;
m_hitshashdone = false;
AlignmentTranslationDeviation::AlignmentTranslationDeviation(Amg::Vector3D u, double sigma,
const std::vector<const Trk::RIO_OnTrack*>& hits) :
m_u(u.unit()), m_sigma(sigma) {
m_hits = hits;
m_hitshash = 0;
m_hitshashdone = false;
}
int AlignmentTranslationDeviation::nPar () const {
return 1;
}
int AlignmentTranslationDeviation::nPar() const { return 1; }
double AlignmentTranslationDeviation::getCovariance (int, int) const {
return m_sigma*m_sigma;
}
double AlignmentTranslationDeviation::getCovariance(int, int) const { return m_sigma * m_sigma; }
Amg::Transform3D AlignmentTranslationDeviation::getTransform (const std::vector<double>& parameters) const {
Amg::Transform3D t(Amg::Translation3D(parameters[0] * m_u));
return t;
Amg::Transform3D AlignmentTranslationDeviation::getTransform(const std::vector<double>& parameters) const {
Amg::Transform3D t(Amg::Translation3D(parameters[0] * m_u));
return t;
}
void AlignmentTranslationDeviation::print (std::ostream& out) const {
out << "A translation along (" << m_u.x() << ", " << m_u.y() << ", " << m_u.z() << ") with sigma=" << m_sigma << " mm applied to " << m_hits.size() << " hits" << std::endl;
void AlignmentTranslationDeviation::print(std::ostream& out) const {
out << "A translation along (" << m_u.x() << ", " << m_u.y() << ", " << m_u.z() << ") with sigma=" << m_sigma << " mm applied to "
<< m_hits.size() << " hits" << std::endl;
}
......@@ -5,77 +5,71 @@
#ifndef MUONALIGNERRORTOOL_ALIGNMENTERRORTOOL_H
#define MUONALIGNERRORTOOL_ALIGNMENTERRORTOOL_H
#include "TrkToolInterfaces/ITrkAlignmentDeviationTool.h"
#include <boost/regex.hpp>
#include <iosfwd>
#include <string>
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "GeoPrimitives/GeoPrimitives.h"
#include "MuonAlignErrorBase/AlignmentDeviation.h"
#include "MuonCalibITools/IIdToFixedIdTool.h"
#include "MuonCondAlg/MuonAlignmentErrorData.h" // for accessing info from the DB
#include "MuonIdHelpers/IMuonIdHelperSvc.h"
#include "GeoPrimitives/GeoPrimitives.h"
#include "MuonCondAlg/MuonAlignmentErrorData.h" // for accessing info from the DB
#include "StoreGate/ReadCondHandleKey.h"
#include <boost/regex.hpp>
#include <iosfwd>
#include <string>
#include "TrkToolInterfaces/ITrkAlignmentDeviationTool.h"
namespace Trk {
class RIO_OnTrack;
class RIO_OnTrack;
}
namespace MuonAlign {
class AlignmentErrorTool : public Trk::ITrkAlignmentDeviationTool, virtual public AthAlgTool {
class AlignmentErrorTool : public Trk::ITrkAlignmentDeviationTool, virtual public AthAlgTool {
public:
AlignmentErrorTool(const std::string&,const std::string&,const IInterface*);
virtual ~AlignmentErrorTool()=default;
virtual StatusCode initialize();
virtual void makeAlignmentDeviations (const Trk::Track& track, std::vector<Trk::AlignmentDeviation*>& deviations) const;
AlignmentErrorTool(const std::string&, const std::string&, const IInterface*);
virtual ~AlignmentErrorTool() = default;
virtual StatusCode initialize();
virtual void makeAlignmentDeviations(const Trk::Track& track, std::vector<Trk::AlignmentDeviation*>& deviations) const;
private:
ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool{this,"idTool","MuonCalib::IdToFixedIdTool"};
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
// Struct for per-Station Deviations Information //
struct deviationSummary_t {
deviationSummary_t();
~deviationSummary_t()=default;
//static int i_instance; // TMP DEBUG
// SYSTEMATIC UNCERTAINTIES
double traslation;
double rotation;
// RULE
boost::regex stationName;
boost::regex multilayer;
// SET OF HITS SATISFYING THE RULE
std::vector<const Trk::RIO_OnTrack*> hits;
// USEFUL NUMBERS
Amg::Vector3D sumP;
Amg::Vector3D sumU;
Amg::Vector3D sumV;
double sumW2;
};
// SOME USEFUL METHODS //
// GET STATION EXACT NAME, FROM: https://svnweb.cern.ch/cern/wsvn/atlas-giraudpf/giraudpf/MuonSpectrometer/MuonAlignment/MuonAlignTrk/trunk/MuonAlignTrk/MuonFixedId.h
std::string hardwareName(MuonCalib::MuonFixedId calibId) const;
std::string side(MuonCalib::MuonFixedId calibId) const;
std::string sectorString(MuonCalib::MuonFixedId calibId) const;
int sector(MuonCalib::MuonFixedId calibId) const;
int hardwareEta(MuonCalib::MuonFixedId calibId) const;
bool isSmallSector(MuonCalib::MuonFixedId calibId) const;
SG::ReadCondHandleKey<MuonAlignmentErrorData> m_readKey{this, "ReadKey", "MuonAlignmentErrorData", "Key of MuonAlignmentErrorData"};
};
}
ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool{this, "idTool", "MuonCalib::IdToFixedIdTool"};
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
// Struct for per-Station Deviations Information //
struct deviationSummary_t {
deviationSummary_t();
~deviationSummary_t() = default;
// static int i_instance; // TMP DEBUG
// SYSTEMATIC UNCERTAINTIES
double traslation;
double rotation;
// RULE
boost::regex stationName;
boost::regex multilayer;
// SET OF HITS SATISFYING THE RULE
std::vector<const Trk::RIO_OnTrack*> hits;
// USEFUL NUMBERS
Amg::Vector3D sumP;
Amg::Vector3D sumU;
Amg::Vector3D sumV;
double sumW2;
};
// SOME USEFUL METHODS //
// GET STATION EXACT NAME, FROM:
// https://svnweb.cern.ch/cern/wsvn/atlas-giraudpf/giraudpf/MuonSpectrometer/MuonAlignment/MuonAlignTrk/trunk/MuonAlignTrk/MuonFixedId.h
std::string hardwareName(MuonCalib::MuonFixedId calibId) const;
std::string side(MuonCalib::MuonFixedId calibId) const;
std::string sectorString(MuonCalib::MuonFixedId calibId) const;
int sector(MuonCalib::MuonFixedId calibId) const;
int hardwareEta(MuonCalib::MuonFixedId calibId) const;
bool isSmallSector(MuonCalib::MuonFixedId calibId) const;
SG::ReadCondHandleKey<MuonAlignmentErrorData> m_readKey{this, "ReadKey", "MuonAlignmentErrorData", "Key of MuonAlignmentErrorData"};
};
} // namespace MuonAlign
#endif
......@@ -8,45 +8,42 @@
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkToolInterfaces/ITrkAlignmentDeviationTool.h"
#include "MuonIdHelpers/IMuonIdHelperSvc.h"
#include "MuonCalibITools/IIdToFixedIdTool.h"
#include "MuonIdHelpers/IMuonIdHelperSvc.h"
#include "TFile.h"
#include "TH1F.h"
#include "TrkToolInterfaces/ITrkAlignmentDeviationTool.h"
namespace Trk {
class Track;
class Track;
}
namespace MuonAlign {
class MuonAlignErrorExampleAlg : public AthAlgorithm {
class MuonAlignErrorExampleAlg : public AthAlgorithm {
public:
MuonAlignErrorExampleAlg(const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
MuonAlignErrorExampleAlg(const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
void muonTrack(const Trk::Track* track) const;
ToolHandle<Trk::ITrkAlignmentDeviationTool> m_alignErrorTool{this,"alignErrorTool","MuonAlign::AlignmentErrorTool"};
// FOR DEBUGGING
TFile* m_debug;
TH1F* m_cham_per_dev;
TH1F* m_dev_per_track;
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool{this,"idTool","MuonCalib::IdToFixedIdTool/IdToFixedIdTool"};
std::string hardwareName(MuonCalib::MuonFixedId calibId) const;
std::string side(MuonCalib::MuonFixedId calibId) const;
std::string sectorString(MuonCalib::MuonFixedId calibId) const;
int sector(MuonCalib::MuonFixedId calibId) const;
int hardwareEta(MuonCalib::MuonFixedId calibId) const;
bool isSmallSector(MuonCalib::MuonFixedId calibId) const;
};
}
void muonTrack(const Trk::Track* track) const;
ToolHandle<Trk::ITrkAlignmentDeviationTool> m_alignErrorTool{this, "alignErrorTool", "MuonAlign::AlignmentErrorTool"};
// FOR DEBUGGING
TFile* m_debug;
TH1F* m_cham_per_dev;
TH1F* m_dev_per_track;
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
ToolHandle<MuonCalib::IIdToFixedIdTool> m_idTool{this, "idTool", "MuonCalib::IdToFixedIdTool/IdToFixedIdTool"};
std::string hardwareName(MuonCalib::MuonFixedId calibId) const;
std::string side(MuonCalib::MuonFixedId calibId) const;
std::string sectorString(MuonCalib::MuonFixedId calibId) const;
int sector(MuonCalib::MuonFixedId calibId) const;
int hardwareEta(MuonCalib::MuonFixedId calibId) const;
bool isSmallSector(MuonCalib::MuonFixedId calibId) const;
};
} // namespace MuonAlign
#endif
......@@ -3,195 +3,182 @@
*/
#include "MuonAlignErrorTool/MuonAlignErrorExampleAlg.h"
#include <iostream>
#include "MuonAlignErrorBase/AlignmentDeviation.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkRIO_OnTrack/RIO_OnTrack.h"
#include <iostream>
#include "TrkTrack/TrackCollection.h"
using namespace MuonAlign;
MuonAlignErrorExampleAlg::MuonAlignErrorExampleAlg (const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator),
m_debug(nullptr),
m_cham_per_dev(nullptr),
m_dev_per_track(nullptr) {
}
StatusCode MuonAlignErrorExampleAlg::initialize () {
MuonAlignErrorExampleAlg::MuonAlignErrorExampleAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator), m_debug(nullptr), m_cham_per_dev(nullptr), m_dev_per_track(nullptr) {}
m_debug = new TFile("muonalignerrordebug.root", "RECREATE");
m_debug->cd();
m_cham_per_dev = new TH1F("cham_per_dev", "# of chamber layers per alignment deviation", 10, 0., 10.);
m_dev_per_track = new TH1F("dev_per_track", "# of chamber layers per alignment deviation", 10, 0., 10.);
StatusCode MuonAlignErrorExampleAlg::initialize() {
m_debug = new TFile("muonalignerrordebug.root", "RECREATE");
m_debug->cd();
m_cham_per_dev = new TH1F("cham_per_dev", "# of chamber layers per alignment deviation", 10, 0., 10.);
m_dev_per_track = new TH1F("dev_per_track", "# of chamber layers per alignment deviation", 10, 0., 10.);
ATH_CHECK(m_idHelperSvc.retrieve());
ATH_CHECK(m_idHelperSvc.retrieve());
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
StatusCode MuonAlignErrorExampleAlg::execute () {
StatusCode sc;
const ::TrackCollection* tracks = 0;
sc = sgSvc()->retrieve(tracks, "MuonSpectrometerTracks"); // for example, should be a job option
if(sc.isFailure()) return sc;
StatusCode MuonAlignErrorExampleAlg::execute() {
StatusCode sc;
const ::TrackCollection* tracks = 0;
sc = sgSvc()->retrieve(tracks, "MuonSpectrometerTracks"); // for example, should be a job option
if (sc.isFailure()) return sc;
// LOOP ON MUON TRACKS //
for (::TrackCollection::const_iterator it=tracks->begin(), end=tracks->end(); it!=end; it++) {
const Trk::Track* track = *it;
muonTrack(track);
}
// LOOP ON MUON TRACKS //
for (::TrackCollection::const_iterator it = tracks->begin(), end = tracks->end(); it != end; it++) {
const Trk::Track* track = *it;
muonTrack(track);
}
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
void MuonAlignErrorExampleAlg::muonTrack (const Trk::Track* track) const {
// Compute and verbose the alignment deviations for a given track
ATH_MSG_DEBUG("Processing track with momentum " << track->trackParameters()->front()->momentum().mag()/1000. << " GeV and transverse momentum " << track->trackParameters()->front()->momentum().perp()/1000 << " GeV");
std::vector<Trk::AlignmentDeviation*> deviations;
m_alignErrorTool->makeAlignmentDeviations(*track, deviations);
// DEBUG
m_dev_per_track->Fill(deviations.size());
std::vector<const Trk::RIO_OnTrack*> hits;
// DO SOME CHECKS AND THEN CLEAN UP
for (std::vector<Trk::AlignmentDeviation*>::iterator it(deviations.begin()), end(deviations.end()); it!=end; ++it) {
(*it)->getListOfHits(hits);
std::set<std::string> myidset_all;
for(std::vector<const Trk::RIO_OnTrack*>::iterator jt(hits.begin()), end(hits.end()); jt!=end; ++jt) {
// JOCHEN WAY
Identifier myid = ((const Trk::RIO_OnTrack*)(*jt))->identify();
void MuonAlignErrorExampleAlg::muonTrack(const Trk::Track* track) const {
// Compute and verbose the alignment deviations for a given track
ATH_MSG_DEBUG("Processing track with momentum " << track->trackParameters()->front()->momentum().mag() / 1000.
<< " GeV and transverse momentum "
<< track->trackParameters()->front()->momentum().perp() / 1000 << " GeV");
std::vector<Trk::AlignmentDeviation*> deviations;
m_alignErrorTool->makeAlignmentDeviations(*track, deviations);
// DEBUG
m_dev_per_track->Fill(deviations.size());
std::vector<const Trk::RIO_OnTrack*> hits;
// DO SOME CHECKS AND THEN CLEAN UP
for (std::vector<Trk::AlignmentDeviation*>::iterator it(deviations.begin()), end(deviations.end()); it != end; ++it) {
(*it)->getListOfHits(hits);
std::set<std::string> myidset_all;
for (std::vector<const Trk::RIO_OnTrack*>::iterator jt(hits.begin()), end(hits.end()); jt != end; ++jt) {
// JOCHEN WAY
Identifier myid = ((const Trk::RIO_OnTrack*)(*jt))->identify();
if (!(m_idHelperSvc->isMM(myid) || m_idHelperSvc->issTgc(myid))) {
// CAMILLA WAY
MuonCalib::MuonFixedId calibId = m_idTool->idToFixedId(myid);
if (!calibId.isValid()) { continue; }
std::string completename = hardwareName(calibId);
myidset_all.insert(completename.substr(0, 2));
} else
myidset_all.insert(m_idHelperSvc->toStringStation(myid));
}
m_cham_per_dev->Fill(myidset_all.size());
if (!(m_idHelperSvc->isMM(myid)||m_idHelperSvc->issTgc(myid))) {
// CAMILLA WAY
MuonCalib::MuonFixedId calibId = m_idTool->idToFixedId(myid);
if (!calibId.isValid()) {
continue;
}
std::string completename = hardwareName(calibId);
myidset_all.insert(completename.substr(0,2));
} else myidset_all.insert(m_idHelperSvc->toStringStation(myid));
// cleanup
delete (*it);
}
m_cham_per_dev->Fill(myidset_all.size());
// cleanup
delete (*it);
}
}
StatusCode MuonAlignErrorExampleAlg::finalize () {
m_debug->Write();
//m_cham_per_dev->Write();
//m_dev_per_track->Write();
m_debug->Close();
StatusCode MuonAlignErrorExampleAlg::finalize() {
m_debug->Write();
// m_cham_per_dev->Write();
// m_dev_per_track->Write();
m_debug->Close();
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
////////////////////////////
// RECOGNIZE STATION NAME //
////////////////////////////
inline std::string MuonAlignErrorExampleAlg::hardwareName(MuonCalib::MuonFixedId calibId) const {
if (sector(calibId)==13) {
if (calibId.eta()== 7 && calibId.stationName()==5) return "BOE1A13"; // BOE1A13 not BOL7A13
if (calibId.eta()==-7 && calibId.stationName()==5) return "BOE1C13"; // BOE1C13 not BOL7C13
}
std::string etaString = "0";
etaString[0] += std::abs(hardwareEta(calibId));
return calibId.stationNameString() + etaString + side(calibId) + sectorString(calibId);
if (sector(calibId) == 13) {
if (calibId.eta() == 7 && calibId.stationName() == 5) return "BOE1A13"; // BOE1A13 not BOL7A13
if (calibId.eta() == -7 && calibId.stationName() == 5) return "BOE1C13"; // BOE1C13 not BOL7C13
}
std::string etaString = "0";
etaString[0] += std::abs(hardwareEta(calibId));
return calibId.stationNameString() + etaString + side(calibId) + sectorString(calibId);
}
inline std::string MuonAlignErrorExampleAlg::side(MuonCalib::MuonFixedId calibId) const {
return calibId.eta()>0 ? "A" : calibId.eta()<0 ? "C" : "B";
return calibId.eta() > 0 ? "A" : calibId.eta() < 0 ? "C" : "B";
}
inline std::string MuonAlignErrorExampleAlg::sectorString(MuonCalib::MuonFixedId calibId) const {
std::string ret = "00";
int sec = sector(calibId);
if (sec >= 10) {
ret[0] = '1';
sec -= 10;
}
ret[1] += sec;
return ret;
inline std::string MuonAlignErrorExampleAlg::sectorString(MuonCalib::MuonFixedId calibId) const {
std::string ret = "00";
int sec = sector(calibId);
if (sec >= 10) {
ret[0] = '1';
sec -= 10;
}
ret[1] += sec;
return ret;
}
inline int MuonAlignErrorExampleAlg::sector (MuonCalib::MuonFixedId calibId) const {
return isSmallSector(calibId) ? 2*calibId.phi() : 2*calibId.phi()-1;
inline int MuonAlignErrorExampleAlg::sector(MuonCalib::MuonFixedId calibId) const {
return isSmallSector(calibId) ? 2 * calibId.phi() : 2 * calibId.phi() - 1;
}
inline bool MuonAlignErrorExampleAlg::isSmallSector (MuonCalib::MuonFixedId calibId) const {
switch (calibId.stationName()) {
case 2: return true;
case 4: return true;
case 6: return true;
case 7: return true;
case 9: return true;
case 10: return true;
case 11: return true;
case 17: return true;
case 20: return true;
case 23: return true;
case 24: return true;
case 33: return true;
default: return false;
}
inline bool MuonAlignErrorExampleAlg::isSmallSector(MuonCalib::MuonFixedId calibId) const {
switch (calibId.stationName()) {
case 2: return true;
case 4: return true;
case 6: return true;
case 7: return true;
case 9: return true;
case 10: return true;
case 11: return true;
case 17: return true;
case 20: return true;
case 23: return true;
case 24: return true;
case 33: return true;
default: return false;
}
}
inline int MuonAlignErrorExampleAlg::hardwareEta(MuonCalib::MuonFixedId calibId) const {
switch (calibId.stationName()) {
case 3:
{
if (sector(calibId)==13) {
switch (calibId.eta()) {
case 4: return 5;
case 5: return 6;
case 6: return 7;
case -4: return -5;
case -5: return -6;
case -6: return -7;
}
}
return calibId.eta();
}
case 5:
{
if (sector(calibId)==13) {
if (calibId.eta()== 7) return 1; // BOE1A13 not BOL7A13
if (calibId.eta()==-7) return -1; // BOE1C13 not BOL7C13
}
return calibId.eta();
}
case 10: return calibId.eta()>0 ? calibId.eta()*2-1 : calibId.eta()*2+1;
case 11: return calibId.eta()*2;
case 15:
{
if ((sector(calibId) == 1) || (sector(calibId) == 9)) {
switch (calibId.eta()) {
case 4: return 5;
case 5: return 4;
case -4: return -5;
case -5: return -4;
}
switch (calibId.stationName()) {
case 3: {
if (sector(calibId) == 13) {
switch (calibId.eta()) {
case 4: return 5;
case 5: return 6;
case 6: return 7;
case -4: return -5;
case -5: return -6;
case -6: return -7;
}
}
return calibId.eta();
}
case 5: {
if (sector(calibId) == 13) {
if (calibId.eta() == 7) return 1; // BOE1A13 not BOL7A13
if (calibId.eta() == -7) return -1; // BOE1C13 not BOL7C13
}
return calibId.eta();
}
return calibId.eta();
}
case 16:
{
if ((sector(calibId) == 5) && (calibId.eta() == 1)) return 2;
if ((sector(calibId) == 5) && (calibId.eta() == -1)) return -2;
return calibId.eta();
}
default: return calibId.eta();
}
case 10: return calibId.eta() > 0 ? calibId.eta() * 2 - 1 : calibId.eta() * 2 + 1;
case 11: return calibId.eta() * 2;
case 15: {
if ((sector(calibId) == 1) || (sector(calibId) == 9)) {
switch (calibId.eta()) {
case 4: return 5;
case 5: return 4;
case -4: return -5;
case -5: return -4;
}
}
return calibId.eta();
}
case 16: {
if ((sector(calibId) == 5) && (calibId.eta() == 1)) return 2;
if ((sector(calibId) == 5) && (calibId.eta() == -1)) return -2;
return calibId.eta();
}
default: return calibId.eta();
}
}
#include "MuonAlignErrorTool/MuonAlignErrorExampleAlg.h"
#include "MuonAlignErrorTool/AlignmentErrorTool.h"
#include "MuonAlignErrorTool/MuonAlignErrorExampleAlg.h"
DECLARE_COMPONENT( MuonAlign::MuonAlignErrorExampleAlg )
DECLARE_COMPONENT( MuonAlign::AlignmentErrorTool )
DECLARE_COMPONENT(MuonAlign::MuonAlignErrorExampleAlg)
DECLARE_COMPONENT(MuonAlign::AlignmentErrorTool)
......@@ -5,59 +5,52 @@
#ifndef MUONALIGNGENALGS_COMBINEDMUONALIGNMODULE_H
#define MUONALIGNGENALGS_COMBINEDMUONALIGNMODULE_H
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
#include <iostream>
#include <vector>
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
/**
@file CombinedMuonAlignModule.h
@class CombinedMuonAlignModule
@brief CombinedMuonAlignModule is a grouping of MdtReadoutElements,
@brief CombinedMuonAlignModule is a grouping of MdtReadoutElements,
TgcReadoutElements, and RpcReadoutElements, grouped according to the type of alignment.
@author Robert Harrington <roberth@bu.edu>
@date 06/09/2009
*/
namespace MuonGM {
class MdtReadoutElement;
class TgcReadoutElement;
class RpcReadoutElement;
}
class MdtReadoutElement;
class TgcReadoutElement;
class RpcReadoutElement;
} // namespace MuonGM
namespace Muon {
class CombinedMuonAlignModule : public Trk::AlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with CombinedMuonAlignModule for name
and the the same output level as the AlgTool. */
CombinedMuonAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created
the CombinedMuonAlignModule and the same output level. */
CombinedMuonAlignModule(MsgStream* log,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
virtual ~CombinedMuonAlignModule();
virtual void shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const;
virtual void restoreSurfaces(Trk::TrkDetElementBase* mre) const;
private:
MsgStream* m_log;
CombinedMuonAlignModule & operator=(const CombinedMuonAlignModule &right);
CombinedMuonAlignModule(const CombinedMuonAlignModule&);
}; // end class
} // end namespace
#endif // MUONALIGNGENALGS_COMBINEDMUONALIGNMODULE_H
class CombinedMuonAlignModule : public Trk::AlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with CombinedMuonAlignModule for name
and the the same output level as the AlgTool. */
CombinedMuonAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created
the CombinedMuonAlignModule and the same output level. */
CombinedMuonAlignModule(MsgStream* log, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
virtual ~CombinedMuonAlignModule();
virtual void shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const;
virtual void restoreSurfaces(Trk::TrkDetElementBase* mre) const;
private:
MsgStream* m_log;
CombinedMuonAlignModule& operator=(const CombinedMuonAlignModule& right);
CombinedMuonAlignModule(const CombinedMuonAlignModule&);
}; // end class
} // namespace Muon
#endif // MUONALIGNGENALGS_COMBINEDMUONALIGNMODULE_H
......@@ -5,13 +5,13 @@
#ifndef MUONALIGNGENALGS_CSCALIGNMODULE_H
#define MUONALIGNGENALGS_CSCALIGNMODULE_H
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include <iostream>
#include <vector>
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
/**
@file CscAlignModule.h
@class CscAlignModule
......@@ -27,49 +27,43 @@ class TFile;
class TTree;
namespace MuonGM {
class CscReadoutElement;
class CscReadoutElement;
}
namespace Muon {
class CscAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with CscAlignModule for name
and the the same output level as the AlgTool. */
CscAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created
the CscAlignModule and the same output level. */
CscAlignModule(MsgStream* log,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
virtual ~CscAlignModule();
/** tree in m_rootfile used to store positions of tubes in chambers */
TFile* getRootFile() { return m_rootfile; }
TTree* getTubePositionTree() { return m_tubePositionTree; }
void setRootFile(TFile* file) { m_rootfile=file; }
void setTubePositionTree(TTree* tree) { m_tubePositionTree=tree; }
//void shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const;
//void restoreSurfaces(Trk::TrkDetElementBase* mre) const;
private:
/** tree used to store positions of tubes for drawing hits and troubleshooting */
TFile* m_rootfile;
TTree* m_tubePositionTree;
MsgStream* m_log;
CscAlignModule & operator=(const CscAlignModule &right);
CscAlignModule(const CscAlignModule&);
}; // end class
} // end namespace
#endif // MUONALIGNGENALGS_CSCALIGNMODULE_H
class CscAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with CscAlignModule for name
and the the same output level as the AlgTool. */
CscAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created
the CscAlignModule and the same output level. */
CscAlignModule(MsgStream* log, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
virtual ~CscAlignModule();
/** tree in m_rootfile used to store positions of tubes in chambers */
TFile* getRootFile() { return m_rootfile; }
TTree* getTubePositionTree() { return m_tubePositionTree; }
void setRootFile(TFile* file) { m_rootfile = file; }
void setTubePositionTree(TTree* tree) { m_tubePositionTree = tree; }
// void shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const;
// void restoreSurfaces(Trk::TrkDetElementBase* mre) const;
private:
/** tree used to store positions of tubes for drawing hits and troubleshooting */
TFile* m_rootfile;
TTree* m_tubePositionTree;
MsgStream* m_log;
CscAlignModule& operator=(const CscAlignModule& right);
CscAlignModule(const CscAlignModule&);
}; // end class
} // namespace Muon
#endif // MUONALIGNGENALGS_CSCALIGNMODULE_H
......@@ -5,13 +5,13 @@
#ifndef MUONALIGNGENALGS_MDTALIGNMODULE_H
#define MUONALIGNGENALGS_MDTALIGNMODULE_H
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include <iostream>
#include <vector>
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
/**
@file MdtAlignModule.h
@class MdtAlignModule
......@@ -31,49 +31,43 @@ class TFile;
class TTree;
namespace MuonGM {
class MdtReadoutElement;
class MdtReadoutElement;
}
namespace Muon {
class MdtAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with MdtAlignModule for name
and the the same output level as the AlgTool. */
MdtAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created
the MdtAlignModule and the same output level. */
MdtAlignModule(MsgStream* log,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
virtual ~MdtAlignModule();
/** tree in m_rootfile used to store positions of tubes in chambers */
TFile* getRootFile() { return m_rootfile; }
TTree* getTubePositionTree() { return m_tubePositionTree; }
void setRootFile(TFile* file) { m_rootfile=file; }
void setTubePositionTree(TTree* tree) { m_tubePositionTree=tree; }
//void shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const;
//void restoreSurfaces(Trk::TrkDetElementBase* mre) const;
private:
/** tree used to store positions of tubes for drawing hits and troubleshooting */
TFile* m_rootfile;
TTree* m_tubePositionTree;
MsgStream* m_log;
MdtAlignModule & operator=(const MdtAlignModule &right);
MdtAlignModule(const MdtAlignModule&);
}; // end class
} // end namespace
#endif // MUONALIGNGENALGS_MDTALIGNMODULE_H
class MdtAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with MdtAlignModule for name
and the the same output level as the AlgTool. */
MdtAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created
the MdtAlignModule and the same output level. */
MdtAlignModule(MsgStream* log, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
virtual ~MdtAlignModule();
/** tree in m_rootfile used to store positions of tubes in chambers */
TFile* getRootFile() { return m_rootfile; }
TTree* getTubePositionTree() { return m_tubePositionTree; }
void setRootFile(TFile* file) { m_rootfile = file; }
void setTubePositionTree(TTree* tree) { m_tubePositionTree = tree; }
// void shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const;
// void restoreSurfaces(Trk::TrkDetElementBase* mre) const;
private:
/** tree used to store positions of tubes for drawing hits and troubleshooting */
TFile* m_rootfile;
TTree* m_tubePositionTree;
MsgStream* m_log;
MdtAlignModule& operator=(const MdtAlignModule& right);
MdtAlignModule(const MdtAlignModule&);
}; // end class
} // namespace Muon
#endif // MUONALIGNGENALGS_MDTALIGNMODULE_H
......@@ -5,18 +5,18 @@
#ifndef MUONALIGNGENALGS_RPCALIGNMODULE_H
#define MUONALIGNGENALGS_RPCALIGNMODULE_H
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include <iostream>
#include <vector>
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
/**
@file RpcAlignModule.h
@class RpcAlignModule
@brief RpcAlignModule is a grouping of RpcReadoutElements, grouped
@brief RpcAlignModule is a grouping of RpcReadoutElements, grouped
according to the type of alignment.
@author Robert Harrington <roberth@bu.edu>
......@@ -27,37 +27,31 @@ class TFile;
class TTree;
namespace MuonGM {
class RpcReadoutElement;
class RpcReadoutElement;
}
namespace Muon {
class RpcAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with RpcAlignModule for name and the the same output level as the AlgTool. */
RpcAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created the RpcAlignModule and the same output level. */
RpcAlignModule(MsgStream* log,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
class RpcAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with RpcAlignModule for name and the the same output level as the AlgTool. */
RpcAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
virtual ~RpcAlignModule();
/** This constructor gives a MsgStream with the name of the tool that created the RpcAlignModule and the same output level. */
RpcAlignModule(MsgStream* log, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
//void shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const;
//void restoreSurfaces(Trk::TrkDetElementBase* tre) const;
virtual ~RpcAlignModule();
private:
// void shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const;
// void restoreSurfaces(Trk::TrkDetElementBase* tre) const;
private:
MsgStream* m_log;
RpcAlignModule& operator=(const RpcAlignModule& right);
RpcAlignModule(const RpcAlignModule&);
MsgStream* m_log;
RpcAlignModule & operator=(const RpcAlignModule &right);
RpcAlignModule(const RpcAlignModule&);
}; // end class
}; // end class
} // end namespace
} // namespace Muon
#endif // MUONALIGNGENALGS_RPCALIGNMODULE_H
#endif // MUONALIGNGENALGS_RPCALIGNMODULE_H
......@@ -5,13 +5,13 @@
#ifndef MUONALIGNGENALGS_TGCALIGNMODULE_H
#define MUONALIGNGENALGS_TGCALIGNMODULE_H
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include <iostream>
#include <vector>
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include "TrkAlignEvent/AlignModule.h"
#include "TrkAlignEvent/AlignPar.h"
/**
@file TgcAlignModule.h
@class TgcAlignModule
......@@ -30,49 +30,44 @@ class TFile;
class TTree;
namespace MuonGM {
class TgcReadoutElement;
class TgcReadoutElement;
}
namespace Muon {
class TgcAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with TgcAlignModule for name and the the same output level as the AlgTool. */
TgcAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created the TgcAlignModule and the same output level. */
TgcAlignModule(MsgStream* log,
const Amg::Transform3D& transform=Amg::Transform3D::Identity());
virtual ~TgcAlignModule();
/** trees in m_rootfile used to store positions of strips and wires in chambers */
TFile* getRootFile() { return m_rootfile; }
TTree* getStripPositionTree() { return m_stripPositionTree; }
TTree* getWirePositionTree() { return m_wirePositionTree; }
void setRootFile(TFile* file) { m_rootfile=file; }
void setStripPositionTree(TTree* tree) { m_stripPositionTree=tree; }
void setWirePositionTree(TTree* tree) { m_wirePositionTree=tree; }
//void shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const;
//void restoreSurfaces(Trk::TrkDetElementBase* tre) const;
private:
/** trees used to store positions of stripts and wires for drawing hits and troubleshooting */
TFile* m_rootfile;
TTree* m_stripPositionTree;
TTree* m_wirePositionTree;
MsgStream* m_log;
TgcAlignModule & operator=(const TgcAlignModule &right);
TgcAlignModule(const TgcAlignModule&);
}; // end class
} // end namespace
#endif // MUONALIGNGENALGS_TGCALIGNMODULE_H
class TgcAlignModule : public CombinedMuonAlignModule {
public:
/** Constructor using AlgTool gives a MsgStream with TgcAlignModule for name and the the same output level as the AlgTool. */
TgcAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
/** This constructor gives a MsgStream with the name of the tool that created the TgcAlignModule and the same output level. */
TgcAlignModule(MsgStream* log, const Amg::Transform3D& transform = Amg::Transform3D::Identity());
virtual ~TgcAlignModule();
/** trees in m_rootfile used to store positions of strips and wires in chambers */
TFile* getRootFile() { return m_rootfile; }
TTree* getStripPositionTree() { return m_stripPositionTree; }
TTree* getWirePositionTree() { return m_wirePositionTree; }
void setRootFile(TFile* file) { m_rootfile = file; }
void setStripPositionTree(TTree* tree) { m_stripPositionTree = tree; }
void setWirePositionTree(TTree* tree) { m_wirePositionTree = tree; }
// void shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const;
// void restoreSurfaces(Trk::TrkDetElementBase* tre) const;
private:
/** trees used to store positions of stripts and wires for drawing hits and troubleshooting */
TFile* m_rootfile;
TTree* m_stripPositionTree;
TTree* m_wirePositionTree;
MsgStream* m_log;
TgcAlignModule& operator=(const TgcAlignModule& right);
TgcAlignModule(const TgcAlignModule&);
}; // end class
} // namespace Muon
#endif // MUONALIGNGENALGS_TGCALIGNMODULE_H
......@@ -13,7 +13,8 @@ This package contains classes to be used for alignment of muon chambers.
@section MuonAlignEvent_MuonAlignEventOverview Class Overview
The package contains the following classes:
- MdtAlignModule: a generalized alignable module, consisting of groups of MDT detectors to be aligned as a single structure. Inherits from Trk::AlignModule.
- MdtAlignModule: a generalized alignable module, consisting of groups of MDT detectors to be aligned as a single structure. Inherits
from Trk::AlignModule.
......
......@@ -2,97 +2,88 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonReadoutGeometry/CscReadoutElement.h"
#include "MuonReadoutGeometry/MdtReadoutElement.h"
#include "MuonReadoutGeometry/TgcReadoutElement.h"
#include "MuonReadoutGeometry/RpcReadoutElement.h"
#include "MuonReadoutGeometry/CscReadoutElement.h"
#include "MuonAlignEvent/CombinedMuonAlignModule.h"
#include "MuonReadoutGeometry/TgcReadoutElement.h"
namespace Muon {
//________________________________________________________________________
CombinedMuonAlignModule::CombinedMuonAlignModule(MsgStream* log,
const Amg::Transform3D& transform)
: AlignModule(log,transform)
, m_log(new MsgStream(*log))
{
}
//________________________________________________________________________
CombinedMuonAlignModule::CombinedMuonAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform)
: AlignModule(algtool,transform)
, m_log(new MsgStream(algtool->msgSvc(),"CombinedMuonAlignModule"))
{
const AthAlgTool* athAlgTool=dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool)
m_log->setLevel(athAlgTool->msg().level());
}
//________________________________________________________________________
CombinedMuonAlignModule::~CombinedMuonAlignModule()
{
delete m_log;
}
//________________________________________________________________________
void CombinedMuonAlignModule::shiftSurface(Trk::TrkDetElementBase* det,
Identifier id) const
{
MuonGM::MdtReadoutElement* mdt=dynamic_cast<MuonGM::MdtReadoutElement*>(det);
if (mdt) {
mdt->shiftTube(id);
return;
//________________________________________________________________________
CombinedMuonAlignModule::CombinedMuonAlignModule(MsgStream* log, const Amg::Transform3D& transform) :
AlignModule(log, transform), m_log(new MsgStream(*log)) {}
//________________________________________________________________________
CombinedMuonAlignModule::CombinedMuonAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform) :
AlignModule(algtool, transform), m_log(new MsgStream(algtool->msgSvc(), "CombinedMuonAlignModule")) {
const AthAlgTool* athAlgTool = dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool) m_log->setLevel(athAlgTool->msg().level());
}
MuonGM::TgcReadoutElement* tgc=dynamic_cast<MuonGM::TgcReadoutElement*>(det);
if (tgc) {
tgc->shiftSurface(id);
return;
//________________________________________________________________________
CombinedMuonAlignModule::~CombinedMuonAlignModule() { delete m_log; }
//________________________________________________________________________
void CombinedMuonAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const {
MuonGM::MdtReadoutElement* mdt = dynamic_cast<MuonGM::MdtReadoutElement*>(det);
if (mdt) {
mdt->shiftTube(id);
return;
}
MuonGM::TgcReadoutElement* tgc = dynamic_cast<MuonGM::TgcReadoutElement*>(det);
if (tgc) {
tgc->shiftSurface(id);
return;
}
MuonGM::RpcReadoutElement* rpc = dynamic_cast<MuonGM::RpcReadoutElement*>(det);
if (rpc) {
rpc->shiftSurface(id);
return;
}
MuonGM::CscReadoutElement* csc = dynamic_cast<MuonGM::CscReadoutElement*>(det);
if (csc) {
csc->shiftSurface(id);
return;
}
return;
}
MuonGM::RpcReadoutElement* rpc=dynamic_cast<MuonGM::RpcReadoutElement*>(det);
if (rpc) {
rpc->shiftSurface(id);
return;
//________________________________________________________________________
void CombinedMuonAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
MuonGM::MdtReadoutElement* mdt = dynamic_cast<MuonGM::MdtReadoutElement*>(det);
if (mdt) {
mdt->restoreTubes();
return;
}
MuonGM::TgcReadoutElement* tgc = dynamic_cast<MuonGM::TgcReadoutElement*>(det);
if (tgc) {
tgc->restoreSurfaces();
return;
}
MuonGM::RpcReadoutElement* rpc = dynamic_cast<MuonGM::RpcReadoutElement*>(det);
if (rpc) {
rpc->restoreSurfaces();
return;
}
MuonGM::CscReadoutElement* csc = dynamic_cast<MuonGM::CscReadoutElement*>(det);
if (csc) {
csc->restoreSurfaces();
return;
}
*m_log << MSG::ERROR << "det element not MDT, TGC, or RPC!" << endmsg;
return;
}
MuonGM::CscReadoutElement* csc=dynamic_cast<MuonGM::CscReadoutElement*>(det);
if (csc) {
csc->shiftSurface(id);
return;
}
return;
}
//________________________________________________________________________
void CombinedMuonAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const
{
MuonGM::MdtReadoutElement* mdt=dynamic_cast<MuonGM::MdtReadoutElement*>(det);
if (mdt) { mdt->restoreTubes(); return; }
MuonGM::TgcReadoutElement* tgc=dynamic_cast<MuonGM::TgcReadoutElement*>(det);
if (tgc) { tgc->restoreSurfaces(); return; }
MuonGM::RpcReadoutElement* rpc=dynamic_cast<MuonGM::RpcReadoutElement*>(det);
if (rpc) { rpc->restoreSurfaces(); return; }
MuonGM::CscReadoutElement* csc=dynamic_cast<MuonGM::CscReadoutElement*>(det);
if (csc) { csc->restoreSurfaces(); return; }
*m_log<<MSG::ERROR<<"det element not MDT, TGC, or RPC!"<<endmsg;
return;
}
} // namespace
} // namespace Muon
......@@ -2,50 +2,38 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonAlignEvent/CscAlignModule.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonReadoutGeometry/MdtReadoutElement.h"
#include "MuonAlignEvent/CscAlignModule.h"
namespace Muon {
//________________________________________________________________________
CscAlignModule::CscAlignModule(MsgStream* log,
const Amg::Transform3D& transform)
: CombinedMuonAlignModule(log,transform)
, m_rootfile(0)
, m_tubePositionTree(0)
, m_log(new MsgStream(*log))
{
}
//________________________________________________________________________
CscAlignModule::CscAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform)
: CombinedMuonAlignModule(algtool,transform)
, m_rootfile(0)
, m_tubePositionTree(0)
, m_log(new MsgStream(algtool->msgSvc(),"CscAlignModule"))
{
const AthAlgTool* athAlgTool=dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool)
m_log->setLevel(athAlgTool->msg().level());
}
//________________________________________________________________________
CscAlignModule::~CscAlignModule()
{
delete m_log;
}
//________________________________________________________________________
//void CscAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const {
//(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->shiftTube(tubeId);
//}
//________________________________________________________________________
//void CscAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
//(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->restoreTubes();
//}
} // namespace
//________________________________________________________________________
CscAlignModule::CscAlignModule(MsgStream* log, const Amg::Transform3D& transform) :
CombinedMuonAlignModule(log, transform), m_rootfile(0), m_tubePositionTree(0), m_log(new MsgStream(*log)) {}
//________________________________________________________________________
CscAlignModule::CscAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform) :
CombinedMuonAlignModule(algtool, transform),
m_rootfile(0),
m_tubePositionTree(0),
m_log(new MsgStream(algtool->msgSvc(), "CscAlignModule")) {
const AthAlgTool* athAlgTool = dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool) m_log->setLevel(athAlgTool->msg().level());
}
//________________________________________________________________________
CscAlignModule::~CscAlignModule() { delete m_log; }
//________________________________________________________________________
// void CscAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const {
//(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->shiftTube(tubeId);
//}
//________________________________________________________________________
// void CscAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
//(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->restoreTubes();
//}
} // namespace Muon
......@@ -2,52 +2,40 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonAlignEvent/MdtAlignModule.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonReadoutGeometry/MdtReadoutElement.h"
#include "MuonAlignEvent/MdtAlignModule.h"
namespace Muon {
//________________________________________________________________________
MdtAlignModule::MdtAlignModule(MsgStream* log,
const Amg::Transform3D& transform)
: CombinedMuonAlignModule(log,transform)
, m_rootfile(0)
, m_tubePositionTree(0)
, m_log(new MsgStream(*log))
{
}
//________________________________________________________________________
MdtAlignModule::MdtAlignModule(const AlgTool* algtool,
const Amg::Transform3D& transform)
: CombinedMuonAlignModule(algtool,transform)
, m_rootfile(0)
, m_tubePositionTree(0)
, m_log(new MsgStream(algtool->msgSvc(),"MdtAlignModule"))
{
const AthAlgTool* athAlgTool=dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool)
m_log->setLevel(athAlgTool->msg().level());
}
//________________________________________________________________________
MdtAlignModule::~MdtAlignModule()
{
delete m_log;
}
/*
//________________________________________________________________________
void MdtAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const {
(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->shiftTube(tubeId);
}
//________________________________________________________________________
void MdtAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->restoreTubes();
}
*/
} // namespace
//________________________________________________________________________
MdtAlignModule::MdtAlignModule(MsgStream* log, const Amg::Transform3D& transform) :
CombinedMuonAlignModule(log, transform), m_rootfile(0), m_tubePositionTree(0), m_log(new MsgStream(*log)) {}
//________________________________________________________________________
MdtAlignModule::MdtAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform) :
CombinedMuonAlignModule(algtool, transform),
m_rootfile(0),
m_tubePositionTree(0),
m_log(new MsgStream(algtool->msgSvc(), "MdtAlignModule")) {
const AthAlgTool* athAlgTool = dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool) m_log->setLevel(athAlgTool->msg().level());
}
//________________________________________________________________________
MdtAlignModule::~MdtAlignModule() { delete m_log; }
/*
//________________________________________________________________________
void MdtAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier tubeId) const {
(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->shiftTube(tubeId);
}
//________________________________________________________________________
void MdtAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
(dynamic_cast<MuonGM::MdtReadoutElement*>(det))->restoreTubes();
}
*/
} // namespace Muon
......@@ -2,46 +2,34 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonAlignEvent/RpcAlignModule.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "MuonReadoutGeometry/RpcReadoutElement.h"
#include "MuonAlignEvent/RpcAlignModule.h"
namespace Muon {
//________________________________________________________________________
RpcAlignModule::RpcAlignModule( MsgStream* log,
const Amg::Transform3D& transform )
: CombinedMuonAlignModule( log, transform )
, m_log( new MsgStream( *log ) )
{ }
//________________________________________________________________________
RpcAlignModule::RpcAlignModule( const AlgTool* algtool,
const Amg::Transform3D& transform )
: CombinedMuonAlignModule( algtool, transform )
, m_log( new MsgStream( algtool->msgSvc(), "RpcAlignModule" ) )
{
const AthAlgTool* athAlgTool = dynamic_cast <const AthAlgTool*>( algtool );
if ( athAlgTool ) {
m_log->setLevel( athAlgTool->msg().level() );
//________________________________________________________________________
RpcAlignModule::RpcAlignModule(MsgStream* log, const Amg::Transform3D& transform) :
CombinedMuonAlignModule(log, transform), m_log(new MsgStream(*log)) {}
//________________________________________________________________________
RpcAlignModule::RpcAlignModule(const AlgTool* algtool, const Amg::Transform3D& transform) :
CombinedMuonAlignModule(algtool, transform), m_log(new MsgStream(algtool->msgSvc(), "RpcAlignModule")) {
const AthAlgTool* athAlgTool = dynamic_cast<const AthAlgTool*>(algtool);
if (athAlgTool) { m_log->setLevel(athAlgTool->msg().level()); }
}
}
//________________________________________________________________________
RpcAlignModule::~RpcAlignModule()
{
delete m_log;
}
//________________________________________________________________________
//void RpcAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const {
// (dynamic_cast<MuonGM::RpcReadoutElement*>(det))->shiftSurface(id);
//}
//________________________________________________________________________
//void RpcAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
// (dynamic_cast<MuonGM::RpcReadoutElement*>(det))->restoreSurfaces();
// }
}
//________________________________________________________________________
RpcAlignModule::~RpcAlignModule() { delete m_log; }
//________________________________________________________________________
// void RpcAlignModule::shiftSurface(Trk::TrkDetElementBase* det, Identifier id) const {
// (dynamic_cast<MuonGM::RpcReadoutElement*>(det))->shiftSurface(id);
//}
//________________________________________________________________________
// void RpcAlignModule::restoreSurfaces(Trk::TrkDetElementBase* det) const {
// (dynamic_cast<MuonGM::RpcReadoutElement*>(det))->restoreSurfaces();
// }
} // namespace Muon
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