22#include "CLHEP/Units/SystemOfUnits.h"
26 const std::string &name,
27 const IInterface *parent)
28 : base_class(
type, name, parent)
35 const int numberOfStations = layersInStations.size();
36 std::list<std::vector< std::vector<ROOT::Math::Transform3D> >
::iterator> iterators;
39 for (std::vector< std::vector<ROOT::Math::Transform3D> >* theMatrix : matrices) {
40 theMatrix->resize(numberOfStations);
41 iterators.push_back(theMatrix->begin());
45 for (
const int layersN : layersInStations)
46 for (std::vector< std::vector<ROOT::Math::Transform3D> >
::iterator& matrixIter : iterators)
47 (*(matrixIter++)) = std::vector<ROOT::Math::Transform3D> (layersN);
52 using TransformVec_t = std::vector<std::vector<ROOT::Math::Transform3D>>;
54 std::list<TransformVec_t*> matricesForLayersInit;
62 unsigned int totalLayersN = 0;
64 totalLayersN += layersN;
67 bool useDefualtTransformation =
true;
75 for (ROOT::Math::Transform3D& layerTransform : station) {
76 layerTransform.SetComponents(valueIter, valueIter+12);
82 for (ROOT::Math::Transform3D& layerTransform : station) {
83 layerTransform.SetComponents(valueErrIter, valueErrIter+12);
87 useDefualtTransformation =
false;
90 ATH_MSG_WARNING(
"Incorrect number of elements in transformationErr vector in job options. Should be "<<totalLayersN<<
"x4x3="<<totalLayersN*4*3<<
". Is "<<
m_transformationsErrInit.size()<<
". Will use default transformation.");
93 ATH_MSG_WARNING(
"Incorrect number of elements in transformation vector in job options. Should be "<<totalLayersN<<
"x4x3="<<totalLayersN*4*3<<
". Is "<<
m_transformationsInit.size()<<
". Will use default transformation.");
96 ATH_MSG_INFO(
"In job options m_transformationsInit and m_transformationsErrInit are not defined simultaneously, so default transformations will be used.");
99 if (useDefualtTransformation) {
104 const ROOT::Math::Translation3D translationA0(0, 0, 0.);
109 const ROOT::Math::Translation3D translationC0(0, 0, 0.);
159 int stationCounter(0);
160 ATH_MSG_DEBUG(
"The following transformation matrices will be used");
162 int layersCounter (0);
164 for (
const ROOT::Math::Transform3D& layerTrans : station)
169 ATH_MSG_DEBUG(
"The following transformation matrices for errors will be used");
171 int layersCounter (0);
173 for (
const ROOT::Math::Transform3D& layerTrans : station)
177 return StatusCode::SUCCESS;
181 return StatusCode::SUCCESS;
201 float flipAC = (stationID<2 ? -1. : +1.);
208 const ROOT::Math::RotationZYX locRotation(flipAC*LA.
alpha(), -1.*flipAC*LA.
gamma(), LA.
beta());
209 const ROOT::Math::Translation3D locTranslation(-1.*LA.
yShift(), flipAC*LA.
xShift(), flipAC*LA.
zShift());
210 const ROOT::Math::Translation3D globTranslation(GA.
xShift(), flipAC*GA.
yShift(), GA.
zShift());
212 ROOT::Math::XYZPoint localCS = globTranslation*locTranslation*locRotation*
m_transformations.at(stationID).at(layerID)*horizVertID;
213 ROOT::Math::XYZPoint localCSError = locRotation*
m_transformationsErr.at(stationID).at(layerID)*horizVertIDErr;
215 auto *xAODCluster = xAODContainer->push_back(std::make_unique<xAOD::AFPSiHitsCluster>());
217 fillXAOD (stationID, layerID, localCS, localCSError, xAODCluster);
218 xAODCluster->setDepositedCharge(cluster.
charge());
219 xAODCluster->setNHits(cluster.
hits().size());
221 ATH_MSG_DEBUG(
"Cluster info: station="<<stationID<<
" layer="<<layerID<<
" horizID="<<cluster.
horizID()<<
" vertID="<<cluster.
vertID()<<
"\tcoordinates: x="<<xAODCluster->xLocal()<<
" y="<<xAODCluster->yLocal());
224 ATH_MSG_DEBUG(
"("<<theHit->pixelHorizID()<<
", "<<theHit->pixelVertID()<<
")");
228 catch (
const std::out_of_range& outOfRange) {
229 ATH_MSG_WARNING(
"Transformation matrix for station or pixel ID outside expected range. Aborting transformation to xAOD.");
#define ATH_MSG_WARNING(x)
Class representing basic silicon pixels cluster, designed to be used for creating the clusters.
float vertID() const
vertical position (ID number) of the cluster (float because it can be weighted mean of hits)
float vertIDErr() const
uncertainty of vertical position (ID number) in fraction
float horizIDErr() const
uncertainty of horizontal position (ID number) in fraction
std::list< const xAOD::AFPSiHit * > & hits()
list of pixels used to form the cluster
double charge() const
charge of the cluster
float horizID() const
horizontal position (ID number) of the cluster (float because it can be weighted mean of hits)
Class storing information about alignment.
double beta() const
Rotation angle.
double xShift() const
Shift of the plane in X direction with respect to the nominal position.
double zShift() const
Shift of the plane in Z direction with respect to the nominal position.
double gamma() const
Rotation angle.
double alpha() const
Rotation angle.
double yShift() const
Shift of the plane in Y direction with respect to the nominal position.
void setYLocal(float newYLocal)
Set cluster position along Y axis in station local coordinate system.
void setXLocal(float newXLocal)
Set cluster position along X axis in station local coordinate system.
void setStationID(int stationID)
Set index of the station with pixel hit.
void setZLocal(float newZLocal)
Set cluster position along Z axis in station local coordinate system.
void setYLocalErr(float newYLocalErr)
Set uncertainty of cluster position along Y axis in station local coordinate system.
void setPixelLayerID(int layerID)
Method setting index of the detector layer with the cluster.
void setZLocalErr(float newZLocalErr)
Set uncertainty of cluster position along Z axis in station local coordinate system.
void setXLocalErr(float newXLocalErr)
Set uncertainty of cluster position along X axis in station local coordinate system.
AFPSiHitsCluster_v1 AFPSiHitsCluster
static constexpr double SiT_Plate_rot_xz
static constexpr double SiT_Plate_zsep
static constexpr double SiT_Pixel_amount_x