REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorReadoutChannel.h
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
23#ifndef RestCore_TRestDetectorReadoutChannel
24#define RestCore_TRestDetectorReadoutChannel
25
26#include <TRestMetadata.h>
27
28#include <iostream>
29
30#include "TRestDetectorReadoutPixel.h"
31
32enum TRestDetectorReadoutChannelType {
33 Channel_NoType = 0,
34 Channel_Pixel = 1,
35 Channel_X = 2,
36 Channel_Y = 3,
37 Channel_U = 4,
38 Channel_V = 5,
39 Channel_W = 6,
40};
41
45 private:
46 Int_t fDaqID;
48 std::vector<TRestDetectorReadoutPixel> fReadoutPixel;
50
51 Short_t fChannelId = -1;
52
53 void Initialize();
54
55 public:
57 inline Int_t GetDaqID() const { return fDaqID; }
58
60 inline Int_t GetChannelId() const { return fChannelId; }
61
63 Int_t GetNumberOfPixels() { return fReadoutPixel.size(); }
64
65 TRestDetectorReadoutPixel& operator[](int n) { return fReadoutPixel[n]; }
66
69 if (n >= GetNumberOfPixels()) return nullptr;
70 return &fReadoutPixel[n];
71 }
72
73 void SetType(TRestDetectorReadoutChannelType type) {
74 // in future we may implement this
75 }
76
77 TRestDetectorReadoutChannelType GetType() {
78 // in future we may implement this
79 return Channel_NoType;
80 }
81
83 void SetDaqID(Int_t id) { fDaqID = id; }
84
86 void SetChannelID(Int_t id) { fChannelId = id; }
87
89 void AddPixel(const TRestDetectorReadoutPixel& pixel) { fReadoutPixel.emplace_back(pixel); }
90
91 Int_t isInside(Double_t x, Double_t y);
92
93 void Print(int DetailLevel = 0);
94
95 // Constructor
97 // Destructor
99
100 ClassDef(TRestDetectorReadoutChannel, 4); // REST run class
101};
102#endif
std::vector< TRestDetectorReadoutPixel > fReadoutPixel
TRestDetectorReadoutChannel()
TRestDetectorReadoutChannel default constructor.
void Initialize()
Initializes the channel members.
Int_t GetChannelId() const
Returns the corresponding channel id.
Short_t fChannelId
It stores the corresponding physical readout channel.
Int_t GetDaqID() const
Returns the corresponding daq channel id.
void Print(int DetailLevel=0)
Prints the details of the readout channel including pixel coordinates.
Int_t GetNumberOfPixels()
Returns the total number of pixels inside the readout channel.
void AddPixel(const TRestDetectorReadoutPixel &pixel)
Adds a new pixel to the readout channel.
Int_t isInside(Double_t x, Double_t y)
Determines if (x,y) referenced to module coordinates is inside the channel.
virtual ~TRestDetectorReadoutChannel()
TRestDetectorReadoutChannel default destructor.
void SetDaqID(Int_t id)
Sets the daq channel number id.
void SetChannelID(Int_t id)
Sets the readout channel number id.
TRestDetectorReadoutPixel * GetPixel(int n)
Returns a pointer to the pixel n by index.
A class to store the readout pixel definition used in TRestDetectorReadoutChannel.