15 embeddedMuonBestTrack_(
false),
16 embeddedTunePMuonBestTrack_(
false),
17 embeddedTrack_(
false),
18 embeddedStandAloneMuon_(
false),
19 embeddedCombinedMuon_(
false),
20 embeddedTCMETMuonCorrs_(
false),
21 embeddedCaloMETMuonCorrs_(
false),
22 embeddedPickyMuon_(
false),
23 embeddedTpfmsMuon_(
false),
24 embeddedDytMuon_(
false),
25 embeddedPFCandidate_(
false),
27 cachedNormChi2_(
false),
29 cachedNumberOfValidHits_(
false),
30 numberOfValidHits_(0),
39 initImpactParameters();
46 embeddedMuonBestTrack_(
false),
47 embeddedTunePMuonBestTrack_(
false),
48 embeddedTrack_(
false),
49 embeddedStandAloneMuon_(
false),
50 embeddedCombinedMuon_(
false),
51 embeddedTCMETMuonCorrs_(
false),
52 embeddedCaloMETMuonCorrs_(
false),
53 embeddedPickyMuon_(
false),
54 embeddedTpfmsMuon_(
false),
55 embeddedDytMuon_(
false),
56 embeddedPFCandidate_(
false),
58 cachedNormChi2_(
false),
60 cachedNumberOfValidHits_(
false),
61 numberOfValidHits_(0),
70 initImpactParameters();
77 embeddedMuonBestTrack_(
false),
78 embeddedTunePMuonBestTrack_(
false),
79 embeddedTrack_(
false),
80 embeddedStandAloneMuon_(
false),
81 embeddedCombinedMuon_(
false),
82 embeddedTCMETMuonCorrs_(
false),
83 embeddedCaloMETMuonCorrs_(
false),
84 embeddedPickyMuon_(
false),
85 embeddedTpfmsMuon_(
false),
86 embeddedDytMuon_(
false),
87 embeddedPFCandidate_(
false),
89 cachedNormChi2_(
false),
91 cachedNumberOfValidHits_(
false),
92 numberOfValidHits_(0),
101 initImpactParameters();
108 embeddedMuonBestTrack_(
false),
109 embeddedTunePMuonBestTrack_(
false),
110 embeddedTrack_(
false),
111 embeddedStandAloneMuon_(
false),
112 embeddedCombinedMuon_(
false),
113 embeddedTCMETMuonCorrs_(
false),
114 embeddedCaloMETMuonCorrs_(
false),
115 embeddedPickyMuon_(
false),
116 embeddedTpfmsMuon_(
false),
117 embeddedDytMuon_(
false),
118 embeddedPFCandidate_(
false),
120 cachedNormChi2_(
false),
122 cachedNumberOfValidHits_(
false),
123 numberOfValidHits_(0),
132 initImpactParameters();
143 out <<
"\tpat::Muon: ";
144 out << std::setiosflags(std::ios::right);
146 out << std::setprecision(3);
147 out <<
" E/pT/eta/phi " <<
obj.energy() <<
"/" <<
obj.pt() <<
"/" <<
obj.eta() <<
"/" <<
obj.phi();
152 void Muon::initImpactParameters() {
159 void Muon::initSimInfo() {
163 simHeaviestMotherFlavour_ = 0;
176 if (embeddedTrack_) {
185 if (embeddedStandAloneMuon_) {
194 if (embeddedCombinedMuon_) {
203 if (embeddedPickyMuon_) {
212 if (embeddedTpfmsMuon_) {
221 if (embeddedDytMuon_) {
230 if (!muonBestTrack_.empty()) {
239 if (!tunePMuonBestTrack_.empty()) {
241 }
else if (muonBestTrackType() == tunePMuonBestTrackType()) {
242 return muonBestTrack();
250 if (embeddedPFCandidate_) {
253 return pfCandidateRef_;
259 if (pfCandidateRef_.isNonnull() &&
i == 0)
261 if (refToOrig_.isNonnull() && pfCandidateRef_.isNonnull() &&
i == 1)
263 if (refToOrig_.isNonnull() && !pfCandidateRef_.isNonnull() &&
i == 0)
270 muonBestTrack_.clear();
271 embeddedMuonBestTrack_ =
false;
272 bool alreadyEmbedded =
false;
274 switch (muonBestTrackType()) {
276 alreadyEmbedded =
true;
280 alreadyEmbedded =
true;
283 if (embeddedStandAloneMuon_)
284 alreadyEmbedded =
true;
287 if (embeddedCombinedMuon_)
288 alreadyEmbedded =
true;
291 if (embeddedTpfmsMuon_)
292 alreadyEmbedded =
true;
295 if (embeddedPickyMuon_)
296 alreadyEmbedded =
true;
299 if (embeddedDytMuon_)
300 alreadyEmbedded =
true;
304 if (
force || !alreadyEmbedded) {
306 embeddedMuonBestTrack_ =
true;
312 tunePMuonBestTrack_.clear();
313 bool alreadyEmbedded =
false;
314 embeddedTunePMuonBestTrack_ =
false;
316 switch (tunePMuonBestTrackType()) {
318 alreadyEmbedded =
true;
322 alreadyEmbedded =
true;
325 if (embeddedStandAloneMuon_)
326 alreadyEmbedded =
true;
329 if (embeddedCombinedMuon_)
330 alreadyEmbedded =
true;
333 if (embeddedTpfmsMuon_)
334 alreadyEmbedded =
true;
337 if (embeddedPickyMuon_)
338 alreadyEmbedded =
true;
341 if (embeddedDytMuon_)
342 alreadyEmbedded =
true;
345 if (muonBestTrackType() == tunePMuonBestTrackType()) {
346 if (embeddedMuonBestTrack_)
347 alreadyEmbedded =
true;
350 if (
force || !alreadyEmbedded) {
352 embeddedTunePMuonBestTrack_ =
true;
361 embeddedTrack_ =
true;
367 standAloneMuon_.clear();
370 embeddedStandAloneMuon_ =
true;
376 combinedMuon_.clear();
379 embeddedCombinedMuon_ =
true;
387 for (
auto const&
assoc : assocs) {
388 if (!
assoc->contains(trackExtra.
id())) {
393 trackExtra = trackExtraOut;
396 track.setExtra(trackExtra);
427 caloMETMuonCorrs_.clear();
428 caloMETMuonCorrs_.push_back(
t);
429 embeddedCaloMETMuonCorrs_ =
true;
434 tcMETMuonCorrs_.clear();
435 tcMETMuonCorrs_.push_back(
t);
436 embeddedTCMETMuonCorrs_ =
true;
444 pickyMuon_.push_back(*tk);
445 embeddedPickyMuon_ =
true;
454 tpfmsMuon_.push_back(*tk);
455 embeddedTpfmsMuon_ =
true;
464 dytMuon_.push_back(*tk);
465 embeddedDytMuon_ =
true;
471 inverseBeta_ =
t.inverseBeta();
472 inverseBetaErr_ =
t.inverseBetaErr();
478 if (pfCandidateRef_.isAvailable() && pfCandidateRef_.isNonnull()) {
480 embeddedPFCandidate_ =
true;
493 double Muon::normChi2()
const {
494 if (cachedNormChi2_) {
498 return t->chi2() /
t->ndof();
507 if (cachedNumberOfValidHits_) {
508 return numberOfValidHits_;
511 return t->numberOfValidHits();
517 double Muon::dB(IpType type_)
const {
519 if (cachedIP_ & (1 <<
int(type_))) {
528 double Muon::edB(IpType type_)
const {
530 if (cachedIP_ & (1 <<
int(type_))) {