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

Comparing UserCode/MitPhysics/Mods/src/MuonIDMod.cc (file contents):
Revision 1.13 by loizides, Thu Dec 11 15:53:03 2008 UTC vs.
Revision 1.20 by loizides, Mon May 11 08:02:43 2009 UTC

# Line 13 | Line 13 | ClassImp(mithep::MuonIDMod)
13    BaseMod(name,title),
14    fMuonBranchName(Names::gkMuonBrn),
15    fCleanMuonsName(ModNames::gkCleanMuonsName),  
16 +  fVertexName("PrimaryVertexesBeamSpot"),
17    fMuonIDType("Loose"),
18    fMuonIsoType("TrackCaloSliding"),  
19    fMuonClassType("Global"),  
# Line 20 | Line 21 | ClassImp(mithep::MuonIDMod)
21    fCaloIsolationCut(3.0),
22    fCombIsolationCut(5.0),
23    fMuonPtMin(10),
24 <  fMuons(0)
24 >  fD0Cut(0.025),
25 >  fReverseIsoCut(kFALSE),
26 >  fMuIDType(kIdUndef),
27 >  fMuIsoType(kIsoUndef),
28 >  fMuClassType(kClassUndef),
29 >  fMuons(0),
30 >  fVertices(0),
31 >  fMuonTools(0)
32   {
33    // Constructor.
34   }
# Line 31 | Line 39 | void MuonIDMod::Process()
39    // Process entries of the tree.
40  
41    LoadBranch(fMuonBranchName);
42 +  LoadBranch(fVertexName);
43  
44    MuonOArr *CleanMuons = new MuonOArr;
45    CleanMuons->SetName(fCleanMuonsName);
# Line 39 | Line 48 | void MuonIDMod::Process()
48      const Muon *mu = fMuons->At(i);
49  
50      Bool_t pass = kFALSE;
51 <    Double_t pt = -1; // make sure pt is taken from the correct track!
51 >    Double_t pt = 0; // make sure pt is taken from the correct track!
52      switch (fMuClassType) {
53        case kAll:
54          pass = kTRUE;
55 <        pt = mu->Pt();
55 >        if (mu->HasTrk())
56 >          pt = mu->Pt();
57          break;
58        case kGlobal:
59 <        pass = (mu->GlobalTrk() != 0);
59 >        pass = mu->HasGlobalTrk();
60          if (pass)
61            pt = mu->GlobalTrk()->Pt();
62          break;
63        case kSta:
64 <        pass = (mu->StandaloneTrk() != 0);
64 >        pass = mu->HasStandaloneTrk();
65          if (pass)
66            pt = mu->StandaloneTrk()->Pt();
67          break;
68        case kTrackerOnly:
69 <        pass = (mu->TrackerTrk() != 0);
69 >        pass = mu->HasTrackerTrk();
70          if (pass)
71            pt = mu->TrackerTrk()->Pt();
72          break;
# Line 80 | Line 90 | void MuonIDMod::Process()
90          idpass = fMuonTools->IsGood(mu, MuonTools::kTMOneStationTight) &&
91                   fMuonTools->IsGood(mu, MuonTools::kTM2DCompatibilityTight);
92          break;
93 +      case kNoId:
94 +        idpass = kTRUE;
95 +        break;
96        default:
97          break;
98      }
# Line 102 | Line 115 | void MuonIDMod::Process()
115            Double_t totalIso = 1.0 * mu->IsoR03SumPt() +
116                                1.0 * mu->IsoR03EmEt() +
117                                1.0 * mu->IsoR03HadEt();
118 <          if ((totalIso < (mu->Pt()-10.0)*5.0/15.0 && mu->Pt() <= 25) ||
118 >          if ((totalIso < (pt-10.0)*5.0/15.0 && pt <= 25) ||
119                (totalIso < 5.0 && mu->Pt() > 25) ||
120                 totalIso <= 0)
121              isopass = kTRUE;
# Line 116 | Line 129 | void MuonIDMod::Process()
129          break;
130      }
131  
132 <    if (!isopass)
132 >    if ((isopass == kFALSE && fReverseIsoCut == kFALSE) ||
133 >        (isopass == kTRUE  && fReverseIsoCut == kTRUE))
134 >      continue;
135 >
136 >    // d0 cut only for muons that have a track
137 >    const Track *mt = mu->BestTrk();
138 >    if (!mt)
139 >      continue;
140 >    Double_t d0_real = 1e30;
141 >    for(UInt_t i0 = 0; i0 < fVertices->GetEntries(); i0++) {
142 >      Double_t pD0 = mt->D0Corrected(*fVertices->At(i0));
143 >      if(TMath::Abs(pD0) < TMath::Abs(d0_real))
144 >        d0_real = TMath::Abs(pD0);
145 >    }
146 >    if(d0_real >= fD0Cut)
147        continue;
148  
149      // add good muon
# Line 137 | Line 164 | void MuonIDMod::SlaveBegin()
164    // we just request the muon collection branch.
165  
166    ReqBranch(fMuonBranchName, fMuons);
167 +  ReqBranch(fVertexName, fVertices);
168  
169    fMuonTools = new MuonTools;
170  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines