ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/JetPlusIsoTrackSelMod.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/JetPlusIsoTrackSelMod.h"
4     #include "MitPhysics/Utils/interface/IsolationTools.h"
5     #include "MitCommon/MathTools/interface/MathUtils.h"
6    
7     using namespace mithep;
8    
9     ClassImp(mithep::JetPlusIsoTrackSelMod)
10    
11     //--------------------------------------------------------------------------------------------------
12     mithep::JetPlusIsoTrackSelMod::JetPlusIsoTrackSelMod(const char *name, const char *title) :
13     BaseSelMod(name,title),
14     fJetColName("SetMe"),
15     fTrackerTrackColName("SetMe"),
16     fGsfTrackColName("SetMe"),
17     fJetPtMin(0),
18     fJetPtMax(5000),
19     fJetEtaMin(-10),
20     fJetEtaMax(10),
21     fTrackPtMin(0),
22     fTrackPtMax(5000),
23     fTrackEtaMin(-10),
24     fTrackEtaMax(10),
25     fJetCol(0),
26     fTrackerTrackCol(0),
27     fGsfTrackCol(0)
28     {
29     // Constructor.
30     }
31    
32     //--------------------------------------------------------------------------------------------------
33     void mithep::JetPlusIsoTrackSelMod::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     fJetCol = GetObjThisEvt<Collection<Jet> >(GetJetColName());
44     if (!fJetCol ) {
45     this->SendError(kAbortModule, "Process",
46     "Could not obtain collection with name %s!", GetJetColName());
47     return;
48     }
49    
50     if (!fJetCol && !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 JetCounter = 0;
60     for(UInt_t i=0;i<fJetCol->GetEntries();++i) {
61     if (fJetCol->At(i)->Pt() >= fJetPtMin &&
62     fJetCol->At(i)->Pt() <= fJetPtMax &&
63     fJetCol->At(i)->Eta() >= fJetEtaMin &&
64     fJetCol->At(i)->Eta() <= fJetEtaMax)
65     JetCounter++;
66     }
67     if (JetCounter == 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 && trk->Pt() <= fTrackPtMax &&
78     trk->Eta() >= fTrackEtaMin && trk->Eta() <= fTrackEtaMax) {
79     Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
80     if (iso < 10.0) {
81     //require that the track is not the same object as one of the leptons
82     if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
83     fJetCol->At(0)->Phi(), fJetCol->At(0)->Eta()) >= 0.3)
84     TrackCounter++;
85     }
86     }
87     }
88     for(UInt_t i=0;i<fGsfTrackCol->GetEntries();++i) {
89     const Track *trk = fGsfTrackCol->At(i);
90     if (trk->Pt() >= fTrackPtMin &&
91     trk->Pt() <= fTrackPtMax &&
92     trk->Eta() >= fTrackEtaMin &&
93     trk->Eta() <= fTrackEtaMax) {
94     Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
95     if (iso < 10.0) {
96     if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
97     fJetCol->At(0)->Phi(), fJetCol->At(0)->Eta()) >= 0.3)
98     TrackCounter++;
99     }
100     }
101     }
102    
103     if (TrackCounter == 0) {
104     this->SkipEvent();
105     return;
106     }
107    
108     fNAccCounters->Fill(3);
109     }
110    
111     //--------------------------------------------------------------------------------------------------
112     void mithep::JetPlusIsoTrackSelMod::SlaveBegin()
113     {
114     // Setup acceptence histogram.
115     ReqBranch(GetTrackerTrackColName(), fTrackerTrackCol);
116     ReqBranch(GetGsfTrackColName(), fGsfTrackCol);
117    
118     AddTH1(fNAccCounters,"hNAccCounters",";cut;#",25,-0.5,24.5);
119     if (1) {
120     TAxis *xa = fNAccCounters->GetXaxis();
121     for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
122     xa->SetBinLabel(i,"unused");
123     xa->SetBinLabel(1,"Enter");
124     xa->SetBinLabel(2,"Objs");
125     xa->SetBinLabel(3,"AtLeastOneJet");
126     xa->SetBinLabel(4,"IsolatedTrack");
127     xa->SetRangeUser(0,3);
128     }
129     }