ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/LeptonPlusIsoTrackSelMod.cc
Revision: 1.1
Committed: Sun Mar 22 09:04:13 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009a, Mit_009, Mit_008
Log Message:
Added skimming code for jet,lepton,photon plus iso tracks.

File Contents

# User Rev Content
1 loizides 1.1 // $Id: $
2    
3     #include "MitPhysics/SelMods/interface/LeptonPlusIsoTrackSelMod.h"
4     #include "MitPhysics/Utils/interface/IsolationTools.h"
5     #include "MitCommon/MathTools/interface/MathUtils.h"
6    
7     using namespace mithep;
8    
9     ClassImp(mithep::LeptonPlusIsoTrackSelMod)
10    
11     //--------------------------------------------------------------------------------------------------
12     mithep::LeptonPlusIsoTrackSelMod::LeptonPlusIsoTrackSelMod(const char *name, const char *title) :
13     BaseSelMod(name,title),
14     fLeptonColName("SetMe"),
15     fTrackerTrackColName("SetMe"),
16     fGsfTrackColName("SetMe"),
17     fLeptonPtMin(0),
18     fLeptonPtMax(5000),
19     fLeptonEtaMin(-10),
20     fLeptonEtaMax(10),
21     fTrackPtMin(0),
22     fTrackPtMax(5000),
23     fTrackEtaMin(-10),
24     fTrackEtaMax(10),
25     fLeptonCol(0),
26     fTrackerTrackCol(0),
27     fGsfTrackCol(0)
28     {
29     // Constructor.
30     }
31    
32     //--------------------------------------------------------------------------------------------------
33     void mithep::LeptonPlusIsoTrackSelMod::Process()
34     {
35     // Process entries of the tree.
36    
37     //load the track branches
38     LoadBranch(GetTrackerTrackColName());
39     LoadBranch(GetGsfTrackColName());
40    
41     fNAccCounters->Fill(0);
42    
43     fLeptonCol = GetObjThisEvt<Collection<Particle> >(GetLeptonColName());
44     if (!fLeptonCol ) {
45     this->SendError(kAbortModule, "Process",
46     "Could not obtain collection with name %s!", GetLeptonColName());
47     return;
48     }
49    
50     if (!fLeptonCol && !fGsfTrackCol) {
51     this->SendError(kAbortModule, "Process",
52     "Could not obtain either collections with names %s , %s!",
53     GetTrackerTrackColName(), GetGsfTrackColName());
54     return;
55     }
56    
57     fNAccCounters->Fill(1);
58    
59     UInt_t LeptonCounter = 0;
60     for(UInt_t i=0;i<fLeptonCol->GetEntries();++i) {
61     if (fLeptonCol->At(i)->Pt() >= fLeptonPtMin &&
62     fLeptonCol->At(i)->Pt() <= fLeptonPtMax &&
63     fLeptonCol->At(i)->Eta() >= fLeptonEtaMin &&
64     fLeptonCol->At(i)->Eta() <= fLeptonEtaMax)
65     LeptonCounter++;
66     }
67     if (LeptonCounter == 0) {
68     this->SkipEvent();
69     return;
70     }
71    
72     fNAccCounters->Fill(2);
73    
74     UInt_t TrackCounter = 0;
75     for(UInt_t i=0;i<fTrackerTrackCol->GetEntries();++i) {
76     const Track *trk = fTrackerTrackCol->At(i);
77     if (trk->Pt() >= fTrackPtMin &&
78     trk->Pt() <= fTrackPtMax &&
79     trk->Eta() >= fTrackEtaMin &&
80     trk->Eta() <= fTrackEtaMax) {
81     Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
82     if (iso < 10.0) {
83     //require that the track is not the same object as one of the leptons
84     if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
85     fLeptonCol->At(0)->Phi(),
86     fLeptonCol->At(0)->Eta()) >= 0.3)
87     TrackCounter++;
88     }
89     }
90     }
91     for(UInt_t i=0;i<fGsfTrackCol->GetEntries();++i) {
92     const Track *trk = fGsfTrackCol->At(i);
93     if (trk->Pt() >= fTrackPtMin &&
94     trk->Pt() <= fTrackPtMax &&
95     trk->Eta() >= fTrackEtaMin &&
96     trk->Eta() <= fTrackEtaMax) {
97     Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
98     if (iso < 10.0) {
99     if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
100     fLeptonCol->At(0)->Phi(), fLeptonCol->At(0)->Eta()) >= 0.3)
101     TrackCounter++;
102     }
103     }
104     }
105    
106     if (TrackCounter == 0) {
107     this->SkipEvent();
108     return;
109     }
110    
111     fNAccCounters->Fill(3);
112     }
113    
114     //--------------------------------------------------------------------------------------------------
115     void mithep::LeptonPlusIsoTrackSelMod::SlaveBegin()
116     {
117     // Setup acceptence histogram.
118     ReqBranch(GetTrackerTrackColName(), fTrackerTrackCol);
119     ReqBranch(GetGsfTrackColName(), fGsfTrackCol);
120    
121     AddTH1(fNAccCounters,"hNAccCounters",";cut;#",25,-0.5,24.5);
122     if (1) {
123     TAxis *xa = fNAccCounters->GetXaxis();
124     for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
125     xa->SetBinLabel(i,"unused");
126     xa->SetBinLabel(1,"Enter");
127     xa->SetBinLabel(2,"Objs");
128     xa->SetBinLabel(3,"AtLeastOneLepton");
129     xa->SetBinLabel(4,"IsolatedTrack");
130     xa->SetRangeUser(0,3);
131     }
132     }