qupid 0.2
Quasi-Signal Generation Model for Pixelized Detector
Loading...
Searching...
No Matches
QPGraphFactory.cpp
1#include "QPGraphFactory.hpp"
2#include "QPDigitizerBase.hpp"
3#include "QPPixelBase.hpp"
4#include "TH2D.h"
5#include "TText.h"
6#include "TLine.h"
7
8QPGraphFactory::QPGraphFactory(QPDigitizerBase* digitizer, std::string name="fac1"): fDigitizer(digitizer), fName(name){;}
9
10
11
13 double sizeX = GetDigitizer()->GetSizeY();
14 double sizeY = GetDigitizer()->GetSizeY();
15 TH2D * h = new TH2D(TString::Format("hfact_%s_an", fName.c_str()), "AnalogSignal",
16 ndiv, -sizeX/2, sizeX/2, ndiv, -sizeY/2, sizeY/2);
17 for(int i=1; i<=ndiv; i++){
18 for(int j=1; j<=ndiv; j++){
19 double x = h->GetXaxis()->GetBinCenter(i);
20 double y = h->GetYaxis()->GetBinCenter(j);
21
22 double val = GetDigitizer()->GetAnalogSignal(x,y);
23
24 h->SetBinContent(i,j,val);
25 }
26 }
27 h->GetZaxis()->SetRangeUser(0.1, h->GetBinContent(h->GetMaximumBin()));
28 return h;
29}
30
32 double sizeX = GetDigitizer()->GetSizeY();
33 double sizeY = GetDigitizer()->GetSizeY();
34 int ndivX = GetDigitizer()->GetNPixelX();
35 int ndivY = GetDigitizer()->GetNPixelY();
36 TH2D * h = new TH2D(TString::Format("hfact_%s_dl", fName.c_str()), "DigitalSignal",
37 ndivX, -sizeX/2, sizeX/2, ndivY, -sizeY/2, sizeY/2);
38 for(int i=0; i<ndivX; i++){
39 for(int j=0; j<ndivY; j++){
40 double val = GetDigitizer()->GetPixel(i,j)->GetDigitalSignal();
41 h->SetBinContent(i+1,j+1,val);
42 }
43 }
44 h->GetZaxis()->SetRangeUser(0.1, h->GetBinContent(h->GetMaximumBin()));
45 return h;
46}
47
48TH2D* QPGraphFactory::DigitizedSignal(double threshold){
49 double sizeX = GetDigitizer()->GetSizeY();
50 double sizeY = GetDigitizer()->GetSizeY();
51 int ndivX = GetDigitizer()->GetNPixelX();
52 int ndivY = GetDigitizer()->GetNPixelY();
53 TH2D * h = new TH2D(TString::Format("hfact_%s_dd", fName.c_str()), "DigitizedSignal",
54 ndivX, -sizeX/2, sizeX/2, ndivY, -sizeY/2, sizeY/2);
55 for(int i=0; i<ndivX; i++){
56 for(int j=0; j<ndivY; j++){
57 double val = GetDigitizer()->GetPixel(i,j)->GetDigitalSignal();
58 if(val > threshold){
59 h->SetBinContent(i+1,j+1,1);
60 }else{
61 h->SetBinContent(i+1,j+1,0);
62 }
63 }
64 }
65 h->GetZaxis()->SetRangeUser(0, 1);
66 return h;
67}
68
70 int binx = GetDigitizer()->GetNPixelX();
71 int biny = GetDigitizer()->GetNPixelX();
72 double pitx = GetDigitizer()->GetSizeX() / (binx);
73 double pity = GetDigitizer()->GetSizeY() / (biny);
74 double offsetx = -(GetDigitizer()->GetSizeX())*0.5 + pitx*0.5;
75 double offsety = -(GetDigitizer()->GetSizeY())*0.5 + pity*0.5;
76
77 for(int i=0; i<binx; i++){
78 for(int j=0; j<biny; j++){
79
80 double xc;
81 double yc;
82
83 if(h==nullptr){
84 xc = pitx*i + offsetx;
85 yc = pity*j + offsety;
86 }else{
87 xc = h->GetXaxis()->GetBinCenter(i+1);
88 yc = h->GetYaxis()->GetBinCenter(j+1);
89 }
90
91 double val = GetDigitizer()->GetPixel(i,j)->GetDigitalSignal();
92
93 // h1->SetBinContent(i,j,val);
94
95 TText* t = new TText(xc, yc, TString::Format("%.0f", val));
96 t->SetTextAlign(22);
97 t->SetTextColor(kWhite);
98 t->SetTextFont(43);
99 t->SetTextSize(10);
100 t->SetTextAngle(0);
101 t->Draw();
102 }
103 }
104
105}
106
108 // Not yet implemented.
109}
Abstract pixel-matrix digitizer: owns the injected signals and the matrix geometry; concrete classes ...
virtual double GetAnalogSignal(const double &x, const double &y)
Summed signal density of all injected signals at (x, y), .
int GetNPixelY() const
double GetSizeY() const
double GetSizeX() const
virtual QPPixelBase * GetPixel(const int index)
Pixel by linear index.
int GetNPixelX() const
QPGraphFactory(QPDigitizerBase *digitizer, std::string name)
void DrawDigitalSignalText(TH2D *h=nullptr)
Draws each pixel's digital value as a TText on the current pad.
QPDigitizerBase * GetDigitizer() const
TH2D * AnalogSignal(int ndiv=100)
ndiv×ndiv sampling of GetAnalogSignal over the matrix.
TH2D * DigitizedSignal(double threshold=0.1)
Binary fired-pixel map: 1 where the digital signal exceeds threshold, 0 elsewhere.
TH2D * DigitalSignal()
One bin per pixel, filled with the pixel's integrated digital signal (electrons).
void DrawPixelLinse(TH2D *h=nullptr)
Not implemented; the body is empty.
double GetDigitalSignal()
Total collected charge of the pixel: GetDigitalSignalOne summed over every signal injected into the d...