21 #include <Math/Minimizer.h>
22 #include <Math/Factory.h>
23 #include <Math/Functor.h>
76 internalDebug =
false;
77 considerVxCovariance =
true;
78 pi = 3.141592653589793238;
105 stringstream debugFile;
108 if (outputDebugFile.is_open() ==
true) outputDebugFile.close();
109 tmp.erase(strlen(
fileName.c_str())-4,4);
110 debugFile << tmp.c_str() <<
"_Run" << iEvent.
id().
run() <<
".txt";
111 outputDebugFile.open(debugFile.str().c_str(),
ios::out);
112 outputDebugFile.close();
113 outputDebugFile.open(debugFile.str().c_str(), ios::app);
118 else if (beginTimeOfFit != 0)
120 totalHits += HitCounter(iEvent);
122 if (internalDebug ==
true)
124 cout <<
"[Vx3DHLTAnalyzer]::\tI found " << totalHits <<
" pixel hits until now" << endl;
125 cout <<
"[Vx3DHLTAnalyzer]::\tIn this event there are " << Vx3DCollection->size() <<
" vertex cadidates" << endl;
128 for (vector<Vertex>::const_iterator it3DVx = Vx3DCollection->begin(); it3DVx != Vx3DCollection->end(); it3DVx++)
130 if (internalDebug ==
true)
132 cout <<
"[Vx3DHLTAnalyzer]::\tVertex selections:" << endl;
133 cout <<
"[Vx3DHLTAnalyzer]::\tisValid = " << it3DVx->isValid() << endl;
134 cout <<
"[Vx3DHLTAnalyzer]::\tisFake = " << it3DVx->isFake() << endl;
135 cout <<
"[Vx3DHLTAnalyzer]::\tnodof = " << it3DVx->ndof() << endl;
136 cout <<
"[Vx3DHLTAnalyzer]::\ttracksSize = " << it3DVx->tracksSize() << endl;
139 if ((it3DVx->isValid() ==
true) &&
140 (it3DVx->isFake() ==
false) &&
142 (it3DVx->tracksSize() > 0) &&
143 ((it3DVx->ndof()+3.) / ((double)it3DVx->tracksSize()) >= 2.*
minVxWgt))
145 for (i = 0; i <
DIM; i++)
147 for (j = 0; j <
DIM; j++)
161 if ((i == DIM) && (det > 0.))
163 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tVertex accepted !" << endl;
165 MyVertex.
x = it3DVx->x();
166 MyVertex.
y = it3DVx->y();
167 MyVertex.
z = it3DVx->z();
170 Vx_X->Fill(it3DVx->x());
171 Vx_Y->Fill(it3DVx->y());
172 Vx_Z->Fill(it3DVx->z());
174 Vx_ZX->Fill(it3DVx->z(), it3DVx->x());
175 Vx_ZY->Fill(it3DVx->z(), it3DVx->y());
176 Vx_XY->Fill(it3DVx->x(), it3DVx->y());
178 Vx_X_Cum->Fill(it3DVx->x());
179 Vx_Y_Cum->Fill(it3DVx->y());
180 Vx_Z_Cum->Fill(it3DVx->z());
182 Vx_ZX_Cum->Fill(it3DVx->z(), it3DVx->x());
183 Vx_ZY_Cum->Fill(it3DVx->z(), it3DVx->y());
184 Vx_XY_Cum->Fill(it3DVx->x(), it3DVx->y());
186 else if (internalDebug ==
true)
188 cout <<
"[Vx3DHLTAnalyzer]::\tVertex discarded !" << endl;
190 for (i = 0; i <
DIM; i++)
191 for (j = 0; j <
DIM; j++)
192 cout <<
"(i,j) --> " << i <<
"," << j <<
" --> " << MyVertex.
Covariance[i][j] << endl;
195 else if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tVertex discarded !" << endl;
218 strftime(ts,
sizeof(ts),
"%Y.%m.%d %H:%M:%S %Z", gmtime(&t));
220 string ts_string(ts);
247 (std::fabs(
Vertices[
i].z-zPos) <= maxLongLength))
249 if (considerVxCovariance ==
true)
255 K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3] +
VxErrCorr*
VxErrCorr *
Vertices[
i].Covariance[1][2];
256 K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3] +
VxErrCorr*
VxErrCorr *
Vertices[
i].Covariance[0][2];
260 K[0][0] = std::fabs(par[0]);
261 K[1][1] = std::fabs(par[1]);
262 K[2][2] = std::fabs(par[2]);
263 K[0][1] = K[1][0] = par[3];
264 K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3];
265 K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3];
268 det = K[0][0]*(K[1][1]*K[2][2] - K[1][2]*K[1][2]) -
269 K[0][1]*(K[0][1]*K[2][2] - K[0][2]*K[1][2]) +
270 K[0][2]*(K[0][1]*K[1][2] - K[0][2]*K[1][1]);
272 M[0][0] = (K[1][1]*K[2][2] - K[1][2]*K[1][2]) / det;
273 M[1][1] = (K[0][0]*K[2][2] - K[0][2]*K[0][2]) / det;
274 M[2][2] = (K[0][0]*K[1][1] - K[0][1]*K[0][1]) / det;
275 M[0][1] = M[1][0] = (K[0][2]*K[1][2] - K[0][1]*K[2][2]) / det;
276 M[1][2] = M[2][1] = (K[0][2]*K[0][1] - K[1][2]*K[0][0]) / det;
277 M[0][2] = M[2][0] = (K[0][1]*K[1][2] - K[0][2]*K[1][1]) / det;
308 if ((vals !=
NULL) && (vals->size() == nParams*2))
310 double nSigmaXY = 10.;
312 double parDistanceXY = 1
e-3;
313 double parDistanceZ = 1
e-2;
314 double parDistanceddZ = 1
e-3;
315 double parDistanceCxy = 1
e-5;
318 const unsigned int trials = 4;
319 double largerDist[trials] = {0.1, 5., 10., 100.};
321 double covxz,covyz,det;
323 int bestMovementX = 1;
324 int bestMovementY = 1;
325 int bestMovementZ = 1;
330 vector<double>::const_iterator it = vals->begin();
332 ROOT::Math::Minimizer* Gauss3D = ROOT::Math::Factory::CreateMinimizer(
"Minuit2",
"Migrad");
333 Gauss3D->SetErrorDef(1.0);
334 if (internalDebug ==
true) Gauss3D->SetPrintLevel(3);
335 else Gauss3D->SetPrintLevel(0);
338 Gauss3D->SetFunction(_Gauss3DFunc);
340 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\t@@@ START FITTING @@@" << endl;
344 for (
int i = 0;
i < 3;
i++)
346 deltaMean = (double(
i)-1.)*
std::sqrt(*(it+0));
347 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tdeltaMean --> " << deltaMean << endl;
351 Gauss3D->SetVariable(0,
"var x ", *(it+0), parDistanceXY * parDistanceXY);
352 Gauss3D->SetVariable(1,
"var y ", *(it+1), parDistanceXY * parDistanceXY);
353 Gauss3D->SetVariable(2,
"var z ", *(it+2), parDistanceZ * parDistanceZ);
354 Gauss3D->SetVariable(3,
"cov xy", *(it+3), parDistanceCxy);
355 Gauss3D->SetVariable(4,
"dydz ", *(it+4), parDistanceddZ);
356 Gauss3D->SetVariable(5,
"dxdz ", *(it+5), parDistanceddZ);
357 Gauss3D->SetVariable(6,
"mean x", *(it+6)+deltaMean, parDistanceXY);
358 Gauss3D->SetVariable(7,
"mean y", *(it+7), parDistanceXY);
359 Gauss3D->SetVariable(8,
"mean z", *(it+8), parDistanceZ);
362 xPos = Gauss3D->X()[6];
363 yPos = Gauss3D->X()[7];
364 zPos = Gauss3D->X()[8];
367 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->X()[0]) + std::fabs(Gauss3D->X()[1])) / 2.;
368 maxLongLength = nSigmaZ *
std::sqrt(std::fabs(Gauss3D->X()[2]));
371 goodData = Gauss3D->Status();
372 edm = Gauss3D->Edm();
375 else if (
isNotFinite(edm) ==
true) { goodData = -1;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite edm !" << endl; }
376 else for (
unsigned int j = 0;
j < nParams;
j++)
380 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite errors !" << endl;
385 covyz = Gauss3D->X()[4]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[1])) - Gauss3D->X()[5]*Gauss3D->X()[3];
386 covxz = Gauss3D->X()[5]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[0])) - Gauss3D->X()[4]*Gauss3D->X()[3];
388 det = std::fabs(Gauss3D->X()[0]) * (std::fabs(Gauss3D->X()[1])*std::fabs(Gauss3D->X()[2]) - covyz*covyz) -
389 Gauss3D->X()[3] * (Gauss3D->X()[3]*std::fabs(Gauss3D->X()[2]) - covxz*covyz) +
390 covxz * (Gauss3D->X()[3]*covyz - covxz*std::fabs(Gauss3D->X()[1]));
391 if (det < 0.) { goodData = -4;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNegative determinant !" << endl; }
394 if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementX =
i; }
396 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tFound bestMovementX --> " << bestMovementX << endl;
400 for (
int i = 0;
i < 3;
i++)
402 deltaMean = (double(
i)-1.)*
std::sqrt(*(it+1));
403 if (internalDebug ==
true)
405 cout <<
"[Vx3DHLTAnalyzer]::\tdeltaMean --> " << deltaMean << endl;
406 cout <<
"[Vx3DHLTAnalyzer]::\tdeltaMean X --> " << (double(bestMovementX)-1.)*
std::sqrt(*(it+0)) << endl;
411 Gauss3D->SetVariable(0,
"var x ", *(it+0), parDistanceXY * parDistanceXY);
412 Gauss3D->SetVariable(1,
"var y ", *(it+1), parDistanceXY * parDistanceXY);
413 Gauss3D->SetVariable(2,
"var z ", *(it+2), parDistanceZ * parDistanceZ);
414 Gauss3D->SetVariable(3,
"cov xy", *(it+3), parDistanceCxy);
415 Gauss3D->SetVariable(4,
"dydz ", *(it+4), parDistanceddZ);
416 Gauss3D->SetVariable(5,
"dxdz ", *(it+5), parDistanceddZ);
417 Gauss3D->SetVariable(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*
std::sqrt(*(it+0)), parDistanceXY);
418 Gauss3D->SetVariable(7,
"mean y", *(it+7)+deltaMean, parDistanceXY);
419 Gauss3D->SetVariable(8,
"mean z", *(it+8), parDistanceZ);
422 xPos = Gauss3D->X()[6];
423 yPos = Gauss3D->X()[7];
424 zPos = Gauss3D->X()[8];
427 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->X()[0]) + std::fabs(Gauss3D->X()[1])) / 2.;
428 maxLongLength = nSigmaZ *
std::sqrt(std::fabs(Gauss3D->X()[2]));
431 goodData = Gauss3D->Status();
432 edm = Gauss3D->Edm();
435 else if (
isNotFinite(edm) ==
true) { goodData = -1;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite edm !" << endl; }
436 else for (
unsigned int j = 0;
j < nParams;
j++)
440 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite errors !" << endl;
445 covyz = Gauss3D->X()[4]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[1])) - Gauss3D->X()[5]*Gauss3D->X()[3];
446 covxz = Gauss3D->X()[5]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[0])) - Gauss3D->X()[4]*Gauss3D->X()[3];
448 det = std::fabs(Gauss3D->X()[0]) * (std::fabs(Gauss3D->X()[1])*std::fabs(Gauss3D->X()[2]) - covyz*covyz) -
449 Gauss3D->X()[3] * (Gauss3D->X()[3]*std::fabs(Gauss3D->X()[2]) - covxz*covyz) +
450 covxz * (Gauss3D->X()[3]*covyz - covxz*std::fabs(Gauss3D->X()[1]));
451 if (det < 0.) { goodData = -4;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNegative determinant !" << endl; }
454 if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementY =
i; }
456 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tFound bestMovementY --> " << bestMovementY << endl;
460 for (
int i = 0;
i < 3;
i++)
462 deltaMean = (double(
i)-1.)*
std::sqrt(*(it+2));
463 if (internalDebug ==
true)
465 cout <<
"[Vx3DHLTAnalyzer]::\tdeltaMean --> " << deltaMean << endl;
466 cout <<
"[Vx3DHLTAnalyzer]::\tdeltaMean X --> " << (double(bestMovementX)-1.)*
std::sqrt(*(it+0)) << endl;
467 cout <<
"[Vx3DHLTAnalyzer]::\tdeltaMean Y --> " << (double(bestMovementY)-1.)*
std::sqrt(*(it+1)) << endl;
472 Gauss3D->SetVariable(0,
"var x ", *(it+0), parDistanceXY * parDistanceXY);
473 Gauss3D->SetVariable(1,
"var y ", *(it+1), parDistanceXY * parDistanceXY);
474 Gauss3D->SetVariable(2,
"var z ", *(it+2), parDistanceZ * parDistanceZ);
475 Gauss3D->SetVariable(3,
"cov xy", *(it+3), parDistanceCxy);
476 Gauss3D->SetVariable(4,
"dydz ", *(it+4), parDistanceddZ);
477 Gauss3D->SetVariable(5,
"dxdz ", *(it+5), parDistanceddZ);
478 Gauss3D->SetVariable(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*
std::sqrt(*(it+0)), parDistanceXY);
479 Gauss3D->SetVariable(7,
"mean y", *(it+7)+(
double(bestMovementY)-1.)*
std::sqrt(*(it+1)), parDistanceXY);
480 Gauss3D->SetVariable(8,
"mean z", *(it+8)+deltaMean, parDistanceZ);
483 xPos = Gauss3D->X()[6];
484 yPos = Gauss3D->X()[7];
485 zPos = Gauss3D->X()[8];
488 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->X()[0]) + std::fabs(Gauss3D->X()[1])) / 2.;
489 maxLongLength = nSigmaZ *
std::sqrt(std::fabs(Gauss3D->X()[2]));
492 goodData = Gauss3D->Status();
493 edm = Gauss3D->Edm();
496 else if (
isNotFinite(edm) ==
true) { goodData = -1;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite edm !" << endl; }
497 else for (
unsigned int j = 0;
j < nParams;
j++)
501 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite errors !" << endl;
506 covyz = Gauss3D->X()[4]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[1])) - Gauss3D->X()[5]*Gauss3D->X()[3];
507 covxz = Gauss3D->X()[5]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[0])) - Gauss3D->X()[4]*Gauss3D->X()[3];
509 det = std::fabs(Gauss3D->X()[0]) * (std::fabs(Gauss3D->X()[1])*std::fabs(Gauss3D->X()[2]) - covyz*covyz) -
510 Gauss3D->X()[3] * (Gauss3D->X()[3]*std::fabs(Gauss3D->X()[2]) - covxz*covyz) +
511 covxz * (Gauss3D->X()[3]*covyz - covxz*std::fabs(Gauss3D->X()[1]));
512 if (det < 0.) { goodData = -4;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNegative determinant !" << endl; }
515 if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementZ =
i; }
517 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tFound bestMovementZ --> " << bestMovementZ << endl;
522 Gauss3D->SetVariable(0,
"var x ", *(it+0), parDistanceXY * parDistanceXY);
523 Gauss3D->SetVariable(1,
"var y ", *(it+1), parDistanceXY * parDistanceXY);
524 Gauss3D->SetVariable(2,
"var z ", *(it+2), parDistanceZ * parDistanceZ);
525 Gauss3D->SetVariable(3,
"cov xy", *(it+3), parDistanceCxy);
526 Gauss3D->SetVariable(4,
"dydz ", *(it+4), parDistanceddZ);
527 Gauss3D->SetVariable(5,
"dxdz ", *(it+5), parDistanceddZ);
528 Gauss3D->SetVariable(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*
std::sqrt(*(it+0)), parDistanceXY);
529 Gauss3D->SetVariable(7,
"mean y", *(it+7)+(
double(bestMovementY)-1.)*
std::sqrt(*(it+1)), parDistanceXY);
530 Gauss3D->SetVariable(8,
"mean z", *(it+8)+(
double(bestMovementZ)-1.)*
std::sqrt(*(it+2)), parDistanceZ);
533 xPos = Gauss3D->X()[6];
534 yPos = Gauss3D->X()[7];
535 zPos = Gauss3D->X()[8];
538 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->X()[0]) + std::fabs(Gauss3D->X()[1])) / 2.;
539 maxLongLength = nSigmaZ *
std::sqrt(std::fabs(Gauss3D->X()[2]));
542 goodData = Gauss3D->Status();
543 edm = Gauss3D->Edm();
546 else if (
isNotFinite(edm) ==
true) { goodData = -1;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite edm !" << endl; }
547 else for (
unsigned int j = 0;
j < nParams;
j++)
551 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite errors !" << endl;
556 covyz = Gauss3D->X()[4]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[1])) - Gauss3D->X()[5]*Gauss3D->X()[3];
557 covxz = Gauss3D->X()[5]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[0])) - Gauss3D->X()[4]*Gauss3D->X()[3];
559 det = std::fabs(Gauss3D->X()[0]) * (std::fabs(Gauss3D->X()[1])*std::fabs(Gauss3D->X()[2]) - covyz*covyz) -
560 Gauss3D->X()[3] * (Gauss3D->X()[3]*std::fabs(Gauss3D->X()[2]) - covxz*covyz) +
561 covxz * (Gauss3D->X()[3]*covyz - covxz*std::fabs(Gauss3D->X()[1]));
562 if (det < 0.) { goodData = -4;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNegative determinant !" << endl; }
566 for (
unsigned int i = 0;
i < trials;
i++)
568 if ((goodData != 0) && (goodData != -2))
572 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tFIT WITH DIFFERENT PARAMETER DISTANCES - STEP " <<
i+1 << endl;
574 Gauss3D->SetVariable(0,
"var x ", *(it+0), parDistanceXY * parDistanceXY * largerDist[
i]);
575 Gauss3D->SetVariable(1,
"var y ", *(it+1), parDistanceXY * parDistanceXY * largerDist[i]);
576 Gauss3D->SetVariable(2,
"var z ", *(it+2), parDistanceZ * parDistanceZ * largerDist[i]);
577 Gauss3D->SetVariable(3,
"cov xy", *(it+3), parDistanceCxy * largerDist[i]);
578 Gauss3D->SetVariable(4,
"dydz ", *(it+4), parDistanceddZ * largerDist[i]);
579 Gauss3D->SetVariable(5,
"dxdz ", *(it+5), parDistanceddZ * largerDist[i]);
580 Gauss3D->SetVariable(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*std::sqrt(*(it+0)), parDistanceXY * largerDist[i]);
581 Gauss3D->SetVariable(7,
"mean y", *(it+7)+(
double(bestMovementY)-1.)*std::sqrt(*(it+1)), parDistanceXY * largerDist[i]);
582 Gauss3D->SetVariable(8,
"mean z", *(it+8)+(
double(bestMovementZ)-1.)*std::sqrt(*(it+2)), parDistanceZ * largerDist[i]);
585 xPos = Gauss3D->X()[6];
586 yPos = Gauss3D->X()[7];
587 zPos = Gauss3D->X()[8];
590 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->X()[0]) + std::fabs(Gauss3D->X()[1])) / 2.;
591 maxLongLength = nSigmaZ *
std::sqrt(std::fabs(Gauss3D->X()[2]));
594 goodData = Gauss3D->Status();
595 edm = Gauss3D->Edm();
598 else if (
isNotFinite(edm) ==
true) { goodData = -1;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite edm !" << endl; }
599 else for (
unsigned int j = 0;
j < nParams;
j++)
603 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNot finite errors !" << endl;
608 covyz = Gauss3D->X()[4]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[1])) - Gauss3D->X()[5]*Gauss3D->X()[3];
609 covxz = Gauss3D->X()[5]*(std::fabs(Gauss3D->X()[2])-std::fabs(Gauss3D->X()[0])) - Gauss3D->X()[4]*Gauss3D->X()[3];
611 det = std::fabs(Gauss3D->X()[0]) * (std::fabs(Gauss3D->X()[1])*std::fabs(Gauss3D->X()[2]) - covyz*covyz) -
612 Gauss3D->X()[3] * (Gauss3D->X()[3]*std::fabs(Gauss3D->X()[2]) - covxz*covyz) +
613 covxz * (Gauss3D->X()[3]*covyz - covxz*std::fabs(Gauss3D->X()[1]));
614 if (det < 0.) { goodData = -4;
if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tNegative determinant !" << endl; }
620 for (
unsigned int i = 0;
i < nParams;
i++)
622 vals->operator[](
i) = Gauss3D->X()[
i];
623 vals->operator[](
i+nParams) = Gauss3D->Errors()[
i];
636 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true))
638 outputDebugFile <<
"Runnumber " <<
runNumber << endl;
639 outputDebugFile <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
640 outputDebugFile <<
"BeginLumiRange " << beginLumiOfFit << endl;
641 outputDebugFile <<
"EndTimeOfFit " <<
formatTime(endTimeOfFit >> 32) <<
" " << (endTimeOfFit >> 32) << endl;
642 outputDebugFile <<
"EndLumiRange " << endLumiOfFit << endl;
643 outputDebugFile <<
"LumiCounter " << lumiCounter << endl;
644 outputDebugFile <<
"LastLumiOfFit " << lastLumiOfFit << endl;
648 if (ResetType.compare(
"scratch") == 0)
683 goodVxCounter->Reset();
684 statusCounter->Reset();
687 reportSummary->Fill(-1);
688 reportSummaryMap->getTH1()->SetBinContent(1, 1, -1);
699 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tReset issued: scratch" << endl;
700 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true)) outputDebugFile <<
"Reset -scratch- issued\n" << endl;
702 else if (ResetType.compare(
"whole") == 0)
721 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tReset issued: whole" << endl;
722 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true)) outputDebugFile <<
"Reset -whole- issued\n" << endl;
724 else if (ResetType.compare(
"hitCounter") == 0)
728 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tReset issued: hitCounter" << endl;
729 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true)) outputDebugFile <<
"Reset -hitCounter- issued\n" << endl;
737 unsigned int BeginLumiOfFit,
738 unsigned int EndLumiOfFit,
741 stringstream BufferString;
742 BufferString.precision(5);
746 if ((
outputFile.is_open() ==
true) && (vals !=
NULL) && (vals->size() == (nParams-1)*2))
748 vector<double>::const_iterator it = vals->begin();
751 outputFile <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
752 outputFile <<
"EndTimeOfFit " <<
formatTime(endTimeOfFit >> 32) <<
" " << (endTimeOfFit >> 32) << endl;
753 outputFile <<
"LumiRange " << beginLumiOfFit <<
" - " << endLumiOfFit << endl;
759 BufferString << *(it+0);
760 outputFile <<
"X0 " << BufferString.str().c_str() << endl;
761 BufferString.str(
"");
763 BufferString << *(it+1);
764 outputFile <<
"Y0 " << BufferString.str().c_str() << endl;
765 BufferString.str(
"");
767 BufferString << *(it+2);
768 outputFile <<
"Z0 " << BufferString.str().c_str() << endl;
769 BufferString.str(
"");
771 BufferString << *(it+3);
772 outputFile <<
"sigmaZ0 " << BufferString.str().c_str() << endl;
773 BufferString.str(
"");
775 BufferString << *(it+4);
776 outputFile <<
"dxdz " << BufferString.str().c_str() << endl;
777 BufferString.str(
"");
779 BufferString << *(it+5);
780 outputFile <<
"dydz " << BufferString.str().c_str() << endl;
781 BufferString.str(
"");
783 BufferString << *(it+6);
784 outputFile <<
"BeamWidthX " << BufferString.str().c_str() << endl;
785 BufferString.str(
"");
787 BufferString << *(it+7);
788 outputFile <<
"BeamWidthY " << BufferString.str().c_str() << endl;
789 BufferString.str(
"");
791 outputFile <<
"Cov(0,j) " << *(it+8) <<
" 0.0 0.0 0.0 0.0 0.0 0.0" << endl;
792 outputFile <<
"Cov(1,j) 0.0 " << *(it+9) <<
" 0.0 0.0 0.0 0.0 0.0" << endl;
793 outputFile <<
"Cov(2,j) 0.0 0.0 " << *(it+10) <<
" 0.0 0.0 0.0 0.0" << endl;
794 outputFile <<
"Cov(3,j) 0.0 0.0 0.0 " << *(it+11) <<
" 0.0 0.0 0.0" << endl;
795 outputFile <<
"Cov(4,j) 0.0 0.0 0.0 0.0 " << *(it+12) <<
" 0.0 0.0" << endl;
796 outputFile <<
"Cov(5,j) 0.0 0.0 0.0 0.0 0.0 " << *(it+13) <<
" 0.0" << endl;
797 outputFile <<
"Cov(6,j) 0.0 0.0 0.0 0.0 0.0 0.0 " << ((*(it+14)) + (*(it+15)) + 2.*
std::sqrt((*(it+14))*(*(it+15)))) / 4. << endl;
805 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true) && (vals !=
NULL) && (vals->size() == (nParams-1)*2))
807 vector<double>::const_iterator it = vals->begin();
809 outputDebugFile <<
"Runnumber " <<
runNumber << endl;
810 outputDebugFile <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
811 outputDebugFile <<
"EndTimeOfFit " <<
formatTime(endTimeOfFit >> 32) <<
" " << (endTimeOfFit >> 32) << endl;
812 outputDebugFile <<
"LumiRange " << beginLumiOfFit <<
" - " << endLumiOfFit << endl;
813 outputDebugFile <<
"Type " << dataType << endl;
818 BufferString << *(it+0);
819 outputDebugFile <<
"X0 " << BufferString.str().c_str() << endl;
820 BufferString.str(
"");
822 BufferString << *(it+1);
823 outputDebugFile <<
"Y0 " << BufferString.str().c_str() << endl;
824 BufferString.str(
"");
826 BufferString << *(it+2);
827 outputDebugFile <<
"Z0 " << BufferString.str().c_str() << endl;
828 BufferString.str(
"");
830 BufferString << *(it+3);
831 outputDebugFile <<
"sigmaZ0 " << BufferString.str().c_str() << endl;
832 BufferString.str(
"");
834 BufferString << *(it+4);
835 outputDebugFile <<
"dxdz " << BufferString.str().c_str() << endl;
836 BufferString.str(
"");
838 BufferString << *(it+5);
839 outputDebugFile <<
"dydz " << BufferString.str().c_str() << endl;
840 BufferString.str(
"");
842 BufferString << *(it+6);
843 outputDebugFile <<
"BeamWidthX " << BufferString.str().c_str() << endl;
844 BufferString.str(
"");
846 BufferString << *(it+7);
847 outputDebugFile <<
"BeamWidthY " << BufferString.str().c_str() << endl;
848 BufferString.str(
"");
850 outputDebugFile <<
"Cov(0,j) " << *(it+8) <<
" 0.0 0.0 0.0 0.0 0.0 0.0" << endl;
851 outputDebugFile <<
"Cov(1,j) 0.0 " << *(it+9) <<
" 0.0 0.0 0.0 0.0 0.0" << endl;
852 outputDebugFile <<
"Cov(2,j) 0.0 0.0 " << *(it+10) <<
" 0.0 0.0 0.0 0.0" << endl;
853 outputDebugFile <<
"Cov(3,j) 0.0 0.0 0.0 " << *(it+11) <<
" 0.0 0.0 0.0" << endl;
854 outputDebugFile <<
"Cov(4,j) 0.0 0.0 0.0 0.0 " << *(it+12) <<
" 0.0 0.0" << endl;
855 outputDebugFile <<
"Cov(5,j) 0.0 0.0 0.0 0.0 0.0 " << *(it+13) <<
" 0.0" << endl;
856 outputDebugFile <<
"Cov(6,j) 0.0 0.0 0.0 0.0 0.0 0.0 " << ((*(it+14)) + (*(it+15)) + 2.*
std::sqrt((*(it+14))*(*(it+15)))) / 4. << endl;
858 outputDebugFile <<
"EmittanceX 0.0" << endl;
859 outputDebugFile <<
"EmittanceY 0.0" << endl;
860 outputDebugFile <<
"BetaStar 0.0" << endl;
862 outputDebugFile <<
"\n" <<
"Used vertices: " << counterVx <<
"\n" << endl;
869 cout <<
"var x --> " << fitResults[0] <<
" +/- " << fitResults[0+nParams] << endl;
870 cout <<
"var y --> " << fitResults[1] <<
" +/- " << fitResults[1+nParams] << endl;
871 cout <<
"var z --> " << fitResults[2] <<
" +/- " << fitResults[2+nParams] << endl;
872 cout <<
"cov xy --> " << fitResults[3] <<
" +/- " << fitResults[3+nParams] << endl;
873 cout <<
"dydz --> " << fitResults[4] <<
" +/- " << fitResults[4+nParams] << endl;
874 cout <<
"dxdz --> " << fitResults[5] <<
" +/- " << fitResults[5+nParams] << endl;
875 cout <<
"mean x --> " << fitResults[6] <<
" +/- " << fitResults[6+nParams] << endl;
876 cout <<
"mean y --> " << fitResults[7] <<
" +/- " << fitResults[7+nParams] << endl;
877 cout <<
"mean z --> " << fitResults[8] <<
" +/- " << fitResults[8+nParams] << endl;
884 if ((lumiCounter == 0) && (lumiBlock.
luminosityBlock() > lastLumiOfFit))
890 else if ((lumiCounter != 0) && (lumiBlock.
luminosityBlock() >= (beginLumiOfFit+lumiCounter))) lumiCounter++;
891 else reset(
"scratch");
897 stringstream histTitle;
904 lastLumiOfFit = endLumiOfFit;
907 hitCounter->getTH1()->SetBinContent(lastLumiOfFit, (
double)totalHits);
908 hitCounter->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt((
double)totalHits));
912 vector<double> fitResults;
914 fitResults.push_back(Vx_X->getTH1()->GetRMS()*Vx_X->getTH1()->GetRMS());
915 fitResults.push_back(Vx_Y->getTH1()->GetRMS()*Vx_Y->getTH1()->GetRMS());
916 fitResults.push_back(Vx_Z->getTH1()->GetRMS()*Vx_Z->getTH1()->GetRMS());
917 fitResults.push_back(0.0);
918 fitResults.push_back(0.0);
919 fitResults.push_back(0.0);
920 fitResults.push_back(Vx_X->getTH1()->GetMean());
921 fitResults.push_back(Vx_Y->getTH1()->GetMean());
922 fitResults.push_back(Vx_Z->getTH1()->GetMean());
923 for (
unsigned int i = 0;
i < nParams;
i++) fitResults.push_back(0.0);
925 if (internalDebug ==
true)
927 cout <<
"[Vx3DHLTAnalyzer]::\t@@@ Beam Spot parameters - prefit @@@" << endl;
929 printFitParams(fitResults);
932 cout <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
933 cout <<
"EndTimeOfFit " <<
formatTime(endTimeOfFit >> 32) <<
" " << (endTimeOfFit >> 32) << endl;
934 cout <<
"LumiRange " << beginLumiOfFit <<
" - " << endLumiOfFit << endl;
937 goodData = MyFit(&fitResults);
939 if (internalDebug ==
true)
941 cout <<
"[Vx3DHLTAnalyzer]::\t@@@ Beam Spot parameters - postfit @@@" << endl;
943 printFitParams(fitResults);
945 cout <<
"goodData --> " << goodData << endl;
946 cout <<
"Used vertices --> " << counterVx << endl;
951 vals.push_back(fitResults[6]);
952 vals.push_back(fitResults[7]);
953 vals.push_back(fitResults[8]);
954 vals.push_back(
std::sqrt(std::fabs(fitResults[2])));
955 vals.push_back(fitResults[5]);
956 vals.push_back(fitResults[4]);
957 vals.push_back(
std::sqrt(std::fabs(fitResults[0])));
958 vals.push_back(
std::sqrt(std::fabs(fitResults[1])));
960 vals.push_back(
std::pow(fitResults[6+nParams],2.));
961 vals.push_back(
std::pow(fitResults[7+nParams],2.));
962 vals.push_back(
std::pow(fitResults[8+nParams],2.));
963 vals.push_back(
std::pow(std::fabs(fitResults[2+nParams]) / (2.*
std::sqrt(std::fabs(fitResults[2]))),2.));
964 vals.push_back(
std::pow(fitResults[5+nParams],2.));
965 vals.push_back(
std::pow(fitResults[4+nParams],2.));
966 vals.push_back(
std::pow(std::fabs(fitResults[0+nParams]) / (2.*
std::sqrt(std::fabs(fitResults[0]))),2.));
967 vals.push_back(
std::pow(std::fabs(fitResults[1+nParams]) / (2.*
std::sqrt(std::fabs(fitResults[1]))),2.));
969 else for (
unsigned int i = 0;
i < (nParams-1)*2;
i++) vals.push_back(0.0);
975 counterVx = Vx_X->getTH1F()->GetEntries();
981 vals.push_back(Vx_X->getTH1F()->GetMean());
982 vals.push_back(Vx_Y->getTH1F()->GetMean());
983 vals.push_back(Vx_Z->getTH1F()->GetMean());
984 vals.push_back(Vx_Z->getTH1F()->GetRMS());
987 vals.push_back(Vx_X->getTH1F()->GetRMS());
988 vals.push_back(Vx_Y->getTH1F()->GetRMS());
990 vals.push_back(
std::pow(Vx_X->getTH1F()->GetMeanError(),2.));
991 vals.push_back(
std::pow(Vx_Y->getTH1F()->GetMeanError(),2.));
992 vals.push_back(
std::pow(Vx_Z->getTH1F()->GetMeanError(),2.));
993 vals.push_back(
std::pow(Vx_Z->getTH1F()->GetRMSError(),2.));
996 vals.push_back(
std::pow(Vx_X->getTH1F()->GetRMSError(),2.));
997 vals.push_back(
std::pow(Vx_Y->getTH1F()->GetRMSError(),2.));
1002 for (
unsigned int i = 0;
i < (nParams-1)*2;
i++) vals.push_back(0.0);
1025 writeToFile(&vals, beginTimeOfFit, endTimeOfFit, beginLumiOfFit, endLumiOfFit, 3);
1026 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tUsed vertices: " << counterVx << endl;
1028 statusCounter->getTH1()->SetBinContent(lastLumiOfFit, (
double)goodData);
1029 statusCounter->getTH1()->SetBinError(lastLumiOfFit, 1
e-3);
1035 histTitle <<
"Ongoing: fitted lumis " << beginLumiOfFit <<
" - " << endLumiOfFit;
1040 if (goodData == -2) histTitle <<
"Ongoing: not enough evts (" << lumiCounter <<
" - " <<
maxLumiIntegration <<
" lumis)";
1041 else histTitle <<
"Ongoing: temporary problems (" << lumiCounter <<
" - " << maxLumiIntegration <<
" lumis)";
1043 if (lumiCounter >= maxLumiIntegration)
1045 statusCounter->getTH1()->SetBinContent(lastLumiOfFit, -5);
1046 statusCounter->getTH1()->SetBinError(lastLumiOfFit, 1
e-3);
1049 else reset(
"hitCounter");
1052 reportSummary->Fill((numberFits != 0 ? ((
double)numberGoodFits) / ((
double)numberFits) : -1));
1053 reportSummaryMap->getTH1()->SetBinContent(1, 1, (numberFits != 0 ? ((
double)numberGoodFits) / ((
double)numberFits) : -1));
1055 fitResults->setAxisTitle(histTitle.str().c_str(), 1);
1057 fitResults->setBinContent(1, 9, vals[0]);
1058 fitResults->setBinContent(1, 8, vals[1]);
1059 fitResults->setBinContent(1, 7, vals[2]);
1060 fitResults->setBinContent(1, 6, vals[3]);
1061 fitResults->setBinContent(1, 5, vals[4]);
1062 fitResults->setBinContent(1, 4, vals[5]);
1063 fitResults->setBinContent(1, 3, vals[6]);
1064 fitResults->setBinContent(1, 2, vals[7]);
1065 fitResults->setBinContent(1, 1, counterVx);
1067 fitResults->setBinContent(2, 9,
std::sqrt(vals[8]));
1068 fitResults->setBinContent(2, 8,
std::sqrt(vals[9]));
1069 fitResults->setBinContent(2, 7,
std::sqrt(vals[10]));
1070 fitResults->setBinContent(2, 6,
std::sqrt(vals[11]));
1071 fitResults->setBinContent(2, 5,
std::sqrt(vals[12]));
1072 fitResults->setBinContent(2, 4,
std::sqrt(vals[13]));
1073 fitResults->setBinContent(2, 3,
std::sqrt(vals[14]));
1074 fitResults->setBinContent(2, 2,
std::sqrt(vals[15]));
1075 fitResults->setBinContent(2, 1,
std::sqrt(counterVx));
1078 TF1* myLinFit =
new TF1(
"myLinFit",
"[0] + [1]*x", mXlumi->getTH1()->GetXaxis()->GetXmin(), mXlumi->getTH1()->GetXaxis()->GetXmax());
1079 myLinFit->SetLineColor(2);
1080 myLinFit->SetLineWidth(2);
1081 myLinFit->SetParName(0,
"Inter.");
1082 myLinFit->SetParName(1,
"Slope");
1084 mXlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[0]);
1085 mXlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[8]));
1086 myLinFit->SetParameter(0, mXlumi->getTH1()->GetMean(2));
1087 myLinFit->SetParameter(1, 0.0);
1088 mXlumi->getTH1()->Fit(myLinFit,
"QR");
1090 mYlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[1]);
1091 mYlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[9]));
1092 myLinFit->SetParameter(0, mYlumi->getTH1()->GetMean(2));
1093 myLinFit->SetParameter(1, 0.0);
1094 mYlumi->getTH1()->Fit(myLinFit,
"QR");
1096 mZlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[2]);
1097 mZlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[10]));
1098 myLinFit->SetParameter(0, mZlumi->getTH1()->GetMean(2));
1099 myLinFit->SetParameter(1, 0.0);
1100 mZlumi->getTH1()->Fit(myLinFit,
"QR");
1102 sXlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[6]);
1103 sXlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[14]));
1104 myLinFit->SetParameter(0, sXlumi->getTH1()->GetMean(2));
1105 myLinFit->SetParameter(1, 0.0);
1106 sXlumi->getTH1()->Fit(myLinFit,
"QR");
1108 sYlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[7]);
1109 sYlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[15]));
1110 myLinFit->SetParameter(0, sYlumi->getTH1()->GetMean(2));
1111 myLinFit->SetParameter(1, 0.0);
1112 sYlumi->getTH1()->Fit(myLinFit,
"QR");
1114 sZlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[3]);
1115 sZlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[11]));
1116 myLinFit->SetParameter(0, sZlumi->getTH1()->GetMean(2));
1117 myLinFit->SetParameter(1, 0.0);
1118 sZlumi->getTH1()->Fit(myLinFit,
"QR");
1120 dxdzlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[4]);
1121 dxdzlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[12]));
1122 myLinFit->SetParameter(0, dxdzlumi->getTH1()->GetMean(2));
1123 myLinFit->SetParameter(1, 0.0);
1124 dxdzlumi->getTH1()->Fit(myLinFit,
"QR");
1126 dydzlumi->getTH1()->SetBinContent(lastLumiOfFit, vals[5]);
1127 dydzlumi->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt(vals[13]));
1128 myLinFit->SetParameter(0, dydzlumi->getTH1()->GetMean(2));
1129 myLinFit->SetParameter(1, 0.0);
1130 dydzlumi->getTH1()->Fit(myLinFit,
"QR");
1135 TF1* myExpFit =
new TF1(
"myExpFit",
"[0]*exp(-x/[1])", hitCounter->getTH1()->GetXaxis()->GetXmin(), hitCounter->getTH1()->GetXaxis()->GetXmax());
1136 myExpFit->SetLineColor(2);
1137 myExpFit->SetLineWidth(2);
1138 myExpFit->SetParName(0,
"Ampli.");
1139 myExpFit->SetParName(1,
"#tau");
1141 myExpFit->SetParameter(0, hitCounter->getTH1()->GetMaximum());
1143 hitCounter->getTH1()->Fit(myExpFit,
"QR");
1145 goodVxCounter->getTH1()->SetBinContent(lastLumiOfFit, (
double)counterVx);
1146 goodVxCounter->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt((
double)counterVx));
1148 myExpFit->SetParameter(0, goodVxCounter->getTH1()->GetMaximum());
1150 goodVxCounter->getTH1()->Fit(myExpFit,
"QR");
1158 fitResults->setAxisTitle(histTitle.str().c_str(), 1);
1159 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true))
1161 outputDebugFile <<
"\n" <<
"Runnumber " <<
runNumber << endl;
1162 outputDebugFile <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
1163 outputDebugFile <<
"BeginLumiRange " << beginLumiOfFit << endl;
1164 outputDebugFile << histTitle.str().c_str() <<
"\n" << endl;
1169 histTitle <<
"Ongoing: no ongoing fits";
1170 fitResults->setAxisTitle(histTitle.str().c_str(), 1);
1171 if ((
debugMode ==
true) && (outputDebugFile.is_open() ==
true)) outputDebugFile << histTitle.str().c_str() <<
"\n" << endl;
1175 hitCounter->getTH1()->SetBinContent(endLumiOfFit, (
double)totalHits);
1176 hitCounter->getTH1()->SetBinError(endLumiOfFit,
std::sqrt((
double)totalHits));
1181 if (internalDebug ==
true)
cout <<
"[Vx3DHLTAnalyzer]::\tHistogram title: " << histTitle.str() << endl;
1193 Vx_X->setAxisTitle(
"Entries [#]",2);
1194 Vx_Y->setAxisTitle(
"Primary Vertices Y [cm]",1);
1195 Vx_Y->setAxisTitle(
"Entries [#]",2);
1196 Vx_Z->setAxisTitle(
"Primary Vertices Z [cm]",1);
1197 Vx_Z->setAxisTitle(
"Entries [#]",2);
1199 Vx_X_Cum = ibooker.
book1D(
"H - vertex x cum",
"Primary Vertex X Distribution (Cumulative)",
int(rint(
xRange/
xStep)), -
xRange/2.,
xRange/2.);
1200 Vx_Y_Cum = ibooker.
book1D(
"H - vertex y cum",
"Primary Vertex Y Distribution (Cumulative)",
int(rint(
yRange/
yStep)), -
yRange/2.,
yRange/2.);
1201 Vx_Z_Cum = ibooker.
book1D(
"H - vertex z cum",
"Primary Vertex Z Distribution (Cumulative)",
int(rint(
zRange/
zStep)), -
zRange/2.,
zRange/2.);
1203 Vx_X_Cum->setAxisTitle(
"Entries [#]",2);
1204 Vx_Y_Cum->setAxisTitle(
"Primary Vertices Y [cm]",1);
1205 Vx_Y_Cum->setAxisTitle(
"Entries [#]",2);
1206 Vx_Z_Cum->setAxisTitle(
"Primary Vertices Z [cm]",1);
1207 Vx_Z_Cum->setAxisTitle(
"Entries [#]",2);
1210 mYlumi = ibooker.
book1D(
"B - muY vs lumi",
"#mu_{y} vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1211 mZlumi = ibooker.
book1D(
"B - muZ vs lumi",
"#mu_{z} vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1213 mXlumi->setAxisTitle(
"#mu_{x} [cm]",2);
1214 mXlumi->getTH1()->SetOption(
"E1");
1215 mYlumi->setAxisTitle(
"Lumisection [#]",1);
1216 mYlumi->setAxisTitle(
"#mu_{y} [cm]",2);
1217 mYlumi->getTH1()->SetOption(
"E1");
1218 mZlumi->setAxisTitle(
"Lumisection [#]",1);
1219 mZlumi->setAxisTitle(
"#mu_{z} [cm]",2);
1220 mZlumi->getTH1()->SetOption(
"E1");
1222 sXlumi = ibooker.
book1D(
"C - sigmaX vs lumi",
"#sigma_{x} vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1223 sYlumi = ibooker.
book1D(
"C - sigmaY vs lumi",
"#sigma_{y} vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1224 sZlumi = ibooker.
book1D(
"C - sigmaZ vs lumi",
"#sigma_{z} vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1226 sXlumi->setAxisTitle(
"#sigma_{x} [cm]",2);
1227 sXlumi->getTH1()->SetOption(
"E1");
1228 sYlumi->setAxisTitle(
"Lumisection [#]",1);
1229 sYlumi->setAxisTitle(
"#sigma_{y} [cm]",2);
1230 sYlumi->getTH1()->SetOption(
"E1");
1231 sZlumi->setAxisTitle(
"Lumisection [#]",1);
1232 sZlumi->setAxisTitle(
"#sigma_{z} [cm]",2);
1233 sZlumi->getTH1()->SetOption(
"E1");
1235 dxdzlumi = ibooker.
book1D(
"D - dxdz vs lumi",
"dX/dZ vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1236 dydzlumi = ibooker.
book1D(
"D - dydz vs lumi",
"dY/dZ vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1238 dxdzlumi->setAxisTitle(
"dX/dZ [rad]",2);
1239 dxdzlumi->getTH1()->SetOption(
"E1");
1240 dydzlumi->setAxisTitle(
"Lumisection [#]",1);
1241 dydzlumi->setAxisTitle(
"dY/dZ [rad]",2);
1242 dydzlumi->getTH1()->SetOption(
"E1");
1248 Vx_ZX->setAxisTitle(
"Primary Vertices X [cm]",2);
1249 Vx_ZX->setAxisTitle(
"Entries [#]",3);
1250 Vx_ZY->setAxisTitle(
"Primary Vertices Z [cm]",1);
1251 Vx_ZY->setAxisTitle(
"Primary Vertices Y [cm]",2);
1252 Vx_ZY->setAxisTitle(
"Entries [#]",3);
1253 Vx_XY->setAxisTitle(
"Primary Vertices X [cm]",1);
1254 Vx_XY->setAxisTitle(
"Primary Vertices Y [cm]",2);
1255 Vx_XY->setAxisTitle(
"Entries [#]",3);
1261 Vx_ZX_Cum->setAxisTitle(
"Primary Vertices X [cm]",2);
1262 Vx_ZX_Cum->setAxisTitle(
"Entries [#]",3);
1263 Vx_ZY_Cum->setAxisTitle(
"Primary Vertices Z [cm]",1);
1264 Vx_ZY_Cum->setAxisTitle(
"Primary Vertices Y [cm]",2);
1265 Vx_ZY_Cum->setAxisTitle(
"Entries [#]",3);
1266 Vx_XY_Cum->setAxisTitle(
"Primary Vertices X [cm]",1);
1267 Vx_XY_Cum->setAxisTitle(
"Primary Vertices Y [cm]",2);
1268 Vx_XY_Cum->setAxisTitle(
"Entries [#]",3);
1270 hitCounter = ibooker.
book1D(
"J - pixelHits vs lumi",
"# Pixel-Hits vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1272 hitCounter->setAxisTitle(
"Pixel-Hits [#]",2);
1273 hitCounter->getTH1()->SetOption(
"E1");
1275 goodVxCounter = ibooker.
book1D(
"I - good vertices vs lumi",
"# Good vertices vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1277 goodVxCounter->setAxisTitle(
"Good vertices [#]",2);
1278 goodVxCounter->getTH1()->SetOption(
"E1");
1280 statusCounter = ibooker.
book1D(
"K - app status vs lumi",
"Status vs. Lumisection", nLumiXaxisRange, 0.5, ((
double)nLumiXaxisRange)+0.5);
1282 statusCounter->setAxisTitle(
"App. status [0 = OK]",2);
1283 statusCounter->getTH1()->SetOption(
"E1");
1285 fitResults = ibooker.
book2D(
"A - fit results",
"Results of Beam Spot Fit", 2, 0., 2., 9, 0., 9.);
1287 fitResults->setBinLabel(9,
"X[cm]", 2);
1288 fitResults->setBinLabel(8,
"Y[cm]", 2);
1289 fitResults->setBinLabel(7,
"Z[cm]", 2);
1290 fitResults->setBinLabel(6,
"#sigma_{Z}[cm]", 2);
1291 fitResults->setBinLabel(5,
"#frac{dX}{dZ}[rad]", 2);
1292 fitResults->setBinLabel(4,
"#frac{dY}{dZ}[rad]", 2);
1293 fitResults->setBinLabel(3,
"#sigma_{X}[cm]", 2);
1294 fitResults->setBinLabel(2,
"#sigma_{Y}[cm]", 2);
1295 fitResults->setBinLabel(1,
"Vtx[#]", 2);
1296 fitResults->setBinLabel(1,
"Value", 1);
1297 fitResults->setBinLabel(2,
"Error (stat)", 1);
1298 fitResults->getTH1()->SetOption(
"text");
1303 reportSummary = ibooker.
bookFloat(
"reportSummary");
1304 reportSummary->
Fill(-1);
1305 reportSummaryMap = ibooker.
book2D(
"reportSummaryMap",
"Pixel-Vertices Beam Spot: % Good Fits", 1, 0., 1., 1, 0., 1.);
1306 reportSummaryMap->
getTH1()->SetBinContent(1, 1, -1);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
int MyFit(std::vector< double > *vals)
data_type const * const_iterator
Timestamp const & beginTime() const
unsigned int HitCounter(const edm::Event &iEvent)
double Gauss3DFunc(const double *par)
void writeToFile(std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
LuminosityBlockNumber_t luminosityBlock() const
T x() const
Cartesian x coordinate.
void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
static ELstring formatTime(const time_t t)
Vx3DHLTAnalyzer(const edm::ParameterSet &)
std::string formatTime(const time_t &t)
Timestamp const & endTime() const
MonitorElement * book1D(Args &&...args)
LuminosityBlock const & getLuminosityBlock() const
void reset(std::string ResetType)
unsigned long long TimeValue_t
void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
std::vector< std::vector< double > > tmp
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void printFitParams(const std::vector< double > &fitResults)
static std::atomic< unsigned int > counter
MonitorElement * bookFloat(Args &&...args)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void reset(double vett[256])
TimeValue_t value() const
Power< A, B >::type pow(const A &a, const B &b)