1 |
bendavid |
1.1 |
// $Id: MVASystematicsMod.cc,v 1.1 2011/11/18 19:10:43 fabstoec Exp $
|
2 |
|
|
|
3 |
|
|
#include <TMath.h>
|
4 |
|
|
#include <TH1D.h>
|
5 |
|
|
#include <TH2D.h>
|
6 |
|
|
#include <TNtuple.h>
|
7 |
|
|
#include <TRandom3.h>
|
8 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
9 |
|
|
#include "MitAna/DataUtil/interface/Debug.h"
|
10 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
11 |
|
|
#include "MitAna/DataTree/interface/TrackCol.h"
|
12 |
|
|
#include "MitAna/DataTree/interface/VertexCol.h"
|
13 |
|
|
#include "MitAna/DataTree/interface/PhotonCol.h"
|
14 |
|
|
#include "MitPhysics/Mods/interface/MVASystematicsMod.h"
|
15 |
|
|
#include "MitAna/DataTree/interface/BeamSpotCol.h"
|
16 |
|
|
#include "FWCore/ParameterSet/interface/FileInPath.h"
|
17 |
|
|
|
18 |
|
|
#include "MitPhysics/Utils/interface/IsolationTools.h"
|
19 |
|
|
#include "MitPhysics/Utils/interface/PhotonTools.h"
|
20 |
|
|
|
21 |
|
|
#include <iostream>
|
22 |
|
|
#include <sstream>
|
23 |
|
|
|
24 |
|
|
using namespace mithep;
|
25 |
|
|
|
26 |
|
|
ClassImp(mithep::MVASystematicsMod)
|
27 |
|
|
|
28 |
|
|
//--------------------------------------------------------------------------------------------------
|
29 |
|
|
MVASystematicsMod::MVASystematicsMod(const char *name, const char *title) :
|
30 |
|
|
BaseMod (name,title),
|
31 |
|
|
|
32 |
|
|
// define all the Branches to load
|
33 |
|
|
fMCParticleName (Names::gkMCPartBrn),
|
34 |
|
|
|
35 |
|
|
// ----------------------------------------
|
36 |
|
|
// collections....
|
37 |
|
|
fMCParticles (0),
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
fIsData (false),
|
40 |
|
|
|
41 |
|
|
fTupleName("hMVAtuple")
|
42 |
|
|
|
43 |
|
|
{
|
44 |
|
|
// Constructor.
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
//--------------------------------------------------------------------------------------------------
|
48 |
|
|
void MVASystematicsMod::Begin()
|
49 |
|
|
{
|
50 |
|
|
// Run startup code on the client machine. For this module, we dont do anything here.
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
//--------------------------------------------------------------------------------------------------
|
54 |
|
|
void MVASystematicsMod::Process()
|
55 |
|
|
{
|
56 |
|
|
IncNEventsProcessed();
|
57 |
|
|
if( !fIsData )
|
58 |
|
|
LoadBranch(fMCParticleName);
|
59 |
|
|
|
60 |
|
|
Float_t _pth = -100.;
|
61 |
|
|
Float_t _y = -100.;
|
62 |
|
|
Float_t _genmass = -100.;
|
63 |
|
|
if( !fIsData ) FindHiggsPtAndY(_pth, _y, _genmass);
|
64 |
|
|
|
65 |
|
|
hMVAtuple->Fill(_pth, _y, _genmass);
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
return;
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
//--------------------------------------------------------------------------------------------------
|
72 |
|
|
void MVASystematicsMod::SlaveBegin()
|
73 |
|
|
{
|
74 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
75 |
|
|
// we typically initialize histograms and other analysis objects and request
|
76 |
|
|
// branches or objects created by earlier modules.
|
77 |
|
|
|
78 |
|
|
if (!fIsData) {
|
79 |
|
|
ReqBranch(fMCParticleName, fMCParticles);
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
hMVAtuple = new TNtuple(fTupleName.Data(),fTupleName.Data(),"hpt:hy:hm");
|
83 |
|
|
|
84 |
|
|
AddOutput(hMVAtuple);
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
//--------------------------------------------------------------------------------------------------
|
88 |
|
|
void MVASystematicsMod::SlaveTerminate()
|
89 |
|
|
{
|
90 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this
|
91 |
|
|
// module, we dont do anything here.
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
//--------------------------------------------------------------------------------------------------
|
95 |
|
|
void MVASystematicsMod::Terminate()
|
96 |
|
|
{
|
97 |
|
|
// Run finishing code on the client computer. For this module, we dont do
|
98 |
|
|
// anything here.
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
// ----------------------------------------------------------------------------------------
|
102 |
|
|
// some helpfer functions....
|
103 |
|
|
void MVASystematicsMod::FindHiggsPtAndY(Float_t& pt, Float_t& Y, Float_t& mass) {
|
104 |
|
|
|
105 |
|
|
pt = -999.;
|
106 |
|
|
Y = -999;
|
107 |
|
|
mass = -999.;
|
108 |
|
|
|
109 |
|
|
// loop over all GEN particles and look for status 1 photons
|
110 |
|
|
for(UInt_t i=0; i<fMCParticles->GetEntries(); ++i) {
|
111 |
|
|
const MCParticle* p = fMCParticles->At(i);
|
112 |
|
|
if( p->Is(MCParticle::kH) ) {
|
113 |
|
|
pt=p->Pt();
|
114 |
|
|
Y = p->Rapidity();
|
115 |
|
|
mass = p->Mass();
|
116 |
|
|
break;
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
return;
|
121 |
|
|
}
|