80 esConsumes<Chi2MeasurementEstimatorBase, TrackingComponentsRecord>(
edm::ESInputTag(
"",
"Chi2"));
83 esConsumes<PixelClusterParameterEstimator, TkPixelCPERecord>(
edm::ESInputTag(
"",
"PixelCPEGeneric"));
89 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource constructor" << endl;
95 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource destructor" << endl;
97 std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator struct_iter;
99 delete struct_iter->second;
100 struct_iter->second =
nullptr;
114 else if (
layer == 2) {
121 else if (
layer == 3) {
146 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource beginRun()" << endl;
159 LogVerbatim(
"PixelDQM") <<
"TrackerGeometry " << &(*TG) <<
" size is " << TG->
dets().size() << endl;
163 for (TrackerGeometry::DetContainer::const_iterator pxb = TG->
detsPXB().begin(); pxb != TG->
detsPXB().end(); pxb++) {
164 if (dynamic_cast<PixelGeomDetUnit const *>((*pxb)) !=
nullptr) {
167 pair<uint32_t, SiPixelHitEfficiencyModule *>((*pxb)->geographicalId().rawId(),
module));
170 for (TrackerGeometry::DetContainer::const_iterator pxf = TG->
detsPXF().begin(); pxf != TG->
detsPXF().end(); pxf++) {
171 if (dynamic_cast<PixelGeomDetUnit const *>((*pxf)) !=
nullptr) {
174 pair<uint32_t, SiPixelHitEfficiencyModule *>((*pxf)->geographicalId().rawId(),
module));
190 for (std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator pxd =
theSiPixelStructure.begin();
197 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Folder Creation Failed! ";
203 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource ladder Folder Creation Failed! ";
209 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource layer Folder Creation Failed! ";
215 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource phi Folder Creation Failed! ";
221 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Blade Folder Creation Failed! ";
227 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Disk Folder Creation Failed! ";
233 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Ring Folder Creation Failed! ";
241 iBooker.
book1D(
"ClusterProbabilityXY_Layer1_Plus",
"ClusterProbabilityXY_Layer1_Plus", 500, -14, 0.1);
245 iBooker.
book1D(
"ClusterProbabilityXY_Layer1_Minus",
"ClusterProbabilityXY_Layer1_Minus", 500, -14, 0.1);
249 iBooker.
book1D(
"ClusterProbabilityXY_Layer2_Plus",
"ClusterProbabilityXY_Layer2_Plus", 500, -14, 0.1);
253 iBooker.
book1D(
"ClusterProbabilityXY_Layer2_Minus",
"ClusterProbabilityXY_Layer2_Minus", 500, -14, 0.1);
257 iBooker.
book1D(
"ClusterProbabilityXY_Layer3_Plus",
"ClusterProbabilityXY_Layer3_Plus", 500, -14, 0.1);
261 iBooker.
book1D(
"ClusterProbabilityXY_Layer3_Minus",
"ClusterProbabilityXY_Layer3_Minus", 500, -14, 0.1);
267 iBooker.
book1D(
"ClusterProbabilityXY_Disk1_Plus",
"ClusterProbabilityXY_Disk1_Plus", 500, -14, 0.1);
271 iBooker.
book1D(
"ClusterProbabilityXY_Disk1_Minus",
"ClusterProbabilityXY_Disk1_Minus", 500, -14, 0.1);
275 iBooker.
book1D(
"ClusterProbabilityXY_Disk2_Plus",
"ClusterProbabilityXY_Disk2_Plus", 500, -14, 0.1);
279 iBooker.
book1D(
"ClusterProbabilityXY_Disk2_Minus",
"ClusterProbabilityXY_Disk2_Minus", 500, -14, 0.1);
289 if (!vertexCollectionHandle.
isValid())
300 reco::VertexCollection::const_iterator bestVtx =
vertices.end();
301 for (reco::VertexCollection::const_iterator it =
vertices.begin(); it !=
vertices.end(); ++it) {
305 (
vtxntrk_ ==
int(it->tracksSize()) && fabs(
vtxZ_) > fabs(it->z()))) {
307 vtxD0_ = it->position().rho();
315 if (fabs(it->z()) <= 20. && fabs(it->position().rho()) <= 2. && it->ndof() > 4)
331 if (!
match.isValid())
337 std::cout <<
"+++ NEW EVENT +++" << std::endl;
338 std::cout <<
"Map entries \t : " << ttac.
size() << std::endl;
341 std::set<SiPixelCluster> clusterSet;
344 int extrapolateFrom_ = 2;
345 int extrapolateTo_ = 1;
346 float maxlxmatch_ = 0.2;
347 float maxlymatch_ = 0.2;
348 bool keepOriginalMissingHit_ =
true;
357 if (extrapolateFrom_ >= extrapolateTo_) {
366 std::vector<TrajectoryMeasurement> expTrajMeasurements;
373 bool isBpixtrack =
false, isFpixtrack =
false;
382 std::vector<TrajectoryMeasurement> tmeasColl = traj_iterator->measurements();
383 std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
385 for (tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end(); tmeasIt++) {
391 uint testSubDetID = (testhit->geographicalId().subdetId());
392 const DetId &hit_detId = testhit->geographicalId();
435 bool lastValidL2 =
false;
438 if (testhit->isValid()) {
439 if (tmeasIt == tmeasColl.end() - 1) {
444 uint nextSubDetID = (nextRecHit->geographicalId().subdetId());
454 std::vector<const BarrelDetLayer *> pxbLayers =
455 measurementTrackerHandle->geometricSearchTracker()->pixelBarrelLayers();
456 const DetLayer *pxb1 = pxbLayers[extrapolateTo_ - 1];
459 new LayerMeasurements(*measurementTrackerHandle, *measurementTrackerEventHandle);
461 expTrajMeasurements = theLayerMeasurements->
measurements(*pxb1, tsosPXB2, *thePropagator, *
estimator);
462 delete theLayerMeasurements;
463 if (!expTrajMeasurements.empty()) {
464 for (
uint p = 0;
p < expTrajMeasurements.size();
p++) {
466 const auto &pxb1Hit = pxb1TM.
recHit();
468 if (pxb1Hit->geographicalId().rawId() == 0) {
469 expTrajMeasurements.erase(expTrajMeasurements.begin() +
p);
478 trajStateComb(tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState());
479 if (!chkPredTrajState.
isValid())
488 vector<int> imatches;
490 float glmatch = 9999.;
491 for (
size_t iexp = 0; iexp < expTrajMeasurements.size(); iexp++) {
492 const DetId &exphit_detId = expTrajMeasurements[iexp].recHit()->geographicalId();
495 int dladder =
abs(exphit_ladder - hit_ladder);
497 dladder = 20 - dladder;
498 int dmodule =
abs(exphit_mod - hit_mod);
499 if (dladder != 0 || dmodule != 0) {
507 float dxyz =
sqrt((chkx -
x) * (chkx -
x) + (chky -
y) * (chky -
y) + (chkz -
z) * (chkz -
z));
509 if (dxyz <= glmatch) {
512 imatches.push_back(
int(imatch));
517 float lxmatch = 9999.0;
518 float lymatch = 9999.0;
519 if (!expTrajMeasurements.empty()) {
520 if (glmatch < 9999.) {
521 const DetId &matchhit_detId = expTrajMeasurements[imatch].recHit()->geographicalId();
524 int dladder =
abs(matchhit_ladder - hit_ladder);
526 dladder = 20 - dladder;
527 LocalPoint lp = expTrajMeasurements[imatch].updatedState().localPosition();
528 lxmatch = fabs(lp.
x() - chklp.
x());
529 lymatch = fabs(lp.
y() - chklp.
y());
531 if (lxmatch < maxlxmatch_ && lymatch < maxlymatch_) {
533 expTrajMeasurements.erase(expTrajMeasurements.begin() + imatch);
544 if (!expTrajMeasurements.empty()) {
545 for (
size_t f = 0;
f < expTrajMeasurements.size();
f++) {
548 tmeasColl.push_back(AddHit);
554 if (isBpixtrack || isFpixtrack) {
555 if (trackref->pt() < 0.6 || nStripHits < 8 || fabs(trackref->dxy(bestVtx->position())) > 0.05 ||
556 fabs(trackref->dz(bestVtx->position())) > 0.5)
560 std::cout <<
"isBpixtrack : " << isBpixtrack << std::endl;
561 std::cout <<
"isFpixtrack : " << isFpixtrack << std::endl;
565 for (std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end();
575 const DetId &hit_detId =
hit->geographicalId();
579 if (IntSubDetID == 0) {
591 bool isHalfModule =
false;
593 const SiPixelRecHit *pixhit = dynamic_cast<const SiPixelRecHit *>(
hit->hit());
599 if (
hit->isValid()) {
605 if (clusterProbability != 0)
614 if (
hit->isValid()) {
620 if (clusterProbability != 0)
626 if (fabs(trackref->dxy(bestVtx->position())) > 0.01 || fabs(trackref->dz(bestVtx->position())) > 0.1)
628 if (!(L2hits > 0 && L3hits > 0) && !(L2hits > 0 && D1hits > 0) && !(D1hits > 0 && D2hits > 0))
630 }
else if (
layer == 2) {
631 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
633 if (!(L1hits > 0 && L3hits > 0) && !(L1hits > 0 && D1hits > 0))
635 }
else if (
layer == 3) {
636 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
638 if (!(L1hits > 0 && L2hits > 0))
640 }
else if (
layer == 4) {
641 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
643 }
else if (disk == 1) {
644 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
646 if (!(L1hits > 0 && D2hits > 0) && !(L2hits > 0 && D2hits > 0))
648 }
else if (disk == 2) {
649 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
651 if (!(L1hits > 0 && D1hits > 0))
653 }
else if (disk == 3) {
654 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
665 std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator pxd =
676 if (fabs(lx) > 0.55 || fabs(ly) > 3.0)
679 bool passedFiducial =
true;
683 passedFiducial =
false;
686 ((
module == 1 && fabs(ly) < 0.7) ||
687 ((
module == 2 && fabs(ly) < 1.1) && !(disk == -1 && ly > 0.8 && lx > 0.2) &&
688 !(disk == 1 && ly < -0.7 && lx > 0.2) && !(disk == 2 && ly < -0.8)) ||
689 ((
module == 3 && fabs(ly) < 1.5) && !(disk == -2 && lx > 0.1 && ly > 1.0) &&
690 !(disk == 2 && lx > 0.1 && ly < -1.0)) ||
691 ((
module == 4 && fabs(ly) < 1.9) && !(disk == -2 && ly > 1.5) && !(disk == 2 && ly < -1.5)))) ||
693 ((
module == 1 && fabs(ly) < 0.7) ||
694 (
module == 2 && fabs(ly) < 1.2 && !(disk > 0 && ly > 1.1) && !(disk < 0 && ly < -1.1)) ||
695 (
module == 3 && fabs(ly) < 1.6 && !(disk > 0 && ly > 1.5) && !(disk < 0 && ly < -1.5))))))
696 passedFiducial =
false;
699 (panel == 2 && ((
module == 1 &&
abs(disk) == 2) || (
module == 3 &&
abs(disk) == 1)))))
700 passedFiducial =
false;
702 double ly_mod = fabs(ly);
704 ly_mod = ly_mod + 0.405;
705 float d_rocedge = fabs(fmod(ly_mod, 0.81) - 0.405);
706 if (d_rocedge <= 0.0625)
707 passedFiducial =
false;
709 ((!isHalfModule && fabs(lx) < 0.6) || (isHalfModule && lx > -0.3 && lx < 0.2))) ||
712 ((
module == 1 && fabs(lx) < 0.2) ||
713 (
module == 2 && ((fabs(lx) < 0.55 &&
abs(disk) == 1) || (lx > -0.5 && lx < 0.2 && disk == -2) ||
714 (lx > -0.5 && lx < 0.0 && disk == 2))) ||
715 (
module == 3 && lx > -0.6 && lx < 0.5) || (
module == 4 && lx > -0.3 && lx < 0.15))) ||
716 (panel == 2 && ((
module == 1 && fabs(lx) < 0.6) ||
717 (
module == 2 && ((fabs(lx) < 0.55 &&
abs(disk) == 1) ||
718 (lx > -0.6 && lx < 0.5 &&
abs(disk) == 2))) ||
719 (
module == 3 && fabs(lx) < 0.5)))))))
720 passedFiducial =
false;
724 passedFiducial =
false;
729 dx_cl[0] = dx_cl[1] = dy_cl[0] = dy_cl[1] = -9999.;
739 if (clusterCollectionHandle.
isValid()) {
743 minD[0] = minD[1] = 10000.;
744 for (; itClusterSet != clusterCollection.
end(); itClusterSet++) {
745 DetId detId(itClusterSet->
id());
746 if (detId.rawId() !=
hit->geographicalId().rawId())
751 for (; itCluster != itClusterSet->
end(); ++itCluster) {
752 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
755 float D =
sqrt((lp.
x() - lx) * (lp.
x() - lx) + (lp.
y() - ly) * (lp.
y() - ly));
763 }
else if (
D < minD[1]) {
770 for (
size_t i = 0;
i < 2;
i++) {
771 if (minD[
i] < 9999.) {
772 dx_cl[
i] = fabs(dx_cl[
i] - lx);
773 dy_cl[
i] = fabs(dy_cl[
i] - ly);
781 d_cl[0] = d_cl[1] = -9999.;
782 if (dx_cl[0] != -9999. && dy_cl[0] != -9999.)
783 d_cl[0] =
sqrt(dx_cl[0] * dx_cl[0] + dy_cl[0] * dy_cl[0]);
784 if (dx_cl[1] != -9999. && dy_cl[1] != -9999.)
785 d_cl[1] =
sqrt(dx_cl[1] * dx_cl[1] + dy_cl[1] * dy_cl[1]);
786 if (isHitMissing && (d_cl[0] < 0.05 || d_cl[1] < 0.05)) {
787 isHitMissing =
false;
792 std::cout <<
"Ready to add hit in histogram:\n";
794 std::cout <<
"isHitValid: " << isHitValid << std::endl;
795 std::cout <<
"isHitMissing: " << isHitMissing << std::endl;