-
Notifications
You must be signed in to change notification settings - Fork 1
/
HistMuCapTrkResolution.cpp
62 lines (47 loc) · 2.34 KB
/
HistMuCapTrkResolution.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Andrei Gaponenko, 2013
#include "HistMuCapTrkResolution.h"
#include "TH1.h"
#include "TProfile.h"
#include "HistogramFactory.h"
#include "ConfigFile.h"
#include "MuCapUtilities.h"
//================================================================
void HistMuCapTrkResolution::init(HistogramFactory& hf,
const std::string& hdir,
const ConfigFile& conf)
{
hGlobalResolution_ = hf.DefineTH1D(hdir, "globalRes", "Momentum resolution in the fiducial region", 300, -100., 50.);
hGlobalResolution_->GetXaxis()->SetTitle("pmc [MeV/c]");
hMomResVsMom_ = hf.DefineTProfile(hdir, "momResVsMom", "Momentum resolution vs MC momentum", 450, 0., 450., "s");
hMomResVsMom_->GetXaxis()->SetTitle("pmc [MeV/c]");
hMomResVsMom_->GetYaxis()->SetTitle("prec-pmc [MeV/c]");
hMomResVsCosth_ = hf.DefineTProfile(hdir, "momResVsCosth", "Momentum resolution vs MC cos(theta)", 100, -1., 1., "s");
hMomResVsCosth_->GetXaxis()->SetTitle("cos(theta) MC");
hMomResVsCosth_->GetYaxis()->SetTitle("prec-pmc [MeV/c]");
hMomBias2DMC_ = hf.DefineTProfile2D(hdir, "momBias2DMC", "Momentum bias in MC (p,costh)", 450, 0., 450., 100, -1., 1., "s");
hMomBias2DMC_->GetXaxis()->SetTitle("pmc [MeV/c]");
hMomBias2DMC_->GetYaxis()->SetTitle("cos(theta) MC");
hMomBias2DMC_->SetOption("colz");
hMomBias2DReco_ = hf.DefineTProfile2D(hdir, "momBias2DReco", "Momentum bias in reco (p,costh)", 450, 0., 450., 100, -1., 1., "s");
hMomBias2DReco_->GetXaxis()->SetTitle("prec [MeV/c]");
hMomBias2DReco_->GetYaxis()->SetTitle("cos(theta) rec");
hMomBias2DReco_->SetOption("colz");
}
//================================================================
void HistMuCapTrkResolution::fill(const EventClass& evt, int iRecoTrack)
{
const unsigned imcvtxStart = evt.iCaptureMcVtxStart;
if(imcvtxStart != -1) {
const double ptrue = evt.mcvertex_ptot[imcvtxStart];
const double costrue = evt.mcvertex_costh[imcvtxStart];
const double prec = evt.ptot[iRecoTrack];
const double cosrec = evt.costh[iRecoTrack];
const double dp = prec - ptrue;
hGlobalResolution_->Fill(dp);
hMomResVsMom_->Fill(ptrue, dp);
hMomResVsCosth_->Fill(costrue, dp);
hMomBias2DMC_->Fill(ptrue, costrue, dp);
hMomBias2DReco_->Fill(prec, cosrec, dp);
}
}
//================================================================