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;
380 std::vector<TrajectoryMeasurement> tmeasColl = traj_iterator->measurements();
381 std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
383 for (tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end(); tmeasIt++) {
389 uint testSubDetID = (testhit->geographicalId().subdetId());
390 const DetId &hit_detId = testhit->geographicalId();
429 bool lastValidL2 =
false;
432 if (testhit->isValid()) {
433 if (tmeasIt == tmeasColl.end() - 1) {
438 uint nextSubDetID = (nextRecHit->geographicalId().subdetId());
439 int nextlayer =
PixelBarrelName(nextRecHit->geographicalId()).layerName();
448 std::vector<const BarrelDetLayer *> pxbLayers =
449 measurementTrackerHandle->geometricSearchTracker()->pixelBarrelLayers();
450 const DetLayer *pxb1 = pxbLayers[extrapolateTo_ - 1];
453 new LayerMeasurements(*measurementTrackerHandle, *measurementTrackerEventHandle);
455 expTrajMeasurements = theLayerMeasurements->
measurements(*pxb1, tsosPXB2, *thePropagator, *
estimator);
456 delete theLayerMeasurements;
457 if (!expTrajMeasurements.empty()) {
458 for (
uint p = 0;
p < expTrajMeasurements.size();
p++) {
460 const auto &pxb1Hit = pxb1TM.
recHit();
462 if (pxb1Hit->geographicalId().rawId() == 0) {
463 expTrajMeasurements.erase(expTrajMeasurements.begin() +
p);
472 trajStateComb(tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState());
473 if (!chkPredTrajState.
isValid())
482 vector<int> imatches;
484 float glmatch = 9999.;
485 for (
size_t iexp = 0; iexp < expTrajMeasurements.size(); iexp++) {
486 const DetId &exphit_detId = expTrajMeasurements[iexp].recHit()->geographicalId();
489 int dladder =
abs(exphit_ladder - hit_ladder);
491 dladder = 20 - dladder;
492 int dmodule =
abs(exphit_mod - hit_mod);
493 if (dladder != 0 || dmodule != 0) {
501 float dxyz =
sqrt((chkx -
x) * (chkx -
x) + (chky -
y) * (chky -
y) + (chkz -
z) * (chkz -
z));
503 if (dxyz <= glmatch) {
506 imatches.push_back(
int(imatch));
511 float lxmatch = 9999.0;
512 float lymatch = 9999.0;
513 if (!expTrajMeasurements.empty()) {
514 if (glmatch < 9999.) {
515 const DetId &matchhit_detId = expTrajMeasurements[imatch].recHit()->geographicalId();
518 int dladder =
abs(matchhit_ladder - hit_ladder);
520 dladder = 20 - dladder;
521 LocalPoint lp = expTrajMeasurements[imatch].updatedState().localPosition();
522 lxmatch = fabs(lp.
x() - chklp.
x());
523 lymatch = fabs(lp.
y() - chklp.
y());
525 if (lxmatch < maxlxmatch_ && lymatch < maxlymatch_) {
527 expTrajMeasurements.erase(expTrajMeasurements.begin() + imatch);
538 if (!expTrajMeasurements.empty()) {
539 for (
size_t f = 0;
f < expTrajMeasurements.size();
f++) {
542 tmeasColl.push_back(AddHit);
548 if (isBpixtrack || isFpixtrack) {
549 if (trackref->pt() < 0.6 || nStripHits < 8 || fabs(trackref->dxy(bestVtx->position())) > 0.05 ||
550 fabs(trackref->dz(bestVtx->position())) > 0.5)
554 std::cout <<
"isBpixtrack : " << isBpixtrack << std::endl;
555 std::cout <<
"isFpixtrack : " << isFpixtrack << std::endl;
559 for (std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end();
569 const DetId &hit_detId =
hit->geographicalId();
573 if (IntSubDetID == 0) {
585 bool isHalfModule =
false;
593 if (
hit->isValid()) {
599 if (clusterProbability != 0)
608 if (
hit->isValid()) {
614 if (clusterProbability != 0)
620 if (fabs(trackref->dxy(bestVtx->position())) > 0.01 || fabs(trackref->dz(bestVtx->position())) > 0.1)
622 if (!(L2hits > 0 && L3hits > 0) && !(L2hits > 0 && D1hits > 0) && !(D1hits > 0 && D2hits > 0))
624 }
else if (
layer == 2) {
625 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
627 if (!(L1hits > 0 && L3hits > 0) && !(L1hits > 0 && D1hits > 0))
629 }
else if (
layer == 3) {
630 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
632 if (!(L1hits > 0 && L2hits > 0))
634 }
else if (
layer == 4) {
635 if (fabs(trackref->dxy(bestVtx->position())) > 0.02 || fabs(trackref->dz(bestVtx->position())) > 0.1)
637 }
else if (disk == 1) {
638 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
640 if (!(L1hits > 0 && D2hits > 0) && !(L2hits > 0 && D2hits > 0))
642 }
else if (disk == 2) {
643 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
645 if (!(L1hits > 0 && D1hits > 0))
647 }
else if (disk == 3) {
648 if (fabs(trackref->dxy(bestVtx->position())) > 0.05 || fabs(trackref->dz(bestVtx->position())) > 0.5)
659 std::map<uint32_t, SiPixelHitEfficiencyModule *>::iterator pxd =
670 if (fabs(lx) > 0.55 || fabs(ly) > 3.0)
673 bool passedFiducial =
true;
677 passedFiducial =
false;
680 ((
module == 1 && fabs(ly) < 0.7) ||
681 ((
module == 2 && fabs(ly) < 1.1) && !(disk == -1 && ly > 0.8 && lx > 0.2) &&
682 !(disk == 1 && ly < -0.7 && lx > 0.2) && !(disk == 2 && ly < -0.8)) ||
683 ((
module == 3 && fabs(ly) < 1.5) && !(disk == -2 && lx > 0.1 && ly > 1.0) &&
684 !(disk == 2 && lx > 0.1 && ly < -1.0)) ||
685 ((
module == 4 && fabs(ly) < 1.9) && !(disk == -2 && ly > 1.5) && !(disk == 2 && ly < -1.5)))) ||
687 ((
module == 1 && fabs(ly) < 0.7) ||
688 (
module == 2 && fabs(ly) < 1.2 && !(disk > 0 && ly > 1.1) && !(disk < 0 && ly < -1.1)) ||
689 (
module == 3 && fabs(ly) < 1.6 && !(disk > 0 && ly > 1.5) && !(disk < 0 && ly < -1.5))))))
690 passedFiducial =
false;
693 (panel == 2 && ((
module == 1 &&
abs(disk) == 2) || (
module == 3 &&
abs(disk) == 1)))))
694 passedFiducial =
false;
696 double ly_mod = fabs(ly);
698 ly_mod = ly_mod + 0.405;
699 float d_rocedge = fabs(fmod(ly_mod, 0.81) - 0.405);
700 if (d_rocedge <= 0.0625)
701 passedFiducial =
false;
703 ((!isHalfModule && fabs(lx) < 0.6) || (isHalfModule && lx > -0.3 && lx < 0.2))) ||
706 ((
module == 1 && fabs(lx) < 0.2) ||
707 (
module == 2 && ((fabs(lx) < 0.55 &&
abs(disk) == 1) || (lx > -0.5 && lx < 0.2 && disk == -2) ||
708 (lx > -0.5 && lx < 0.0 && disk == 2))) ||
709 (
module == 3 && lx > -0.6 && lx < 0.5) || (
module == 4 && lx > -0.3 && lx < 0.15))) ||
710 (panel == 2 && ((
module == 1 && fabs(lx) < 0.6) ||
711 (
module == 2 && ((fabs(lx) < 0.55 &&
abs(disk) == 1) ||
712 (lx > -0.6 && lx < 0.5 &&
abs(disk) == 2))) ||
713 (
module == 3 && fabs(lx) < 0.5)))))))
714 passedFiducial =
false;
718 passedFiducial =
false;
723 dx_cl[0] = dx_cl[1] = dy_cl[0] = dy_cl[1] = -9999.;
733 if (clusterCollectionHandle.
isValid()) {
737 minD[0] = minD[1] = 10000.;
740 if (
detId.rawId() !=
hit->geographicalId().rawId())
745 for (; itCluster != itClusterSet->
end(); ++itCluster) {
746 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
749 float D =
sqrt((lp.
x() - lx) * (lp.
x() - lx) + (lp.
y() - ly) * (lp.
y() - ly));
757 }
else if (
D < minD[1]) {
764 for (
size_t i = 0;
i < 2;
i++) {
765 if (minD[
i] < 9999.) {
766 dx_cl[
i] = fabs(dx_cl[
i] - lx);
767 dy_cl[
i] = fabs(dy_cl[
i] - ly);
775 d_cl[0] = d_cl[1] = -9999.;
776 if (dx_cl[0] != -9999. && dy_cl[0] != -9999.)
777 d_cl[0] =
sqrt(dx_cl[0] * dx_cl[0] + dy_cl[0] * dy_cl[0]);
778 if (dx_cl[1] != -9999. && dy_cl[1] != -9999.)
779 d_cl[1] =
sqrt(dx_cl[1] * dx_cl[1] + dy_cl[1] * dy_cl[1]);
780 if (isHitMissing && (d_cl[0] < 0.05 || d_cl[1] < 0.05)) {
781 isHitMissing =
false;
786 std::cout <<
"Ready to add hit in histogram:\n";
788 std::cout <<
"isHitValid: " << isHitValid << std::endl;
789 std::cout <<
"isHitMissing: " << isHitMissing << std::endl;
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerEventToken_
Log< level::Info, true > LogVerbatim
uint32_t second(const DetId &id) const
static constexpr auto TEC
MonitorElement * meClusterProbabilityL2_Plus_
std::map< uint32_t, SiPixelHitEfficiencyModule * > theSiPixelStructure
virtual void setPropagationDirection(PropagationDirection dir)
T getParameter(std::string const &) const
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
edm::EDGetTokenT< reco::VertexCollection > vertexCollectionToken_
const_iterator end(bool update=false) const
shell
Create symlink for executable/python cms config if needed.
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)