All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OpFlashAnaAlg.cxx
Go to the documentation of this file.
2 
3 #include "TTree.h"
4 
5 void opdet::OpFlashAnaAlg::SetOpFlashTree(TTree* tree, bool makeOpDetPEHist)
6 {
7  fOpFlashTree = tree;
8  fMakeOpDetPEHist = makeOpDetPEHist;
9 
10  fOpFlashTree->Branch(fOpFlashTree->GetName(),
12  fOpFlashAnaStruct.LeafList.c_str());
13  if(fMakeOpDetPEHist){
14  fOpFlashAnaStruct.FlashOpDetPEHist->SetName("hOpDetPEs");
15  fOpFlashAnaStruct.FlashOpDetPEHist->SetTitle("PEs per Optical Detector; OpDet Number; PE");
16  fOpFlashTree->Branch("flash_OpDetPEHist","TH1D",&(fOpFlashAnaStruct.FlashOpDetPEHist));
17  }
18 
19 }
20 
22 {
23  fOpHitTree = tree;
24  fOpHitTree->Branch(fOpHitTree->GetName(),
25  &fOpHitAnaStruct,
26  fOpHitAnaStruct.LeafList.c_str());
27 }
28 
29 void opdet::OpFlashAnaAlg::FillOpFlashes(const std::vector<recob::OpFlash>& flashVector)
30 {
31  if(fOpFlashTree) FillOpFlashTree(flashVector);
32 }
33 
34 void opdet::OpFlashAnaAlg::FillOpHits(const std::vector<recob::OpHit>& hitVector)
35 {
36  if(fOpHitTree) FillOpHitTree(hitVector);
37 }
38 
39 void opdet::OpFlashAnaAlg::FillOpFlashTree(const std::vector<recob::OpFlash>& flashVector)
40 {
41  for(auto const& flash : flashVector){
42 
43  fOpFlashAnaStruct.FlashTime = flash.Time();
44  fOpFlashAnaStruct.FlashTimeWidth = flash.TimeWidth();
45  fOpFlashAnaStruct.FlashAbsTime = flash.AbsTime();
46  fOpFlashAnaStruct.FlashFrame = flash.Frame();
47  fOpFlashAnaStruct.FlashY = flash.YCenter();
48  fOpFlashAnaStruct.FlashYWidth = flash.YWidth();
49  fOpFlashAnaStruct.FlashZ = flash.ZCenter();
50  fOpFlashAnaStruct.FlashZWidth = flash.ZWidth();
51  fOpFlashAnaStruct.FlashInBeamFrame = flash.InBeamFrame();
52  fOpFlashAnaStruct.FlashOnBeamTime = flash.OnBeamTime();
53  fOpFlashAnaStruct.FlashFastToTotal = flash.FastToTotal();
54  fOpFlashAnaStruct.FlashTotalPE = flash.TotalPE();
55 
56  if(fMakeOpDetPEHist){
57  int n_opdets = flash.WireCenters().size();
58  fOpFlashAnaStruct.FlashOpDetPEHist->SetBins(n_opdets,-0.5,(float)n_opdets-0.5);
59  for(int i=0; i<n_opdets; i++)
60  fOpFlashAnaStruct.FlashOpDetPEHist->SetBinContent(i+1,flash.PE(i));
61  }
62 
63  fOpFlashTree->Fill();
64  }
65 }
66 
67 void opdet::OpFlashAnaAlg::FillOpHitTree(const std::vector<recob::OpHit>& hitVector)
68 {
69  for(auto const& hit : hitVector){
70 
71  fOpHitAnaStruct.HitPeakTime = hit.PeakTime();
72  fOpHitAnaStruct.HitPeakTimeAbs = hit.PeakTimeAbs();
73  fOpHitAnaStruct.HitWidth = hit.Width();
74  fOpHitAnaStruct.HitArea = hit.Area();
75  fOpHitAnaStruct.HitAmplitude = hit.Amplitude();
76  fOpHitAnaStruct.HitFastToTotal = hit.FastToTotal();
77  fOpHitAnaStruct.HitPE = hit.PE();
78  fOpHitAnaStruct.HitFrame = hit.Frame();
79  fOpHitAnaStruct.HitOpChannel = hit.OpChannel();
80 
81  fOpHitTree->Fill();
82  }
83 }
void FillOpFlashes(const std::vector< recob::OpFlash > &)
void FillOpHits(const std::vector< recob::OpHit > &)
process_name hit
Definition: cheaterreco.fcl:51
void SetOpFlashTree(TTree *, bool makeOpDetPEHist=true)
FlashAnaStruct fOpFlashAnaStruct
Definition: OpFlashAnaAlg.h:60
void SetOpHitTree(TTree *)
void FillOpFlashTree(const std::vector< recob::OpFlash > &)
void FillOpHitTree(const std::vector< recob::OpHit > &)