Skip to content
Snippets Groups Projects
Commit 6f20736e authored by hallc-online's avatar hallc-online
Browse files

Clean up HMS calorimeter calibration code.

parent 1b84cdce
No related branches found
No related tags found
No related merge requests found
...@@ -65,10 +65,6 @@ class THcShTrack { ...@@ -65,10 +65,6 @@ class THcShTrack {
// Coordinate correction constants from hcana.param. // Coordinate correction constants from hcana.param.
// //
//// static const Double_t fAcor = 200.;
//// static const Double_t fBcor = 8000.;
//// static const Double_t fCcor = 64.36;
//// static const Double_t fDcor = 1.66;
static constexpr Double_t fAcor = 200.; static constexpr Double_t fAcor = 200.;
static constexpr Double_t fBcor = 8000.; static constexpr Double_t fBcor = 8000.;
static constexpr Double_t fCcor = 64.36; static constexpr Double_t fCcor = 64.36;
...@@ -76,12 +72,6 @@ class THcShTrack { ...@@ -76,12 +72,6 @@ class THcShTrack {
// Calorimeter geometry constants. // Calorimeter geometry constants.
// //
//// static const Double_t fZbl = 10; //cm, block transverse size
//// static const UInt_t fNrows = 13;
//// static const UInt_t fNcols = 4;
////static const UInt_t fNnegs = 26; // number of blocks with neg. side PMTs.
//// static const UInt_t fNpmts = 78; // total number of PMTs.
//// static const UInt_t fNblks = fNrows*fNcols;
static constexpr Double_t fZbl = 10; //cm, block transverse size static constexpr Double_t fZbl = 10; //cm, block transverse size
static constexpr UInt_t fNrows = 13; static constexpr UInt_t fNrows = 13;
static constexpr UInt_t fNcols = 4; static constexpr UInt_t fNcols = 4;
......
...@@ -27,14 +27,13 @@ ...@@ -27,14 +27,13 @@
#define DELTA_MIN -10 //HMS nominal acceptance #define DELTA_MIN -10 //HMS nominal acceptance
#define DELTA_MAX 10 #define DELTA_MAX 10
//#define PR_ADC_THR 0
//#define SH_ADC_THR 0
#define BETA_MIN 0.5 #define BETA_MIN 0.5
#define BETA_MAX 1.5 #define BETA_MAX 1.5
#define CER_MIN 1.5 #define CER_MIN 1.5
#define MIN_HIT_COUNT 100 // Minimum number of hits for a PMT to be calibrated.
using namespace std; using namespace std;
// //
...@@ -44,7 +43,6 @@ using namespace std; ...@@ -44,7 +43,6 @@ using namespace std;
class THcShowerCalib { class THcShowerCalib {
public: public:
//// THcShowerCalib(Int_t);
THcShowerCalib(string); THcShowerCalib(string);
THcShowerCalib(); THcShowerCalib();
~THcShowerCalib(); ~THcShowerCalib();
...@@ -65,13 +63,10 @@ class THcShowerCalib { ...@@ -65,13 +63,10 @@ class THcShowerCalib {
TH2F* hETAvsEPR; TH2F* hETAvsEPR;
private: private:
//// Int_t fRunNumber;
string fRunNumber; string fRunNumber;
Double_t fLoThr; // Low and high thresholds on the normalized uncalibrated Double_t fLoThr; // Low and high thresholds on the normalized uncalibrated
Double_t fHiThr; // energy deposition. Double_t fHiThr; // energy deposition.
UInt_t fNev; // Number of processed events. UInt_t fNev; // Number of processed events.
static const UInt_t fMinHitCount = 100; // Minimum number of hits for a PMT
// to be calibrated.
TTree* fTree; TTree* fTree;
UInt_t fNentries; UInt_t fNentries;
...@@ -155,7 +150,6 @@ THcShowerCalib::THcShowerCalib() {}; ...@@ -155,7 +150,6 @@ THcShowerCalib::THcShowerCalib() {};
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
////THcShowerCalib::THcShowerCalib(Int_t RunNumber) {
THcShowerCalib::THcShowerCalib(string RunNumber) { THcShowerCalib::THcShowerCalib(string RunNumber) {
fRunNumber = RunNumber; fRunNumber = RunNumber;
}; };
...@@ -200,7 +194,6 @@ void THcShowerCalib::Init() { ...@@ -200,7 +194,6 @@ void THcShowerCalib::Init() {
gROOT->Reset(); gROOT->Reset();
//// char* fname = Form("Root_files/hcal_calib_%d.root",fRunNumber);
char* fname = Form("ROOTfiles/hms_replay_%s.root",fRunNumber.c_str()); char* fname = Form("ROOTfiles/hms_replay_%s.root",fRunNumber.c_str());
cout << "THcShowerCalib::Init: Root file name = " << fname << endl; cout << "THcShowerCalib::Init: Root file name = " << fname << endl;
...@@ -214,37 +207,37 @@ void THcShowerCalib::Init() { ...@@ -214,37 +207,37 @@ void THcShowerCalib::Init() {
fTree->SetBranchAddress("H.cal.1pr.aneg_p",H_cal_1pr_aneg_p, fTree->SetBranchAddress("H.cal.1pr.aneg_p",H_cal_1pr_aneg_p,
&b_H_cal_1pr_aneg_p); &b_H_cal_1pr_aneg_p);
fTree->SetBranchAddress("H.cal.1pr.apos_p",H_cal_1pr_apos_p, fTree->SetBranchAddress("H.cal.1pr.apos_p",H_cal_1pr_apos_p,
&b_H_cal_1pr_apos_p); &b_H_cal_1pr_apos_p);
fTree->SetBranchAddress("H.cal.2ta.aneg_p",H_cal_2ta_aneg_p, fTree->SetBranchAddress("H.cal.2ta.aneg_p",H_cal_2ta_aneg_p,
&b_H_cal_2ta_aneg_p); &b_H_cal_2ta_aneg_p);
fTree->SetBranchAddress("H.cal.2ta.apos_p",H_cal_2ta_apos_p, fTree->SetBranchAddress("H.cal.2ta.apos_p",H_cal_2ta_apos_p,
&b_H_cal_2ta_apos_p); &b_H_cal_2ta_apos_p);
fTree->SetBranchAddress("H.cal.3ta.aneg_p",H_cal_3ta_aneg_p, fTree->SetBranchAddress("H.cal.3ta.aneg_p",H_cal_3ta_aneg_p,
&b_H_cal_3ta_aneg_p); &b_H_cal_3ta_aneg_p);
fTree->SetBranchAddress("H.cal.3ta.apos_p",H_cal_3ta_apos_p, fTree->SetBranchAddress("H.cal.3ta.apos_p",H_cal_3ta_apos_p,
&b_H_cal_3ta_apos_p); &b_H_cal_3ta_apos_p);
fTree->SetBranchAddress("H.cal.4ta.aneg_p",H_cal_4ta_aneg_p, fTree->SetBranchAddress("H.cal.4ta.aneg_p",H_cal_4ta_aneg_p,
&b_H_cal_4ta_aneg_p); &b_H_cal_4ta_aneg_p);
fTree->SetBranchAddress("H.cal.4ta.apos_p",H_cal_4ta_apos_p, fTree->SetBranchAddress("H.cal.4ta.apos_p",H_cal_4ta_apos_p,
&b_H_cal_4ta_apos_p); &b_H_cal_4ta_apos_p);
fTree->SetBranchAddress("H.tr.n", &H_tr_n,&b_H_tr_n); fTree->SetBranchAddress("H.tr.n", &H_tr_n,&b_H_tr_n);
fTree->SetBranchAddress("H.tr.x",&H_tr_x,&b_H_tr_x); fTree->SetBranchAddress("H.tr.x",&H_tr_x,&b_H_tr_x);
fTree->SetBranchAddress("H.tr.y",&H_tr_y,&b_H_tr_y); fTree->SetBranchAddress("H.tr.y",&H_tr_y,&b_H_tr_y);
fTree->SetBranchAddress("H.tr.th",&H_tr_xp,&b_H_tr_xp); fTree->SetBranchAddress("H.tr.th",&H_tr_xp,&b_H_tr_xp);
fTree->SetBranchAddress("H.tr.ph",&H_tr_yp,&b_H_tr_yp); fTree->SetBranchAddress("H.tr.ph",&H_tr_yp,&b_H_tr_yp);
fTree->SetBranchAddress("H.tr.p",&H_tr_p,&b_H_tr_p); fTree->SetBranchAddress("H.tr.p",&H_tr_p,&b_H_tr_p);
fTree->SetBranchAddress("H.tr.tg_dp", &H_tr_tg_dp,&b_H_tr_tg_dp); fTree->SetBranchAddress("H.tr.tg_dp", &H_tr_tg_dp,&b_H_tr_tg_dp);
fTree->SetBranchAddress("H.cer.npe", H_cer_npe,&b_H_cer_npe); fTree->SetBranchAddress("H.cer.npe", H_cer_npe,&b_H_cer_npe);
fTree->SetBranchAddress("H.tr.beta", &H_tr_beta,&b_H_tr_beta); fTree->SetBranchAddress("H.tr.beta", &H_tr_beta,&b_H_tr_beta);
fTree->SetBranchAddress("H.cal.nclust", &H_cal_nclust,&b_H_cal_nclust); fTree->SetBranchAddress("H.cal.nclust", &H_cal_nclust,&b_H_cal_nclust);
// Histogram declarations. // Histogram declarations.
...@@ -357,62 +350,6 @@ bool THcShowerCalib::ReadShRawTrack(THcShTrack &trk, UInt_t ientry) { ...@@ -357,62 +350,6 @@ bool THcShowerCalib::ReadShRawTrack(THcShTrack &trk, UInt_t ientry) {
// Set a Shower track event from ntuple ientry. // Set a Shower track event from ntuple ientry.
// //
// Declaration of leaves types
// Calorimeter ADC signals.
/*
Double_t H_cal_1pr_aneg_p[THcShTrack::fNrows];
Double_t H_cal_1pr_apos_p[THcShTrack::fNrows];
Double_t H_cal_2ta_aneg_p[THcShTrack::fNrows];
Double_t H_cal_2ta_apos_p[THcShTrack::fNrows];
Double_t H_cal_3ta_aneg_p[THcShTrack::fNrows];
Double_t H_cal_3ta_apos_p[THcShTrack::fNrows];
Double_t H_cal_4ta_aneg_p[THcShTrack::fNrows];
Double_t H_cal_4ta_apos_p[THcShTrack::fNrows];
// Track parameters.
double H_tr_n;
Double_t H_tr_p;
Double_t H_tr_x; //X FP
Double_t H_tr_xp;
Double_t H_tr_y; //Y FP
Double_t H_tr_yp;
Double_t H_tr_tg_dp;
Double_t H_cer_npe[2];
Double_t H_tr_beta;
*/
// Set branch addresses.
/*
TBranch ("H.cal.1pr.aneg_p",H_cal_1pr_aneg_p);
TBranch ("H.cal.1pr.apos_p",H_cal_1pr_apos_p);
TBranch ("H.cal.2ta.aneg_p",H_cal_2ta_aneg_p);
TBranch ("H.cal.2ta.apos_p",H_cal_2ta_apos_p);
TBranch ("H.cal.3ta.aneg_p",H_cal_3ta_aneg_p);
TBranch ("H.cal.3ta.apos_p",H_cal_3ta_apos_p);
TBranch ("H.cal.4ta.aneg_p",H_cal_4ta_aneg_p);
TBranch ("H.cal.4ta.apos_p",H_cal_4ta_apos_p);
TBranch ("H.tr.n", &H_tr_n);
TBranch ("H.tr.x",&H_tr_x);
TBranch ("H.tr.y",&H_tr_y);
TBranch ("H.tr.th",&H_tr_xp);
TBranch ("H.tr.ph",&H_tr_yp);
TBranch ("H.tr.p",&H_tr_p);
TBranch ("H.tr.tg_dp", &H_tr_tg_dp);
TBranch ("H.cer.npe", H_cer_npe);
TBranch ("H.tr.beta", &H_tr_beta);
*/
fTree->GetEntry(ientry); fTree->GetEntry(ientry);
if (ientry%100000 == 0) cout << " ReadShRawTrack: " << ientry << endl; if (ientry%100000 == 0) cout << " ReadShRawTrack: " << ientry << endl;
...@@ -696,13 +633,13 @@ void THcShowerCalib::SolveAlphas() { ...@@ -696,13 +633,13 @@ void THcShowerCalib::SolveAlphas() {
// correspondent elements 0, except self-correlation Q(i,i)=1. // correspondent elements 0, except self-correlation Q(i,i)=1.
cout << endl; cout << endl;
cout << "Channels with hit number less than " << fMinHitCount cout << "Channels with hit number less than " << MIN_HIT_COUNT
<< " will not be calibrated." << endl; << " will not be calibrated." << endl;
cout << endl; cout << endl;
for (UInt_t i=0; i<THcShTrack::fNpmts; i++) { for (UInt_t i=0; i<THcShTrack::fNpmts; i++) {
if (fHitCount[i] < fMinHitCount) { if (fHitCount[i] < MIN_HIT_COUNT) {
cout << "Channel " << i << ", " << fHitCount[i] cout << "Channel " << i << ", " << fHitCount[i]
<< " hits, will not be calibrated." << endl; << " hits, will not be calibrated." << endl;
q0[i] = 0.; q0[i] = 0.;
...@@ -786,8 +723,6 @@ void THcShowerCalib::FillHEcal() { ...@@ -786,8 +723,6 @@ void THcShowerCalib::FillHEcal() {
hEcal->Fill(Enorm); hEcal->Fill(Enorm);
//// Double_t delta;
//// fTree->SetBranchAddress("H.tr.tg_dp",&delta);
hDPvsEcal->Fill(Enorm,delta,1.); hDPvsEcal->Fill(Enorm,delta,1.);
hETAvsEPR->Fill(trk.EPRnorm(), trk.ETAnorm()); hETAvsEPR->Fill(trk.EPRnorm(), trk.ETAnorm());
...@@ -815,7 +750,6 @@ void THcShowerCalib::SaveAlphas() { ...@@ -815,7 +750,6 @@ void THcShowerCalib::SaveAlphas() {
// //
ofstream output; ofstream output;
//// char* fname = Form("hcal.param.%d",fRunNumber);
char* fname = Form("hcal.param.%s",fRunNumber.c_str()); char* fname = Form("hcal.param.%s",fRunNumber.c_str());
cout << "SaveAlphas: fname=" << fname << endl; cout << "SaveAlphas: fname=" << fname << endl;
......
...@@ -40,7 +40,7 @@ void hcal_calib(string RunNumber) { ...@@ -40,7 +40,7 @@ void hcal_calib(string RunNumber) {
theShowerCalib.hEuncSel->SetFillColor(kGreen); theShowerCalib.hEuncSel->SetFillColor(kGreen);
theShowerCalib.hEuncSel->DrawCopy("same"); theShowerCalib.hEuncSel->DrawCopy("same");
// E(Tail)%E(Preshower). // E(Tail) vs E(Preshower) plot.
Canvas->cd(2); Canvas->cd(2);
theShowerCalib.hETAvsEPR->Draw(); theShowerCalib.hETAvsEPR->Draw();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment