1 |
// $Id: MergeLeptonsMod.cc,v 1.3 2009/06/15 15:00:21 loizides Exp $
|
2 |
|
3 |
#include "MitPhysics/Mods/interface/MergeLeptonsMod.h"
|
4 |
#include "MitAna/DataTree/interface/ElectronCol.h"
|
5 |
#include "MitAna/DataTree/interface/MuonCol.h"
|
6 |
#include "MitAna/DataTree/interface/ParticleCol.h"
|
7 |
#include "MitPhysics/Init/interface/ModNames.h"
|
8 |
#include "TH1D.h"
|
9 |
|
10 |
using namespace mithep;
|
11 |
|
12 |
ClassImp(mithep::MergeLeptonsMod)
|
13 |
|
14 |
//--------------------------------------------------------------------------------------------------
|
15 |
mithep::MergeLeptonsMod::MergeLeptonsMod(const char *name, const char *title) :
|
16 |
BaseMod(name,title),
|
17 |
fElName(ModNames::gkCleanElectronsName),
|
18 |
fMuName(ModNames::gkCleanMuonsName),
|
19 |
fMergedName(ModNames::gkMergedLeptonsName),
|
20 |
fElIn(0),
|
21 |
fMuIn(0),
|
22 |
fColOut(0)
|
23 |
{
|
24 |
// Constructor.
|
25 |
}
|
26 |
|
27 |
//--------------------------------------------------------------------------------------------------
|
28 |
void mithep::MergeLeptonsMod::BeginRun()
|
29 |
{
|
30 |
|
31 |
}
|
32 |
|
33 |
//--------------------------------------------------------------------------------------------------
|
34 |
void mithep::MergeLeptonsMod::Process()
|
35 |
{
|
36 |
// Merge the two input collections and publish merged collection.
|
37 |
|
38 |
fElIn = GetObjThisEvt<ElectronCol>(fElName);
|
39 |
fMuIn = GetObjThisEvt<MuonCol>(fMuName);
|
40 |
if(fElIn){;
|
41 |
fRecoWElectrons->Fill(fElIn->GetEntries());
|
42 |
}
|
43 |
if(fMuIn){
|
44 |
fRecoWMuons->Fill(fMuIn->GetEntries());
|
45 |
}
|
46 |
UInt_t nents = 0;
|
47 |
if (fElIn)
|
48 |
nents += fElIn->GetEntries();
|
49 |
if (fMuIn)
|
50 |
nents += fMuIn->GetEntries();
|
51 |
|
52 |
fColOut = new mithep::ParticleOArr(nents, GetMergedName());
|
53 |
|
54 |
if (fElIn)
|
55 |
fColOut->Add(fElIn);
|
56 |
if (fMuIn)
|
57 |
fColOut->Add(fMuIn);
|
58 |
|
59 |
// sort according to pt
|
60 |
fColOut->Sort();
|
61 |
|
62 |
// add to event for other modules to use
|
63 |
AddObjThisEvt(fColOut);
|
64 |
}
|
65 |
|
66 |
//--------------------------------------------------------------------------------------------------
|
67 |
void mithep::MergeLeptonsMod::SlaveBegin()
|
68 |
{
|
69 |
AddTH1(fRecoWMuons,"fRecoWMuons","Number of Reconstructed Muons;N_{muons};#",10,-0.5,9.5);
|
70 |
AddTH1(fRecoWElectrons,"fRecoWElectrons","Number of Reconstructed Electrons;N_{electrons};#",10,-0.5,9.5);
|
71 |
}
|
72 |
//--------------------------------------------------------------------------------------------------
|
73 |
void mithep::MergeLeptonsMod::SlaveTerminate()
|
74 |
{
|
75 |
|
76 |
}
|
77 |
|