-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathPlotCaloClusterEnergy_RecoVsTrue.C
More file actions
39 lines (30 loc) · 1.35 KB
/
PlotCaloClusterEnergy_RecoVsTrue.C
File metadata and controls
39 lines (30 loc) · 1.35 KB
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
//
// An example of how to plot reco vs true
// This uses cut functions defined in common_cuts.hh
//
#include "EventNtuple/rooutil/inc/RooUtil.hh"
#include "EventNtuple/rooutil/inc/common_cuts.hh"
#include "TH2F.h"
using namespace rooutil;
void PlotCaloClusterEnergy_RecoVsTrue(std::string filename) {
// Create the histogram you want to fill
TH2F* hCaloClusterEnergy_RecoVsTrue = new TH2F("hCaloClusterEnergy_RecoVsTrue", "Energy (all clusters, Reco vs true)", 110,0,110, 110,0,110);
hCaloClusterEnergy_RecoVsTrue->SetXTitle("Reco Energy [MeV]");
hCaloClusterEnergy_RecoVsTrue->SetYTitle("True Energy [MeV]");
// Set up RooUtil
RooUtil util(filename);
// Loop through the events
for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) {
// Get the next event
auto& event = util.GetEvent(i_event);
// Get the calo clusters from the event and make sure they have both a reco and MC object
auto calo_clusters = event.GetCaloClusters([](CaloCluster& cluster){ return has_mc_cluster(cluster) && has_reco_cluster(cluster); });
// Loop through the e_minus tracks
for (auto& calo_cluster : calo_clusters) {
// Fill the histogram
hCaloClusterEnergy_RecoVsTrue->Fill(calo_cluster.calocluster->energyDep_, calo_cluster.caloclustermc->etot);
}
}
// Draw the histogram
hCaloClusterEnergy_RecoVsTrue->Draw("COLZ");
}