ATLAS Offline Software
SurveyConstraint.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 // Gaudi & StoreGate
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/SmartDataPtr.h"
12 
14 
15 
16 // Geometry Stuff
17 #include "Identifier/Identifier.h"
20 #include "InDetIdentifier/SCT_ID.h"
24 
25 // Alignment DB StuffStuff
27 #include "GaudiKernel/IRndmGenSvc.h"
28 #include "GaudiKernel/RndmGenerators.h"
29 
30 #include <cmath>
31 
32 // use anonymous namespace to be only valid inside this .cxx file
33 namespace {
34  constexpr long double operator"" _degree ( long double deg ){
35  return deg * M_PI / 180;
36  }
37  static constexpr double const& phiModEnd = 26.25;
38 }
39 
41 
43  const std::string& name, const IInterface* parent)
45  m_idHelper{},
46  m_pixid(nullptr),
47  m_sctid(nullptr),
48  m_toolsvc(nullptr),
49  m_current_IDAlignDBTool(nullptr),
50  m_survey_IDAlignDBTool(nullptr),
51  m_randsvc(nullptr),
52  m_SurveyWeightX(1.0),
53  m_SurveyWeightY(1.0),
54  m_SurveyWeightZ(1.0),
55  m_SurveyWeightPhiX(1.0),
56  m_SurveyWeightPhiY(1.0),
57  m_SurveyWeightPhiZ(1.0),
58  m_TransX(0.0),
59  m_TransY(0.0),
60  m_TransZ(0.0),
61  m_RotX(0.0),
62  m_RotX2(0.0),
63  m_RotY(0.0),
64  m_RotZ(0.0),
65  m_TransXRand(0.0046),
66  m_TransYRand(0.0047),
67  m_TransZRand(0.0127),
68  m_RotXRand(0.0003),
69  m_RotYRand(0.0007),
70  m_RotZRand(0.00012),
71  m_TransXRandPixB(0.01),
72  m_TransYRandPixB(0.01),
73  m_TransZRandPixB(0.1),
74  m_RotXRandPixB(0.001),
75  m_RotYRandPixB(0.001),
76  m_RotZRandPixB(0.00024),
77  m_TransXRandSCTEC(0.03),
78  m_TransYRandSCTEC(0.03),
79  m_TransZRandSCTEC(0.03),
80  m_RotXRandSCTEC(0.001),
81  m_RotYRandSCTEC(0.001),
82  m_RotZRandSCTEC(0.0003),
83  m_TransXRandSCTB(0.1),
84  m_TransYRandSCTB(0.1),
85  m_TransZRandSCTB(0.1),
86  m_RotXRandSCTB(0.001),
87  m_RotYRandSCTB(0.001),
88  m_RotZRandSCTB(0.001),
89  m_gaus(false),
90  m_TransXRandSect(0.0),
91  m_TransYRandSect(0.0),
92  m_TransZRandSect(0.0),
93  m_RotXRandSect(0.0),
94  m_RotYRandSect(0.0),
95  m_RotZRandSect(0.0),
96  m_TransLayerRand(-1),
97  m_misaligncase(-1),
98  m_gausSect(false),
99  m_FullDisk(false),
100  m_scaleZ(1.0),
101  m_proximity(999999.),
102  m_aligndbtoolinst("InDetCurrentDBTool"),
103  m_surveydbtoolinst("InDetSurveyDBTool"),
104  m_surveywfile(""),
105  m_surveyrfile(""),
106  m_ntuple(false)
107  {
108  declareInterface<ISurveyConstraint>(this);
109  declareProperty("SurveyWeightX" , m_SurveyWeightX);
110  declareProperty("SurveyWeightY" , m_SurveyWeightY);
111  declareProperty("SurveyWeightZ" , m_SurveyWeightZ);
112  declareProperty("SurveyWeightPhiX" , m_SurveyWeightPhiX);
113  declareProperty("SurveyWeightPhiY" , m_SurveyWeightPhiY);
114  declareProperty("SurveyWeightPhiZ" , m_SurveyWeightPhiZ);
115  declareProperty("TransX" , m_TransX);
116  declareProperty("TransY" , m_TransY);
117  declareProperty("TransZ" , m_TransZ);
118  declareProperty("RotX" , m_RotX);
119  declareProperty("RotX2" , m_RotX2);
120  declareProperty("RotY" , m_RotY);
121  declareProperty("RotZ" , m_RotZ);
122  declareProperty("TransXRand" , m_TransXRand);
123  declareProperty("TransYRand" , m_TransYRand);
124  declareProperty("TransZRand" , m_TransZRand);
125  declareProperty("RotXRand" , m_RotXRand);
126  declareProperty("RotYRand" , m_RotYRand);
127  declareProperty("RotZRand" , m_RotZRand);
128  declareProperty("TransXRandPixB" , m_TransXRandPixB);
129  declareProperty("TransYRandPixB" , m_TransYRandPixB);
130  declareProperty("TransZRandPixB" , m_TransZRandPixB);
131  declareProperty("RotXRandPixB" , m_RotXRandPixB);
132  declareProperty("RotYRandPixB" , m_RotYRandPixB);
133  declareProperty("RotZRandPixB" , m_RotZRandPixB);
134  declareProperty("TransXRandSCTEC" , m_TransXRandSCTEC);
135  declareProperty("TransYRandSCTEC" , m_TransYRandSCTEC);
136  declareProperty("TransZRandSCTEC" , m_TransZRandSCTEC);
137  declareProperty("RotXRandSCTEC" , m_RotXRandSCTEC);
138  declareProperty("RotYRandSCTEC" , m_RotYRandSCTEC);
139  declareProperty("RotZRandSCTEC" , m_RotZRandSCTEC);
140  declareProperty("TransXRandSCTB" , m_TransXRandSCTB);
141  declareProperty("TransYRandSCTB" , m_TransYRandSCTB);
142  declareProperty("TransZRandSCTB" , m_TransZRandSCTB);
143  declareProperty("RotXRandSCTB" , m_RotXRandSCTB);
144  declareProperty("RotYRandSCTB" , m_RotYRandSCTB);
145  declareProperty("RotZRandSCTB" , m_RotZRandSCTB);
146  declareProperty("Gaus" , m_gaus);
147  declareProperty("TransXRandSect" , m_TransXRandSect);
148  declareProperty("TransYRandSect" , m_TransYRandSect);
149  declareProperty("TransZRandSect" , m_TransZRandSect);
150  declareProperty("RotXRandSect" , m_RotXRandSect);
151  declareProperty("RotYRandSect" , m_RotYRandSect);
152  declareProperty("RotZRandSect" , m_RotZRandSect);
153  declareProperty("TransLayerRand" , m_TransLayerRand);
154  declareProperty("Misaligncase" , m_misaligncase);
155  declareProperty("GausSect" , m_gausSect);
156  declareProperty("FullDisk" , m_FullDisk);
157  declareProperty("ScaleZ" , m_scaleZ);
158  declareProperty("Proximity" , m_proximity);
159  declareProperty("CurrentDBToolInst" , m_aligndbtoolinst);
160  declareProperty("SurveyDBToolInst" , m_surveydbtoolinst);
161  declareProperty("SurveyWfile" , m_surveywfile);
162  declareProperty("SurveyRFile" , m_surveyrfile);
163  declareProperty("Ntuple" , m_ntuple);
164 }
165 
167 {
168  // delete m_idHelper;
169 }
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
172 
174 
175  // Part 1: Get the messaging service, print where you are
176  msg(MSG::INFO) << "SurveyConstraint initialize()" << endmsg;
177 
178  // Get The ToolSvc
179  StatusCode sc = service("ToolSvc",m_toolsvc);
180  if (sc.isFailure()) {
181  msg(MSG::FATAL) << "Could not find ToolSvc. Exiting." << endmsg;
182  return sc;
183  }
184  msg(MSG::INFO) << "got ToolSvc" << endmsg;
185 
186  // Get current InDetAlignDataBaseTool from ToolService
187  sc = m_toolsvc->retrieveTool("InDetAlignDBTool",m_aligndbtoolinst,m_current_IDAlignDBTool);
188  if (sc.isFailure()) {
189  msg(MSG::FATAL) <<"Could not find InDetAlignDBTool. Exiting."<<endmsg;
190  return sc;
191  }
192  msg(MSG::INFO) << "got current_IDAlignDBTool" << endmsg;
193  msg(MSG::INFO) << "current_IDAlignDBTool name = " << m_current_IDAlignDBTool->name() << endmsg;
194 
195  // Get survey InDetAlignDataBaseTool from ToolService
196  sc = m_toolsvc->retrieveTool("InDetAlignDBTool",m_surveydbtoolinst,m_survey_IDAlignDBTool);
197  if (sc.isFailure()) {
198  msg(MSG::FATAL) <<"Could not find InDetAlignDBTool. Exiting."<<endmsg;
199  return sc;
200  }
201  msg(MSG::INFO) << "got survey_IDAlignDBTool" << endmsg;
202 
203  //ID Helper
204  sc = detStore()->retrieve(m_idHelper, "AtlasID" );
205  if (sc.isFailure()) {
206  msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endmsg;
207  return StatusCode::SUCCESS;
208  }else{
209  if (msgLvl(MSG::DEBUG)) msg() << "Found AtlasDetectorID" << endmsg;
210  }
211 
212  // get ID helpers from detector store (relying on GeoModel to put them)
213  if ((StatusCode::SUCCESS!=detStore()->retrieve(m_pixid)) ||
214  (StatusCode::SUCCESS!=detStore()->retrieve(m_sctid))) {
215  msg(MSG::FATAL) << "Problem retrieving ID helpers" << endmsg;
216  return StatusCode::FAILURE;
217  }
218  msg(MSG::INFO) << "got ID helpers from detector store (relying on GeoModel to put them)" << endmsg;
219 
220  // ReadCondHandleKeys
223 
224  // random number service
225  if (StatusCode::SUCCESS!=service("RndmGenSvc",m_randsvc,true))
226  msg(MSG::ERROR) << "Cannot find RndmGenSvc" << endmsg;
227 
228  // Protection against singular weight matrix
229  if (m_surveywfile==""){
230  if(m_TransXRand<1.E-7) m_TransXRand=1.E-7;
231  if(m_TransYRand<1.E-7) m_TransYRand=1.E-7;
232  if(m_TransZRand<1.E-7) m_TransZRand=1.E-7;
233  if(m_RotXRand<1.E-7) m_RotXRand=1.E-7;
234  if(m_RotYRand<1.E-7) m_RotYRand=1.E-7;
235  if(m_RotZRand<1.E-7) m_RotZRand=1.E-7;
236  if(m_TransXRandPixB<1.E-7) m_TransXRandPixB=1.E-7;
237  if(m_TransYRandPixB<1.E-7) m_TransYRandPixB=1.E-7;
238  if(m_TransZRandPixB<1.E-7) m_TransZRandPixB=1.E-7;
239  if(m_RotXRandPixB<1.E-7) m_RotXRandPixB=1.E-7;
240  if(m_RotYRandPixB<1.E-7) m_RotYRandPixB=1.E-7;
241  if(m_RotZRandPixB<1.E-7) m_RotZRandPixB=1.E-7;
242  //
243  if(m_TransXRandSCTEC<1.E-7) m_TransXRandSCTEC=1.E-7;
244  if(m_TransYRandSCTEC<1.E-7) m_TransYRandSCTEC=1.E-7;
245  if(m_TransZRandSCTEC<1.E-7) m_TransZRandSCTEC=1.E-7;
246  if(m_RotXRandSCTEC<1.E-7) m_RotXRandSCTEC=1.E-7;
247  if(m_RotYRandSCTEC<1.E-7) m_RotYRandSCTEC=1.E-7;
248  if(m_RotZRandSCTEC<1.E-7) m_RotZRandSCTEC=1.E-7;
249  if(m_TransXRandSCTB<1.E-7) m_TransXRandSCTB=1.E-7;
250  if(m_TransYRandSCTB<1.E-7) m_TransYRandSCTB=1.E-7;
251  if(m_TransZRandSCTB<1.E-7) m_TransZRandSCTB=1.E-7;
252  if(m_RotXRandSCTB<1.E-7) m_RotXRandSCTB=1.E-7;
253  if(m_RotYRandSCTB<1.E-7) m_RotYRandSCTB=1.E-7;
254  if(m_RotZRandSCTB<1.E-7) m_RotZRandSCTB=1.E-7;
255  }
256  msg(MSG::INFO) << "now entering SurveyConstraint::setup_SurveyConstraintModules()" << endmsg;
258  //if (m_surveywfile!="")
259  return StatusCode::SUCCESS;
260  }
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
263 
265 
266  // Part 1: Get the messaging service, print where you are
267  msg(MSG::INFO) << "finalize()" << endmsg;
268 
269  std::map<Identifier, SurveyConstraintModule*, std::less<Identifier> >::iterator it;
270  for (it = m_ModuleMap.begin(); it != m_ModuleMap.end(); ++it) {
271  delete it->second;
272  }
273  m_ModuleMap.clear();
274 
275  return StatusCode::SUCCESS;
276 }
277 
278 
279  void SurveyConstraint::MMap(std::map<Identifier, SurveyConstraintModule*, std::less<Identifier> >& ModuleMap) {
280  ModuleMap = m_ModuleMap;
281  }
282 
283 
285  Amg::VectorX& dparams, // alignment parameters
286  double& deltachisq,
287  Amg::VectorX& DOCA_Vector,
288  Amg::MatrixX& DOCA_Matrix) {
289  AmgVector(6) weightfactor;
290  weightfactor[0] = m_SurveyWeightX;
291  weightfactor[1] = m_SurveyWeightY;
292  weightfactor[2] = m_SurveyWeightZ;
293  weightfactor[3] = m_SurveyWeightPhiX;
294  weightfactor[4] = m_SurveyWeightPhiY;
295  weightfactor[5] = m_SurveyWeightPhiZ;
296 
297 
298  //get the SurveyConstraintModule from the ModuleMap, it knows about the global
299  //Module-SurveyConstraintPoints, and the global Stave-SurveyConstraintPoints
300  SurveyConstraintModule* mut = m_ModuleMap[ModuleID];
301 
302  // which subdetector?
303  bool isPixEC = false, isPixB = false, isSCTEC = false, isSCTB = false;
304  if(mut->isPixel()){
305  if(abs(m_pixid->barrel_ec(ModuleID)) == 2) isPixEC = true;
306  else if(m_pixid->barrel_ec(ModuleID) == 0) isPixB = true;
307  } else {
308  if(abs(m_sctid->barrel_ec(ModuleID)) == 2) isSCTEC = true;
309  else if(m_sctid->barrel_ec(ModuleID) == 0) isSCTB = true;
310  }
311 
312  //Define the transform which minimizes the distance between the set of
313  //point pairs: this effectively defines the transform between the survey
314  //and current alignment of the SOW.
316  Amg::Vector3D stavetrans;
317  Amg::Vector3D staveangles;
318  std::vector< SurveyConstraintPoint > Stavepoints;
319  mut->getPoints(Stavepoints,SurveyConstraintModule::Stave);
320  if (msgLvl(MSG::DEBUG)) msg() << "SurveyConstraint().computeConstraint: Stavepoints.size() " << Stavepoints.size() << endmsg;
321  // transform GlobalToLocal
322  GlobalToLocal(mut,Stavepoints);
323 
324  // scale z coordinate
325  for (unsigned int iPoint(0); iPoint < Stavepoints.size(); ++iPoint ) {
326  Amg::Vector3D survey = Stavepoints[iPoint].survey();
327  if (msgLvl(MSG::DEBUG)) msg() << "Survey Stavepoints before: " << survey.x() << "," << survey.y() << "," << survey.z() << endmsg;
328  SurveyConstraintPoint& Stavepoint = Stavepoints[iPoint];
329  Stavepoint.scaleZ(m_scaleZ);
330  survey = Stavepoints[iPoint].survey();
331  if (msgLvl(MSG::DEBUG)) msg() << " and after: " << survey.x() << "," << survey.y() << "," << survey.z() << endmsg;
332  }
333 
334  if (msgLvl(MSG::DEBUG)) msg() << "SurveyConstraint().computeConstraint: Now fitting the 2 Staves" << endmsg;
335  double stavemin = minimizer.findMinimum(Stavepoints,staveangles,stavetrans);
336 
337 
338 
339 
340  stavetrans[2] = (stavetrans.z()/m_scaleZ);
341  if (msgLvl(MSG::DEBUG)) msg() << "Stavepoints translation and rotations: (" <<
342  stavetrans.x() << "," << stavetrans.y() << "," << stavetrans.z() << "," <<
343  staveangles.x()/m_scaleZ << "," << staveangles.y()/m_scaleZ << "," << staveangles.z() << ")" <<
344  endmsg;
345 
346 
347  if(stavemin < 0.0){
348  msg(MSG::FATAL) << "insufficient Points for Stave Fitting" << endmsg;
349  return StatusCode::FAILURE;
350  }
351 
352  //(***) create the transform from survey to current with these parameters
353  Amg::Translation3D amgstavetrans(stavetrans);
354  Amg::Transform3D staveTransform = amgstavetrans * Amg::RotationMatrix3D::Identity();
355  staveTransform *= Amg::AngleAxis3D(staveangles[2], Amg::Vector3D(0.,0.,1.));
356  staveTransform *= Amg::AngleAxis3D(staveangles[1]/m_scaleZ, Amg::Vector3D(0.,1.,0.));
357  staveTransform *= Amg::AngleAxis3D(staveangles[0]/m_scaleZ, Amg::Vector3D(1.,0.,0.));
358 
359 
360  //now, get the points on the MUT, and move to the MUTs frame
361  //we must get the points from the wafer itself
362  std::vector< SurveyConstraintPoint > Modulepoints;
363  mut->getPoints(Modulepoints,SurveyConstraintModule::Module);
364 
365  // transform GlobalToLocal
366  GlobalToLocal(mut,Modulepoints);
367 
368 
369  //transform ONLY the survey points(survey,-) according to the transform from survey to current from the SOW (***)
370  for(unsigned ipoint=0;ipoint<Modulepoints.size();ipoint++){
371  Amg::Vector3D& survey = Modulepoints[ipoint].survey();
372  survey = staveTransform * survey;
373  }
374 
375  //now compute the final parameters: build the 3D residuals between the two sets of MUT points
376  Amg::Vector3D modtrans;
377  Amg::Vector3D modangles;
378  if (msgLvl(MSG::DEBUG)) msg() << "SurveyConstraint().computeConstraint: Now fitting the 2 Modules" << endmsg;
379  double modmin = minimizer.findMinimum(Modulepoints,modangles,modtrans);
380  if(modmin < 0.0){
381  msg(MSG::FATAL) << "insufficient Points for Module Fitting" << endmsg;
382  return StatusCode::FAILURE;
383  }
384 
385  // fill the dparams vector
386  for(unsigned ipar=0;ipar<3;ipar++)
387  dparams[ipar] = modtrans[ipar];
388  dparams[3] = modangles[0];
389  dparams[4] = modangles[1];
390  dparams[5] = modangles[2];
391 
392  // for this get the errors (weight) on the points (actually independent of MUTid)
394  bool ierr=-1;
395  if(isPixEC) ierr = getWeightPixEC(//ModuleID,
396  weight);
397  else if(isPixB) ierr = getWeightPixB(//ModuleID,
398  weight);
399  else if(isSCTEC) ierr = getWeightSCTEC(//ModuleID,
400  weight);
401  else if(isSCTB) ierr = getWeightSCTB(//ModuleID,
402  weight);
403  if(ierr != 0){
404  msg(MSG::FATAL) << "matrixInvertFail" << endmsg;
405  if(isPixEC) msg(MSG::FATAL) << "for PixEC" << endmsg;
406  else if(isPixB) msg(MSG::FATAL) << "for PixB" << endmsg;
407  else if(isSCTEC) msg(MSG::FATAL) << "for SCTEC" << endmsg;
408  else if(isSCTB) msg(MSG::FATAL) << "for SCTB" << endmsg;
409  return StatusCode::FAILURE;
410  }
411 
412  // and asign additional weightfactor to simulate systematic uncertainties (bowing etc.)
413  // Don't need this: Put systematics already in weight matrix!!!
414 // for(unsigned icol=1;icol<=6;icol++)
415 // for(unsigned irow=1;irow<=icol;irow++)
416 // weight.fast(icol,irow) *= weightfactor(icol)*weightfactor(irow);
417 
418  // now get the chi2, add to the vector and the matrix.
419  Amg::MatrixX temp = dparams.transpose() * weight * dparams;
420  msg(MSG::ERROR) << "Chech that the size of the matrix is a 1,1: " << temp.rows() << ", " << temp.cols() << endmsg;
421  deltachisq = temp(0,0);
422 
423 
424  // the derivatives are trivial, since we're already in the wafers local
425  // coordinate system. The factor of 2 comes from the dfn of chisquared, the
426  // sign from the convention that we measure dparams as current-survey
427  DOCA_Vector = 2.0*weight*dparams; // dchisqdparams
428  DOCA_Matrix = 2.0*weight; // d2chisqdpdp
429 
430  return StatusCode::SUCCESS;
431 }
432 
433 
435 {
436  Rndm::Numbers gauss(m_randsvc,Rndm::Gauss(0.,1.));
437 
438  // read in or write an alignment file for the survey alignment,
439  // either a text file (SurveyText.txt) or an ntuple (reading in and writing out
440  // an ntuple does not work at the moment). For this create a DB
441  // an set DBRoot to "/Indet/SiSurvey"
443  if (m_surveyrfile!=""){
446  }
447 
448  // create some displacements at level 1/2/3, using only one parameter m_TransLayerRand
449  if(m_TransLayerRand > 0){
450  // displace all layers randomly
451  if(m_misaligncase == 0)
453  // displace pixel EC layer 0 in x
454  else if(m_misaligncase == 1)
455  m_survey_IDAlignDBTool->dispGroup(1, 2, 0, -1, -1, m_TransLayerRand, 0, 0, 1, 2, 0);
456  // displace pixel EC layer 2 in x
457  else if(m_misaligncase == 2)
458  m_survey_IDAlignDBTool->dispGroup(1, 2, 2, -1, -1, m_TransLayerRand, 0, 0, 1, 2, 0);
459  }
460 
461  int nSCT(0), nPixel(0);
462  std::vector< Amg::Vector3D > localSurveyCoords;
463  Amg::Transform3D SurveyTransRand, SurveyTransRandSect;
464  SurveyTransRand.setIdentity();
465  SurveyTransRandSect.setIdentity();
466 
467  unsigned int nSCTMod = 0,nSCTModInMap = 0,nSCTModEC = 0,nSCTModPointsEC = 0;
468  // Get SiDetectorElementCollection from ConditionStore for SCT
470  const InDetDD::SiDetectorElementCollection* sctElements(*sctDetEleHandle);
471  if (not sctDetEleHandle.isValid() or sctElements==nullptr) {
472  ATH_MSG_FATAL(m_SCTDetEleCollKey.fullKey() << " is not available.");
473  return;
474  }
475  for (const InDetDD::SiDetectorElement* element: *sctElements) {
476  const Identifier SCT_ModuleID = element->identify();
477  if(m_sctid->side(SCT_ModuleID) != 0) continue;
478  ++nSCTMod;
479 
480  if (m_ModuleMap.find(SCT_ModuleID) == m_ModuleMap.end()) {
481  ++nSCTModInMap;
482  SurveyConstraintModule* newSCT_Module = new SurveyConstraintModule(SCT_ModuleID,false);
483  Amg::Transform3D globaltolocal = element->transform().inverse();
484  newSCT_Module->set_globaltolocal(globaltolocal);
485  m_ModuleMap[SCT_ModuleID] = newSCT_Module;
486  ++nSCT;
487  if (msgLvl(MSG::DEBUG)) msg() << "new SCT Module " << nSCT << endmsg;
488 
489 
490 
491  // Get the nominal local coordinates (which are the same for all wafers, and for survey and current)
492  // add SCT EC SurveyCoords to SurveyConstraintModule
493  if(abs(m_sctid->barrel_ec(SCT_ModuleID)) == 2) getSurveyCoordsSCTEC(//SCT_ModuleID,
494  localSurveyCoords);
495  // add SCT Barrel SurveyCoords to SurveyConstraintModule
496  else if(m_sctid->barrel_ec(SCT_ModuleID) == 0) getSurveyCoordsSCTB(//SCT_ModuleID,
497  localSurveyCoords);
498  // get the survey, current transformations from nominal
499  Amg::Transform3D SurveyTrans = m_survey_IDAlignDBTool->getTrans(SCT_ModuleID,3);
500  Amg::Transform3D CurrentTrans = m_current_IDAlignDBTool->getTrans(SCT_ModuleID,3);
501 
502  if(m_gaus){
503  if(abs(m_sctid->barrel_ec(SCT_ModuleID)) == 2){
504  double m1 = m_TransXRandSCTEC*gauss();
505  double m2 = m_TransYRandSCTEC*gauss();
506  double m3 = m_TransZRandSCTEC*gauss();
507  double m4 = m_RotXRandSCTEC*gauss();
508  double m5 = m_RotYRandSCTEC*gauss();
509  double m6 = m_RotZRandSCTEC*gauss();
510  SurveyTransRand = Amg::Translation3D(m1,m2,m3) * Amg::RotationMatrix3D::Identity()
511  * Amg::AngleAxis3D(m6, Amg::Vector3D(0.,0.,1.))
512  * Amg::AngleAxis3D(m5, Amg::Vector3D(0.,1.,0.))
513  * Amg::AngleAxis3D(m4, Amg::Vector3D(1.,0.,0.));
514  if (m_surveywfile!=""){
515  Amg::VectorX Misalign_Vector(6);
516  Misalign_Vector[0]=m1;Misalign_Vector[1]=m2;Misalign_Vector[2]=m3;Misalign_Vector[3]=m4;Misalign_Vector[4]=m5;Misalign_Vector[5]=m6;
517  newSCT_Module->set_DOCA_Vector(Misalign_Vector);
518  }
519  }
520  else if(m_sctid->barrel_ec(SCT_ModuleID) == 0) {
521  double m1 = m_TransXRandSCTB*gauss();
522  double m2 = m_TransYRandSCTB*gauss();
523  double m3 = m_TransZRandSCTB*gauss();
524  double m4 = m_RotXRandSCTB*gauss();
525  double m5 = m_RotYRandSCTB*gauss();
526  double m6 = m_RotZRandSCTB*gauss();
527  SurveyTransRand = Amg::Translation3D(m1,m2,m3) * Amg::RotationMatrix3D::Identity()
528  * Amg::AngleAxis3D(m6, Amg::Vector3D(0.,0.,1.))
529  * Amg::AngleAxis3D(m5, Amg::Vector3D(0.,1.,0.))
530  * Amg::AngleAxis3D(m4, Amg::Vector3D(1.,0.,0.));
531  if (m_surveywfile!=""){
532  Amg::VectorX Misalign_Vector(6);
533  Misalign_Vector[0]=m1;Misalign_Vector[1]=m2;Misalign_Vector[2]=m3;Misalign_Vector[3]=m4;Misalign_Vector[4]=m5;Misalign_Vector[5]=m6;
534  newSCT_Module->set_DOCA_Vector(Misalign_Vector);
535  }
536  }
537  }
538 
539  // add constraint points to "SurveyConstraintModule newSCT_Module" in global coords
540  for ( unsigned int iCorn(0); iCorn < localSurveyCoords.size(); ++iCorn ) {
541  Amg::Vector3D temp = localSurveyCoords[iCorn];
542  // Transform the local points into the MUT's (survey and current) local coordinate system
543  Amg::Vector3D surveyPoint = (SurveyTrans*SurveyTransRand) * localSurveyCoords[iCorn];
544  if(m_TransLayerRand <= 0) m_survey_IDAlignDBTool->setTrans(SCT_ModuleID,3,SurveyTrans*SurveyTransRand);
545  //m_survey_IDAlignDBTool->tweakTrans(SCT_ModuleID,3,SurveyTransRand);
546  Amg::Vector3D currentPoint = CurrentTrans * temp;
547  // Transform the local (survey and current) constraint points into the global coordinate system
548  Amg::VectorX globalSurveyPoint = element->globalPosition( surveyPoint );
549  Amg::VectorX globalCurrentPoint = element->globalPosition( currentPoint);
550 
551  SurveyConstraintPoint newCPoint( globalSurveyPoint, globalCurrentPoint );
552  newSCT_Module->addModuleConstraintPoint(newCPoint);
553  }
554  }
555  }
556 
557  bool first = true, NewDisk = true, NewSector = true, firstB = true;
558  unsigned int nPixMod = 0,nPixModInMap = 0,nPixModEC = 0,nPixModPointsEC = 0;
559  int previous_disk = -1, previous_sector = -1;
560  // Get SiDetectorElementCollection from ConditionStore for Pixel
562  const InDetDD::SiDetectorElementCollection* pixelElements(*pixelDetEleHandle);
563  if (not pixelDetEleHandle.isValid() or pixelElements==nullptr) {
564  ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available.");
565  return;
566  }
567  for (const InDetDD::SiDetectorElement* element: *pixelElements) {
568  const Identifier Pixel_ModuleID = element->identify();
569  ++nPixMod;
570 
571  if (m_ModuleMap.find(Pixel_ModuleID) == m_ModuleMap.end()) {
572  ++nPixModInMap;
573  SurveyConstraintModule* newPixel_Module = new SurveyConstraintModule(Pixel_ModuleID,true);
574  Amg::Transform3D globaltolocal = element->transform().inverse();
575  newPixel_Module->set_globaltolocal(globaltolocal);
576  m_ModuleMap[Pixel_ModuleID] = newPixel_Module;
577  ++nPixel;
578  if (msgLvl(MSG::DEBUG)) msg() << "new Pixel Module " << nPixel << endmsg;
579 
580  // add Pixel EC SurveyCoords
581  if(abs(m_pixid->barrel_ec(Pixel_ModuleID)) == 2){
582  ++nPixModEC;
583  // Get the nominal local coordinates (which are the same for all wafers, and for survey and current)
584  getSurveyCoordsPixEC(//Pixel_ModuleID,
585  localSurveyCoords);
586  // get the survey, current transformations from nominal
587  Amg::Transform3D SurveyTrans = m_survey_IDAlignDBTool->getTrans(Pixel_ModuleID,3);
588  Amg::Transform3D CurrentTrans = m_current_IDAlignDBTool->getTrans(Pixel_ModuleID,3);
589 
590 
591  // ********************************************
592  // Do some tests for first Pixel EC module
593  if(previous_disk == m_pixid->layer_disk(Pixel_ModuleID) && previous_sector == SectorNumber(m_pixid->phi_module(Pixel_ModuleID)))
594  NewSector=false;
595  else NewSector=true;
596  if(previous_disk == m_pixid->layer_disk(Pixel_ModuleID))
597  NewDisk=false;
598  else NewDisk=true;
599  if (NewSector && (!m_gausSect || NewDisk)){
600  CurrentTrans = CurrentTrans * Amg::Translation3D(m_TransX,m_TransY,m_TransZ)
601  * Amg::AngleAxis3D(m_RotZ, Amg::Vector3D(0.,0.,1.))
602  * Amg::AngleAxis3D(m_RotY, Amg::Vector3D(0.,1.,0.))
604  * Amg::AngleAxis3D(m_RotX2, Amg::Vector3D(1.,0.,0.));
605 
606  }
607 
608  if (m_gaus){
609  double m1 = m_TransXRand*gauss();
610  double m2 = m_TransYRand*gauss();
611  double m3 = m_TransZRand*gauss();
612  double m4 = m_RotXRand*gauss();
613  double m5 = m_RotYRand*gauss();
614  double m6 = m_RotZRand*gauss();
615  SurveyTransRand = Amg::Translation3D(m1,m2,m3) * Amg::RotationMatrix3D::Identity()
616  * Amg::AngleAxis3D(m6, Amg::Vector3D(0.,0.,1.))
617  * Amg::AngleAxis3D(m5, Amg::Vector3D(0.,1.,0.))
618  * Amg::AngleAxis3D(m4, Amg::Vector3D(1.,0.,0.));
619 
620 
621  if (m_surveywfile!=""){
622  Amg::VectorX Misalign_Vector(6);
623  Misalign_Vector[0]=m1;Misalign_Vector[1]=m2;Misalign_Vector[2]=m3;Misalign_Vector[3]=m4;Misalign_Vector[4]=m5;Misalign_Vector[5]=m6;
624  newPixel_Module->set_DOCA_Vector(Misalign_Vector);
625  }
626  }
627  if(m_gausSect && NewSector){
628  double m1 = m_TransXRandSect*gauss();
629  double m2 = m_TransYRandSect*gauss();
630  double m3 = m_TransZRandSect*gauss();
631  double m4 = m_RotXRandSect*gauss();
632  double m5 = m_RotYRandSect*gauss();
633  double m6 = m_RotZRandSect*gauss();
634  SurveyTransRandSect = Amg::Translation3D(m1,m2,m3) * Amg::RotationMatrix3D::Identity()
635  * Amg::AngleAxis3D(m6, Amg::Vector3D(0.,0.,1.))
636  * Amg::AngleAxis3D(m5, Amg::Vector3D(0.,1.,0.))
637  * Amg::AngleAxis3D(m4, Amg::Vector3D(1.,0.,0.));
638 
639  }
640  // ********************************************
641 
642 
643  // add constraint points to "SurveyConstraintModule newPixel_Module" in global coords
644  for ( unsigned int iCorn(0); iCorn < localSurveyCoords.size(); ++iCorn ) {
645  ++nPixModPointsEC;
646  Amg::Vector3D temp = localSurveyCoords[iCorn];
647  // Transform the local points into the MUT's (survey and current) local coordinate system
648  Amg::Vector3D surveyPoint = (SurveyTrans*SurveyTransRand) * localSurveyCoords[iCorn];
649  if(m_TransLayerRand <= 0) m_survey_IDAlignDBTool->setTrans(Pixel_ModuleID,3,SurveyTrans*SurveyTransRand);
650  //m_survey_IDAlignDBTool->tweakTrans(Pixel_ModuleID,3,SurveyTransRand);
651  Amg::Vector3D currentPoint = CurrentTrans *temp;
652  //Amg::Vector3D currentPoint = temp.transform(CurrentTrans);
653  // Transform the local (survey and current) constraint points into the global coordinate system
654  Amg::VectorX globalSurveyPoint = element->globalPosition( surveyPoint);
655  Amg::VectorX globalCurrentPoint = element->globalPosition( currentPoint );
656 
657 
658 
659  // transform globalCurrentPoint according to Sector Transformation SurveyTransRandSect
660  //TransformSector(Pixel_ModuleID,newPixel_Module,globalCurrentPoint,SurveyTransRandSect);
661 
662  SurveyConstraintPoint newCPoint( globalSurveyPoint, globalCurrentPoint );
663  newPixel_Module->addModuleConstraintPoint(newCPoint);
664 
665  // ********************************************
666  // Do some tests for first Pixel EC module
667  if (first){
668  //if(SurveyTrans == CurrentTrans) msg(MSG::INFO) << "SurveyTrans == CurrentTrans" << endmsg;
669  //if(surveyPoint == currentPoint) msg(MSG::INFO) << "surveyPoint == currentPoint" << endmsg;
670  //if(globalSurveyPoint == globalCurrentPoint) msg(MSG::INFO) << "globalSurveyPoint == globalCurrentPoint" << endmsg;
671  msg(MSG::INFO) << "Local Coordinates = (" << localSurveyCoords[iCorn][0] << ","
672  << localSurveyCoords[iCorn][1] << "," << localSurveyCoords[iCorn][2] << ")" << endmsg;
673  msg(MSG::INFO) << "Survey Local Coordinates = (" << surveyPoint[0] << ","
674  << surveyPoint[1] << "," << surveyPoint[2] << ")" << endmsg;
675  msg(MSG::INFO) << "Current Local Coordinates = (" << currentPoint[0] << ","
676  << currentPoint[1] << "," << currentPoint[2] << ")" << endmsg;
677  msg(MSG::INFO) << "Survey Global Coordinates = (" << globalSurveyPoint[0] << ","
678  << globalSurveyPoint[1] << "," << globalSurveyPoint[2] << ")" << endmsg;
679  msg(MSG::INFO) << "Current Global Coordinates = (" << globalCurrentPoint[0] << ","
680  << globalCurrentPoint[1] << "," << globalCurrentPoint[2] << ")" << endmsg;
681  msg(MSG::INFO) << "SurveyConstraint().setup_SurveyConstraintModules: nModulePoints " << m_ModuleMap[Pixel_ModuleID]->nModulePoints() << endmsg;
682  first = false;
683  }
684  // ********************************************
685 
686  }
687  previous_disk = m_pixid->layer_disk(Pixel_ModuleID);
688  previous_sector = SectorNumber(m_pixid->phi_module(Pixel_ModuleID));
689  }
690 
691  // add Pixel Barrel SurveyCoords to SurveyConstraintModule
692  if(m_pixid->barrel_ec(Pixel_ModuleID) == 0){
693  // Get the nominal local coordinates (which are the same for all wafers, and for survey and current)
694  getSurveyCoordsPixB(//Pixel_ModuleID,
695  localSurveyCoords);
696  // get the survey, current transformations from nominal
697  Amg::Transform3D SurveyTrans = m_survey_IDAlignDBTool->getTrans(Pixel_ModuleID,3);
698  Amg::Transform3D CurrentTrans = m_current_IDAlignDBTool->getTrans(Pixel_ModuleID,3);
699 
700  if(m_gaus){
701  double m1 = m_TransXRandPixB*gauss();
702  double m2 = m_TransYRandPixB*gauss();
703  double m3 = m_TransZRandPixB*gauss();
704  double m4 = m_RotXRandPixB*gauss();
705  double m5 = m_RotYRandPixB*gauss();
706  double m6 = m_RotZRandPixB*gauss();
707  SurveyTransRand = Amg::Translation3D(m1,m2,m3) * Amg::RotationMatrix3D::Identity()
708  * Amg::AngleAxis3D(m6, Amg::Vector3D(0.,0.,1.))
709  * Amg::AngleAxis3D(m5, Amg::Vector3D(0.,1.,0.))
710  * Amg::AngleAxis3D(m4, Amg::Vector3D(1.,0.,0.));
711 
712  if (m_surveywfile!=""){
713  Amg::VectorX Misalign_Vector(6);
714  Misalign_Vector[0]=m1;Misalign_Vector[1]=m2;Misalign_Vector[2]=m3;Misalign_Vector[3]=m4;Misalign_Vector[4]=m5;Misalign_Vector[5]=m6;
715  newPixel_Module->set_DOCA_Vector(Misalign_Vector);
716  }
717  }
718 
719  // add constraint points to "SurveyConstraintModule newPixel_Module" in global coords
720  for ( unsigned int iCorn(0); iCorn < localSurveyCoords.size(); ++iCorn ) {
721  Amg::Vector3D temp = localSurveyCoords[iCorn];
722  // Transform the local points into the MUT's (survey and current) local coordinate system
723  Amg::Vector3D surveyPoint = (SurveyTrans*SurveyTransRand) *localSurveyCoords[iCorn] ;
724  if(m_TransLayerRand <= 0) m_survey_IDAlignDBTool->setTrans(Pixel_ModuleID,3,SurveyTrans*SurveyTransRand);
725  //m_survey_IDAlignDBTool->tweakTrans(Pixel_ModuleID,3,SurveyTransRand);
726  Amg::Vector3D currentPoint = CurrentTrans *temp;
727  // Transform the local (survey and current) constraint points into the global coordinate system
728  Amg::VectorX globalSurveyPoint = element->globalPosition( surveyPoint );
729  Amg::VectorX globalCurrentPoint = element->globalPosition( currentPoint );
730 
731  SurveyConstraintPoint newCPoint( globalSurveyPoint, globalCurrentPoint );
732  newPixel_Module->addModuleConstraintPoint(newCPoint);
733  }
734  }
735  }
736  }
737  msg(MSG::INFO) << "nSCTMod " << nSCTMod
738  << ", nSCTModInMap " << nSCTModInMap
739  << ", nSCTModEC " << nSCTModEC
740  << ", nSCTModPointsEC " << nSCTModPointsEC
741  << ", nPixMod " << nPixMod
742  << ", nPixModInMap " << nPixModInMap
743  << ", nPixModEC " << nPixModEC
744  << ", nPixModPointsEC " << nPixModPointsEC
745  << endmsg;
746 
747 
748 
749 
750  // find the set of modules (=stave=modules used to constrain the MUT) associated with this module ID
751  // add the SurveyCoords from this Stave to the MUT (SurveyConstraintModule newPixel_Module),
752  // exclude the points which lie actually on the MUT, to get an unbiased alignment of the two Staves (survey and current)
753  std::vector< SurveyConstraintPoint > Stavepoints;
754  // Pix EC
755  unsigned int nPixModEC2 = 0,nPixModPixModEC = 0,nPixModECPixModEC = 0,nSameLayer = 0,nNotIdentical = 0;
756  for (PixelID::const_id_iterator wafer_it=m_pixid->wafer_begin(); wafer_it!=m_pixid->wafer_end(); ++wafer_it) {
757  const Identifier Pixel_ModuleID = *wafer_it;
758  if(abs(m_pixid->barrel_ec(Pixel_ModuleID)) == 2){
759  ++nPixModEC2;
760  for (PixelID::const_id_iterator wafer_it2=m_pixid->wafer_begin(); wafer_it!=m_pixid->wafer_end(); ++wafer_it) {
761  ++nPixModPixModEC;
762  const Identifier Pixel_ModuleID2 = *wafer_it2;
763  if(m_pixid->barrel_ec(Pixel_ModuleID2) == m_pixid->barrel_ec(Pixel_ModuleID)){
764  ++nPixModECPixModEC;
765  if(m_pixid->layer_disk(Pixel_ModuleID2) == m_pixid->layer_disk(Pixel_ModuleID)){
766  ++nSameLayer;
767  // require Pixel_ModuleID2 and Pixel_ModuleID from same sector OR
768  // m_FullDisk=true which means use all modules from one disk
769  if(m_FullDisk || SectorNumber(m_pixid->phi_module(Pixel_ModuleID2)) == SectorNumber(m_pixid->phi_module(Pixel_ModuleID))){
770  //if(SectorNumber(m_pixid->phi_module(Pixel_ModuleID2)) == SectorNumber(m_pixid->phi_module(Pixel_ModuleID))){
771  if(Pixel_ModuleID != Pixel_ModuleID2){
772  ++nNotIdentical;
773  (m_ModuleMap[Pixel_ModuleID2])->getPoints(Stavepoints,SurveyConstraintModule::Module);
774  (m_ModuleMap[Pixel_ModuleID])->addStaveConstraintPoint(Stavepoints);
775 
776  // ********************************************
777  // Do some tests for first Pixel EC module
778  if (firstB){
779  std::vector< SurveyConstraintPoint > Testpoints;
780  m_ModuleMap[Pixel_ModuleID]->getPoints(Testpoints,SurveyConstraintModule::Stave);
781  msg(MSG::INFO) << "SurveyConstraint().setup_SurveyConstraintModules: Stavepoints.size() (from map) " << Testpoints.size() << endmsg;
782  firstB = false;
783  }
784  // ********************************************
785 
786  }
787  }
788  }
789  }
790  }
791  }
792  }
793  msg(MSG::INFO) << "Loop 2, filling stave-points, nPixModEC2 " << nPixModEC2
794  << ", nPixModPixModEC " << nPixModPixModEC
795  << ", nPixModECPixModEC " << nPixModECPixModEC
796  << ", nSameLayer " << nSameLayer
797  << ", nNotIdentical " << nNotIdentical
798  << endmsg;
799 
800  // Pix B
801  nPixModEC2 = 0;nPixModPixModEC = 0;nPixModECPixModEC = 0;nSameLayer = 0;nNotIdentical = 0;
802  for (PixelID::const_id_iterator wafer_it=m_pixid->wafer_begin(); wafer_it!=m_pixid->wafer_end(); ++wafer_it) {
803  const Identifier Pixel_ModuleID = *wafer_it;
804  if(m_pixid->barrel_ec(Pixel_ModuleID) != 0) continue;
805  ++nPixModEC2;
806  for (PixelID::const_id_iterator wafer_it2=m_pixid->wafer_begin(); wafer_it!=m_pixid->wafer_end(); ++wafer_it) {
807  ++nPixModPixModEC;
808  const Identifier Pixel_ModuleID2 = *wafer_it2;
809  if(m_pixid->barrel_ec(Pixel_ModuleID2) != m_pixid->barrel_ec(Pixel_ModuleID))continue;
810  ++nPixModECPixModEC;
811  if(m_pixid->layer_disk(Pixel_ModuleID2) != m_pixid->layer_disk(Pixel_ModuleID))continue;
812  ++nSameLayer;
813  // require Pixel_ModuleID2 and Pixel_ModuleID from same stave:
814  if(m_pixid->phi_module(Pixel_ModuleID2) != m_pixid->phi_module(Pixel_ModuleID))continue;
815  if(Pixel_ModuleID == Pixel_ModuleID2)continue;
816  ++nNotIdentical;
817  (m_ModuleMap[Pixel_ModuleID2])->getPoints(Stavepoints,SurveyConstraintModule::Module);
818  (m_ModuleMap[Pixel_ModuleID])->addStaveConstraintPoint(Stavepoints);
819  }
820  }
821  msg(MSG::INFO) << "Loop 2, filling stave-points, nPixModB2 " << nPixModEC2
822  << ", nPixModPixModB " << nPixModPixModEC
823  << ", nPixModBPixModB " << nPixModECPixModEC
824  << ", nSameLayer " << nSameLayer
825  << ", nNotIdentical " << nNotIdentical
826  << endmsg;
827 
828  // SCT EC
829  nPixModEC2 = 0;nPixModPixModEC = 0;nPixModECPixModEC = 0;nSameLayer = 0;nNotIdentical = 0;
830  for (SCT_ID::const_id_iterator wafer_it=m_sctid->wafer_begin(); wafer_it!=m_sctid->wafer_end(); ++wafer_it) {
831  const Identifier SCT_ModuleID = *wafer_it;
832  if(m_sctid->side(SCT_ModuleID) != 0) continue;
833  if(abs(m_sctid->barrel_ec(SCT_ModuleID)) != 2) continue;
834  ++nPixModEC2;
835  for (SCT_ID::const_id_iterator wafer_it2=m_sctid->wafer_begin(); wafer_it2!=m_sctid->wafer_end(); ++wafer_it2) {
836  ++nPixModPixModEC;
837  const Identifier SCT_ModuleID2 = *wafer_it2;
838  if(m_sctid->side(SCT_ModuleID2) != 0)continue;
839  if(m_sctid->barrel_ec(SCT_ModuleID2) != m_sctid->barrel_ec(SCT_ModuleID))continue;
840  ++nPixModECPixModEC;
841  if(m_sctid->layer_disk(SCT_ModuleID2) != m_sctid->layer_disk(SCT_ModuleID))continue;
842  ++nSameLayer;
843  //if(m_sctid->eta_module(SCT_ModuleID2) != m_sctid->eta_module(SCT_ModuleID))continue;
844  //if(SectorNumber(m_sctid->phi_module(SCT_ModuleID2)) != SectorNumber(m_sctid->phi_module(SCT_ModuleID)))continue;
845  if(SCT_ModuleID == SCT_ModuleID2)continue;
846  ++nNotIdentical;
847  (m_ModuleMap[SCT_ModuleID2])->getPoints(Stavepoints,SurveyConstraintModule::Module);
848  (m_ModuleMap[SCT_ModuleID])->addStaveConstraintPoint(Stavepoints);
849  }
850 
851  // ********************************************
852  // Do some tests for SCT EC module
853  if (m_sctid->barrel_ec(SCT_ModuleID)==2 &&
854  m_sctid->layer_disk(SCT_ModuleID)==0 &&
855  m_sctid->eta_module(SCT_ModuleID)==0 &&
856  m_sctid->side(SCT_ModuleID) == 0 &&
857  SectorNumber(m_sctid->phi_module(SCT_ModuleID)) == 0
858  ){
859  std::vector< SurveyConstraintPoint > Testpoints;
860  m_ModuleMap[SCT_ModuleID]->getPoints(Testpoints,SurveyConstraintModule::Stave);
861  msg(MSG::INFO) << "SurveyConstraint().setup_SurveyConstraintModules: Stavepoints.size() (from map) " << Testpoints.size() << endmsg;
862  }
863  // ********************************************
864 
865 
866  }
867  msg(MSG::INFO) << "Loop 2, filling stave-points, nSCTModEC2 " << nPixModEC2
868  << ", nSCTModSCTModEC " << nPixModPixModEC
869  << ", nSCTModECSCTModEC " << nPixModECPixModEC
870  << ", nSameLayer " << nSameLayer
871  << ", nNotIdentical " << nNotIdentical
872  << endmsg;
873 
874  // SCT B
875  nPixModEC2 = 0;nPixModPixModEC = 0;nPixModECPixModEC = 0;nSameLayer = 0;nNotIdentical = 0;
876  for (SCT_ID::const_id_iterator wafer_it=m_sctid->wafer_begin(); wafer_it!=m_sctid->wafer_end(); ++wafer_it) {
877  const Identifier SCT_ModuleID = *wafer_it;
878  if(m_sctid->side(SCT_ModuleID) != 0) continue;
879  if(m_sctid->barrel_ec(SCT_ModuleID) != 0) continue;
880  ++nPixModEC2;
881  for (SCT_ID::const_id_iterator wafer_it2=m_sctid->wafer_begin(); wafer_it2!=m_sctid->wafer_end(); ++wafer_it2) {
882  ++nPixModPixModEC;
883  const Identifier SCT_ModuleID2 = *wafer_it2;
884  if(m_sctid->side(SCT_ModuleID2) != 0)continue;
885  if(m_sctid->barrel_ec(SCT_ModuleID2) != m_sctid->barrel_ec(SCT_ModuleID))continue;
886  ++nPixModECPixModEC;
887  if(m_sctid->layer_disk(SCT_ModuleID2) != m_sctid->layer_disk(SCT_ModuleID))continue;
888  ++nSameLayer;
889  // require SCT_ModuleID2 and SCT_ModuleID from same stave:
890  if(m_sctid->phi_module(SCT_ModuleID2) != m_sctid->phi_module(SCT_ModuleID))continue;
891  if(SCT_ModuleID == SCT_ModuleID2)continue;
892  ++nNotIdentical;
893  (m_ModuleMap[SCT_ModuleID2])->getPoints(Stavepoints,SurveyConstraintModule::Module);
894  (m_ModuleMap[SCT_ModuleID])->addStaveConstraintPoint(Stavepoints);
895  }
896  }
897  msg(MSG::INFO) << "Loop 2, filling stave-points, nSCTModB2 " << nPixModEC2
898  << ", nSCTModSCTModB " << nPixModPixModEC
899  << ", nSCTModBSCTModB " << nPixModECPixModEC
900  << ", nSameLayer " << nSameLayer
901  << ", nNotIdentical " << nNotIdentical
902  << endmsg;
903 
904 
905  // write out to Condstream1 and write out ntuple or textfile
906  if (m_surveywfile!=""){
909  if (StatusCode::SUCCESS!=m_survey_IDAlignDBTool->outputObjs())
910  msg(MSG::ERROR) << "Write of AlignableTransforms fails" << endmsg;
911  }
912 }
913 
914 //dumb implementation of weight calculation for PixEC
915 //for now which doesn't care about wafer id
916 int SurveyConstraint::getWeightPixEC(//const Identifier& ModuleID,
917  Amg::MatrixX& weight) {
918 
919  AmgSymMatrix(6) covar;
920  // in local coords, set errors to be diagonal, with values provided by Gil and Ron
921  covar(0,0) = m_TransXRand*m_TransXRand;
922  covar(1,1) = m_TransYRand*m_TransYRand;
923  covar(2,2) = m_TransZRand*m_TransZRand;
924  covar(3,3) = m_RotXRand*m_RotXRand;
925  covar(4,4) = m_RotYRand*m_RotYRand;
926  covar(5,5) = m_RotZRand*m_RotZRand;
927  // invert
928  weight = covar.inverse();
929  return 0;
930 }
931 
932 //dumb implementation of weight calculation for PixB
933 //for now which doesn't care about wafer id
934 int SurveyConstraint::getWeightPixB(//const Identifier& ModuleID,
935  Amg::MatrixX& weight) {
936 
937  AmgSymMatrix(6) covar;
938  // in local coords, set errors to be diagonal, with values to be provided by Vadim
939  covar(0,0) = m_TransXRandPixB*m_TransXRandPixB;
940  covar(1,1) = m_TransYRandPixB*m_TransYRandPixB;
941  covar(2,2) = m_TransZRandPixB*m_TransZRandPixB;
942  covar(3,3) = m_RotXRandPixB*m_RotXRandPixB;
943  covar(4,4) = m_RotYRandPixB*m_RotYRandPixB;
944  covar(5,5) = m_RotZRandPixB*m_RotZRandPixB;
945  // invert
946  weight = covar.inverse();
947  return 0;
948 }
949 
950 //dumb implementation of weight calculation for SCTEC
951 //for now which doesn't care about wafer id
952 int SurveyConstraint::getWeightSCTEC(//const Identifier& ModuleID,
953  Amg::MatrixX& weight) {
954 
955  AmgSymMatrix(6) covar;
956  // in local coords, set errors to be diagonal, with values to be provided by Steve Snow
960  covar(3,3) = m_RotXRandSCTEC*m_RotXRandSCTEC;
961  covar(4,4) = m_RotYRandSCTEC*m_RotYRandSCTEC;
962  covar(5,5) = m_RotZRandSCTEC*m_RotZRandSCTEC;
963  // invert
964  weight = covar.inverse();
965  return 0;
966 }
967 
968 //dumb implementation of weight calculation for SCTB
969 //for now which doesn't care about wafer id
970 int SurveyConstraint::getWeightSCTB(//const Identifier& ModuleID,
971  Amg::MatrixX& weight) {
972 
973  AmgSymMatrix(6) covar;
974 
975  // in local coords, set errors to be diagonal, with values to be provided by Stephen Gibson
976  covar(0,0) = m_TransXRandSCTB*m_TransXRandSCTB;
977  covar(1,1) = m_TransYRandSCTB*m_TransYRandSCTB;
978  covar(2,2) = m_TransZRandSCTB*m_TransZRandSCTB;
979  covar(3,3) = m_RotXRandSCTB*m_RotXRandSCTB;
980  covar(4,4) = m_RotYRandSCTB*m_RotYRandSCTB;
981  covar(5,5) = m_RotZRandSCTB*m_RotZRandSCTB;
982  // invert
983  weight = covar.inverse();
984  return 0;
985 }
986 
987 //stupid implementation of Pixel EC survey coordinates
988 void SurveyConstraint::getSurveyCoordsPixEC(//const Identifier& ModuleID,
989  std::vector< Amg::Vector3D > & coords) {
990  coords.clear();
991  const double SurveyTargetX = 17.8/2.0;
992  const double SurveyTargetY = 59.8/2.0;
993  // 4 points
994  coords.emplace_back(-SurveyTargetX,-SurveyTargetY,0.0);
995  coords.emplace_back(-SurveyTargetX, SurveyTargetY,0.0);
996  coords.emplace_back( SurveyTargetX,-SurveyTargetY,0.0);
997  coords.emplace_back( SurveyTargetX, SurveyTargetY,0.0);
998 }
999 
1000 //stupid implementation of Pixel barrel survey coordinates
1001 void SurveyConstraint::getSurveyCoordsPixB(//const Identifier& ModuleID,
1002  std::vector< Amg::Vector3D > & coords) {
1003  coords.clear();
1004  const double SurveyTargetX = 17.8/2.0;
1005  const double SurveyTargetY = 59.8/2.0;
1006  // 4 points
1007  coords.emplace_back(-SurveyTargetX,-SurveyTargetY,0.0);
1008  coords.emplace_back(-SurveyTargetX, SurveyTargetY,0.0);
1009  coords.emplace_back( SurveyTargetX,-SurveyTargetY,0.0);
1010  coords.emplace_back( SurveyTargetX, SurveyTargetY,0.0);
1011 }
1012 
1013 //stupid implementation of SCT EC survey coordinates
1014 void SurveyConstraint::getSurveyCoordsSCTEC(//const Identifier& ModuleID,
1015  std::vector< Amg::Vector3D > & coords) {
1016  coords.clear();
1017  const double SurveyTargetX = 63.6/2.0;
1018  const double SurveyTargetY = 128.2/2.0;
1019  // 4 points
1020  coords.emplace_back(-SurveyTargetX,-SurveyTargetY,0.0);
1021  coords.emplace_back(-SurveyTargetX, SurveyTargetY,0.0);
1022  coords.emplace_back( SurveyTargetX,-SurveyTargetY,0.0);
1023  coords.emplace_back( SurveyTargetX, SurveyTargetY,0.0);
1024 }
1025 
1026 //stupid implementation of SCT barrel survey coordinates
1027 void SurveyConstraint::getSurveyCoordsSCTB(//const Identifier& ModuleID,
1028  std::vector< Amg::Vector3D > & coords) {
1029  coords.clear();
1030  const double SurveyTargetX = 63.6/2.0;
1031  const double SurveyTargetY = 128.2/2.0;
1032  // 4 points
1033  coords.emplace_back(-SurveyTargetX,-SurveyTargetY,0.0);
1034  coords.emplace_back(-SurveyTargetX, SurveyTargetY,0.0);
1035  coords.emplace_back( SurveyTargetX,-SurveyTargetY,0.0);
1036  coords.emplace_back( SurveyTargetX, SurveyTargetY,0.0);
1037 }
1038 
1039 
1041  std::vector<SurveyConstraintPoint>& points) {
1042  // get global to wut's local transformation
1043  Amg::Transform3D globaltolocal = mut->get_globaltolocal();
1044  // Transform the points into the wut's coordinate system
1045  for(unsigned ipoint=0;ipoint<points.size();ipoint++){
1046  Amg::Vector3D& survey = points[ipoint].survey();
1047  Amg::Vector3D& current = points[ipoint].current();
1048  survey =globaltolocal *survey;
1049  current=globaltolocal * current;
1050  }
1051 }
1052 
1053 
1057  Amg::Transform3D SurveyTransRandSect) {
1058  // get rotation angle phi (in global coordinates) to go from module to sector
1059  // coordinate frame
1060  double phi = PhiModuleToSector(m_pixid->phi_module(Pixel_ModuleID));
1061  // transform current point from module to sector coordinate frame
1063  // get global to module's (which is now sector's) local transformation
1064  Amg::Transform3D globaltolocal = mut->get_globaltolocal();
1065  // Transform the points into the sector's local coordinate system
1066  current = globaltolocal * current;
1067  // do the actual sector transformation
1068  current = SurveyTransRandSect * current ;
1069  // go back to global
1070  Amg::Transform3D localtoglobal = globaltolocal.inverse();
1071  current = localtoglobal * current ;
1072  // transform current point back from sector to module coordinate frame
1073  current = Amg::AngleAxis3D(-phi, Amg::Vector3D(0.,0.,1.)) * current ;
1074 }
1075 
1076 
1077 int SurveyConstraint::SectorNumber(int phi_module) {
1078  if(phi_module >= 0 && phi_module <= 5) return 0;
1079  if(phi_module >= 6 && phi_module <= 11) return 1;
1080  if(phi_module >= 12 && phi_module <= 17) return 2;
1081  if(phi_module >= 18 && phi_module <= 23) return 3;
1082  if(phi_module >= 24 && phi_module <= 29) return 4;
1083  if(phi_module >= 30 && phi_module <= 35) return 5;
1084  if(phi_module >= 36 && phi_module <= 41) return 6;
1085  if(phi_module >= 42 && phi_module <= 47) return 7;
1086  return -1;
1087 }
1088 
1089 
1090 double SurveyConstraint::PhiModuleToSector(int phi_module) {
1091  int phiMod6 = phi_module%6;
1092  if(phiMod6 == 0) return ( 7.5 - phiModEnd) * 1.0_degree;
1093  else if(phiMod6 == 1) return (15 - phiModEnd) * 1.0_degree;
1094  else if(phiMod6 == 2) return (22.5 - phiModEnd) * 1.0_degree;
1095  else if(phiMod6 == 3) return (30 - phiModEnd) * 1.0_degree;
1096  else if(phiMod6 == 4) return (37.5 - phiModEnd) * 1.0_degree;
1097  else if(phiMod6 == 5) return (45 - phiModEnd) * 1.0_degree;
1098  else return -1;
1099 }
1100 
1101  //__________________________________________________________________________
1103 
SurveyConstraint::m_TransXRandSCTB
double m_TransXRandSCTB
Weight & rand Translation in X of current SCTB modules.
Definition: SurveyConstraint.h:114
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
SurveyConstraint::SectorNumber
virtual int SectorNumber(int phi_module)
Definition: SurveyConstraint.cxx:1077
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
SurveyConstraint::getSurveyCoordsSCTB
virtual void getSurveyCoordsSCTB(std::vector< Amg::Vector3D > &coords)
Definition: SurveyConstraint.cxx:1027
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
SurveyConstraint::finalize
virtual StatusCode finalize()
Definition: SurveyConstraint.cxx:264
IInDetAlignDBTool::getTrans
virtual Amg::Transform3D getTrans(const Identifier &, const int) const =0
SurveyConstraintModule::isPixel
bool isPixel()
Definition: SurveyConstraintModule.h:83
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SurveyConstraint::m_ModuleMap
std::map< Identifier, SurveyConstraintModule *, std::less< Identifier > > m_ModuleMap
Map of Wafer objects.
Definition: SurveyConstraint.h:79
PixelID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: PixelID.h:72
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:32
SurveyConstraint::m_RotYRandSCTEC
double m_RotYRandSCTEC
Weight & rand Rotation in Y of current SCTEC modules.
Definition: SurveyConstraint.h:112
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
SurveyConstraint::m_RotXRand
double m_RotXRand
Weight & rand Rotation in X of current PixEC modules.
Definition: SurveyConstraint.h:99
SurveyConstraint::m_SurveyWeightPhiX
double m_SurveyWeightPhiX
""
Definition: SurveyConstraint.h:86
PixelID::wafer_end
const_id_iterator wafer_end(void) const
Definition: PixelID.cxx:925
SurveyConstraint::m_RotXRandSect
double m_RotXRandSect
rand Rotation in X of current PixEC sectors
Definition: SurveyConstraint.h:124
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SurveyConstraint::m_scaleZ
double m_scaleZ
scale Z coordinate to match sensitivity
Definition: SurveyConstraint.h:131
SurveyConstraint::m_ntuple
bool m_ntuple
Definition: SurveyConstraint.h:137
SurveyConstraint::m_idHelper
const AtlasDetectorID * m_idHelper
Definition: SurveyConstraint.h:65
SurveyConstraintModule::get_globaltolocal
Amg::Transform3D get_globaltolocal()
Definition: SurveyConstraintModule.h:87
SurveyConstraint::m_FullDisk
bool m_FullDisk
use Full Disk
Definition: SurveyConstraint.h:130
SurveyConstraint::getWeightSCTEC
virtual int getWeightSCTEC(Amg::MatrixX &weight)
Definition: SurveyConstraint.cxx:952
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
SimpleConstraintPointMinimizer
Definition: SimpleConstraintPointMinimizer.h:20
SurveyConstraint::m_TransYRandSCTB
double m_TransYRandSCTB
Weight & rand Translation in Y of current SCTB modules.
Definition: SurveyConstraint.h:115
SimpleConstraintPointMinimizer.h
SurveyConstraint::m_RotZRandSCTB
double m_RotZRandSCTB
Weight & rand Rotation in Z of current SCTB modules
Definition: SurveyConstraint.h:119
SurveyConstraint::~SurveyConstraint
virtual ~SurveyConstraint()
Definition: SurveyConstraint.cxx:166
SurveyConstraint::m_pixid
const PixelID * m_pixid
Definition: SurveyConstraint.h:66
skel.it
it
Definition: skel.GENtoEVGEN.py:423
SurveyConstraint::getWeightSCTB
virtual int getWeightSCTB(Amg::MatrixX &weight)
Definition: SurveyConstraint.cxx:970
PlotCalibFromCool.modmin
modmin
Definition: PlotCalibFromCool.py:82
PixelID::wafer_begin
const_id_iterator wafer_begin(void) const
Iterators over full set of ids. Wafer iterator is sorted.
Definition: PixelID.cxx:921
SCT_ID::wafer_begin
const_id_iterator wafer_begin(void) const
Iterators over full set of ids. Wafer iterator is sorted.
Definition: SCT_ID.cxx:648
SurveyConstraint::m_TransYRand
double m_TransYRand
Weight & rand Translation in Y of current PixEC modules.
Definition: SurveyConstraint.h:97
M_PI
#define M_PI
Definition: ActiveFraction.h:11
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:205
SurveyConstraintPoint::scaleZ
void scaleZ(float scale)
Definition: SurveyConstraintPoint.h:75
deg
#define deg
Definition: SbPolyhedron.cxx:17
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
SurveyConstraint::SurveyConstraint
SurveyConstraint(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SurveyConstraint.cxx:42
IIOVRegistrationSvc.h
This is an interface to a tool used to register conditions objects in the Interval of Validity (IOV) ...
SurveyConstraint::getWeightPixEC
virtual int getWeightPixEC(Amg::MatrixX &weight)
Definition: SurveyConstraint.cxx:916
SCT_ID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: SCT_ID.h:73
SurveyConstraint::m_survey_IDAlignDBTool
IInDetAlignDBTool * m_survey_IDAlignDBTool
Definition: SurveyConstraint.h:72
SurveyConstraint::m_gausSect
bool m_gausSect
use random (Gaus) rotations and translations for sectors
Definition: SurveyConstraint.h:129
SurveyConstraint::m_TransYRandPixB
double m_TransYRandPixB
Weight & rand Translation in Y of current PixB modules.
Definition: SurveyConstraint.h:103
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
SurveyConstraint::m_SurveyWeightX
double m_SurveyWeightX
Multiplicative weight, representing systematic unc.
Definition: SurveyConstraint.h:82
SurveyConstraint::m_RotZRand
double m_RotZRand
Weight & rand Rotation in Z of current PixEC modules
Definition: SurveyConstraint.h:101
SurveyConstraint::m_SurveyWeightY
double m_SurveyWeightY
""
Definition: SurveyConstraint.h:84
SurveyConstraint::m_TransX
double m_TransX
Translation in X of the first current PixEC module.
Definition: SurveyConstraint.h:89
SurveyConstraint::getSurveyCoordsPixB
virtual void getSurveyCoordsPixB(std::vector< Amg::Vector3D > &coords)
Definition: SurveyConstraint.cxx:1001
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:52
SurveyConstraint::m_aligndbtoolinst
std::string m_aligndbtoolinst
Definition: SurveyConstraint.h:133
IInDetAlignDBTool::readTextFile
virtual void readTextFile(const std::string &) const =0
SurveyConstraint::m_gaus
bool m_gaus
use random (Gaus) rotations and translations
Definition: SurveyConstraint.h:120
ReadCondHandle.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SurveyConstraintModule::set_globaltolocal
void set_globaltolocal(Amg::Transform3D &globaltolocal)
Definition: SurveyConstraintModule.cxx:123
SurveyConstraint::m_surveywfile
std::string m_surveywfile
Definition: SurveyConstraint.h:135
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
SurveyConstraint::m_sctid
const SCT_ID * m_sctid
Definition: SurveyConstraint.h:67
IAthenaOutputStreamTool.h
Interface to an output stream tool.
SurveyConstraint::m_TransY
double m_TransY
Translation in Y of the first current PixEC module.
Definition: SurveyConstraint.h:90
SurveyConstraintModule::addModuleConstraintPoint
void addModuleConstraintPoint(const SurveyConstraintPoint &cPoint)
Definition: SurveyConstraintModule.cxx:118
SurveyConstraintModule::getPoints
void getPoints(std::vector< SurveyConstraintPoint > &, ModuleStatus mstat) const
Definition: SurveyConstraintModule.cxx:92
SurveyConstraint::m_SurveyWeightZ
double m_SurveyWeightZ
""
Definition: SurveyConstraint.h:85
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IInDetAlignDBTool::outputObjs
virtual StatusCode outputObjs()=0
SurveyConstraint::m_RotXRandPixB
double m_RotXRandPixB
Weight & rand Rotation in X of current PixB modules.
Definition: SurveyConstraint.h:105
SurveyConstraint::m_surveydbtoolinst
std::string m_surveydbtoolinst
Definition: SurveyConstraint.h:134
SurveyConstraint::m_TransZRandSect
double m_TransZRandSect
rand Translation in Z of current PixEC sectors
Definition: SurveyConstraint.h:123
SurveyConstraint::PhiModuleToSector
virtual double PhiModuleToSector(int phi_module)
Definition: SurveyConstraint.cxx:1090
python.changerun.m1
m1
Definition: changerun.py:32
SurveyConstraint::getSurveyCoordsSCTEC
virtual void getSurveyCoordsSCTEC(std::vector< Amg::Vector3D > &coords)
Definition: SurveyConstraint.cxx:1014
SurveyConstraint::m_RotYRand
double m_RotYRand
Weight & rand Rotation in Y of current PixEC modules.
Definition: SurveyConstraint.h:100
SurveyConstraint::m_RotZRandSCTEC
double m_RotZRandSCTEC
Weight & rand Rotation in Z of current SCTEC modules
Definition: SurveyConstraint.h:113
SurveyConstraint::m_TransXRandSect
double m_TransXRandSect
rand Translation in X of current PixEC sectors
Definition: SurveyConstraint.h:121
SurveyConstraint::GlobalToLocal
virtual void GlobalToLocal(SurveyConstraintModule *mut, std::vector< SurveyConstraintPoint > &points)
Definition: SurveyConstraint.cxx:1040
SurveyConstraint::getWeightPixB
virtual int getWeightPixB(Amg::MatrixX &weight)
Definition: SurveyConstraint.cxx:934
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AlignableTransformContainer.h
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
IInDetAlignDBTool::readNtuple
virtual void readNtuple(const std::string &) const =0
SurveyConstraint::m_surveyrfile
std::string m_surveyrfile
Definition: SurveyConstraint.h:136
SurveyConstraint::m_TransXRand
double m_TransXRand
Weight & rand Translation in X of current PixEC modules.
Definition: SurveyConstraint.h:96
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SurveyConstraint::m_RotYRandPixB
double m_RotYRandPixB
Weight & rand Rotation in Y of current PixB modules.
Definition: SurveyConstraint.h:106
SurveyConstraintModule::Module
@ Module
Definition: SurveyConstraintModule.h:27
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SurveyConstraint::m_TransZ
double m_TransZ
Translation in Z of the first current PixEC module.
Definition: SurveyConstraint.h:91
SurveyConstraint::m_SurveyWeightPhiY
double m_SurveyWeightPhiY
""
Definition: SurveyConstraint.h:87
SurveyConstraint::m_proximity
double m_proximity
Proximity of Survey points used for alignment of SOW.
Definition: SurveyConstraint.h:132
SurveyConstraint::m_TransXRandPixB
double m_TransXRandPixB
Weight & rand Translation in X of current PixB modules.
Definition: SurveyConstraint.h:102
SurveyConstraint::TransformSector
virtual void TransformSector(Identifier Pixel_ModuleID, SurveyConstraintModule *mut, Amg::Vector3D &current, Amg::Transform3D CurrentTransRandSect)
Definition: SurveyConstraint.cxx:1054
IInDetAlignDBTool::createDB
virtual void createDB() const =0
IInDetAlignDBTool.h
SurveyConstraint::m_TransZRandSCTEC
double m_TransZRandSCTEC
Weight & rand Translation in Z of current SCTEC modules.
Definition: SurveyConstraint.h:110
SurveyConstraint::m_current_IDAlignDBTool
IInDetAlignDBTool * m_current_IDAlignDBTool
Definition: SurveyConstraint.h:71
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
SurveyConstraint::getSurveyCoordsPixEC
virtual void getSurveyCoordsPixEC(std::vector< Amg::Vector3D > &coords)
Definition: SurveyConstraint.cxx:988
SurveyConstraint::m_RotZRandSect
double m_RotZRandSect
rand Rotation in Z of current PixEC sectors
Definition: SurveyConstraint.h:126
SurveyConstraint::MMap
virtual void MMap(std::map< Identifier, SurveyConstraintModule *, std::less< Identifier > > &ModuleMap)
Definition: SurveyConstraint.cxx:279
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
SurveyConstraint::m_randsvc
IRndmGenSvc * m_randsvc
Definition: SurveyConstraint.h:73
SurveyConstraint::setup_SurveyConstraintModules
virtual void setup_SurveyConstraintModules()
Definition: SurveyConstraint.cxx:434
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
IInDetAlignDBTool::dispGroup
virtual void dispGroup(const int, const int, const int, const int, const int, const float, const float, const float, const int, const int, const int) const =0
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SurveyConstraint::m_RotYRandSect
double m_RotYRandSect
rand Rotation in Y of current PixEC sectors
Definition: SurveyConstraint.h:125
SurveyConstraint::m_misaligncase
int m_misaligncase
misaligncase
Definition: SurveyConstraint.h:128
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
SiDetectorElement.h
SurveyConstraint::m_toolsvc
IToolSvc * m_toolsvc
Pointer to tool service.
Definition: SurveyConstraint.h:70
SurveyConstraint::m_RotZRandPixB
double m_RotZRandPixB
Weight & rand Rotation in Z of current PixB modules
Definition: SurveyConstraint.h:107
SurveyConstraint::m_TransZRandPixB
double m_TransZRandPixB
Weight & rand Translation in Z of current PixB modules.
Definition: SurveyConstraint.h:104
SurveyConstraint::initialize
virtual StatusCode initialize()
Definition: SurveyConstraint.cxx:173
IInDetAlignDBTool::writeFile
virtual void writeFile(const bool, const std::string &) const =0
SurveyConstraintPoint
Definition: SurveyConstraintPoint.h:25
SurveyConstraint::m_RotYRandSCTB
double m_RotYRandSCTB
Weight & rand Rotation in Y of current SCTB modules.
Definition: SurveyConstraint.h:118
SurveyConstraint::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: SurveyConstraint.h:75
python.SystemOfUnits.gauss
int gauss
Definition: SystemOfUnits.py:230
SurveyConstraintModule::set_DOCA_Vector
void set_DOCA_Vector(Amg::VectorX &DOCA_Vector)
Definition: SurveyConstraintModule.cxx:126
SurveyConstraint::m_TransZRandSCTB
double m_TransZRandSCTB
Weight & rand Translation in Z of current SCTB modules.
Definition: SurveyConstraint.h:116
SimpleConstraintPointMinimizer::findMinimum
double findMinimum(const std::vector< SurveyConstraintPoint > &points, Amg::Vector3D &aRotat, Amg::Vector3D &translate)
Definition: SimpleConstraintPointMinimizer.cxx:27
SurveyConstraint::m_TransZRand
double m_TransZRand
Weight & rand Translation in Z of current PixEC modules.
Definition: SurveyConstraint.h:98
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SurveyConstraint::m_TransXRandSCTEC
double m_TransXRandSCTEC
Weight & rand Translation in X of current SCTEC modules.
Definition: SurveyConstraint.h:108
DeMoScan.first
bool first
Definition: DeMoScan.py:534
SurveyConstraint::m_RotX
double m_RotX
Rotation in X of the first current PixEC module.
Definition: SurveyConstraint.h:92
SurveyConstraint::m_TransYRandSect
double m_TransYRandSect
rand Translation in Y of current PixEC sectors
Definition: SurveyConstraint.h:122
DEBUG
#define DEBUG
Definition: page_access.h:11
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SurveyConstraint::computeConstraint
virtual StatusCode computeConstraint(const Identifier &ModuleID, Amg::VectorX &dparams, double &deltachisq, Amg::VectorX &dchisqdparams, Amg::MatrixX &d2chisqdpdp)
Pure virtual.
Definition: SurveyConstraint.cxx:284
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
SurveyConstraint::m_RotXRandSCTEC
double m_RotXRandSCTEC
Weight & rand Rotation in X of current SCTEC modules.
Definition: SurveyConstraint.h:111
SCT_ID::wafer_end
const_id_iterator wafer_end(void) const
Definition: SCT_ID.cxx:652
Amg::AngleAxis3D
Eigen::AngleAxisd AngleAxis3D
Definition: GeoPrimitives.h:45
SurveyConstraint.h
SurveyConstraint::m_RotX2
double m_RotX2
Rotation in X (after Y & Z) of the first current PixEC module.
Definition: SurveyConstraint.h:93
SurveyConstraint::m_RotZ
double m_RotZ
Rotation in Z of the first current PixEC module.
Definition: SurveyConstraint.h:95
AthAlgTool
Definition: AthAlgTool.h:26
SurveyConstraint::m_TransYRandSCTEC
double m_TransYRandSCTEC
Weight & rand Translation in Y of current SCTEC modules.
Definition: SurveyConstraint.h:109
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
SurveyConstraint::m_TransLayerRand
double m_TransLayerRand
rand Translation in X,Y,Z of all Pixel/SCT EC/B layers
Definition: SurveyConstraint.h:127
IInDetAlignDBTool::setTrans
virtual bool setTrans(const Identifier &, const int, const Amg::Transform3D &) const =0
SurveyConstraintModule
Definition: SurveyConstraintModule.h:24
SurveyConstraint::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: SurveyConstraint.h:76
python.SystemOfUnits.m3
int m3
Definition: SystemOfUnits.py:93
SurveyConstraint::m_SurveyWeightPhiZ
double m_SurveyWeightPhiZ
""
Definition: SurveyConstraint.h:88
SurveyConstraint::m_RotY
double m_RotY
Rotation in Y of the first current PixEC module.
Definition: SurveyConstraint.h:94
SurveyConstraintModule::Stave
@ Stave
Definition: SurveyConstraintModule.h:27
SurveyConstraint::m_RotXRandSCTB
double m_RotXRandSCTB
Weight & rand Rotation in X of current SCTB modules.
Definition: SurveyConstraint.h:117