Belle II Software development
MisalignmentCache.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#ifndef VXD_MISALIGNMENT_CACHE_H
10#define VXD_MISALIGNMENT_CACHE_H
11
12#include <vxd/dataobjects/VxdID.h>
13#include <vxd/dataobjects/VXDTrueHit.h>
14#include <unordered_map>
15#include <tuple>
16
17#include <TGeoMatrix.h>
18
19namespace Belle2 {
25 namespace VXD {
30 public:
31
33 typedef std::unordered_map<Belle2::VxdID::baseType, TGeoHMatrix> MisalignmentMap;
35 typedef std::tuple<bool, double, double> MisalignmentShiftType;
36
39
41 void clear() { m_misalignments.clear(); m_isAlive = false; }
42
45 void readMisalignmentsFromXml(const std::string& filename);
46
53 void addMisalignment(Belle2::VxdID sensorID, const TGeoHMatrix& misalignment)
54 {
55 m_misalignments[sensorID] = misalignment;
56 m_isAlive = true;
57 }
58
61
66 const TGeoHMatrix& getMisalignmentTransform(Belle2::VxdID id) const;
67
74
79 { return getInstance().getMisalignmentShift(hit); }
80
83
85 static bool isAlive()
86 { return getInstance().m_isAlive; }
87
88 private:
89
96
98 bool m_isAlive{false};
101 };
102 }
104} //Belle2 namespace
105#endif
Class VXDTrueHit - Records of tracks that either enter or leave the sensitive volume.
Definition: VXDTrueHit.h:36
Class to hold misalignment information.
static bool isAlive()
Return alive status of the cache (are there misalignment data?
static MisalignmentShiftType getMisalignment(const VXDTrueHit *hit)
Return misalignment shift for a VXDTrueHit.
void addMisalignment(Belle2::VxdID sensorID, const TGeoHMatrix &misalignment)
Add a new entry to the list of sensor misalignments.
MisalignmentCache()
Singleton class, hidden constructor.
bool m_isAlive
Is the cache alive?
MisalignmentShiftType getMisalignmentShift(const VXDTrueHit *hit)
Return misalignment shift for a VXDTrueHit.
const MisalignmentMap & getMisalignments() const
Return the list of sensor misalignments.
const TGeoHMatrix & getMisalignmentTransform(Belle2::VxdID id) const
Return the misalignment transform for a given sensor.
MisalignmentCache & operator=(const MisalignmentCache &)=delete
Singleton class, no assignment.
std::tuple< bool, double, double > MisalignmentShiftType
Misalignment shift information contains a validity flag (if false, the misaligned object falls outsid...
MisalignmentMap m_misalignments
Map to hold solid body misalignments for sensors.
std::unordered_map< Belle2::VxdID::baseType, TGeoHMatrix > MisalignmentMap
Hash map type to store existing misalignment transforms.
void clear()
clear cache data
static MisalignmentCache & getInstance()
Return a reference to the singleton instance.
~MisalignmentCache()
destructor to clean up misalignment
MisalignmentCache(const MisalignmentCache &)=delete
Singleton class, no copying.
void readMisalignmentsFromXml(const std::string &filename)
Read misalignment data from an xml file and store sensor misalignments.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.