diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 80d7623a5e78405b90b6de485250523cf62a1b8f..00228e110a3eba13932ee27e0ea917c8febf30a1 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -324,46 +324,46 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) //Calibration related parameters (from hcal.param). - fNtotBlocks=0; //total number of blocks - for (UInt_t i=0; i<fNLayers; i++) fNtotBlocks += fNBlocks[i]; + fNTotBlocks=0; //total number of blocks in the layers + for (UInt_t i=0; i<fNLayers; i++) fNTotBlocks += fNBlocks[i]; // Debug output. 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; //Pedestal limits from hcal.param. - fShPosPedLimit = new Int_t [fNtotBlocks]; - fShNegPedLimit = new Int_t [fNtotBlocks]; + fShPosPedLimit = new Int_t [fNTotBlocks]; + fShNegPedLimit = new Int_t [fNTotBlocks]; //Calibration constants - fPosGain = new Double_t [fNtotBlocks]; - fNegGain = new Double_t [fNtotBlocks]; + fPosGain = new Double_t [fNTotBlocks]; + fNegGain = new Double_t [fNTotBlocks]; //Read in parameters from hcal.param - Double_t hcal_pos_cal_const[fNtotBlocks]; - // Double_t hcal_pos_gain_ini[fNtotBlocks]; not used - // Double_t hcal_pos_gain_cur[fNtotBlocks]; not used - // Int_t hcal_pos_ped_limit[fNtotBlocks]; not used - Double_t hcal_pos_gain_cor[fNtotBlocks]; - - Double_t hcal_neg_cal_const[fNtotBlocks]; - // Double_t hcal_neg_gain_ini[fNtotBlocks]; not used - // Double_t hcal_neg_gain_cur[fNtotBlocks]; not used - // Int_t hcal_neg_ped_limit[fNtotBlocks]; not used - Double_t hcal_neg_gain_cor[fNtotBlocks]; + Double_t hcal_pos_cal_const[fNTotBlocks]; + // Double_t hcal_pos_gain_ini[fNTotBlocks]; not used + // Double_t hcal_pos_gain_cur[fNTotBlocks]; not used + // Int_t hcal_pos_ped_limit[fNTotBlocks]; not used + Double_t hcal_pos_gain_cor[fNTotBlocks]; + + Double_t hcal_neg_cal_const[fNTotBlocks]; + // Double_t hcal_neg_gain_ini[fNTotBlocks]; not used + // Double_t hcal_neg_gain_cur[fNTotBlocks]; not used + // Int_t hcal_neg_ped_limit[fNTotBlocks]; not used + 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", fShPosPedLimit, 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", fShNegPedLimit, kInt, fNtotBlocks}, - {"cal_neg_gain_cor", hcal_neg_gain_cor, 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_cur", hcal_pos_gain_cur, kDouble, fNTotBlocks}, + {"cal_pos_ped_limit", fShPosPedLimit, 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", fShNegPedLimit, kInt, fNTotBlocks}, + {"cal_neg_gain_cor", hcal_neg_gain_cor, kDouble, fNTotBlocks}, {"cal_min_peds", &fShMinPeds, kInt}, {0} }; @@ -430,7 +430,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) // 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]; fNegGain[i] = hcal_neg_cal_const[i] * hcal_neg_gain_cor[i]; } diff --git a/src/THcShower.h b/src/THcShower.h index 738bdace5c61dbdbb31e4b276df49ec0dd16da90..d6005376e254e09d775c8602100ae7b0c92d4e39 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -233,12 +233,12 @@ protected: 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 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; // Per-event data @@ -263,7 +263,7 @@ protected: // Following apply to just sideways readout layers Double_t* BlockThick; // Thickness of blocks 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* YPos; Double_t* ZPos; diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 5d5d9a908e7aae6f7989757f77feab94b7071765..a171e940910a2fed19ee0c4fd5e24e9c09a80ad1 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -103,13 +103,17 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) // Pedestal limits per channel. 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; 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(); InitializePedestals(); @@ -133,7 +137,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) cout << "Debug output from THcShowerArray::ReadDatabase for " << GetParent()->GetPrefix() << ":" << endl; - cout << " Layer #" << fLayerNum << ", number of elements " << fNelem + cout << " Layer #" << fLayerNum << ", number of elements " << dec << fNelem << endl; cout << " Columns " << fNColumns << ", Rows " << fNRows << endl; @@ -213,9 +217,7 @@ Int_t THcShowerArray::FineProcess( TClonesArray& tracks ) //_____________________________________________________________________________ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) { - // 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. + // Extract the data for this layer from hit list. THcShower* fParent; fParent = (THcShower*) GetParent(); @@ -329,10 +331,9 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit); - // OK for hit list sorted by layer. - // if(hit->fPlane > fLayerNum) { - // break; - // } + if(hit->fPlane != fLayerNum) { + break; + } Int_t element = hit->fCounter - 1; // Should check if in range @@ -368,6 +369,10 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ih); + if(hit->fPlane != fLayerNum) { + break; + } + Int_t adc = fUsingFADC ? hit->GetData(0,fPedSampLow,fPedSampHigh,fDataSampLow,fDataSampHigh) : @@ -406,7 +411,7 @@ void THcShowerArray::CalculatePedestals( ) if ( ((THcShower*) GetParent())->fdbg_raw_cal ) { cout << "---------------------------------------------------------------\n"; - cout << "Debug output from THcShowerArray::CalculatePedestals for" + cout << "Debug output from THcShowerArray::CalculatePedestals for " << GetParent()->GetPrefix() << ":" << endl; cout << " ADC pedestals and thresholds for calorimeter plane " @@ -414,7 +419,7 @@ void THcShowerArray::CalculatePedestals( ) for(Int_t i=0; i<fNelem;i++) { cout << " element " << i << ": " << " Pedestal = " << fPed[i] - << " /threshold = " << fThresh[i] + << " threshold = " << fThresh[i] << endl; } cout << "---------------------------------------------------------------\n"; diff --git a/src/THcShowerPlane.cxx b/src/THcShowerPlane.cxx index d884bc93ad2b319b059c5bd7f4fbf6ffa7ecdc6d..cb4518336126d5f3012d7f6e0ecbff381d09be95 100644 --- a/src/THcShowerPlane.cxx +++ b/src/THcShowerPlane.cxx @@ -175,7 +175,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) cout << "Debug output from THcShowerPlane::ReadDatabase for " << GetParent()->GetPrefix() << ":" << endl; - cout << " Layer #" << fLayerNum << ", number of elements " << fNelem + cout << " Layer #" << fLayerNum << ", number of elements " << dec << fNelem << endl; cout << " Origin of Layer at X = " << fOrigin.X()