Belle II Software development
arichBtestModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <arich/modules/arichBtest/arichBtestModule.h>
10
11// Framework - DataStore
12#include <framework/datastore/StoreObjPtr.h>
13#include <framework/dataobjects/EventMetaData.h>
14#include <framework/datastore/StoreArray.h>
15#include <framework/logging/Logger.h>
16#include <framework/gearbox/Unit.h>
17
18// Hit classes
19#include <arich/dataobjects/ARICHDigit.h>
20#include <arich/dataobjects/ARICHAeroHit.h>
21#include "arich/geometry/ARICHGeometryPar.h"
22#include "arich/geometry/ARICHBtestGeometryPar.h"
23
24#include "arich/modules/arichBtest/arichBtestData.h"
25
26#include <TH1F.h>
27#include <TH2F.h>
28#include <TFile.h>
29#include <TNtuple.h>
30#include <Math/Vector3D.h>
31#include <Math/Rotation3D.h>
32#include <TAxis.h>
33
34// ifstream constructor.
35#include <fstream>
36
37namespace Belle2 {
44 //-----------------------------------------------------------------
46 //-----------------------------------------------------------------
47 REG_MODULE(arichBtest);
48
49 //-----------------------------------------------------------------
50 // Implementation
51 //-----------------------------------------------------------------
52
53
54 arichBtestModule::arichBtestModule() : Module(), m_end(0), m_events(0), m_file(NULL), m_timestart(0), m_mwpc(NULL)
55 {
56 //Set module properties
57 setDescription("Module for the ARICH Beamtest data analysis. It creates track form the MWPC hits and reads the HAPD hits");
58
59 //Parameter definition
60 addParam("outputFileName", m_outFile, "Output Root Filename", std::string("output.root"));
61 std::vector<std::string> defaultList;
62 addParam("runList", m_runList, "Data Filenames.", defaultList);
63 std::vector<int> defaultMask;
64 addParam("mwpcTrackMask", m_MwpcTrackMask, "Create track from MWPC layers", defaultMask);
65 m_fp = NULL;
66 addParam("beamMomentum", m_beamMomentum, "Momentum of the beam [GeV]", 0.0);
67
68 for (int i = 0; i < 32; i++) m_tdc[i] = 0;
69
70 }
71
72 TNtuple* m_tuple;
73 TH1F* hapd[6];
74 TH1F* mwpc_tdc[4][5];
75 TH1F* mwpc_diff[4][2];
76 TH1F* mwpc_sum[4][2];
77 TH1F* mwpc_sum_cut[4][2];
78 TH1F* mwpc_residuals[4][2];
79 TH2F* mwpc_xy[4];
80 TH2F* mwpc_residualsz[4][2];
81 //TGraph* m_hapdmap;
82 //TGraph* m_el2pos;
83
85 {
86 B2INFO("arichBtestModule::initialize()");
89 aeroHits.registerInDataStore();
90 digits.registerInDataStore();
91
92 m_file = new TFile(m_outFile.c_str(), "RECREATE");
93 m_tuple = new TNtuple("nt", "Btest data hits", "x:y:xrec:yrec:m:c:gx:gy");
94 char hapdName[256];
95 for (int i = 0; i < 6; i++) {
96 sprintf(hapdName, "hapd%d", i);
97 hapd[i] = new TH1F(hapdName, hapdName, 145, -0.5, 144.5);
98 }
99 char name[256];
100
101 for (int i = 0; i < 4; i++) {
102 for (int k = 0; k < 2; k++) {
103 sprintf(name, "mwpc%d_a%d_", i, k);
104 mwpc_diff[i][k] = new TH1F(strcat(name, "diff"), name, 300, -150, 150);
105 sprintf(name, "mwpc%d_a%d_", i, k);
106 mwpc_sum[i][k] = new TH1F(strcat(name, "sum"), name, 200, -0.5, 199.5);
107 sprintf(name, "mwpc%d_a%d_", i, k);
108 mwpc_sum_cut[i][k] = new TH1F(strcat(name, "sum_cut"), name, 200, -0.5, 199.5);
109 sprintf(name, "mwpc%d_a%d_", i, k);
110 mwpc_residuals[i][k] = new TH1F(strcat(name, "resd"), name, 200, -100, 100);
111 sprintf(name, "mwpc%d_a%d_", i, k);
112 mwpc_residualsz[i][k] = new TH2F(strcat(name, "resd_z"), name, 200, -25, 25, 400, -1000, 1000);
113 }
114 for (int k = 0; k < 5; k++) {
115 sprintf(name, "mwpc%d_a%d_", i, k);
116 mwpc_tdc[i][k] = new TH1F(strcat(name, "tdc"), name, 1024, -1024, 1024);
117 }
118 sprintf(name, "mwpc%d_", i);
119 mwpc_xy[i] = new TH2F(strcat(name, "xy"), name, 120, -30, 30, 120, -30, 30);
120 }
121 //m_hapdmap = new TGraph("arich/modules/arichBtest/geometry/hapd.map");
122 //m_el2pos = new TGraph("arich/modules/arichBtest/geometry/hapdchmap_v0.dat");
123
124 /*
125 arich::ARICHGeometryPar* _arichgp = arich::ARICHGeometryPar::Instance();
126
127 ofstream dout;
128 dout.open ("ChannelCenterGlob.txt");
129 for (int i=0;i<6;i++){
130 for (int k=0;k<144;k++){
131 ROOT::Math::XYZVector r = _arichgp->getChannelCenterGlob(i + 1, k);
132 dout << r.X() << " " << r.Y() << endl;
133 }
134 }
135 dout.close();
136 */
137 time(&m_timestart);
138 }
139
141 {
142
143 B2INFO("arichBtestModule::beginRun()");
144
145 StoreObjPtr<EventMetaData> eventMetaDataPtr;
146 B2INFO("arichBtestModule::eventMetaDataPtr run:" << eventMetaDataPtr->getRun());
147 B2INFO("arichBtestModule::eventMetaDataPtr exp:" << eventMetaDataPtr->getExperiment());
148
150 m_mwpc = _arichbtgp->getMwpc();
151
152 static int first = 1;
153 if (first) {
154 m_runCurrent = m_runList.begin();
155 first = 0;
156 m_mwpc[0].Print();
157 m_mwpc[1].Print();
158 m_mwpc[2].Print();
159 m_mwpc[3].Print();
160
161 }
162 m_end = 1;
163
164 if (m_runCurrent < m_runList.end()) {
165 if (m_fp) {
166 m_eveList.push_back(m_events);
167 gzclose(m_fp);
168 }
169 m_fp = gzopen((*m_runCurrent).c_str(), "rb");
170 if (m_fp == NULL) {
171 B2INFO("Cannot open " << *m_runCurrent);
172 m_end = 1;
173 } else {
174 B2INFO("File opened " << *m_runCurrent);
175 m_end = 0;
176 }
177 }
178 m_events = 0;
179 }
180
182 {
183 unsigned int u;
184 gzread(fp, &u, sizeof(unsigned int));
185 gzseek(fp, u * sizeof(unsigned int), SEEK_CUR);
186 return u + 1;
187 }
188
189 void arichBtestModule::readmwpc(unsigned int* dbuf, unsigned int len, int print1290)
190 {
191
192 const int unsigned MAXV1290 = 32;
193
194 unsigned int edge;
195 unsigned int tdcch;
196 unsigned int tdcl;
197 unsigned int nhits;
198
199 for (int i = 0; i < 32; i++) m_tdc[i] = 0XFFFF;
200 //TDC V1290
201 //for (int i=0;i<len;i++) printf("V1290 %d(%d) 0x%08x \n",i,len, dbuf[i],n);
202 for (unsigned int i = 0; i < len; i++) {
203 int rid = (dbuf[i] >> 27) & 0x1F;
204 switch (rid) {
205 case 0x18: // Filler
206 if (print1290) printf("Filler 0x%08x %u.data\n", dbuf[i], i);
207 break;
208 case 0x8: // Global Header
209 if (print1290) printf("Global Header 0x%08x %u.data\n", dbuf[i], i);
210 break;
211 case 0x10: // Global Trailer --- Last word of data
212 nhits = ((dbuf[i] >> 5) & 0xFFFF); //Word Count = bit 31...21< Word Count: 20 ... 5 > 4...0
213 if (print1290) printf("Global Trailer 0x%08x %u.data STATUS=0x%03x nhits=%u\n", dbuf[i], i, (dbuf[i] >> 24) & 0x7, nhits);
214
215 if (nhits != len) {
216 if (print1290) printf("V1290 nhits!=len %u %u\n", nhits, len);
217 };
218 break;
219 case 0x11: // Global Trigger TimeTag
220 if (print1290) printf("Global Trigger TimeTag 0x%08x %u.data\n", dbuf[i], i);
221 break;
222 case 0x1: // TDC header
223 if (print1290) printf("TDC header 0x%08x %u.data evid=%u wc=%u\n", dbuf[i], i, (dbuf[i] >> 12) & 0xFFF, dbuf[i] & 0xFFF);
224
225 break;
226 case 0x3: // TDC trailer
227 if (print1290) printf("TDC trailer 0x%08x %u.data\n", dbuf[i], i);
228
229 break;
230 case 0x4: // TDC Error
231 if (print1290) printf("TDC Error 0x%08x %u.data ERR=0x%x\n", dbuf[i], i, dbuf[i] & 0x3FFF);
232
233 break;
234 case 0x0 : // TDC data
235
236 edge = (dbuf[i] >> 26) & 0x1;
237 tdcch = (dbuf[i] >> 21) & 0x1F;
238 tdcl = dbuf[i] & 0x1FFFFF;
239 if (tdcch < MAXV1290) {
240 //if (tdcch>15) gV1290[tdcch]->Fill(tdcl/40);
241 //if (tdcch>15) if (tdcl< trg[tdcch-16] && tdcl>16000 && tdcl<20000 ) trg[tdcch-16]=tdcl;
242 if (print1290)
243 printf("V1290 0x%08x %u. [ch=%2u] edge=%u data=%u \n", dbuf[i], i, tdcch, edge, tdcl);
244 m_tdc[tdcch] = tdcl / 40;
245 }
246
247 break;
248
249 default:
250 if (print1290) printf("Unknown 0x%08x %u.data\n", dbuf[i], i);
251
252 break;
253
254 }
255 }
256
257 }
258
259 int arichBtestModule::readhapd(unsigned int len, unsigned int* data)
260 {
261
264 //-----------------------------------------------------
265
266 unsigned int bmask = 0xF;
267
268 for (int module = 0; module < 6; module++) {
269 int istart = 19 * module;
270 int istop = 19 * module + 18;
271 for (int i = istart; i < istop; i++) {
272 for (int j = 0; j < 8; j++) {
273 unsigned int kdata = data[i] & (bmask << (j * 4));
274 if (kdata) {
275 int channelID = j + 8 * (i - istart);
276
277 if (_arichgp->isActive(module, channelID)) {
278
279 hapd[module]->Fill(channelID);
280
281 StoreArray<ARICHDigit> arichDigits;
282 double globalTime = 0;
283
284 double rposx = 0, rposy = 0;
285 std::pair<int, int> eposhapd(_arichbtgp->GetHapdElectronicMap(module * 144 + channelID));
286 int channel = eposhapd.second;
287
288 if ((channel < 108 && channel > 71) || channel < 36) channel = 108 - (int(channel / 6) * 2 + 1) * 6 +
289 channel;
290 else channel = 144 - (int((channel - 36) / 6) * 2 + 1) * 6 + channel - 36;
291 ROOT::Math::XYVector loc = _arichgp->getChannelCenterLoc(channel);
292 if (abs(loc.X()) > 2.3 || abs(loc.Y()) > 2.3) continue;
293
294 arichDigits.appendNew(module + 1, channel, globalTime);
295
296 ROOT::Math::XYZVector rechit = _arichgp->getChannelCenterGlob(module + 1, channel);
297 std::pair<double, double> poshapd(_arichbtgp->GetHapdChannelPosition(module * 144 + channelID));
298 m_tuple ->Fill(-poshapd.first, poshapd.second, rechit.X(), rechit.Y(), module, channelID, rposx, rposy);
299 }
300 }
301 }
302 }
303 }
304
305 return len;
306 }
307
308
309 int arichBtestModule::getTrack(int mask, ROOT::Math::XYZVector& r, ROOT::Math::XYZVector& dir)
310 {
311 int retval = 0;
312 //const int trgch = 13;
313 const double t0 = 0;// m_tdc[trgch];
314 for (int i = 0; i < 4; i++) {
315 ARICHTracking* w = &m_mwpc[i];
316
317 for (int k = 0; k < 4; k++) mwpc_tdc[i][k]->Fill(m_tdc[w->tdc[k]] - t0);
318 mwpc_tdc[i][4]->Fill(m_tdc[w->atdc] - t0);
319
320
321 for (int k = 0; k < 2; k++) { // axis x,y
322 w->status[k] = 1;
323 w->diff[k] = m_tdc[w->tdc[2 * k]] - m_tdc[w->tdc[2 * k + 1]];
324 w->sum[k] = m_tdc[w->tdc[2 * k + 1]] + m_tdc[w->tdc[2 * k]] - 2 * m_tdc[w->atdc];
325 mwpc_sum[i][k]->Fill(w->sum[k]);
326 if (w->sum[k] < w->cutll[k] || w->sum[k] > w->cutul[k]) continue;
327 mwpc_sum_cut[i][k]->Fill(w->sum[k]);
328 w->status[k] = 0;
329 w->reco[k] = w->diff[k] * w->slp[k] + w->offset[k];
330 w->reco[k] += w->pos[k];
331
332 mwpc_diff[i][k]->Fill(w->diff[k]);
333 }
334
335 w->reco[2] = w->pos[2]; // update z axis
336 if (!w->status[0] && !w->status[1]) mwpc_xy[i]->Fill(w->reco[0], w->reco[1]);
337
338 if (mask & (1 << i)) {
339 if (!w->status[0] && !w->status[1]) {
340 // add point to a fitter
341 } else {
342 retval = 1;
343 }
344 }
345 }
346
347 // replace by fitter
348 int ii[4] = {0, 1, 0, 0};
349 int ncnt = 0;
350 for (int i = 0; i < 4; i++) {
351 if (mask & (1 << i)) {
352 //B2INFO(ncnt << " " << i << " Mask " << mask);
353 ii[ncnt++] = i;
354 }
355 }
356 int i0 = ii[0];
357 int i1 = ii[1];
358
359 r.SetXYZ(m_mwpc[i0].reco[1], m_mwpc[i0].reco[0], m_mwpc[i0].reco[2]);
360 dir.SetXYZ(m_mwpc[i1].reco[1] - m_mwpc[i0].reco[1],
361 m_mwpc[i1].reco[0] - m_mwpc[i0].reco[0],
362 m_mwpc[i1].reco[2] - m_mwpc[i0].reco[2]);
363
364 dir = dir.Unit();
365
366// end replace by fitter
367 if (dir.Z() != 0) {
368 for (int i = 0; i < 4; i++) {
369 ARICHTracking* w = &m_mwpc[i];
370 double l = (w->reco[2] - r.Z()) / dir.Z() ;
371 ROOT::Math::XYZVector rext = r + dir * l;
372 if (!w->status[0]) mwpc_residuals[i][0]->Fill(w->reco[0] - rext.Y());
373 if (!w->status[1]) mwpc_residuals[i][1]->Fill(w->reco[1] - rext.X());
374
375 TAxis* axis = mwpc_residualsz[i][1]->GetYaxis();
376 for (int k = 0; k < axis->GetNbins(); k++) {
377 double ll = (w->reco[2] + axis->GetBinCenter(k + 1) - r.Z()) / dir.Z();
378 ROOT::Math::XYZVector rextt = r + dir * ll;
379 mwpc_residualsz[i][0]->Fill(w->reco[0] - rextt.Y(), axis->GetBinCenter(k + 1));
380 mwpc_residualsz[i][1]->Fill(w->reco[1] - rextt.X(), axis->GetBinCenter(k + 1));
381
382 }
383 }
384 }
385
386 return retval;
387 }
388
389 int arichBtestModule::readdata(gzFile fp, int rec_id, int)
390 {
391
392 unsigned int len, data[10000];
393 gzread(fp, &len, sizeof(unsigned int));
394 //if (print) printf( "[%3d] %d: ", len, rec_id );
395 gzread(fp, data, sizeof(unsigned int)*len);
396
397 ROOT::Math::XYZVector r;
398 ROOT::Math::XYZVector dir;
399 if (rec_id == 1) {
400 readmwpc(data, len);
401 int retval = getTrack(*(m_MwpcTrackMask.begin()), r, dir);
402 //dir = ROOT::Math::XYZVector(0,0,1);
403
404 if (!retval) {
405 // global transf, add track to datastore
406 StoreArray<ARICHAeroHit> arichAeroHits;
407
408 int particleId = 11;// geant4
409 dir *= m_beamMomentum * Unit::GeV;
410 r *= Unit::mm /*/ CLHEP::mm*/;
412 static ROOT::Math::XYZVector dr = _arichbtgp->getTrackingShift();
413
414 r += dr;
415
416 //----------------------------------------
417 // Track rotation
418 //
419 ROOT::Math::Rotation3D rot = _arichbtgp->getFrameRotation();
420 ROOT::Math::XYZVector rc = _arichbtgp->getRotationCenter();
421
422 ROOT::Math::XYZVector rrel = rc - rot * rc;
423 r = rot * r + rrel;
424 dir = rot * dir;
425 r.SetX(-r.X()); dir.SetX(-dir.X());
426
427 //
428 // end track rotation
429 //----------------------------------------
430 r.SetY(-r.Y());
431 dir.SetY(-dir.Y());
432 B2DEBUG(50, "-----------> " << rc.X() << " " << rc.Y() << " " << rc.Z() << "::::" << rrel.X() << " " << rrel.Y() << " " <<
433 rrel.Z() << " ----> R " << r.X() << " " << r.Y() << " " << r.Z() << " ----> S " << dir.X() << " " << dir.Y() << " " <<
434 dir.Z());
435
436 // Add new ARIHCAeroHit to datastore
437 arichAeroHits.appendNew(particleId, r, dir);
438
439 }
440 }
441
442 if (rec_id == 2) {
443 readhapd(len, data);
444 }
445
446 for (unsigned int j = 0; j < len; j++) {
447 //if( j%8==0 && j!= 0 ) printf( " " );
448 //printf( " %08x", data[j] );
449 //if( j%8==7 || j==len-1 ) putchar('\n');
450 }
451 return len + 1;
452 }
453
454
455
456
458 {
459
460
461
462
463
464 if (!m_fp) return;
465 unsigned int hdr[2];
466 EventRec rec;
467 BeginRec beginrec;
468 BeginRec endrec;
469 static char msg[1024];
470 int type;
471
472 const int sint = sizeof(unsigned int);
473 do {
474 if (gzread(m_fp, hdr, sint * 2) != 2 * sint && m_end) {
475 B2INFO("[" << m_events << "] End of file: " << *m_runCurrent);
476 ++m_runCurrent;
477 if (m_runCurrent == m_runList.end()) {
478 StoreObjPtr<EventMetaData> eventMetaDataPtr;
479 eventMetaDataPtr->setEndOfData();
480 return;
481 }
482 beginRun();
483 }
484
485 } while (m_end && m_runCurrent != m_runList.end());
486 if (m_events % 1000 == 0) {
487 time_t m_time;
488 time(&m_time);
489 B2INFO("neve= [" << m_events << "] in " << (double)(m_time - m_timestart) / 60. << " min (" << int(
490 m_time - m_timestart) << "s) from " << *m_runCurrent);
491
492 }
493 m_events++;
494
495 type = hdr[0];
496 // len = hdr[1];
497
498 gzseek(m_fp, 2 * sizeof(unsigned int), SEEK_CUR);
499 switch (type) {
500 case BEGIN_RECORD_TYPE: {
501 gzread(m_fp, &beginrec, sizeof(beginrec));
502 time_t t = beginrec.time;
503 sprintf(msg, "BeginRec run %u time %s", beginrec.runno, ctime(&t));
504 B2INFO(msg);
505 break;
506 }
507 case END_RECORD_TYPE: {
508 gzread(m_fp, &endrec, sizeof(endrec));
509 time_t t = endrec.time;
510 sprintf(msg, "EndRec run %u time %s", endrec.runno, ctime(&t));
511 B2INFO(msg);
512 break;
513 }
514 case EVENT_RECORD_TYPE: {
515 gzread(m_fp, &rec, sizeof(rec));
516 int print = !(rec.evtno % 10000);
517 time_t t = rec.time;
518 if (print) {
519 sprintf(msg, "EventRec run %u evt %u mstime %u, time %s", rec.runno, rec.evtno, rec.mstime, ctime(&t));
520 B2INFO(msg);
521 }
522 /* if you just want to jump to the end */
523 int pos = gztell(m_fp);
524 /* try to read inside data */
525 int buflen = rec.len - sizeof(rec) / sizeof(int);
526
527 //if (print) printf ("%d: buflen\n",buflen);
528 int n[5] = { 0 };
529 int i(0), j(0);
530 while (i < buflen && j < 5) {
531 n[j] = readdata(m_fp, j, print);
532 // n[j] = skipdata( m_fp );
533 i += n[j];
534 j++;
535 }
536 if (gzseek(m_fp, pos + buflen * sizeof(unsigned int), SEEK_SET) < 0) B2ERROR("gzseek returns -1 ");
537 break;
538 }
539 default:
540 B2ERROR("IO error unknown record type " << type);
541 break;
542 }
543 if (gzeof(m_fp)) m_end = 1;
544 }
545
547 {
548 B2INFO(" arichBtestModule: End Run !!!");
549
550 m_file->Write();
551 m_file->Close();
552
553 if (m_fp) {
554 gzclose(m_fp);
555 m_eveList.push_back(m_events);
556 }
557 }
558
560 {
561 int j = 1;
562 for (const std::string& fname : m_runList) {
563 B2INFO(m_eveList[j] << " events processed from file " << fname);
564 j++;
565 }
566 for (int i = 0; i < 4; i++) {
567 //ARICHTracking* w = &m_mwpc[i];
568 B2INFO(i << " a1=" << m_mwpc[i].tdc[0] << " a2=" << m_mwpc[i].tdc[1] << " a3=" << m_mwpc[i].tdc[2] << " a2=" << m_mwpc[i].tdc[3]
569 << " A=" << m_mwpc[i].atdc);
570 }
571
572 }
573
575}
The Class for ARICH Beamtest Geometry Parameters.
The Class for ARICH Geometry Parameters.
Beamtest ARICH Geometry Tracking Class.
void Print()
Debug printouts.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
static const double mm
[millimeters]
Definition: Unit.h:70
static const double GeV
Standard of [energy, momentum, mass].
Definition: Unit.h:51
std::string m_outFile
output file name
time_t m_timestart
time of the first processed event
ARICHTracking * m_mwpc
Pointer to the tracking chambers.
int m_tdc[32]
raw MWPC TDC buffer
std::vector< std::string >::iterator m_runCurrent
current run
TFile * m_file
pointer to the root file
double m_beamMomentum
Momentum of the particles in the beam [GeV].
std::vector< std::string > m_runList
The filenames of the runs.
int m_events
number of events
std::vector< int > m_MwpcTrackMask
Bit mask of the MWPC tracking chambers used for the track creation.
gzFile m_fp
file descriptor of the data file
std::vector< int > m_eveList
The eventnumbers for each of the runs.
TH2F * mwpc_xy[4]
calculated x-y track positions
TH1F * mwpc_residuals[4][2]
residuals from mwpcs
int skipdata(gzFile fp)
Skip the data part of the record.
TH1F * mwpc_sum_cut[4][2]
tdc sum from mwpcs, with sum cut applied
virtual void initialize() override
Initialize the Module.
TH2F * mwpc_residualsz[4][2]
z-residuals from mwpcs
TH1F * mwpc_diff[4][2]
tdc difference from mwpcs
virtual void event() override
Running over all events.
virtual void endRun() override
Is called after processing the last event of a run.
virtual void terminate() override
Is called at the end of your Module.
virtual void beginRun() override
Called when entering a new run.
TH1F * mwpc_sum[4][2]
tdc sum from mwpcs
int getTrack(int mask, ROOT::Math::XYZVector &r, ROOT::Math::XYZVector &dir)
Beamtest Track reconstruction.
TH1F * hapd[6]
histogram of hits for each hapd
TNtuple * m_tuple
ntuple containing hapd hits
void readmwpc(unsigned int *dbuf, unsigned int len, int print=0)
Read the MWPC information from the data buffer.
int readdata(gzFile fp, int rec_id, int print)
Read the data from the file (can be compressed)
int readhapd(unsigned int len, unsigned int *data)
Read the HAPD hits from the data buffer.
TH1F * mwpc_tdc[4][5]
tdc information from mwpcs
std::pair< double, double > GetHapdChannelPosition(int)
Get the position of the HAPD channel.
ROOT::Math::XYZVector getRotationCenter()
Get the rotation center of the Aerogel RICH frame.
ROOT::Math::Rotation3D getFrameRotation()
Get the rotation matrix of the Aerogel RICH frame.
std::pair< int, int > GetHapdElectronicMap(int)
Get the mapping of the electronic channel to the HAPD module nr and the channel number.
static ARICHBtestGeometryPar * Instance()
Static method to get a reference to the ARICHBtestGeometryPar instance.
static ARICHGeometryPar * Instance()
Static method to get a reference to the ARICHGeometryPar instance.
ROOT::Math::XYZVector getTrackingShift()
Get the tracking shift.
ARICHTracking * getMwpc()
Get the pointer of the tracking MWPCs.
bool isActive(int module, int channel)
check the activity of the channel
ROOT::Math::XYZVector getChannelCenterGlob(int modID, int chanID)
get center of chanID channel of modID detector module (in global coordinates)
ROOT::Math::XYVector getChannelCenterLoc(int chID)
get center position of chID channel (in detector module local coordinates)
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
Abstract base class for different kinds of events.
Begin record structure for the beamtest data.
unsigned int runno
Run number.
unsigned int time
Timestamp of the run.
Event record structure for the beamtest data.