forked from JeffersonLab/SBS-offline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SBSSimEvent.cxx
138 lines (123 loc) · 4.17 KB
/
SBSSimEvent.cxx
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include <iostream>
#include "SBSSimEvent.h"
#include "TTree.h"
// -----------------------------------------------
// class SBSSimEvent: encapsulation of g4sbs_tree
//
/*
//_____________________________________________________________________________
SBSSimEvent::SBSSimEvent() : g4sbs_tree()
{
std::cout << "Initializing SBSSimEvent" << std::endl;
RunID = EvtID = 0;
//Weight = 1;
Clear();
}
*/
//_____________________________________________________________________________
//SBSSimEvent::SBSSimEvent(TTree* tree, TString experiment) {
SBSSimEvent::SBSSimEvent(TTree* tree, Exp_t experiment) {
std::cout << "Initializing SBSSimEvent" << std::endl;
RunID = EvtID = 0;
fExperiment = experiment;
//Now we need to initialize the appropriate Tree structure based on experiment:
//We should probably use an enum or something simple to make this less clunky than doing a string comparison each time we open the file
//or load the event:
switch( fExperiment ){
case kGEnRP://"genrp":
//do nothing for now; eventually we will allocate the genrp_tree and store the pointer in the data member of this class:
Tgmn = new gmn_tree_digitized(tree);
Tgenrp = new genrp_tree_digitized(tree);
break;
case kGEp://"gep":
//Tgep = new gep_tree_digitized(tree);
break;
case kSIDIS://"sidis":
//Tsidis = new sidis_tree_digitized(tree);
break;
case kGMN://"gmn":
Tgmn = new gmn_tree_digitized(tree);
//case //"gen":
break;
default:
Tgmn = new gmn_tree_digitized(tree);
//Tgenrp = new genrp_tree_digitized(tree);
break;
}
// if(Tgmn==0){
// std::cout << " SBSSimEvent::SBSSimEvent(): Digitized tree can't be found! Stopping the program! " << std::endl;
// exit(-1);
// }
// if(Tgmn->GetEntry(0)==0){
// std::cout << " SBSSimEvent::SBSSimEvent(): Digitized tree is empty! Stopping the program! " << std::endl;
// exit(-1);
// }
// if(Tgmn==0){
// std::cout << " SBSSimEvent::SBSSimEvent(): Digitized tree can't be found! Stopping the program! " << std::endl;
// exit(-1);
// }
// if(Tgmn->GetEntry(0)==0){
// std::cout << " SBSSimEvent::SBSSimEvent(): Digitized tree is empty! Stopping the program! " << std::endl;
// exit(-1);
// }
//Weight = 1;
Clear();
}
/*
//_____________________________________________________________________________
SBSSimEvent::SBSSimEvent(TTree* tree, std::vector<TString> det_list) : g4sbs_tree(tree, det_list)
{
std::cout << "Initializing SBSSimEvent" << std::endl;
cout << det_list.size() << endl;
RunID = EvtID = 0;
//Weight = 1;
Clear();
}
*/
//_____________________________________________________________________________
void SBSSimEvent::Clear( const Option_t* opt )
{
// do nothing...
}
//_____________________________________________________________________________
void SBSSimEvent::Print( const Option_t* opt ) const
{
//std::cout << RunID << " " << EvtID << " " << ev_sigma*ev_solang << std::endl;
}
//_____________________________________________________________________________
Int_t SBSSimEvent::GetEntry( Long64_t entry )
{
EvtID = entry;
//std::cout << "SBSSimEvent::GetEntry(" << entry << "): " << std::endl;
// Read contents of entry.
//if (!fChain) return 0;
//fChain->Print();
//int ret = fChain->GetEntry(entry);
int ret=-1;
//switch is not actually capable of taking strings... use a "enum"
switch( fExperiment ){
case kGEnRP://"genrp":
//do nothing for now; eventually we will invoke the "GetEntry" methods of the various classes:
ret = Tgmn->GetEntry(entry);
ret = Tgenrp->GetEntry(entry);
break;
case kGEp://"gep":
//ret = Tgep->GetEntry(entry);
break;
case kSIDIS://"sidis":
//ret = Tsidis->GetEntry(entry);
break;
case kGMN://"gmn":
//case "gen":
ret = Tgmn->GetEntry(entry);
break;
default:
ret = Tgmn->GetEntry(entry);
//ret = Tgenrp->GetEntry(entry);
break;
}
//cout << Earm_BBPSTF1.nhits << " " << Earm_BBSHTF1.nhits << " " << Earm_BBHodoScint.nhits << " " << Earm_GRINCH.nhits << " " << Earm_BBGEM.nhits << " " << Harm_HCalScint.nhits << endl;
return ret;
}
//-----------------------------------------------------------------------------
ClassImp(SBSSimEvent)