Public Member Functions | Private Member Functions | Private Attributes | List of all members
opdet::FlashHypothesisComparison Class Reference

#include <FlashHypothesisComparison.h>

Public Member Functions

 FlashHypothesisComparison ()
 
void SetOutputObjects (TTree *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, const unsigned int, bool fill=true)
 
void RunComparison (const unsigned int, const unsigned int, const FlashHypothesisCollection &, const SimPhotonCounter &, const std::vector< float > &, const std::vector< float > &)
 

Private Member Functions

void FillFlashHypothesisInfo (const FlashHypothesisCollection &, const std::vector< float > &, const std::vector< float > &)
 
void FillSimPhotonCounterInfo (const SimPhotonCounter &, const std::vector< float > &, const std::vector< float > &)
 
void FillComparisonInfo (const FlashHypothesisCollection &, const SimPhotonCounter &)
 

Private Attributes

FlashUtilities fUtil
 
bool fFillTree
 
TTree * fTree
 
TH1F * fHypHist_p
 
TH1F * fSimHist_p
 
TH1F * fCompareHist_p
 
TH1F * fHypHist_l
 
TH1F * fSimHist_l
 
TH1F * fCompareHist_l
 
TH1F * fHypHist_t
 
TH1F * fSimHist_t
 
TH1F * fCompareHist_t
 
unsigned int fRun
 
unsigned int fEvent
 
float fHypPEs_p
 
float fHypPEsError_p
 
float fSimPEs_p
 
float fHypY_p
 
float fSimY_p
 
float fHypRMSY_p
 
float fSimRMSY_p
 
float fHypZ_p
 
float fSimZ_p
 
float fHypRMSZ_p
 
float fSimRMSZ_p
 
float fCompare_p
 
float fHypPEs_l
 
float fHypPEsError_l
 
float fSimPEs_l
 
float fHypY_l
 
float fSimY_l
 
float fHypRMSY_l
 
float fSimRMSY_l
 
float fHypZ_l
 
float fSimZ_l
 
float fHypRMSZ_l
 
float fSimRMSZ_l
 
float fCompare_l
 
float fHypPEs_t
 
float fHypPEsError_t
 
float fSimPEs_t
 
float fHypY_t
 
float fSimY_t
 
float fHypRMSY_t
 
float fSimRMSY_t
 
float fHypZ_t
 
float fSimZ_t
 
float fHypRMSZ_t
 
float fSimRMSZ_t
 
float fCompare_t
 

Detailed Description

Definition at line 25 of file FlashHypothesisComparison.h.

Constructor & Destructor Documentation

opdet::FlashHypothesisComparison::FlashHypothesisComparison ( )
inline

Definition at line 28 of file FlashHypothesisComparison.h.

28 {}

Member Function Documentation

void opdet::FlashHypothesisComparison::FillComparisonInfo ( const FlashHypothesisCollection fhc,
const SimPhotonCounter spc 
)
private

Definition at line 219 of file FlashHypothesisComparison.cxx.

221 {
222  std::vector<float> result_p,result_l,result_t;
223  fCompare_p = fUtil.CompareByError(fhc.GetPromptHypothesis(),spc.PromptPhotonVector(),result_p);
224  fCompare_l = fUtil.CompareByError(fhc.GetLateHypothesis(),spc.LatePhotonVector(),result_l);
225  fCompare_t = fUtil.CompareByError(fhc.GetTotalHypothesis(),spc.TotalPhotonVector(),result_t);
226 
227  for(size_t i=0; i<result_p.size(); i++){
228  fCompareHist_p->SetBinContent(i+1,result_p[i]);
229  fCompareHist_l->SetBinContent(i+1,result_l[i]);
230  fCompareHist_t->SetBinContent(i+1,result_t[i]);
231  }
232 
233 }
float CompareByError(const FlashHypothesis &, const std::vector< float > &, std::vector< float > &)
void opdet::FlashHypothesisComparison::FillFlashHypothesisInfo ( const FlashHypothesisCollection fhc,
const std::vector< float > &  posY,
const std::vector< float > &  posZ 
)
private

Definition at line 163 of file FlashHypothesisComparison.cxx.

166 {
167  fHypPEs_p = fhc.GetPromptHypothesis().GetTotalPEs();
168  fHypPEsError_p = fhc.GetPromptHypothesis().GetTotalPEsError();
169  fUtil.GetPosition(fhc.GetPromptHypothesis().GetHypothesisVector(),posY,fHypY_p,fHypRMSY_p);
170  fUtil.GetPosition(fhc.GetPromptHypothesis().GetHypothesisVector(),posZ,fHypZ_p,fHypRMSZ_p);
171 
172  for(size_t i=0; i<fhc.GetVectorSize(); i++)
173  fHypHist_p->SetBinContent(i+1,fhc.GetPromptHypothesis().GetHypothesis(i));
174 
175  fHypPEs_l = fhc.GetLateHypothesis().GetTotalPEs();
176  fHypPEsError_l = fhc.GetLateHypothesis().GetTotalPEsError();
177  fUtil.GetPosition(fhc.GetLateHypothesis().GetHypothesisVector(),posY,fHypY_l,fHypRMSY_l);
178  fUtil.GetPosition(fhc.GetLateHypothesis().GetHypothesisVector(),posZ,fHypZ_l,fHypRMSZ_l);
179 
180  for(size_t i=0; i<fhc.GetVectorSize(); i++)
181  fHypHist_l->SetBinContent(i+1,fhc.GetLateHypothesis().GetHypothesis(i));
182 
183  fHypPEs_t = fhc.GetTotalHypothesis().GetTotalPEs();
184  fHypPEsError_t = fhc.GetTotalHypothesis().GetTotalPEsError();
185  fUtil.GetPosition(fhc.GetTotalHypothesis().GetHypothesisVector(),posY,fHypY_t,fHypRMSY_t);
186  fUtil.GetPosition(fhc.GetTotalHypothesis().GetHypothesisVector(),posZ,fHypZ_t,fHypRMSZ_t);
187 
188  for(size_t i=0; i<fhc.GetVectorSize(); i++)
189  fHypHist_t->SetBinContent(i+1,fhc.GetLateHypothesis().GetHypothesis(i));
190 }
void GetPosition(const std::vector< float > &, const std::vector< float > &, float &, float &)
void opdet::FlashHypothesisComparison::FillSimPhotonCounterInfo ( const SimPhotonCounter spc,
const std::vector< float > &  posY,
const std::vector< float > &  posZ 
)
private

Definition at line 192 of file FlashHypothesisComparison.cxx.

195 {
196  fSimPEs_p = spc.PromptPhotonTotal();
197  fUtil.GetPosition(spc.PromptPhotonVector(),posY,fSimY_p,fSimRMSY_p);
198  fUtil.GetPosition(spc.PromptPhotonVector(),posZ,fSimZ_p,fSimRMSZ_p);
199 
200  for(size_t i=0; i<spc.PromptPhotonVector().size(); i++)
201  fSimHist_p->SetBinContent(i+1,spc.PromptPhotonVector()[i]);
202 
203  fSimPEs_l = spc.LatePhotonTotal();
204  fUtil.GetPosition(spc.LatePhotonVector(),posY,fSimY_l,fSimRMSY_l);
205  fUtil.GetPosition(spc.LatePhotonVector(),posZ,fSimZ_l,fSimRMSZ_l);
206 
207  for(size_t i=0; i<spc.LatePhotonVector().size(); i++)
208  fSimHist_l->SetBinContent(i+1,spc.LatePhotonVector()[i]);
209 
211  fUtil.GetPosition(spc.TotalPhotonVector(),posY,fSimY_t,fSimRMSY_t);
212  fUtil.GetPosition(spc.TotalPhotonVector(),posZ,fSimZ_t,fSimRMSZ_t);
213 
214  for(size_t i=0; i<spc.GetVectorSize(); i++)
215  fSimHist_t->SetBinContent(i+1,spc.TotalPhotonVector(i));
216 
217 }
void GetPosition(const std::vector< float > &, const std::vector< float > &, float &, float &)
void opdet::FlashHypothesisComparison::RunComparison ( const unsigned int  run,
const unsigned int  event,
const FlashHypothesisCollection fhc,
const SimPhotonCounter spc,
const std::vector< float > &  posY,
const std::vector< float > &  posZ 
)

Definition at line 139 of file FlashHypothesisComparison.cxx.

145 {
146  if(fhc.GetVectorSize() != (unsigned int)fHypHist_p->GetNbinsX() ||
147  fhc.GetVectorSize() != spc.PromptPhotonVector().size() ||
148  fhc.GetVectorSize() != posY.size() ||
149  fhc.GetVectorSize() != posZ.size() ){
150  std::cout << (unsigned int)fHypHist_p->GetNbinsX() << " " << spc.PromptPhotonVector().size() << " " << posY.size() << " " << posZ.size() << std::endl;
151  throw std::runtime_error("ERROR in FlashHypothesisComparison: Mismatch in vector sizes.");
152  }
153  fRun = run;
154  fEvent = event;
155 
156  FillFlashHypothesisInfo(fhc,posY,posZ);
157  FillSimPhotonCounterInfo(spc,posY,posZ);
158  FillComparisonInfo(fhc,spc);
159 
160  if(fFillTree) fTree->Fill();
161 }
void FillSimPhotonCounterInfo(const SimPhotonCounter &, const std::vector< float > &, const std::vector< float > &)
void FillComparisonInfo(const FlashHypothesisCollection &, const SimPhotonCounter &)
void FillFlashHypothesisInfo(const FlashHypothesisCollection &, const std::vector< float > &, const std::vector< float > &)
QTextStream & endl(QTextStream &s)
void opdet::FlashHypothesisComparison::SetOutputObjects ( TTree *  tree,
TH1F *  h_h_p,
TH1F *  h_s_p,
TH1F *  h_c_p,
TH1F *  h_h_l,
TH1F *  h_s_l,
TH1F *  h_c_l,
TH1F *  h_h_t,
TH1F *  h_s_t,
TH1F *  h_c_t,
const unsigned int  n_opdet,
bool  fill = true 
)

Title: FlashHypothesisComparison Class Author: Wes Ketchum (wketc.nosp@m.hum@.nosp@m.lanl..nosp@m.gov)

Description: Class for comparing a flash hypothesis to MC truth (via SimPhotonCounter). Needs a flash hypothesis and a SimPhotonCounter object as input. Outputs a Tree with relevent info.

Definition at line 22 of file FlashHypothesisComparison.cxx.

28 {
29  fTree = tree;
30  fFillTree = fill;
31  fTree->SetName("ctree");
32 
33  fTree->Branch("run",&fRun,"run/i");
34  fTree->Branch("event",&fEvent,"event/i");
35 
36  fHypHist_p = h_h_p;
37  fSimHist_p = h_s_p;
38  fCompareHist_p = h_c_p;
39 
40  fHypHist_p->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
41  fSimHist_p->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
42  fCompareHist_p->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
43 
44  fHypHist_p->SetNameTitle("hHypHist_p","Hypothesis (Prompt);Opdet;PEs");
45  fSimHist_p->SetNameTitle("hSimHist_p","SimPhoton (Prompt);Opdet;PEs");
46  fCompareHist_p->SetNameTitle("hCompareHist_p","Comparison (Hyp - Sim) (Prompt);Opdet;PEs");
47 
48  fTree->Branch("hyp_PEs_p",&fHypPEs_p,"hyp_PEs_p/F");
49  fTree->Branch("hyp_PEsError_p",&fHypPEsError_p,"hyp_PEsError_p/F");
50  fTree->Branch("sim_PEs_p",&fSimPEs_p,"sim_PEs_p/F");
51 
52  fTree->Branch("hyp_Y_p",&fHypY_p,"hyp_Y_p/F");
53  fTree->Branch("sim_Y_p",&fSimY_p,"sim_Y_p/F");
54 
55  fTree->Branch("hyp_RMSY_p",&fHypRMSY_p,"hyp_RMSY_p/F");
56  fTree->Branch("sim_RMSY_p",&fSimRMSY_p,"sim_RMSY_p/F");
57 
58  fTree->Branch("hyp_Z_p",&fHypZ_p,"hyp_Z_p/F");
59  fTree->Branch("sim_Z_p",&fSimZ_p,"sim_Z_p/F");
60 
61  fTree->Branch("hyp_RMSZ_p",&fHypRMSZ_p,"hyp_RMSZ_p/F");
62  fTree->Branch("sim_RMSZ_p",&fSimRMSZ_p,"sim_RMSZ_p/F");
63 
64  fTree->Branch("comp_total_p",&fCompare_p,"comp_total_p/F");
65 
66  fTree->Branch("hHypHist_p",&fHypHist_p);
67  fTree->Branch("hSimHist_p",&fSimHist_p);
68  fTree->Branch("hCompareHist_p",&fCompareHist_p);
69 
70  fHypHist_l = h_h_l;
71  fSimHist_l = h_s_l;
72  fCompareHist_l = h_c_l;
73 
74  fHypHist_l->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
75  fSimHist_l->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
76  fCompareHist_l->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
77 
78  fHypHist_l->SetNameTitle("hHypHist_l","Hypothesis (Late);Opdet;PEs");
79  fSimHist_l->SetNameTitle("hSimHist_l","SimPhoton (Late);Opdet;PEs");
80  fCompareHist_l->SetNameTitle("hCompareHist_l","Comparison (Hyp - Sim) (Late);Opdet;PEs");
81 
82  fTree->Branch("hyp_PEs_l",&fHypPEs_l,"hyp_PEs_l/F");
83  fTree->Branch("hyp_PEsError_l",&fHypPEsError_l,"hyp_PEsError_l/F");
84  fTree->Branch("sim_PEs_l",&fSimPEs_l,"sim_PEs_l/F");
85 
86  fTree->Branch("hyp_Y_l",&fHypY_l,"hyp_Y_l/F");
87  fTree->Branch("sim_Y_l",&fSimY_l,"sim_Y_l/F");
88 
89  fTree->Branch("hyp_RMSY_l",&fHypRMSY_l,"hyp_RMSY_l/F");
90  fTree->Branch("sim_RMSY_l",&fSimRMSY_l,"sim_RMSY_l/F");
91 
92  fTree->Branch("hyp_Z_l",&fHypZ_l,"hyp_Z_l/F");
93  fTree->Branch("sim_Z_l",&fSimZ_l,"sim_Z_l/F");
94 
95  fTree->Branch("hyp_RMSZ_l",&fHypRMSZ_l,"hyp_RMSZ_l/F");
96  fTree->Branch("sim_RMSZ_l",&fSimRMSZ_l,"sim_RMSZ_l/F");
97 
98  fTree->Branch("comp_total_l",&fCompare_l,"comp_total_l/F");
99 
100  fTree->Branch("hHypHist_l",&fHypHist_l);
101  fTree->Branch("hSimHist_l",&fSimHist_l);
102  fTree->Branch("hCompareHist_l",&fCompareHist_l);
103 
104  fHypHist_t = h_h_t;
105  fSimHist_t = h_s_t;
106  fCompareHist_t = h_c_t;
107 
108  fHypHist_t->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
109  fSimHist_t->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
110  fCompareHist_t->SetBins(n_opdet,-0.5,(float)n_opdet - 0.5);
111 
112  fHypHist_t->SetNameTitle("hHypHist_t","Hypothesis (Total);Opdet;PEs");
113  fSimHist_t->SetNameTitle("hSimHist_t","SimPhoton (Total);Opdet;PEs");
114  fCompareHist_t->SetNameTitle("hCompareHist_t","Comparison (Hyp - Sim) (Total);Opdet;PEs");
115 
116  fTree->Branch("hyp_PEs_t",&fHypPEs_t,"hyp_PEs_t/F");
117  fTree->Branch("hyp_PEsError_t",&fHypPEsError_t,"hyp_PEsError_t/F");
118  fTree->Branch("sim_PEs_t",&fSimPEs_t,"sim_PEs_t/F");
119 
120  fTree->Branch("hyp_Y_t",&fHypY_t,"hyp_Y_t/F");
121  fTree->Branch("sim_Y_t",&fSimY_t,"sim_Y_t/F");
122 
123  fTree->Branch("hyp_RMSY_t",&fHypRMSY_t,"hyp_RMSY_t/F");
124  fTree->Branch("sim_RMSY_t",&fSimRMSY_t,"sim_RMSY_t/F");
125 
126  fTree->Branch("hyp_Z_t",&fHypZ_t,"hyp_Z_t/F");
127  fTree->Branch("sim_Z_t",&fSimZ_t,"sim_Z_t/F");
128 
129  fTree->Branch("hyp_RMSZ_t",&fHypRMSZ_t,"hyp_RMSZ_t/F");
130  fTree->Branch("sim_RMSZ_t",&fSimRMSZ_t,"sim_RMSZ_t/F");
131 
132  fTree->Branch("comp_total_t",&fCompare_t,"comp_total_t/F");
133 
134  fTree->Branch("hHypHist_t",&fHypHist_t);
135  fTree->Branch("hSimHist_t",&fSimHist_t);
136  fTree->Branch("hCompareHist_t",&fCompareHist_t);
137 }
def fill(s)
Definition: translator.py:93

Member Data Documentation

float opdet::FlashHypothesisComparison::fCompare_l
private

Definition at line 99 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fCompare_p
private

Definition at line 86 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fCompare_t
private

Definition at line 112 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fCompareHist_l
private

Definition at line 67 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fCompareHist_p
private

Definition at line 64 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fCompareHist_t
private

Definition at line 70 of file FlashHypothesisComparison.h.

unsigned int opdet::FlashHypothesisComparison::fEvent
private

Definition at line 73 of file FlashHypothesisComparison.h.

bool opdet::FlashHypothesisComparison::fFillTree
private

Definition at line 59 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fHypHist_l
private

Definition at line 65 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fHypHist_p
private

Definition at line 62 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fHypHist_t
private

Definition at line 68 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypPEs_l
private

Definition at line 88 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypPEs_p
private

Definition at line 75 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypPEs_t
private

Definition at line 101 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypPEsError_l
private

Definition at line 89 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypPEsError_p
private

Definition at line 76 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypPEsError_t
private

Definition at line 102 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypRMSY_l
private

Definition at line 93 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypRMSY_p
private

Definition at line 80 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypRMSY_t
private

Definition at line 106 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypRMSZ_l
private

Definition at line 97 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypRMSZ_p
private

Definition at line 84 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypRMSZ_t
private

Definition at line 110 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypY_l
private

Definition at line 91 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypY_p
private

Definition at line 78 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypY_t
private

Definition at line 104 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypZ_l
private

Definition at line 95 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypZ_p
private

Definition at line 82 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fHypZ_t
private

Definition at line 108 of file FlashHypothesisComparison.h.

unsigned int opdet::FlashHypothesisComparison::fRun
private

Definition at line 72 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fSimHist_l
private

Definition at line 66 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fSimHist_p
private

Definition at line 63 of file FlashHypothesisComparison.h.

TH1F* opdet::FlashHypothesisComparison::fSimHist_t
private

Definition at line 69 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimPEs_l
private

Definition at line 90 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimPEs_p
private

Definition at line 77 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimPEs_t
private

Definition at line 103 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimRMSY_l
private

Definition at line 94 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimRMSY_p
private

Definition at line 81 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimRMSY_t
private

Definition at line 107 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimRMSZ_l
private

Definition at line 98 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimRMSZ_p
private

Definition at line 85 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimRMSZ_t
private

Definition at line 111 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimY_l
private

Definition at line 92 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimY_p
private

Definition at line 79 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimY_t
private

Definition at line 105 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimZ_l
private

Definition at line 96 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimZ_p
private

Definition at line 83 of file FlashHypothesisComparison.h.

float opdet::FlashHypothesisComparison::fSimZ_t
private

Definition at line 109 of file FlashHypothesisComparison.h.

TTree* opdet::FlashHypothesisComparison::fTree
private

Definition at line 60 of file FlashHypothesisComparison.h.

FlashUtilities opdet::FlashHypothesisComparison::fUtil
private

Definition at line 46 of file FlashHypothesisComparison.h.


The documentation for this class was generated from the following files: