13 #include <digreadoutmap.h>
26 #include <TClonesArray.h>
48 DIGReadoutmap::DIGReadoutmap(Int_t Npixels)
51 fPixelMap.resize(fNpixels);
52 fAnalogChargeMap.resize(fNpixels);
53 fDigitalChargeMap.resize(fNpixels);
57 DIGReadoutmap::~DIGReadoutmap() {
64 DIGReadoutmap::DIGReadoutmap(
DIGReadoutmap & adigreadoutmap) : TObject()
67 fNpixels = adigreadoutmap.GetNpixels();
68 fPixelMap.resize(fNpixels);
69 fAnalogChargeMap.resize(fNpixels);
70 fDigitalChargeMap.resize(fNpixels);
71 for (Int_t i=0 ; i<fNpixels ; i++){
72 fPixelMap[i] = adigreadoutmap.GetPixelMap()[i];
73 fAnalogChargeMap[i] = adigreadoutmap.GetAnalogCharge()[i];
74 fDigitalChargeMap[i] = adigreadoutmap.GetDigitalCharge()[i];
79 void DIGReadoutmap::Clear(
const Option_t *)
86 void DIGReadoutmap::PrintInfo() {
87 std::cout<<
"---------DIGReadoutmap properties------------- "<<endl;
88 std::cout<<fNpixels<<
" fNpixels map analog digital "<<endl;
90 std::cout<<
" size vectors "<< fPixelMap.size()<<
" "<<fAnalogChargeMap.size()<<
" "<<fDigitalChargeMap.size()<<endl;
91 for (Int_t i=0 ; i<fNpixels ; i++){
92 std::cout<<i<<
" "<<fPixelMap[i]<<
" "<<fAnalogChargeMap[i]<<
" "<<fDigitalChargeMap[i]<<endl;
95 std::cout<<
"---------END OF DIGReadoutmap properties------------- "<<endl;
99 void DIGReadoutmap::PrintOuput(Int_t Nx ,Int_t Ny) {
100 std::cout<<
"---------DIGReadoutmap PrintOuput------------- "<<endl;
101 std::cout<<fNpixels<<
" fNpixels "<<endl;
103 std::cout<<
" size vectors "<< fPixelMap.size()<<
" "<<fAnalogChargeMap.size()<<
" "<<fDigitalChargeMap.size()<<endl;
104 for (Int_t iy=0 ; iy<Ny ; iy++){
105 for (Int_t ix=0 ; ix<Nx ; ix++){
107 Int_t Npixel = ix+Nx*iy;
108 Bool_t found =
false;
110 while((!found)&&(j<fNpixels)){
111 if(Npixel==fPixelMap[j]){
113 cout<<
" "<<fDigitalChargeMap[j];
126 std::cout<<
"---------END OF DIGReadoutmap PrintOuput------------- "<<endl;
130 void DIGReadoutmap::AddPixel(Float_t AnalogCharge, Int_t PixelNumber) {
132 fPixelMap.push_back(PixelNumber);
133 fAnalogChargeMap.push_back(AnalogCharge);
134 fDigitalChargeMap.push_back(0);
138 void DIGReadoutmap::UpdatePixel(Float_t AnalogCharge, Int_t PixelNumber) {
139 Bool_t found =
false;
141 while((!found)&&(i<fNpixels)){
142 if(PixelNumber==fPixelMap[i]){
144 fAnalogChargeMap[i]+=AnalogCharge;
149 AddPixel(AnalogCharge, PixelNumber);
155 void DIGReadoutmap::AnalogToDigitalconversion(
DIGADC *myDIGADC,
DIGPlane *myDIGPlane ){
156 Double_t Noisefix = myDIGPlane->GetNoiseElectrons();
158 std::cout <<
"<---- DIGReadoutmap::AnalogToDigitalconversion --->"<<endl;
159 std::cout<<
"WARNING negative or null Noise is not physical, please correct the input file"<<endl;
162 for (Int_t i = 0; i < fNpixels ; i++){
163 if (fAnalogChargeMap[i]<=0.0){
164 fDigitalChargeMap[i]=0;
166 Bool_t thresholdfound =
false;
168 fDigitalChargeMap[i]=0;
169 while((thresholdfound==
false)&&(ithres< (myDIGADC->GetNThresholds()) )){
170 if( (fAnalogChargeMap[i]/Noisefix) < myDIGADC->GetADC_thresholds()[ithres] ){
171 thresholdfound =
true;
173 fDigitalChargeMap[i]++;