ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/TauCleaningMod.cc
Revision: 1.1
Committed: Wed Apr 8 10:11:44 2009 UTC (16 years, 1 month ago) by ceballos
Content type: text/plain
Branch: MAIN
Log Message:
new tau selection

File Contents

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