ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/CosmicCleaningMod.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/CosmicCleaningMod.cc (file contents):
Revision 1.1 by ceballos, Sat Aug 3 11:50:09 2013 UTC vs.
Revision 1.3 by dimatteo, Wed Oct 9 22:16:27 2013 UTC

# Line 15 | Line 15 | CosmicCleaningMod::CosmicCleaningMod(con
15    fCosmicsName("random"),        
16    fCleanMuonsName(ModNames::gkCleanMuonsName),        
17    fCleanCosmicsName(ModNames::gkCleanCosmicsName),
18 +  fDeltaR(0.1),
19    fCosmics(0)
20   {
21    // Constructor.
# Line 31 | Line 32 | void CosmicCleaningMod::Process()
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
# Line 45 | Line 48 | void CosmicCleaningMod::Process()
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 < 0.1) {
51 >          Double_t deltaRInv = MathUtils::DeltaR(CleanMuons->At(j)->Mom(), momInv);    
52 >          if (deltaR < fDeltaR || deltaRInv < fDeltaR) {
53              isMuonOverlap = kTRUE;
54              break;        
55            }
# Line 57 | Line 61 | void CosmicCleaningMod::Process()
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 <      }
71 <
72 <      if (isCosmicOverlap)
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 <
76 >        
77        // if no overlaps then add to clean cosmics
78        CleanCosTemp.push_back(fCosmics->At(i));  
79      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines