Project
Loading...
Searching...
No Matches
Digit.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "TOFBase/Digit.h"
13
14#include <iostream>
15
16using namespace o2::tof;
17
19
20Digit::Digit(Int_t channel, Int_t tdc, Int_t tot, uint64_t bc, Int_t label, uint32_t triggerorbit, uint16_t triggerbunch, float geanttime, double t0)
21 : mChannel(channel), mTDC(tdc), mTOT(tot), mIR(0, 0), mLabel(label), mTriggerOrbit(triggerorbit), mTriggerBunch(triggerbunch), mIsUsedInCluster(kFALSE), mTgeant(geanttime), mT0true(t0)
22{
23 mIR.setFromLong(bc);
24}
25//______________________________________________________________________
26Digit::Digit(Int_t channel, Int_t tdc, Int_t tot, uint32_t orbit, uint16_t bc, Int_t label, uint32_t triggerorbit, uint16_t triggerbunch, float geanttime, double t0)
27 : mChannel(channel), mTDC(tdc), mTOT(tot), mIR(bc, orbit), mLabel(label), mTriggerOrbit(triggerorbit), mTriggerBunch(triggerbunch), mIsUsedInCluster(kFALSE), mTgeant(geanttime), mT0true(t0)
28{
29}
30//______________________________________________________________________
31
32void Digit::printStream(std::ostream& stream) const
33{
34 stream << "TOF Digit: Channel " << mChannel << " TDC " << mTDC << " TOT " << mTOT << "Bunch Crossing index" << mIR.toLong() << " Label " << mLabel << "\n";
35}
36
37//______________________________________________________________________
38
39std::ostream& operator<<(std::ostream& stream, const Digit& digi)
40{
41 digi.printStream(stream);
42 return stream;
43}
44
45//______________________________________________________________________
46
47bool Digit::merge(Int_t tdc, Int_t tot)
48{
49
50 // merging two digits
51
52 if (tdc < mTDC) {
53 mTDC = tdc;
54 return 1; // new came first
55 // TODO: adjust TOT
56 } else {
57 // TODO: adjust TOT
58 return 0;
59 }
60}
61
62//______________________________________________________________________
63
64void Digit::getPhiAndEtaIndex(int& phi, int& eta) const
65{
66
67 // method that returns the index in phi and eta of the digit
68
69 int chan;
70 int detId[5];
71 chan = getChannel(); // note that inside the strip the digits are ordered per channel number
72 Geo::getVolumeIndices(chan, detId); // Get volume index from channel index
73 eta = detId[2] /*strip*/ * 2 + detId[3] /*pad Z*/;
74 if (detId[1] /*module*/ == 0) {
75 eta += 0;
76 } else if (detId[1] == 1) {
77 eta += 38;
78 } else if (detId[1] == 2) {
79 eta += 76;
80 } else if (detId[1] == 3) {
81 eta += 106;
82 } else if (detId[1] == 4) {
83 eta += 144;
84 }
85 phi = detId[0] /*phi sector*/ * 48 + detId[4] /*pad x*/;
86
87 return;
88}
ClassImp(o2::tof::Digit)
uint64_t orbit
Definition RawEventData.h:6
uint64_t bc
Definition RawEventData.h:5
TOF digit implementation.
Definition Digit.h:31
void printStream(std::ostream &stream) const
Definition Digit.cxx:32
Int_t getChannel() const
Definition Digit.h:49
Digit()=default
bool merge(Int_t tdc, Int_t tot)
Definition Digit.cxx:47
void getPhiAndEtaIndex(int &phi, int &eta) const
Definition Digit.cxx:64
static void getVolumeIndices(Int_t index, Int_t *detId)
Definition Geo.cxx:543
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition glcorearb.h:5034
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &os, Cluster &c)
void setFromLong(int64_t l)