32 |
|
|
33 |
|
// Go through all cosmics and remove cosmic overlaps with collision muons and duplicates. |
34 |
|
std::vector<const Muon*> CleanCosTemp; |
35 |
< |
|
35 |
> |
|
36 |
|
if (fCosmics) { |
37 |
|
for (UInt_t i=0; i<fCosmics->GetEntries(); ++i) { |
38 |
|
const Muon *u = fCosmics->At(i); |
39 |
|
|
40 |
|
FourVectorM mom(u->Mom()); |
41 |
+ |
// Invert the cosmic momentum for fake cosmic cleaning |
42 |
+ |
FourVectorM momInv(mom.Pt(),-mom.Eta(),mom.Phi()+TMath::Pi(),mom.M()); |
43 |
|
|
44 |
|
// Check whether it overlaps with a good muon: If the muon and cosmic both have |
45 |
|
// tracker tracks then compare the tracks, otherwise |
48 |
|
UInt_t n = CleanMuons->GetEntries(); |
49 |
|
for (UInt_t j=0; j<n; ++j) { |
50 |
|
Double_t deltaR = MathUtils::DeltaR(CleanMuons->At(j)->Mom(), mom); |
51 |
< |
if (deltaR < fDeltaR) { |
51 |
> |
Double_t deltaRInv = MathUtils::DeltaR(CleanMuons->At(j)->Mom(), momInv); |
52 |
> |
if (deltaR < fDeltaR || deltaRInv < fDeltaR) { |
53 |
|
isMuonOverlap = kTRUE; |
54 |
|
break; |
55 |
|
} |
61 |
|
if (isMuonOverlap) |
62 |
|
continue; |
63 |
|
|
64 |
+ |
// Check whether it overlaps with another cosmic candidate: |
65 |
+ |
bool isCosmicOverlap = kFALSE; |
66 |
+ |
for (UInt_t j=0; j<CleanCosTemp.size(); ++j) { |
67 |
+ |
Double_t deltaR = MathUtils::DeltaR(CleanCosTemp[j]->Mom(), mom); |
68 |
+ |
if (deltaR < 0.1) { |
69 |
+ |
isCosmicOverlap = kTRUE; |
70 |
+ |
break; |
71 |
+ |
} |
72 |
+ |
} |
73 |
+ |
|
74 |
+ |
if (isCosmicOverlap) |
75 |
+ |
continue; |
76 |
+ |
|
77 |
|
// if no overlaps then add to clean cosmics |
78 |
|
CleanCosTemp.push_back(fCosmics->At(i)); |
79 |
|
} |