ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonCleaningMod.cc
Revision: 1.8
Committed: Fri Jun 18 06:08:46 2010 UTC (14 years, 10 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, Mit_014c, Mit_014b, HEAD
Changes since 1.7: +4 -4 lines
Log Message:
bug im deltar

File Contents

# Content
1 // $Id: PhotonCleaningMod.cc,v 1.7 2009/11/02 13:39:23 ceballos 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)->SCluster()->Phi(),
49 CleanElectrons->At(j)->SCluster()->Eta(),
50 ph->SCluster()->Phi(),ph->SCluster()->Eta());
51 if (deltaR < fMinDeltaRToElectron) {
52 isElectronOverlap = kTRUE;
53 break;
54 }
55 }
56 }
57
58 if (isElectronOverlap)
59 continue;
60
61 CleanPhotons->Add(ph);
62 }
63
64 // sort according to pt
65 CleanPhotons->Sort();
66
67 // add to event for other modules to use
68 AddObjThisEvt(CleanPhotons);
69 }