ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonCleaningMod.cc
Revision: 1.3
Committed: Wed Dec 10 21:19:25 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.2: +7 -5 lines
Log Message:
Use const input collections.

File Contents

# User Rev Content
1 loizides 1.3 // $Id: PhotonCleaningMod.cc,v 1.2 2008/12/10 11:44:33 loizides Exp $
2 sixie 1.1
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 loizides 1.3 const PhotonCol *GoodPhotons = GetObjThisEvt<PhotonCol>(fGoodPhotonsName);
29     const ElectronCol *CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
30 sixie 1.1
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 loizides 1.3 UInt_t n = GoodPhotons->GetEntries();
37     for (UInt_t i=0; i<n; ++i) {
38 sixie 1.1 const Photon *ph = GoodPhotons->At(i);
39    
40     Bool_t isElectronOverlap = false;
41    
42     //Check for overlap with an electron
43     if (CleanElectrons) {
44 loizides 1.3 UInt_t n2 = CleanElectrons->GetEntries();
45     for (UInt_t j=0; j<n2; j++) {
46 sixie 1.1 Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),ph->Mom());
47     if (deltaR < fMinDeltaRToElectron) {
48     isElectronOverlap = kTRUE;
49     break;
50     }
51     }
52     }
53    
54     if (isElectronOverlap)
55     continue;
56    
57     CleanPhotons->Add(ph);
58     }
59    
60 loizides 1.2 // sort according to pt
61     CleanPhotons->Sort();
62    
63 sixie 1.1 // add to event for other modules to use
64     AddObjThisEvt(CleanPhotons);
65     }