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
35 private:
36 Int_t fDaqID;
38 std::vector<TRestDetectorReadoutPixel> fReadoutPixel;
40
41 Short_t fChannelId = -1;
42
43 std::string fName; // Name of the signal
44 std::string fType; // Type of the signal
45
46 void Initialize();
47
48 public:
50 inline Int_t GetDaqID() const { return fDaqID; }
51
53 inline std::string GetName() const { return fName; }
54
56 inline std::string GetType() const { return fType; }
57
59 inline Int_t GetChannelId() const { return fChannelId; }
60
61 std::string GetChannelName() const { return fName; }
62 std::string GetChannelType() const { return fType; }
63
64 void SetChannelName(const std::string& name) { fName = name; }
65 void SetChannelType(const std::string& type) { fType = type; }
66
68 Int_t GetNumberOfPixels() { return fReadoutPixel.size(); }
69
70 TRestDetectorReadoutPixel& operator[](int n) { return fReadoutPixel[n]; }
71
74 if (n >= GetNumberOfPixels()) return nullptr;
75 return &fReadoutPixel[n];
76 }
77
79 void SetDaqID(Int_t id) { fDaqID = id; }
80
82 void SetChannelID(Int_t id) { fChannelId = id; }
83
85 void AddPixel(const TRestDetectorReadoutPixel& pixel) { fReadoutPixel.emplace_back(pixel); }
86
88 void SetName(const std::string& name) { fName = name; }
89
91 void SetType(const std::string& type) { fType = type; }
92
93 Int_t isInside(Double_t x, Double_t y);
94
95 void Print(int DetailLevel = 0);
96
97 // Constructor
99 // Destructor
101
102 ClassDef(TRestDetectorReadoutChannel, 6); // REST run class
103};
104#endif
std::vector< TRestDetectorReadoutPixel > fReadoutPixel
TRestDetectorReadoutChannel()
TRestDetectorReadoutChannel default constructor.
void Initialize()
Initializes the channel members.
std::string GetType() const
Returns the channel type.
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 SetName(const std::string &name)
Sets the channel name.
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.
void SetType(const std::string &type)
Sets the channel type.
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.
std::string GetName() const
Returns the channel name.
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.