1 |
loizides |
1.5 |
// $Id: PhotonCleaningMod.cc,v 1.4 2009/01/20 10:28:02 loizides Exp $
|
2 |
sixie |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/PhotonCleaningMod.h"
|
4 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
5 |
loizides |
1.5 |
#include "MitAna/DataTree/interface/ElectronCol.h"
|
6 |
|
|
#include "MitAna/DataTree/interface/PhotonCol.h"
|
7 |
sixie |
1.1 |
#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 |
loizides |
1.3 |
const PhotonCol *GoodPhotons = GetObjThisEvt<PhotonCol>(fGoodPhotonsName);
|
31 |
|
|
const ElectronCol *CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
|
32 |
sixie |
1.1 |
|
33 |
|
|
// create output collection
|
34 |
|
|
PhotonOArr *CleanPhotons = new PhotonOArr;
|
35 |
|
|
CleanPhotons->SetName(fCleanPhotonsName);
|
36 |
|
|
|
37 |
loizides |
1.4 |
// remove any photon that overlaps in eta, phi with an isolated electron.
|
38 |
loizides |
1.3 |
UInt_t n = GoodPhotons->GetEntries();
|
39 |
|
|
for (UInt_t i=0; i<n; ++i) {
|
40 |
sixie |
1.1 |
const Photon *ph = GoodPhotons->At(i);
|
41 |
|
|
|
42 |
|
|
Bool_t isElectronOverlap = false;
|
43 |
|
|
|
44 |
loizides |
1.4 |
// check for overlap with an electron
|
45 |
sixie |
1.1 |
if (CleanElectrons) {
|
46 |
loizides |
1.3 |
UInt_t n2 = CleanElectrons->GetEntries();
|
47 |
|
|
for (UInt_t j=0; j<n2; j++) {
|
48 |
sixie |
1.1 |
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 |
loizides |
1.2 |
// sort according to pt
|
63 |
|
|
CleanPhotons->Sort();
|
64 |
|
|
|
65 |
sixie |
1.1 |
// add to event for other modules to use
|
66 |
|
|
AddObjThisEvt(CleanPhotons);
|
67 |
|
|
}
|