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;
127 default:
return "UNKNOWN TRACKER HIT TYPE";
131 struct ProductIDSetPrinter {
132 ProductIDSetPrinter(
const std::set<edm::ProductID>&
set): set_(set) {}
134 void print(std::ostream& os)
const {
135 for(
const auto& item: set_) {
140 const std::set<edm::ProductID>& set_;
142 std::ostream&
operator<<(std::ostream& os,
const ProductIDSetPrinter&
o) {
146 template <
typename T>
147 struct ProductIDMapPrinter {
148 ProductIDMapPrinter(
const std::map<edm::ProductID, T>&
map):
map_(map) {}
150 void print(std::ostream& os)
const {
151 for(
const auto& item:
map_) {
152 os << item.first <<
" ";
156 const std::map<edm::ProductID, T>&
map_;
158 template <
typename T>
159 auto make_ProductIDMapPrinter(
const std::map<edm::ProductID, T>&
map) {
160 return ProductIDMapPrinter<T>(
map);
162 template <
typename T>
163 std::ostream& operator<<(std::ostream& os, const ProductIDMapPrinter<T>&
o) {
168 template <
typename T>
169 struct VectorPrinter {
170 VectorPrinter(
const std::vector<T>& vec): vec_(vec) {}
172 void print(std::ostream& os)
const {
173 for(
const auto& item: vec_) {
178 const std::vector<T>& vec_;
180 template <
typename T>
181 auto make_VectorPrinter(
const std::vector<T>& vec) {
182 return VectorPrinter<T>(vec);
184 template <
typename T>
185 std::ostream& operator<<(std::ostream& os, const VectorPrinter<T>&
o) {
190 void checkProductID(
const std::set<edm::ProductID>&
set,
const edm::ProductID&
id,
const char *
name) {
192 throw cms::Exception(
"Configuration") <<
"Got " << name <<
" with a hit with ProductID " <<
id 193 <<
" which does not match to the set of ProductID's for the hits: " 194 << ProductIDSetPrinter(
set)
195 <<
". Usually this is caused by a wrong hit collection in the configuration.";
198 template <
typename SimLink,
typename Func>
200 for(
const auto& link: digiSimLinks) {
201 if(link.channel() == channel) {
209 template <
typename ...Args>
void call_nop(Args&&...
args) {}
211 template <
typename ...Types>
219 return std::get<0>(content_)[i];
222 template <
typename ...Args>
223 void book(Args&&...
args) {
224 impl([&](
auto& vec) { vec.book(std::forward<Args>(
args)...); });
227 template <
typename ...Args>
228 void push_back(Args&&...
args) {
229 impl([&](
auto& vec) { vec.push_back(std::forward<Args>(
args)...); });
232 template <
typename ...Args>
233 void resize(Args&&...
args) {
234 impl([&](
auto& vec) { vec.resize(std::forward<Args>(
args)...); });
237 template <
typename ...Args>
238 void set(Args&&...
args) {
239 impl([&](
auto& vec) { vec.set(std::forward<Args>(
args)...); });
243 impl([&](
auto& vec) { vec.clear(); });
248 template <
typename F>
249 void impl(
F&& func) {
250 impl2(std::index_sequence_for<Types...>{}, std::forward<F>(
func));
258 template <std::size_t ...Is,
typename F>
259 void impl2(std::index_sequence<Is...>,
F&& func) {
260 call_nop( (
func(std::get<Is>(content_)) , 0)...);
263 std::tuple<
Types...> content_;
267 std::map<unsigned int, double> chargeFraction(
const SiPixelCluster& cluster,
const DetId& detId,
269 std::map<unsigned int, double> simTrackIdToAdc;
271 auto idetset = digiSimLink.
find(detId);
272 if(idetset == digiSimLink.
end())
273 return simTrackIdToAdc;
277 for(
int iPix=0; iPix != cluster.
size(); ++iPix) {
281 forEachMatchedSimLink(*idetset, channel, [&](
const PixelDigiSimLink& simLink){
287 for(
auto& pair: simTrackIdToAdc) {
291 pair.second /= adcSum;
294 return simTrackIdToAdc;
297 std::map<unsigned int, double> chargeFraction(
const SiStripCluster& cluster,
const DetId& detId,
299 std::map<unsigned int, double> simTrackIdToAdc;
301 auto idetset = digiSimLink.
find(detId);
302 if(idetset == digiSimLink.
end())
303 return simTrackIdToAdc;
311 double& adc = simTrackIdToAdc[simLink.
SimTrackId()];
315 for(
const auto& pair: simTrackIdToAdc) {
316 simTrackIdToAdc[pair.first] = (adcSum != 0. ? pair.second/adcSum : 0.);
320 return simTrackIdToAdc;
326 std::map<unsigned int, double> simTrackIdToAdc;
327 throw cms::Exception(
"LogicError") <<
"Not possible to use StripDigiSimLink with Phase2TrackerCluster1D! ";
328 return simTrackIdToAdc;
335 std::map<unsigned int, double> simTrackIdToAdc;
336 return simTrackIdToAdc;
339 struct TrackTPMatch {
341 int countClusters = 0;
346 const TrackingParticleRefKeyToIndex& tpKeyToIndex) {
354 std::unordered_map<int, Count>
count;
355 for(
size_t iCluster=0,
end=clusters.size(); iCluster<
end; ++iCluster) {
356 const auto& clusterRef = clusters[iCluster];
358 auto range = clusterToTPMap.
equal_range(clusterRef);
359 for(
auto ip=range.first; ip != range.second; ++ip) {
360 const auto tpKey = ip->second.key();
361 if(tpKeyToIndex.find(tpKey) == tpKeyToIndex.end())
364 auto&
elem = count[tpKey];
375 for(
auto& keyCount: count) {
376 if(keyCount.second.clusters > bestCount ||
377 (keyCount.second.clusters == bestCount && keyCount.second.innermostHit < bestInnermostHit)) {
378 best.key = keyCount.first;
379 best.countClusters = bestCount = keyCount.second.clusters;
380 bestInnermostHit = keyCount.second.innermostHit;
384 LogTrace(
"TrackingNtuple") <<
"findBestMatchingTrackingParticle key " << best.key;
389 TrackTPMatch findMatchingTrackingParticleFromFirstHit(
const reco::Track& track,
391 const TrackingParticleRefKeyToIndex& tpKeyToIndex) {
395 if(clusters.empty()) {
399 auto operateCluster = [&](
const auto& clusterRef,
const auto&
func) {
400 auto range = clusterToTPMap.
equal_range(clusterRef);
401 for(
auto ip=range.first; ip != range.second; ++ip) {
402 const auto tpKey = ip->second.key();
403 if(tpKeyToIndex.find(tpKey) == tpKeyToIndex.end())
409 std::vector<unsigned int> validTPs;
410 auto iCluster = clusters.begin();
411 operateCluster(*iCluster, [&](
unsigned int tpKey) {
412 validTPs.push_back(tpKey);
414 if(validTPs.empty()) {
418 ++best.countClusters;
420 std::vector<bool> foundTPs(validTPs.size(),
false);
421 for(
auto iEnd=clusters.end(); iCluster != iEnd; ++iCluster) {
422 const auto& clusterRef = *iCluster;
425 operateCluster(clusterRef, [&](
unsigned int tpKey) {
426 auto found =
std::find(cbegin(validTPs), cend(validTPs), tpKey);
427 if(found != cend(validTPs)) {
434 auto iTP = validTPs.size();
439 validTPs.erase(validTPs.begin()+iTP);
440 foundTPs.erase(foundTPs.begin()+iTP);
443 if(!validTPs.empty()) {
447 best.key = validTPs[0];
454 ++best.countClusters;
458 return best.countClusters >= 3 ? best : TrackTPMatch();
477 void clearVariables();
524 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
529 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
530 std::set<edm::ProductID>& hitProductIds
533 void fillStripRphiStereoHits(
const edm::Event& iEvent,
535 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
540 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
541 std::set<edm::ProductID>& hitProductIds
544 void fillStripMatchedHits(
const edm::Event& iEvent,
547 std::vector<std::pair<int, int> >& monoStereoClusterList
553 std::vector<std::pair<int, int> >& monoStereoClusterList
556 void fillPhase2OTHits(
const edm::Event& iEvent,
558 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
563 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
564 std::set<edm::ProductID>& hitProductIds
569 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
576 std::vector<std::pair<int, int> >& monoStereoClusterList,
577 const std::set<edm::ProductID>& hitProductIds,
578 std::map<edm::ProductID, size_t>& seedToCollIndex
583 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
584 const TrackingParticleRefKeyToCount& tpKeyToClusterCount,
592 const std::set<edm::ProductID>& hitProductIds,
593 const std::map<edm::ProductID, size_t>& seedToCollIndex,
594 const std::vector<const MVACollection *>& mvaColls,
595 const std::vector<const QualityMaskCollection *>& qualColls
599 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
602 SimHitRefKeyToIndex& simHitRefKeyToIndex,
603 std::vector<TPHitIndex>& tpHitList);
609 const TrackingVertexRefKeyToIndex& tvKeyToIndex,
611 const std::vector<TPHitIndex>& tpHitList,
612 const TrackingParticleRefKeyToCount& tpKeyToClusterCount
617 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
618 const unsigned int seedOffset
625 const TrackingParticleRefKeyToIndex& tpKeyToIndex
638 template <
typename SimLink>
640 DetId hitId,
int clusterKey,
643 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
646 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
651 std::vector<edm::EDGetTokenT<edm::View<reco::Track> > >
seedTokens_;
687 #define BOOK(name) tree->Branch((prefix+"_"+#name).c_str(), &name); 705 detId .push_back(
id.rawId() );
706 subdet.push_back(
id.subdetId() );
707 layer .push_back(tTopo.
layer(
id) );
710 unsigned short s = 0;
711 switch(
id.subdetId()) {
734 subdet[
index] =
id.subdetId();
735 layer [
index] = tTopo.layer(
id);
736 side [
index] = tTopo.side(
id);
752 std::vector<unsigned short>
side;
769 blade .push_back( isBarrel ? 0 : tTopo.
pxfBlade(
id) );
770 panel .push_back( isBarrel ? 0 : tTopo.
pxfPanel(
id) );
796 const auto parsed =
parse(tTopo,
id);
797 order .push_back(parsed.order );
798 ring .push_back(parsed.ring );
799 rod .push_back(parsed.rod );
809 const auto parsed =
parse(tTopo,
id);
810 order [
index] = parsed.order ;
812 rod [
index] = parsed.rod ;
825 unsigned int order = 0;
827 unsigned int rod = 0;
830 switch(
id.subdetId()) {
845 std::vector<unsigned short>
ring;
846 std::vector<unsigned short>
rod;
862 const auto parsed =
parse(tTopo,
id);
863 string .push_back(parsed.string );
864 petalNumber.push_back(parsed.petalNumber);
865 isStereo .push_back(tTopo.
isStereo(
id));
866 isRPhi .push_back(tTopo.
isRPhi(
id));
867 isGlued .push_back(parsed.glued);
871 string .resize(size);
872 petalNumber.resize(size);
873 isStereo .resize(size);
874 isRPhi .resize(size);
875 isGlued .resize(size);
879 const auto parsed =
parse(tTopo,
id);
880 string [
index] = parsed.string ;
881 petalNumber[
index] = parsed.petalNumber;
882 isStereo [
index] = tTopo.isStereo(
id);
883 isRPhi [
index] = tTopo.isRPhi(
id);
884 isGlued [
index] = parsed.glued;
899 unsigned int string = 0;
900 unsigned int petalNumber = 0;
904 switch(
id.subdetId()) {
936 isLower.push_back(tTopo.
isLower(
id));
937 isUpper.push_back(tTopo.
isUpper(
id));
938 isStack.push_back(tTopo.
stack(
id) == 0);
954 using DetIdPixel = CombineDetId<DetIdCommon, DetIdPixelOnly>;
955 using DetIdStrip = CombineDetId<DetIdCommon, DetIdOTCommon, DetIdStripOnly>;
956 using DetIdPhase2OT = CombineDetId<DetIdCommon, DetIdOTCommon, DetIdPhase2OTOnly>;
957 using DetIdAll = CombineDetId<DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdStripOnly>;
958 using DetIdAllPhase2 = CombineDetId<DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdPhase2OTOnly>;
1277 trackToken_(consumes<
edm::
View<
reco::Track> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"tracks"))),
1278 clusterTPMapToken_(consumes<
ClusterTPAssociation>(iConfig.getUntrackedParameter<
edm::InputTag>(
"clusterTPMap"))),
1281 pixelSimLinkToken_(consumes<
edm::DetSetVector<
PixelDigiSimLink> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"pixelDigiSimLink"))),
1282 stripSimLinkToken_(consumes<
edm::DetSetVector<
StripDigiSimLink> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"stripDigiSimLink"))),
1283 siphase2OTSimLinksToken_(consumes<
edm::DetSetVector<
PixelDigiSimLink> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"phase2OTSimLink"))),
1284 includeStripHits_(iConfig.getUntrackedParameter<
edm::InputTag>(
"stripDigiSimLink").
label() !=
""),
1285 includePhase2OTHits_(iConfig.getUntrackedParameter<
edm::InputTag>(
"phase2OTSimLink").
label() !=
""),
1286 beamSpotToken_(consumes<
reco::
BeamSpot>(iConfig.getUntrackedParameter<
edm::InputTag>(
"beamSpot"))),
1294 tpNLayersToken_(consumes<
edm::ValueMap<unsigned
int> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"trackingParticleNlayers"))),
1295 tpNPixelLayersToken_(consumes<
edm::ValueMap<unsigned
int> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"trackingParticleNpixellayers"))),
1296 tpNStripStereoLayersToken_(consumes<
edm::ValueMap<unsigned
int> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"trackingParticleNstripstereolayers"))),
1297 builderName_(iConfig.getUntrackedParameter<
std::
string>(
"TTRHBuilder")),
1298 parametersDefinerName_(iConfig.getUntrackedParameter<
std::
string>(
"parametersDefiner")),
1299 includeSeeds_(iConfig.getUntrackedParameter<
bool>(
"includeSeeds")),
1300 includeAllHits_(iConfig.getUntrackedParameter<
bool>(
"includeAllHits")),
1301 includeMVA_(iConfig.getUntrackedParameter<
bool>(
"includeMVA")),
1302 includeTrackingParticles_(iConfig.getUntrackedParameter<
bool>(
"includeTrackingParticles"))
1306 return consumes<edm::View<reco::Track> >(tag);
1309 return consumes<std::vector<SeedStopInfo> >(tag);
1311 if(seedTokens_.size() != seedStopInfoTokens_.size()) {
1312 throw cms::Exception(
"Configuration") <<
"Got " << seedTokens_.size() <<
" seed collections, but " << seedStopInfoTokens_.size() <<
" track candidate collections";
1316 if(includeAllHits_) {
1317 if(includeStripHits_ && includePhase2OTHits_) {
1318 throw cms::Exception(
"Configuration") <<
"Both stripDigiSimLink and phase2OTSimLink are set, please set only either one (this information is used to infer if you're running phase0/1 or phase2 detector)";
1320 if(!includeStripHits_ && !includePhase2OTHits_) {
1321 throw cms::Exception(
"Configuration") <<
"Neither stripDigiSimLink or phase2OTSimLink are set, please set either one.";
1328 trackingParticleRefToken_ = consumes<TrackingParticleRefVector>(
tpTag);
1331 trackingParticleToken_ = consumes<TrackingParticleCollection>(
tpTag);
1339 return std::make_tuple(consumes<MVACollection>(edm::InputTag(tag,
"MVAValues")),
1340 consumes<QualityMaskCollection>(edm::InputTag(tag,
"QualityMasks")));
1346 t = fs->
make<TTree>(
"tree",
"tree");
1348 t->Branch(
"event" , &ev_event);
1349 t->Branch(
"lumi" , &ev_lumi);
1350 t->Branch(
"run" , &ev_run);
1353 t->Branch(
"trk_px" , &trk_px);
1354 t->Branch(
"trk_py" , &trk_py);
1355 t->Branch(
"trk_pz" , &trk_pz);
1356 t->Branch(
"trk_pt" , &trk_pt);
1357 t->Branch(
"trk_inner_px" , &trk_inner_px);
1358 t->Branch(
"trk_inner_py" , &trk_inner_py);
1359 t->Branch(
"trk_inner_pz" , &trk_inner_pz);
1360 t->Branch(
"trk_inner_pt" , &trk_inner_pt);
1361 t->Branch(
"trk_outer_px" , &trk_outer_px);
1362 t->Branch(
"trk_outer_py" , &trk_outer_py);
1363 t->Branch(
"trk_outer_pz" , &trk_outer_pz);
1364 t->Branch(
"trk_outer_pt" , &trk_outer_pt);
1365 t->Branch(
"trk_eta" , &trk_eta);
1366 t->Branch(
"trk_lambda" , &trk_lambda);
1367 t->Branch(
"trk_cotTheta" , &trk_cotTheta);
1368 t->Branch(
"trk_phi" , &trk_phi);
1369 t->Branch(
"trk_dxy" , &trk_dxy );
1370 t->Branch(
"trk_dz" , &trk_dz );
1371 t->Branch(
"trk_dxyPV" , &trk_dxyPV );
1372 t->Branch(
"trk_dzPV" , &trk_dzPV );
1373 t->Branch(
"trk_dxyClosestPV", &trk_dxyClosestPV );
1374 t->Branch(
"trk_dzClosestPV", &trk_dzClosestPV );
1375 t->Branch(
"trk_ptErr" , &trk_ptErr );
1376 t->Branch(
"trk_etaErr" , &trk_etaErr );
1377 t->Branch(
"trk_lambdaErr", &trk_lambdaErr);
1378 t->Branch(
"trk_phiErr" , &trk_phiErr );
1379 t->Branch(
"trk_dxyErr" , &trk_dxyErr );
1380 t->Branch(
"trk_dzErr" , &trk_dzErr );
1381 t->Branch(
"trk_refpoint_x", &trk_refpoint_x);
1382 t->Branch(
"trk_refpoint_y", &trk_refpoint_y);
1383 t->Branch(
"trk_refpoint_z", &trk_refpoint_z);
1384 t->Branch(
"trk_nChi2" , &trk_nChi2);
1385 t->Branch(
"trk_nChi2_1Dmod", &trk_nChi2_1Dmod);
1386 t->Branch(
"trk_ndof" , &trk_ndof);
1388 trk_mvas.resize(mvaQualityCollectionTokens_.size());
1389 trk_qualityMasks.resize(mvaQualityCollectionTokens_.size());
1390 if(!trk_mvas.empty()) {
1391 t->Branch(
"trk_mva" , &(trk_mvas[0]));
1392 t->Branch(
"trk_qualityMask", &(trk_qualityMasks[0]));
1393 for(
size_t i=1;
i<trk_mvas.size(); ++
i) {
1394 t->Branch((
"trk_mva"+std::to_string(
i+1)).c_str(), &(trk_mvas[
i]));
1395 t->Branch((
"trk_qualityMask"+std::to_string(i+1)).c_str(), &(trk_qualityMasks[i]));
1399 t->Branch(
"trk_q" , &trk_q);
1400 t->Branch(
"trk_nValid" , &trk_nValid );
1401 t->Branch(
"trk_nLost" , &trk_nLost);
1402 t->Branch(
"trk_nInactive", &trk_nInactive);
1403 t->Branch(
"trk_nPixel" , &trk_nPixel );
1404 t->Branch(
"trk_nStrip" , &trk_nStrip );
1405 t->Branch(
"trk_nOuterLost", &trk_nOuterLost);
1406 t->Branch(
"trk_nInnerLost", &trk_nInnerLost);
1407 t->Branch(
"trk_nOuterInactive", &trk_nOuterInactive);
1408 t->Branch(
"trk_nInnerInactive", &trk_nInnerInactive);
1409 t->Branch(
"trk_nPixelLay", &trk_nPixelLay);
1410 t->Branch(
"trk_nStripLay", &trk_nStripLay);
1411 t->Branch(
"trk_n3DLay" , &trk_n3DLay );
1412 t->Branch(
"trk_nLostLay" , &trk_nLostLay );
1413 t->Branch(
"trk_nCluster" , &trk_nCluster);
1414 t->Branch(
"trk_algo" , &trk_algo );
1415 t->Branch(
"trk_originalAlgo", &trk_originalAlgo);
1418 t->Branch(
"trk_isHP" , &
trk_isHP );
1423 if(includeTrackingParticles_) {
1441 if(includeAllHits_) {
1445 if(includeTrackingParticles_) {
1452 t->Branch(
"sim_px" , &
sim_px );
1453 t->Branch(
"sim_py" , &
sim_py );
1454 t->Branch(
"sim_pz" , &
sim_pz );
1455 t->Branch(
"sim_pt" , &
sim_pt );
1456 t->Branch(
"sim_eta" , &
sim_eta );
1457 t->Branch(
"sim_phi" , &
sim_phi );
1465 t->Branch(
"sim_q" , &
sim_q );
1469 t->Branch(
"sim_nLay" , &
sim_nLay );
1481 if(includeAllHits_) {
1485 if(includeAllHits_) {
1493 if(includeTrackingParticles_) {
1498 t->Branch(
"pix_x" , &
pix_x );
1499 t->Branch(
"pix_y" , &
pix_y );
1500 t->Branch(
"pix_z" , &
pix_z );
1501 t->Branch(
"pix_xx" , &
pix_xx );
1502 t->Branch(
"pix_xy" , &
pix_xy );
1503 t->Branch(
"pix_yy" , &
pix_yy );
1504 t->Branch(
"pix_yz" , &
pix_yz );
1505 t->Branch(
"pix_zz" , &
pix_zz );
1506 t->Branch(
"pix_zx" , &
pix_zx );
1507 t->Branch(
"pix_radL" , &
pix_radL );
1508 t->Branch(
"pix_bbxi" , &
pix_bbxi );
1509 t->Branch(
"pix_bbxi" , &
pix_bbxi );
1511 if(includeStripHits_){
1518 if(includeTrackingParticles_) {
1523 t->Branch(
"str_x" , &
str_x );
1524 t->Branch(
"str_y" , &
str_y );
1525 t->Branch(
"str_z" , &
str_z );
1526 t->Branch(
"str_xx" , &
str_xx );
1527 t->Branch(
"str_xy" , &
str_xy );
1528 t->Branch(
"str_yy" , &
str_yy );
1529 t->Branch(
"str_yz" , &
str_yz );
1530 t->Branch(
"str_zz" , &
str_zz );
1531 t->Branch(
"str_zx" , &
str_zx );
1532 t->Branch(
"str_radL" , &
str_radL );
1533 t->Branch(
"str_bbxi" , &
str_bbxi );
1542 t->Branch(
"glu_x" , &
glu_x );
1543 t->Branch(
"glu_y" , &
glu_y );
1544 t->Branch(
"glu_z" , &
glu_z );
1545 t->Branch(
"glu_xx" , &
glu_xx );
1546 t->Branch(
"glu_xy" , &
glu_xy );
1547 t->Branch(
"glu_yy" , &
glu_yy );
1548 t->Branch(
"glu_yz" , &
glu_yz );
1549 t->Branch(
"glu_zz" , &
glu_zz );
1550 t->Branch(
"glu_zx" , &
glu_zx );
1551 t->Branch(
"glu_radL" , &
glu_radL );
1552 t->Branch(
"glu_bbxi" , &
glu_bbxi );
1555 if(includePhase2OTHits_){
1562 if(includeTrackingParticles_) {
1566 t->Branch(
"ph2_x" , &
ph2_x );
1567 t->Branch(
"ph2_y" , &
ph2_y );
1568 t->Branch(
"ph2_z" , &
ph2_z );
1569 t->Branch(
"ph2_xx" , &
ph2_xx );
1570 t->Branch(
"ph2_xy" , &
ph2_xy );
1571 t->Branch(
"ph2_yy" , &
ph2_yy );
1572 t->Branch(
"ph2_yz" , &
ph2_yz );
1573 t->Branch(
"ph2_zz" , &
ph2_zz );
1574 t->Branch(
"ph2_zx" , &
ph2_zx );
1575 t->Branch(
"ph2_radL" , &
ph2_radL );
1576 t->Branch(
"ph2_bbxi" , &
ph2_bbxi );
1577 t->Branch(
"ph2_bbxi" , &
ph2_bbxi );
1581 if(includeStripHits_)
inv_detId.book(
"inv", t);
1583 t->Branch(
"inv_type" , &
inv_type );
1585 if(includeTrackingParticles_) {
1601 t->Branch(
"bsp_x" , &
bsp_x ,
"bsp_x/F");
1602 t->Branch(
"bsp_y" , &
bsp_y ,
"bsp_y/F");
1603 t->Branch(
"bsp_z" , &
bsp_z ,
"bsp_z/F");
1604 t->Branch(
"bsp_sigmax" , &
bsp_sigmax ,
"bsp_sigmax/F");
1605 t->Branch(
"bsp_sigmay" , &
bsp_sigmay ,
"bsp_sigmay/F");
1606 t->Branch(
"bsp_sigmaz" , &
bsp_sigmaz ,
"bsp_sigmaz/F");
1610 t->Branch(
"see_px" , &
see_px );
1611 t->Branch(
"see_py" , &
see_py );
1612 t->Branch(
"see_pz" , &
see_pz );
1613 t->Branch(
"see_pt" , &
see_pt );
1614 t->Branch(
"see_eta" , &
see_eta );
1615 t->Branch(
"see_phi" , &
see_phi );
1616 t->Branch(
"see_dxy" , &
see_dxy );
1617 t->Branch(
"see_dz" , &
see_dz );
1623 t->Branch(
"see_chi2" , &
see_chi2 );
1630 t->Branch(
"see_q" , &
see_q );
1637 t->Branch(
"see_algo" , &
see_algo );
1641 if(includeTrackingParticles_) {
1652 if(includeAllHits_) {
1661 t->Branch(
"vtx_x" , &
vtx_x);
1662 t->Branch(
"vtx_y" , &
vtx_y);
1663 t->Branch(
"vtx_z" , &
vtx_z);
1709 trk_inner_px .clear();
1710 trk_inner_py .clear();
1711 trk_inner_pz .clear();
1712 trk_inner_pt .clear();
1713 trk_outer_px .clear();
1714 trk_outer_py .clear();
1715 trk_outer_pz .clear();
1716 trk_outer_pt .clear();
1718 trk_lambda .clear();
1719 trk_cotTheta .clear();
1725 trk_dxyClosestPV.clear();
1726 trk_dzClosestPV.clear();
1728 trk_etaErr .clear();
1729 trk_lambdaErr.clear();
1730 trk_phiErr .clear();
1731 trk_dxyErr .clear();
1733 trk_refpoint_x.clear();
1734 trk_refpoint_y.clear();
1735 trk_refpoint_z.clear();
1737 trk_nChi2_1Dmod.clear();
1739 for(
auto&
mva: trk_mvas) {
1742 for(
auto&
mask: trk_qualityMasks) {
1746 trk_nValid .clear();
1748 trk_nInactive.clear();
1749 trk_nPixel .clear();
1750 trk_nStrip .clear();
1751 trk_nOuterLost.clear();
1752 trk_nInnerLost.clear();
1753 trk_nOuterInactive.clear();
1754 trk_nInnerInactive.clear();
1755 trk_nPixelLay.clear();
1756 trk_nStripLay.clear();
1757 trk_n3DLay .clear();
1758 trk_nLostLay .clear();
1759 trk_nCluster .clear();
1761 trk_originalAlgo.clear();
1988 using namespace edm;
1989 using namespace reco;
1990 using namespace std;
1994 const auto& mf = *mfHandle;
2008 iEvent.
getByToken(trackAssociatorToken_, theAssociator);
2011 LogDebug(
"TrackingNtuple") <<
"Analyzing new event";
2025 iEvent.
getByToken(trackingParticleToken_, TPCollectionH);
2026 for(
size_t i=0,
size=TPCollectionH->size();
i<
size; ++
i) {
2032 iEvent.
getByToken(trackingParticleRefToken_, TPCollectionHRefVector);
2033 tmpTPptr = TPCollectionHRefVector.
product();
2038 TrackingParticleRefKeyToIndex tpKeyToIndex;
2039 for(
size_t i=0;
i<tpCollection.
size(); ++
i) {
2040 tpKeyToIndex[tpCollection[
i].key()] =
i;
2045 iEvent.
getByToken(trackingVertexToken_, htv);
2050 TrackingVertexRefKeyToIndex tvKeyToIndex;
2051 for(
size_t i=0;
i<tvs.size(); ++
i) {
2055 tvKeyToIndex[
i] = tvRefs.
size();
2061 iEvent.
getByToken(clusterTPMapToken_, pCluster2TPListH);
2064 iEvent.
getByToken(simHitTPMapToken_, simHitsTPAssoc);
2067 TrackingParticleRefKeyToCount tpKeyToClusterCount;
2068 for(
const auto& clusterTP: clusterToTPMap) {
2069 tpKeyToClusterCount[clusterTP.second.key()] += 1;
2073 SimHitRefKeyToIndex simHitRefKeyToIndex;
2076 std::vector<TPHitIndex> tpHitList;
2080 std::set<edm::ProductID> hitProductIds;
2081 std::map<edm::ProductID, size_t> seedCollToOffset;
2083 ev_run = iEvent.
id().
run();
2085 ev_event = iEvent.
id().
event();
2089 iEvent.
getByToken(pixelSimLinkToken_, pixelDigiSimLinksHandle);
2090 const auto& pixelDigiSimLinks = *pixelDigiSimLinksHandle;
2093 iEvent.
getByToken(stripSimLinkToken_, stripDigiSimLinksHandle);
2097 iEvent.
getByToken(siphase2OTSimLinksToken_, siphase2OTSimLinksHandle);
2101 iEvent.
getByToken(beamSpotToken_, recoBeamSpotHandle);
2102 BeamSpot const & bs = *recoBeamSpotHandle;
2107 vector<pair<int,int> > monoStereoClusterList;
2108 if(includeAllHits_) {
2110 if(includeTrackingParticles_) {
2111 fillSimHits(tracker, tpKeyToIndex, *simHitsTPAssoc, tTopo, simHitRefKeyToIndex, tpHitList);
2115 fillPixelHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, pixelDigiSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
2118 if(includeStripHits_){
2119 LogDebug(
"TrackingNtuple") <<
"foundStripSimLink" ;
2120 const auto& stripDigiSimLinks = *stripDigiSimLinksHandle;
2121 fillStripRphiStereoHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, stripDigiSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
2127 if(includePhase2OTHits_){
2128 LogDebug(
"TrackingNtuple") <<
"foundPhase2OTSimLinks" ;
2129 const auto& phase2OTSimLinks = *siphase2OTSimLinksHandle;
2130 fillPhase2OTHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, phase2OTSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
2136 fillSeeds(iEvent, tpCollection, tpKeyToIndex, bs, associatorByHits, clusterToTPMap, *theTTRHBuilder, mf, tTopo, monoStereoClusterList, hitProductIds, seedCollToOffset);
2141 iEvent.
getByToken(trackToken_, tracksHandle);
2148 std::vector<const MVACollection *> mvaColls;
2149 std::vector<const QualityMaskCollection *> qualColls;
2154 for(
const auto& tokenTpl: mvaQualityCollectionTokens_) {
2155 iEvent.
getByToken(std::get<0>(tokenTpl), hmva);
2156 iEvent.
getByToken(std::get<1>(tokenTpl), hqual);
2158 mvaColls.push_back(hmva.
product());
2159 qualColls.push_back(hqual.
product());
2160 if(mvaColls.back()->size() != tracks.
size()) {
2161 throw cms::Exception(
"Configuration") <<
"Inconsistency in track collection and MVA sizes. Track collection has " << tracks.
size() <<
" tracks, whereas the MVA " << (mvaColls.size()-1) <<
" has " << mvaColls.back()->size() <<
" entries. Double-check your configuration.";
2163 if(qualColls.back()->size() != tracks.
size()) {
2164 throw cms::Exception(
"Configuration") <<
"Inconsistency in track collection and quality mask sizes. Track collection has " << tracks.
size() <<
" tracks, whereas the quality mask " << (qualColls.size()-1) <<
" has " << qualColls.back()->size() <<
" entries. Double-check your configuration.";
2172 fillTracks(trackRefs, tpCollection, tpKeyToIndex, tpKeyToClusterCount, mf, bs, *vertices, associatorByHits, clusterToTPMap, *theTTRHBuilder, tTopo, hitProductIds, seedCollToOffset, mvaColls, qualColls);
2177 fillTrackingParticles(iEvent, iSetup, trackRefs, bs, tpCollection, tvKeyToIndex, associatorByHits, tpHitList, tpKeyToClusterCount);
2199 template <
typename SimLink>
struct GetCluster;
2201 struct GetCluster<PixelDigiSimLink> {
2205 struct GetCluster<StripDigiSimLink> {
2210 template <
typename SimLink>
2212 DetId hitId,
int clusterKey,
2215 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2218 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2223 std::map<unsigned int, double> simTrackIdToChargeFraction;
2225 else simTrackIdToChargeFraction = chargeFraction(GetCluster<SimLink>::call(cluster), hitId, digiSimLinks);
2228 auto range = clusterToTPMap.
equal_range( cluster );
2229 if( range.first != range.second ) {
2230 for(
auto ip=range.first; ip != range.second; ++ip ) {
2234 const auto event = trackingParticle->eventId().event();
2235 const auto bx = trackingParticle->eventId().bunchCrossing();
2243 auto tpIndex = tpKeyToIndex.find(trackingParticle.
key());
2244 if( tpIndex == tpKeyToIndex.end())
2248 std::pair<TrackingParticleRef, TrackPSimHitRef> simHitTPpairWithDummyTP(trackingParticle,
TrackPSimHitRef());
2250 auto range = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
2252 bool foundSimHit =
false;
2253 bool foundElectron =
false;
2254 for(
auto ip = range.first; ip != range.second; ++ip) {
2259 if(
std::abs(TPhit->particleType()) == 11 &&
std::abs(trackingParticle->pdgId()) != 11) {
2260 foundElectron =
true;
2265 auto simHitKey = TPhit.
key();
2266 auto simHitID = TPhit.
id();
2268 auto simHitIndex = simHitRefKeyToIndex.at(std::make_pair(simHitKey, simHitID));
2271 double chargeFraction = 0.;
2272 for(
const SimTrack& simtrk: trackingParticle->g4Tracks()) {
2273 auto found = simTrackIdToChargeFraction.find(simtrk.trackId());
2274 if(found != simTrackIdToChargeFraction.end()) {
2275 chargeFraction += found->second;
2285 simhit_hitType[simHitIndex].push_back(static_cast<int>(hitType));
2294 auto ex =
cms::Exception(
"LogicError") <<
"Did not find SimHit for reco hit DetId " << hitId.
rawId()
2295 <<
" for TP " << trackingParticle.
key() <<
" bx:event " << bx <<
":" <<
event 2296 <<
".\nFound SimHits from detectors ";
2297 for(
auto ip = range.first; ip != range.second; ++ip) {
2300 ex << dId.
rawId() <<
" ";
2302 if(trackingParticle->eventId().event() != 0) {
2303 ex <<
"\nSince this is a TrackingParticle from pileup, check that you're running the pileup mixing in playback mode.";
2314 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2317 SimHitRefKeyToIndex& simHitRefKeyToIndex,
2318 std::vector<TPHitIndex>& tpHitList) {
2320 for(
const auto&
assoc: simHitsTPAssoc) {
2321 auto tpKey =
assoc.first.key();
2325 auto found = tpKeyToIndex.find(tpKey);
2326 if(found == tpKeyToIndex.end())
2328 const auto tpIndex = found->second;
2331 const auto& simhit = *(
assoc.second);
2332 auto detId =
DetId(simhit.detUnitId());
2342 auto simHitKey = std::make_pair(
assoc.second.key(),
assoc.second.id());
2344 if(simHitRefKeyToIndex.find(simHitKey) != simHitRefKeyToIndex.end()) {
2345 for(
const auto& assoc2: simHitsTPAssoc) {
2346 if(std::make_pair(assoc2.second.key(), assoc2.second.id()) == simHitKey) {
2349 auto range1 = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
2352 auto range2 = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
2356 LogTrace(
"TrackingNtuple") <<
"Earlier TP " << assoc2.first.key() <<
" SimTrack Ids";
2357 for(
const auto&
simTrack: assoc2.first->g4Tracks()) {
2360 for(
auto iHit = range2.first; iHit != range2.second; ++iHit) {
2361 LogTrace(
"TrackingNtuple") <<
" SimHit " << iHit->second.key() <<
" " << iHit->second.id() <<
" tof " << iHit->second->tof() <<
" trackId " << iHit->second->trackId() <<
" BX:event " << iHit->second->eventId().bunchCrossing() <<
":" << iHit->second->eventId().event();
2363 LogTrace(
"TrackingNtuple") <<
"Current TP " <<
assoc.first.key() <<
" SimTrack Ids";
2367 for(
auto iHit = range1.first; iHit != range1.second; ++iHit) {
2368 LogTrace(
"TrackingNtuple") <<
" SimHit " << iHit->second.key() <<
" " << iHit->second.id() <<
" tof " << iHit->second->tof() <<
" trackId " << iHit->second->trackId() <<
" BX:event " << iHit->second->eventId().bunchCrossing() <<
":" << iHit->second->eventId().event();
2372 throw cms::Exception(
"LogicError") <<
"Got second time the SimHit " << simHitKey.first <<
" of " << simHitKey.second <<
", first time with TrackingParticle " << assoc2.first.key() <<
", now with " << tpKey;
2375 throw cms::Exception(
"LogicError") <<
"Got second time the SimHit " << simHitKey.first <<
" of " << simHitKey.second <<
", now with TrackingParticle " << tpKey <<
", but I didn't find the first occurrance!";
2380 throw cms::Exception(
"LogicError") <<
"Did not find a det unit for DetId " << simhit.detUnitId() <<
" from tracker geometry";
2382 const auto pos = det->surface().toGlobal(simhit.localPosition());
2383 const float tof = simhit.timeOfFlight();
2385 const auto simHitIndex =
simhit_x.size();
2386 simHitRefKeyToIndex[simHitKey] = simHitIndex;
2388 if(includeStripHits_)
simhit_detId.push_back(tTopo, detId);
2404 tpHitList.emplace_back(tpKey, simHitIndex, tof, simhit.detUnitId());
2410 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2415 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2416 std::set<edm::ProductID>& hitProductIds
2419 iEvent.
getByToken(pixelRecHitToken_, pixelHits);
2420 for (
auto it = pixelHits->
begin(); it!=pixelHits->
end(); it++ ) {
2421 const DetId hitId = it->detId();
2422 for (
auto hit = it->begin(); hit!=it->end(); hit++ ) {
2425 hitProductIds.insert(hit->cluster().id());
2427 const int key = hit->cluster().key();
2428 const int lay = tTopo.
layer(hitId);
2434 pix_x .push_back( ttrh->globalPosition().x() );
2435 pix_y .push_back( ttrh->globalPosition().y() );
2436 pix_z .push_back( ttrh->globalPosition().z() );
2437 pix_xx .push_back( ttrh->globalPositionError().cxx() );
2438 pix_xy .push_back( ttrh->globalPositionError().cyx() );
2439 pix_yy .push_back( ttrh->globalPositionError().cyy() );
2440 pix_yz .push_back( ttrh->globalPositionError().czy() );
2441 pix_zz .push_back( ttrh->globalPositionError().czz() );
2442 pix_zx .push_back( ttrh->globalPositionError().czx() );
2443 pix_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
2444 pix_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
2446 LogTrace(
"TrackingNtuple") <<
"pixHit cluster=" << key
2449 <<
" rawId=" << hitId.
rawId()
2450 <<
" pos =" << ttrh->globalPosition();
2451 if(includeTrackingParticles_) {
2453 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Pixel);
2460 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
2466 <<
" event=" << simHitData.
event[0];
2476 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2481 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2482 std::set<edm::ProductID>& hitProductIds
2486 iEvent.
getByToken(stripRphiRecHitToken_, rphiHits);
2488 iEvent.
getByToken(stripStereoRecHitToken_, stereoHits);
2497 str_x .resize(totalStripHits);
2498 str_y .resize(totalStripHits);
2499 str_z .resize(totalStripHits);
2500 str_xx .resize(totalStripHits);
2501 str_xy .resize(totalStripHits);
2502 str_yy .resize(totalStripHits);
2503 str_yz .resize(totalStripHits);
2504 str_zz .resize(totalStripHits);
2505 str_zx .resize(totalStripHits);
2510 for(
const auto& detset: hits) {
2511 const DetId hitId = detset.detId();
2512 for(
const auto& hit: detset) {
2515 hitProductIds.insert(hit.cluster().id());
2517 const int key = hit.cluster().key();
2518 const int lay = tTopo.
layer(hitId);
2521 str_x [
key] = ttrh->globalPosition().x();
2522 str_y [
key] = ttrh->globalPosition().y();
2523 str_z [
key] = ttrh->globalPosition().z();
2524 str_xx [
key] = ttrh->globalPositionError().cxx();
2525 str_xy [
key] = ttrh->globalPositionError().cyx();
2526 str_yy [
key] = ttrh->globalPositionError().cyy();
2527 str_yz [
key] = ttrh->globalPositionError().czy();
2528 str_zz [
key] = ttrh->globalPositionError().czz();
2529 str_zx [
key] = ttrh->globalPositionError().czx();
2530 str_radL [
key] = ttrh->surface()->mediumProperties().radLen();
2531 str_bbxi [
key] = ttrh->surface()->mediumProperties().xi();
2532 LogTrace(
"TrackingNtuple") << name <<
" cluster=" << key
2535 <<
" rawId=" << hitId.
rawId()
2536 <<
" pos =" << ttrh->globalPosition();
2538 if(includeTrackingParticles_) {
2540 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Strip);
2547 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
2554 <<
" event=" << simHitData.
event[0];
2561 fill(*rphiHits,
"stripRPhiHit");
2562 fill(*stereoHits,
"stripStereoHit");
2569 std::vector<std::pair<int, int> >& monoStereoClusterList
2573 const int lay = tTopo.
layer(hitId);
2580 glu_x .push_back( ttrh->globalPosition().x() );
2581 glu_y .push_back( ttrh->globalPosition().y() );
2582 glu_z .push_back( ttrh->globalPosition().z() );
2583 glu_xx .push_back( ttrh->globalPositionError().cxx() );
2584 glu_xy .push_back( ttrh->globalPositionError().cyx() );
2585 glu_yy .push_back( ttrh->globalPositionError().cyy() );
2586 glu_yz .push_back( ttrh->globalPositionError().czy() );
2587 glu_zz .push_back( ttrh->globalPositionError().czz() );
2588 glu_zx .push_back( ttrh->globalPositionError().czx() );
2589 glu_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
2590 glu_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
2591 LogTrace(
"TrackingNtuple") <<
"stripMatchedHit" 2594 <<
" subdId=" << hitId.subdetId()
2596 <<
" rawId=" << hitId.rawId()
2597 <<
" pos =" << ttrh->globalPosition();
2604 std::vector<std::pair<int, int> >& monoStereoClusterList
2607 iEvent.
getByToken(stripMatchedRecHitToken_, matchedHits);
2608 for (
auto it = matchedHits->
begin(); it!=matchedHits->
end(); it++ ) {
2609 for (
auto hit = it->begin(); hit!=it->end(); hit++ ) {
2617 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2622 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2623 std::set<edm::ProductID>& hitProductIds
2626 iEvent.
getByToken(phase2OTRecHitToken_, phase2OTHits);
2627 for (
auto it = phase2OTHits->
begin(); it!=phase2OTHits->
end(); it++ ) {
2628 const DetId hitId = it->detId();
2629 for (
auto hit = it->begin(); hit!=it->end(); hit++ ) {
2632 hitProductIds.insert(hit->cluster().id());
2634 const int key = hit->cluster().key();
2635 const int lay = tTopo.
layer(hitId);
2641 ph2_x .push_back( ttrh->globalPosition().x() );
2642 ph2_y .push_back( ttrh->globalPosition().y() );
2643 ph2_z .push_back( ttrh->globalPosition().z() );
2644 ph2_xx .push_back( ttrh->globalPositionError().cxx() );
2645 ph2_xy .push_back( ttrh->globalPositionError().cyx() );
2646 ph2_yy .push_back( ttrh->globalPositionError().cyy() );
2647 ph2_yz .push_back( ttrh->globalPositionError().czy() );
2648 ph2_zz .push_back( ttrh->globalPositionError().czz() );
2649 ph2_zx .push_back( ttrh->globalPositionError().czx() );
2650 ph2_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
2651 ph2_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
2653 LogTrace(
"TrackingNtuple") <<
"phase2 OT cluster=" << key
2656 <<
" rawId=" << hitId.
rawId()
2657 <<
" pos =" << ttrh->globalPosition();
2659 if(includeTrackingParticles_) {
2661 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Phase2OT);
2667 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
2673 <<
" event=" << simHitData.
event[0];
2683 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2690 std::vector<std::pair<int, int> >& monoStereoClusterList,
2691 const std::set<edm::ProductID>& hitProductIds,
2692 std::map<edm::ProductID, size_t>& seedCollToOffset
2695 for(
size_t iColl=0; iColl < seedTokens_.size(); ++iColl) {
2696 const auto& seedToken = seedTokens_[iColl];
2699 iEvent.
getByToken(seedToken, seedTracksHandle);
2708 const auto& seedStopInfoToken = seedStopInfoTokens_[iColl];
2710 iEvent.
getByToken(seedStopInfoToken, seedStopInfoHandle);
2711 const auto& seedStopInfos = *seedStopInfoHandle;
2712 if(
seedTracks.size() != seedStopInfos.size()) {
2716 throw cms::Exception(
"LogicError") <<
"Got " <<
seedTracks.size() <<
" seeds, but " << seedStopInfos.size() <<
" seed stopping infos for collections " << labels.
module <<
", " << labels2.
module;
2729 label.ReplaceAll(
"seedTracks",
"");
2730 label.ReplaceAll(
"Seeds",
"");
2731 label.ReplaceAll(
"muonSeeded",
"muonSeededStep");
2736 auto inserted = seedCollToOffset.emplace(
id,
offset);
2737 if(!inserted.second)
2738 throw cms::Exception(
"Configuration") <<
"Trying to add seeds with ProductID " <<
id <<
" for a second time from collection " << labels.
module <<
", seed algo " << label <<
". Typically this is caused by a configuration problem.";
2741 LogTrace(
"TrackingNtuple") <<
"NEW SEED LABEL: " << label <<
" size: " <<
seedTracks.size() <<
" algo=" << algo
2742 <<
" ProductID " <<
id;
2744 for(
size_t iSeed=0; iSeed < seedTrackRefs.
size(); ++iSeed) {
2745 const auto& seedTrackRef = seedTrackRefs[iSeed];
2746 const auto& seedTrack = *seedTrackRef;
2747 const auto& seedRef = seedTrack.seedRef();
2748 const auto&
seed = *seedRef;
2750 const auto seedStopInfo = seedStopInfos[iSeed];
2752 if(seedRef.id() !=
id)
2753 throw cms::Exception(
"LogicError") <<
"All tracks in 'TracksFromSeeds' collection should point to seeds in the same collection. Now the element 0 had ProductID " <<
id <<
" while the element " << seedTrackRef.key() <<
" had " << seedTrackRef.id() <<
". The source collection is " << labels.
module <<
".";
2755 std::vector<int> tpIdx;
2756 std::vector<float> sharedFraction;
2757 auto foundTPs = recSimColl.
find(seedTrackRef);
2758 if (foundTPs != recSimColl.
end()) {
2759 for(
const auto tpQuality: foundTPs->val) {
2760 tpIdx.push_back( tpKeyToIndex.at( tpQuality.first.key() ) );
2761 sharedFraction.push_back(tpQuality.second);
2766 const int nHits = seedTrack.numberOfValidHits();
2768 const int nClusters = clusters.size();
2769 const auto bestKeyCount = findBestMatchingTrackingParticle(seedTrack, clusterToTPMap, tpKeyToIndex);
2770 const float bestShareFrac = nClusters > 0 ?
static_cast<float>(bestKeyCount.countClusters)/static_cast<float>(nClusters): 0;
2772 const auto bestFirstHitKeyCount = findMatchingTrackingParticleFromFirstHit(seedTrack, clusterToTPMap, tpKeyToIndex);
2773 const float bestFirstHitShareFrac = nClusters > 0 ?
static_cast<float>(bestFirstHitKeyCount.countClusters)/static_cast<float>(nClusters) : 0;
2776 const int charge = seedTrack.charge();
2777 const float pt = seedFitOk ? seedTrack.pt() : 0;
2778 const float eta = seedFitOk ? seedTrack.eta() : 0;
2779 const float phi = seedFitOk ? seedTrack.phi() : 0;
2781 const auto seedIndex =
see_fitok.size();
2785 see_px .push_back( seedFitOk ? seedTrack.px() : 0 );
2786 see_py .push_back( seedFitOk ? seedTrack.py() : 0 );
2787 see_pz .push_back( seedFitOk ? seedTrack.pz() : 0 );
2791 see_q .push_back( charge );
2796 see_ptErr .push_back( seedFitOk ? seedTrack.ptError() : 0);
2797 see_etaErr .push_back( seedFitOk ? seedTrack.etaError() : 0);
2798 see_phiErr .push_back( seedFitOk ? seedTrack.phiError() : 0);
2799 see_dxyErr .push_back( seedFitOk ? seedTrack.dxyError() : 0);
2800 see_dzErr .push_back( seedFitOk ? seedTrack.dzError() : 0);
2803 see_nCands .push_back( seedStopInfo.candidatesPerSeed() );
2805 const auto& state = seedTrack.seedRef()->startingState();
2806 const auto&
pos = state.parameters().position();
2807 const auto& mom = state.parameters().momentum();
2816 if(includeTrackingParticles_) {
2819 see_bestSimTrkIdx.push_back(bestKeyCount.key >= 0 ? tpKeyToIndex.at(bestKeyCount.key) : -1);
2840 std::vector<int> hitIdx;
2841 std::vector<int> hitType;
2843 for (
auto hit=
seed.recHits().first; hit!=
seed.recHits().second; ++hit) {
2845 int subid = recHit->geographicalId().subdetId();
2850 if(includeAllHits_) {
2851 checkProductID(hitProductIds, clusterRef.id(),
"seed");
2854 hitIdx.push_back( clusterKey );
2860 if(includeAllHits_) {
2867 std::vector<std::pair<int,int> >::iterator
pos =
find( monoStereoClusterList.begin(), monoStereoClusterList.end(), std::make_pair(monoIdx,stereoIdx) );
2868 size_t gluedIndex = -1;
2869 if(pos != monoStereoClusterList.end()) {
2870 gluedIndex =
std::distance(monoStereoClusterList.begin(), pos);
2877 gluedIndex =
addStripMatchedHit(*matchedHit, theTTRHBuilder, tTopo, monoStereoClusterList);
2880 if(includeAllHits_)
glu_seeIdx[gluedIndex].push_back(seedIndex);
2881 hitIdx.push_back( gluedIndex );
2886 unsigned int clusterKey;
2887 if(clusterRef.isPhase2()){
2890 clusterKey = clusterRef.cluster_strip().key();
2893 if(includeAllHits_) {
2894 checkProductID(hitProductIds, clusterRef.id(),
"seed");
2895 if(clusterRef.isPhase2()){
2902 hitIdx.push_back( clusterKey );
2903 if(clusterRef.isPhase2()){
2910 LogTrace(
"TrackingNtuple") <<
" not pixel and not Strip detector";
2925 std::vector<GlobalPoint>
gp(2);
2926 std::vector<GlobalError> ge(2);
2927 gp[0] = recHit0->globalPosition();
2928 ge[0] = recHit0->globalPositionError();
2929 gp[1] = recHit1->globalPosition();
2930 ge[1] = recHit1->globalPositionError();
2931 LogTrace(
"TrackingNtuple") <<
"seed " << seedTrackRef.key()
2932 <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
2933 <<
" - PAIR - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId()
2934 <<
" hitpos: " << gp[0] <<
" " << gp[1]
2935 <<
" trans0: " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2936 <<
" " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2937 <<
" trans1: " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2938 <<
" " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2939 <<
" eta,phi: " << gp[0].
eta() <<
"," << gp[0].phi();
2940 }
else if (nHits==3) {
2947 gp[0] = recHit0->globalPosition();
2948 ge[0] = recHit0->globalPositionError();
2949 int subid0 = recHit0->geographicalId().subdetId();
2951 gp[1] = recHit1->globalPosition();
2952 ge[1] = recHit1->globalPositionError();
2953 int subid1 = recHit1->geographicalId().subdetId();
2955 gp[2] = recHit2->globalPosition();
2956 ge[2] = recHit2->globalPositionError();
2957 int subid2 = recHit2->geographicalId().subdetId();
2960 float seed_chi2 = rzLine.
chi2();
2963 LogTrace(
"TrackingNtuple") <<
"seed " << seedTrackRef.key()
2964 <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
2965 <<
" - TRIPLET - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId() <<
" " << recHit2->geographicalId().rawId()
2966 <<
" hitpos: " <<
gp[0] <<
" " <<
gp[1] <<
" " <<
gp[2]
2967 <<
" trans0: " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2968 <<
" " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2969 <<
" trans1: " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2970 <<
" " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2971 <<
" trans2: " << (recHit2->transientHits().size()>1 ? recHit2->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2972 <<
" " << (recHit2->transientHits().size()>1 ? recHit2->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2973 <<
" local: " << recHit2->localPosition()
2975 <<
" eta,phi: " <<
gp[0].eta() <<
"," <<
gp[0].phi()
2976 <<
" pt,chi2: " << seed_pt <<
"," << seed_chi2;
2988 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2989 const TrackingParticleRefKeyToCount& tpKeyToClusterCount,
2997 const std::set<edm::ProductID>& hitProductIds,
2998 const std::map<edm::ProductID, size_t>& seedCollToOffset,
2999 const std::vector<const MVACollection *>& mvaColls,
3000 const std::vector<const QualityMaskCollection *>& qualColls
3005 LogTrace(
"TrackingNtuple") <<
"NEW TRACK LABEL: " << labels.
module;
3007 auto pvPosition = vertices[0].position();
3009 for(
size_t iTrack = 0; iTrack<tracks.
size(); ++iTrack) {
3010 const auto& itTrack = tracks[iTrack];
3011 int charge = itTrack->charge();
3012 float pt = itTrack->pt();
3013 float eta = itTrack->eta();
3014 const double lambda = itTrack->lambda();
3015 float chi2 = itTrack->normalizedChi2();
3016 float ndof = itTrack->ndof();
3017 float phi = itTrack->phi();
3018 int nHits = itTrack->numberOfValidHits();
3021 const auto& tkParam = itTrack->parameters();
3022 auto tkCov = itTrack->covariance();
3027 bool isSimMatched =
false;
3028 std::vector<int> tpIdx;
3029 std::vector<float> sharedFraction;
3030 std::vector<float> tpChi2;
3031 auto foundTPs = recSimColl.
find(itTrack);
3032 if (foundTPs != recSimColl.
end()) {
3033 if (!foundTPs->val.empty()) {
3034 nSimHits = foundTPs->val[0].first->numberOfTrackerHits();
3035 isSimMatched =
true;
3037 for(
const auto tpQuality: foundTPs->val) {
3038 tpIdx.push_back( tpKeyToIndex.at( tpQuality.first.key() ) );
3039 sharedFraction.push_back(tpQuality.second);
3046 const int nClusters = clusters.size();
3048 const auto bestKeyCount = findBestMatchingTrackingParticle(*itTrack, clusterToTPMap, tpKeyToIndex);
3049 const float bestShareFrac =
static_cast<float>(bestKeyCount.countClusters)/static_cast<float>(nClusters);
3050 float bestShareFracSimDenom = 0;
3051 float bestShareFracSimClusterDenom = 0;
3052 float bestChi2 = -1;
3053 if(bestKeyCount.key >= 0) {
3054 bestShareFracSimDenom =
static_cast<float>(bestKeyCount.countClusters)/static_cast<float>(tpCollection[tpKeyToIndex.at(bestKeyCount.key)]->numberOfTrackerHits());
3055 bestShareFracSimClusterDenom =
static_cast<float>(bestKeyCount.countClusters)/static_cast<float>(tpKeyToClusterCount.at(bestKeyCount.key));
3059 const auto bestFirstHitKeyCount = findMatchingTrackingParticleFromFirstHit(*itTrack, clusterToTPMap, tpKeyToIndex);
3060 const float bestFirstHitShareFrac =
static_cast<float>(bestFirstHitKeyCount.countClusters)/static_cast<float>(nClusters);
3061 float bestFirstHitShareFracSimDenom = 0;
3062 float bestFirstHitShareFracSimClusterDenom = 0;
3063 float bestFirstHitChi2 = -1;
3064 if(bestFirstHitKeyCount.key >= 0) {
3065 bestFirstHitShareFracSimDenom =
static_cast<float>(bestFirstHitKeyCount.countClusters)/static_cast<float>(tpCollection[tpKeyToIndex.at(bestFirstHitKeyCount.key)]->numberOfTrackerHits());
3066 bestFirstHitShareFracSimClusterDenom =
static_cast<float>(bestFirstHitKeyCount.countClusters)/static_cast<float>(tpKeyToClusterCount.at(bestFirstHitKeyCount.key));
3070 float chi2_1Dmod =
chi2;
3071 int count1dhits = 0;
3072 for(
auto iHit = itTrack->recHitsBegin(), iEnd=itTrack->recHitsEnd(); iHit != iEnd; ++iHit) {
3077 if(count1dhits > 0) {
3078 chi2_1Dmod = (chi2+count1dhits)/(ndof+count1dhits);
3083 trk_px .push_back(itTrack->px());
3084 trk_py .push_back(itTrack->py());
3085 trk_pz .push_back(itTrack->pz());
3086 trk_pt .push_back(pt);
3087 trk_inner_px.push_back(itTrack->innerMomentum().x());
3088 trk_inner_py.push_back(itTrack->innerMomentum().y());
3089 trk_inner_pz.push_back(itTrack->innerMomentum().z());
3090 trk_inner_pt.push_back(itTrack->innerMomentum().rho());
3091 trk_outer_px.push_back(itTrack->outerMomentum().x());
3092 trk_outer_py.push_back(itTrack->outerMomentum().y());
3093 trk_outer_pz.push_back(itTrack->outerMomentum().z());
3094 trk_outer_pt.push_back(itTrack->outerMomentum().rho());
3095 trk_eta .push_back(eta);
3096 trk_lambda .push_back(lambda);
3097 trk_cotTheta .push_back(1/
tan(
M_PI*0.5-lambda));
3098 trk_phi .push_back(phi);
3099 trk_dxy .push_back(itTrack->dxy(bs.
position()));
3100 trk_dz .push_back(itTrack->dz(bs.
position()));
3101 trk_dxyPV .push_back(itTrack->dxy(pvPosition));
3102 trk_dzPV .push_back(itTrack->dz(pvPosition));
3103 trk_dxyClosestPV.push_back(itTrack->dxy(bestPV));
3104 trk_dzClosestPV .push_back(itTrack->dz(bestPV));
3105 trk_ptErr .push_back(itTrack->ptError());
3106 trk_etaErr .push_back(itTrack->etaError());
3107 trk_lambdaErr.push_back(itTrack->lambdaError());
3108 trk_phiErr .push_back(itTrack->phiError());
3109 trk_dxyErr .push_back(itTrack->dxyError());
3110 trk_dzErr .push_back(itTrack->dzError());
3111 trk_refpoint_x.push_back(itTrack->vx());
3112 trk_refpoint_y.push_back(itTrack->vy());
3113 trk_refpoint_z.push_back(itTrack->vz());
3114 trk_nChi2 .push_back(chi2);
3115 trk_nChi2_1Dmod.push_back(chi2_1Dmod);
3116 trk_ndof .push_back(ndof);
3117 trk_q .push_back(charge);
3131 trk_nCluster .push_back(nClusters);
3132 trk_algo .push_back(itTrack->algo());
3133 trk_originalAlgo.push_back(itTrack->originalAlgo());
3138 for(
size_t i=0;
i<trk_mvas.size(); ++
i) {
3139 trk_mvas [
i].push_back( (*(mvaColls [
i]))[iTrack] );
3140 trk_qualityMasks[
i].push_back( (*(qualColls[i]))[iTrack] );
3144 auto offset = seedCollToOffset.find(itTrack->seedRef().id());
3145 if(
offset == seedCollToOffset.end()) {
3148 <<
"' refers to seed collection " << itTrack->seedRef().id()
3149 <<
", but that seed collection is not given as an input. The following collections were given as an input " << make_ProductIDMapPrinter(seedCollToOffset);
3152 const auto seedIndex =
offset->second + itTrack->seedRef().key();
3155 throw cms::Exception(
"LogicError") <<
"Track index has already been set for seed " << seedIndex <<
" to " <<
see_trkIdx[seedIndex] <<
"; was trying to set it to " << iTrack;
3160 if(includeTrackingParticles_) {
3164 trk_bestSimTrkIdx.push_back(bestKeyCount.key >= 0 ? tpKeyToIndex.at(bestKeyCount.key) : -1);
3179 LogTrace(
"TrackingNtuple") <<
"Track #" << itTrack.key() <<
" with q=" << charge
3180 <<
", pT=" << pt <<
" GeV, eta: " << eta <<
", phi: " << phi
3181 <<
", chi2=" << chi2
3182 <<
", Nhits=" << nHits
3183 <<
", algo=" << itTrack->algoName(itTrack->algo()).c_str()
3185 <<
" seed#=" << itTrack->seedRef().key()
3186 <<
" simMatch=" << isSimMatched
3187 <<
" nSimHits=" << nSimHits
3188 <<
" sharedFraction=" << (sharedFraction.empty()?-1:sharedFraction[0])
3189 <<
" tpIdx=" << (tpIdx.empty()?-1:tpIdx[0]);
3190 std::vector<int> hitIdx;
3191 std::vector<int> hitType;
3193 for(
auto i=itTrack->recHitsBegin();
i!=itTrack->recHitsEnd();
i++) {
3195 DetId hitId = hit->geographicalId();
3202 if (hit->isValid()) {
3206 unsigned int clusterKey;
3207 if(clusterRef.isPixel()){
3209 }
else if(clusterRef.isPhase2()){
3210 clusterKey = clusterRef.cluster_phase2OT().key();
3212 clusterKey = clusterRef.cluster_strip().key();
3215 LogTrace(
"TrackingNtuple") <<
" id: " << hitId.
rawId() <<
" - globalPos =" << hit->globalPosition()
3216 <<
" cluster=" << clusterKey
3217 <<
" clusterRef ID=" << clusterRef.id()
3218 <<
" eta,phi: " << hit->globalPosition().eta() <<
"," << hit->globalPosition().phi();
3219 if(includeAllHits_) {
3220 checkProductID(hitProductIds, clusterRef.id(),
"track");
3221 if(clusterRef.isPixel()){
3223 }
else if(clusterRef.isPhase2()){
3231 hitIdx.push_back(clusterKey);
3232 if(clusterRef.isPixel()){
3234 }
else if(clusterRef.isPhase2()){
3240 LogTrace(
"TrackingNtuple") <<
" - invalid hit";
3246 if(includeStripHits_)
inv_detId.push_back( tTopo, hitId );
3248 inv_type .push_back( hit->getType() );
3263 const TrackingVertexRefKeyToIndex& tvKeyToIndex,
3265 const std::vector<TPHitIndex>& tpHitList,
3266 const TrackingParticleRefKeyToCount& tpKeyToClusterCount
3274 iEvent.
getByToken(tpNLayersToken_, tpNLayersH);
3275 const auto& nLayers_tPCeff = *tpNLayersH;
3277 iEvent.
getByToken(tpNPixelLayersToken_, tpNLayersH);
3278 const auto& nPixelLayers_tPCeff = *tpNLayersH;
3280 iEvent.
getByToken(tpNStripStereoLayersToken_, tpNLayersH);
3281 const auto& nStripMonoAndStereoLayers_tPCeff = *tpNLayersH;
3286 LogTrace(
"TrackingNtuple") <<
"tracking particle pt=" << tp->pt() <<
" eta=" << tp->eta() <<
" phi=" << tp->phi();
3287 bool isRecoMatched =
false;
3288 std::vector<int> tkIdx;
3289 std::vector<float> sharedFraction;
3290 auto foundTracks = simRecColl.
find(tp);
3291 if(foundTracks != simRecColl.
end()) {
3292 isRecoMatched =
true;
3300 for(
const auto& genRef: tp->genParticles()) {
3301 if(genRef.isNonnull())
3305 bool isFromBHadron =
false;
3310 for(
const auto& particle: recoGenParticleTrail) {
3313 isFromBHadron =
true;
3319 LogTrace(
"TrackingNtuple") <<
"matched to tracks = " << make_VectorPrinter(tkIdx) <<
" isRecoMatched=" << isRecoMatched;
3320 sim_event .push_back(tp->eventId().event());
3324 sim_px .push_back(tp->px());
3325 sim_py .push_back(tp->py());
3326 sim_pz .push_back(tp->pz());
3327 sim_pt .push_back(tp->pt());
3328 sim_eta .push_back(tp->eta());
3329 sim_phi .push_back(tp->phi());
3330 sim_q .push_back(tp->charge());
3334 std::vector<int> decayIdx;
3335 for(
const auto&
v: tp->decayVertices())
3336 decayIdx.push_back( tvKeyToIndex.at(
v.key()) );
3344 const double lambdaSim =
M_PI/2 - momentum.theta();
3353 std::vector<int> hitIdx;
3354 int nPixel=0, nStrip=0;
3356 for(
auto ip = rangeHit.first; ip != rangeHit.second; ++ip) {
3360 LogTrace(
"TrackingNtuple") <<
"simhit=" << ip->simHitIdx <<
" type=" <<
static_cast<int>(
type);
3361 hitIdx.push_back(ip->simHitIdx);
3364 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " << tp.key() <<
" with DetId " << detid.rawId() <<
" whose det() is not Tracker but " << detid.det();
3366 const auto subdet = detid.subdetId();
3379 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " << tp.key() <<
" with DetId " << detid.rawId() <<
" whose subdet is not recognized, is " << subdet;
3386 const auto nSimLayers = nLayers_tPCeff[tp];
3387 const auto nSimPixelLayers = nPixelLayers_tPCeff[tp];
3388 const auto nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tp];
3391 sim_n3DLay .push_back( nSimPixelLayers+nSimStripMonoAndStereoLayers );
3394 auto found = tpKeyToClusterCount.find(tp.key());
3395 sim_nRecoClusters.push_back(found != cend(tpKeyToClusterCount) ? found->second : 0);
3404 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
3405 const unsigned int seedOffset) {
3409 for(
const auto& keyVal: simRecColl) {
3410 const auto& tpRef = keyVal.key;
3411 auto found = tpKeyToIndex.find(tpRef.key());
3412 if(found == tpKeyToIndex.end())
3413 throw cms::Exception(
"Assert") << __FILE__ <<
":" << __LINE__ <<
" fillTrackingParticlesForSeeds: tpRef.key() " << tpRef.key() <<
" not found from tpKeyToIndex. tpKeyToIndex size " << tpKeyToIndex.size();
3414 const auto tpIndex = found->second;
3415 for(
const auto& pair: keyVal.val) {
3416 const auto& seedRef = pair.first->seedRef();
3417 sim_seedIdx[tpIndex].push_back(seedOffset + seedRef.key());
3425 for(
size_t iVertex=0,
size=vertices.size(); iVertex<
size; ++iVertex) {
3427 vtx_x.push_back(vertex.
x());
3428 vtx_y.push_back(vertex.
y());
3429 vtx_z.push_back(vertex.
z());
3438 std::vector<int> trkIdx;
3441 if(iTrack->id() != tracks.
id())
3444 trkIdx.push_back(iTrack->key());
3447 throw cms::Exception(
"LogicError") <<
"Vertex index has already been set for track " << iTrack->key() <<
" to " <<
trk_vtxIdx[iTrack->key()] <<
"; was trying to set it to " << iVertex;
3456 const TrackingParticleRefKeyToIndex& tpKeyToIndex
3458 int current_event = -1;
3459 for(
const auto& ref: trackingVertices) {
3469 processType = v.
g4Vertices()[0].processType();
3481 for(
const auto& tpRef: tps) {
3482 auto found = tpKeyToIndex.find(tpRef.key());
3483 if(found != tpKeyToIndex.end()) {
3484 idx.push_back(found->second);
3489 std::vector<int> sourceIdx;
3490 std::vector<int> daughterIdx;
3504 desc.
addUntracked<std::vector<edm::InputTag> >(
"seedTracks", std::vector<edm::InputTag>{
3516 desc.
addUntracked<std::vector<edm::InputTag> >(
"trackCandidates", std::vector<edm::InputTag>{
3529 desc.
addUntracked<std::vector<std::string> >(
"trackMVAs", std::vector<std::string>{{
"generalTracks"}});
3531 desc.
addUntracked<
bool>(
"trackingParticlesRef",
false);
3554 desc.
addUntracked<
bool>(
"includeTrackingParticles",
true);
3555 descriptions.
add(
"trackingNtuple",desc);
int adc(sample_type sample)
get the ADC sample (12 bits)
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
EventNumber_t event() const
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
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
bool tobIsDoubleSide(const DetId &id) const
const_iterator end(bool update=false) 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
size_type dataSize() const
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 > 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< int > glu_monoIdx
std::vector< float > trk_eta
std::vector< short > glu_isBarrel
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
void fillStripMatchedHits(const edm::Event &iEvent, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, std::vector< std::pair< int, int > > &monoStereoClusterList)
trackRef_iterator tracks_end() const
last iterator over tracks
std::vector< int > trk_bestFromFirstHitSimTrkIdx
std::vector< std::vector< int > > simhit_hitIdx
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
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
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
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 > glu_z
std::vector< float > see_stateTrajY
edm::EDGetTokenT< edm::View< reco::Track > > trackToken_
size_t addStripMatchedHit(const SiStripMatchedRecHit2D &hit, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, std::vector< std::pair< int, int > > &monoStereoClusterList)
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
std::vector< OmniClusterRef > hitsToClusterRefs(iter begin, iter end)
std::vector< unsigned int > see_algo
std::vector< Vertex > VertexCollection
collection of Vertex objects
T * make(const Args &...args) const
make new ROOT object
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
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)
S & print(S &os, JobReport::InputFile const &f)
std::vector< float > sim_py
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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 > 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_
CombineDetId< DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdStripOnly > DetIdAll
std::vector< std::vector< int > > pix_seeIdx
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< float > trk_bestSimTrkShareFracSimDenom
std::vector< unsigned short > ring
std::vector< float > trk_bestFromFirstHitSimTrkNChi2
RefToBase< value_type > refAt(size_type i) const
bool isLower(const DetId &id) const
math::XYZPointD Point
point in the space
std::vector< float > see_etaErr
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
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
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::string parametersDefinerName_
std::vector< unsigned int > trk_nPixel
std::vector< float > glu_y
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< unsigned int > see_nCluster
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitToken_
std::vector< float > ph2_y
std::vector< std::tuple< edm::EDGetTokenT< MVACollection >, edm::EDGetTokenT< QualityMaskCollection > > > mvaQualityCollectionTokens_
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
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
simTrack
per collection params
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
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
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_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
std::vector< float > vtx_yErr
std::vector< std::vector< int > > pix_trkIdx
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
std::vector< float > simvtx_x
double z() const
z coordinate
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)
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
const bool includeTrackingParticles_
OmniClusterRef const & firstClusterRef() const override
std::vector< float > trk_dz
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
std::vector< float > trk_ptErr
std::vector< unsigned int > trk_nStripLay
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
OmniClusterRef const & monoClusterRef() const
std::vector< float > vtx_z
int trackerLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
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
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
def elem(elemtype, innerHTML='', html_class='', kwargs)
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)
std::vector< float > vtx_xErr
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isUpper(const DetId &id) const
std::vector< float > sim_pz
std::vector< std::vector< int > > sim_simHitIdx
edm::Ref< TrackingVertexCollection > TrackingVertexRef
std::vector< unsigned short > isGlued
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< int > glu_stereoIdx
std::vector< float > trk_py
double xError() const
error on x
std::vector< std::vector< int > > pix_simHitIdx
std::vector< float > trk_nChi2
SiStripRecHit2D stereoHit() const
std::vector< std::vector< unsigned short > > trk_qualityMasks
void book(const std::string &prefix, TTree *tree)
T const * product() const
std::vector< unsigned int > see_nGlued
std::vector< float > see_py
std::vector< float > pix_x
std::vector< unsigned int > detId
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< int > sim_parentVtxIdx
std::vector< float > see_ptErr
std::vector< float > str_z
std::vector< unsigned short > isStack
std::vector< float > str_zx
uint32_t stack(const DetId &id) const
std::vector< TrackingVertex > TrackingVertexCollection
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
std::vector< unsigned int > trk_nInnerInactive
std::vector< unsigned short > isLower
unsigned int tecOrder(const DetId &id) const
Base class to all the history types.
int numberOfLostHits(HitCategory category) const
std::vector< std::vector< int > > trk_hitIdx
unsigned int layer(const DetId &id) const
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
SiStripRecHit2D monoHit() const
std::vector< unsigned int > sim_nPixel
std::vector< SimHitTPPair > SimHitTPAssociationList
const bool includeAllHits_
int trackerLayersWithoutMeasurement(HitCategory category) const
std::vector< short > vtx_valid
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
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
void depth(int d)
Set the depth of the history.
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< float > sim_pca_eta
void push_back(const RefToBase< T > &)
virtual OmniClusterRef const & firstClusterRef() const =0
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)
static int pixelToChannel(int row, int col)
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
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
std::vector< float > trk_dxyClosestPV
int numberOfValidPixelHits() const
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.
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNPixelLayersToken_
bool isUninitialized() const
std::vector< unsigned int > trk_nPixelLay
unsigned int tecPetalNumber(const DetId &id) const
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
std::vector< unsigned int > see_offset
DetId geographicalId() const
std::vector< float > ph2_zz
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
trackRef_iterator tracks_begin() const
first iterator over tracks
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 > 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
std::vector< decltype(reco::TrackBase().algoMaskUL())> trk_algoMask
std::vector< std::vector< int > > see_hitIdx
T const * product() const
std::vector< float > vtx_x
double trackAssociationChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const Basic3DVector< double > &momAtVtx, const Basic3DVector< double > &vert, int charge, const MagneticField &magfield, const reco::BeamSpot &bs)
basic method where chi2 is computed
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< unsigned int > see_nPixel
edm::Ref< TrackingParticleCollection > TrackingParticleRef
std::vector< unsigned short > petalNumber
std::vector< float > see_eta
const std::vector< uint8_t > & amplitudes() const
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
const_iterator begin(bool update=false) const
std::vector< float > vtx_zErr
unsigned int operator[](size_t i) const
std::vector< float > simhit_eloss
std::vector< float > see_bestFromFirstHitSimTrkShareFrac
std::vector< int > sim_isFromBHadron
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripSimLinkToken_
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.