39 #define COUT(x) std::cout << x << ' '
41 #define COUT(x) LogDebug(x)
48 : confID_(iConfig.
id()),
50 NumberOfTracks(nullptr),
51 NumberOfMeanRecHitsPerTrack(nullptr),
52 NumberOfMeanLayersPerTrack(nullptr)
55 FractionOfGoodTracks(nullptr),
56 NumberOfTrackingRegions(nullptr),
57 NumberOfSeeds(nullptr),
58 NumberOfSeeds_lumiFlag(nullptr),
59 NumberOfTrackCandidates(nullptr),
60 FractionCandidatesOverSeeds(nullptr)
63 NumberEventsOfVsLS(nullptr),
64 NumberOfTracksVsLS(nullptr)
67 GoodTracksFractionVsLS(nullptr)
72 NumberOfGoodPVtxVsLS(nullptr),
73 NumberOfGoodPVtxWO0VsLS(nullptr),
74 NumberEventsOfVsBX(nullptr),
75 NumberOfTracksVsBX(nullptr),
76 GoodTracksFractionVsBX(nullptr),
77 NumberOfRecHitsPerTrackVsBX(nullptr),
78 NumberOfGoodPVtxVsBX(nullptr),
79 NumberOfGoodPVtxWO0VsBX(nullptr),
80 NumberOfTracksVsBXlumi(nullptr),
81 NumberOfTracksVsGoodPVtx(nullptr),
82 NumberOfTracksVsPUPVtx(nullptr),
83 NumberEventsOfVsGoodPVtx(nullptr),
84 GoodTracksFractionVsGoodPVtx(nullptr),
85 NumberOfRecHitsPerTrackVsGoodPVtx(nullptr),
86 NumberOfPVtxVsGoodPVtx(nullptr),
87 NumberOfPixelClustersVsGoodPVtx(nullptr),
88 NumberOfStripClustersVsGoodPVtx(nullptr),
89 NumberEventsOfVsLUMI(nullptr),
90 NumberOfTracksVsLUMI(nullptr),
91 GoodTracksFractionVsLUMI(nullptr),
92 NumberOfRecHitsPerTrackVsLUMI(nullptr),
93 NumberOfGoodPVtxVsLUMI(nullptr),
94 NumberOfGoodPVtxWO0VsLUMI(nullptr),
95 NumberOfPixelClustersVsLUMI(nullptr),
96 NumberOfStripClustersVsLUMI(nullptr),
97 NumberOfTracks_lumiFlag(nullptr)
101 builderName(iConfig.getParameter<
std::
string>(
"TTRHBuilder")),
102 doTrackerSpecific_(iConfig.getParameter<
bool>(
"doTrackerSpecific")),
104 doProfilesVsLS_(iConfig.getParameter<
bool>(
"doProfilesVsLS")),
105 doAllSeedPlots(iConfig.getParameter<
bool>(
"doSeedParameterHistos")),
107 doGeneralPropertiesPlots_(iConfig.getParameter<
bool>(
"doGeneralPropertiesPlots")),
108 doHitPropertiesPlots_(iConfig.getParameter<
bool>(
"doHitPropertiesPlots")),
109 doTkCandPlots(iConfig.getParameter<
bool>(
"doTrackCandHistos")),
110 doPUmonitoring_(iConfig.getParameter<
bool>(
"doPUmonitoring")),
112 iConfig.getParameter<
edm::
ParameterSet>(
"genericTriggerEventPSet"), consumesCollector(), *this)),
113 numSelection_(iConfig.getParameter<
std::
string>(
"numCut")),
114 denSelection_(iConfig.getParameter<
std::
string>(
"denCut")),
115 pvNDOF_(iConfig.getParameter<
int>(
"pvNDOF")),
116 forceSCAL_(iConfig.getParameter<
bool>(
"forceSCAL")) {
133 allTrackToken_ = consumes<edm::View<reco::Track> >(alltrackProducer);
136 seedToken_ = consumes<edm::View<TrajectorySeed> >(seedProducer);
143 return std::make_tuple(consumes<MVACollection>(edm::InputTag(tag,
"MVAValues")),
144 consumes<QualityMaskCollection>(edm::InputTag(tag,
"QualityMasks")));
157 if (!regionLayersTag.label().empty()) {
160 <<
"Only one of 'RegionProducer' and 'RegionSeedingLayersProducer' can be non-empty, now both are.";
164 throw cms::Exception(
"Configuration") <<
"With doRegionPlots=True either 'RegionProducer' or "
165 "'RegionSeedingLayersProducer' must be non-empty, now both are empty.";
209 iConfig.
getParameter<std::vector<edm::InputTag> >(
"primaryVertexInputTags");
211 iConfig.
getParameter<std::vector<edm::InputTag> >(
"selPrimaryVertexInputTags");
212 std::vector<std::string>
pvLabels = iConfig.
getParameter<std::vector<std::string> >(
"pvLabels");
252 edm::LogWarning(
"TrackingMonitor") <<
"Qualty Name is invalid, using no quality criterea by default";
261 int TKNoBin = conf->getParameter<
int>(
"TkSizeBin");
262 double TKNoMin = conf->getParameter<
double>(
"TkSizeMin");
263 double TKNoMax = conf->getParameter<
double>(
"TkSizeMax");
265 int TCNoBin = conf->getParameter<
int>(
"TCSizeBin");
266 double TCNoMin = conf->getParameter<
double>(
"TCSizeMin");
267 double TCNoMax = conf->getParameter<
double>(
"TCSizeMax");
269 int TKNoSeedBin = conf->getParameter<
int>(
"TkSeedSizeBin");
270 double TKNoSeedMin = conf->getParameter<
double>(
"TkSeedSizeMin");
271 double TKNoSeedMax = conf->getParameter<
double>(
"TkSeedSizeMax");
274 double RecHitMin = conf->getParameter<
double>(
"RecHitMin");
275 double RecHitMax = conf->getParameter<
double>(
"RecHitMax");
277 int MeanHitBin = conf->getParameter<
int>(
"MeanHitBin");
278 double MeanHitMin = conf->getParameter<
double>(
"MeanHitMin");
279 double MeanHitMax = conf->getParameter<
double>(
"MeanHitMax");
281 int MeanLayBin = conf->getParameter<
int>(
"MeanLayBin");
282 double MeanLayMin = conf->getParameter<
double>(
"MeanLayMin");
283 double MeanLayMax = conf->getParameter<
double>(
"MeanLayMax");
285 int LSBin = conf->getParameter<
int>(
"LSBin");
286 int LSMin = conf->getParameter<
double>(
"LSMin");
287 int LSMax = conf->getParameter<
double>(
"LSMax");
290 if (StateName !=
"OuterSurface" && StateName !=
"InnerSurface" && StateName !=
"ImpactPoint" &&
291 StateName !=
"default" && StateName !=
"All") {
293 edm::LogWarning(
"TrackingMonitor") <<
"State Name is invalid, using 'ImpactPoint' by default";
304 histname =
"NumberOfTracks_" + CategoryName;
311 histname =
"NumberOfTracks_PUvtx_" + CategoryName;
316 histname =
"NumberofTracks_Hardvtx_" + CategoryName;
322 histname =
"NumberofTracks_Hardvtx_PUvtx_" + CategoryName;
330 histname =
"NumberOfMeanRecHitsPerTrack_" + CategoryName;
335 histname =
"NumberOfMeanLayersPerTrack_" + CategoryName;
341 histname =
"FractionOfGoodTracks_" + CategoryName;
353 histname =
"NumberOfTracks_lumiFlag_" + CategoryName;
365 histname =
"NumberOfTracksVsLS_" + CategoryName;
371 histname =
"NumberOfRecHitsPerTrackVsLS_" + CategoryName;
378 histname =
"NumberEventsVsLS_" + CategoryName;
389 histname =
"NumberOfGoodPVtxVsLS_" + CategoryName;
396 histname =
"NumberOfGoodPVtxWO0VsLS_" + CategoryName;
403 histname =
"GoodTracksFractionVsLS_" + CategoryName;
414 double BXMax = 3564.5;
416 histname =
"NumberEventsVsBX_" + CategoryName;
421 histname =
"NumberOfTracksVsBX_" + CategoryName;
426 histname =
"NumberOfRecHitsPerTrackVsBX_" + CategoryName;
432 histname =
"NumberOfGoodPVtxVsBX_" + CategoryName;
438 histname =
"NumberOfGoodPVtxWO0VsBX_" + CategoryName;
445 histname =
"GoodTracksFractionVsBX_" + CategoryName;
464 int PVBin = conf->getParameter<
int>(
"PVBin");
465 float PVMin = conf->getParameter<
double>(
"PVMin");
466 float PVMax = conf->getParameter<
double>(
"PVMax");
468 histname =
"NumberOfTracksVsGoodPVtx";
473 histname =
"NumberOfTracksVsPUPVtx";
478 histname =
"NumberEventsVsGoodPVtx";
484 histname =
"GoodTracksFractionVsGoodPVtx";
490 histname =
"NumberOfRecHitsPerTrackVsGoodPVtx";
495 histname =
"NumberOfPVtxVsGoodPVtx";
500 double NClusPxMin = conf->getParameter<
double>(
"NClusPxMin");
501 double NClusPxMax = conf->getParameter<
double>(
"NClusPxMax");
502 histname =
"NumberOfPixelClustersVsGoodPVtx";
508 double NClusStrMin = conf->getParameter<
double>(
"NClusStrMin");
509 double NClusStrMax = conf->getParameter<
double>(
"NClusStrMax");
510 histname =
"NumberOfStripClustersVsGoodPVtx";
519 int LUMIBin = conf->getParameter<
int>(
"LUMIBin");
520 float LUMIMin = conf->getParameter<
double>(
"LUMIMin");
521 float LUMIMax = conf->getParameter<
double>(
"LUMIMax");
534 histname =
"GoodTracksFractionVsLUMI";
540 histname =
"NumberOfRecHitsPerTrackVsLUMI";
546 double PVMin = conf->getParameter<
double>(
"PVMin");
547 double PVMax = conf->getParameter<
double>(
"PVMax");
549 histname =
"NumberOfGoodPVtxVsLUMI";
554 histname =
"NumberOfGoodPVtxWO0VsLUMI";
560 double NClusPxMin = conf->getParameter<
double>(
"NClusPxMin");
561 double NClusPxMax = conf->getParameter<
double>(
"NClusPxMax");
562 histname =
"NumberOfPixelClustersVsGoodPVtx";
568 double NClusStrMin = conf->getParameter<
double>(
"NClusStrMin");
569 double NClusStrMax = conf->getParameter<
double>(
"NClusStrMax");
570 histname =
"NumberOfStripClustersVsLUMI";
585 histname =
"NumberOfTracksVsBXlumi_" + CategoryName;
612 histname =
"NumberOfSeeds_" + seedProducer.label() +
"_" + CategoryName;
620 histname =
"NumberOfSeeds_lumiFlag_" + seedProducer.label() +
"_" + CategoryName;
630 ClusterLabels = conf->getParameter<std::vector<std::string> >(
"ClusterLabels");
632 std::vector<double> histoMin, histoMax;
633 std::vector<int> histoBin;
635 int NClusPxBin = conf->getParameter<
int>(
"NClusPxBin");
636 double NClusPxMin = conf->getParameter<
double>(
"NClusPxMin");
637 double NClusPxMax = conf->getParameter<
double>(
"NClusPxMax");
639 int NClusStrBin = conf->getParameter<
int>(
"NClusStrBin");
640 double NClusStrMin = conf->getParameter<
double>(
"NClusStrMin");
641 double NClusStrMax = conf->getParameter<
double>(
"NClusStrMax");
649 histname,
histname, histoBin[
i], histoMin[
i], histoMax[
i], TKNoSeedBin, TKNoSeedMin, TKNoSeedMax)));
659 int regionBin = conf->getParameter<
int>(
"RegionSizeBin");
660 double regionMin = conf->getParameter<
double>(
"RegionSizeMin");
661 double regionMax = conf->getParameter<
double>(
"RegionSizeMax");
663 histname =
"TrackingRegionsNumberOf_" + seedProducer.label() +
"_" + CategoryName;
674 histname =
"NumberOfTrackCandidates_" + tcProducer.
label() +
"_" + CategoryName;
679 histname =
"FractionOfCandOverSeeds_" + tcProducer.
label() +
"_" + CategoryName;
688 ClusterLabels = conf->getParameter<std::vector<std::string> >(
"ClusterLabels");
690 std::vector<double> histoMin, histoMax;
691 std::vector<int> histoBin;
693 int NClusStrBin = conf->getParameter<
int>(
"NClusStrBin");
694 double NClusStrMin = conf->getParameter<
double>(
"NClusStrMin");
695 double NClusStrMax = conf->getParameter<
double>(
"NClusStrMax");
697 int NClusPxBin = conf->getParameter<
int>(
"NClusPxBin");
698 double NClusPxMin = conf->getParameter<
double>(
"NClusPxMin");
699 double NClusPxMax = conf->getParameter<
double>(
"NClusPxMax");
702 int NTrk2DBin = ParametersNTrk2D.getParameter<
int>(
"NTrk2DBin");
703 double NTrk2DMin = ParametersNTrk2D.getParameter<
double>(
"NTrk2DMin");
704 double NTrk2DMax = ParametersNTrk2D.getParameter<
double>(
"NTrk2DMax");
718 title =
"# of Clusters in (Pixel+Strip) Detectors";
752 LumiScalersCollection::const_iterator scalit =
lumiScalers->begin();
753 lumi = scalit->instantLumi();
775 int numberOfTracks_den = 0;
777 if (allTrackHandle.
isValid()) {
781 numberOfTracks_den++;
788 pv0 = &pvHandle->front();
798 int numberOfTracks = trackHandle->size();
799 int numberOfTracks_num = 0;
800 int numberOfTracks_pv0 = 0;
804 int totalRecHits = 0, totalLayers = 0;
814 numberOfTracks_num++;
816 ++numberOfTracks_pv0;
821 track->numberOfValidHits());
826 totalRecHits +=
track->numberOfValidHits();
827 totalLayers +=
track->hitPattern().trackerLayersWithMeasurement();
835 if (numberOfTracks_den > 0)
836 frac = static_cast<double>(numberOfTracks_num) / static_cast<double>(numberOfTracks_den);
862 if (numberOfTracks > 0) {
863 double meanRecHits = static_cast<double>(totalRecHits) / static_cast<double>(numberOfTracks);
864 double meanLayers = static_cast<double>(totalLayers) / static_cast<double>(numberOfTracks);
871 float nLS = static_cast<double>(
iEvent.id().luminosityBlock());
909 for (TrackCandidateCollection::const_iterator
cand = theTCCollection.begin();
cand != theTCCollection.end();
914 edm::LogWarning(
"TrackingMonitor") <<
"No Track Candidates in the event. Not filling associated histograms";
919 std::vector<const MVACollection*> mvaCollections;
920 std::vector<const QualityMaskCollection*> qualityMaskCollections;
927 hmva =
iEvent.getHandle(std::get<0>(tokenTpl));
928 hqual =
iEvent.getHandle(std::get<1>(tokenTpl));
929 mvaCollections.push_back(hmva.
product());
930 qualityMaskCollections.push_back(hqual.
product());
953 std::vector<int> NClus;
962 const auto& seedStopInfo = *stopHandle;
981 <<
") differs from seed stop info collection size (" << seedStopInfo.size()
982 <<
"). This is a sign of inconsistency in the configuration. Not filling associated histograms.";
987 edm::LogWarning(
"TrackingMonitor") <<
"No Trajectory seeds in the event. Not filling associated histograms";
995 const auto&
regions = *hregions;
1001 const auto&
regions = *hregions;
1014 std::vector<int> NClus;
1027 size_t totalNumGoodPV = 0;
1029 for (reco::VertexCollection::const_iterator
pv = pvHandle->begin();
pv != pvHandle->end(); ++
pv) {
1031 if (
pv->isFake() ||
pv->tracksSize() == 0)
1042 if (totalNumGoodPV > 1)
1044 double(numberOfTracks - numberOfTracks_pv0) /
double(totalNumGoodPV - 1));
1064 std::vector<int> NClus;
1066 std::ostringstream
ss;
1067 ss <<
"VI stat " << totalNumGoodPV <<
' ' << numberOfTracks;
1069 ss <<
' ' << NClus[
i];
1088 if (totalNumGoodPV != 0)
1091 if (totalNumGoodPV != 0)
1094 if (totalNumGoodPV != 0)
1103 std::vector<double>& arrayMax,
1104 std::vector<int>& arrayBin,
1126 arrayMax[
i] = smax + pmax;
1130 <<
" not defined, using strip parameters ";
1139 int ncluster_pix = -1;
1140 int ncluster_strip = -1;
1146 ncluster_pix = (*pixel_clusters).dataSize();
1147 ncluster_strip = (*strip_clusters).dataSize();
1153 arrayNclus[
i] = ncluster_pix;
1155 arrayNclus[
i] = ncluster_strip;
1157 arrayNclus[
i] = ncluster_pix + ncluster_strip;
1160 <<
" not defined using stri parametrs ";
1161 arrayNclus[
i] = ncluster_strip;