32 #define CP(level) if (level >= verbose_)
48 : hltResName_(
parameters.getUntrackedParameter<
string>(
"hltTrgResults",
"TriggerResults")),
49 pixelName_(
parameters.getUntrackedParameter<
string>(
"pixelRecHits",
"siPixelRecHits")),
50 clusterVtxName_(
parameters.getUntrackedParameter<
string>(
"clusterVertices",
"")),
51 ZVCut_(
parameters.getUntrackedParameter<double>(
"ZVertexCut", 10)),
52 ZVEtaRegion_(
parameters.getUntrackedParameter<double>(
"ZVertexEtaRegion", 2)),
53 ZVVtxRegion_(
parameters.getUntrackedParameter<double>(
"ZVertexVtxRegion", 2)),
54 dPhiVc_(
parameters.getUntrackedParameter<double>(
"dPhiVertexCut", 0.08)),
55 dZVc_(
parameters.getUntrackedParameter<double>(
"dZVertexCut", 0.25)),
56 sigEtaCut_(
parameters.getUntrackedParameter<double>(
"signalEtaCut", 0.1)),
57 sigPhiCut_(
parameters.getUntrackedParameter<double>(
"signalPhiCut", 1.5)),
58 bkgEtaCut_(
parameters.getUntrackedParameter<double>(
"backgroundEtaCut", 0.1)),
59 bkgPhiCut_(
parameters.getUntrackedParameter<double>(
"backgroundPhiCut", 3.0)),
60 verbose_(
parameters.getUntrackedParameter<
int>(
"verbose", 3)),
61 pixLayers_(
parameters.getUntrackedParameter<
int>(
"pixLayerCombinations", 12)),
62 clusLayers_(
parameters.getUntrackedParameter<
int>(
"clusLayerCombinations", 12)),
65 AlphaTracklets12_(nullptr),
66 AlphaTracklets13_(nullptr),
67 AlphaTracklets23_(nullptr),
71 h2TrigCorr_(nullptr) {
86 Form(
"Value for pixLayerCombinations must be one of 12,13, or 23. "
87 "Got %d, set value to 12",
113 bool isHltCfgChanged =
false;
131 print(3, Form(
"Could not obtain HLT config for process name(s) %s", teststr.c_str()));
148 print(0, Form(
"Checking trigger name %s for %s", n2.c_str(), n1.c_str()));
153 print(0, Form(
"Added trigger %d with name %s for bit %d",
int(
hltTrgBits_.size() - 1), n1.c_str(),
int(
j)));
159 CP(2)
print(2, Form(
"Could not find trigger bit for %s", n1.c_str()));
207 repSumMap_ = iBooker.
book2D(
"reportSummaryMap",
"reportSummaryMap", 1, 0, 1, 1, 0, 1);
214 const double x1 = -0.5;
215 const double x2 =
Nx - 0.5;
228 const double x1 = -0.5;
229 const double x2 = 149.5;
239 const double x1 = -0.5;
240 const double x2 = 14.5;
250 const double x1 = -3;
251 const double x2 = +3;
261 const double x1 = -3.2;
262 const double x2 = +3.2;
272 const double x1 = -25;
273 const double x2 = +25;
285 const double x1 = -3;
286 const double x2 = +3;
294 "raw #eta vs z vertex from tracklets12;#eta;vz [cm]",
307 "raw #eta vs z vertex from tracklets13;#eta;vz [cm]",
320 "raw #eta vs z vertex from tracklets23;#eta;vz [cm]",
333 const double x1 = -3;
334 const double x2 = +3;
336 const double y1 = -3.2;
337 const double y2 = +3.2;
341 "hTracklet12RawDetaDphi",
342 "tracklet12 raw #Delta#eta vs #Delta#phi;#Delta#eta;#Delta#phi",
354 "hTracklet13RawDetaDphi",
355 "tracklet13 raw #Delta#eta vs #Delta#phi;#Delta#eta;#Delta#phi",
367 "hTracklet23RawDetaDphi",
368 "tracklet12 raw #Delta#eta vs #Delta#phi;#Delta#eta;#Delta#phi",
381 const double x1 = -3;
382 const double x2 = +3;
386 "hTracklet12RawDeta",
387 "tracklet12 raw dN/#Delta#eta;#Delta#eta;dN/#Delta#eta",
396 "hTracklet13RawDeta",
397 "tracklet13 raw dN/#Delta#eta;#Delta#eta;dN/#Delta#eta",
406 "hTracklet23RawDeta",
407 "tracklet23 raw dN/#Delta#eta;#Delta#eta;dN/#Delta#eta",
417 const double x1 = -3.2;
418 const double x2 = +3.2;
422 "hTracklet12RawDphi",
423 "tracklet12 raw dN/#Delta#phi;#Delta#phi;dN/#Delta#phi",
432 "hTracklet13RawDphi",
433 "tracklet13 raw dN/#Delta#phi;#Delta#phi;dN/#Delta#phi",
442 "hTracklet23RawDphi",
443 "tracklet23 raw dN/#Delta#phi;#Delta#phi;dN/#Delta#phi",
452 const int Nx = xa->GetNbins();
453 const double x1 = xa->GetBinLowEdge(1);
454 const double x2 = xa->GetBinLowEdge(
Nx + 1);
458 "hdNdEtaRawTracklets12",
459 "raw dN/d#eta for tracklets12;#eta;dN/d#eta",
468 "hdNdEtaSubTracklets12",
469 "(1-#beta) dN/d#eta for tracklets12;#eta;dN/d#eta",
478 "hdNdEtaTracklets12",
479 "dN/d#eta for tracklets12;#eta;dN/d#eta",
486 "hEventCountsPerEta12_",
487 "Events per vtx-#eta bin from tracklets12;#eta;#",
496 const int Nx = xa->GetNbins();
497 const double x1 = xa->GetBinLowEdge(1);
498 const double x2 = xa->GetBinLowEdge(
Nx + 1);
502 "hdNdEtaRawTracklets13",
503 "raw dN/d#eta for tracklets13;#eta;dN/d#eta",
512 "hdNdEtaSubTracklets13",
513 "(1-#beta) dN/d#eta for tracklets13;#eta;dN/d#eta",
522 "hdNdEtaTracklets13",
523 "dN/d#eta for tracklets13;#eta;dN/d#eta",
530 "hEventCountsPerEta13",
531 "Events per vtx-#eta bin from tracklets13;#eta;#",
540 const int Nx = xa->GetNbins();
541 const double x1 = xa->GetBinLowEdge(1);
542 const double x2 = xa->GetBinLowEdge(
Nx + 1);
546 "hdNdEtaRawTracklets23",
547 "raw dN/d#eta for tracklets23;#eta;dN/d#eta",
556 "hdNdEtaSubTracklets23",
557 "(1-#beta) dN/d#eta for tracklets23;#eta;dN/d#eta",
566 "hdNdEtaTracklets23",
567 "dN/d#eta for tracklets23;#eta;dN/d#eta",
574 "hEventCountsPerEta23",
575 "Events per vtx-#eta bin from tracklets23;#eta;#",
585 const double x1 = -25;
586 const double x2 = +25;
593 const double x1 = -3;
594 const double x2 = +3;
596 const double y1 = -0.5;
597 const double y2 = 24.5;
602 "cluster #eta vs local y size on layer 1;#eta;size",
615 "cluster #eta vs local y size on layer 2;#eta;size",
628 "cluster #eta vs local y size on layer 3;#eta;size",
641 const double x1 = -3;
642 const double x2 = +3;
645 const double y2 = 2500;
650 "cluster #eta vs adc on layer 1;#eta;adc",
663 "cluster #eta vs adc on layer 2;#eta;adc",
676 "cluster #eta vs adc on layer 3;#eta;adc",
698 "QcdLowPtDQM::analyze -- Could not obtain pointer to "
699 "TrackerGeometry. Return.");
711 std::vector<MonitorElement *> &mes,
727 TH1 *h1 =
e->getTH1();
736 std::vector<MonitorElement *> &mes,
757 TH1 *h1 =
e->getTH1();
818 const std::vector<TH3F *> &NsigTracklets,
819 const std::vector<TH3F *> &NbkgTracklets,
820 const std::vector<TH1F *> &NEvsPerEta,
821 std::vector<MonitorElement *> &hdNdEtaRawTrkl,
822 std::vector<MonitorElement *> &hdNdEtaSubTrkl,
823 std::vector<MonitorElement *> &hdNdEtaTrklets) {
829 const int netabins = AlphaTracklets->GetNbinsX();
830 const int nhitbins = AlphaTracklets->GetNbinsY();
831 const int nvzbins = AlphaTracklets->GetNbinsZ();
837 for (
size_t i = 0;
i < hdNdEtaRawTrkl.size(); ++
i) {
846 TH3F *hsig = NsigTracklets.at(
i);
847 TH3F *hbkg = NbkgTracklets.at(
i);
848 TH1F *hepa = NEvsPerEta.at(
i);
850 for (
int etabin = 1; etabin <= netabins; ++etabin) {
851 const double etaval = AlphaTracklets->GetXaxis()->GetBinCenter(etabin);
852 const double etawidth = AlphaTracklets->GetXaxis()->GetBinWidth(etabin);
853 const int zvetabin = hepa->GetXaxis()->FindFixBin(etaval);
854 const double events = hepa->GetBinContent(zvetabin);
866 double dndetaraw = 0;
867 double dndetasub = 0;
869 double dndetarawerr = 0;
870 double dndetasuberr = 0;
871 double dndetaerr = 0;
872 for (
int hitbin = 1; hitbin <= nhitbins; ++hitbin) {
873 for (
int vzbin = 1; vzbin <= nvzbins; ++vzbin) {
874 int gbin = AlphaTracklets->GetBin(etabin, hitbin, vzbin);
875 const double nsig = hsig->GetBinContent(gbin);
877 const double nbkg = hbkg->GetBinContent(gbin);
878 const double nsub = nsig - nbkg;
880 CP(2)
print(2, Form(
"Got negative contributions: %d %d %d %f", etabin, hitbin, vzbin,
nsub));
884 const double alpha = AlphaTracklets->GetBinContent(gbin);
886 double nsig2 = nsig * nsig;
889 dndetarawerr += nsig2;
890 dndetasuberr += nsub2;
891 dndetaerr += alpha2 * nsub2;
895 double norm = etawidth *
events;
896 double enorm = etawidth * norm;
900 dndetarawerr /= enorm;
901 dndetasuberr /= enorm;
903 double dndetarawsigma2 = (dndetaraw * dndetaraw - dndetarawerr) /
events;
904 double dndetasubsigma2 = (dndetasub * dndetasub - dndetasuberr) /
events;
905 double dndetasigma2 = (dndeta * dndeta - dndetaerr) /
events;
918 return std::shared_ptr<qlpd::Cache>();
968 for (
size_t i = 0;
i < hs.size(); ++
i) {
971 hs.at(
i)->Fill(
val,
w);
978 for (
size_t i = 0;
i < mes.size(); ++
i) {
981 mes.at(
i)->Fill(
val,
w);
988 for (
size_t i = 0;
i < hs.size(); ++
i) {
991 hs.at(
i)->Fill(valx, valy,
w);
998 for (
size_t i = 0;
i < mes.size(); ++
i) {
1001 mes.at(
i)->Fill(valx, valy,
w);
1008 for (
size_t i = 0;
i < hs.size(); ++
i) {
1011 hs.at(
i)->AddBinContent(gbin,
w);
1025 if (tbit < triggerResultsHLT->
size()) {
1056 CP(2)
print(2, Form(
"Can not obtain pixel hit collection with name %s",
pixelName_.c_str()));
1069 if (!
hit->isValid())
1073 if (
hit->isOnEdge() ||
hit->hasBadPixels())
1085 vector<SiPixelCluster::Pixel> pixels(
hit->cluster()->pixels());
1086 bool pixelOnEdge =
false;
1087 for (std::vector<SiPixelCluster::Pixel>::const_iterator
pixel = pixels.begin();
pixel != pixels.end(); ++
pixel) {
1088 int pixelX =
pixel->x;
1089 int pixelY =
pixel->y;
1101 double adc =
hit->cluster()->charge() / 135.;
1102 double sizex =
hit->cluster()->sizeX();
1103 double sizey =
hit->cluster()->sizeY();
1105 Pixel pix(gpos,
adc, sizex, sizey);
1113 }
else if (
layer == 2) {
1143 Form(
"Can not obtain pixel vertex from cluster collection "
1152 reco::VertexCollection::const_iterator
vertex =
vertices->begin();
1155 std::vector<Pixel> allp(
bpix1_);
1173 const std::vector<Pixel> &pix,
1174 std::vector<MonitorElement *> &hClusterYSize,
1175 std::vector<MonitorElement *> &hClusterADC) {
1178 for (
size_t i = 0;
i < pix.size(); ++
i) {
1234 const std::vector<Pixel> &pix1,
1235 const std::vector<Pixel> &pix2,
1236 const Vertex &trackletV) {
1245 std::vector<Tracklet> tmptrkls;
1246 tmptrkls.reserve(pix1.size() * pix2.size());
1247 for (
size_t i = 0;
i < pix1.size(); ++
i) {
1248 const GlobalPoint tmp1(pix1.at(
i).x(), pix1.at(
i).y(), pix1.at(
i).z() - trackletV.
z());
1250 for (
size_t j = 0;
j < pix2.size(); ++
j) {
1251 const GlobalPoint tmp2(pix2.at(
j).x(), pix2.at(
j).y(), pix2.at(
j).z() - trackletV.
z());
1256 tmptrkls.push_back(tracklet);
1264 vector<bool> secused(pix2.size(),
false);
1265 for (
size_t k = 0;
k < tmptrkls.size(); ++
k) {
1267 size_t p2ind = tl.
i2();
1268 if (secused.at(p2ind))
1270 secused[p2ind] =
true;
1271 tracklets.push_back(tl);
1272 if (tracklets.size() == pix2.size())
1278 const std::vector<Pixel> &pixels,
1280 const TH3F *AlphaTracklets,
1281 std::vector<TH3F *> &NsigTracklets,
1282 std::vector<TH3F *> &NbkgTracklets,
1283 std::vector<TH1F *> &eventpereta,
1284 std::vector<MonitorElement *> &detaphi,
1285 std::vector<MonitorElement *> &deta,
1286 std::vector<MonitorElement *> &dphi,
1287 std::vector<MonitorElement *> &etavsvtx) {
1290 if (!AlphaTracklets)
1293 if (tracklets.empty())
1297 for (
size_t i = 0;
i < eventpereta.size(); ++
i) {
1300 TH1 *
h = eventpereta.at(
i);
1301 h->AddBinContent(1, 1);
1303 h->AddBinContent(0, 1);
1305 h->AddBinContent(2, 1);
1309 const TAxis *xa = AlphaTracklets->GetXaxis();
1310 int ybin = AlphaTracklets->GetYaxis()->FindFixBin(pixels.size());
1311 int zbin = AlphaTracklets->GetZaxis()->FindFixBin(trackletV.
z());
1312 int tbin = AlphaTracklets->GetBin(0, ybin, zbin);
1313 for (
size_t k = 0;
k < tracklets.size(); ++
k) {
1315 fill2D(detaphi, tl.deta(), tl.dphi());
1318 int ebin = xa->FindFixBin(tl.eta());
1319 int gbin = ebin + tbin;
1320 fill2D(etavsvtx, tl.eta(), trackletV.
z());
1326 fill3D(NsigTracklets, gbin);
1328 fill3D(NbkgTracklets, gbin);
1336 printf(
"QcdLowPtDQM: %s\n",
msg);
1337 }
else if (
level == 1) {
1339 }
else if (
level == 2) {
1341 }
else if (
level == 3) {
1370 vector<double> zvCands;
1371 zvCands.reserve(pix1.size() * pix2.size());
1374 for (
size_t i = 0;
i < pix1.size(); ++
i) {
1376 const double r12 =
p1.x() *
p1.x() +
p1.y() *
p1.y();
1377 for (
size_t j = 0;
j < pix2.size(); ++
j) {
1381 const double r22 =
p2.x() *
p2.x() +
p2.y() *
p2.y();
1382 const double vz =
p1.z() - (
p2.z() -
p1.z()) / (TMath::Sqrt(r22 / r12) - 1);
1383 if (TMath::IsNaN(vz))
1387 zvCands.push_back(vz);
1392 sort(zvCands.begin(), zvCands.end());
1399 for (
size_t i = 0;
i < zvCands.size(); ++
i) {
1400 double z1 = zvCands.at(
i);
1404 for (
size_t j =
i;
j < zvCands.size(); ++
j) {
1405 double z2 = zvCands.at(
j);
1418 if ((ncl < mcl) || (ncl == mcl &&
s2 > ms2))
1427 vtx.set(mcl, mzv, ms2);
1433 double chi_max = 1
e+9;
1434 double z_best = -999;
1437 for (
double z0 = -15.9;
z0 <= 15.95;
z0 += 0.1) {
1440 for (
size_t i = 0;
i < pix.size(); ++
i) {
1446 if (chitest <= 1.) {
1455 if (
nhits < nhits_max)
1458 if ((
nhits > nhits_max) || (chi < chi_max)) {
1474 const int nEtaBin = 12;
1475 const int nHitBin = 14;
1476 const int nVzBin = 10;
1478 double HitBins[nHitBin + 1] = {0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 200, 700};
1481 for (
int i = 0;
i <= nEtaBin;
i++)
1482 EtaBins[
i] = (
double)
i * 6.0 / (double)nEtaBin - 3.0;
1483 double VzBins[nVzBin + 1];
1484 for (
int i = 0;
i <= nVzBin;
i++)
1485 VzBins[
i] = (
double)
i * 20.0 / (double)nVzBin - 10.0;
1488 "Alpha for tracklets12;#eta;#hits;vz [cm]",
2732 const int nEtaBin = 12;
2733 const int nHitBin = 14;
2734 const int nVzBin = 10;
2736 double HitBins[nHitBin + 1] = {0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 200, 700};
2739 for (
int i = 0;
i <= nEtaBin;
i++)
2740 EtaBins[
i] = (
double)
i * 6.0 / (double)nEtaBin - 3.0;
2741 double VzBins[nVzBin + 1];
2742 for (
int i = 0;
i <= nVzBin;
i++)
2743 VzBins[
i] = (
double)
i * 20.0 / (double)nVzBin - 10.0;
2746 "Alpha for tracklets13;#eta;#hits;vz [cm]",
3766 const int nEtaBin = 12;
3767 const int nHitBin = 14;
3768 const int nVzBin = 10;
3770 double HitBins[nHitBin + 1] = {0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 200, 700};
3773 for (
int i = 0;
i <= nEtaBin;
i++)
3774 EtaBins[
i] = (
double)
i * 6.0 / (double)nEtaBin - 3.0;
3775 double VzBins[nVzBin + 1];
3776 for (
int i = 0;
i <= nVzBin;
i++)
3777 VzBins[
i] = (
double)
i * 20.0 / (double)nVzBin - 10.0;
3780 "Alpha for tracklets23;#eta;#hits;vz [cm]",