Skip to content
Snippets Groups Projects
Commit a18bed34 authored by Vardan Tadevosyan's avatar Vardan Tadevosyan Committed by Stephen A. Wood
Browse files

Add pedestal calculations for the ShowerArray class.

parent c93b3896
No related branches found
No related tags found
No related merge requests found
...@@ -324,46 +324,46 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -324,46 +324,46 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
//Calibration related parameters (from hcal.param). //Calibration related parameters (from hcal.param).
fNtotBlocks=0; //total number of blocks fNTotBlocks=0; //total number of blocks in the layers
for (UInt_t i=0; i<fNLayers; i++) fNtotBlocks += fNBlocks[i]; for (UInt_t i=0; i<fNLayers; i++) fNTotBlocks += fNBlocks[i];
// Debug output. // Debug output.
if (fdbg_init_cal) if (fdbg_init_cal)
cout << " Total number of blocks in the calorimeter: " << fNtotBlocks cout << " Total number of blocks in the layers of calorimeter: " << dec << fNTotBlocks
<< endl; << endl;
//Pedestal limits from hcal.param. //Pedestal limits from hcal.param.
fShPosPedLimit = new Int_t [fNtotBlocks]; fShPosPedLimit = new Int_t [fNTotBlocks];
fShNegPedLimit = new Int_t [fNtotBlocks]; fShNegPedLimit = new Int_t [fNTotBlocks];
//Calibration constants //Calibration constants
fPosGain = new Double_t [fNtotBlocks]; fPosGain = new Double_t [fNTotBlocks];
fNegGain = new Double_t [fNtotBlocks]; fNegGain = new Double_t [fNTotBlocks];
//Read in parameters from hcal.param //Read in parameters from hcal.param
Double_t hcal_pos_cal_const[fNtotBlocks]; Double_t hcal_pos_cal_const[fNTotBlocks];
// Double_t hcal_pos_gain_ini[fNtotBlocks]; not used // Double_t hcal_pos_gain_ini[fNTotBlocks]; not used
// Double_t hcal_pos_gain_cur[fNtotBlocks]; not used // Double_t hcal_pos_gain_cur[fNTotBlocks]; not used
// Int_t hcal_pos_ped_limit[fNtotBlocks]; not used // Int_t hcal_pos_ped_limit[fNTotBlocks]; not used
Double_t hcal_pos_gain_cor[fNtotBlocks]; Double_t hcal_pos_gain_cor[fNTotBlocks];
Double_t hcal_neg_cal_const[fNtotBlocks]; Double_t hcal_neg_cal_const[fNTotBlocks];
// Double_t hcal_neg_gain_ini[fNtotBlocks]; not used // Double_t hcal_neg_gain_ini[fNTotBlocks]; not used
// Double_t hcal_neg_gain_cur[fNtotBlocks]; not used // Double_t hcal_neg_gain_cur[fNTotBlocks]; not used
// Int_t hcal_neg_ped_limit[fNtotBlocks]; not used // Int_t hcal_neg_ped_limit[fNTotBlocks]; not used
Double_t hcal_neg_gain_cor[fNtotBlocks]; Double_t hcal_neg_gain_cor[fNTotBlocks];
DBRequest list[]={ DBRequest list[]={
{"cal_pos_cal_const", hcal_pos_cal_const, kDouble, fNtotBlocks}, {"cal_pos_cal_const", hcal_pos_cal_const, kDouble, fNTotBlocks},
// {"cal_pos_gain_ini", hcal_pos_gain_ini, kDouble, fNtotBlocks}, // {"cal_pos_gain_ini", hcal_pos_gain_ini, kDouble, fNTotBlocks},
// {"cal_pos_gain_cur", hcal_pos_gain_cur, kDouble, fNtotBlocks}, // {"cal_pos_gain_cur", hcal_pos_gain_cur, kDouble, fNTotBlocks},
{"cal_pos_ped_limit", fShPosPedLimit, kInt, fNtotBlocks}, {"cal_pos_ped_limit", fShPosPedLimit, kInt, fNTotBlocks},
{"cal_pos_gain_cor", hcal_pos_gain_cor, kDouble, fNtotBlocks}, {"cal_pos_gain_cor", hcal_pos_gain_cor, kDouble, fNTotBlocks},
{"cal_neg_cal_const", hcal_neg_cal_const, 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_ini", hcal_neg_gain_ini, kDouble, fNTotBlocks},
// {"cal_neg_gain_cur", hcal_neg_gain_cur, kDouble, fNtotBlocks}, // {"cal_neg_gain_cur", hcal_neg_gain_cur, kDouble, fNTotBlocks},
{"cal_neg_ped_limit", fShNegPedLimit, kInt, fNtotBlocks}, {"cal_neg_ped_limit", fShNegPedLimit, kInt, fNTotBlocks},
{"cal_neg_gain_cor", hcal_neg_gain_cor, kDouble, fNtotBlocks}, {"cal_neg_gain_cor", hcal_neg_gain_cor, kDouble, fNTotBlocks},
{"cal_min_peds", &fShMinPeds, kInt}, {"cal_min_peds", &fShMinPeds, kInt},
{0} {0}
}; };
...@@ -430,7 +430,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -430,7 +430,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
// Calibration constants (GeV / ADC channel). // Calibration constants (GeV / ADC channel).
for (UInt_t i=0; i<fNtotBlocks; i++) { for (UInt_t i=0; i<fNTotBlocks; i++) {
fPosGain[i] = hcal_pos_cal_const[i] * hcal_pos_gain_cor[i]; fPosGain[i] = hcal_pos_cal_const[i] * hcal_pos_gain_cor[i];
fNegGain[i] = hcal_neg_cal_const[i] * hcal_neg_gain_cor[i]; fNegGain[i] = hcal_neg_cal_const[i] * hcal_neg_gain_cor[i];
} }
......
...@@ -233,12 +233,12 @@ protected: ...@@ -233,12 +233,12 @@ protected:
Int_t fAnalyzePedestals; // Flag for pedestal analysis. Int_t fAnalyzePedestals; // Flag for pedestal analysis.
Int_t* fShPosPedLimit; // [fNtotBlocks] ADC limits for pedestal calc.-s. Int_t* fShPosPedLimit; // [fNTotBlocks] ADC limits for pedestal calc.-s.
Int_t* fShNegPedLimit; Int_t* fShNegPedLimit;
Int_t fShMinPeds; // Min.number of events to analyze pedestals. Int_t fShMinPeds; // Min.number of events to analyze pedestals.
Double_t* fPosGain; // [fNtotBlocks] Gain constants from calibration Double_t* fPosGain; // [fNTotBlocks] Gain constants from calibration
Double_t* fNegGain; Double_t* fNegGain;
// Per-event data // Per-event data
...@@ -263,7 +263,7 @@ protected: ...@@ -263,7 +263,7 @@ protected:
// Following apply to just sideways readout layers // Following apply to just sideways readout layers
Double_t* BlockThick; // Thickness of blocks Double_t* BlockThick; // Thickness of blocks
UInt_t* fNBlocks; // [fNLayers] number of blocks per layer UInt_t* fNBlocks; // [fNLayers] number of blocks per layer
UInt_t fNtotBlocks; // Total number of shower counter blocks UInt_t fNTotBlocks; // Total number of shower counter blocks
Double_t** XPos; // [fNLayers] X,Y,Z positions of blocks Double_t** XPos; // [fNLayers] X,Y,Z positions of blocks
Double_t* YPos; Double_t* YPos;
Double_t* ZPos; Double_t* ZPos;
......
...@@ -103,13 +103,17 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) ...@@ -103,13 +103,17 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date )
// Pedestal limits per channel. // Pedestal limits per channel.
fPedLimit = new Int_t [fNelem]; fPedLimit = new Int_t [fNelem];
DBRequest list1[]={
// {"cal_arr_cal_const", hcal_pos_cal_const, kDouble, fNelem},
{"cal_arr_ped_limit", fPedLimit, kInt, fNelem},
// {"cal_arr_gain_cor", hcal_pos_gain_cor, kDouble, fNelem},
// {"cal_min_peds", &fShMinPeds, kInt},
{0}
};
gHcParms->LoadParmValues((DBRequest*)&list1, prefix);
THcShower* fParent; THcShower* fParent;
fParent = (THcShower*) GetParent(); fParent = (THcShower*) GetParent();
for(Int_t i=0;i<fNelem;i++) {
fPedLimit[i] = fParent->GetPedLimit(i,fLayerNum,0); //layer 2, neg. side
}
fMinPeds = fParent->GetMinPeds(); fMinPeds = fParent->GetMinPeds();
InitializePedestals(); InitializePedestals();
...@@ -133,7 +137,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) ...@@ -133,7 +137,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date )
cout << "Debug output from THcShowerArray::ReadDatabase for " cout << "Debug output from THcShowerArray::ReadDatabase for "
<< GetParent()->GetPrefix() << ":" << endl; << GetParent()->GetPrefix() << ":" << endl;
cout << " Layer #" << fLayerNum << ", number of elements " << fNelem cout << " Layer #" << fLayerNum << ", number of elements " << dec << fNelem
<< endl; << endl;
cout << " Columns " << fNColumns << ", Rows " << fNRows << endl; cout << " Columns " << fNColumns << ", Rows " << fNRows << endl;
...@@ -213,9 +217,7 @@ Int_t THcShowerArray::FineProcess( TClonesArray& tracks ) ...@@ -213,9 +217,7 @@ Int_t THcShowerArray::FineProcess( TClonesArray& tracks )
//_____________________________________________________________________________ //_____________________________________________________________________________
Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
{ {
// Extract the data for this layer from hit list // Extract the data for this layer from hit list.
// Assumes that the hit list is sorted by layer, so we stop when the
// plane doesn't agree and return the index for the next hit.
THcShower* fParent; THcShower* fParent;
fParent = (THcShower*) GetParent(); fParent = (THcShower*) GetParent();
...@@ -329,10 +331,9 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) ...@@ -329,10 +331,9 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit)
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit); THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit);
// OK for hit list sorted by layer. if(hit->fPlane != fLayerNum) {
// if(hit->fPlane > fLayerNum) { break;
// break; }
// }
Int_t element = hit->fCounter - 1; // Should check if in range Int_t element = hit->fCounter - 1; // Should check if in range
...@@ -368,6 +369,10 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) ...@@ -368,6 +369,10 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit)
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ih); THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ih);
if(hit->fPlane != fLayerNum) {
break;
}
Int_t adc = fUsingFADC ? Int_t adc = fUsingFADC ?
hit->GetData(0,fPedSampLow,fPedSampHigh,fDataSampLow,fDataSampHigh) hit->GetData(0,fPedSampLow,fPedSampHigh,fDataSampLow,fDataSampHigh)
: :
...@@ -406,7 +411,7 @@ void THcShowerArray::CalculatePedestals( ) ...@@ -406,7 +411,7 @@ void THcShowerArray::CalculatePedestals( )
if ( ((THcShower*) GetParent())->fdbg_raw_cal ) { if ( ((THcShower*) GetParent())->fdbg_raw_cal ) {
cout << "---------------------------------------------------------------\n"; cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerArray::CalculatePedestals for" cout << "Debug output from THcShowerArray::CalculatePedestals for "
<< GetParent()->GetPrefix() << ":" << endl; << GetParent()->GetPrefix() << ":" << endl;
cout << " ADC pedestals and thresholds for calorimeter plane " cout << " ADC pedestals and thresholds for calorimeter plane "
...@@ -414,7 +419,7 @@ void THcShowerArray::CalculatePedestals( ) ...@@ -414,7 +419,7 @@ void THcShowerArray::CalculatePedestals( )
for(Int_t i=0; i<fNelem;i++) { for(Int_t i=0; i<fNelem;i++) {
cout << " element " << i << ": " cout << " element " << i << ": "
<< " Pedestal = " << fPed[i] << " Pedestal = " << fPed[i]
<< " /threshold = " << fThresh[i] << " threshold = " << fThresh[i]
<< endl; << endl;
} }
cout << "---------------------------------------------------------------\n"; cout << "---------------------------------------------------------------\n";
......
...@@ -175,7 +175,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) ...@@ -175,7 +175,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date )
cout << "Debug output from THcShowerPlane::ReadDatabase for " cout << "Debug output from THcShowerPlane::ReadDatabase for "
<< GetParent()->GetPrefix() << ":" << endl; << GetParent()->GetPrefix() << ":" << endl;
cout << " Layer #" << fLayerNum << ", number of elements " << fNelem cout << " Layer #" << fLayerNum << ", number of elements " << dec << fNelem
<< endl; << endl;
cout << " Origin of Layer at X = " << fOrigin.X() cout << " Origin of Layer at X = " << fOrigin.X()
......
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