2 #include "TRestDetectorGainMap.h"
7 #include "TRestDetectorReadout.h"
23 auto iter = fChannelGain.begin();
24 while (iter != fChannelGain.end()) {
25 if (max < iter->first) max = iter->first;
26 if (min > iter->first) min = iter->first;
30 TH1D* h =
new TH1D(
"GainMap",
"GainMap", max - min + 2, min - 1, max + 1);
31 iter = fChannelGain.begin();
32 while (iter != fChannelGain.end()) {
33 h->SetBinContent(h->FindBin(iter->first), iter->second);
38 double xmin = 0, xmax = mod->
GetSize().X(), ymin = 0, ymax = mod->
GetSize().Y();
39 cout << xmin <<
" " << xmax <<
" " << ymin <<
" " << ymax << endl;
41 TCanvas* c1 =
new TCanvas();
42 gStyle->SetPalette(kBlueYellow);
46 TGraph2D* gr =
new TGraph2D();
48 TRandom* r =
new TRandom();
50 for (
int i = 0; i < N; i++) {
51 double x = xmax * (r->Rndm());
52 double y = ymax * (r->Rndm());
53 gr->SetPoint(i, x, y, 1);
59 if (fChannelGain.count(
id) == 0) fChannelGain[
id] = 1;
62 gr->SetPoint(i + N, pos.X(), pos.Y(), fChannelGain[id]);
64 cout << pos.X() <<
" " << pos.Y() <<
" " << fChannelGain[id] << endl;
72 gr->SetPoint(0, xmin, ymin, 1);
73 gr->SetPoint(1, xmin, ymax, 1);
74 gr->SetPoint(2, xmax, ymin, 1);
75 gr->SetPoint(3, xmax, ymax, 1);
77 gr->SetTitle(Form(
"Channel gain map for readout module%i", mod->
GetModuleID()));
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
Int_t GetDaqID() const
Returns the corresponding daq channel id.
TRestDetectorReadoutPixel * GetPixel(int n)
Returns a pointer to the pixel n by index.
Int_t GetNumberOfPixels()
Returns the total number of pixels inside the readout channel.
Int_t GetModuleID() const
Returns the module id.
TVector2 GetSize() const
Returns the module size (x, y) in mm.
TRestDetectorReadoutChannel * GetChannel(size_t n)
Returns a pointer to a readout channel by index.
size_t GetNumberOfChannels() const
Returns the total number of channels defined inside the module.