ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/JetPlusIsoTrackSelMod.cc
Revision: 1.2
Committed: Mon Jun 15 15:00:22 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009b
Changes since 1.1: +4 -1 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

# User Rev Content
1 loizides 1.2 // $Id: JetPlusIsoTrackSelMod.cc,v 1.1 2009/03/22 09:04:13 loizides Exp $
2 loizides 1.1
3     #include "MitPhysics/SelMods/interface/JetPlusIsoTrackSelMod.h"
4     #include "MitPhysics/Utils/interface/IsolationTools.h"
5     #include "MitCommon/MathTools/interface/MathUtils.h"
6 loizides 1.2 #include "MitAna/DataTree/interface/JetCol.h"
7     #include "MitAna/DataTree/interface/TrackCol.h"
8     #include <TH1D.h>
9 loizides 1.1
10     using namespace mithep;
11    
12     ClassImp(mithep::JetPlusIsoTrackSelMod)
13    
14     //--------------------------------------------------------------------------------------------------
15     mithep::JetPlusIsoTrackSelMod::JetPlusIsoTrackSelMod(const char *name, const char *title) :
16     BaseSelMod(name,title),
17     fJetColName("SetMe"),
18     fTrackerTrackColName("SetMe"),
19     fGsfTrackColName("SetMe"),
20     fJetPtMin(0),
21     fJetPtMax(5000),
22     fJetEtaMin(-10),
23     fJetEtaMax(10),
24     fTrackPtMin(0),
25     fTrackPtMax(5000),
26     fTrackEtaMin(-10),
27     fTrackEtaMax(10),
28     fJetCol(0),
29     fTrackerTrackCol(0),
30     fGsfTrackCol(0)
31     {
32     // Constructor.
33     }
34    
35     //--------------------------------------------------------------------------------------------------
36     void mithep::JetPlusIsoTrackSelMod::Process()
37     {
38     // Process entries of the tree.
39    
40     //load the track branches
41     LoadBranch(GetTrackerTrackColName());
42     LoadBranch(GetGsfTrackColName());
43    
44     fNAccCounters->Fill(0);
45    
46     fJetCol = GetObjThisEvt<Collection<Jet> >(GetJetColName());
47     if (!fJetCol ) {
48     this->SendError(kAbortModule, "Process",
49     "Could not obtain collection with name %s!", GetJetColName());
50     return;
51     }
52    
53     if (!fJetCol && !fGsfTrackCol) {
54     this->SendError(kAbortModule, "Process",
55     "Could not obtain either collections with names %s , %s!",
56     GetTrackerTrackColName(), GetGsfTrackColName());
57     return;
58     }
59    
60     fNAccCounters->Fill(1);
61    
62     UInt_t JetCounter = 0;
63     for(UInt_t i=0;i<fJetCol->GetEntries();++i) {
64     if (fJetCol->At(i)->Pt() >= fJetPtMin &&
65     fJetCol->At(i)->Pt() <= fJetPtMax &&
66     fJetCol->At(i)->Eta() >= fJetEtaMin &&
67     fJetCol->At(i)->Eta() <= fJetEtaMax)
68     JetCounter++;
69     }
70     if (JetCounter == 0) {
71     this->SkipEvent();
72     return;
73     }
74    
75     fNAccCounters->Fill(2);
76    
77     UInt_t TrackCounter = 0;
78     for(UInt_t i=0;i<fTrackerTrackCol->GetEntries();++i) {
79     const Track *trk = fTrackerTrackCol->At(i);
80     if (trk->Pt() >= fTrackPtMin && trk->Pt() <= fTrackPtMax &&
81     trk->Eta() >= fTrackEtaMin && trk->Eta() <= fTrackEtaMax) {
82     Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
83     if (iso < 10.0) {
84     //require that the track is not the same object as one of the leptons
85     if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
86     fJetCol->At(0)->Phi(), fJetCol->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     fJetCol->At(0)->Phi(), fJetCol->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::JetPlusIsoTrackSelMod::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,"AtLeastOneJet");
129     xa->SetBinLabel(4,"IsolatedTrack");
130     xa->SetRangeUser(0,3);
131     }
132     }