ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonCleaningMod.cc
Revision: 1.1
Committed: Sat Nov 29 18:43:25 2008 UTC (16 years, 5 months ago) by sixie
Content type: text/plain
Branch: MAIN
Log Message:
Add Photon ID module

File Contents

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