30 #include <TFitterMinuit.h>
56 nLumiReset = iConfig.
getParameter<
unsigned int>(
"nLumiReset");
58 minNentries = iConfig.
getParameter<
unsigned int>(
"minNentries");
89 if (debugMode ==
true)
91 stringstream debugFile;
94 if (outputDebugFile.is_open() ==
true) outputDebugFile.close();
95 tmp.erase(strlen(
fileName.c_str())-4,4);
96 debugFile << tmp.c_str() <<
"_Run" << iEvent.
id().
run() <<
".txt";
97 outputDebugFile.open(debugFile.str().c_str(),
ios::out);
98 outputDebugFile.close();
99 outputDebugFile.open(debugFile.str().c_str(), ios::app);
104 else if (beginTimeOfFit != 0)
106 totalHits += HitCounter(iEvent);
108 for (vector<Vertex>::const_iterator it3DVx = Vx3DCollection->begin(); it3DVx != Vx3DCollection->end(); it3DVx++)
110 if ((it3DVx->isValid() ==
true) &&
111 (it3DVx->isFake() ==
false) &&
112 (it3DVx->ndof() >= minVxDoF))
114 for (i = 0; i <
DIM; i++)
116 for (j = 0; j <
DIM; j++)
126 if ((i == DIM) && (det > 0.))
128 MyVertex.
x = it3DVx->x();
129 MyVertex.
y = it3DVx->y();
130 MyVertex.
z = it3DVx->z();
133 else if (internalDebug ==
true)
135 cout <<
"Vertex discarded !" << endl;
136 for (i = 0; i <
DIM; i++)
137 for (j = 0; j <
DIM; j++)
138 cout <<
"(i,j) --> " << i <<
"," << j <<
" --> " << MyVertex.
Covariance[i][j] << endl;
141 Vx_X->Fill(it3DVx->x());
142 Vx_Y->Fill(it3DVx->y());
143 Vx_Z->Fill(it3DVx->z());
145 Vx_ZX->Fill(it3DVx->z(), it3DVx->x());
146 Vx_ZY->Fill(it3DVx->z(), it3DVx->y());
147 Vx_XY->Fill(it3DVx->x(), it3DVx->y());
157 iEvent.
getByLabel(
"siPixelRecHits",rechitspixel);
159 unsigned int counter = 0;
171 strftime(ts,
sizeof(ts),
"%Y.%m.%d %H:%M:%S %Z", gmtime(&t));
177 void Gauss3DFunc(
int& ,
double* ,
double& fval,
double* par,
int )
206 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];
207 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];
211 K[0][0] = std::fabs(par[0]);
212 K[1][1] = std::fabs(par[1]);
213 K[2][2] = std::fabs(par[2]);
214 K[0][1] = K[1][0] = par[3];
215 K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3];
216 K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3];
219 det = K[0][0]*(K[1][1]*K[2][2] - K[1][2]*K[1][2]) -
220 K[0][1]*(K[0][1]*K[2][2] - K[0][2]*K[1][2]) +
221 K[0][2]*(K[0][1]*K[1][2] - K[0][2]*K[1][1]);
223 M[0][0] = (K[1][1]*K[2][2] - K[1][2]*K[1][2]) / det;
224 M[1][1] = (K[0][0]*K[2][2] - K[0][2]*K[0][2]) / det;
225 M[2][2] = (K[0][0]*K[1][1] - K[0][1]*K[0][1]) / det;
226 M[0][1] = M[1][0] = (K[0][2]*K[1][2] - K[0][1]*K[2][2]) / det;
227 M[1][2] = M[2][1] = (K[0][2]*K[0][1] - K[1][2]*K[0][0]) / det;
228 M[0][2] = M[2][0] = (K[0][1]*K[1][2] - K[0][2]*K[1][1]) / det;
252 unsigned int nParams = 9;
254 if ((vals !=
NULL) && (vals->size() == nParams*2))
256 double nSigmaXY = 100.;
257 double nSigmaZ = 100.;
258 double varFactor = 4./25.;
259 double parDistanceXY = 0.005;
260 double parDistanceZ = 0.5;
261 double parDistanceddZ = 1
e-3;
262 double parDistanceCxy = 1
e-5;
263 double bestEdm = 1
e-1;
265 const unsigned int trials = 4;
266 double largerDist[trials] = {0.1, 5., 10., 100.};
268 double covxz,covyz,det;
270 int bestMovementX = 1;
271 int bestMovementY = 1;
272 int bestMovementZ = 1;
276 double amin,errdef,edm;
279 vector<double>::const_iterator it = vals->begin();
281 TFitterMinuit* Gauss3D =
new TFitterMinuit(nParams);
282 if (internalDebug ==
true) Gauss3D->SetPrintLevel(3);
283 else Gauss3D->SetPrintLevel(0);
288 if (internalDebug ==
true)
cout <<
"\n@@@ START FITTING @@@" << endl;
292 for (
int i = 0;
i < 3;
i++)
294 deltaMean = (double(
i)-1.)*
std::sqrt((*(it+0))*varFactor);
295 if (internalDebug ==
true)
cout <<
"deltaMean --> " << deltaMean << endl;
301 Gauss3D->SetParameter(0,
"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
302 Gauss3D->SetParameter(1,
"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
303 Gauss3D->SetParameter(2,
"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
304 Gauss3D->SetParameter(3,
"cov xy", *(it+3), parDistanceCxy, 0., 0.);
305 Gauss3D->SetParameter(4,
"dydz ", *(it+4), parDistanceddZ, 0., 0.);
306 Gauss3D->SetParameter(5,
"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
307 Gauss3D->SetParameter(6,
"mean x", *(it+6)+deltaMean, parDistanceXY, 0., 0.);
308 Gauss3D->SetParameter(7,
"mean y", *(it+7), parDistanceXY, 0., 0.);
309 Gauss3D->SetParameter(8,
"mean z", *(it+8), parDistanceZ, 0., 0.);
312 xPos = Gauss3D->GetParameter(6);
313 yPos = Gauss3D->GetParameter(7);
314 zPos = Gauss3D->GetParameter(8);
317 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
320 goodData = Gauss3D->ExecuteCommand(
"MIGRAD",arglist,2);
321 Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
323 if (
counterVx < minNentries) goodData = -2;
324 else if (
std::isnan(edm) ==
true) goodData = -1;
325 else for (
unsigned int j = 0;
j < nParams;
j++)
if (
std::isnan(Gauss3D->GetParError(
j)) ==
true) { goodData = -1;
break; }
328 covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
329 covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
331 det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
332 Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
333 covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
334 if (det < 0.) { goodData = -1;
if (internalDebug ==
true)
cout <<
"Negative determinant !" << endl; }
337 if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementX =
i; }
339 if (internalDebug ==
true)
cout <<
"Found bestMovementX --> " << bestMovementX << endl;
343 for (
int i = 0;
i < 3;
i++)
345 deltaMean = (double(
i)-1.)*
std::sqrt((*(it+1))*varFactor);
346 if (internalDebug ==
true)
348 cout <<
"deltaMean --> " << deltaMean << endl;
349 cout <<
"deltaMean X --> " << (double(bestMovementX)-1.)*
std::sqrt((*(it+0))*varFactor) << endl;
356 Gauss3D->SetParameter(0,
"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
357 Gauss3D->SetParameter(1,
"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
358 Gauss3D->SetParameter(2,
"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
359 Gauss3D->SetParameter(3,
"cov xy", *(it+3), parDistanceCxy, 0., 0.);
360 Gauss3D->SetParameter(4,
"dydz ", *(it+4), parDistanceddZ, 0., 0.);
361 Gauss3D->SetParameter(5,
"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
362 Gauss3D->SetParameter(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*
std::sqrt((*(it+0))*varFactor), parDistanceXY, 0., 0.);
363 Gauss3D->SetParameter(7,
"mean y", *(it+7)+deltaMean, parDistanceXY, 0., 0.);
364 Gauss3D->SetParameter(8,
"mean z", *(it+8), parDistanceZ, 0., 0.);
367 xPos = Gauss3D->GetParameter(6);
368 yPos = Gauss3D->GetParameter(7);
369 zPos = Gauss3D->GetParameter(8);
372 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
375 goodData = Gauss3D->ExecuteCommand(
"MIGRAD",arglist,2);
376 Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
378 if (
counterVx < minNentries) goodData = -2;
379 else if (
std::isnan(edm) ==
true) goodData = -1;
380 else for (
unsigned int j = 0;
j < nParams;
j++)
if (
std::isnan(Gauss3D->GetParError(
j)) ==
true) { goodData = -1;
break; }
383 covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
384 covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
386 det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
387 Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
388 covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
389 if (det < 0.) { goodData = -1;
if (internalDebug ==
true)
cout <<
"Negative determinant !" << endl; }
392 if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementY =
i; }
394 if (internalDebug ==
true)
cout <<
"Found bestMovementY --> " << bestMovementY << endl;
398 for (
int i = 0;
i < 3;
i++)
400 deltaMean = (double(
i)-1.)*
std::sqrt(*(it+2));
401 if (internalDebug ==
true)
403 cout <<
"deltaMean --> " << deltaMean << endl;
404 cout <<
"deltaMean X --> " << (double(bestMovementX)-1.)*
std::sqrt((*(it+0))*varFactor) << endl;
405 cout <<
"deltaMean Y --> " << (double(bestMovementY)-1.)*
std::sqrt((*(it+1))*varFactor) << endl;
412 Gauss3D->SetParameter(0,
"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
413 Gauss3D->SetParameter(1,
"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
414 Gauss3D->SetParameter(2,
"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
415 Gauss3D->SetParameter(3,
"cov xy", *(it+3), parDistanceCxy, 0., 0.);
416 Gauss3D->SetParameter(4,
"dydz ", *(it+4), parDistanceddZ, 0., 0.);
417 Gauss3D->SetParameter(5,
"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
418 Gauss3D->SetParameter(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*
std::sqrt((*(it+0))*varFactor), parDistanceXY, 0., 0.);
419 Gauss3D->SetParameter(7,
"mean y", *(it+7)+(
double(bestMovementY)-1.)*
std::sqrt((*(it+1))*varFactor), parDistanceXY, 0., 0.);
420 Gauss3D->SetParameter(8,
"mean z", *(it+8)+deltaMean, parDistanceZ, 0., 0.);
423 xPos = Gauss3D->GetParameter(6);
424 yPos = Gauss3D->GetParameter(7);
425 zPos = Gauss3D->GetParameter(8);
428 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
431 goodData = Gauss3D->ExecuteCommand(
"MIGRAD",arglist,2);
432 Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
434 if (
counterVx < minNentries) goodData = -2;
435 else if (
std::isnan(edm) ==
true) goodData = -1;
436 else for (
unsigned int j = 0;
j < nParams;
j++)
if (
std::isnan(Gauss3D->GetParError(
j)) ==
true) { goodData = -1;
break; }
439 covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
440 covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
442 det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
443 Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
444 covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
445 if (det < 0.) { goodData = -1;
if (internalDebug ==
true)
cout <<
"Negative determinant !" << endl; }
448 if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementZ =
i; }
450 if (internalDebug ==
true)
cout <<
"Found bestMovementZ --> " << bestMovementZ << endl;
457 Gauss3D->SetParameter(0,
"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
458 Gauss3D->SetParameter(1,
"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
459 Gauss3D->SetParameter(2,
"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
460 Gauss3D->SetParameter(3,
"cov xy", *(it+3), parDistanceCxy, 0., 0.);
461 Gauss3D->SetParameter(4,
"dydz ", *(it+4), parDistanceddZ, 0., 0.);
462 Gauss3D->SetParameter(5,
"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
463 Gauss3D->SetParameter(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*
std::sqrt((*(it+0))*varFactor), parDistanceXY, 0., 0.);
464 Gauss3D->SetParameter(7,
"mean y", *(it+7)+(
double(bestMovementY)-1.)*
std::sqrt((*(it+1))*varFactor), parDistanceXY, 0., 0.);
465 Gauss3D->SetParameter(8,
"mean z", *(it+8)+(
double(bestMovementZ)-1.)*
std::sqrt(*(it+2)), parDistanceZ, 0., 0.);
468 xPos = Gauss3D->GetParameter(6);
469 yPos = Gauss3D->GetParameter(7);
470 zPos = Gauss3D->GetParameter(8);
473 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
476 goodData = Gauss3D->ExecuteCommand(
"MIGRAD",arglist,2);
477 Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
479 if (
counterVx < minNentries) goodData = -2;
480 else if (
std::isnan(edm) ==
true) goodData = -1;
481 else for (
unsigned int j = 0;
j < nParams;
j++)
if (
std::isnan(Gauss3D->GetParError(
j)) ==
true) { goodData = -1;
break; }
484 covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
485 covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
487 det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
488 Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
489 covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
490 if (det < 0.) { goodData = -1;
if (internalDebug ==
true)
cout <<
"Negative determinant !" << endl; }
496 for (
unsigned int i = 0;
i < trials;
i++)
498 if ((goodData != 0) && (goodData != -2))
502 if (internalDebug ==
true)
cout <<
"FIT WITH DIFFERENT PARAMETER DISTANCES - STEP " <<
i+1 << endl;
504 Gauss3D->SetParameter(0,
"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY * largerDist[
i], 0, 0);
505 Gauss3D->SetParameter(1,
"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY * largerDist[i], 0, 0);
506 Gauss3D->SetParameter(2,
"var z ", *(it+2), parDistanceZ*parDistanceZ * largerDist[i], 0, 0);
507 Gauss3D->SetParameter(3,
"cov xy", *(it+3), parDistanceCxy * largerDist[i], 0, 0);
508 Gauss3D->SetParameter(4,
"dydz ", *(it+4), parDistanceddZ * largerDist[i], 0, 0);
509 Gauss3D->SetParameter(5,
"dxdz ", *(it+5), parDistanceddZ * largerDist[i], 0, 0);
510 Gauss3D->SetParameter(6,
"mean x", *(it+6)+(
double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor), parDistanceXY * largerDist[i], 0, 0);
511 Gauss3D->SetParameter(7,
"mean y", *(it+7)+(
double(bestMovementY)-1.)*std::sqrt((*(it+1))*varFactor), parDistanceXY * largerDist[i], 0, 0);
512 Gauss3D->SetParameter(8,
"mean z", *(it+8)+(
double(bestMovementZ)-1.)*std::sqrt(*(it+2)), parDistanceZ * largerDist[i], 0, 0);
515 xPos = Gauss3D->GetParameter(6);
516 yPos = Gauss3D->GetParameter(7);
517 zPos = Gauss3D->GetParameter(8);
520 maxTransRadius = nSigmaXY *
std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
523 goodData = Gauss3D->ExecuteCommand(
"MIGRAD",arglist,2);
524 Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
526 if (
counterVx < minNentries) goodData = -2;
527 else if (
std::isnan(edm) ==
true) goodData = -1;
528 else for (
unsigned int j = 0;
j < nParams;
j++)
if (
std::isnan(Gauss3D->GetParError(
j)) ==
true) { goodData = -1;
break; }
531 covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
532 covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
534 det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
535 Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
536 covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
537 if (det < 0.) { goodData = -1;
if (internalDebug ==
true)
cout <<
"Negative determinant !" << endl; }
543 for (
unsigned int i = 0;
i < nParams;
i++)
545 vals->operator[](
i) = Gauss3D->GetParameter(
i);
546 vals->operator[](
i+nParams) = Gauss3D->GetParError(
i);
559 if (ResetType.compare(
"scratch") == 0)
586 hitCountHistory->Reset();
587 goodVxCounter->Reset();
588 goodVxCountHistory->Reset();
591 reportSummary->Fill(0.);
592 reportSummaryMap->Fill(0.5, 0.5, 0.);
597 lumiCounterHisto = 0;
604 else if (ResetType.compare(
"whole") == 0)
617 lumiCounterHisto = 0;
624 else if (ResetType.compare(
"partial") == 0)
639 else if (ResetType.compare(
"nohisto") == 0)
644 lumiCounterHisto = 0;
651 else if (ResetType.compare(
"hitCounter") == 0)
659 unsigned int BeginLumiOfFit,
660 unsigned int EndLumiOfFit,
663 stringstream BufferString;
664 BufferString.precision(5);
668 if ((
outputFile.is_open() ==
true) && (vals !=
NULL) && (vals->size() == 8*2))
670 vector<double>::const_iterator it = vals->begin();
673 outputFile <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
674 outputFile <<
"EndTimeOfFit " <<
formatTime(endTimeOfFit >> 32) <<
" " << (endTimeOfFit >> 32) << endl;
675 outputFile <<
"LumiRange " << beginLumiOfFit <<
" - " << endLumiOfFit << endl;
681 BufferString << *(it+0);
682 outputFile <<
"X0 " << BufferString.str().c_str() << endl;
683 BufferString.str(
"");
685 BufferString << *(it+1);
686 outputFile <<
"Y0 " << BufferString.str().c_str() << endl;
687 BufferString.str(
"");
689 BufferString << *(it+2);
690 outputFile <<
"Z0 " << BufferString.str().c_str() << endl;
691 BufferString.str(
"");
693 BufferString << *(it+3);
694 outputFile <<
"sigmaZ0 " << BufferString.str().c_str() << endl;
695 BufferString.str(
"");
697 BufferString << *(it+4);
698 outputFile <<
"dxdz " << BufferString.str().c_str() << endl;
699 BufferString.str(
"");
701 BufferString << *(it+5);
702 outputFile <<
"dydz " << BufferString.str().c_str() << endl;
703 BufferString.str(
"");
705 BufferString << *(it+6);
706 outputFile <<
"BeamWidthX " << BufferString.str().c_str() << endl;
707 BufferString.str(
"");
709 BufferString << *(it+7);
710 outputFile <<
"BeamWidthY " << BufferString.str().c_str() << endl;
711 BufferString.str(
"");
713 outputFile <<
"Cov(0,j) " << *(it+8) <<
" 0.0 0.0 0.0 0.0 0.0 0.0" << endl;
714 outputFile <<
"Cov(1,j) 0.0 " << *(it+9) <<
" 0.0 0.0 0.0 0.0 0.0" << endl;
715 outputFile <<
"Cov(2,j) 0.0 0.0 " << *(it+10) <<
" 0.0 0.0 0.0 0.0" << endl;
716 outputFile <<
"Cov(3,j) 0.0 0.0 0.0 " << *(it+11) <<
" 0.0 0.0 0.0" << endl;
717 outputFile <<
"Cov(4,j) 0.0 0.0 0.0 0.0 " << *(it+12) <<
" 0.0 0.0" << endl;
718 outputFile <<
"Cov(5,j) 0.0 0.0 0.0 0.0 0.0 " << *(it+13) <<
" 0.0" << endl;
719 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;
727 if ((debugMode ==
true) && (outputDebugFile.is_open() ==
true) && (vals !=
NULL) && (vals->size() == 8*2))
729 vector<double>::const_iterator it = vals->begin();
731 outputDebugFile <<
"Runnumber " <<
runNumber << endl;
732 outputDebugFile <<
"BeginTimeOfFit " <<
formatTime(beginTimeOfFit >> 32) <<
" " << (beginTimeOfFit >> 32) << endl;
733 outputDebugFile <<
"EndTimeOfFit " <<
formatTime(endTimeOfFit >> 32) <<
" " << (endTimeOfFit >> 32) << endl;
734 outputDebugFile <<
"LumiRange " << beginLumiOfFit <<
" - " << endLumiOfFit << endl;
735 outputDebugFile <<
"Type " << dataType << endl;
740 BufferString << *(it+0);
741 outputDebugFile <<
"X0 " << BufferString.str().c_str() << endl;
742 BufferString.str(
"");
744 BufferString << *(it+1);
745 outputDebugFile <<
"Y0 " << BufferString.str().c_str() << endl;
746 BufferString.str(
"");
748 BufferString << *(it+2);
749 outputDebugFile <<
"Z0 " << BufferString.str().c_str() << endl;
750 BufferString.str(
"");
752 BufferString << *(it+3);
753 outputDebugFile <<
"sigmaZ0 " << BufferString.str().c_str() << endl;
754 BufferString.str(
"");
756 BufferString << *(it+4);
757 outputDebugFile <<
"dxdz " << BufferString.str().c_str() << endl;
758 BufferString.str(
"");
760 BufferString << *(it+5);
761 outputDebugFile <<
"dydz " << BufferString.str().c_str() << endl;
762 BufferString.str(
"");
764 BufferString << *(it+6);
765 outputDebugFile <<
"BeamWidthX " << BufferString.str().c_str() << endl;
766 BufferString.str(
"");
768 BufferString << *(it+7);
769 outputDebugFile <<
"BeamWidthY " << BufferString.str().c_str() << endl;
770 BufferString.str(
"");
772 outputDebugFile <<
"Cov(0,j) " << *(it+8) <<
" 0.0 0.0 0.0 0.0 0.0 0.0" << endl;
773 outputDebugFile <<
"Cov(1,j) 0.0 " << *(it+9) <<
" 0.0 0.0 0.0 0.0 0.0" << endl;
774 outputDebugFile <<
"Cov(2,j) 0.0 0.0 " << *(it+10) <<
" 0.0 0.0 0.0 0.0" << endl;
775 outputDebugFile <<
"Cov(3,j) 0.0 0.0 0.0 " << *(it+11) <<
" 0.0 0.0 0.0" << endl;
776 outputDebugFile <<
"Cov(4,j) 0.0 0.0 0.0 0.0 " << *(it+12) <<
" 0.0 0.0" << endl;
777 outputDebugFile <<
"Cov(5,j) 0.0 0.0 0.0 0.0 0.0 " << *(it+13) <<
" 0.0" << endl;
778 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;
780 outputDebugFile <<
"EmittanceX 0.0" << endl;
781 outputDebugFile <<
"EmittanceY 0.0" << endl;
782 outputDebugFile <<
"BetaStar 0.0" << endl;
790 if ((lumiCounter == 0) && (lumiBlock.
luminosityBlock() > lastLumiOfFit))
797 else if ((lumiCounter != 0) && (lumiBlock.
luminosityBlock() >= (beginLumiOfFit+lumiCounter))) { lumiCounter++; lumiCounterHisto++; }
804 stringstream histTitle;
806 unsigned int nParams = 9;
808 if ((lumiCounter%nLumiReset == 0) && (nLumiReset != 0) && (beginTimeOfFit != 0) && (
runNumber != 0))
812 lastLumiOfFit = endLumiOfFit;
815 hitCounter->ShiftFillLast((
double)totalHits,
std::sqrt((
double)totalHits), nLumiReset);
817 if (lastLumiOfFit % prescaleHistory == 0)
819 hitCountHistory->getTH1()->SetBinContent(lastLumiOfFit, (
double)totalHits);
820 hitCountHistory->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt((
double)totalHits));
823 if (dataFromFit ==
true)
825 vector<double> fitResults;
827 fitResults.push_back(Vx_X->getTH1()->GetRMS()*Vx_X->getTH1()->GetRMS());
828 fitResults.push_back(Vx_Y->getTH1()->GetRMS()*Vx_Y->getTH1()->GetRMS());
829 fitResults.push_back(Vx_Z->getTH1()->GetRMS()*Vx_Z->getTH1()->GetRMS());
830 fitResults.push_back(0.0);
831 fitResults.push_back(0.0);
832 fitResults.push_back(0.0);
833 fitResults.push_back(Vx_X->getTH1()->GetMean());
834 fitResults.push_back(Vx_Y->getTH1()->GetMean());
835 fitResults.push_back(Vx_Z->getTH1()->GetMean());
836 for (
unsigned int i = 0;
i < nParams;
i++) fitResults.push_back(0.0);
838 goodData = MyFit(&fitResults);
840 if (internalDebug ==
true)
842 cout <<
"goodData --> " << goodData << endl;
844 cout <<
"var x --> " << fitResults[0] <<
" +/- " << fitResults[0+nParams] << endl;
845 cout <<
"var y --> " << fitResults[1] <<
" +/- " << fitResults[1+nParams] << endl;
846 cout <<
"var z --> " << fitResults[2] <<
" +/- " << fitResults[2+nParams] << endl;
847 cout <<
"cov xy --> " << fitResults[3] <<
" +/- " << fitResults[3+nParams] << endl;
848 cout <<
"dydz --> " << fitResults[4] <<
" +/- " << fitResults[4+nParams] << endl;
849 cout <<
"dxdz --> " << fitResults[5] <<
" +/- " << fitResults[5+nParams] << endl;
850 cout <<
"mean x --> " << fitResults[6] <<
" +/- " << fitResults[6+nParams] << endl;
851 cout <<
"mean y --> " << fitResults[7] <<
" +/- " << fitResults[7+nParams] << endl;
852 cout <<
"mean z --> " << fitResults[8] <<
" +/- " << fitResults[8+nParams] << endl;
857 vals.push_back(fitResults[6]);
858 vals.push_back(fitResults[7]);
859 vals.push_back(fitResults[8]);
860 vals.push_back(
std::sqrt(std::fabs(fitResults[2])));
861 vals.push_back(fitResults[5]);
862 vals.push_back(fitResults[4]);
863 vals.push_back(
std::sqrt(std::fabs(fitResults[0])));
864 vals.push_back(
std::sqrt(std::fabs(fitResults[1])));
866 vals.push_back(powf(fitResults[6+nParams],2.));
867 vals.push_back(powf(fitResults[7+nParams],2.));
868 vals.push_back(powf(fitResults[8+nParams],2.));
869 vals.push_back(powf(std::fabs(fitResults[2+nParams]) / (2.*
std::sqrt(std::fabs(fitResults[2]))),2.));
870 vals.push_back(powf(fitResults[5+nParams],2.));
871 vals.push_back(powf(fitResults[4+nParams],2.));
872 vals.push_back(powf(std::fabs(fitResults[0+nParams]) / (2.*
std::sqrt(std::fabs(fitResults[0]))),2.));
873 vals.push_back(powf(std::fabs(fitResults[1+nParams]) / (2.*
std::sqrt(std::fabs(fitResults[1]))),2.));
875 else for (
unsigned int i = 0;
i < 8*2;
i++) vals.push_back(0.0);
881 counterVx = Vx_X->getTH1F()->GetEntries();
883 if (Vx_X->getTH1F()->GetEntries() >= minNentries)
887 vals.push_back(Vx_X->getTH1F()->GetMean());
888 vals.push_back(Vx_Y->getTH1F()->GetMean());
889 vals.push_back(Vx_Z->getTH1F()->GetMean());
890 vals.push_back(Vx_Z->getTH1F()->GetRMS());
893 vals.push_back(Vx_X->getTH1F()->GetRMS());
894 vals.push_back(Vx_Y->getTH1F()->GetRMS());
896 vals.push_back(powf(Vx_X->getTH1F()->GetMeanError(),2.));
897 vals.push_back(powf(Vx_Y->getTH1F()->GetMeanError(),2.));
898 vals.push_back(powf(Vx_Z->getTH1F()->GetMeanError(),2.));
899 vals.push_back(powf(Vx_Z->getTH1F()->GetRMSError(),2.));
902 vals.push_back(powf(Vx_X->getTH1F()->GetRMSError(),2.));
903 vals.push_back(powf(Vx_Y->getTH1F()->GetRMSError(),2.));
908 for (
unsigned int i = 0;
i < 8*2;
i++) vals.push_back(0.0);
938 writeToFile(&vals, beginTimeOfFit, endTimeOfFit, beginLumiOfFit, endLumiOfFit, 3);
939 if ((internalDebug ==
true) && (outputDebugFile.is_open() ==
true)) outputDebugFile <<
"Used vertices: " <<
counterVx << endl;
943 histTitle <<
"Fitted Beam Spot [cm] (Lumi start: " << beginLumiOfFit <<
" - Lumi end: " << endLumiOfFit <<
")";
944 if (lumiCounterHisto >= maxLumiIntegration)
reset(
"whole");
945 else reset(
"partial");
949 writeToFile(&vals, beginTimeOfFit, endTimeOfFit, beginLumiOfFit, endLumiOfFit, -1);
950 if ((internalDebug ==
true) && (outputDebugFile.is_open() ==
true)) outputDebugFile <<
"Used vertices: " <<
counterVx << endl;
954 histTitle <<
"Fitted Beam Spot [cm] (not enough statistics)";
955 if (lumiCounter >= maxLumiIntegration)
reset(
"whole");
956 else reset(
"hitCounter");
960 histTitle <<
"Fitted Beam Spot [cm] (problems)";
961 if (lumiCounterHisto >= maxLumiIntegration)
reset(
"whole");
962 else reset(
"partial");
968 reportSummary->Fill(numberFits != 0 ? (
double)numberGoodFits/(
double)numberFits : 0.0);
969 reportSummaryMap->Fill(0.5, 0.5, numberFits != 0 ? (
double)numberGoodFits/(
double)numberFits : 0.0);
971 fitResults->setAxisTitle(histTitle.str().c_str(), 1);
973 fitResults->setBinContent(1, 9, vals[0]);
974 fitResults->setBinContent(1, 8, vals[1]);
975 fitResults->setBinContent(1, 7, vals[2]);
976 fitResults->setBinContent(1, 6, vals[3]);
977 fitResults->setBinContent(1, 5, vals[4]);
978 fitResults->setBinContent(1, 4, vals[5]);
979 fitResults->setBinContent(1, 3, vals[6]);
980 fitResults->setBinContent(1, 2, vals[7]);
981 fitResults->setBinContent(1, 1,
counterVx);
983 fitResults->setBinContent(2, 9,
std::sqrt(vals[8]));
984 fitResults->setBinContent(2, 8,
std::sqrt(vals[9]));
985 fitResults->setBinContent(2, 7,
std::sqrt(vals[10]));
986 fitResults->setBinContent(2, 6,
std::sqrt(vals[11]));
987 fitResults->setBinContent(2, 5,
std::sqrt(vals[12]));
988 fitResults->setBinContent(2, 4,
std::sqrt(vals[13]));
989 fitResults->setBinContent(2, 3,
std::sqrt(vals[14]));
990 fitResults->setBinContent(2, 2,
std::sqrt(vals[15]));
994 TF1* myLinFit =
new TF1(
"myLinFit",
"[0] + [1]*x", mXlumi->getTH1()->GetXaxis()->GetXmin(), mXlumi->getTH1()->GetXaxis()->GetXmax());
995 myLinFit->SetLineColor(2);
996 myLinFit->SetLineWidth(2);
997 myLinFit->SetParName(0,
"Intercept");
998 myLinFit->SetParName(1,
"Slope");
1000 mXlumi->ShiftFillLast(vals[0],
std::sqrt(vals[8]), nLumiReset);
1001 myLinFit->SetParameter(0, mXlumi->getTH1()->GetMean(2));
1002 myLinFit->SetParameter(1, 0.0);
1003 mXlumi->getTH1()->Fit(
"myLinFit",
"QR");
1005 mYlumi->ShiftFillLast(vals[1],
std::sqrt(vals[9]), nLumiReset);
1006 myLinFit->SetParameter(0, mYlumi->getTH1()->GetMean(2));
1007 myLinFit->SetParameter(1, 0.0);
1008 mYlumi->getTH1()->Fit(
"myLinFit",
"QR");
1010 mZlumi->ShiftFillLast(vals[2],
std::sqrt(vals[10]), nLumiReset);
1011 myLinFit->SetParameter(0, mZlumi->getTH1()->GetMean(2));
1012 myLinFit->SetParameter(1, 0.0);
1013 mZlumi->getTH1()->Fit(
"myLinFit",
"QR");
1015 sXlumi->ShiftFillLast(vals[6],
std::sqrt(vals[14]), nLumiReset);
1016 myLinFit->SetParameter(0, sXlumi->getTH1()->GetMean(2));
1017 myLinFit->SetParameter(1, 0.0);
1018 sXlumi->getTH1()->Fit(
"myLinFit",
"QR");
1020 sYlumi->ShiftFillLast(vals[7],
std::sqrt(vals[15]), nLumiReset);
1021 myLinFit->SetParameter(0, sYlumi->getTH1()->GetMean(2));
1022 myLinFit->SetParameter(1, 0.0);
1023 sYlumi->getTH1()->Fit(
"myLinFit",
"QR");
1025 sZlumi->ShiftFillLast(vals[3],
std::sqrt(vals[11]), nLumiReset);
1026 myLinFit->SetParameter(0, sZlumi->getTH1()->GetMean(2));
1027 myLinFit->SetParameter(1, 0.0);
1028 sZlumi->getTH1()->Fit(
"myLinFit",
"QR");
1030 dxdzlumi->ShiftFillLast(vals[4],
std::sqrt(vals[12]), nLumiReset);
1031 myLinFit->SetParameter(0, dxdzlumi->getTH1()->GetMean(2));
1032 myLinFit->SetParameter(1, 0.0);
1033 dxdzlumi->getTH1()->Fit(
"myLinFit",
"QR");
1035 dydzlumi->ShiftFillLast(vals[5],
std::sqrt(vals[13]), nLumiReset);
1036 myLinFit->SetParameter(0, dydzlumi->getTH1()->GetMean(2));
1037 myLinFit->SetParameter(1, 0.0);
1038 dydzlumi->getTH1()->Fit(
"myLinFit",
"QR");
1040 goodVxCounter->ShiftFillLast((
double)
counterVx,
std::sqrt((
double)counterVx), nLumiReset);
1041 myLinFit->SetParameter(0, goodVxCounter->getTH1()->GetMean(2));
1042 myLinFit->SetParameter(1, 0.0);
1043 goodVxCounter->getTH1()->Fit(
"myLinFit",
"QR");
1045 if (lastLumiOfFit % prescaleHistory == 0)
1047 goodVxCountHistory->getTH1()->SetBinContent(lastLumiOfFit, (
double)counterVx);
1048 goodVxCountHistory->getTH1()->SetBinError(lastLumiOfFit,
std::sqrt((
double)counterVx));
1055 else if (nLumiReset == 0)
1057 histTitle <<
"Fitted Beam Spot [cm] (no ongoing fits)";
1058 fitResults->setAxisTitle(histTitle.str().c_str(), 1);
1059 reportSummaryMap->Fill(0.5, 0.5, 1.0);
1060 hitCounter->ShiftFillLast(totalHits,
std::sqrt(totalHits), 1);
1072 nBinsHistoricalPlot = 80;
1073 nBinsWholeHistory = 3000;
1080 Vx_X = dbe->
book1D(
"vertex x",
"Primary Vertex X Coordinate Distribution",
int(rint(xRange/xStep)), -xRange/2., xRange/2.);
1081 Vx_Y = dbe->
book1D(
"vertex y",
"Primary Vertex Y Coordinate Distribution",
int(rint(yRange/yStep)), -yRange/2., yRange/2.);
1082 Vx_Z = dbe->
book1D(
"vertex z",
"Primary Vertex Z Coordinate Distribution",
int(rint(zRange/zStep)), -zRange/2., zRange/2.);
1084 Vx_X->setAxisTitle(
"Entries [#]",2);
1085 Vx_Y->setAxisTitle(
"Primary Vertices Y [cm]",1);
1086 Vx_Y->setAxisTitle(
"Entries [#]",2);
1087 Vx_Z->setAxisTitle(
"Primary Vertices Z [cm]",1);
1088 Vx_Z->setAxisTitle(
"Entries [#]",2);
1090 mXlumi = dbe->
book1D(
"muX vs lumi",
"\\mu_{x} vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1091 mYlumi = dbe->
book1D(
"muY vs lumi",
"\\mu_{y} vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1092 mZlumi = dbe->
book1D(
"muZ vs lumi",
"\\mu_{z} vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1094 mXlumi->setAxisTitle(
"\\mu_{x} [cm]",2);
1095 mXlumi->getTH1()->SetOption(
"E1");
1096 mYlumi->setAxisTitle(
"Lumisection [#]",1);
1097 mYlumi->setAxisTitle(
"\\mu_{y} [cm]",2);
1098 mYlumi->getTH1()->SetOption(
"E1");
1099 mZlumi->setAxisTitle(
"Lumisection [#]",1);
1100 mZlumi->setAxisTitle(
"\\mu_{z} [cm]",2);
1101 mZlumi->getTH1()->SetOption(
"E1");
1103 sXlumi = dbe->
book1D(
"sigmaX vs lumi",
"\\sigma_{x} vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1104 sYlumi = dbe->
book1D(
"sigmaY vs lumi",
"\\sigma_{y} vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1105 sZlumi = dbe->
book1D(
"sigmaZ vs lumi",
"\\sigma_{z} vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1107 sXlumi->setAxisTitle(
"\\sigma_{x} [cm]",2);
1108 sXlumi->getTH1()->SetOption(
"E1");
1109 sYlumi->setAxisTitle(
"Lumisection [#]",1);
1110 sYlumi->setAxisTitle(
"\\sigma_{y} [cm]",2);
1111 sYlumi->getTH1()->SetOption(
"E1");
1112 sZlumi->setAxisTitle(
"Lumisection [#]",1);
1113 sZlumi->setAxisTitle(
"\\sigma_{z} [cm]",2);
1114 sZlumi->getTH1()->SetOption(
"E1");
1116 dxdzlumi = dbe->
book1D(
"dxdz vs lumi",
"dX/dZ vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1117 dydzlumi = dbe->
book1D(
"dydz vs lumi",
"dY/dZ vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1119 dxdzlumi->setAxisTitle(
"dX/dZ [rad]",2);
1120 dxdzlumi->getTH1()->SetOption(
"E1");
1121 dydzlumi->setAxisTitle(
"Lumisection [#]",1);
1122 dydzlumi->setAxisTitle(
"dY/dZ [rad]",2);
1123 dydzlumi->getTH1()->SetOption(
"E1");
1125 Vx_ZX = dbe->
book2D(
"vertex zx",
"Primary Vertex ZX Coordinate Distribution",
int(rint(zRange/zStep/5.)), -zRange/2., zRange/2.,
int(rint(xRange/xStep/5.)), -xRange/2., xRange/2.);
1126 Vx_ZY = dbe->
book2D(
"vertex zy",
"Primary Vertex ZY Coordinate Distribution",
int(rint(zRange/zStep/5.)), -zRange/2., zRange/2.,
int(rint(yRange/yStep/5.)), -yRange/2., yRange/2.);
1127 Vx_XY = dbe->
book2D(
"vertex xy",
"Primary Vertex XY Coordinate Distribution",
int(rint(xRange/xStep/5.)), -xRange/2., xRange/2.,
int(rint(yRange/yStep/5.)), -yRange/2., yRange/2.);
1129 Vx_ZX->setAxisTitle(
"Primary Vertices X [cm]",2);
1130 Vx_ZX->setAxisTitle(
"Entries [#]",3);
1131 Vx_ZY->setAxisTitle(
"Primary Vertices Z [cm]",1);
1132 Vx_ZY->setAxisTitle(
"Primary Vertices Y [cm]",2);
1133 Vx_ZY->setAxisTitle(
"Entries [#]",3);
1134 Vx_XY->setAxisTitle(
"Primary Vertices X [cm]",1);
1135 Vx_XY->setAxisTitle(
"Primary Vertices Y [cm]",2);
1136 Vx_XY->setAxisTitle(
"Entries [#]",3);
1138 hitCounter = dbe->
book1D(
"pixelHits vs lumi",
"# Pixel-Hits vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1140 hitCounter->setAxisTitle(
"Pixel-Hits [#]",2);
1141 hitCounter->getTH1()->SetOption(
"E1");
1143 hitCountHistory = dbe->
book1D(
"hist pixelHits vs lumi",
"History: # Pixel-Hits vs. Lumi", nBinsWholeHistory, 0.5, (
double)nBinsWholeHistory+0.5);
1145 hitCountHistory->setAxisTitle(
"Pixel-Hits [#]",2);
1146 hitCountHistory->getTH1()->SetOption(
"E1");
1148 goodVxCounter = dbe->
book1D(
"good vertices vs lumi",
"# Good vertices vs. Lumisection", nBinsHistoricalPlot, 0.5, (
double)nBinsHistoricalPlot+0.5);
1150 goodVxCounter->setAxisTitle(
"Good vertices [#]",2);
1151 goodVxCounter->getTH1()->SetOption(
"E1");
1153 goodVxCountHistory = dbe->
book1D(
"hist good vx vs lumi",
"History: # Good vx vs. Lumi", nBinsWholeHistory, 0.5, (
double)nBinsWholeHistory+0.5);
1155 goodVxCountHistory->setAxisTitle(
"Good vertices [#]",2);
1156 goodVxCountHistory->getTH1()->SetOption(
"E1");
1158 fitResults = dbe->
book2D(
"fit results",
"Results of Beam Spot Fit", 2, 0., 2., 9, 0., 9.);
1160 fitResults->setBinLabel(9,
"X", 2);
1161 fitResults->setBinLabel(8,
"Y", 2);
1162 fitResults->setBinLabel(7,
"Z", 2);
1163 fitResults->setBinLabel(6,
"\\sigma_{Z}", 2);
1164 fitResults->setBinLabel(5,
"#frac{dX}{dZ}[rad]", 2);
1165 fitResults->setBinLabel(4,
"#frac{dY}{dZ}[rad]", 2);
1166 fitResults->setBinLabel(3,
"\\sigma_{X}", 2);
1167 fitResults->setBinLabel(2,
"\\sigma_{Y}", 2);
1168 fitResults->setBinLabel(1,
"Vertices", 2);
1169 fitResults->setBinLabel(1,
"Value", 1);
1170 fitResults->setBinLabel(2,
"Stat. Error", 1);
1171 fitResults->getTH1()->SetOption(
"text");
1174 reportSummary = dbe->
bookFloat(
"reportSummary");
1175 reportSummary->
Fill(0.);
1176 reportSummaryMap = dbe->
book2D(
"reportSummaryMap",
"Pixel-Vertices Beam Spot: % Good Fits", 1, 0., 1., 1, 0., 1.);
1177 reportSummaryMap->
Fill(0.5, 0.5, 0.);
1187 prescaleHistory = 1;
1188 maxLumiIntegration = 15;
1192 internalDebug =
false;
1194 pi = 3.141592653589793238;
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
virtual char * formatTime(const time_t &t)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
#define DEFINE_FWK_MODULE(type)
virtual int MyFit(std::vector< double > *vals)
data_type const * const_iterator
Timestamp const & beginTime() const
virtual unsigned int HitCounter(const edm::Event &iEvent)
virtual void writeToFile(std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
MonitorElement * bookFloat(const char *name)
Book float.
LuminosityBlockNumber_t luminosityBlock() const
bool considerVxCovariance
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
Vx3DHLTAnalyzer(const edm::ParameterSet &)
Timestamp const & endTime() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
LuminosityBlock const & getLuminosityBlock() const
virtual void reset(std::string ResetType)
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
TimeValue_t value() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static char * formatTime(const time_t t)
void Gauss3DFunc(int &, double *, double &fval, double *par, int)
std::vector< std::vector< double > > tmp
std::vector< VertexType > Vertices
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
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])
void setCurrentFolder(const std::string &fullpath)