7#include "GaudiKernel/MsgStream.h"
14#include "GaudiKernel/SmartDataPtr.h"
15#include "GaudiKernel/NTuple.h"
16#include "GaudiKernel/INTupleSvc.h"
48 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service(
"ToolSvc")};
57 ATH_MSG_DEBUG(
"got ID helpers from detector store (relying on GeoModel to put them)" );
63return StatusCode::SUCCESS;
70 NTupleFilePtr file1(
ntupleSvc(),
"/NTUPLES/FILE1");
72 NTuplePtr nt(
ntupleSvc(),
"/NTUPLES/FILE1/InitialAlignment");
74 nt =
ntupleSvc()->book(
"/NTUPLES/FILE1/InitialAlignment", CLID_ColumnWiseTuple,
"InitialAlignment");
98 std::map<Identifier, SurveyConstraintModule*, std::less<Identifier> > ModuleMap;
100 std::map<Identifier, SurveyConstraintModule*, std::less<Identifier> >
::iterator it;
101 for (it = ModuleMap.begin(); it != ModuleMap.end(); ++it) {
102 const Identifier& ModuleID = (it->second)->moduleID();
106 barrel_ec =
m_pixid->barrel_ec(ModuleID);
107 layer_disk =
m_pixid->layer_disk(ModuleID);
111 if (
m_sctid->side(ModuleID) != 0)
continue;
113 barrel_ec =
m_sctid->barrel_ec(ModuleID);
114 layer_disk =
m_sctid->layer_disk(ModuleID);
135 sc =
ntupleSvc()->writeRecord(
"NTUPLES/FILE1/InitialAlignment");
136 if (
sc.isFailure()) {
153 double deltachisq = 0;
158 bool NewDisk =
true, NewSector =
true;
159 int previous_disk = -1, previous_sector = -1;
164 if(std::abs(
m_pixid->barrel_ec(Pixel_ModuleID)) == 2){
172 if(previous_disk ==
m_pixid->layer_disk(Pixel_ModuleID) &&
176 if(previous_disk ==
m_pixid->layer_disk(Pixel_ModuleID))
179 if (NewDisk)
for (
unsigned int i=0;i!=6;++i)
m_h_PixEC_Align_Disk[i] -> Fill(multipl*dparams[i]);
181 else for (
unsigned int i=0;i!=6;++i)
m_h_PixEC_Align[i] -> Fill(multipl*dparams[i]);
182 previous_disk =
m_pixid->layer_disk(Pixel_ModuleID);
186 ATH_MSG_DEBUG(
"alignment parameters = (" << dparams[0] <<
"," << dparams[1] <<
"," << dparams[2] <<
"," << dparams[3] <<
"," << dparams[4] <<
"," << dparams[5] <<
")");
188 ATH_MSG_DEBUG(
"DOCA_Vector = (" << DOCA_Vector[0] <<
"," << DOCA_Vector[1] <<
"," << DOCA_Vector[2] <<
"," << DOCA_Vector[3] <<
"," << DOCA_Vector[4] <<
"," << DOCA_Vector[5] <<
")");
189 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,0) <<
"," << DOCA_Matrix(2,0) <<
"," << DOCA_Matrix(3,0) <<
"," << DOCA_Matrix(4,0) <<
"," << DOCA_Matrix(5,0) <<
")");
190 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,1) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,1) <<
"," << DOCA_Matrix(3,1) <<
"," << DOCA_Matrix(4,1) <<
"," << DOCA_Matrix(5,1) <<
")");
191 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,2) <<
"," << DOCA_Matrix(3,2) <<
"," << DOCA_Matrix(4,4) <<
"," << DOCA_Matrix(5,5) <<
")");
200 if(
m_pixid->barrel_ec(Pixel_ModuleID) == 0){
206 ATH_MSG_DEBUG(
"Pixel Barrel ModuleID = " << Pixel_ModuleID);
207 ATH_MSG_DEBUG(
"alignment parameters = (" << dparams[0] <<
"," << dparams[1] <<
"," << dparams[2] <<
"," << dparams[3] <<
"," << dparams[4] <<
"," << dparams[5] <<
")");
209 ATH_MSG_DEBUG(
"DOCA_Vector = (" << DOCA_Vector[0] <<
"," << DOCA_Vector[1] <<
"," << DOCA_Vector[2] <<
"," << DOCA_Vector[3] <<
"," << DOCA_Vector[4] <<
"," << DOCA_Vector[5] <<
")");
210 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,0) <<
"," << DOCA_Matrix(2,0) <<
"," << DOCA_Matrix(3,0) <<
"," << DOCA_Matrix(4,0) <<
"," << DOCA_Matrix(5,0) <<
")");
211 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,1) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,1) <<
"," << DOCA_Matrix(3,1) <<
"," << DOCA_Matrix(4,1) <<
"," << DOCA_Matrix(5,1) <<
")");
212 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,2) <<
"," << DOCA_Matrix(3,2) <<
"," << DOCA_Matrix(4,4) <<
"," << DOCA_Matrix(5,5) <<
")");
221 if(std::abs(
m_sctid->barrel_ec(SCT_ModuleID)) == 2){
228 ATH_MSG_DEBUG(
"alignment parameters = (" << dparams[0] <<
"," << dparams[1] <<
"," << dparams[2] <<
"," << dparams[3] <<
"," << dparams[4] <<
"," << dparams[5] <<
")");
230 ATH_MSG_DEBUG(
"DOCA_Vector = (" << DOCA_Vector[0] <<
"," << DOCA_Vector[1] <<
"," << DOCA_Vector[2] <<
"," << DOCA_Vector[3] <<
"," << DOCA_Vector[4] <<
"," << DOCA_Vector[5] <<
")");
231 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,0) <<
"," << DOCA_Matrix(2,0) <<
"," << DOCA_Matrix(3,0) <<
"," << DOCA_Matrix(4,0) <<
"," << DOCA_Matrix(5,0) <<
")");
232 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,1) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,1) <<
"," << DOCA_Matrix(3,1) <<
"," << DOCA_Matrix(4,1) <<
"," << DOCA_Matrix(5,1) <<
")");
233 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,2) <<
"," << DOCA_Matrix(3,2) <<
"," << DOCA_Matrix(4,4) <<
"," << DOCA_Matrix(5,5) <<
")");
242 if(
m_sctid->barrel_ec(SCT_ModuleID) == 0){
249 ATH_MSG_DEBUG(
"alignment parameters = (" << dparams[0] <<
"," << dparams[1] <<
"," << dparams[2] <<
"," << dparams[3] <<
"," << dparams[4] <<
"," << dparams[5] <<
")");
251 ATH_MSG_DEBUG(
"DOCA_Vector = (" << DOCA_Vector[0] <<
"," << DOCA_Vector[1] <<
"," << DOCA_Vector[2] <<
"," << DOCA_Vector[3] <<
"," << DOCA_Vector[4] <<
"," << DOCA_Vector[5] <<
")");
252 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,0) <<
"," << DOCA_Matrix(2,0) <<
"," << DOCA_Matrix(3,0) <<
"," << DOCA_Matrix(4,0) <<
"," << DOCA_Matrix(5,0) <<
")");
253 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,1) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,1) <<
"," << DOCA_Matrix(3,1) <<
"," << DOCA_Matrix(4,1) <<
"," << DOCA_Matrix(5,1) <<
")");
254 ATH_MSG_DEBUG(
"DOCA_Matrix = (" <<DOCA_Matrix(0,0) <<
"," << DOCA_Matrix(1,1) <<
"," << DOCA_Matrix(2,2) <<
"," << DOCA_Matrix(3,2) <<
"," << DOCA_Matrix(4,4) <<
"," << DOCA_Matrix(5,5) <<
")");
259 return StatusCode::SUCCESS;
270 <<
", mrad = " << CLHEP::mrad
271 <<
", micrometer = " << CLHEP::micrometer
272 <<
", deg = " << CLHEP::deg);
274 return StatusCode::SUCCESS;
281 auto book = [&] (TH1*&
h,
288 h =
new TH1F (name, title, nbins, xlo, xhi);
289 const static std::string prefix =
"/stat/MisAlign/";
290 return histSvc->regHist (prefix + name,
h);
314 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Header file for AthHistogramAlgorithm.
std::vector< Identifier >::const_iterator const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Amg::VectorX DOCA_Vector() const
NTuple::Item< long > m_AlignResults_Identifier_SCT
virtual StatusCode finalize() override
NTuple::Item< double > m_AlignResults_gamma
NTuple::Item< long > m_AlignResults_Identifier_ID
NTuple::Item< double > m_AlignResults_alpha
NTuple::Item< long > m_AlignResults_Identifier_LayerDisc
void CreateMisAlignNtuple()
virtual StatusCode execute() override
ISurveyConstraint * m_SurvConstr
NTuple::Item< long > m_AlignResults_Identifier_Eta
int m_AlignResults_nModules
NTuple::Item< long > m_AlignResults_Identifier_BarrelEC
NTuple::Item< double > m_AlignResults_y
NTuple::Item< double > m_AlignResults_z
NTuple::Item< double > m_AlignResults_beta
TH1 * m_h_PixEC_Align_Disk[6]
TH1 * m_h_PixEC_Align_first[6]
NTuple::Item< long > m_AlignResults_Identifier_Phi
virtual StatusCode initialize() override
SurveyConstraintTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
NTuple::Item< double > m_AlignResults_x
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.