67int main(
int argc,
char **argv)
79 typedef JSingleFileScanner_t::pointer_type pointer_type;
84 JLimit_t& numberOfEvents = inputFile.getLimit();
86 JCalibration_t calibrationFile;
94 JParser<> zap(
"Program to extract information about hits and all PMTs in the detector for water property studies");
107 catch(
const exception& error) {
108 FATAL(error.what() << endl);
121 unique_ptr<JDynamics> dynamics;
125 dynamics->load(calibrationFile);
127 catch(
const exception& error) {
128 if (!calibrationFile.empty()) {
135 out =
new TFile(
outputFile.c_str(),
"RECREATE");
137 catch(
const exception& error){
138 FATAL(error.what() << endl);
145 TTree *hits_tree =
new TTree(
"Hits",
"Tree with hits");
146 vector<float> hit_rate, hit_QE, hit_pos_x, hit_pos_y, hit_pos_z, hit_dir_x, hit_dir_y, hit_dir_z, hit_time, hit_tot;
147 vector<int> hit_first, hit_HRV, hit_status, hit_dom_id, hit_channel_id;
148 hits_tree->Branch(
"first",&hit_first);
149 hits_tree->Branch(
"QE",&hit_QE);
150 hits_tree->Branch(
"rate",&hit_rate);
151 hits_tree->Branch(
"status",&hit_status);
152 hits_tree->Branch(
"HRV",&hit_HRV);
153 hits_tree->Branch(
"pos_x",&hit_pos_x);
154 hits_tree->Branch(
"pos_y",&hit_pos_y);
155 hits_tree->Branch(
"pos_z",&hit_pos_z);
156 hits_tree->Branch(
"dir_x",&hit_dir_x);
157 hits_tree->Branch(
"dir_y",&hit_dir_y);
158 hits_tree->Branch(
"dir_z",&hit_dir_z);
159 hits_tree->Branch(
"time",&hit_time);
160 hits_tree->Branch(
"tot",&hit_tot);
161 hits_tree->Branch(
"channel_id",&hit_channel_id);
162 hits_tree->Branch(
"dom_id",&hit_dom_id);
165 TTree *pmts_tree =
new TTree(
"PMTs",
"Tree with PMTs");
166 vector<float> pmt_pos_x, pmt_pos_y, pmt_pos_z, pmt_dir_x, pmt_dir_y, pmt_dir_z, pmt_QE, pmt_rate;
168 pmts_tree->Branch(
"pos_x",&pmt_pos_x);
169 pmts_tree->Branch(
"pos_y",&pmt_pos_y);
170 pmts_tree->Branch(
"pos_z",&pmt_pos_z);
171 pmts_tree->Branch(
"dir_x",&pmt_dir_x);
172 pmts_tree->Branch(
"dir_y",&pmt_dir_y);
173 pmts_tree->Branch(
"dir_z",&pmt_dir_z);
174 pmts_tree->Branch(
"QE",&pmt_QE);
175 pmts_tree->Branch(
"channel_id",&pmt_channel_id);
176 pmts_tree->Branch(
"dom_id",&pmt_dom_id);
177 pmts_tree->Branch(
"rate",&pmt_rate);
179 pmts_tree->Branch(
"HRV",&pmt_HRV);
192 while (in.hasNext()) {
194 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
196 pointer_type ps = in.next();
203 dynamics->update(*tev);
208 buildL0(*tev, router,
true, back_inserter(dataL0));
212 int module_id_last = -1;
213 int channel_id_last = -1;
216 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
221 hit_pos_x.push_back(hit.
getX());
222 hit_pos_y.push_back(hit.
getY());
223 hit_pos_z.push_back(hit.
getZ());
225 hit_dir_x.push_back(hit.
getDX());
226 hit_dir_y.push_back(hit.
getDY());
227 hit_dir_z.push_back(hit.
getDZ());
229 hit_time.push_back(hit.
getT());
230 hit_tot.push_back(hit.
getToT());
244 hit_rate.push_back(hit.
getR());
248 hit_first.push_back(0);
251 hit_first.push_back(1);
261 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
265 for (
size_t pmt = 0; pmt !=
module.size(); ++pmt) {
267 pmt_pos_x.push_back(module[pmt].getX());
268 pmt_pos_y.push_back(module[pmt].getY());
269 pmt_pos_z.push_back(module[pmt].getZ());
271 pmt_dir_x.push_back(module[pmt].getDX());
272 pmt_dir_y.push_back(module[pmt].getDY());
273 pmt_dir_z.push_back(module[pmt].getDZ());
279 pmt_channel_id.push_back(pmt);
280 pmt_dom_id.push_back(module.
getID());
306 hit_channel_id.clear();
316 pmt_channel_id.clear();