CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
LASBarrelAlgorithm Class Reference

#include <LASBarrelAlgorithm.h>

Public Member Functions

LASBarrelAlignmentParameterSet CalculateParameters (LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
 
void Dump (void)
 
 LASBarrelAlgorithm ()
 

Private Member Functions

void ReadMisalignmentFromFile (const char *, LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
 
void ReadStartParametersFromFile (const char *, float[52])
 

Private Attributes

TMinuit * minuit
 

Detailed Description

implementation of the alignment tube algorithm

Definition at line 22 of file LASBarrelAlgorithm.h.

Constructor & Destructor Documentation

LASBarrelAlgorithm::LASBarrelAlgorithm ( )

Definition at line 13 of file LASBarrelAlgorithm.cc.

References minuit.

13 { minuit = new TMinuit(52); }

Member Function Documentation

LASBarrelAlignmentParameterSet LASBarrelAlgorithm::CalculateParameters ( LASGlobalData< LASCoordinateSet > &  measuredCoordinates,
LASGlobalData< LASCoordinateSet > &  nominalCoordinates 
)

The minimization of the equation system for the barrel. For documentation, please refer to the TkLasATModel TWiki page: TWiki > CMS Web > CMSTrackerLaserAlignmenSystem > TkLasBarrelAlgorithm > TkLasATModel

Definition at line 20 of file LASBarrelAlgorithm.cc.

References fitWZ::arglist, gather_cfg::cout, fcn(), LASBarrelAlignmentParameterSet::GetParameter(), and minuit.

Referenced by LaserAlignment::endRunProduce().

21  {
22  std::cout << " [LASBarrelAlgorithm::CalculateParameters] -- Starting." << std::endl;
23 
25  // for testing..
26  //ReadMisalignmentFromFile( "misalign-var.txt", measuredCoordinates, nominalCoordinates );
28 
29  // statics for minuit
30  aMeasuredCoordinates = &measuredCoordinates;
31  aNominalCoordinates = &nominalCoordinates;
32 
33  // minimizer and variables for it
34  minuit->SetFCN(fcn);
35  double arglist[10];
36  int _ierflg = 0;
37 
38  // toggle minuit blabla
39  arglist[0] = -1;
40  minuit->mnexcm("SET PRI", arglist, 1, _ierflg);
41 
42  // set par errors
43  arglist[0] = 1;
44  minuit->mnexcm("SET ERR", arglist, 1, _ierflg);
45 
46  //
47  // define 52 parameters
48  //
49 
50  // start values: to be evacuated to cfg
51  static float _vstart[52] = {
52  0.00, 0.00, 0.0, 0.0, 0.0, 0.0, // subdet for TIB+
53  0.00, 0.00, 0.0, 0.0, 0.0, 0.0, // subdet for TIB-
54  0.00, 0.00, 0.0, 0.0, 0.0, 0.0, // subdet for TOB+
55  0.00, 0.00, 0.0, 0.0, 0.0, 0.0, // subdet for TOB-
56  0.00, 0.00, 0.0, 0.0, 0.0, 0.0, // subdet for TEC+
57  0.00, 0.00, 0.0, 0.0, 0.0, 0.0, // subdet for TEC-
58  0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // beams 0-3
59  0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00 // beams 4-7
60  };
61 
63  // ReadStartParametersFromFile( "startParameters.txt", _vstart ); // debug
65 
66  // step sizes: to be tuned, to be evacuated to cfg
67  static float _vstep[52] = {
68  0.001, 0.001, 0.1, 0.1, 0.1, 0.1, // subdet for TIB+
69  0.001, 0.001, 0.1, 0.1, 0.1, 0.1, // subdet for TIB-
70  0.001, 0.001, 0.1, 0.1, 0.1, 0.1, // subdet for TOB+
71  0.001, 0.001, 0.1, 0.1, 0.1, 0.1, // subdet for TOB-
72  0.001, 0.001, 0.1, 0.1, 0.1, 0.1, // subdet for TEC+
73  0.001, 0.001, 0.1, 0.1, 0.1, 0.1, // subdet for TEC-
74  0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, // beams 0-3
75  0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001 // beams 4-7
76  };
77 
78  // subdetector parameters for TIB+:
79 
80  // rotation around z of first end face
81  minuit->mnparm(0, "subRot1TIB+", _vstart[0], _vstep[0], 0, 0, _ierflg);
82  // rotation around z of second end face
83  minuit->mnparm(1, "subRot2TIB+", _vstart[1], _vstep[1], 0, 0, _ierflg);
84  // translation along x of first end face
85  minuit->mnparm(2, "subTransX1TIB+", _vstart[2], _vstep[2], 0, 0, _ierflg);
86  // translation along x of second end face
87  minuit->mnparm(3, "subTransX2TIB+", _vstart[3], _vstep[3], 0, 0, _ierflg);
88  // translation along y of first end face
89  minuit->mnparm(4, "subTransY1TIB+", _vstart[4], _vstep[4], 0, 0, _ierflg);
90  // translation along y of second end face
91  minuit->mnparm(5, "subTransY2TIB+", _vstart[5], _vstep[5], 0, 0, _ierflg);
92 
93  // subdetector parameters for TIB-:
94 
95  // rotation around z of first end face
96  minuit->mnparm(6, "subRot1TIB-", _vstart[6], _vstep[6], 0, 0, _ierflg);
97  // rotation around z of second end face
98  minuit->mnparm(7, "subRot2TIB-", _vstart[7], _vstep[7], 0, 0, _ierflg);
99  // translation along x of first end face
100  minuit->mnparm(8, "subTransX1TIB-", _vstart[8], _vstep[8], 0, 0, _ierflg);
101  // translation along x of second end face
102  minuit->mnparm(9, "subTransX2TIB-", _vstart[9], _vstep[9], 0, 0, _ierflg);
103  // translation along y of first end face
104  minuit->mnparm(10, "subTransY1TIB-", _vstart[10], _vstep[10], 0, 0, _ierflg);
105  // translation along y of second end face
106  minuit->mnparm(11, "subTransY2TIB-", _vstart[11], _vstep[11], 0, 0, _ierflg);
107 
108  // subdetector parameters for TOB+:
109 
110  // rotation around z of first end face
111  minuit->mnparm(12, "subRot1TOB+", _vstart[12], _vstep[12], 0, 0, _ierflg);
112  // rotation around z of second end face
113  minuit->mnparm(13, "subRot2TOB+", _vstart[13], _vstep[13], 0, 0, _ierflg);
114  // translation along x of first end face
115  minuit->mnparm(14, "subTransX1TOB+", _vstart[14], _vstep[14], 0, 0, _ierflg);
116  // translation along x of second end face
117  minuit->mnparm(15, "subTransX2TOB+", _vstart[15], _vstep[15], 0, 0, _ierflg);
118  // translation along y of first end face
119  minuit->mnparm(16, "subTransY1TOB+", _vstart[16], _vstep[16], 0, 0, _ierflg);
120  // translation along y of second end face
121  minuit->mnparm(17, "subTransY2TOB+", _vstart[17], _vstep[17], 0, 0, _ierflg);
122 
123  // subdetector parameters for TOB-:
124 
125  // rotation around z of first end face
126  minuit->mnparm(18, "subRot1TOB-", _vstart[18], _vstep[18], 0, 0, _ierflg);
127  // rotation around z of second end face
128  minuit->mnparm(19, "subRot2TOB-", _vstart[19], _vstep[19], 0, 0, _ierflg);
129  // translation along x of first end face
130  minuit->mnparm(20, "subTransX1TOB-", _vstart[20], _vstep[20], 0, 0, _ierflg);
131  // translation along x of second end face
132  minuit->mnparm(21, "subTransX2TOB-", _vstart[21], _vstep[21], 0, 0, _ierflg);
133  // translation along y of first end face
134  minuit->mnparm(22, "subTransY1TOB-", _vstart[22], _vstep[22], 0, 0, _ierflg);
135  // translation along y of second end face
136  minuit->mnparm(23, "subTransY2TOB-", _vstart[23], _vstep[23], 0, 0, _ierflg);
137 
138  // subdetector parameters for TEC+:
139 
140  // rotation around z of first end face
141  minuit->mnparm(24, "subRot1TEC+", _vstart[24], _vstep[24], 0, 0, _ierflg);
142  // rotation around z of second end face
143  minuit->mnparm(25, "subRot2TEC+", _vstart[25], _vstep[25], 0, 0, _ierflg);
144  // translation along x of first end face
145  minuit->mnparm(26, "subTransX1TEC+", _vstart[26], _vstep[26], 0, 0, _ierflg);
146  // translation along x of second end face
147  minuit->mnparm(27, "subTransX2TEC+", _vstart[27], _vstep[27], 0, 0, _ierflg);
148  // translation along y of first end face
149  minuit->mnparm(28, "subTransY1TEC+", _vstart[28], _vstep[28], 0, 0, _ierflg);
150  // translation along y of second end face
151  minuit->mnparm(29, "subTransY2TEC+", _vstart[29], _vstep[29], 0, 0, _ierflg);
152 
153  // subdetector parameters for TEC-:
154 
155  // rotation around z of first end face
156  minuit->mnparm(30, "subRot1TEC-", _vstart[30], _vstep[30], 0, 0, _ierflg);
157  // rotation around z of second end face
158  minuit->mnparm(31, "subRot2TEC-", _vstart[31], _vstep[31], 0, 0, _ierflg);
159  // translation along x of first end face
160  minuit->mnparm(32, "subTransX1TEC-", _vstart[32], _vstep[32], 0, 0, _ierflg);
161  // translation along x of second end face
162  minuit->mnparm(33, "subTransX2TEC-", _vstart[33], _vstep[33], 0, 0, _ierflg);
163  // translation along y of first end face
164  minuit->mnparm(34, "subTransY1TEC-", _vstart[34], _vstep[34], 0, 0, _ierflg);
165  // translation along y of second end face
166  minuit->mnparm(35, "subTransY2TEC-", _vstart[35], _vstep[35], 0, 0, _ierflg);
167 
168  // beam parameters (+-z pairs, duplicated for beams 0-7):
169 
170  // rotation around z at zt1
171  minuit->mnparm(36, "beamRot1Beam0", _vstart[36], _vstep[36], 0, 0, _ierflg);
172  // rotation around z at zt2
173  minuit->mnparm(37, "beamRot2Beam0", _vstart[37], _vstep[37], 0, 0, _ierflg);
174 
175  // rotation around z at zt1
176  minuit->mnparm(38, "beamRot1Beam1", _vstart[38], _vstep[38], 0, 0, _ierflg);
177  // rotation around z at zt2
178  minuit->mnparm(39, "beamRot2Beam1", _vstart[39], _vstep[39], 0, 0, _ierflg);
179 
180  // rotation around z at zt1
181  minuit->mnparm(40, "beamRot1Beam2", _vstart[40], _vstep[40], 0, 0, _ierflg);
182  // rotation around z at zt2
183  minuit->mnparm(41, "beamRot2Beam2", _vstart[41], _vstep[41], 0, 0, _ierflg);
184 
185  // rotation around z at zt1
186  minuit->mnparm(42, "beamRot1Beam3", _vstart[42], _vstep[42], 0, 0, _ierflg);
187  // rotation around z at zt2
188  minuit->mnparm(43, "beamRot2Beam3", _vstart[43], _vstep[43], 0, 0, _ierflg);
189 
190  // rotation around z at zt1
191  minuit->mnparm(44, "beamRot1Beam4", _vstart[44], _vstep[44], 0, 0, _ierflg);
192  // rotation around z at zt2
193  minuit->mnparm(45, "beamRot2Beam4", _vstart[45], _vstep[45], 0, 0, _ierflg);
194 
195  // rotation around z at zt1
196  minuit->mnparm(46, "beamRot1Beam5", _vstart[46], _vstep[46], 0, 0, _ierflg);
197  // rotation around z at zt2
198  minuit->mnparm(47, "beamRot2Beam5", _vstart[47], _vstep[47], 0, 0, _ierflg);
199 
200  // rotation around z at zt1
201  minuit->mnparm(48, "beamRot1Beam6", _vstart[48], _vstep[48], 0, 0, _ierflg);
202  // rotation around z at zt2
203  minuit->mnparm(49, "beamRot2Beam6", _vstart[49], _vstep[49], 0, 0, _ierflg);
204 
205  // rotation around z at zt1
206  minuit->mnparm(50, "beamRot1Beam7", _vstart[50], _vstep[50], 0, 0, _ierflg);
207  // rotation around z at zt2
208  minuit->mnparm(51, "beamRot2Beam7", _vstart[51], _vstep[51], 0, 0, _ierflg);
209 
210  // we fix the respective outer disks 9 of each endcap
211  // as a reference system (pars 25,27,29 & 30,32,34)
212  // note: minuit numbering is fortran style...
213  arglist[0] = 26;
214  arglist[1] = 28;
215  arglist[2] = 30;
216  // minuit->mnexcm( "FIX", arglist ,3, _ierflg ); // TEC+
217  arglist[0] = 31;
218  arglist[1] = 33;
219  arglist[2] = 35;
220  // minuit->mnexcm( "FIX", arglist ,3, _ierflg ); // TEC-
221 
223  // DEBUG: FIX BEAM PARAMETERS /////////////////////////////////////////////////////////////////////
224  double parlist[16];
225  for (int par = 37; par <= 52; ++par)
226  parlist[par - 37] = par;
227  minuit->mnexcm("FIX", parlist, 16, _ierflg);
229 
231  // DEBUG: FIX ALGN PARAMETERS /////////////////////////////////////////////////////////////////////
232  // double parlist[36];
233  // for( int par = 1; par <= 36; ++par ) parlist[par-1] = par;
234  // minuit->mnexcm( "FIX", parlist ,36, _ierflg );
236 
237  // now ready for minimization step
238  arglist[0] = 10000;
239  arglist[1] = 0.1;
240  minuit->mnexcm("MIGRAD", arglist, 2, _ierflg); // minimizer
241  // minuit->mnexcm( "MINOS", arglist , 1, _ierflg ); // error recalculation
242 
243  // now fill the result vector.
244  // turned out that the parameter numbering is stupid, change this later..
246  double par = 0., parError = 0.;
247 
248  // TEC+ rot
249  minuit->GetParameter(24, par, parError);
250  theResult.GetParameter(0, 0, 0).first = par;
251  theResult.GetParameter(0, 0, 0).second = parError;
252  minuit->GetParameter(25, par, parError);
253  theResult.GetParameter(0, 1, 0).first = par;
254  theResult.GetParameter(0, 1, 0).second = parError;
255  // TEC+ x
256  minuit->GetParameter(26, par, parError);
257  theResult.GetParameter(0, 0, 1).first = par;
258  theResult.GetParameter(0, 0, 1).second = parError;
259  minuit->GetParameter(27, par, parError);
260  theResult.GetParameter(0, 1, 1).first = par;
261  theResult.GetParameter(0, 1, 1).second = parError;
262  // TEC+ x
263  minuit->GetParameter(28, par, parError);
264  theResult.GetParameter(0, 0, 2).first = par;
265  theResult.GetParameter(0, 0, 2).second = parError;
266  minuit->GetParameter(29, par, parError);
267  theResult.GetParameter(0, 1, 2).first = par;
268  theResult.GetParameter(0, 1, 2).second = parError;
269 
270  // TEC- rot
271  minuit->GetParameter(30, par, parError);
272  theResult.GetParameter(1, 0, 0).first = par;
273  theResult.GetParameter(1, 0, 0).second = parError;
274  minuit->GetParameter(31, par, parError);
275  theResult.GetParameter(1, 1, 0).first = par;
276  theResult.GetParameter(1, 1, 0).second = parError;
277  // TEC- x
278  minuit->GetParameter(32, par, parError);
279  theResult.GetParameter(1, 0, 1).first = par;
280  theResult.GetParameter(1, 0, 1).second = parError;
281  minuit->GetParameter(33, par, parError);
282  theResult.GetParameter(1, 1, 1).first = par;
283  theResult.GetParameter(1, 1, 1).second = parError;
284  // TEC- x
285  minuit->GetParameter(34, par, parError);
286  theResult.GetParameter(1, 0, 2).first = par;
287  theResult.GetParameter(1, 0, 2).second = parError;
288  minuit->GetParameter(35, par, parError);
289  theResult.GetParameter(1, 1, 2).first = par;
290  theResult.GetParameter(1, 1, 2).second = parError;
291 
292  // TIB+ rot
293  minuit->GetParameter(0, par, parError);
294  theResult.GetParameter(2, 0, 0).first = par;
295  theResult.GetParameter(2, 0, 0).second = parError;
296  minuit->GetParameter(1, par, parError);
297  theResult.GetParameter(2, 1, 0).first = par;
298  theResult.GetParameter(2, 1, 0).second = parError;
299  // TIB+ x
300  minuit->GetParameter(2, par, parError);
301  theResult.GetParameter(2, 0, 1).first = par;
302  theResult.GetParameter(2, 0, 1).second = parError;
303  minuit->GetParameter(3, par, parError);
304  theResult.GetParameter(2, 1, 1).first = par;
305  theResult.GetParameter(2, 1, 1).second = parError;
306  // TIB+ x
307  minuit->GetParameter(4, par, parError);
308  theResult.GetParameter(2, 0, 2).first = par;
309  theResult.GetParameter(2, 0, 2).second = parError;
310  minuit->GetParameter(5, par, parError);
311  theResult.GetParameter(2, 1, 2).first = par;
312  theResult.GetParameter(2, 1, 2).second = parError;
313 
314  // TIB- rot
315  minuit->GetParameter(6, par, parError);
316  theResult.GetParameter(3, 0, 0).first = par;
317  theResult.GetParameter(3, 0, 0).second = parError;
318  minuit->GetParameter(7, par, parError);
319  theResult.GetParameter(3, 1, 0).first = par;
320  theResult.GetParameter(3, 1, 0).second = parError;
321  // TIB- x
322  minuit->GetParameter(8, par, parError);
323  theResult.GetParameter(3, 0, 1).first = par;
324  theResult.GetParameter(3, 0, 1).second = parError;
325  minuit->GetParameter(9, par, parError);
326  theResult.GetParameter(3, 1, 1).first = par;
327  theResult.GetParameter(3, 1, 1).second = parError;
328  // TIB- x
329  minuit->GetParameter(10, par, parError);
330  theResult.GetParameter(3, 0, 2).first = par;
331  theResult.GetParameter(3, 0, 2).second = parError;
332  minuit->GetParameter(11, par, parError);
333  theResult.GetParameter(3, 1, 2).first = par;
334  theResult.GetParameter(3, 1, 2).second = parError;
335 
336  // TOB+ rot
337  minuit->GetParameter(12, par, parError);
338  theResult.GetParameter(4, 0, 0).first = par;
339  theResult.GetParameter(4, 0, 0).second = parError;
340  minuit->GetParameter(13, par, parError);
341  theResult.GetParameter(4, 1, 0).first = par;
342  theResult.GetParameter(4, 1, 0).second = parError;
343  // TOB+ x
344  minuit->GetParameter(14, par, parError);
345  theResult.GetParameter(4, 0, 1).first = par;
346  theResult.GetParameter(4, 0, 1).second = parError;
347  minuit->GetParameter(15, par, parError);
348  theResult.GetParameter(4, 1, 1).first = par;
349  theResult.GetParameter(4, 1, 1).second = parError;
350  // TOB+ x
351  minuit->GetParameter(16, par, parError);
352  theResult.GetParameter(4, 0, 2).first = par;
353  theResult.GetParameter(4, 0, 2).second = parError;
354  minuit->GetParameter(17, par, parError);
355  theResult.GetParameter(4, 1, 2).first = par;
356  theResult.GetParameter(4, 1, 2).second = parError;
357 
358  // TOB- rot
359  minuit->GetParameter(18, par, parError);
360  theResult.GetParameter(5, 0, 0).first = par;
361  theResult.GetParameter(5, 0, 0).second = parError;
362  minuit->GetParameter(19, par, parError);
363  theResult.GetParameter(5, 1, 0).first = par;
364  theResult.GetParameter(5, 1, 0).second = parError;
365  // TOB- x
366  minuit->GetParameter(20, par, parError);
367  theResult.GetParameter(5, 0, 1).first = par;
368  theResult.GetParameter(5, 0, 1).second = parError;
369  minuit->GetParameter(21, par, parError);
370  theResult.GetParameter(5, 1, 1).first = par;
371  theResult.GetParameter(5, 1, 1).second = parError;
372  // TOB- x
373  minuit->GetParameter(22, par, parError);
374  theResult.GetParameter(5, 0, 2).first = par;
375  theResult.GetParameter(5, 0, 2).second = parError;
376  minuit->GetParameter(23, par, parError);
377  theResult.GetParameter(5, 1, 2).first = par;
378  theResult.GetParameter(5, 1, 2).second = parError;
379 
380  std::cout << " [LASBarrelAlgorithm::CalculateParameters] -- Done." << std::endl;
381 
382  return theResult;
383 }
std::pair< double, double > & GetParameter(int aSubdetector, int aDisk, int aParameter)
arglist
Definition: fitWZ.py:39
void fcn(int &npar, double *gin, double &f, double *par, int iflag)
LASGlobalData< LASCoordinateSet > * aMeasuredCoordinates
LASGlobalData< LASCoordinateSet > * aNominalCoordinates
void LASBarrelAlgorithm::Dump ( void  )

Print resulting parameters to stdout and to a file - for debugging only

Definition at line 603 of file LASBarrelAlgorithm.cc.

References EcalCondDBWriter_cfi::beam, beam_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, relativeConstraints::error, FrontierConditions_GlobalTag_cff::file, alignBH_cfg::fixed, minuit, AlCaHLTBitMon_QueryRunRegistry::string, subdetNames, relativeConstraints::value, and z.

603  {
604  if (!minuit) {
605  std::cerr << " [LASBarrelAlgorithm::Dump] ** WARNING: minimizer object uninitialized." << std::endl;
606  return;
607  }
608 
609  std::cout << std::endl << " [LASBarrelAlgorithm::Dump] -- Parameter dump: " << std::endl;
610 
611  const int subdetParMap[6] = {24, 30, 0, 6, 12, 18}; // map to one-dim array
612  const std::string subdetNames[6] = {" TEC+ ", " TEC- ", " TIB+ ", " TIB- ", " TOB+ ", " TOB- "};
613  double value, error;
614 
615  std::cout << " Detector parameters: " << std::endl;
616  std::cout << " -------------------" << std::endl;
617  std::cout << " Values: PHI1 X1 Y1 PHI2 X2 Y2 " << std::endl;
618  for (int subdet = 0; subdet < 6; ++subdet) {
619  std::cout << subdetNames[subdet];
620  for (int par = subdetParMap[subdet]; par <= subdetParMap[subdet] + 4; par += 2) {
621  minuit->GetParameter(par, value, error);
622  std::cout << std::setw(12) << std::setprecision(6) << std::fixed << value;
623  }
624  for (int par = subdetParMap[subdet] + 1; par <= subdetParMap[subdet] + 5; par += 2) {
625  minuit->GetParameter(par, value, error);
626  std::cout << std::setw(12) << std::setprecision(6) << std::fixed << value;
627  }
628  std::cout << std::endl;
629  }
630 
631  std::cout << " Errors: PHI1 X1 Y1 PHI2 X2 Y2 " << std::endl;
632  for (int subdet = 0; subdet < 6; ++subdet) {
633  std::cout << subdetNames[subdet];
634  for (int par = subdetParMap[subdet]; par <= subdetParMap[subdet] + 4; par += 2) {
635  minuit->GetParameter(par, value, error);
636  std::cout << std::setw(12) << std::setprecision(6) << std::fixed << error;
637  }
638  for (int par = subdetParMap[subdet] + 1; par <= subdetParMap[subdet] + 5; par += 2) {
639  minuit->GetParameter(par, value, error);
640  std::cout << std::setw(12) << std::setprecision(6) << std::fixed << error;
641  }
642  std::cout << std::endl;
643  }
644 
645  std::cout << std::endl;
646  std::cout << " Beam parameters: " << std::endl;
647  std::cout << " ---------------" << std::endl;
648  std::cout << " Values: PHI1 PHI2" << std::endl;
649  for (int beam = 0; beam < 8; ++beam) {
650  std::cout << " " << beam << " ";
651  for (int z = 0; z < 2; ++z) {
652  minuit->GetParameter(36 + 2 * beam + z, value, error);
653  std::cout << std::setw(12) << std::setprecision(6) << std::fixed << value;
654  }
655  std::cout << std::endl;
656  }
657 
658  std::cout << " Errors: PHI1 PHI2" << std::endl;
659  for (int beam = 0; beam < 8; ++beam) {
660  std::cout << " " << beam << " ";
661  for (int z = 0; z < 2; ++z) {
662  minuit->GetParameter(36 + 2 * beam + z, value, error);
663  std::cout << std::setw(12) << std::setprecision(6) << std::fixed << error;
664  }
665  std::cout << std::endl;
666  }
667 
668  // det parameters once again without leading column (for easy read-in), into a file
669  std::ofstream file("/afs/cern.ch/user/o/olzem/public/parameters_det.txt");
670  for (int subdet = 0; subdet < 6; ++subdet) {
671  for (int par = subdetParMap[subdet]; par <= subdetParMap[subdet] + 4; par += 2) {
672  minuit->GetParameter(par, value, error);
673  file << std::setw(12) << std::setprecision(6) << std::fixed << value;
674  }
675  for (int par = subdetParMap[subdet] + 1; par <= subdetParMap[subdet] + 5; par += 2) {
676  minuit->GetParameter(par, value, error);
677  file << std::setw(12) << std::setprecision(6) << std::fixed << value;
678  }
679  file << std::endl;
680  }
681  file.close();
682 
683  // same for beam parameters
684  file.open("/afs/cern.ch/user/o/olzem/public/parameters_beam.txt");
685  for (int beam = 0; beam < 8; ++beam) {
686  for (int z = 0; z < 2; ++z) {
687  minuit->GetParameter(36 + 2 * beam + z, value, error);
688  file << std::setw(12) << std::setprecision(6) << std::fixed << value;
689  }
690  file << std::endl;
691  }
692  file.close();
693 
694  std::cout << " [LASBarrelAlgorithm::Dump] -- End parameter dump." << std::endl;
695  std::cout << std::endl;
696 }
static const char * subdetNames[]
void LASBarrelAlgorithm::ReadMisalignmentFromFile ( const char *  filename,
LASGlobalData< LASCoordinateSet > &  measuredCoordinates,
LASGlobalData< LASCoordinateSet > &  nominalCoordinates 
)
private

allows to push in a simple simulated misalignment for quick internal testing purposes; overwrites LASGlobalData<LASCoordinateSet>& measuredCoordinates; call at beginning of LASBarrelAlgorithm::CalculateParameters method

one line per module, format for TEC: det ring beam disk phi phiErr format for TEC(at) & TIBTOB: det beam z "-1" phi phiErr

Definition at line 707 of file LASBarrelAlgorithm.cc.

References EcalCondDBWriter_cfi::beam, beam_dqm_sourceclient-live_cfg::cerr, FrontierConditions_GlobalTag_cff::file, LASGlobalData< T >::GetTEC2TECEntry(), LASGlobalData< T >::GetTECEntry(), LASGlobalData< T >::GetTIBTOBEntry(), phi, muonME0PseudoDigis_cfi::phiError, relativeConstraints::ring, LASCoordinateSet::SetPhi(), LASCoordinateSet::SetPhiError(), LASGlobalLoop::TEC2TECLoop(), LASGlobalLoop::TECLoop(), LASGlobalLoop::TIBTOBLoop(), and z.

709  {
710  std::ifstream file(filename);
711  if (file.bad()) {
712  std::cerr << " [LASBarrelAlgorithm::ReadMisalignmentFromFile] ** ERROR: cannot open file \"" << filename << "\"."
713  << std::endl;
714  return;
715  }
716 
717  std::cerr
718  << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
719  << std::endl;
720  std::cerr
721  << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
722  << std::endl;
723  std::cerr
724  << " [LASBarrelAlgorithm::ReadMisalignmentFromFile] ** WARNING: you are reading a fake measurement from a file!"
725  << std::endl;
726  std::cerr
727  << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
728  << std::endl;
729  std::cerr
730  << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
731  << std::endl;
732 
733  // the measured coordinates will finally be overwritten;
734  // first, set them to the nominal values
735  measuredCoordinates = nominalCoordinates;
736 
737  // and put large errors on all values;
738  {
739  LASGlobalLoop moduleLoop;
740  int det, ring, beam, disk, pos;
741 
742  det = 0;
743  ring = 0;
744  beam = 0;
745  disk = 0;
746  do {
747  measuredCoordinates.GetTECEntry(det, ring, beam, disk).SetPhiError(1000.);
748  } while (moduleLoop.TECLoop(det, ring, beam, disk));
749 
750  det = 2;
751  beam = 0;
752  pos = 0;
753  do {
754  measuredCoordinates.GetTIBTOBEntry(det, beam, pos).SetPhiError(1000.);
755  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
756 
757  det = 0;
758  beam = 0;
759  disk = 0;
760  do {
761  measuredCoordinates.GetTEC2TECEntry(det, beam, disk).SetPhiError(1000.);
762  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
763  }
764 
765  // buffers for read-in
766  int det, beam, z, ring;
767  double phi, phiError;
768 
769  while (!file.eof()) {
770  file >> det;
771  if (file.eof())
772  break; // do not read the last line twice, do not fill trash if file empty
773 
774  file >> beam;
775  file >> z;
776  file >> ring;
777  file >> phi;
778  file >> phiError;
779 
780  if (det > 1) { // TIB/TOB
781  measuredCoordinates.GetTIBTOBEntry(det, beam, z).SetPhi(phi);
782  measuredCoordinates.GetTIBTOBEntry(det, beam, z).SetPhiError(phiError);
783  } else { // TEC or TEC(at)
784  if (ring > -1) { // TEC
785  measuredCoordinates.GetTECEntry(det, ring, beam, z).SetPhi(phi);
786  measuredCoordinates.GetTECEntry(det, ring, beam, z).SetPhiError(phiError);
787  } else { // TEC(at)
788  measuredCoordinates.GetTEC2TECEntry(det, beam, z).SetPhi(phi);
789  measuredCoordinates.GetTEC2TECEntry(det, beam, z).SetPhiError(phiError);
790  }
791  }
792  }
793 
794  file.close();
795 }
void SetPhi(double aPhi)
void SetPhiError(double aPhiError)
bool TEC2TECLoop(int &, int &, int &) const
T & GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition)
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)
T & GetTECEntry(int subdetector, int tecRing, int beam, int tecDisk)
Definition: LASGlobalData.h:84
bool TECLoop(int &, int &, int &, int &) const
bool TIBTOBLoop(int &, int &, int &) const
void LASBarrelAlgorithm::ReadStartParametersFromFile ( const char *  filename,
float  values[52] 
)
private

this function is here only for debugging, don't use. file format: <phi1> <x1> <y1> <phi2> <x2> <y2> // for TEC* " " " " " " // TEC- .. then for TIB+, TIB-, TOB+, TOB- index 1 if for lower z, 2 for higher z

Definition at line 805 of file LASBarrelAlgorithm.cc.

References beam_dqm_sourceclient-live_cfg::cerr, and FrontierConditions_GlobalTag_cff::file.

805  {
806  std::ifstream file(filename);
807  if (file.bad()) {
808  std::cerr << " [LASBarrelAlgorithm::ReadStartParametersFromFile] ** ERROR: cannot open file \"" << filename << "\"."
809  << std::endl;
810  return;
811  }
812 
813  std::cerr << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
814  "@@@@@@@@@@@@"
815  << std::endl;
816  std::cerr << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
817  "@@@@@@@@@@@@"
818  << std::endl;
819  std::cerr << " [LASBarrelAlgorithm::ReadStartParametersFrom File] ** WARNING: you are reading parameter start values "
820  "from a file!"
821  << std::endl;
822  std::cerr << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
823  "@@@@@@@@@@@@"
824  << std::endl;
825  std::cerr << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
826  "@@@@@@@@@@@@"
827  << std::endl;
828 
829  // map to the minuit par array
830  const int subdetParMap[6] = {24, 30, 0, 6, 12, 18};
831 
832  for (int det = 0; det < 6; ++det) {
833  file >> values[subdetParMap[det]]; // phi1
834  file >> values[subdetParMap[det] + 2]; // x1
835  file >> values[subdetParMap[det] + 4]; // y1
836  file >> values[subdetParMap[det] + 1]; // phi2
837  file >> values[subdetParMap[det] + 3]; // x2
838  file >> values[subdetParMap[det] + 5]; // y2
839  }
840 }

Member Data Documentation

TMinuit* LASBarrelAlgorithm::minuit
private

Definition at line 32 of file LASBarrelAlgorithm.h.

Referenced by CalculateParameters(), Dump(), and LASBarrelAlgorithm().