27 #include "GaudiKernel/ITHistSvc.h"
35 m_layerMaterialName(
"UnspecifiedLayerMaterialMap"),
36 m_validationTree(nullptr),
37 m_validationTreeName(
"LayerMaterialAnalyser"),
38 m_validationTreeDescription(
"LayerMaterialAnalyser information"),
39 m_validationTreeFolder(
"/val/LayerMaterialAnalyser"),
42 m_layerTranslation(nullptr),
43 m_layerRotation(nullptr),
44 m_layerDimension0(0.),
45 m_layerDimension1(0.),
60 declareInterface<Trk::ILayerMaterialAnalyser>(
this);
77 m_layerTranslation =
new std::vector<float>(3, 0.);
78 m_layerRotation =
new std::vector<float>(9, 0.);
93 m_validationTree =
new TTree(m_validationTreeName.c_str(), m_validationTreeDescription.c_str());
96 m_validationTree->Branch(
"LayerIndex", &m_layerIndex );
97 m_validationTree->Branch(
"LayerType", &m_layerType );
98 m_validationTree->Branch(
"LayerTranslation", &m_layerTranslation );
99 m_validationTree->Branch(
"LayerRotation", &m_layerRotation );
100 m_validationTree->Branch(
"LayerDimension0", &m_layerDimension0 );
101 m_validationTree->Branch(
"LayerDimension1", &m_layerDimension1 );
102 m_validationTree->Branch(
"LayerBins", &m_layerBins );
103 m_validationTree->Branch(
"LayerBins0", &m_layerBins0 );
104 m_validationTree->Branch(
"LayerBins1", &m_layerBins1 );
105 m_validationTree->Branch(
"LayerBin0", &m_bin0 );
106 m_validationTree->Branch(
"LayerBin1", &m_bin1 );
107 m_validationTree->Branch(
"LayerBinCounter", &m_binCounter );
108 m_validationTree->Branch(
"LayerThickness", &m_thickness );
109 m_validationTree->Branch(
"LayerX0", &m_X0 );
110 m_validationTree->Branch(
"LayerL0", &m_L0 );
111 m_validationTree->Branch(
"LayerA", &m_A );
112 m_validationTree->Branch(
"LayerZ", &m_Z );
113 m_validationTree->Branch(
"LayerRo", &m_Rho );
114 m_validationTree->Branch(
"LayerElements", &m_elements );
117 SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc")};
119 ATH_MSG_ERROR(
"initialize() Could not find Hist Service -> Switching ValidationMode Off !" );
120 delete m_validationTree; m_validationTree =
nullptr;
121 return StatusCode::SUCCESS;
123 if ((tHistSvc->regTree(m_validationTreeFolder.c_str(), m_validationTree)).isFailure()) {
124 ATH_MSG_ERROR(
"initialize() Could not register the validation Tree -> Switching ValidationMode Off !" );
125 delete m_validationTree; m_validationTree =
nullptr;
126 return StatusCode::SUCCESS;
129 return StatusCode::SUCCESS;
135 delete m_layerTranslation ;
136 delete m_layerRotation ;
146 delete m_binCounter ;
147 return StatusCode::SUCCESS;
157 if (!lMaterial)
return StatusCode::SUCCESS;
159 return analyseLayerMaterial(
layer, *lMaterial);
169 ATH_MSG_DEBUG(
"Recieved BinnedLayerMaterial - analyzing it." );
175 size_t mBins0 = bUtility ? bUtility->
max(0)+1 : 1;
176 size_t mBins1 = bUtility ? bUtility->
max(1)+1 : 1;
179 for (
size_t ibin1 = 0; ibin1 < mBins1; ++ ibin1){
180 for (
size_t ibin0 = 0; ibin0 < mBins0; ++ibin0)
181 mpMatrix[ibin1][ibin0] = lMaterial.
material(ibin0, ibin1);
184 return analyse(
layer, mpMatrix);
190 ATH_MSG_DEBUG(
"Recieved MaterialPropertyMatrix - analyzing it." );
191 return analyse(
layer, mpMatrix);
197 ATH_MSG_DEBUG(
"Recieved LayerMaterialRecord - analyzing it." );
203 const std::vector< std::vector< unsigned int > >* bCounter )
const
207 m_layerIndex =
layer.layerIndex().value();
209 m_layerTranslation->at(0) = lSurface.
center().x();
210 m_layerTranslation->at(1) = lSurface.
center().y();
211 m_layerTranslation->at(2) = lSurface.
center().z();
214 m_layerRotation->at(0) = rMatrix(0,0);
215 m_layerRotation->at(1) = rMatrix(1,0);
216 m_layerRotation->at(2) = rMatrix(2,0);
217 m_layerRotation->at(3) = rMatrix(0,1);
218 m_layerRotation->at(4) = rMatrix(1,1);
219 m_layerRotation->at(5) = rMatrix(2,1);
220 m_layerRotation->at(6) = rMatrix(0,2);
221 m_layerRotation->at(7) = rMatrix(1,2);
222 m_layerRotation->at(8) = rMatrix(2,2);
230 m_layerDimension0 = cb->
r();
238 m_layerDimension0 =
db->rMin();
239 m_layerDimension1 =
db->rMax();
248 for (
const auto & outerIter : mpMatrix){
250 for (
const auto & innerIter : outerIter ){
251 m_bin0->at(m_layerBins) = bin0;
252 m_bin1->at(m_layerBins) =
bin1;
256 m_thickness->at(m_layerBins) = mProperties->
thickness();
257 m_X0->at(m_layerBins) = mProperties->
x0();
258 m_L0->at(m_layerBins) = mProperties->
l0();
259 m_A->at(m_layerBins) = mProperties->
averageA();
260 m_Z->at(m_layerBins) = mProperties->
averageZ();
261 m_Rho->at(m_layerBins) = mProperties->
averageRho();
264 m_thickness->at(m_layerBins) = 0.;
265 m_X0->at(m_layerBins) = 0.;
266 m_L0->at(m_layerBins) = 0.;
267 m_A->at(m_layerBins) = 0.;
268 m_Z->at(m_layerBins) = 0.;
269 m_Rho->at(m_layerBins) = 0.;
270 m_elements->at(m_layerBins) = 0.;
273 m_binCounter->at(m_layerBins) = bCounter ? (*bCounter)[
bin1][bin0] : 1;
276 if (!
bin1) ++m_layerBins0;
282 m_validationTree->Fill();
285 return StatusCode::SUCCESS;