REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorReadout.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_TRestDetectorReadout
24#define RestCore_TRestDetectorReadout
25
26#include <TRestMetadata.h>
27
28#include <iostream>
29
30#include "TRestDetectorReadoutPlane.h"
31
34 private:
35 void InitFromConfigFile() override;
36
37 void Initialize() override;
38
39 Bool_t fDecoding;
41
43 std::vector<TRestDetectorReadoutPlane>
45
46 Int_t fMappingNodes;
48 std::vector<TRestDetectorReadoutModule> fModuleDefinitions;
50
51 void ValidateReadout();
52
53 public:
54 TRestDetectorReadoutPlane& operator[](int p) { return fReadoutPlanes[p]; }
55
58
64
66 Int_t GetNumberOfModules();
67 Int_t GetNumberOfChannels();
68
69 Int_t GetModuleDefinitionId(TString name);
70
72 TRestDetectorReadoutModule* ParseModuleDefinition(TiXmlElement* moduleDefinition);
73 void GetPlaneModuleChannel(Int_t daqID, Int_t& planeID, Int_t& moduleID, Int_t& channelID);
74 Int_t GetHitsDaqChannel(const TVector3& position, Int_t& planeID, Int_t& moduleID, Int_t& channelID);
75 Int_t GetHitsDaqChannelAtReadoutPlane(const TVector3& hitPosition, Int_t& moduleID, Int_t& channelID,
76 Int_t planeId = 0);
77 Double_t GetX(Int_t signalID);
78 Double_t GetY(Int_t signalID);
80
81 Double_t GetX(Int_t planeID, Int_t modID, Int_t chID);
82 Double_t GetY(Int_t planeID, Int_t modID, Int_t chID);
83
84 // Detail Level:
85 // 0->this readout
86 // 1->+all readout plane
87 // 2->+all readout module
88 // 3->+all readout channel
89 // 4->+all readout pixel
90 inline void PrintMetadata() override { PrintMetadata(1); }
91 void PrintMetadata(Int_t DetailLevel);
92
93 void Draw();
94
95 // Constructor
97 explicit TRestDetectorReadout(const char* configFilename);
98 TRestDetectorReadout(const char* configFilename, std::string name);
99 // Destructor
100 ~TRestDetectorReadout() override;
101
102 ClassDefOverride(TRestDetectorReadout, 1);
103};
104#endif
A metadata class to generate/store a readout description.
std::vector< TRestDetectorReadoutPlane > fReadoutPlanes
A std::vector storing the TRestDetectorReadoutPlane definitions.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
Int_t GetNumberOfChannels()
Returns the total number of channels implemented in all the readout planes and modules.
~TRestDetectorReadout() override
TRestDetectorReadout default destructor.
Int_t GetHitsDaqChannelAtReadoutPlane(const TVector3 &hitPosition, Int_t &moduleID, Int_t &channelID, Int_t planeId=0)
This method recovers the channel daq id corresponding to the (x,y,z) coordinates given by argument....
TRestDetectorReadoutPlane * GetReadoutPlane(int p)
Returns a pointer to the readout plane by index.
TRestDetectorReadoutPlane * GetReadoutPlaneWithID(int id)
Returns a pointer to the readout plane by ID.
Double_t GetY(Int_t signalID)
It returns the physical Y-coordinate corresponding to a given signal id in plane coordinates.
TRestDetectorReadout()
TRestDetectorReadout default constructor.
void InitFromConfigFile() override
Initializes the readout members using the information given in the TRestDetectorReadout RML section.
Int_t fNReadoutPlanes
Number of readout planes present on the readout.
TRestDetectorReadoutModule * GetReadoutModuleWithID(int id)
Returns a pointer to the readout module by ID.
void AddReadoutPlane(TRestDetectorReadoutPlane plane)
Adds a readout plane to the readout.
Double_t GetX(Int_t signalID)
It returns the physical X-coordinate corresponding to a given signal id in plane coordinates.
Int_t GetNumberOfModules()
Returns the total number of modules implemented in all the readout planes.
TRestDetectorReadoutChannel * GetReadoutChannelWithDaqID(int daqId)
Returns a pointer to the readout channel by daq id.
*TRestDetectorReadoutModule definitions *void ValidateReadout()
This method is not implemented yet. But it could do some checks to help verifying the readout.
void Initialize() override
Initializes the readout members and defines the section name.
Int_t GetModuleDefinitionId(TString name)
Returns the id of the readout module with a given name.
Int_t GetNumberOfReadoutPlanes()
Returns the number of readout planes defined on the readout.
void Draw()
Draws the readout on screen. Not yet implemented.
A base class for any REST metadata class.
Definition: TRestMetadata.h:70