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";
753 LumiScalersCollection::const_iterator scalit =
lumiScalers->begin();
754 lumi = scalit->instantLumi();
778 int numberOfTracks_den = 0;
781 if (allTrackHandle.
isValid()) {
785 numberOfTracks_den++;
793 pv0 = &pvHandle->front();
803 int numberOfTracks = trackHandle->size();
804 int numberOfTracks_num = 0;
805 int numberOfTracks_pv0 = 0;
809 int totalRecHits = 0, totalLayers = 0;
819 numberOfTracks_num++;
821 ++numberOfTracks_pv0;
826 track->numberOfValidHits());
831 totalRecHits +=
track->numberOfValidHits();
832 totalLayers +=
track->hitPattern().trackerLayersWithMeasurement();
840 if (numberOfTracks_den > 0)
841 frac = static_cast<double>(numberOfTracks_num) / static_cast<double>(numberOfTracks_den);
867 if (numberOfTracks > 0) {
868 double meanRecHits = static_cast<double>(totalRecHits) / static_cast<double>(numberOfTracks);
869 double meanLayers = static_cast<double>(totalLayers) / static_cast<double>(numberOfTracks);
876 float nLS = static_cast<double>(
iEvent.id().luminosityBlock());
917 for (TrackCandidateCollection::const_iterator
cand = theTCCollection.begin();
cand != theTCCollection.end();
922 edm::LogWarning(
"TrackingMonitor") <<
"No Track Candidates in the event. Not filling associated histograms";
927 std::vector<const MVACollection*> mvaCollections;
928 std::vector<const QualityMaskCollection*> qualityMaskCollections;
936 iEvent.getByToken(std::get<0>(tokenTpl), hmva);
937 iEvent.getByToken(std::get<1>(tokenTpl), hqual);
939 mvaCollections.push_back(hmva.
product());
940 qualityMaskCollections.push_back(hqual.
product());
964 std::vector<int> NClus;
974 const auto& seedStopInfo = *stopHandle;
994 <<
") differs from seed stop info collection size (" << seedStopInfo.size()
995 <<
"). This is a sign of inconsistency in the configuration. Not filling associated histograms.";
1000 edm::LogWarning(
"TrackingMonitor") <<
"No Trajectory seeds in the event. Not filling associated histograms";
1009 const auto&
regions = *hregions;
1016 const auto&
regions = *hregions;
1030 std::vector<int> NClus;
1043 size_t totalNumGoodPV = 0;
1045 for (reco::VertexCollection::const_iterator
pv = pvHandle->begin();
pv != pvHandle->end(); ++
pv) {
1047 if (
pv->isFake() ||
pv->tracksSize() == 0)
1058 if (totalNumGoodPV > 1)
1060 double(numberOfTracks - numberOfTracks_pv0) /
double(totalNumGoodPV - 1));
1080 std::vector<int> NClus;
1082 std::ostringstream
ss;
1083 ss <<
"VI stat " << totalNumGoodPV <<
' ' << numberOfTracks;
1085 ss <<
' ' << NClus[
i];
1104 if (totalNumGoodPV != 0)
1107 if (totalNumGoodPV != 0)
1110 if (totalNumGoodPV != 0)
1119 std::vector<double>& arrayMax,
1120 std::vector<int>& arrayBin,
1142 arrayMax[
i] = smax + pmax;
1146 <<
" not defined, using strip parameters ";
1155 int ncluster_pix = -1;
1156 int ncluster_strip = -1;
1164 ncluster_pix = (*pixel_clusters).dataSize();
1165 ncluster_strip = (*strip_clusters).dataSize();
1171 arrayNclus[
i] = ncluster_pix;
1173 arrayNclus[
i] = ncluster_strip;
1175 arrayNclus[
i] = ncluster_pix + ncluster_strip;
1178 <<
" not defined using stri parametrs ";
1179 arrayNclus[
i] = ncluster_strip;