ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonCleaningMod.cc
Revision: 1.5
Committed: Mon Jun 15 15:00:21 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b
Changes since 1.4: +3 -1 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

# Content
1 // $Id: PhotonCleaningMod.cc,v 1.4 2009/01/20 10:28:02 loizides Exp $
2
3 #include "MitPhysics/Mods/interface/PhotonCleaningMod.h"
4 #include "MitCommon/MathTools/interface/MathUtils.h"
5 #include "MitAna/DataTree/interface/ElectronCol.h"
6 #include "MitAna/DataTree/interface/PhotonCol.h"
7 #include "MitPhysics/Init/interface/ModNames.h"
8
9 using namespace mithep;
10
11 ClassImp(mithep::PhotonCleaningMod)
12
13 //--------------------------------------------------------------------------------------------------
14 PhotonCleaningMod::PhotonCleaningMod(const char *name, const char *title) :
15 BaseMod(name,title),
16 fCleanElectronsName(ModNames::gkCleanElectronsName),
17 fGoodPhotonsName(ModNames::gkGoodPhotonsName),
18 fCleanPhotonsName(ModNames::gkCleanPhotonsName),
19 fMinDeltaRToElectron(0.3)
20 {
21 // Constructor.
22 }
23
24 //--------------------------------------------------------------------------------------------------
25 void PhotonCleaningMod::Process()
26 {
27 // Process entries of the tree.
28
29 // get input collections
30 const PhotonCol *GoodPhotons = GetObjThisEvt<PhotonCol>(fGoodPhotonsName);
31 const ElectronCol *CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
32
33 // create output collection
34 PhotonOArr *CleanPhotons = new PhotonOArr;
35 CleanPhotons->SetName(fCleanPhotonsName);
36
37 // remove any photon that overlaps in eta, phi with an isolated electron.
38 UInt_t n = GoodPhotons->GetEntries();
39 for (UInt_t i=0; i<n; ++i) {
40 const Photon *ph = GoodPhotons->At(i);
41
42 Bool_t isElectronOverlap = false;
43
44 // check for overlap with an electron
45 if (CleanElectrons) {
46 UInt_t n2 = CleanElectrons->GetEntries();
47 for (UInt_t j=0; j<n2; j++) {
48 Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),ph->Mom());
49 if (deltaR < fMinDeltaRToElectron) {
50 isElectronOverlap = kTRUE;
51 break;
52 }
53 }
54 }
55
56 if (isElectronOverlap)
57 continue;
58
59 CleanPhotons->Add(ph);
60 }
61
62 // sort according to pt
63 CleanPhotons->Sort();
64
65 // add to event for other modules to use
66 AddObjThisEvt(CleanPhotons);
67 }