ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PFTauCleaningMod.cc
Revision: 1.1
Committed: Sun Jul 18 21:15:19 2010 UTC (14 years, 9 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a, Mit_028a, Mit_028, Mit_027, Mit_027a, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, HEAD
Log Message:
adding PF taus

File Contents

# User Rev Content
1 ceballos 1.1 // $Id: PFTauCleaningMod.cc,v 1.4 2009/06/15 15:00:21 loizides Exp $
2    
3     #include "MitPhysics/Mods/interface/PFTauCleaningMod.h"
4     #include "MitCommon/MathTools/interface/MathUtils.h"
5     #include "MitAna/DataTree/interface/ElectronCol.h"
6     #include "MitAna/DataTree/interface/MuonCol.h"
7     #include "MitAna/DataTree/interface/PFTauCol.h"
8     #include "MitPhysics/Init/interface/ModNames.h"
9    
10     using namespace mithep;
11    
12     ClassImp(mithep::PFTauCleaningMod)
13    
14     //--------------------------------------------------------------------------------------------------
15     PFTauCleaningMod::PFTauCleaningMod(const char *name, const char *title) :
16     BaseMod(name,title),
17     fCleanElectronsName(ModNames::gkCleanElectronsName),
18     fCleanMuonsName(ModNames::gkCleanMuonsName),
19     fGoodPFTausName(ModNames::gkGoodPFTausName),
20     fCleanPFTausName(ModNames::gkCleanPFTausName),
21     fMinDeltaRToElectron(0.3),
22     fMinDeltaRToMuon(0.3)
23     {
24     // Constructor.
25     }
26    
27     //--------------------------------------------------------------------------------------------------
28     void PFTauCleaningMod::Process()
29     {
30     // Process entries of the tree.
31    
32     // get input collections
33     const PFTauCol *GoodPFTaus = GetObjThisEvt<PFTauCol>(fGoodPFTausName);
34     const ElectronCol *CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
35     const MuonCol *CleanMuons = GetObjThisEvt<MuonCol>(fCleanMuonsName);
36    
37     // create output collection
38     PFTauOArr *CleanPFTaus = new PFTauOArr;
39     CleanPFTaus->SetName(fCleanPFTausName);
40    
41     // remove any Tau that overlaps in eta, phi with an isolated electron.
42     UInt_t n = GoodPFTaus->GetEntries();
43     for (UInt_t i=0; i<n; ++i) {
44     const PFTau *tau = GoodPFTaus->At(i);
45    
46     Bool_t isElectronOverlap = false;
47    
48     // check for overlap with an electron
49     if (CleanElectrons) {
50     UInt_t n1 = CleanElectrons->GetEntries();
51     for (UInt_t j=0; j<n1; j++) {
52     Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),
53     tau->Mom());
54     if (deltaR < fMinDeltaRToElectron) {
55     isElectronOverlap = kTRUE;
56     break;
57     }
58     }
59     }
60    
61     if (isElectronOverlap)
62     continue;
63    
64     Bool_t isMuonOverlap = false;
65    
66     // check for overlap with an Muon
67     if (CleanMuons) {
68     UInt_t n2 = CleanMuons->GetEntries();
69     for (UInt_t j=0; j<n2; j++) {
70     Double_t deltaR = MathUtils::DeltaR(CleanMuons->At(j)->Mom(),
71     tau->Mom());
72     if (deltaR < fMinDeltaRToMuon) {
73     isMuonOverlap = kTRUE;
74     break;
75     }
76     }
77     }
78    
79     if (isMuonOverlap)
80     continue;
81    
82     CleanPFTaus->Add(tau);
83     }
84    
85     // sort according to pt
86     CleanPFTaus->Sort();
87    
88     // add to event for other modules to use
89     AddObjThisEvt(CleanPFTaus);
90     }