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;
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.;
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;
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerEventToken_
Log< level::Info, true > LogVerbatim
static constexpr auto TEC
MonitorElement * meClusterProbabilityL2_Plus_
std::map< uint32_t, SiPixelHitEfficiencyModule * > theSiPixelStructure
virtual void setPropagationDirection(PropagationDirection dir)
T getParameter(std::string const &) const
constexpr char const * layerName[numberOfLayers]
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomTokenBeginRun_
SiPixelHitEfficiencySource(const edm::ParameterSet &)
LocalPoint localPosition() const
virtual void setCurrentFolder(std::string const &fullpath)
friend struct const_iterator
const DetContainer & detsPXB() const
unsigned int module() const
det id
~SiPixelHitEfficiencySource() override
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clusterCollectionToken_
T const * product() const
virtual Propagator * clone() const =0
const DetContainer & detsPXF() const
MonitorElement * meClusterProbabilityL1_Minus_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoTokenBeginRun_
MonitorElement * meClusterProbabilityL3_Plus_
const LocalTrajectoryParameters & localParameters() const
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
data_type const * const_iterator
virtual void fillClusterProbability(int, int, bool, double)
key_type key() const
Accessor for product key.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
constexpr std::array< uint8_t, layerIndexSize > layer
edm::EDGetTokenT< reco::VertexCollection > vertexCollectionToken_
const_iterator end(bool update=false) const
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
const_iterator end() const
last iterator over the map (read only)
T getUntrackedParameter(std::string const &, T const &) const
size_type size() const
map size
T const * product() const
GlobalPoint globalPosition() const
bool isHalfModule() const
full or half module
MonitorElement * meClusterProbabilityL3_Minus_
int diskName() const
disk id
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_
HalfCylinder halfCylinder() const
Abs< T >::type abs(const T &t)
id_type id(size_t cell) const
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MonitorElement * meClusterProbabilityD1_Minus_
static constexpr auto TOB
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
float clusterProbability(unsigned int flags=0) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Log< level::Info, false > LogInfo
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
const_iterator begin(bool update=false) const
DecomposeProduct< arg, typename Div::arg > D
int layerName() const
layer id
edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2MeasurementEstimatorBaseToken_
const_iterator begin() const
first iterator over the map (read only)
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
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_
MonitorElement * meClusterProbabilityD2_Minus_
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
modOn
online/offline RawDataErrors
unsigned int ladder() const
ladder id
std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType > ReturnType
static constexpr auto TID
void dqmBeginRun(const edm::Run &r, edm::EventSetup const &iSetup) override
int pannelName() const
pannel id
ConstRecHitPointer const & recHit() const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelClusterParameterEstimatorToken_
int plaquetteName() const
plaquetteId (in pannel)