88 #include "HepPDT/ParticleID.hh"
96 #include <unordered_set>
97 #include <unordered_map>
112 using TrackingParticleRefKeyToIndex = std::unordered_map<reco::RecoToSimCollection::index_type, size_t>;
113 using TrackingVertexRefKeyToIndex = TrackingParticleRefKeyToIndex;
114 using SimHitFullKey = std::pair<TrackPSimHitRef::key_type, edm::ProductID>;
115 using SimHitRefKeyToIndex = std::map<SimHitFullKey, size_t>;
116 using TrackingParticleRefKeyToCount = TrackingParticleRefKeyToIndex;
133 return "UNKNOWN TRACKER HIT TYPE";
137 struct ProductIDSetPrinter {
138 ProductIDSetPrinter(
const std::set<edm::ProductID>& set) : set_(set) {}
140 void print(std::ostream& os)
const {
141 for (
const auto&
item : set_) {
146 const std::set<edm::ProductID>& set_;
148 std::ostream&
operator<<(std::ostream& os,
const ProductIDSetPrinter&
o) {
152 template <
typename T>
153 struct ProductIDMapPrinter {
154 ProductIDMapPrinter(
const std::map<edm::ProductID, T>& map) : map_(map) {}
156 void print(std::ostream& os)
const {
157 for (
const auto&
item : map_) {
158 os <<
item.first <<
" ";
162 const std::map<edm::ProductID, T>& map_;
164 template <
typename T>
165 auto make_ProductIDMapPrinter(
const std::map<edm::ProductID, T>& map) {
166 return ProductIDMapPrinter<T>(map);
168 template <
typename T>
169 std::ostream& operator<<(std::ostream& os, const ProductIDMapPrinter<T>&
o) {
174 template <
typename T>
175 struct VectorPrinter {
176 VectorPrinter(
const std::vector<T>& vec) : vec_(vec) {}
178 void print(std::ostream& os)
const {
179 for (
const auto&
item : vec_) {
184 const std::vector<T>& vec_;
186 template <
typename T>
187 auto make_VectorPrinter(
const std::vector<T>& vec) {
188 return VectorPrinter<T>(vec);
190 template <
typename T>
191 std::ostream& operator<<(std::ostream& os, const VectorPrinter<T>&
o) {
196 void checkProductID(
const std::set<edm::ProductID>& set,
const edm::ProductID&
id,
const char*
name) {
197 if (set.find(
id) == set.end())
199 <<
"Got " << name <<
" with a hit with ProductID " <<
id
200 <<
" which does not match to the set of ProductID's for the hits: " << ProductIDSetPrinter(set)
201 <<
". Usually this is caused by a wrong hit collection in the configuration.";
204 template <
typename SimLink,
typename Func>
206 for (
const auto&
link : digiSimLinks) {
207 if (
link.channel() == channel) {
214 template <
typename... Args>
215 void call_nop(Args&&...
args) {}
217 template <
typename... Types>
224 unsigned int operator[](
size_t i)
const {
return std::get<0>(content_)[i]; }
226 template <
typename... Args>
227 void book(Args&&...
args) {
228 impl([&](
auto& vec) { vec.book(std::forward<Args>(
args)...); });
231 template <
typename... Args>
233 impl([&](
auto& vec) { vec.push_back(std::forward<Args>(
args)...); });
236 template <
typename... Args>
237 void resize(Args&&...
args) {
238 impl([&](
auto& vec) { vec.resize(std::forward<Args>(
args)...); });
241 template <
typename... Args>
242 void set(Args&&...
args) {
243 impl([&](
auto& vec) { vec.set(std::forward<Args>(
args)...); });
247 impl([&](
auto& vec) { vec.clear(); });
252 template <
typename F>
253 void impl(
F&& func) {
254 impl2(std::index_sequence_for<Types...>{}, std::forward<F>(
func));
262 template <std::size_t... Is,
typename F>
263 void impl2(std::index_sequence<Is...>,
F&& func) {
264 call_nop((
func(std::get<Is>(content_)), 0)...);
267 std::tuple<Types...> content_;
270 std::map<unsigned int, double> chargeFraction(
const SiPixelCluster& cluster,
273 std::map<unsigned int, double> simTrackIdToAdc;
275 auto idetset = digiSimLink.
find(detId);
276 if (idetset == digiSimLink.
end())
277 return simTrackIdToAdc;
281 for (
int iPix = 0; iPix != cluster.
size(); ++iPix) {
285 forEachMatchedSimLink(*idetset, channel, [&](
const PixelDigiSimLink& simLink) {
291 for (
auto& pair : simTrackIdToAdc) {
295 pair.second /= adcSum;
298 return simTrackIdToAdc;
301 std::map<unsigned int, double> chargeFraction(
const SiStripCluster& cluster,
304 std::map<unsigned int, double> simTrackIdToAdc;
306 auto idetset = digiSimLink.
find(detId);
307 if (idetset == digiSimLink.
end())
308 return simTrackIdToAdc;
315 forEachMatchedSimLink(*idetset, first +
i, [&](
const StripDigiSimLink& simLink) {
316 double& adc = simTrackIdToAdc[simLink.
SimTrackId()];
320 for (
const auto& pair : simTrackIdToAdc) {
321 simTrackIdToAdc[pair.first] = (adcSum != 0. ? pair.second / adcSum : 0.);
324 return simTrackIdToAdc;
330 std::map<unsigned int, double> simTrackIdToAdc;
331 throw cms::Exception(
"LogicError") <<
"Not possible to use StripDigiSimLink with Phase2TrackerCluster1D! ";
332 return simTrackIdToAdc;
340 std::map<unsigned int, double> simTrackIdToAdc;
341 return simTrackIdToAdc;
344 struct TrackTPMatch {
346 int countClusters = 0;
351 const TrackingParticleRefKeyToIndex& tpKeyToIndex) {
357 std::vector<OmniClusterRef>
clusters =
360 std::unordered_map<int, Count>
count;
361 for (
size_t iCluster = 0,
end = clusters.size(); iCluster <
end; ++iCluster) {
362 const auto& clusterRef = clusters[iCluster];
365 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
366 const auto tpKey = ip->second.key();
367 if (tpKeyToIndex.find(tpKey) == tpKeyToIndex.end())
370 auto& elem = count[tpKey];
372 elem.innermostHit =
std::min(elem.innermostHit, iCluster);
381 for (
auto& keyCount : count) {
382 if (keyCount.second.clusters > bestCount ||
383 (keyCount.second.clusters == bestCount && keyCount.second.innermostHit < bestInnermostHit)) {
384 best.key = keyCount.first;
385 best.countClusters = bestCount = keyCount.second.clusters;
386 bestInnermostHit = keyCount.second.innermostHit;
390 LogTrace(
"TrackingNtuple") <<
"findBestMatchingTrackingParticle key " << best.key;
395 TrackTPMatch findMatchingTrackingParticleFromFirstHit(
const reco::Track& track,
397 const TrackingParticleRefKeyToIndex& tpKeyToIndex) {
400 std::vector<OmniClusterRef> clusters =
402 if (clusters.empty()) {
406 auto operateCluster = [&](
const auto& clusterRef,
const auto&
func) {
408 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
409 const auto tpKey = ip->second.key();
410 if (tpKeyToIndex.find(tpKey) == tpKeyToIndex.end())
416 std::vector<unsigned int>
418 auto iCluster = clusters.begin();
419 operateCluster(*iCluster, [&](
unsigned int tpKey) { validTPs.push_back(tpKey); });
420 if (validTPs.empty()) {
424 ++best.countClusters;
426 std::vector<bool> foundTPs(validTPs.size(),
false);
427 for (
auto iEnd = clusters.end(); iCluster != iEnd; ++iCluster) {
428 const auto& clusterRef = *iCluster;
431 operateCluster(clusterRef, [&](
unsigned int tpKey) {
432 auto found =
std::find(cbegin(validTPs), cend(validTPs), tpKey);
433 if (found != cend(validTPs)) {
439 auto iTP = validTPs.size();
443 if (!foundTPs[iTP]) {
444 validTPs.erase(validTPs.begin() + iTP);
445 foundTPs.erase(foundTPs.begin() + iTP);
448 if (!validTPs.empty()) {
452 best.key = validTPs[0];
458 ++best.countClusters;
462 return best.countClusters >= 3 ? best : TrackTPMatch();
497 TPHitIndex(
unsigned int tp = 0,
unsigned int simHit = 0,
float to = 0,
unsigned int id = 0)
518 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
523 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
524 std::set<edm::ProductID>& hitProductIds);
528 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
533 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
534 std::set<edm::ProductID>& hitProductIds);
539 std::vector<std::pair<int, int>>& monoStereoClusterList);
544 const std::vector<std::pair<uint64_t, StripMaskContainer const*>>& stripMasks,
545 std::vector<std::pair<int, int>>& monoStereoClusterList);
549 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
554 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
555 std::set<edm::ProductID>& hitProductIds);
559 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
566 std::vector<std::pair<int, int>>& monoStereoClusterList,
567 const std::set<edm::ProductID>& hitProductIds,
568 std::map<edm::ProductID, size_t>& seedToCollIndex);
572 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
573 const TrackingParticleRefKeyToCount& tpKeyToClusterCount,
581 const std::set<edm::ProductID>& hitProductIds,
582 const std::map<edm::ProductID, size_t>& seedToCollIndex,
583 const std::vector<const MVACollection*>& mvaColls,
584 const std::vector<const QualityMaskCollection*>& qualColls);
587 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
590 SimHitRefKeyToIndex& simHitRefKeyToIndex,
591 std::vector<TPHitIndex>& tpHitList);
598 const TrackingVertexRefKeyToIndex& tvKeyToIndex,
600 const std::vector<TPHitIndex>& tpHitList,
601 const TrackingParticleRefKeyToCount& tpKeyToClusterCount);
605 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
606 const unsigned int seedOffset);
611 const TrackingParticleRefKeyToIndex& tpKeyToIndex);
622 template <
typename SimLink>
628 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
631 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
640 std::vector<edm::EDGetTokenT<edm::View<reco::Track>>>
seedTokens_;
686 #define BOOK(name) tree->Branch((prefix + "_" + #name).c_str(), &name);
702 detId.push_back(
id.rawId());
703 subdet.push_back(
id.subdetId());
707 unsigned short s = 0;
708 switch (
id.subdetId()) {
731 subdet[
index] =
id.subdetId();
749 std::vector<unsigned short>
side;
793 const auto parsed =
parse(tTopo,
id);
794 order.push_back(parsed.order);
795 ring.push_back(parsed.ring);
796 rod.push_back(parsed.rod);
806 const auto parsed =
parse(tTopo,
id);
827 switch (
id.subdetId()) {
842 std::vector<unsigned short>
ring;
843 std::vector<unsigned short>
rod;
859 const auto parsed =
parse(tTopo,
id);
860 string.push_back(parsed.string);
864 isGlued.push_back(parsed.glued);
876 const auto parsed =
parse(tTopo,
id);
877 string[
index] = parsed.string;
896 unsigned int string = 0;
901 switch (
id.subdetId()) {
952 using DetIdPixel = CombineDetId<DetIdCommon, DetIdPixelOnly>;
953 using DetIdStrip = CombineDetId<DetIdCommon, DetIdOTCommon, DetIdStripOnly>;
954 using DetIdPhase2OT = CombineDetId<DetIdCommon, DetIdOTCommon, DetIdPhase2OTOnly>;
955 using DetIdAll = CombineDetId<DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdStripOnly>;
956 using DetIdAllPhase2 = CombineDetId<DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdPhase2OTOnly>;
1306 trackToken_(consumes<edm::
View<
reco::Track>>(iConfig.getUntrackedParameter<edm::
InputTag>(
"tracks"))),
1309 iConfig.getUntrackedParameter<edm::
InputTag>(
"simHitTPMap"))),
1311 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackAssociator"))),
1313 iConfig.getUntrackedParameter<edm::
InputTag>(
"pixelDigiSimLink"))),
1315 iConfig.getUntrackedParameter<edm::
InputTag>(
"stripDigiSimLink"))),
1317 iConfig.getUntrackedParameter<edm::
InputTag>(
"phase2OTSimLink"))),
1318 includeStripHits_(!iConfig.getUntrackedParameter<edm::
InputTag>(
"stripDigiSimLink").
label().
empty()),
1319 includePhase2OTHits_(!iConfig.getUntrackedParameter<edm::
InputTag>(
"phase2OTSimLink").
label().
empty()),
1320 beamSpotToken_(consumes<
reco::
BeamSpot>(iConfig.getUntrackedParameter<edm::
InputTag>(
"beamSpot"))),
1323 stripRphiRecHitToken_(
1325 stripStereoRecHitToken_(
1328 iConfig.getUntrackedParameter<edm::
InputTag>(
"stripMatchedRecHits"))),
1330 iConfig.getUntrackedParameter<edm::
InputTag>(
"phase2OTRecHits"))),
1332 trackingVertexToken_(
1334 tpNLayersToken_(consumes<edm::ValueMap<unsigned int>>(
1335 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackingParticleNlayers"))),
1336 tpNPixelLayersToken_(consumes<edm::ValueMap<unsigned int>>(
1337 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackingParticleNpixellayers"))),
1338 tpNStripStereoLayersToken_(consumes<edm::ValueMap<unsigned int>>(
1339 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackingParticleNstripstereolayers"))),
1340 includeSeeds_(iConfig.getUntrackedParameter<bool>(
"includeSeeds")),
1341 addSeedCurvCov_(iConfig.getUntrackedParameter<bool>(
"addSeedCurvCov")),
1342 includeAllHits_(iConfig.getUntrackedParameter<bool>(
"includeAllHits")),
1343 includeMVA_(iConfig.getUntrackedParameter<bool>(
"includeMVA")),
1344 includeTrackingParticles_(iConfig.getUntrackedParameter<bool>(
"includeTrackingParticles")),
1345 includeOOT_(iConfig.getUntrackedParameter<bool>(
"includeOOT")),
1346 keepEleSimHits_(iConfig.getUntrackedParameter<bool>(
"keepEleSimHits")),
1347 saveSimHitsP3_(iConfig.getUntrackedParameter<bool>(
"saveSimHitsP3")),
1348 simHitBySignificance_(iConfig.getUntrackedParameter<bool>(
"simHitBySignificance")),
1349 parametersDefiner_(iConfig.getUntrackedParameter<edm::
InputTag>(
"beamSpot"), consumesCollector()) {
1357 if (seedTokens_.size() != seedStopInfoTokens_.size()) {
1358 throw cms::Exception(
"Configuration") <<
"Got " << seedTokens_.size() <<
" seed collections, but "
1359 << seedStopInfoTokens_.size() <<
" track candidate collections";
1363 if (includeAllHits_) {
1364 if (includeStripHits_ && includePhase2OTHits_) {
1366 <<
"Both stripDigiSimLink and phase2OTSimLink are set, please set only either one (this information is used "
1367 "to infer if you're running phase0/1 or phase2 detector)";
1369 if (!includeStripHits_ && !includePhase2OTHits_) {
1371 <<
"Neither stripDigiSimLink or phase2OTSimLink are set, please set either one.";
1374 auto const& maskVPset =
iConfig.getUntrackedParameterSetVector(
"clusterMasks");
1375 pixelUseMaskTokens_.reserve(maskVPset.size());
1376 stripUseMaskTokens_.reserve(maskVPset.size());
1377 for (
auto const& mask : maskVPset) {
1378 auto index = mask.getUntrackedParameter<
unsigned int>(
"index");
1380 pixelUseMaskTokens_.emplace_back(
index,
1381 consumes<PixelMaskContainer>(mask.getUntrackedParameter<
edm::InputTag>(
"src")));
1382 if (includeStripHits_)
1383 stripUseMaskTokens_.emplace_back(
1384 index, consumes<StripMaskContainer>(mask.getUntrackedParameter<
edm::InputTag>(
"src")));
1388 const bool tpRef =
iConfig.getUntrackedParameter<
bool>(
"trackingParticlesRef");
1391 trackingParticleRefToken_ = consumes<TrackingParticleRefVector>(tpTag);
1393 trackingParticleToken_ = consumes<TrackingParticleCollection>(tpTag);
1401 return std::make_tuple(consumes<MVACollection>(
edm::InputTag(tag,
"MVAValues")),
1402 consumes<QualityMaskCollection>(
edm::InputTag(tag,
"QualityMasks")));
1408 t = fs->
make<TTree>(
"tree",
"tree");
1410 t->Branch(
"event", &ev_event);
1411 t->Branch(
"lumi", &ev_lumi);
1412 t->Branch(
"run", &ev_run);
1415 t->Branch(
"trk_px", &trk_px);
1416 t->Branch(
"trk_py", &trk_py);
1417 t->Branch(
"trk_pz", &trk_pz);
1418 t->Branch(
"trk_pt", &trk_pt);
1419 t->Branch(
"trk_inner_px", &trk_inner_px);
1420 t->Branch(
"trk_inner_py", &trk_inner_py);
1421 t->Branch(
"trk_inner_pz", &trk_inner_pz);
1422 t->Branch(
"trk_inner_pt", &trk_inner_pt);
1423 t->Branch(
"trk_outer_px", &trk_outer_px);
1424 t->Branch(
"trk_outer_py", &trk_outer_py);
1425 t->Branch(
"trk_outer_pz", &trk_outer_pz);
1426 t->Branch(
"trk_outer_pt", &trk_outer_pt);
1427 t->Branch(
"trk_eta", &trk_eta);
1428 t->Branch(
"trk_lambda", &trk_lambda);
1429 t->Branch(
"trk_cotTheta", &trk_cotTheta);
1430 t->Branch(
"trk_phi", &trk_phi);
1431 t->Branch(
"trk_dxy", &trk_dxy);
1432 t->Branch(
"trk_dz", &trk_dz);
1433 t->Branch(
"trk_dxyPV", &trk_dxyPV);
1434 t->Branch(
"trk_dzPV", &trk_dzPV);
1435 t->Branch(
"trk_dxyClosestPV", &trk_dxyClosestPV);
1436 t->Branch(
"trk_dzClosestPV", &trk_dzClosestPV);
1437 t->Branch(
"trk_ptErr", &trk_ptErr);
1438 t->Branch(
"trk_etaErr", &trk_etaErr);
1439 t->Branch(
"trk_lambdaErr", &trk_lambdaErr);
1440 t->Branch(
"trk_phiErr", &trk_phiErr);
1441 t->Branch(
"trk_dxyErr", &trk_dxyErr);
1442 t->Branch(
"trk_dzErr", &trk_dzErr);
1443 t->Branch(
"trk_refpoint_x", &trk_refpoint_x);
1444 t->Branch(
"trk_refpoint_y", &trk_refpoint_y);
1445 t->Branch(
"trk_refpoint_z", &trk_refpoint_z);
1446 t->Branch(
"trk_nChi2", &trk_nChi2);
1447 t->Branch(
"trk_nChi2_1Dmod", &trk_nChi2_1Dmod);
1448 t->Branch(
"trk_ndof", &trk_ndof);
1450 trk_mvas.resize(mvaQualityCollectionTokens_.size());
1451 trk_qualityMasks.resize(mvaQualityCollectionTokens_.size());
1452 if (!trk_mvas.empty()) {
1453 t->Branch(
"trk_mva", &(trk_mvas[0]));
1454 t->Branch(
"trk_qualityMask", &(trk_qualityMasks[0]));
1455 for (
size_t i = 1;
i < trk_mvas.size(); ++
i) {
1457 t->Branch((
"trk_qualityMask" +
std::to_string(i + 1)).c_str(), &(trk_qualityMasks[i]));
1461 t->Branch(
"trk_q", &trk_q);
1462 t->Branch(
"trk_nValid", &trk_nValid);
1463 t->Branch(
"trk_nLost", &trk_nLost);
1464 t->Branch(
"trk_nInactive", &trk_nInactive);
1465 t->Branch(
"trk_nPixel", &trk_nPixel);
1466 t->Branch(
"trk_nStrip", &trk_nStrip);
1467 t->Branch(
"trk_nOuterLost", &trk_nOuterLost);
1468 t->Branch(
"trk_nInnerLost", &trk_nInnerLost);
1469 t->Branch(
"trk_nOuterInactive", &trk_nOuterInactive);
1470 t->Branch(
"trk_nInnerInactive", &trk_nInnerInactive);
1471 t->Branch(
"trk_nPixelLay", &trk_nPixelLay);
1472 t->Branch(
"trk_nStripLay", &trk_nStripLay);
1473 t->Branch(
"trk_n3DLay", &trk_n3DLay);
1474 t->Branch(
"trk_nLostLay", &trk_nLostLay);
1475 t->Branch(
"trk_nCluster", &trk_nCluster);
1476 t->Branch(
"trk_algo", &trk_algo);
1477 t->Branch(
"trk_originalAlgo", &trk_originalAlgo);
1478 t->Branch(
"trk_algoMask", &trk_algoMask);
1479 t->Branch(
"trk_stopReason", &trk_stopReason);
1480 t->Branch(
"trk_isHP", &trk_isHP);
1481 if (includeSeeds_) {
1482 t->Branch(
"trk_seedIdx", &trk_seedIdx);
1484 t->Branch(
"trk_vtxIdx", &trk_vtxIdx);
1485 if (includeTrackingParticles_) {
1486 t->Branch(
"trk_simTrkIdx", &trk_simTrkIdx);
1487 t->Branch(
"trk_simTrkShareFrac", &trk_simTrkShareFrac);
1488 t->Branch(
"trk_simTrkNChi2", &trk_simTrkNChi2);
1489 t->Branch(
"trk_bestSimTrkIdx", &trk_bestSimTrkIdx);
1490 t->Branch(
"trk_bestFromFirstHitSimTrkIdx", &trk_bestFromFirstHitSimTrkIdx);
1492 t->Branch(
"trk_isTrue", &trk_isTrue);
1494 t->Branch(
"trk_bestSimTrkShareFrac", &trk_bestSimTrkShareFrac);
1495 t->Branch(
"trk_bestSimTrkShareFracSimDenom", &trk_bestSimTrkShareFracSimDenom);
1496 t->Branch(
"trk_bestSimTrkShareFracSimClusterDenom", &trk_bestSimTrkShareFracSimClusterDenom);
1497 t->Branch(
"trk_bestSimTrkNChi2", &trk_bestSimTrkNChi2);
1498 t->Branch(
"trk_bestFromFirstHitSimTrkShareFrac", &trk_bestFromFirstHitSimTrkShareFrac);
1499 t->Branch(
"trk_bestFromFirstHitSimTrkShareFracSimDenom", &trk_bestFromFirstHitSimTrkShareFracSimDenom);
1500 t->Branch(
"trk_bestFromFirstHitSimTrkShareFracSimClusterDenom", &trk_bestFromFirstHitSimTrkShareFracSimClusterDenom);
1501 t->Branch(
"trk_bestFromFirstHitSimTrkNChi2", &trk_bestFromFirstHitSimTrkNChi2);
1502 if (includeAllHits_) {
1503 t->Branch(
"trk_hitIdx", &trk_hitIdx);
1504 t->Branch(
"trk_hitType", &trk_hitType);
1506 if (includeTrackingParticles_) {
1508 t->Branch(
"sim_event", &sim_event);
1509 t->Branch(
"sim_bunchCrossing", &sim_bunchCrossing);
1510 t->Branch(
"sim_pdgId", &sim_pdgId);
1511 t->Branch(
"sim_genPdgIds", &sim_genPdgIds);
1512 t->Branch(
"sim_isFromBHadron", &sim_isFromBHadron);
1513 t->Branch(
"sim_px", &sim_px);
1514 t->Branch(
"sim_py", &sim_py);
1515 t->Branch(
"sim_pz", &sim_pz);
1516 t->Branch(
"sim_pt", &sim_pt);
1517 t->Branch(
"sim_eta", &sim_eta);
1518 t->Branch(
"sim_phi", &sim_phi);
1519 t->Branch(
"sim_pca_pt", &sim_pca_pt);
1520 t->Branch(
"sim_pca_eta", &sim_pca_eta);
1521 t->Branch(
"sim_pca_lambda", &sim_pca_lambda);
1522 t->Branch(
"sim_pca_cotTheta", &sim_pca_cotTheta);
1523 t->Branch(
"sim_pca_phi", &sim_pca_phi);
1524 t->Branch(
"sim_pca_dxy", &sim_pca_dxy);
1525 t->Branch(
"sim_pca_dz", &sim_pca_dz);
1526 t->Branch(
"sim_q", &sim_q);
1527 t->Branch(
"sim_nValid", &sim_nValid);
1528 t->Branch(
"sim_nPixel", &sim_nPixel);
1529 t->Branch(
"sim_nStrip", &sim_nStrip);
1530 t->Branch(
"sim_nLay", &sim_nLay);
1531 t->Branch(
"sim_nPixelLay", &sim_nPixelLay);
1532 t->Branch(
"sim_n3DLay", &sim_n3DLay);
1533 t->Branch(
"sim_nTrackerHits", &sim_nTrackerHits);
1534 t->Branch(
"sim_nRecoClusters", &sim_nRecoClusters);
1535 t->Branch(
"sim_trkIdx", &sim_trkIdx);
1536 t->Branch(
"sim_trkShareFrac", &sim_trkShareFrac);
1537 if (includeSeeds_) {
1538 t->Branch(
"sim_seedIdx", &sim_seedIdx);
1540 t->Branch(
"sim_parentVtxIdx", &sim_parentVtxIdx);
1541 t->Branch(
"sim_decayVtxIdx", &sim_decayVtxIdx);
1542 if (includeAllHits_) {
1543 t->Branch(
"sim_simHitIdx", &sim_simHitIdx);
1546 if (includeAllHits_) {
1548 t->Branch(
"pix_isBarrel", &pix_isBarrel);
1549 pix_detId.book(
"pix",
t);
1550 t->Branch(
"pix_trkIdx", &pix_trkIdx);
1551 if (includeSeeds_) {
1552 t->Branch(
"pix_seeIdx", &pix_seeIdx);
1554 if (includeTrackingParticles_) {
1555 t->Branch(
"pix_simHitIdx", &pix_simHitIdx);
1556 if (simHitBySignificance_) {
1557 t->Branch(
"pix_xySignificance", &pix_xySignificance);
1559 t->Branch(
"pix_chargeFraction", &pix_chargeFraction);
1560 t->Branch(
"pix_simType", &pix_simType);
1562 t->Branch(
"pix_x", &pix_x);
1563 t->Branch(
"pix_y", &pix_y);
1564 t->Branch(
"pix_z", &pix_z);
1565 t->Branch(
"pix_xx", &pix_xx);
1566 t->Branch(
"pix_xy", &pix_xy);
1567 t->Branch(
"pix_yy", &pix_yy);
1568 t->Branch(
"pix_yz", &pix_yz);
1569 t->Branch(
"pix_zz", &pix_zz);
1570 t->Branch(
"pix_zx", &pix_zx);
1571 t->Branch(
"pix_radL", &pix_radL);
1572 t->Branch(
"pix_bbxi", &pix_bbxi);
1573 t->Branch(
"pix_clustSizeCol", &pix_clustSizeCol);
1574 t->Branch(
"pix_clustSizeRow", &pix_clustSizeRow);
1575 t->Branch(
"pix_usedMask", &pix_usedMask);
1577 if (includeStripHits_) {
1578 t->Branch(
"str_isBarrel", &str_isBarrel);
1579 str_detId.book(
"str",
t);
1580 t->Branch(
"str_trkIdx", &str_trkIdx);
1581 if (includeSeeds_) {
1582 t->Branch(
"str_seeIdx", &str_seeIdx);
1584 if (includeTrackingParticles_) {
1585 t->Branch(
"str_simHitIdx", &str_simHitIdx);
1586 if (simHitBySignificance_) {
1587 t->Branch(
"str_xySignificance", &str_xySignificance);
1589 t->Branch(
"str_chargeFraction", &str_chargeFraction);
1590 t->Branch(
"str_simType", &str_simType);
1592 t->Branch(
"str_x", &str_x);
1593 t->Branch(
"str_y", &str_y);
1594 t->Branch(
"str_z", &str_z);
1595 t->Branch(
"str_xx", &str_xx);
1596 t->Branch(
"str_xy", &str_xy);
1597 t->Branch(
"str_yy", &str_yy);
1598 t->Branch(
"str_yz", &str_yz);
1599 t->Branch(
"str_zz", &str_zz);
1600 t->Branch(
"str_zx", &str_zx);
1601 t->Branch(
"str_radL", &str_radL);
1602 t->Branch(
"str_bbxi", &str_bbxi);
1603 t->Branch(
"str_chargePerCM", &str_chargePerCM);
1604 t->Branch(
"str_clustSize", &str_clustSize);
1605 t->Branch(
"str_usedMask", &str_usedMask);
1607 t->Branch(
"glu_isBarrel", &glu_isBarrel);
1608 glu_detId.book(
"glu",
t);
1609 t->Branch(
"glu_monoIdx", &glu_monoIdx);
1610 t->Branch(
"glu_stereoIdx", &glu_stereoIdx);
1611 if (includeSeeds_) {
1612 t->Branch(
"glu_seeIdx", &glu_seeIdx);
1614 t->Branch(
"glu_x", &glu_x);
1615 t->Branch(
"glu_y", &glu_y);
1616 t->Branch(
"glu_z", &glu_z);
1617 t->Branch(
"glu_xx", &glu_xx);
1618 t->Branch(
"glu_xy", &glu_xy);
1619 t->Branch(
"glu_yy", &glu_yy);
1620 t->Branch(
"glu_yz", &glu_yz);
1621 t->Branch(
"glu_zz", &glu_zz);
1622 t->Branch(
"glu_zx", &glu_zx);
1623 t->Branch(
"glu_radL", &glu_radL);
1624 t->Branch(
"glu_bbxi", &glu_bbxi);
1625 t->Branch(
"glu_chargePerCM", &glu_chargePerCM);
1626 t->Branch(
"glu_clustSizeMono", &glu_clustSizeMono);
1627 t->Branch(
"glu_clustSizeStereo", &glu_clustSizeStereo);
1628 t->Branch(
"glu_usedMaskMono", &glu_usedMaskMono);
1629 t->Branch(
"glu_usedMaskStereo", &glu_usedMaskStereo);
1632 if (includePhase2OTHits_) {
1633 t->Branch(
"ph2_isBarrel", &ph2_isBarrel);
1634 ph2_detId.book(
"ph2",
t);
1635 t->Branch(
"ph2_trkIdx", &ph2_trkIdx);
1636 if (includeSeeds_) {
1637 t->Branch(
"ph2_seeIdx", &ph2_seeIdx);
1639 if (includeTrackingParticles_) {
1640 t->Branch(
"ph2_simHitIdx", &ph2_simHitIdx);
1641 if (simHitBySignificance_) {
1642 t->Branch(
"ph2_xySignificance", &ph2_xySignificance);
1644 t->Branch(
"ph2_simType", &ph2_simType);
1646 t->Branch(
"ph2_x", &ph2_x);
1647 t->Branch(
"ph2_y", &ph2_y);
1648 t->Branch(
"ph2_z", &ph2_z);
1649 t->Branch(
"ph2_xx", &ph2_xx);
1650 t->Branch(
"ph2_xy", &ph2_xy);
1651 t->Branch(
"ph2_yy", &ph2_yy);
1652 t->Branch(
"ph2_yz", &ph2_yz);
1653 t->Branch(
"ph2_zz", &ph2_zz);
1654 t->Branch(
"ph2_zx", &ph2_zx);
1655 t->Branch(
"ph2_radL", &ph2_radL);
1656 t->Branch(
"ph2_bbxi", &ph2_bbxi);
1657 t->Branch(
"ph2_bbxi", &ph2_bbxi);
1660 t->Branch(
"inv_isBarrel", &inv_isBarrel);
1661 if (includeStripHits_)
1662 inv_detId.book(
"inv",
t);
1664 inv_detId_phase2.book(
"inv",
t);
1665 t->Branch(
"inv_type", &inv_type);
1667 if (includeTrackingParticles_) {
1668 if (includeStripHits_)
1669 simhit_detId.book(
"simhit",
t);
1671 simhit_detId_phase2.book(
"simhit",
t);
1672 t->Branch(
"simhit_x", &simhit_x);
1673 t->Branch(
"simhit_y", &simhit_y);
1674 t->Branch(
"simhit_z", &simhit_z);
1675 if (saveSimHitsP3_) {
1676 t->Branch(
"simhit_px", &simhit_px);
1677 t->Branch(
"simhit_py", &simhit_py);
1678 t->Branch(
"simhit_pz", &simhit_pz);
1680 t->Branch(
"simhit_particle", &simhit_particle);
1681 t->Branch(
"simhit_process", &simhit_process);
1682 t->Branch(
"simhit_eloss", &simhit_eloss);
1683 t->Branch(
"simhit_tof", &simhit_tof);
1684 t->Branch(
"simhit_simTrkIdx", &simhit_simTrkIdx);
1685 t->Branch(
"simhit_hitIdx", &simhit_hitIdx);
1686 t->Branch(
"simhit_hitType", &simhit_hitType);
1690 t->Branch(
"bsp_x", &bsp_x,
"bsp_x/F");
1691 t->Branch(
"bsp_y", &bsp_y,
"bsp_y/F");
1692 t->Branch(
"bsp_z", &bsp_z,
"bsp_z/F");
1693 t->Branch(
"bsp_sigmax", &bsp_sigmax,
"bsp_sigmax/F");
1694 t->Branch(
"bsp_sigmay", &bsp_sigmay,
"bsp_sigmay/F");
1695 t->Branch(
"bsp_sigmaz", &bsp_sigmaz,
"bsp_sigmaz/F");
1696 if (includeSeeds_) {
1698 t->Branch(
"see_fitok", &see_fitok);
1699 t->Branch(
"see_px", &see_px);
1700 t->Branch(
"see_py", &see_py);
1701 t->Branch(
"see_pz", &see_pz);
1702 t->Branch(
"see_pt", &see_pt);
1703 t->Branch(
"see_eta", &see_eta);
1704 t->Branch(
"see_phi", &see_phi);
1705 t->Branch(
"see_dxy", &see_dxy);
1706 t->Branch(
"see_dz", &see_dz);
1707 t->Branch(
"see_ptErr", &see_ptErr);
1708 t->Branch(
"see_etaErr", &see_etaErr);
1709 t->Branch(
"see_phiErr", &see_phiErr);
1710 t->Branch(
"see_dxyErr", &see_dxyErr);
1711 t->Branch(
"see_dzErr", &see_dzErr);
1712 t->Branch(
"see_chi2", &see_chi2);
1713 t->Branch(
"see_statePt", &see_statePt);
1714 t->Branch(
"see_stateTrajX", &see_stateTrajX);
1715 t->Branch(
"see_stateTrajY", &see_stateTrajY);
1716 t->Branch(
"see_stateTrajPx", &see_stateTrajPx);
1717 t->Branch(
"see_stateTrajPy", &see_stateTrajPy);
1718 t->Branch(
"see_stateTrajPz", &see_stateTrajPz);
1719 t->Branch(
"see_stateTrajGlbX", &see_stateTrajGlbX);
1720 t->Branch(
"see_stateTrajGlbY", &see_stateTrajGlbY);
1721 t->Branch(
"see_stateTrajGlbZ", &see_stateTrajGlbZ);
1722 t->Branch(
"see_stateTrajGlbPx", &see_stateTrajGlbPx);
1723 t->Branch(
"see_stateTrajGlbPy", &see_stateTrajGlbPy);
1724 t->Branch(
"see_stateTrajGlbPz", &see_stateTrajGlbPz);
1725 if (addSeedCurvCov_) {
1726 t->Branch(
"see_stateCurvCov", &see_stateCurvCov);
1728 t->Branch(
"see_q", &see_q);
1729 t->Branch(
"see_nValid", &see_nValid);
1730 t->Branch(
"see_nPixel", &see_nPixel);
1731 t->Branch(
"see_nGlued", &see_nGlued);
1732 t->Branch(
"see_nStrip", &see_nStrip);
1733 t->Branch(
"see_nPhase2OT", &see_nPhase2OT);
1734 t->Branch(
"see_nCluster", &see_nCluster);
1735 t->Branch(
"see_algo", &see_algo);
1736 t->Branch(
"see_stopReason", &see_stopReason);
1737 t->Branch(
"see_nCands", &see_nCands);
1738 t->Branch(
"see_trkIdx", &see_trkIdx);
1739 if (includeTrackingParticles_) {
1740 t->Branch(
"see_simTrkIdx", &see_simTrkIdx);
1741 t->Branch(
"see_simTrkShareFrac", &see_simTrkShareFrac);
1742 t->Branch(
"see_bestSimTrkIdx", &see_bestSimTrkIdx);
1743 t->Branch(
"see_bestFromFirstHitSimTrkIdx", &see_bestFromFirstHitSimTrkIdx);
1745 t->Branch(
"see_isTrue", &see_isTrue);
1747 t->Branch(
"see_bestSimTrkShareFrac", &see_bestSimTrkShareFrac);
1748 t->Branch(
"see_bestFromFirstHitSimTrkShareFrac", &see_bestFromFirstHitSimTrkShareFrac);
1749 if (includeAllHits_) {
1750 t->Branch(
"see_hitIdx", &see_hitIdx);
1751 t->Branch(
"see_hitType", &see_hitType);
1754 t->Branch(
"see_offset", &see_offset);
1758 t->Branch(
"vtx_x", &vtx_x);
1759 t->Branch(
"vtx_y", &vtx_y);
1760 t->Branch(
"vtx_z", &vtx_z);
1761 t->Branch(
"vtx_xErr", &vtx_xErr);
1762 t->Branch(
"vtx_yErr", &vtx_yErr);
1763 t->Branch(
"vtx_zErr", &vtx_zErr);
1764 t->Branch(
"vtx_ndof", &vtx_ndof);
1765 t->Branch(
"vtx_chi2", &vtx_chi2);
1766 t->Branch(
"vtx_fake", &vtx_fake);
1767 t->Branch(
"vtx_valid", &vtx_valid);
1768 t->Branch(
"vtx_trkIdx", &vtx_trkIdx);
1771 t->Branch(
"simvtx_event", &simvtx_event);
1772 t->Branch(
"simvtx_bunchCrossing", &simvtx_bunchCrossing);
1773 t->Branch(
"simvtx_processType", &simvtx_processType);
1774 t->Branch(
"simvtx_x", &simvtx_x);
1775 t->Branch(
"simvtx_y", &simvtx_y);
1776 t->Branch(
"simvtx_z", &simvtx_z);
1777 t->Branch(
"simvtx_sourceSimIdx", &simvtx_sourceSimIdx);
1778 t->Branch(
"simvtx_daughterSimIdx", &simvtx_daughterSimIdx);
1780 t->Branch(
"simpv_idx", &simpv_idx);
2106 using namespace edm;
2107 using namespace reco;
2108 using namespace std;
2119 LogDebug(
"TrackingNtuple") <<
"Analyzing new event";
2134 for (
size_t i = 0,
size = TPCollectionH->size(); i <
size; ++
i) {
2140 tmpTPptr = TPCollectionHRefVector.product();
2145 TrackingParticleRefKeyToIndex tpKeyToIndex;
2146 for (
size_t i = 0; i < tpCollection.size(); ++
i) {
2147 tpKeyToIndex[tpCollection[
i].key()] =
i;
2157 TrackingVertexRefKeyToIndex tvKeyToIndex;
2158 for (
size_t i = 0; i < tvs.size(); ++
i) {
2162 tvKeyToIndex[
i] = tvRefs.size();
2174 TrackingParticleRefKeyToCount tpKeyToClusterCount;
2175 for (
const auto& clusterTP : clusterToTPMap) {
2176 tpKeyToClusterCount[clusterTP.second.key()] += 1;
2180 SimHitRefKeyToIndex simHitRefKeyToIndex;
2183 std::vector<TPHitIndex> tpHitList;
2187 std::set<edm::ProductID> hitProductIds;
2188 std::map<edm::ProductID, size_t> seedCollToOffset;
2197 const auto& pixelDigiSimLinks = *pixelDigiSimLinksHandle;
2213 vector<pair<int, int>> monoStereoClusterList;
2217 fillSimHits(tracker, tpKeyToIndex, *simHitsTPAssoc, tTopo, simHitRefKeyToIndex, tpHitList);
2228 simHitRefKeyToIndex,
2233 LogDebug(
"TrackingNtuple") <<
"foundStripSimLink";
2234 const auto& stripDigiSimLinks = *stripDigiSimLinksHandle;
2242 simHitRefKeyToIndex,
2250 LogDebug(
"TrackingNtuple") <<
"foundPhase2OTSimLinks";
2251 const auto& phase2OTSimLinks = *siphase2OTSimLinksHandle;
2259 simHitRefKeyToIndex,
2275 monoStereoClusterList,
2289 std::vector<const MVACollection*> mvaColls;
2290 std::vector<const QualityMaskCollection*> qualColls;
2296 iEvent.
getByToken(std::get<0>(tokenTpl), hmva);
2297 iEvent.
getByToken(std::get<1>(tokenTpl), hqual);
2299 mvaColls.push_back(hmva.
product());
2300 qualColls.push_back(hqual.
product());
2301 if (mvaColls.back()->size() !=
tracks.size()) {
2303 <<
"Inconsistency in track collection and MVA sizes. Track collection has " <<
tracks.size()
2304 <<
" tracks, whereas the MVA " << (mvaColls.size() - 1) <<
" has " << mvaColls.back()->size()
2305 <<
" entries. Double-check your configuration.";
2307 if (qualColls.back()->size() !=
tracks.size()) {
2309 <<
"Inconsistency in track collection and quality mask sizes. Track collection has " <<
tracks.size()
2310 <<
" tracks, whereas the quality mask " << (qualColls.size() - 1) <<
" has " << qualColls.back()->size()
2311 <<
" entries. Double-check your configuration.";
2322 tpKeyToClusterCount,
2339 iEvent, iSetup, trackRefs,
bs, tpCollection, tvKeyToIndex, associatorByHits, tpHitList, tpKeyToClusterCount);
2360 template <
typename SimLink>
2372 template <
typename SimLink>
2379 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2382 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2386 std::map<unsigned int, double> simTrackIdToChargeFraction;
2390 simTrackIdToChargeFraction = chargeFraction(GetCluster<SimLink>::call(cluster), hitId, digiSimLinks);
2392 float h_x = 0, h_y = 0;
2393 float h_xx = 0, h_xy = 0, h_yy = 0;
2395 h_x = ttrh->localPosition().x();
2396 h_y = ttrh->localPosition().y();
2397 h_xx = ttrh->localPositionError().xx();
2398 h_xy = ttrh->localPositionError().xy();
2399 h_yy = ttrh->localPositionError().yy();
2405 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
2409 const auto event = trackingParticle->eventId().event();
2410 const auto bx = trackingParticle->eventId().bunchCrossing();
2419 auto tpIndex = tpKeyToIndex.find(trackingParticle.
key());
2420 if (tpIndex == tpKeyToIndex.end())
2424 std::pair<TrackingParticleRef, TrackPSimHitRef> simHitTPpairWithDummyTP(trackingParticle,
TrackPSimHitRef());
2426 auto range = std::equal_range(simHitsTPAssoc.begin(),
2427 simHitsTPAssoc.end(),
2428 simHitTPpairWithDummyTP,
2430 bool foundSimHit =
false;
2431 bool foundElectron =
false;
2432 int foundElectrons = 0;
2433 int foundNonElectrons = 0;
2434 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
2439 if (
std::abs(TPhit->particleType()) == 11 &&
std::abs(trackingParticle->pdgId()) != 11) {
2442 foundNonElectrons++;
2452 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
2457 if (
std::abs(TPhit->particleType()) == 11 &&
std::abs(trackingParticle->pdgId()) != 11) {
2458 foundElectron =
true;
2463 float sx = TPhit->localPosition().x();
2464 float sy = TPhit->localPosition().y();
2465 float dx = sx - h_x;
2466 float dy = sy - h_y;
2467 float sig = (dx * dx * h_yy - 2 * dx * dy * h_xy + dy * dy * h_xx) / (h_xx * h_yy - h_xy * h_xy);
2469 if (sig < minSignificance) {
2470 minSignificance = sig;
2472 simHitKey = TPhit.
key();
2473 simHitID = TPhit.
id();
2478 auto simHitIndex = simHitRefKeyToIndex.at(std::make_pair(simHitKey, simHitID));
2481 double chargeFraction = 0.;
2482 for (
const SimTrack& simtrk : trackingParticle->g4Tracks()) {
2483 auto found = simTrackIdToChargeFraction.find(simtrk.trackId());
2484 if (found != simTrackIdToChargeFraction.end()) {
2485 chargeFraction += found->second;
2496 simhit_hitType[simHitIndex].push_back(static_cast<int>(hitType));
2499 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
2504 if (
std::abs(TPhit->particleType()) == 11 &&
std::abs(trackingParticle->pdgId()) != 11) {
2505 foundElectron =
true;
2508 if (foundNonElectrons > 0)
2513 auto simHitKey = TPhit.
key();
2514 auto simHitID = TPhit.
id();
2516 auto simHitIndex = simHitRefKeyToIndex.at(std::make_pair(simHitKey, simHitID));
2519 double chargeFraction = 0.;
2520 for (
const SimTrack& simtrk : trackingParticle->g4Tracks()) {
2521 auto found = simTrackIdToChargeFraction.find(simtrk.trackId());
2522 if (found != simTrackIdToChargeFraction.end()) {
2523 chargeFraction += found->second;
2534 simhit_hitType[simHitIndex].push_back(static_cast<int>(hitType));
2545 <<
"Did not find SimHit for reco hit DetId " << hitId.
rawId() <<
" for TP " << trackingParticle.
key()
2546 <<
" bx:event " <<
bx <<
":" <<
event <<
" PDGid " << trackingParticle->pdgId() <<
" q "
2547 << trackingParticle->charge() <<
" p4 " << trackingParticle->p4() <<
" nG4 "
2548 << trackingParticle->g4Tracks().size() <<
".\nFound SimHits from detectors ";
2549 for (
auto ip =
range.first; ip !=
range.second; ++ip) {
2552 ex << dId.
rawId() <<
" ";
2554 if (trackingParticle->eventId().event() != 0) {
2555 ex <<
"\nSince this is a TrackingParticle from pileup, check that you're running the pileup mixing in "
2567 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2570 SimHitRefKeyToIndex& simHitRefKeyToIndex,
2571 std::vector<TPHitIndex>& tpHitList) {
2572 for (
const auto& assoc : simHitsTPAssoc) {
2573 auto tpKey = assoc.first.key();
2577 auto found = tpKeyToIndex.find(tpKey);
2578 if (found == tpKeyToIndex.end())
2580 const auto tpIndex = found->second;
2583 const auto& simhit = *(assoc.second);
2584 auto detId =
DetId(simhit.detUnitId());
2596 auto simHitKey = std::make_pair(assoc.second.key(), assoc.second.id());
2598 if (simHitRefKeyToIndex.find(simHitKey) != simHitRefKeyToIndex.end()) {
2599 for (
const auto& assoc2 : simHitsTPAssoc) {
2600 if (std::make_pair(assoc2.second.key(), assoc2.second.id()) == simHitKey) {
2602 auto range1 = std::equal_range(simHitsTPAssoc.begin(),
2603 simHitsTPAssoc.end(),
2606 auto range2 = std::equal_range(simHitsTPAssoc.begin(),
2607 simHitsTPAssoc.end(),
2611 LogTrace(
"TrackingNtuple") <<
"Earlier TP " << assoc2.first.key() <<
" SimTrack Ids";
2612 for (
const auto&
simTrack : assoc2.first->g4Tracks()) {
2614 <<
simTrack.eventId().bunchCrossing() <<
":" <<
simTrack.eventId().event();
2616 for (
auto iHit = range2.first; iHit != range2.second; ++iHit) {
2617 LogTrace(
"TrackingNtuple") <<
" SimHit " << iHit->second.key() <<
" " << iHit->second.id() <<
" tof "
2618 << iHit->second->tof() <<
" trackId " << iHit->second->trackId() <<
" BX:event "
2619 << iHit->second->eventId().bunchCrossing() <<
":"
2620 << iHit->second->eventId().event();
2622 LogTrace(
"TrackingNtuple") <<
"Current TP " << assoc.first.key() <<
" SimTrack Ids";
2623 for (
const auto&
simTrack : assoc.first->g4Tracks()) {
2625 <<
simTrack.eventId().bunchCrossing() <<
":" <<
simTrack.eventId().event();
2627 for (
auto iHit = range1.first; iHit != range1.second; ++iHit) {
2628 LogTrace(
"TrackingNtuple") <<
" SimHit " << iHit->second.key() <<
" " << iHit->second.id() <<
" tof "
2629 << iHit->second->tof() <<
" trackId " << iHit->second->trackId() <<
" BX:event "
2630 << iHit->second->eventId().bunchCrossing() <<
":"
2631 << iHit->second->eventId().event();
2636 <<
"Got second time the SimHit " << simHitKey.first <<
" of " << simHitKey.second
2637 <<
", first time with TrackingParticle " << assoc2.first.key() <<
", now with " << tpKey;
2640 throw cms::Exception(
"LogicError") <<
"Got second time the SimHit " << simHitKey.first <<
" of "
2641 << simHitKey.second <<
", now with TrackingParticle " << tpKey
2642 <<
", but I didn't find the first occurrance!";
2647 throw cms::Exception(
"LogicError") <<
"Did not find a det unit for DetId " << simhit.detUnitId()
2648 <<
" from tracker geometry";
2650 const auto pos = det->surface().toGlobal(simhit.localPosition());
2651 const float tof = simhit.timeOfFlight();
2653 const auto simHitIndex =
simhit_x.size();
2654 simHitRefKeyToIndex[simHitKey] = simHitIndex;
2664 const auto mom = det->surface().toGlobal(simhit.momentumAtEntry());
2680 tpHitList.emplace_back(tpKey, simHitIndex, tof, simhit.detUnitId());
2686 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2691 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2692 std::set<edm::ProductID>& hitProductIds) {
2693 std::vector<std::pair<uint64_t, PixelMaskContainer const*>> pixelMasks;
2698 pixelMasks.emplace_back(1 << itoken.first, aH.
product());
2700 auto pixUsedMask = [&pixelMasks](
size_t key) {
2702 for (
auto const&
m : pixelMasks) {
2703 if (
m.second->mask(
key))
2711 for (
auto it = pixelHits->begin(); it != pixelHits->end(); it++) {
2712 const DetId hitId = it->detId();
2713 for (
auto hit = it->begin();
hit != it->end();
hit++) {
2716 hitProductIds.insert(
hit->cluster().
id());
2718 const int key =
hit->cluster().key();
2719 const int lay = tTopo.
layer(hitId);
2725 pix_x.push_back(ttrh->globalPosition().x());
2726 pix_y.push_back(ttrh->globalPosition().y());
2727 pix_z.push_back(ttrh->globalPosition().z());
2728 pix_xx.push_back(ttrh->globalPositionError().cxx());
2729 pix_xy.push_back(ttrh->globalPositionError().cyx());
2730 pix_yy.push_back(ttrh->globalPositionError().cyy());
2731 pix_yz.push_back(ttrh->globalPositionError().czy());
2732 pix_zz.push_back(ttrh->globalPositionError().czz());
2733 pix_zx.push_back(ttrh->globalPositionError().czx());
2734 pix_radL.push_back(ttrh->surface()->mediumProperties().radLen());
2735 pix_bbxi.push_back(ttrh->surface()->mediumProperties().xi());
2740 LogTrace(
"TrackingNtuple") <<
"pixHit cluster=" << key <<
" subdId=" << hitId.
subdetId() <<
" lay=" << lay
2741 <<
" rawId=" << hitId.
rawId() <<
" pos =" << ttrh->globalPosition();
2751 simHitRefKeyToIndex,
2760 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx <<
" simHitPos="
2766 <<
" event=" << simHitData.
event[0];
2775 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2780 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2781 std::set<edm::ProductID>& hitProductIds) {
2782 std::vector<std::pair<uint64_t, StripMaskContainer const*>> stripMasks;
2787 stripMasks.emplace_back(1 << itoken.first, aH.
product());
2789 auto strUsedMask = [&stripMasks](
size_t key) {
2791 for (
auto const&
m : stripMasks) {
2792 if (
m.second->mask(
key))
2803 int totalStripHits = rphiHits->dataSize() + stereoHits->dataSize();
2811 str_x.resize(totalStripHits);
2812 str_y.resize(totalStripHits);
2813 str_z.resize(totalStripHits);
2814 str_xx.resize(totalStripHits);
2815 str_xy.resize(totalStripHits);
2816 str_yy.resize(totalStripHits);
2817 str_yz.resize(totalStripHits);
2818 str_zz.resize(totalStripHits);
2819 str_zx.resize(totalStripHits);
2829 for (
const auto& detset : hits) {
2830 const DetId hitId = detset.detId();
2831 for (
const auto&
hit : detset) {
2834 hitProductIds.insert(
hit.cluster().
id());
2836 const int key =
hit.cluster().key();
2837 const int lay = tTopo.
layer(hitId);
2840 str_x[
key] = ttrh->globalPosition().x();
2841 str_y[
key] = ttrh->globalPosition().y();
2842 str_z[
key] = ttrh->globalPosition().z();
2843 str_xx[
key] = ttrh->globalPositionError().cxx();
2844 str_xy[
key] = ttrh->globalPositionError().cyx();
2845 str_yy[
key] = ttrh->globalPositionError().cyy();
2846 str_yz[
key] = ttrh->globalPositionError().czy();
2847 str_zz[
key] = ttrh->globalPositionError().czz();
2848 str_zx[
key] = ttrh->globalPositionError().czx();
2849 str_radL[
key] = ttrh->surface()->mediumProperties().radLen();
2850 str_bbxi[
key] = ttrh->surface()->mediumProperties().xi();
2854 LogTrace(
"TrackingNtuple") << name <<
" cluster=" << key <<
" subdId=" << hitId.
subdetId() <<
" lay=" << lay
2855 <<
" rawId=" << hitId.
rawId() <<
" pos =" << ttrh->globalPosition();
2866 simHitRefKeyToIndex,
2875 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx <<
" simHitPos="
2883 <<
" event=" << simHitData.
event[0];
2890 fill(*rphiHits,
"stripRPhiHit");
2891 fill(*stereoHits,
"stripStereoHit");
2897 const std::vector<std::pair<uint64_t, StripMaskContainer const*>>& stripMasks,
2898 std::vector<std::pair<int, int>>& monoStereoClusterList) {
2899 auto strUsedMask = [&stripMasks](
size_t key) {
2901 for (
auto const&
m : stripMasks) {
2902 if (
m.second->mask(
key))
2910 const int lay = tTopo.
layer(hitId);
2917 glu_x.push_back(ttrh->globalPosition().x());
2918 glu_y.push_back(ttrh->globalPosition().y());
2919 glu_z.push_back(ttrh->globalPosition().z());
2920 glu_xx.push_back(ttrh->globalPositionError().cxx());
2921 glu_xy.push_back(ttrh->globalPositionError().cyx());
2922 glu_yy.push_back(ttrh->globalPositionError().cyy());
2923 glu_yz.push_back(ttrh->globalPositionError().czy());
2924 glu_zz.push_back(ttrh->globalPositionError().czz());
2925 glu_zx.push_back(ttrh->globalPositionError().czx());
2926 glu_radL.push_back(ttrh->surface()->mediumProperties().radLen());
2927 glu_bbxi.push_back(ttrh->surface()->mediumProperties().xi());
2933 LogTrace(
"TrackingNtuple") <<
"stripMatchedHit"
2935 <<
" cluster1=" << hit.
monoHit().
cluster().
key() <<
" subdId=" << hitId.subdetId()
2936 <<
" lay=" << lay <<
" rawId=" << hitId.rawId() <<
" pos =" << ttrh->globalPosition();
2943 std::vector<std::pair<int, int>>& monoStereoClusterList) {
2944 std::vector<std::pair<uint64_t, StripMaskContainer const*>> stripMasks;
2949 stripMasks.emplace_back(1 << itoken.first, aH.
product());
2954 for (
auto it = matchedHits->begin(); it != matchedHits->end(); it++) {
2955 for (
auto hit = it->begin();
hit != it->end();
hit++) {
2963 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2968 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2969 std::set<edm::ProductID>& hitProductIds) {
2972 for (
auto it = phase2OTHits->begin(); it != phase2OTHits->end(); it++) {
2973 const DetId hitId = it->detId();
2974 for (
auto hit = it->begin();
hit != it->end();
hit++) {
2977 hitProductIds.insert(
hit->cluster().
id());
2979 const int key =
hit->cluster().key();
2980 const int lay = tTopo.
layer(hitId);
2986 ph2_x.push_back(ttrh->globalPosition().x());
2987 ph2_y.push_back(ttrh->globalPosition().y());
2988 ph2_z.push_back(ttrh->globalPosition().z());
2989 ph2_xx.push_back(ttrh->globalPositionError().cxx());
2990 ph2_xy.push_back(ttrh->globalPositionError().cyx());
2991 ph2_yy.push_back(ttrh->globalPositionError().cyy());
2992 ph2_yz.push_back(ttrh->globalPositionError().czy());
2993 ph2_zz.push_back(ttrh->globalPositionError().czz());
2994 ph2_zx.push_back(ttrh->globalPositionError().czx());
2995 ph2_radL.push_back(ttrh->surface()->mediumProperties().radLen());
2996 ph2_bbxi.push_back(ttrh->surface()->mediumProperties().xi());
2998 LogTrace(
"TrackingNtuple") <<
"phase2 OT cluster=" << key <<
" subdId=" << hitId.
subdetId() <<
" lay=" << lay
2999 <<
" rawId=" << hitId.
rawId() <<
" pos =" << ttrh->globalPosition();
3010 simHitRefKeyToIndex,
3018 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx <<
" simHitPos="
3024 <<
" event=" << simHitData.
event[0];
3033 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
3040 std::vector<std::pair<int, int>>& monoStereoClusterList,
3041 const std::set<edm::ProductID>& hitProductIds,
3042 std::map<edm::ProductID, size_t>& seedCollToOffset) {
3044 for (
size_t iColl = 0; iColl <
seedTokens_.size(); ++iColl) {
3048 iEvent.
getByToken(seedToken, seedTracksHandle);
3049 const auto& seedTracks = *seedTracksHandle;
3051 if (seedTracks.empty())
3059 iEvent.
getByToken(seedStopInfoToken, seedStopInfoHandle);
3060 const auto& seedStopInfos = *seedStopInfoHandle;
3061 if (seedTracks.size() != seedStopInfos.size()) {
3065 throw cms::Exception(
"LogicError") <<
"Got " << seedTracks.size() <<
" seeds, but " << seedStopInfos.size()
3066 <<
" seed stopping infos for collections " << labels.
module <<
", "
3070 std::vector<std::pair<uint64_t, StripMaskContainer const*>> stripMasks;
3075 stripMasks.emplace_back(1 << itoken.first, aH.
product());
3081 seedTrackRefs.
push_back(seedTracks.refAt(i));
3088 label.ReplaceAll(
"seedTracks",
"");
3089 label.ReplaceAll(
"Seeds",
"");
3090 label.ReplaceAll(
"muonSeeded",
"muonSeededStep");
3092 label.ReplaceAll(
"FromPixelTracks",
"");
3093 label.ReplaceAll(
"PFLowPixel",
"");
3094 label.ReplaceAll(
"hltDoubletRecovery",
"pixelPairStep");
3099 auto inserted = seedCollToOffset.emplace(
id,
offset);
3100 if (!inserted.second)
3102 <<
"Trying to add seeds with ProductID " <<
id <<
" for a second time from collection " << labels.
module
3103 <<
", seed algo " << label <<
". Typically this is caused by a configuration problem.";
3106 LogTrace(
"TrackingNtuple") <<
"NEW SEED LABEL: " << label <<
" size: " << seedTracks.size() <<
" algo=" << algo
3107 <<
" ProductID " <<
id;
3109 for (
size_t iSeed = 0; iSeed < seedTrackRefs.
size(); ++iSeed) {
3110 const auto& seedTrackRef = seedTrackRefs[iSeed];
3111 const auto& seedTrack = *seedTrackRef;
3112 const auto& seedRef = seedTrack.seedRef();
3113 const auto&
seed = *seedRef;
3115 const auto seedStopInfo = seedStopInfos[iSeed];
3117 if (seedRef.id() !=
id)
3119 <<
"All tracks in 'TracksFromSeeds' collection should point to seeds in the same collection. Now the "
3120 "element 0 had ProductID "
3121 <<
id <<
" while the element " << seedTrackRef.key() <<
" had " << seedTrackRef.id()
3122 <<
". The source collection is " << labels.
module <<
".";
3124 std::vector<int> tpIdx;
3125 std::vector<float> sharedFraction;
3126 auto foundTPs = recSimColl.
find(seedTrackRef);
3127 if (foundTPs != recSimColl.
end()) {
3128 for (
const auto& tpQuality : foundTPs->val) {
3129 tpIdx.push_back(tpKeyToIndex.at(tpQuality.first.key()));
3130 sharedFraction.push_back(tpQuality.second);
3135 const int nHits = seedTrack.numberOfValidHits();
3137 seedTrack.recHitsBegin(),
3138 seedTrack.recHitsEnd());
3139 const int nClusters = clusters.size();
3140 const auto bestKeyCount = findBestMatchingTrackingParticle(seedTrack, clusterToTPMap, tpKeyToIndex);
3141 const float bestShareFrac =
3142 nClusters > 0 ?
static_cast<float>(bestKeyCount.countClusters) / static_cast<float>(nClusters) : 0;
3144 const auto bestFirstHitKeyCount =
3145 findMatchingTrackingParticleFromFirstHit(seedTrack, clusterToTPMap, tpKeyToIndex);
3146 const float bestFirstHitShareFrac =
3147 nClusters > 0 ?
static_cast<float>(bestFirstHitKeyCount.countClusters) / static_cast<float>(nClusters) : 0;
3150 const int charge = seedTrack.charge();
3151 const float pt = seedFitOk ? seedTrack.pt() : 0;
3152 const float eta = seedFitOk ? seedTrack.eta() : 0;
3153 const float phi = seedFitOk ? seedTrack.phi() : 0;
3155 const auto seedIndex =
see_fitok.size();
3159 see_px.push_back(seedFitOk ? seedTrack.px() : 0);
3160 see_py.push_back(seedFitOk ? seedTrack.py() : 0);
3161 see_pz.push_back(seedFitOk ? seedTrack.pz() : 0);
3165 see_q.push_back(charge);
3170 see_ptErr.push_back(seedFitOk ? seedTrack.ptError() : 0);
3171 see_etaErr.push_back(seedFitOk ? seedTrack.etaError() : 0);
3172 see_phiErr.push_back(seedFitOk ? seedTrack.phiError() : 0);
3173 see_dxyErr.push_back(seedFitOk ? seedTrack.dxyError() : 0);
3174 see_dzErr.push_back(seedFitOk ? seedTrack.dzError() : 0);
3177 see_nCands.push_back(seedStopInfo.candidatesPerSeed());
3179 const auto&
state = seedTrack.seedRef()->startingState();
3180 const auto& pos =
state.parameters().position();
3181 const auto& mom =
state.parameters().momentum();
3202 std::vector<float> cov(15);
3203 auto covP = cov.begin();
3204 for (
auto const val : stateCcov)
3213 see_bestSimTrkIdx.push_back(bestKeyCount.key >= 0 ? tpKeyToIndex.at(bestKeyCount.key) : -1);
3215 bestFirstHitKeyCount.key >= 0 ? tpKeyToIndex.at(bestFirstHitKeyCount.key) : -1);
3234 std::vector<int> hitIdx;
3235 std::vector<int> hitType;
3237 for (
auto const&
hit :
seed.recHits()) {
3239 int subid = recHit->geographicalId().subdetId();
3245 checkProductID(hitProductIds, clusterRef.id(),
"seed");
3248 hitIdx.push_back(clusterKey);
3261 std::vector<std::pair<int, int>>::iterator pos =
3262 find(monoStereoClusterList.begin(), monoStereoClusterList.end(), std::make_pair(monoIdx, stereoIdx));
3263 size_t gluedIndex = -1;
3264 if (pos != monoStereoClusterList.end()) {
3265 gluedIndex =
std::distance(monoStereoClusterList.begin(), pos);
3271 gluedIndex =
addStripMatchedHit(*matchedHit, theTTRHBuilder, tTopo, stripMasks, monoStereoClusterList);
3276 hitIdx.push_back(gluedIndex);
3281 unsigned int clusterKey;
3282 if (clusterRef.isPhase2()) {
3285 clusterKey = clusterRef.cluster_strip().key();
3289 checkProductID(hitProductIds, clusterRef.id(),
"seed");
3290 if (clusterRef.isPhase2()) {
3297 hitIdx.push_back(clusterKey);
3298 if (clusterRef.isPhase2()) {
3305 LogTrace(
"TrackingNtuple") <<
" not pixel and not Strip detector";
3320 std::vector<GlobalPoint>
gp(2);
3321 std::vector<GlobalError> ge(2);
3322 gp[0] = recHit0->globalPosition();
3323 ge[0] = recHit0->globalPositionError();
3324 gp[1] = recHit1->globalPosition();
3325 ge[1] = recHit1->globalPositionError();
3327 <<
"seed " << seedTrackRef.key() <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
3328 <<
" - PAIR - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId()
3329 <<
" hitpos: " << gp[0] <<
" " << gp[1] <<
" trans0: "
3330 << (recHit0->transientHits().size() > 1 ? recHit0->transientHits()[0]->globalPosition()
3333 << (recHit0->transientHits().size() > 1 ? recHit0->transientHits()[1]->globalPosition()
3336 << (recHit1->transientHits().size() > 1 ? recHit1->transientHits()[0]->globalPosition()
3339 << (recHit1->transientHits().size() > 1 ? recHit1->transientHits()[1]->globalPosition()
3341 <<
" eta,phi: " << gp[0].
eta() <<
"," << gp[0].phi();
3342 }
else if (nHits == 3) {
3349 gp[0] = recHit0->globalPosition();
3350 ge[0] = recHit0->globalPositionError();
3351 int subid0 = recHit0->geographicalId().subdetId();
3354 gp[1] = recHit1->globalPosition();
3355 ge[1] = recHit1->globalPositionError();
3356 int subid1 = recHit1->geographicalId().subdetId();
3359 gp[2] = recHit2->globalPosition();
3360 ge[2] = recHit2->globalPositionError();
3361 int subid2 = recHit2->geographicalId().subdetId();
3365 float seed_chi2 = rzLine.
chi2();
3369 <<
"seed " << seedTrackRef.key() <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
3370 <<
" - TRIPLET - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId()
3371 <<
" " << recHit2->geographicalId().rawId() <<
" hitpos: " <<
gp[0] <<
" " <<
gp[1] <<
" " <<
gp[2]
3373 << (recHit0->transientHits().size() > 1 ? recHit0->transientHits()[0]->globalPosition()
3376 << (recHit0->transientHits().size() > 1 ? recHit0->transientHits()[1]->globalPosition()
3379 << (recHit1->transientHits().size() > 1 ? recHit1->transientHits()[0]->globalPosition()
3382 << (recHit1->transientHits().size() > 1 ? recHit1->transientHits()[1]->globalPosition()
3385 << (recHit2->transientHits().size() > 1 ? recHit2->transientHits()[0]->globalPosition()
3388 << (recHit2->transientHits().size() > 1 ? recHit2->transientHits()[1]->globalPosition()
3391 << recHit2->localPosition()
3393 <<
" eta,phi: " <<
gp[0].eta() <<
"," <<
gp[0].phi() <<
" pt,chi2: " << seed_pt <<
"," << seed_chi2;
3405 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
3406 const TrackingParticleRefKeyToCount& tpKeyToClusterCount,
3414 const std::set<edm::ProductID>& hitProductIds,
3415 const std::map<edm::ProductID, size_t>& seedCollToOffset,
3416 const std::vector<const MVACollection*>& mvaColls,
3417 const std::vector<const QualityMaskCollection*>& qualColls) {
3421 LogTrace(
"TrackingNtuple") <<
"NEW TRACK LABEL: " << labels.
module;
3423 auto pvPosition = vertices[0].position();
3425 for (
size_t iTrack = 0; iTrack < tracks.
size(); ++iTrack) {
3426 const auto& itTrack = tracks[iTrack];
3427 int charge = itTrack->charge();
3428 float pt = itTrack->pt();
3429 float eta = itTrack->eta();
3430 const double lambda = itTrack->lambda();
3431 float chi2 = itTrack->normalizedChi2();
3432 float ndof = itTrack->ndof();
3433 float phi = itTrack->phi();
3434 int nHits = itTrack->numberOfValidHits();
3437 const auto& tkParam = itTrack->parameters();
3438 auto tkCov = itTrack->covariance();
3443 bool isSimMatched =
false;
3444 std::vector<int> tpIdx;
3445 std::vector<float> sharedFraction;
3446 std::vector<float> tpChi2;
3447 auto foundTPs = recSimColl.
find(itTrack);
3448 if (foundTPs != recSimColl.
end()) {
3449 if (!foundTPs->val.empty()) {
3450 nSimHits = foundTPs->val[0].first->numberOfTrackerHits();
3451 isSimMatched =
true;
3453 for (
const auto& tpQuality : foundTPs->val) {
3454 tpIdx.push_back(tpKeyToIndex.at(tpQuality.first.key()));
3455 sharedFraction.push_back(tpQuality.second);
3462 itTrack->recHitsBegin(),
3463 itTrack->recHitsEnd());
3464 const int nClusters = clusters.size();
3466 const auto bestKeyCount = findBestMatchingTrackingParticle(*itTrack, clusterToTPMap, tpKeyToIndex);
3467 const float bestShareFrac =
static_cast<float>(bestKeyCount.countClusters) / static_cast<float>(nClusters);
3468 float bestShareFracSimDenom = 0;
3469 float bestShareFracSimClusterDenom = 0;
3470 float bestChi2 = -1;
3471 if (bestKeyCount.key >= 0) {
3472 bestShareFracSimDenom =
3473 static_cast<float>(bestKeyCount.countClusters) /
3474 static_cast<float>(tpCollection[tpKeyToIndex.at(bestKeyCount.key)]->numberOfTrackerHits());
3475 bestShareFracSimClusterDenom =
3476 static_cast<float>(bestKeyCount.countClusters) / static_cast<float>(tpKeyToClusterCount.at(bestKeyCount.key));
3478 tkParam, tkCov, *(tpCollection[tpKeyToIndex.at(bestKeyCount.key)]), mf, bs);
3481 const auto bestFirstHitKeyCount = findMatchingTrackingParticleFromFirstHit(*itTrack, clusterToTPMap, tpKeyToIndex);
3482 const float bestFirstHitShareFrac =
3483 static_cast<float>(bestFirstHitKeyCount.countClusters) / static_cast<float>(nClusters);
3484 float bestFirstHitShareFracSimDenom = 0;
3485 float bestFirstHitShareFracSimClusterDenom = 0;
3486 float bestFirstHitChi2 = -1;
3487 if (bestFirstHitKeyCount.key >= 0) {
3488 bestFirstHitShareFracSimDenom =
3489 static_cast<float>(bestFirstHitKeyCount.countClusters) /
3490 static_cast<float>(tpCollection[tpKeyToIndex.at(bestFirstHitKeyCount.key)]->numberOfTrackerHits());
3491 bestFirstHitShareFracSimClusterDenom =
static_cast<float>(bestFirstHitKeyCount.countClusters) /
3492 static_cast<float>(tpKeyToClusterCount.at(bestFirstHitKeyCount.key));
3494 tkParam, tkCov, *(tpCollection[tpKeyToIndex.at(bestFirstHitKeyCount.key)]), mf, bs);
3497 float chi2_1Dmod =
chi2;
3498 int count1dhits = 0;
3499 for (
auto iHit = itTrack->recHitsBegin(), iEnd = itTrack->recHitsEnd(); iHit != iEnd; ++iHit) {
3504 if (count1dhits > 0) {
3505 chi2_1Dmod = (chi2 + count1dhits) / (ndof + count1dhits);
3510 trk_px.push_back(itTrack->px());
3511 trk_py.push_back(itTrack->py());
3512 trk_pz.push_back(itTrack->pz());
3517 trk_inner_pt.push_back(itTrack->innerMomentum().rho());
3521 trk_outer_pt.push_back(itTrack->outerMomentum().rho());
3528 trk_dxyPV.push_back(itTrack->dxy(pvPosition));
3529 trk_dzPV.push_back(itTrack->dz(pvPosition));
3532 trk_ptErr.push_back(itTrack->ptError());
3537 trk_dzErr.push_back(itTrack->dzError());
3544 trk_q.push_back(charge);
3559 trk_algo.push_back(itTrack->algo());
3565 for (
size_t i = 0; i <
trk_mvas.size(); ++
i) {
3566 trk_mvas[
i].push_back((*(mvaColls[i]))[iTrack]);
3571 auto offset = seedCollToOffset.find(itTrack->seedRef().id());
3572 if (
offset == seedCollToOffset.end()) {
3576 << itTrack->seedRef().id()
3577 <<
", but that seed collection is not given as an input. The following collections were given as an input "
3578 << make_ProductIDMapPrinter(seedCollToOffset);
3581 const auto seedIndex =
offset->second + itTrack->seedRef().key();
3584 throw cms::Exception(
"LogicError") <<
"Track index has already been set for seed " << seedIndex <<
" to "
3585 <<
see_trkIdx[seedIndex] <<
"; was trying to set it to " << iTrack;
3594 trk_bestSimTrkIdx.push_back(bestKeyCount.key >= 0 ? tpKeyToIndex.at(bestKeyCount.key) : -1);
3609 LogTrace(
"TrackingNtuple") <<
"Track #" << itTrack.key() <<
" with q=" << charge <<
", pT=" << pt
3610 <<
" GeV, eta: " << eta <<
", phi: " << phi <<
", chi2=" << chi2 <<
", Nhits=" << nHits
3611 <<
", algo=" << itTrack->algoName(itTrack->algo()).c_str()
3613 <<
" seed#=" << itTrack->seedRef().key() <<
" simMatch=" << isSimMatched
3614 <<
" nSimHits=" << nSimHits
3615 <<
" sharedFraction=" << (sharedFraction.empty() ? -1 : sharedFraction[0])
3616 <<
" tpIdx=" << (tpIdx.empty() ? -1 : tpIdx[0]);
3617 std::vector<int> hitIdx;
3618 std::vector<int> hitType;
3620 for (
auto i = itTrack->recHitsBegin(); i != itTrack->recHitsEnd(); i++) {
3622 DetId hitId = hit->geographicalId();
3630 if (hit->isValid()) {
3634 unsigned int clusterKey;
3635 if (clusterRef.isPixel()) {
3637 }
else if (clusterRef.isPhase2()) {
3638 clusterKey = clusterRef.cluster_phase2OT().key();
3640 clusterKey = clusterRef.cluster_strip().key();
3643 LogTrace(
"TrackingNtuple") <<
" id: " << hitId.
rawId() <<
" - globalPos =" << hit->globalPosition()
3644 <<
" cluster=" << clusterKey <<
" clusterRef ID=" << clusterRef.id()
3645 <<
" eta,phi: " << hit->globalPosition().eta() <<
"," << hit->globalPosition().phi();
3647 checkProductID(hitProductIds, clusterRef.id(),
"track");
3648 if (clusterRef.isPixel()) {
3650 }
else if (clusterRef.isPhase2()) {
3657 hitIdx.push_back(clusterKey);
3658 if (clusterRef.isPixel()) {
3660 }
else if (clusterRef.isPhase2()) {
3666 LogTrace(
"TrackingNtuple") <<
" - invalid hit";
3676 inv_type.push_back(hit->getType());
3690 const TrackingVertexRefKeyToIndex& tvKeyToIndex,
3692 const std::vector<TPHitIndex>& tpHitList,
3693 const TrackingParticleRefKeyToCount& tpKeyToClusterCount) {
3697 const auto& nLayers_tPCeff = *tpNLayersH;
3700 const auto& nPixelLayers_tPCeff = *tpNLayersH;
3703 const auto& nStripMonoAndStereoLayers_tPCeff = *tpNLayersH;
3708 LogTrace(
"TrackingNtuple") <<
"tracking particle pt=" <<
tp->pt() <<
" eta=" <<
tp->eta() <<
" phi=" <<
tp->phi();
3709 bool isRecoMatched =
false;
3710 std::vector<int> tkIdx;
3711 std::vector<float> sharedFraction;
3712 auto foundTracks = simRecColl.
find(
tp);
3713 if (foundTracks != simRecColl.
end()) {
3714 isRecoMatched =
true;
3722 for (
const auto& genRef :
tp->genParticles()) {
3723 if (genRef.isNonnull())
3727 bool isFromBHadron =
false;
3732 for (
const auto& particle : recoGenParticleTrail) {
3733 HepPDT::ParticleID particleID(particle->pdgId());
3734 if (particleID.hasBottom()) {
3735 isFromBHadron =
true;
3741 LogTrace(
"TrackingNtuple") <<
"matched to tracks = " << make_VectorPrinter(tkIdx)
3742 <<
" isRecoMatched=" << isRecoMatched;
3753 sim_q.push_back(
tp->charge());
3757 std::vector<int> decayIdx;
3758 for (
const auto&
v :
tp->decayVertices())
3759 decayIdx.push_back(tvKeyToIndex.at(
v.key()));
3767 const double lambdaSim =
M_PI / 2 - momentum.theta();
3776 std::vector<int> hitIdx;
3777 int nPixel = 0, nStrip = 0;
3779 for (
auto ip = rangeHit.first; ip != rangeHit.second; ++ip) {
3783 LogTrace(
"TrackingNtuple") <<
"simhit=" << ip->simHitIdx <<
" type=" <<
static_cast<int>(
type);
3784 hitIdx.push_back(ip->simHitIdx);
3787 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " <<
tp.key() <<
" with DetId "
3788 << detid.rawId() <<
" whose det() is not Tracker but " << detid.det();
3790 const auto subdet = detid.subdetId();
3803 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " <<
tp.key() <<
" with DetId "
3804 << detid.rawId() <<
" whose subdet is not recognized, is " << subdet;
3811 const auto nSimLayers = nLayers_tPCeff[
tp];
3812 const auto nSimPixelLayers = nPixelLayers_tPCeff[
tp];
3813 const auto nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[
tp];
3816 sim_n3DLay.push_back(nSimPixelLayers + nSimStripMonoAndStereoLayers);
3819 auto found = tpKeyToClusterCount.find(
tp.key());
3820 sim_nRecoClusters.push_back(found != cend(tpKeyToClusterCount) ? found->second : 0);
3829 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
3830 const unsigned int seedOffset) {
3834 for (
const auto& keyVal : simRecColl) {
3835 const auto& tpRef = keyVal.key;
3836 auto found = tpKeyToIndex.find(tpRef.key());
3837 if (found == tpKeyToIndex.end())
3838 throw cms::Exception(
"Assert") << __FILE__ <<
":" << __LINE__ <<
" fillTrackingParticlesForSeeds: tpRef.key() "
3839 << tpRef.key() <<
" not found from tpKeyToIndex. tpKeyToIndex size "
3840 << tpKeyToIndex.size();
3841 const auto tpIndex = found->second;
3842 for (
const auto& pair : keyVal.val) {
3843 const auto& seedRef = pair.first->seedRef();
3844 sim_seedIdx[tpIndex].push_back(seedOffset + seedRef.key());
3851 for (
size_t iVertex = 0,
size = vertices.size(); iVertex <
size; ++iVertex) {
3853 vtx_x.push_back(vertex.
x());
3854 vtx_y.push_back(vertex.
y());
3855 vtx_z.push_back(vertex.
z());
3864 std::vector<int> trkIdx;
3867 if (iTrack->id() != tracks.
id())
3870 trkIdx.push_back(iTrack->key());
3873 throw cms::Exception(
"LogicError") <<
"Vertex index has already been set for track " << iTrack->key() <<
" to "
3874 <<
trk_vtxIdx[iTrack->key()] <<
"; was trying to set it to " << iVertex;
3883 const TrackingParticleRefKeyToIndex& tpKeyToIndex) {
3884 int current_event = -1;
3885 for (
const auto& ref : trackingVertices) {
3895 processType = v.
g4Vertices()[0].processType();
3907 for (
const auto& tpRef : tps) {
3908 auto found = tpKeyToIndex.find(tpRef.key());
3909 if (found != tpKeyToIndex.end()) {
3910 idx.push_back(found->second);
3915 std::vector<int> sourceIdx;
3916 std::vector<int> daughterIdx;
3932 std::vector<edm::InputTag>{
edm::InputTag(
"seedTracksinitialStepSeeds"),
3944 std::vector<edm::InputTag>{
edm::InputTag(
"initialStepTrackCandidates"),
3955 desc.
addUntracked<std::vector<std::string>>(
"trackMVAs", std::vector<std::string>{{
"generalTracks"}});
3960 std::vector<edm::ParameterSet> cMasks;
3965 cMasks.push_back(ps);
3979 desc.
addUntracked<
bool>(
"trackingParticlesRef",
false);
3995 edm::InputTag(
"trackingParticleNumberOfLayersProducer",
"trackerLayers"));
3997 edm::InputTag(
"trackingParticleNumberOfLayersProducer",
"pixelLayers"));
3999 edm::InputTag(
"trackingParticleNumberOfLayersProducer",
"stripStereoLayers"));
4005 desc.
addUntracked<
bool>(
"includeTrackingParticles",
true);
4009 desc.
addUntracked<
bool>(
"simHitBySignificance",
false);
4010 descriptions.
add(
"trackingNtuple", desc);
std::vector< unsigned int > sim_nTrackerHits
std::vector< int > trk_bestSimTrkIdx
std::vector< float > sim_pca_dz
edm::LuminosityBlockNumber_t ev_lumi
std::vector< float > trk_nChi2_1Dmod
static const std::string kSharedResource
std::vector< unsigned int > simvtx_processType
Parsed parse(const TrackerTopology &tTopo, const DetId &id) const
edm::EDGetTokenT< TrackingParticleRefVector > trackingParticleRefToken_
std::vector< unsigned int > sim_nLay
std::vector< float > ph2_radL
std::vector< float > trk_dxyPV
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
EventNumber_t event() const
static constexpr auto TEC
void fillTrackingVertices(const TrackingVertexRefVector &trackingVertices, const TrackingParticleRefKeyToIndex &tpKeyToIndex)
std::vector< float > see_bestSimTrkShareFrac
std::vector< std::vector< float > > see_simTrkShareFrac
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > stripMatchedRecHitToken_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< short > see_fitok
Phase2Cluster1DRef cluster_phase2OT() const
std::vector< short > vtx_fake
std::vector< float > simvtx_z
std::vector< std::vector< float > > trk_simTrkNChi2
std::vector< std::vector< int > > see_hitType
std::vector< float > trk_dzClosestPV
edm::EDGetTokenT< SiStripRecHit2DCollection > stripRphiRecHitToken_
Phase2TrackerCluster1D const & phase2OTCluster() const
tuple ret
prodAgent to be discontinued
const TrackingParticleRefVector & sourceTracks() const
std::vector< short > ph2_isBarrel
bool tecIsDoubleSide(const DetId &id) const
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
std::vector< float > trk_phi
SiPixelCluster const & pixelCluster() const
std::vector< float > sim_pca_cotTheta
const bool simHitBySignificance_
bool tobIsDoubleSide(const DetId &id) const
std::vector< float > sim_pca_dxy
void book(const std::string &prefix, TTree *tree)
std::vector< float > see_stateTrajX
std::vector< unsigned int > trk_nOuterLost
std::vector< float > glu_xy
std::vector< short > trk_isTrue
std::vector< std::vector< int > > ph2_seeIdx
std::vector< float > glu_radL
std::vector< float > trk_inner_pz
int event() const
get the contents of the subdetector field (should be protected?)
std::vector< float > see_stateTrajPy
std::vector< float > pix_y
std::vector< int > trk_vtxIdx
std::vector< std::vector< int > > str_trkIdx
std::vector< unsigned int > see_nValid
std::vector< float > str_yy
iterator find(det_id_type id)
bool tibIsDoubleSide(const DetId &id) const
bool trackFromSeedFitFailed(const reco::Track &track)
std::vector< float > trk_outer_py
unsigned int tibString(const DetId &id) const
std::vector< float > glu_chargePerCM
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< float > pix_zz
unsigned int tidRing(const DetId &id) const
std::vector< unsigned short > layer
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< float > ph2_bbxi
std::vector< uint64_t > str_usedMask
std::vector< int > glu_monoIdx
std::vector< float > trk_eta
std::vector< short > glu_isBarrel
uint16_t *__restrict__ id
std::vector< unsigned short > order
std::vector< int > sim_bunchCrossing
SimHitData matchCluster(const OmniClusterRef &cluster, DetId hitId, int clusterKey, const TransientTrackingRecHit::RecHitPointer &ttrh, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< SimLink > &digiSimLinks, const SimHitRefKeyToIndex &simHitRefKeyToIndex, HitType hitType)
std::vector< float > see_phiErr
std::vector< int > trk_bestFromFirstHitSimTrkIdx
std::vector< std::vector< int > > simhit_hitIdx
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
const_iterator end() const
last iterator over the map (read only)
std::vector< float > str_x
std::vector< float > see_dzErr
std::vector< unsigned int > sim_n3DLay
std::vector< float > trk_cotTheta
std::vector< float > trk_bestSimTrkNChi2
CombineDetId< DetIdCommon, DetIdOTCommon, DetIdStripOnly > DetIdStrip
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > see_nStrip
std::vector< float > trk_px
double zError() const
error on z
constexpr bool isNotFinite(T x)
void fillPixelHits(const edm::Event &iEvent, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< PixelDigiSimLink > &digiSimLink, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const SimHitRefKeyToIndex &simHitRefKeyToIndex, std::set< edm::ProductID > &hitProductIds)
std::vector< unsigned short > pix_simType
std::vector< unsigned short > inv_type
std::vector< float > see_stateTrajPz
std::vector< float > pix_zx
TPHitIndex(unsigned int tp=0, unsigned int simHit=0, float to=0, unsigned int id=0)
const std::vector< SimVertex > & g4Vertices() const
#define DEFINE_FWK_MODULE(type)
std::vector< float > sim_phi
std::vector< std::vector< int > > trk_simTrkIdx
void fillStripRphiStereoHits(const edm::Event &iEvent, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< StripDigiSimLink > &digiSimLink, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const SimHitRefKeyToIndex &simHitRefKeyToIndex, std::set< edm::ProductID > &hitProductIds)
int numberOfValidHits() const
std::vector< float > trk_dzPV
double y() const
y coordinate
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > trackAssociatorToken_
OmniClusterRef const & stereoClusterRef() const
int pdgId() const
PDG ID.
bool isValid() const
Tells whether the vertex is valid.
edm::EDGetTokenT< SiStripRecHit2DCollection > stripStereoRecHitToken_
std::vector< float > trk_dxyErr
unsigned int SimTrackId() const
std::vector< float > str_yz
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< float > trk_pt
unsigned int tecRing(const DetId &id) const
ring id
const CurvilinearTrajectoryError & curvilinearError() const
SiStripCluster const & amplitudes() const
std::vector< float > glu_x
std::vector< float > trk_inner_py
std::vector< float > see_px
std::vector< float > see_chi2
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< float > simhit_px
std::vector< float > glu_z
std::vector< float > see_stateTrajY
edm::EDGetTokenT< edm::View< reco::Track > > trackToken_
constexpr bool isUninitialized() const noexcept
CombineDetId< DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdPhase2OTOnly > DetIdAllPhase2
CombineDetId< DetIdCommon, DetIdPixelOnly > DetIdPixel
unsigned int pxbLadder(const DetId &id) const
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
unsigned int side(const DetId &id) const
void fillBeamSpot(const reco::BeamSpot &bs)
std::vector< unsigned short > see_stopReason
std::vector< float > trk_outer_px
std::vector< std::vector< int > > trk_hitType
std::vector< unsigned int > trk_nCluster
std::vector< float > ph2_xx
unsigned long long EventNumber_t
std::vector< std::vector< int > > ph2_trkIdx
int numberOfValidStripHits() const
edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > phase2OTRecHitToken_
bool isStereo(const DetId &id) const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
std::vector< OmniClusterRef > hitsToClusterRefs(iter begin, iter end)
std::vector< unsigned int > see_algo
std::string to_string(const V &value)
const bool addSeedCurvCov_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::vector< Vertex > VertexCollection
collection of Vertex objects
T * make(const Args &...args) const
make new ROOT object
auto const & tracks
cannot be loose
std::vector< float > trk_inner_pt
uint16_t firstStrip() const
std::vector< short > simhit_process
std::vector< unsigned short > module
std::vector< float > trk_bestSimTrkShareFracSimClusterDenom
CombineDetId< DetIdCommon, DetIdOTCommon, DetIdPhase2OTOnly > DetIdPhase2OT
std::vector< std::vector< int > > str_seeIdx
std::vector< std::vector< int > > see_simTrkIdx
std::vector< int > simvtx_event
std::vector< float > str_radL
std::vector< int > simhit_simTrkIdx
key_type key() const
Accessor for product key.
std::vector< unsigned short > trk_stopReason
std::vector< uint64_t > glu_usedMaskStereo
int pixelLayersWithMeasurement() const
std::vector< unsigned short > ladder
static bool tpHitIndexListLess(const TPHitIndex &i, const TPHitIndex &j)
TrackingNtuple(const edm::ParameterSet &)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
std::ostream & operator<<(std::ostream &out, const ALILine &li)
std::vector< float > sim_py
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< Vertex > VertexCollection
LuminosityBlockNumber_t luminosityBlock() const
std::vector< float > sim_px
unsigned int SimTrackId() const
unsigned int LuminosityBlockNumber_t
std::vector< float > pix_xx
std::vector< std::vector< int > > sim_decayVtxIdx
std::vector< float > trk_refpoint_x
std::vector< float > pix_radL
std::vector< float > xySignificance
OmniClusterRef const & firstClusterRef() const override
std::vector< float > pix_bbxi
std::vector< std::vector< float > > sim_trkShareFrac
std::vector< std::vector< float > > trk_mvas
void fillPhase2OTHits(const edm::Event &iEvent, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< PixelDigiSimLink > &digiSimLink, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const SimHitRefKeyToIndex &simHitRefKeyToIndex, std::set< edm::ProductID > &hitProductIds)
std::vector< float > ph2_zx
ProductID id() const
Accessor for product ID.
std::vector< int > simpv_idx
std::vector< unsigned char > QualityMaskCollection
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > pixelSimLinkToken_
TrackAlgorithm
track algorithm
CombineDetId< DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdStripOnly > DetIdAll
std::vector< std::vector< float > > str_xySignificance
std::vector< std::vector< int > > pix_seeIdx
const uint16_t range(const Frame &aFrame)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int numberOfLostTrackerHits(HitCategory category) const
std::vector< unsigned short > str_simType
ClusterPixelRef cluster_pixel() const
std::vector< short > see_isTrue
std::vector< short > inv_isBarrel
std::vector< SimHitTPPair > SimHitTPAssociationList
std::vector< float > trk_bestSimTrkShareFracSimDenom
std::vector< unsigned short > ring
std::vector< float > trk_bestFromFirstHitSimTrkNChi2
bool isLower(const DetId &id) const
math::XYZPointD Point
point in the space
std::vector< float > see_etaErr
bool getData(T &iHolder) const
std::vector< std::vector< float > > trk_simTrkShareFrac
std::vector< float > simhit_z
std::vector< float > ph2_z
std::vector< float > ph2_yy
Parsed parse(const TrackerTopology &tTopo, const DetId &id) const
std::vector< float > trk_refpoint_y
std::vector< unsigned int > trk_nLostLay
std::vector< float > MVACollection
unsigned int module(const DetId &id) const
std::vector< int > sim_event
std::vector< unsigned int > trk_nStrip
SiStripCluster const & stripCluster() const
std::vector< const reco::GenParticle * > RecoGenParticleTrail
reco::GenParticle trail type.
std::vector< int > see_bestSimTrkIdx
std::vector< float > chargeFraction
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNStripStereoLayersToken_
unsigned int tibSide(const DetId &id) const
std::vector< float > see_stateTrajGlbPz
std::vector< unsigned int > trk_nPixel
std::vector< float > glu_y
std::vector< std::vector< float > > pix_xySignificance
std::vector< unsigned short > panel
std::vector< float > trk_pz
std::vector< float > trk_dzErr
std::vector< unsigned short > isStereo
std::vector< float > trk_lambdaErr
std::vector< unsigned short > isUpper
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
std::vector< std::vector< float > > see_stateCurvCov
std::vector< unsigned int > see_nCluster
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitToken_
std::vector< float > ph2_y
std::vector< std::tuple< edm::EDGetTokenT< MVACollection >, edm::EDGetTokenT< QualityMaskCollection > > > mvaQualityCollectionTokens_
size_t addStripMatchedHit(const SiStripMatchedRecHit2D &hit, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const std::vector< std::pair< uint64_t, StripMaskContainer const * >> &stripMasks, std::vector< std::pair< int, int >> &monoStereoClusterList)
uint16_t hitPattern[ARRAY_LENGTH]
std::vector< std::vector< int > > simvtx_sourceSimIdx
std::vector< float > trk_bestFromFirstHitSimTrkShareFracSimDenom
std::vector< float > trk_etaErr
std::vector< short > pix_isBarrel
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
std::vector< float > glu_yz
std::vector< float > sim_pca_phi
std::vector< int > pix_clustSizeCol
auto dz(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
std::vector< unsigned int > trk_algo
std::vector< unsigned int > sim_nRecoClusters
void fillTrackingParticlesForSeeds(const TrackingParticleRefVector &tpCollection, const reco::SimToRecoCollection &simRecColl, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const unsigned int seedOffset)
std::vector< float > ph2_xy
std::vector< float > trk_bestFromFirstHitSimTrkShareFracSimClusterDenom
std::vector< float > vtx_y
std::vector< float > pix_z
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
std::vector< int > see_bestFromFirstHitSimTrkIdx
int bunchCrossing() const
get the detector field from this detid
std::vector< int > bunchCrossing
std::vector< float > sim_eta
std::vector< unsigned short > blade
std::vector< unsigned int > trk_originalAlgo
std::vector< unsigned int > trk_nInnerLost
std::vector< float > str_y
std::vector< int > sim_pdgId
std::vector< std::vector< int > > simhit_hitType
std::vector< float > trk_refpoint_z
unsigned int tobSide(const DetId &id) const
std::vector< unsigned int > trk_nInactive
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > seedTokens_
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitTPMapToken_
std::vector< unsigned int > trk_nOuterInactive
std::vector< float > pix_yz
std::vector< std::vector< int > > sim_genPdgIds
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< int > trk_seedIdx
std::vector< std::vector< float > > pix_chargeFraction
tuple key
prepare the HTCondor submission files and eventually submit them
std::vector< float > vtx_yErr
std::vector< std::vector< int > > pix_trkIdx
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< unsigned int > sim_nValid
std::vector< float > glu_yy
std::vector< float > vtx_ndof
double chi2() const
chi-squares
std::vector< std::vector< int > > ph2_simHitIdx
trackRef_iterator tracks_end() const
last iterator over tracks
std::vector< float > simvtx_x
double z() const
z coordinate
T operator[](int i) const
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
std::vector< float > str_zz
DetIdAllPhase2 inv_detId_phase2
std::vector< float > sim_pca_pt
std::vector< float > see_dxyErr
bool isMatched(TrackingRecHit const &hit)
std::vector< float > trk_bestFromFirstHitSimTrkShareFrac
double BeamWidthX() const
beam width X
ClusterRef cluster() const
range equal_range(const OmniClusterRef &key) const
std::vector< float > see_pt
std::vector< unsigned int > see_nPhase2OT
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexToken_
std::vector< float > see_dxy
std::vector< std::vector< int > > glu_seeIdx
std::vector< unsigned int > trk_n3DLay
std::vector< std::vector< int > > sim_trkIdx
std::vector< float > trk_outer_pt
static bool tpHitIndexListLessSort(const TPHitIndex &i, const TPHitIndex &j)
std::vector< int > matchingSimHit
std::vector< float > str_chargePerCM
const bool includeTrackingParticles_
std::vector< float > trk_dz
static constexpr auto TOB
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
std::vector< float > trk_ptErr
std::vector< unsigned int > trk_nStripLay
trackRef_iterator tracks_begin() const
first iterator over tracks
void fillSimHits(const TrackerGeometry &tracker, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const TrackerTopology &tTopo, SimHitRefKeyToIndex &simHitRefKeyToIndex, std::vector< TPHitIndex > &tpHitList)
std::vector< float > see_phi
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken_
OmniClusterRef const & monoClusterRef() const
std::vector< float > vtx_z
int trackerLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Log< level::Warning, true > LogPrint
std::vector< float > see_pz
void fillTrackingParticles(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::RefToBaseVector< reco::Track > &tracks, const reco::BeamSpot &bs, const TrackingParticleRefVector &tpCollection, const TrackingVertexRefKeyToIndex &tvKeyToIndex, const reco::TrackToTrackingParticleAssociator &associatorByHits, const std::vector< TPHitIndex > &tpHitList, const TrackingParticleRefKeyToCount &tpKeyToClusterCount)
void book(const std::string &prefix, TTree *tree)
std::vector< float > trk_phiErr
std::vector< unsigned int > sim_nPixelLay
std::vector< float > trk_lambda
std::vector< edm::EDGetTokenT< std::vector< SeedStopInfo > > > seedStopInfoTokens_
iterator end()
Return the off-the-end iterator.
std::vector< float > glu_zz
std::vector< float > sim_pca_lambda
std::vector< float > see_stateTrajPx
std::vector< float > glu_zx
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
std::shared_ptr< TrackingRecHit const > RecHitPointer
void fillTracks(const edm::RefToBaseVector< reco::Track > &tracks, const TrackingParticleRefVector &tpCollection, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const TrackingParticleRefKeyToCount &tpKeyToClusterCount, const MagneticField &mf, const reco::BeamSpot &bs, const reco::VertexCollection &vertices, const reco::TrackToTrackingParticleAssociator &associatorByHits, const ClusterTPAssociation &clusterToTPMap, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const std::set< edm::ProductID > &hitProductIds, const std::map< edm::ProductID, size_t > &seedToCollIndex, const std::vector< const MVACollection * > &mvaColls, const std::vector< const QualityMaskCollection * > &qualColls)
const bool saveSimHitsP3_
std::vector< float > vtx_xErr
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isUpper(const DetId &id) const
std::vector< float > sim_pz
std::vector< float > see_stateTrajGlbY
std::vector< std::vector< int > > sim_simHitIdx
edm::Ref< TrackingVertexCollection > TrackingVertexRef
std::vector< unsigned short > isGlued
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
edm::EventNumber_t ev_event
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< unsigned short > isRPhi
std::vector< float > ph2_x
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
double x() const
x coordinate
std::vector< uint64_t > pix_usedMask
std::vector< uint64_t > glu_usedMaskMono
std::vector< int > glu_stereoIdx
std::vector< float > trk_py
double xError() const
error on x
static constexpr auto TIB
std::vector< std::vector< int > > pix_simHitIdx
std::vector< float > trk_nChi2
SiStripRecHit2D stereoHit() const
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
std::vector< std::vector< unsigned short > > trk_qualityMasks
void book(const std::string &prefix, TTree *tree)
T const * product() const
unsigned long long uint64_t
const GlobalTrajectoryParameters & globalParameters() const
std::vector< unsigned int > see_nGlued
std::vector< float > see_py
std::vector< float > pix_x
std::vector< unsigned int > detId
std::vector< int > sim_parentVtxIdx
std::vector< float > see_ptErr
std::vector< float > str_z
std::vector< unsigned short > isStack
void addUntrackedParameter(std::string const &name, T const &value)
std::vector< float > str_zx
uint32_t stack(const DetId &id) const
virtual OmniClusterRef const & firstClusterRef() const =0
std::vector< TrackingVertex > TrackingVertexCollection
std::vector< int > glu_clustSizeStereo
double sigmaZ() const
sigma z
std::string algoName() const
bool tidIsDoubleSide(const DetId &id) const
int stripLayersWithMeasurement() const
std::vector< short > trk_isHP
std::vector< float > str_xy
double BeamWidthY() const
beam width Y
std::vector< std::vector< float > > str_chargeFraction
void push_back(const TrackerTopology &tTopo, const DetId &id)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~TrackingNtuple() override
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
std::vector< unsigned int > trk_nInnerInactive
std::vector< unsigned short > isLower
std::vector< std::pair< unsigned int, edm::EDGetTokenT< StripMaskContainer > > > stripUseMaskTokens_
unsigned int tecOrder(const DetId &id) const
Base class to all the history types.
std::vector< std::vector< float > > ph2_xySignificance
int numberOfLostHits(HitCategory category) const
std::vector< std::vector< int > > trk_hitIdx
unsigned int layer(const DetId &id) const
bool includePhase2OTHits_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
deadvectors[0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
void fillSeeds(const edm::Event &iEvent, const TrackingParticleRefVector &tpCollection, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const reco::BeamSpot &bs, const reco::TrackToTrackingParticleAssociator &associatorByHits, const ClusterTPAssociation &clusterToTPMap, const TransientTrackingRecHitBuilder &theTTRHBuilder, const MagneticField &theMF, const TrackerTopology &tTopo, std::vector< std::pair< int, int >> &monoStereoClusterList, const std::set< edm::ProductID > &hitProductIds, std::map< edm::ProductID, size_t > &seedToCollIndex)
SiStripRecHit2D monoHit() const
std::vector< unsigned int > sim_nPixel
const bool includeAllHits_
int trackerLayersWithoutMeasurement(HitCategory category) const
std::vector< short > vtx_valid
std::vector< float > see_stateTrajGlbX
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
const EncodedEventId & eventId() const
edm::EDGetTokenT< ClusterTPAssociation > clusterTPMapToken_
unsigned int tidOrder(const DetId &id) const
Pixel cluster – collection of neighboring pixels above threshold.
std::vector< std::vector< int > > vtx_trkIdx
edm::ProductID id() const
const AlgebraicSymMatrix55 & matrix() const
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< short > str_isBarrel
auto dxy(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
void analyze(const edm::Event &, const edm::EventSetup &) override
Structure Point Contains parameters of Gaussian fits to DMRs.
std::vector< int > str_clustSize
const TrackingParticleRefVector & daughterTracks() const
std::vector< float > glu_bbxi
std::vector< int > simhit_particle
std::vector< float > trk_outer_pz
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNLayersToken_
std::vector< unsigned short > ph2_simType
std::vector< std::pair< unsigned int, edm::EDGetTokenT< PixelMaskContainer > > > pixelUseMaskTokens_
std::vector< float > sim_pca_eta
void push_back(const RefToBase< T > &)
std::vector< float > ph2_yz
std::vector< unsigned short > string
Point getBestVertex(reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
std::vector< int > glu_clustSizeMono
static int pixelToChannel(int row, int col)
ParametersDefinerForTP parametersDefiner_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< unsigned short > rod
static TrackAlgorithm algoByName(const std::string &name)
double y0() const
y coordinate
std::vector< float > simhit_y
std::vector< float > trk_dxyClosestPV
int numberOfValidPixelHits() const
std::vector< float > see_stateTrajGlbPx
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
std::vector< std::vector< int > > str_simHitIdx
std::vector< float > see_statePt
std::vector< float > trk_ndof
size_type size() const
Size of the RefVector.
std::vector< float > glu_xx
Monte Carlo truth information used for tracking validation.
const bool keepEleSimHits_
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNPixelLayersToken_
std::vector< unsigned int > trk_nPixelLay
unsigned int tecPetalNumber(const DetId &id) const
std::vector< float > see_stateTrajGlbZ
std::vector< float > simhit_x
const Point & position() const
position
std::vector< float > simvtx_y
std::vector< unsigned short > see_nCands
std::vector< std::vector< int > > simvtx_daughterSimIdx
std::vector< float > str_xx
#define declareDynArray(T, n, x)
std::vector< float > trk_bestSimTrkShareFrac
void fillStripMatchedHits(const edm::Event &iEvent, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, std::vector< std::pair< int, int >> &monoStereoClusterList)
std::vector< float > simhit_py
std::vector< unsigned int > see_offset
DetId geographicalId() const
std::vector< float > ph2_zz
void book(const std::string &prefix, TTree *tree)
bool isRPhi(const DetId &id) const
std::vector< int > see_trkIdx
unsigned int tobRod(const DetId &id) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
math::XYZVectorD Vector
point in the space
std::vector< unsigned short > side
std::vector< float > simhit_tof
std::vector< std::vector< int > > sim_seedIdx
void fillVertices(const reco::VertexCollection &vertices, const edm::RefToBaseVector< reco::Track > &tracks)
std::vector< float > see_stateTrajGlbPy
std::vector< float > pix_xy
std::vector< unsigned short > subdet
std::vector< float > trk_dxy
RecoGenParticleTrail const & recoGenParticleTrail() const
Return all reco::GenParticle in the history.
void book(const std::string &prefix, TTree *tree)
std::vector< float > sim_pt
std::vector< float > pix_yy
double trackAssociationChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const reco::TrackBase::ParameterVector &sParameters)
basic method where chi2 is computed
static constexpr auto TID
std::vector< decltype(reco::TrackBase().algoMaskUL())> trk_algoMask
std::vector< std::vector< int > > see_hitIdx
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > ttrhToken_
ParameterDescriptionBase * addVPSetUntracked(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void set(size_t index, const TrackerTopology &tTopo, const DetId &id)
std::vector< float > vtx_x
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< float > simhit_pz
std::vector< unsigned int > see_nPixel
tuple size
Write out results.
edm::Ref< TrackingParticleCollection > TrackingParticleRef
std::vector< unsigned short > petalNumber
std::vector< float > see_eta
unsigned int pxfPanel(const DetId &id) const
DetIdAllPhase2 simhit_detId_phase2
std::vector< unsigned int > trk_nValid
unsigned int pxfBlade(const DetId &id) const
std::vector< unsigned int > trk_nLost
std::vector< float > trk_inner_px
double yError() const
error on y
std::vector< float > vtx_zErr
unsigned int operator[](size_t i) const
std::vector< float > simhit_eloss
std::vector< float > see_bestFromFirstHitSimTrkShareFrac
void set(size_t index, const TrackerTopology &tTopo, const DetId &id)
std::vector< int > sim_isFromBHadron
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripSimLinkToken_
uint16_t *__restrict__ uint16_t const *__restrict__ adc
std::vector< int > pix_clustSizeRow
std::vector< float > vtx_chi2
std::vector< int > simvtx_bunchCrossing
std::vector< float > str_bbxi
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
std::vector< float > see_dz
unsigned int tibOrder(const DetId &id) const
const LorentzVector & position() const
constexpr Detector det() const
get the detector field from this detid
double x0() const
x coordinate
std::vector< unsigned int > sim_nStrip
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
void set(size_t index, const TrackerTopology &tTopo, const DetId &id)