From 93a087c5ffbcfc46d80c2d87ba6592308f20a292 Mon Sep 17 00:00:00 2001 From: Vardan Tadevosyan <tadevosn@jlab.org> Date: Tue, 29 Dec 2015 16:33:34 +0400 Subject: [PATCH] Add geometric parameters in THcShowerArray class. --- src/THcShowerArray.cxx | 52 ++++++++++++++++++++++++++++++++++++++++-- src/THcShowerArray.h | 9 ++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 5cee71d..c64bbd9 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -44,6 +44,9 @@ THcShowerArray::THcShowerArray( const char* name, THcShowerArray::~THcShowerArray() { // Destructor + delete fXPos; + delete fYPos; + delete fADCHits; delete [] fA; @@ -88,8 +91,13 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) fDataSampLow=23; fDataSampHigh=49; DBRequest list[]={ - {"cal_nrows", &fNRows, kInt}, - {"cal_ncolumns", &fNColumns, kInt}, + {"cal_arr_nrows", &fNRows, kInt}, + {"cal_arr_ncolumns", &fNColumns, kInt}, + {"cal_arr_front_x", &fXFront, kDouble}, + {"cal_arr_front_y", &fYFront, kDouble}, + {"cal_arr_front_z", &fZFront, kDouble}, + {"cal_arr_xstep", &fXStep, kDouble}, + {"cal_arr_ystep", &fYStep, kDouble}, {"cal_using_fadc", &fUsingFADC, kInt, 0, 1}, {"cal_ped_sample_low", &fPedSampLow, kInt, 0, 1}, {"cal_ped_sample_high", &fPedSampHigh, kInt, 0, 1}, @@ -101,6 +109,22 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) fNelem = fNRows*fNColumns; + fXPos = new Double_t* [fNRows]; + fYPos = new Double_t* [fNRows]; + for (UInt_t i=0; i<fNRows; i++) { + fXPos[i] = new Double_t [fNColumns]; + fYPos[i] = new Double_t [fNColumns]; + } + + //Looking to the front, the numbering goes from left to right, and from top + //to bottom. + + for (UInt_t j=0; j<fNColumns; j++) + for (UInt_t i=0; i<fNRows; i++) { + fXPos[i][j] = fXFront - (fNRows-1)*fXStep/2 + fXStep*i; + fYPos[i][j] = fYFront + (fNColumns-1)*fYStep/2 - fYStep*j; + } + // Debug output. THcShower* fParent; @@ -115,6 +139,30 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) << endl; cout << " Columns " << fNColumns << ", Rows " << fNRows << endl; + cout << "Front X, Y Z: " << fXFront << ", " << fYFront << ", " << fZFront + << " cm" << endl; + + cout << " Block to block X and Y distances: " << fXStep << ", " << fYStep + << " cm" << endl; + + cout << "Block X coordinates:" << endl; + for (UInt_t i=0; i<fNRows; i++) { + for (UInt_t j=0; j<fNColumns; j++) { + cout << fXPos[i][j] << " "; + } + cout << endl; + } + cout << endl; + + cout << "Block Y coordinates:" << endl; + for (UInt_t i=0; i<fNRows; i++) { + for (UInt_t j=0; j<fNColumns; j++) { + cout << fYPos[i][j] << " "; + } + cout << endl; + } + cout << endl; + cout << " Using FADC " << fUsingFADC << endl; if (fUsingFADC) { cout << " FADC pedestal sample low = " << fPedSampLow << ", high = " diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h index 71d88a9..d4eb98a 100644 --- a/src/THcShowerArray.h +++ b/src/THcShowerArray.h @@ -71,8 +71,17 @@ protected: TClonesArray* fADCHits; // List of ADC hits // Parameters + Int_t fNRows; Int_t fNColumns; + Double_t fXFront; // Front position X + Double_t fYFront; // Front position Y + Double_t fZFront; // Front position Z, from FP + Double_t fXStep; // distance btw centers of blocks along X + Double_t fYStep; // distance btw centers of blocks along Y + Double_t** fXPos; // block X coordinates + Double_t** fYPos; // block Y coordinates + Int_t fUsingFADC; // != 0 if using FADC in sample mode Int_t fPedSampLow; // Sample range for Int_t fPedSampHigh; // dynamic pedestal -- GitLab