97 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource constructor" << endl;
103 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource destructor" << endl;
105 std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator struct_iter;
107 delete struct_iter->second;
108 struct_iter->second =
nullptr;
122 else if (layer == 2) {
129 else if (layer == 3) {
154 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource beginRun()" << endl;
168 LogVerbatim(
"PixelDQM") <<
"TrackerGeometry " << &(*TG) <<
" size is " << TG->
dets().size() << endl;
172 for (TrackerGeometry::DetContainer::const_iterator pxb = TG->
detsPXB().begin(); pxb != TG->
detsPXB().end(); pxb++) {
173 if (dynamic_cast<PixelGeomDetUnit const *>((*pxb)) !=
nullptr) {
176 pair<uint32_t, SiPixelHitEfficiencyModule *>((*pxb)->geographicalId().rawId(), module));
179 for (TrackerGeometry::DetContainer::const_iterator pxf = TG->
detsPXF().begin(); pxf != TG->
detsPXF().end(); pxf++) {
180 if (dynamic_cast<PixelGeomDetUnit const *>((*pxf)) !=
nullptr) {
183 pair<uint32_t, SiPixelHitEfficiencyModule *>((*pxf)->geographicalId().rawId(), module));
195 for (std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator pxd =
theSiPixelStructure.begin();
202 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Folder Creation Failed! ";
208 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource ladder Folder Creation Failed! ";
214 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource layer Folder Creation Failed! ";
220 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource phi Folder Creation Failed! ";
226 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Blade Folder Creation Failed! ";
232 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Disk Folder Creation Failed! ";
238 throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Ring Folder Creation Failed! ";
246 iBooker.
book1D(
"ClusterProbabilityXY_Layer1_Plus",
"ClusterProbabilityXY_Layer1_Plus", 500, -14, 0.1);
250 iBooker.
book1D(
"ClusterProbabilityXY_Layer1_Minus",
"ClusterProbabilityXY_Layer1_Minus", 500, -14, 0.1);
254 iBooker.
book1D(
"ClusterProbabilityXY_Layer2_Plus",
"ClusterProbabilityXY_Layer2_Plus", 500, -14, 0.1);
258 iBooker.
book1D(
"ClusterProbabilityXY_Layer2_Minus",
"ClusterProbabilityXY_Layer2_Minus", 500, -14, 0.1);
262 iBooker.
book1D(
"ClusterProbabilityXY_Layer3_Plus",
"ClusterProbabilityXY_Layer3_Plus", 500, -14, 0.1);
266 iBooker.
book1D(
"ClusterProbabilityXY_Layer3_Minus",
"ClusterProbabilityXY_Layer3_Minus", 500, -14, 0.1);
272 iBooker.
book1D(
"ClusterProbabilityXY_Disk1_Plus",
"ClusterProbabilityXY_Disk1_Plus", 500, -14, 0.1);
276 iBooker.
book1D(
"ClusterProbabilityXY_Disk1_Minus",
"ClusterProbabilityXY_Disk1_Minus", 500, -14, 0.1);
280 iBooker.
book1D(
"ClusterProbabilityXY_Disk2_Plus",
"ClusterProbabilityXY_Disk2_Plus", 500, -14, 0.1);
284 iBooker.
book1D(
"ClusterProbabilityXY_Disk2_Minus",
"ClusterProbabilityXY_Disk2_Minus", 500, -14, 0.1);
295 if (!vertexCollectionHandle.
isValid())
306 reco::VertexCollection::const_iterator bestVtx = vertices.end();
307 for (reco::VertexCollection::const_iterator it = vertices.begin(); it != vertices.end(); ++it) {
311 (
vtxntrk_ ==
int(it->tracksSize()) && fabs(
vtxZ_) > fabs(it->z()))) {
313 vtxD0_ = it->position().rho();
321 if (fabs(it->z()) <= 20. && fabs(it->position().rho()) <= 2. && it->ndof() > 4)
343 std::cout <<
"+++ NEW EVENT +++" << std::endl;
344 std::cout <<
"Map entries \t : " << ttac.
size() << std::endl;
347 std::set<SiPixelCluster> clusterSet;
350 int extrapolateFrom_ = 2;
351 int extrapolateTo_ = 1;
352 float maxlxmatch_ = 0.2;
353 float maxlymatch_ = 0.2;
354 bool keepOriginalMissingHit_ =
true;
367 if (extrapolateFrom_ >= extrapolateTo_) {
376 std::vector<TrajectoryMeasurement> expTrajMeasurements;
383 bool isBpixtrack =
false, isFpixtrack =
false;
392 std::vector<TrajectoryMeasurement> tmeasColl = traj_iterator->measurements();
393 std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
395 for (tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end(); tmeasIt++) {
401 uint testSubDetID = (testhit->geographicalId().subdetId());
402 const DetId &hit_detId = testhit->geographicalId();
445 bool lastValidL2 =
false;
448 if (testhit->isValid()) {
449 if (tmeasIt == tmeasColl.end() - 1) {
454 uint nextSubDetID = (nextRecHit->geographicalId().subdetId());
455 int nextlayer =
PixelBarrelName(nextRecHit->geographicalId()).layerName();
464 std::vector<const BarrelDetLayer *> pxbLayers =
465 measurementTrackerHandle->geometricSearchTracker()->pixelBarrelLayers();
466 const DetLayer *pxb1 = pxbLayers[extrapolateTo_ - 1];
469 new LayerMeasurements(*measurementTrackerHandle, *measurementTrackerEventHandle);
471 expTrajMeasurements = theLayerMeasurements->
measurements(*pxb1, tsosPXB2, *thePropagator, *estimator);
472 delete theLayerMeasurements;
473 if (!expTrajMeasurements.empty()) {
474 for (
uint p = 0;
p < expTrajMeasurements.size();
p++) {
476 const auto &pxb1Hit = pxb1TM.
recHit();
478 if (pxb1Hit->geographicalId().rawId() == 0) {
479 expTrajMeasurements.erase(expTrajMeasurements.begin() +
p);
488 trajStateComb(tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState());
489 if (!chkPredTrajState.
isValid())
498 vector<int> imatches;
500 float glmatch = 9999.;
501 for (
size_t iexp = 0; iexp < expTrajMeasurements.size(); iexp++) {
502 const DetId &exphit_detId = expTrajMeasurements[iexp].recHit()->geographicalId();
505 int dladder =
abs(exphit_ladder - hit_ladder);
507 dladder = 20 - dladder;
508 int dmodule =
abs(exphit_mod - hit_mod);
509 if (dladder != 0 || dmodule != 0) {
517 float dxyz =
sqrt((chkx - x) * (chkx - x) + (chky - y) * (chky - y) + (chkz - z) * (chkz - z));
519 if (dxyz <= glmatch) {
522 imatches.push_back(
int(imatch));
527 float lxmatch = 9999.0;
528 float lymatch = 9999.0;
529 if (!expTrajMeasurements.empty()) {
530 if (glmatch < 9999.) {
531 const DetId &matchhit_detId = expTrajMeasurements[imatch].recHit()->geographicalId();
534 int dladder =
abs(matchhit_ladder - hit_ladder);
536 dladder = 20 - dladder;
537 LocalPoint lp = expTrajMeasurements[imatch].updatedState().localPosition();
538 lxmatch = fabs(lp.
x() - chklp.
x());
539 lymatch = fabs(lp.
y() - chklp.
y());
541 if (lxmatch < maxlxmatch_ && lymatch < maxlymatch_) {
543 expTrajMeasurements.erase(expTrajMeasurements.begin() + imatch);
554 if (!expTrajMeasurements.empty()) {
555 for (
size_t f = 0;
f < expTrajMeasurements.size();
f++) {
558 tmeasColl.push_back(AddHit);
564 if (isBpixtrack || isFpixtrack) {
565 if (trackref->pt() < 0.6 || nStripHits < 8 || fabs(trackref->dxy(bestVtx->position())) > 0.05 ||
566 fabs(trackref->dz(bestVtx->position())) > 0.5)
570 std::cout <<
"isBpixtrack : " << isBpixtrack << std::endl;
571 std::cout <<
"isFpixtrack : " << isFpixtrack << std::endl;
575 for (std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end();
585 const DetId &hit_detId = hit->geographicalId();
589 if (IntSubDetID == 0) {
601 bool isHalfModule =
false;
609 if (hit->isValid()) {
615 if (clusterProbability != 0)
624 if (hit->isValid()) {
630 if (clusterProbability != 0)
636 if (fabs(trackref->dxy(bestVtx->position())) > 0.01 || fabs(trackref->dz(bestVtx->position())) > 0.1)
638 if (!(L2hits > 0 && L3hits > 0) && !(L2hits > 0 && D1hits > 0) && !(D1hits > 0 && D2hits > 0))
640 }
else if (layer == 2) {
641 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
643 if (!(L1hits > 0 && L3hits > 0) && !(L1hits > 0 && D1hits > 0))
645 }
else if (layer == 3) {
646 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
648 if (!(L1hits > 0 && L2hits > 0))
650 }
else if (layer == 4) {
651 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
653 }
else if (disk == 1) {
654 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
656 if (!(L1hits > 0 && D2hits > 0) && !(L2hits > 0 && D2hits > 0))
658 }
else if (disk == 2) {
659 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
661 if (!(L1hits > 0 && D1hits > 0))
663 }
else if (disk == 3) {
664 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
675 std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator pxd =
686 if (fabs(lx) > 0.55 || fabs(ly) > 3.0)
689 bool passedFiducial =
true;
693 passedFiducial =
false;
696 ((module == 1 && fabs(ly) < 0.7) ||
697 ((module == 2 && fabs(ly) < 1.1) && !(disk == -1 && ly > 0.8 && lx > 0.2) &&
698 !(disk == 1 && ly < -0.7 && lx > 0.2) && !(disk == 2 && ly < -0.8)) ||
699 ((module == 3 && fabs(ly) < 1.5) && !(disk == -2 && lx > 0.1 && ly > 1.0) &&
700 !(disk == 2 && lx > 0.1 && ly < -1.0)) ||
701 ((module == 4 && fabs(ly) < 1.9) && !(disk == -2 && ly > 1.5) && !(disk == 2 && ly < -1.5)))) ||
703 ((module == 1 && fabs(ly) < 0.7) ||
704 (module == 2 && fabs(ly) < 1.2 && !(disk > 0 && ly > 1.1) && !(disk < 0 && ly < -1.1)) ||
705 (module == 3 && fabs(ly) < 1.6 && !(disk > 0 && ly > 1.5) && !(disk < 0 && ly < -1.5))))))
706 passedFiducial =
false;
708 ((panel == 1 && (module == 1 || (module >= 3 &&
abs(disk) == 1))) ||
709 (panel == 2 && ((module == 1 &&
abs(disk) == 2) || (module == 3 &&
abs(disk) == 1)))))
710 passedFiducial =
false;
712 double ly_mod = fabs(ly);
714 ly_mod = ly_mod + 0.405;
715 float d_rocedge = fabs(fmod(ly_mod, 0.81) - 0.405);
716 if (d_rocedge <= 0.0625)
717 passedFiducial =
false;
719 ((!isHalfModule && fabs(lx) < 0.6) || (isHalfModule && lx > -0.3 && lx < 0.2))) ||
722 ((module == 1 && fabs(lx) < 0.2) ||
723 (module == 2 && ((fabs(lx) < 0.55 &&
abs(disk) == 1) || (lx > -0.5 && lx < 0.2 && disk == -2) ||
724 (lx > -0.5 && lx < 0.0 && disk == 2))) ||
725 (module == 3 && lx > -0.6 && lx < 0.5) || (module == 4 && lx > -0.3 && lx < 0.15))) ||
726 (panel == 2 && ((module == 1 && fabs(lx) < 0.6) ||
727 (module == 2 && ((fabs(lx) < 0.55 &&
abs(disk) == 1) ||
728 (lx > -0.6 && lx < 0.5 &&
abs(disk) == 2))) ||
729 (module == 3 && fabs(lx) < 0.5)))))))
730 passedFiducial =
false;
734 passedFiducial =
false;
739 dx_cl[0] = dx_cl[1] = dy_cl[0] = dy_cl[1] = -9999.;
750 if (clusterCollectionHandle.
isValid()) {
754 minD[0] = minD[1] = 10000.;
755 for (; itClusterSet != clusterCollection.
end(); itClusterSet++) {
756 DetId detId(itClusterSet->
id());
757 if (detId.rawId() != hit->geographicalId().rawId())
762 for (; itCluster != itClusterSet->
end(); ++itCluster) {
763 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
766 float D =
sqrt((lp.
x() - lx) * (lp.
x() - lx) + (lp.
y() - ly) * (lp.
y() - ly));
774 }
else if (D < minD[1]) {
781 for (
size_t i = 0;
i < 2;
i++) {
782 if (minD[
i] < 9999.) {
783 dx_cl[
i] = fabs(dx_cl[
i] - lx);
784 dy_cl[
i] = fabs(dy_cl[
i] - ly);
792 d_cl[0] = d_cl[1] = -9999.;
793 if (dx_cl[0] != -9999. && dy_cl[0] != -9999.)
794 d_cl[0] =
sqrt(dx_cl[0] * dx_cl[0] + dy_cl[0] * dy_cl[0]);
795 if (dx_cl[1] != -9999. && dy_cl[1] != -9999.)
796 d_cl[1] =
sqrt(dx_cl[1] * dx_cl[1] + dy_cl[1] * dy_cl[1]);
797 if (isHitMissing && (d_cl[0] < 0.05 || d_cl[1] < 0.05)) {
798 isHitMissing =
false;
803 std::cout <<
"Ready to add hit in histogram:\n";
805 std::cout <<
"isHitValid: " << isHitValid << std::endl;
806 std::cout <<
"isHitMissing: " << isHitMissing << std::endl;
int plaquetteName() const
plaquetteId (in pannel)
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerEventToken_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
static constexpr auto TEC
MonitorElement * meClusterProbabilityL2_Plus_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
std::map< uint32_t, SiPixelHitEfficiencyModule * > theSiPixelStructure
virtual void setPropagationDirection(PropagationDirection dir)
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
const_iterator end(bool update=false) const
virtual Propagator * clone() const =0
float clusterProbability(unsigned int flags=0) const
ConstRecHitPointer const & recHit() const
SiPixelHitEfficiencySource(const edm::ParameterSet &)
const LocalTrajectoryParameters & localParameters() const
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
LocalPoint localPosition() const
~SiPixelHitEfficiencySource() override
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clusterCollectionToken_
MonitorElement * meClusterProbabilityL1_Minus_
GlobalPoint globalPosition() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
MonitorElement * meClusterProbabilityL3_Plus_
unsigned int ladder() const
ladder id
data_type const * const_iterator
key_type key() const
Accessor for product key.
virtual void fillClusterProbability(int, int, bool, double)
id_type id(size_t cell) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< reco::VertexCollection > vertexCollectionToken_
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
#define DEFINE_FWK_MODULE(type)
bool isHalfModule() const
full or half module
MonitorElement * meClusterProbabilityL3_Minus_
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0, bool isUpgrade=false)
Set folder name for a module or plaquette.
edm::EDGetTokenT< TrajTrackAssociationCollection > tracksrc_
const DetContainer & detsPXB() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
unsigned int module() const
det id
Abs< T >::type abs(const T &t)
MonitorElement * meClusterProbabilityD1_Minus_
static constexpr auto TOB
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
MonitorElement * meClusterProbabilityD1_Plus_
MonitorElement * meClusterProbabilityL1_Plus_
void analyze(const edm::Event &, const edm::EventSetup &) override
static constexpr auto TIB
DecomposeProduct< arg, typename Div::arg > D
size_type size() const
map size
T const * product() const
int layerName() const
layer id
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
int pannelName() const
pannel id
const DetContainer & detsPXF() const
int diskName() const
disk id
MonitorElement * meClusterProbabilityD2_Plus_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
MonitorElement * meClusterProbabilityL2_Minus_
const_iterator begin() const
first iterator over the map (read only)
MonitorElement * meClusterProbabilityD2_Minus_
HalfCylinder halfCylinder() const
modOn
online/offline RawDataErrors
std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType > ReturnType
static constexpr auto TID
T const * product() const
void dqmBeginRun(const edm::Run &r, edm::EventSetup const &iSetup) override
const_iterator begin(bool update=false) const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)