ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/PhotonPlusIsoTrackSelMod.cc
Revision: 1.2
Committed: Mon Jun 15 15:00:22 2009 UTC (15 years, 11 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

# Content
1 // $Id: PhotonPlusIsoTrackSelMod.cc,v 1.1 2009/03/22 09:04:13 loizides Exp $
2
3 #include "MitPhysics/SelMods/interface/PhotonPlusIsoTrackSelMod.h"
4 #include "MitPhysics/Utils/interface/IsolationTools.h"
5 #include "MitCommon/MathTools/interface/MathUtils.h"
6 #include "MitAna/DataTree/interface/PhotonCol.h"
7 #include "MitAna/DataTree/interface/TrackCol.h"
8 #include <TH1D.h>
9
10 using namespace mithep;
11
12 ClassImp(mithep::PhotonPlusIsoTrackSelMod)
13
14 //--------------------------------------------------------------------------------------------------
15 mithep::PhotonPlusIsoTrackSelMod::PhotonPlusIsoTrackSelMod(const char *name, const char *title) :
16 BaseSelMod(name,title),
17 fPhotonColName("SetMe"),
18 fTrackerTrackColName("SetMe"),
19 fGsfTrackColName("SetMe"),
20 fPhotonPtMin(0),
21 fPhotonPtMax(5000),
22 fPhotonEtaMin(-10),
23 fPhotonEtaMax(10),
24 fTrackPtMin(0),
25 fTrackPtMax(5000),
26 fTrackEtaMin(-10),
27 fTrackEtaMax(10),
28 fPhotonCol(0),
29 fTrackerTrackCol(0),
30 fGsfTrackCol(0)
31 {
32 // Constructor.
33 }
34
35 //--------------------------------------------------------------------------------------------------
36 void mithep::PhotonPlusIsoTrackSelMod::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 fPhotonCol = GetObjThisEvt<Collection<Photon> >(GetPhotonColName());
47 if (!fPhotonCol ) {
48 this->SendError(kAbortModule, "Process",
49 "Could not obtain collection with name %s!", GetPhotonColName());
50 return;
51 }
52
53 if (!fPhotonCol && !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 PhotonCounter = 0;
63 for(UInt_t i=0;i<fPhotonCol->GetEntries();++i) {
64 if (fPhotonCol->At(i)->Pt() >= fPhotonPtMin &&
65 fPhotonCol->At(i)->Pt() <= fPhotonPtMax &&
66 fPhotonCol->At(i)->Eta() >= fPhotonEtaMin &&
67 fPhotonCol->At(i)->Eta() <= fPhotonEtaMax)
68 PhotonCounter++;
69 }
70 if (PhotonCounter == 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 &&
81 trk->Pt() <= fTrackPtMax &&
82 trk->Eta() >= fTrackEtaMin &&
83 trk->Eta() <= fTrackEtaMax) {
84 Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
85 if (iso < 10.0) {
86 //require that the track is not the same object as one of the leptons
87 if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
88 fPhotonCol->At(0)->Phi(), fPhotonCol->At(0)->Eta()) >= 0.3)
89 TrackCounter++;
90 }
91 }
92 }
93
94 for(UInt_t i=0;i<fGsfTrackCol->GetEntries();++i) {
95 const Track *trk = fGsfTrackCol->At(i);
96 if (trk->Pt() >= fTrackPtMin &&
97 trk->Pt() <= fTrackPtMax &&
98 trk->Eta() >= fTrackEtaMin &&
99 trk->Eta() <= fTrackEtaMax) {
100 Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
101 if (iso < 10.0) {
102 if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
103 fPhotonCol->At(0)->Phi(), fPhotonCol->At(0)->Eta()) >= 0.3)
104 TrackCounter++;
105 }
106 }
107 }
108
109 if (TrackCounter == 0) {
110 this->SkipEvent();
111 return;
112 }
113
114 fNAccCounters->Fill(3);
115 }
116
117 //--------------------------------------------------------------------------------------------------
118 void mithep::PhotonPlusIsoTrackSelMod::SlaveBegin()
119 {
120 // Setup acceptence histogram.
121 ReqBranch(GetTrackerTrackColName(), fTrackerTrackCol);
122 ReqBranch(GetGsfTrackColName(), fGsfTrackCol);
123
124 AddTH1(fNAccCounters,"hNAccCounters",";cut;#",25,-0.5,24.5);
125 if (1) {
126 TAxis *xa = fNAccCounters->GetXaxis();
127 for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
128 xa->SetBinLabel(i,"unused");
129 xa->SetBinLabel(1,"Enter");
130 xa->SetBinLabel(2,"Objs");
131 xa->SetBinLabel(3,"AtLeastOnePhoton");
132 xa->SetBinLabel(4,"IsolatedTrack");
133 xa->SetRangeUser(0,3);
134 }
135 }