Skip to content
Snippets Groups Projects
Commit 904625f3 authored by Vardan Tadevosyan's avatar Vardan Tadevosyan
Browse files

Added reading calibration constants and pedestal thresholds

parent b9210c89
No related branches found
No related tags found
No related merge requests found
......@@ -26,3 +26,5 @@ raddeg=3.14159265/180
#include "PARAM/haero.param"
#include "PARAM/hdc.param"
#include "PARAM/hdriftmap.param"
#include "PARAM/hcal.param"
......@@ -63,8 +63,10 @@
// Eventually need to learn to skip over, or properly analyze
// the pedestal events
run->SetEventRange(1,2000);// Physics Event number, does not
// run->SetEventRange(1,2000);// Physics Event number, does not
// include scaler or control events
// run->SetEventRange(1,999999);
run->SetEventRange(1,1);
// Define the analysis parameters
analyzer->SetEvent( event );
......
......@@ -15,6 +15,3 @@ if ( ! ($?LD_LIBRARY_PATH) ) then
setenv LD_LIBRARY_PATH ""
endif
setenv LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:${ANALYZER}:${HCANALYZER}"
......@@ -171,6 +171,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
};
gHcParms->LoadParmValues((DBRequest*)&list, prefix);
}
YPos = new Double_t* [fNLayers];
for(Int_t i=0;i<fNLayers;i++) {
YPos[i] = new Double_t [fNBlocks[i]];
......@@ -180,6 +181,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
};
gHcParms->LoadParmValues((DBRequest*)&list, prefix);
}
for(Int_t i=0;i<fNLayers;i++) {
cout << "Plane " << fLayerNames[i] << ":" << endl;
cout << " Block thickness: " << BlockThick[i] << endl;
......@@ -191,8 +193,159 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
cout << " " << YPos[i][j];
}
cout << endl;
}
//Calibration related parameters (from hcal.param).
fNtotBlocks=0; //total number of blocks
for (Int_t i=0; i<fNLayers; i++) fNtotBlocks += fNBlocks[i];
cout << "Total number of blocks in he calorimeter: " << fNtotBlocks << endl;
//Pedestal limits from hcal.param.
fCalPosPedLimit = new Int_t [fNtotBlocks];
fCalNegPedLimit = new Int_t [fNtotBlocks];
//Calibration constants
fCalPosCalConst = new Double_t [fNtotBlocks];
fCalNegCalConst = new Double_t [fNtotBlocks];
//Read in parameters from hcal.param
Double_t hcal_pos_cal_const[fNtotBlocks];
// Double_t hcal_pos_gain_ini[fNtotBlocks];
// Double_t hcal_pos_gain_cur[fNtotBlocks];
Int_t hcal_pos_ped_limit[fNtotBlocks];
Double_t hcal_pos_gain_cor[fNtotBlocks];
Double_t hcal_neg_cal_const[fNtotBlocks];
// Double_t hcal_neg_gain_ini[fNtotBlocks];
// Double_t hcal_neg_gain_cur[fNtotBlocks];
Int_t hcal_neg_ped_limit[fNtotBlocks];
Double_t hcal_neg_gain_cor[fNtotBlocks];
DBRequest list[]={
{"cal_pos_cal_const", hcal_pos_cal_const, kDouble, fNtotBlocks},
// {"cal_pos_gain_ini", hcal_pos_gain_ini, kDouble, fNtotBlocks},
// {"cal_pos_gain_cur", hcal_pos_gain_cur, kDouble, fNtotBlocks},
{"cal_pos_ped_limit", hcal_pos_ped_limit, kInt, fNtotBlocks},
{"cal_pos_gain_cor", hcal_pos_gain_cor, kDouble, fNtotBlocks},
{"cal_neg_cal_const", hcal_neg_cal_const, kDouble, fNtotBlocks},
// {"cal_neg_gain_ini", hcal_neg_gain_ini, kDouble, fNtotBlocks},
// {"cal_neg_gain_cur", hcal_neg_gain_cur, kDouble, fNtotBlocks},
{"cal_neg_ped_limit", hcal_neg_ped_limit, kInt, fNtotBlocks},
{"cal_neg_gain_cor", hcal_neg_gain_cor, kDouble, fNtotBlocks},
{0}
};
gHcParms->LoadParmValues((DBRequest*)&list, prefix);
//+++
cout << "hcal_pos_cal_const:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << hcal_pos_cal_const[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
// cout << "hcal_pos_gain_ini:" << endl;
// for (Int_t j=0; j<fNLayers; j++) {
// for (Int_t i=0; i<fNBlocks[j]; i++) {
// cout << hcal_pos_gain_ini[j*fNBlocks[j]+i] << " ";
// };
// cout << endl;
// };
// cout << "hcal_pos_gain_cur:" << endl;
// for (Int_t j=0; j<fNLayers; j++) {
// for (Int_t i=0; i<fNBlocks[j]; i++) {
// cout << hcal_pos_gain_cur[j*fNBlocks[j]+i] << " ";
// };
// cout << endl;
// };
cout << "hcal_pos_ped_limit:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << hcal_pos_ped_limit[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
cout << "hcal_pos_gain_cor:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << hcal_pos_gain_cor[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
//---
cout << "hcal_neg_cal_const:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << hcal_neg_cal_const[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
// cout << "hcal_neg_gain_ini:" << endl;
// for (Int_t j=0; j<fNLayers; j++) {
// for (Int_t i=0; i<fNBlocks[j]; i++) {
// cout << hcal_neg_gain_ini[j*fNBlocks[j]+i] << " ";
// };
// // cout << endl;
// };
// cout << "hcal_neg_gain_cur:" << endl;
// for (Int_t j=0; j<fNLayers; j++) {
// for (Int_t i=0; i<fNBlocks[j]; i++) {
// cout << hcal_neg_gain_cur[j*fNBlocks[j]+i] << " ";
// };
// cout << endl;
// };
cout << "hcal_neg_ped_limit:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << hcal_neg_ped_limit[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
cout << "hcal_neg_gain_cor:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << hcal_neg_gain_cor[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
//Calibration constants in GeV per ADC channel.
for (Int_t i=0; i<fNtotBlocks; i++) {
fCalPosCalConst[i] = hcal_pos_cal_const[i] * hcal_pos_gain_cor[i];
fCalNegCalConst[i] = hcal_neg_cal_const[i] * hcal_neg_gain_cor[i];
}
cout << "fCalPosCalConst:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << fCalPosCalConst[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
cout << "fCalNegCalConst:" << endl;
for (Int_t j=0; j<fNLayers; j++) {
for (Int_t i=0; i<fNBlocks[j]; i++) {
cout << fCalNegCalConst[j*fNBlocks[j]+i] << " ";
};
cout << endl;
};
fIsInit = true;
return kOK;
......
......@@ -38,20 +38,31 @@ public:
friend class THaScCalib;
THcShower(); // for ROOT I/O
protected:
Int_t fAnalyzePedestals;
// Calibration
// Number of events for pedestal calculations.
Int_t* fCalPosPedLimit;
Int_t* fCalNegPedLimit;
// Calibration constants
Double_t* fCalPosCalConst;
Double_t* fCalNegCalConst;
// Per-event data
// Potential Hall C parameters. Mostly here for demonstration
char** fLayerNames;
Int_t fNLayers;
Int_t fNRows;
Double_t* fNLayerZPos; // Z position of front of shower counter layers
Double_t* fNLayerZPos; // Z position of front of shower counter layers
Double_t* BlockThick; // Thickness of shower counter blocks, blocks
Int_t* fNBlocks; // Number of shower counter blocks per layer
Int_t* fNBlocks; // Number of shower counter blocks per layer
Int_t fNtotBlocks; // Total number of shower counter blocks
Double_t** YPos; //X,Y positions of shower counter blocks
Double_t* XPos;
......@@ -59,6 +70,7 @@ protected:
TClonesArray* fTrackProj; // projection of track onto scintillator plane
// and estimated match to TOF paddle
// Useful derived quantities
// double tan_angle, sin_angle, cos_angle;
......@@ -84,9 +96,9 @@ protected:
enum ESide { kLeft = 0, kRight = 1 };
virtual Double_t TimeWalkCorrection(const Int_t& paddle,
const ESide side);
const ESide side);
void Setup(const char* name, const char* description);
void Setup(const char* name, const char* description);
ClassDef(THcShower,0) // Generic hodoscope class
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment