ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/PhotonPlusIsoTrackSelMod.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

# Content
1 // $Id: $
2
3 #include "MitPhysics/SelMods/interface/PhotonPlusIsoTrackSelMod.h"
4 #include "MitPhysics/Utils/interface/IsolationTools.h"
5 #include "MitCommon/MathTools/interface/MathUtils.h"
6
7 using namespace mithep;
8
9 ClassImp(mithep::PhotonPlusIsoTrackSelMod)
10
11 //--------------------------------------------------------------------------------------------------
12 mithep::PhotonPlusIsoTrackSelMod::PhotonPlusIsoTrackSelMod(const char *name, const char *title) :
13 BaseSelMod(name,title),
14 fPhotonColName("SetMe"),
15 fTrackerTrackColName("SetMe"),
16 fGsfTrackColName("SetMe"),
17 fPhotonPtMin(0),
18 fPhotonPtMax(5000),
19 fPhotonEtaMin(-10),
20 fPhotonEtaMax(10),
21 fTrackPtMin(0),
22 fTrackPtMax(5000),
23 fTrackEtaMin(-10),
24 fTrackEtaMax(10),
25 fPhotonCol(0),
26 fTrackerTrackCol(0),
27 fGsfTrackCol(0)
28 {
29 // Constructor.
30 }
31
32 //--------------------------------------------------------------------------------------------------
33 void mithep::PhotonPlusIsoTrackSelMod::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 fPhotonCol = GetObjThisEvt<Collection<Photon> >(GetPhotonColName());
44 if (!fPhotonCol ) {
45 this->SendError(kAbortModule, "Process",
46 "Could not obtain collection with name %s!", GetPhotonColName());
47 return;
48 }
49
50 if (!fPhotonCol && !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 PhotonCounter = 0;
60 for(UInt_t i=0;i<fPhotonCol->GetEntries();++i) {
61 if (fPhotonCol->At(i)->Pt() >= fPhotonPtMin &&
62 fPhotonCol->At(i)->Pt() <= fPhotonPtMax &&
63 fPhotonCol->At(i)->Eta() >= fPhotonEtaMin &&
64 fPhotonCol->At(i)->Eta() <= fPhotonEtaMax)
65 PhotonCounter++;
66 }
67 if (PhotonCounter == 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 fPhotonCol->At(0)->Phi(), fPhotonCol->At(0)->Eta()) >= 0.3)
86 TrackCounter++;
87 }
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 fPhotonCol->At(0)->Phi(), fPhotonCol->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::PhotonPlusIsoTrackSelMod::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,"AtLeastOnePhoton");
129 xa->SetBinLabel(4,"IsolatedTrack");
130 xa->SetRangeUser(0,3);
131 }
132 }