Skip to content
Snippets Groups Projects
Commit 5ef90b4b authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Get shower counter parameters using DBRequest/LoadParmValues.

Change shower plane names from 1z, 2z, 3z, 4z to 1pr, 2ta, 3ta, 4ta
  to match the names used in the parameters.
Fix up histogram names for new plane names.
Get rid of duplicate THaNonTrackingDetector::Init call.
parent 2e7c6877
No related branches found
No related tags found
No related merge requests found
...@@ -26,26 +26,26 @@ TH1F hposadc4 'HMS s2y+ ADC hits' H.hod.2y.posadchits 10 0.5 10.5 ...@@ -26,26 +26,26 @@ TH1F hposadc4 'HMS s2y+ ADC hits' H.hod.2y.posadchits 10 0.5 10.5
TH1F hnegadc4 'HMS s2y- ADC hits' H.hod.2y.negadchits 10 0.5 10.5 TH1F hnegadc4 'HMS s2y- ADC hits' H.hod.2y.negadchits 10 0.5 10.5
# ADC hits per Calorimeter layer # ADC hits per Calorimeter layer
TH1F chposadc1 'HMS Cal A+ ADC hits' H.Cal.1z.posadchits 13 0.5 13.5 TH1F chposadc1 'HMS Cal A+ ADC hits' H.Cal.1pr.posadchits 13 0.5 13.5
TH1F chnegadc1 'HMS Cal A- ADC hits' H.Cal.1z.negadchits 13 0.5 13.5 TH1F chnegadc1 'HMS Cal A- ADC hits' H.Cal.1pr.negadchits 13 0.5 13.5
TH1F chposadc2 'HMS Cal B+ ADC hits' H.Cal.2z.posadchits 13 0.5 13.5 TH1F chposadc2 'HMS Cal B+ ADC hits' H.Cal.2ta.posadchits 13 0.5 13.5
TH1F chnegadc2 'HMS Cal B- ADC hits' H.Cal.2z.negadchits 13 0.5 13.5 TH1F chnegadc2 'HMS Cal B- ADC hits' H.Cal.2ta.negadchits 13 0.5 13.5
TH1F chposadc3 'HMS Cal C+ ADC hits' H.Cal.3z.posadchits 13 0.5 13.5 TH1F chposadc3 'HMS Cal C+ ADC hits' H.Cal.3ta.posadchits 13 0.5 13.5
TH1F chposadc4 'HMS Cal D+ ADC hits' H.Cal.4z.posadchits 13 0.5 13.5 TH1F chposadc4 'HMS Cal D+ ADC hits' H.Cal.4ta.posadchits 13 0.5 13.5
TH1F calposadc1 'HMS Cal ADC1' H.Cal.1z.posadc1 150 -50 400 TH1F calposadc1 'HMS Cal ADC1' H.Cal.1pr.posadc1 150 -50 400
# TH1F calposadc2 'HMS Cal ADC2' H.Cal.2z.posadc1 150 -50 400 # TH1F calposadc2 'HMS Cal ADC2' H.Cal.2ta.posadc1 150 -50 400
# TH1F chposadc 'HMS Cal ADC3' H.Cal.1z.posadc3 150 -50 400 # TH1F chposadc 'HMS Cal ADC3' H.Cal.1pr.posadc3 150 -50 400
# TH1F chposadc 'HMS Cal ADC4' H.Cal.1z.posadc4 150 -50 400 # TH1F chposadc 'HMS Cal ADC4' H.Cal.1pr.posadc4 150 -50 400
# TH1F chposadc 'HMS Cal ADC5' H.Cal.1z.posadc5 150 -50 400 # TH1F chposadc 'HMS Cal ADC5' H.Cal.1pr.posadc5 150 -50 400
# TH1F chposadc 'HMS Cal ADC6' H.Cal.1z.posadc6 150 -50 400 # TH1F chposadc 'HMS Cal ADC6' H.Cal.1pr.posadc6 150 -50 400
# TH1F chposadc 'HMS Cal ADC7' H.Cal.1z.posadc7 150 -50 400 # TH1F chposadc 'HMS Cal ADC7' H.Cal.1pr.posadc7 150 -50 400
# TH1F chposadc 'HMS Cal ADC8' H.Cal.1z.posadc8 150 -50 400 # TH1F chposadc 'HMS Cal ADC8' H.Cal.1pr.posadc8 150 -50 400
# TH1F chposadc 'HMS Cal ADC9' H.Cal.1z.posadc9 150 -50 400 # TH1F chposadc 'HMS Cal ADC9' H.Cal.1pr.posadc9 150 -50 400
# TH1F chposadc 'HMS Cal ADC10' H.Cal.1z.posadc10 150 -50 400 # TH1F chposadc 'HMS Cal ADC10' H.Cal.1pr.posadc10 150 -50 400
# TH1F chposadc 'HMS Cal ADC11' H.Cal.1z.posadc11 150 -50 400 # TH1F chposadc 'HMS Cal ADC11' H.Cal.1pr.posadc11 150 -50 400
# TH1F chposadc 'HMS Cal ADC12' H.Cal.1z.posadc12 150 -50 400 # TH1F chposadc 'HMS Cal ADC12' H.Cal.1pr.posadc12 150 -50 400
# TH1F chposadc 'HMS Cal ADC13' H.Cal.1z.posadc13 150 -50 400 # TH1F chposadc 'HMS Cal ADC13' H.Cal.1pr.posadc13 150 -50 400
#TH1F hdcrawtdc #TH1F hdcrawtdc
#TH1F hdccuttdc #TH1F hdccuttdc
......
...@@ -37,7 +37,6 @@ THcShower::THcShower( const char* name, const char* description, ...@@ -37,7 +37,6 @@ THcShower::THcShower( const char* name, const char* description,
THaNonTrackingDetector(name,description,apparatus) THaNonTrackingDetector(name,description,apparatus)
{ {
// Constructor // Constructor
Setup(name, description);
// fTrackProj = new TClonesArray( "THaTrackProj", 5 ); // fTrackProj = new TClonesArray( "THaTrackProj", 5 );
} }
...@@ -60,11 +59,12 @@ void THcShower::Setup(const char* name, const char* description) ...@@ -60,11 +59,12 @@ void THcShower::Setup(const char* name, const char* description)
fNLayers = 4; // Eventually get # layers and layer names from a DB fNLayers = 4; // Eventually get # layers and layer names from a DB
fLayerNames = new char* [fNLayers]; fLayerNames = new char* [fNLayers];
for(Int_t i=0;i<fNLayers;i++) {fLayerNames[i] = new char[3];} for(Int_t i=0;i<fNLayers;i++) {fLayerNames[i] = new char[4];}
strcpy(fLayerNames[0],"1z"); // Use layer names to help construct parameter names
strcpy(fLayerNames[1],"2z"); strcpy(fLayerNames[0],"1pr");
strcpy(fLayerNames[2],"3z"); strcpy(fLayerNames[1],"2ta");
strcpy(fLayerNames[3],"4z"); strcpy(fLayerNames[2],"3ta");
strcpy(fLayerNames[3],"4ta");
size_t nlen = strlen(name); size_t nlen = strlen(name);
size_t slen = 0; size_t slen = 0;
...@@ -92,10 +92,7 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date ) ...@@ -92,10 +92,7 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date )
static const char* const here = "Init()"; static const char* const here = "Init()";
cout << "THcShower::Init " << GetName() << endl; cout << "THcShower::Init " << GetName() << endl;
Setup(GetName(), GetTitle());
if( THaNonTrackingDetector::Init( date ) )
return fStatus;
// Should probably put this in ReadDatabase as we will know the // Should probably put this in ReadDatabase as we will know the
// maximum number of hits after setting up the detector map // maximum number of hits after setting up the detector map
...@@ -131,6 +128,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -131,6 +128,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
// 'date' contains the date/time of the run being analyzed. // 'date' contains the date/time of the run being analyzed.
// static const char* const here = "ReadDatabase()"; // static const char* const here = "ReadDatabase()";
char prefix[2];
// Read data from database // Read data from database
// Pull values from the THcParmList instead of reading a database // Pull values from the THcParmList instead of reading a database
...@@ -142,89 +140,47 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -142,89 +140,47 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
// Will need to determine which spectrometer in order to construct // Will need to determine which spectrometer in order to construct
// the parameter names (e.g. hscin_1x_nr vs. sscin_1x_nr) // the parameter names (e.g. hscin_1x_nr vs. sscin_1x_nr)
cout << "THcShower::ReadDatabase called " << GetName() << endl; cout << "THcShower::ReadDatabase called " << GetName() << endl;
fNLayers = 4; // Hardwire for now prefix[0]=tolower(GetApparatus()->GetName()[0]);
prefix[1]='\0';
BlockThick = new Double_t [fNLayers]; BlockThick = new Double_t [fNLayers];
fNBlocks = new Int_t [fNLayers];
BlockThick[0] = *(Double_t *)gHcParms->Find("hcal_1pr_thick")->GetValuePointer();
BlockThick[1] = *(Double_t *)gHcParms->Find("hcal_2ta_thick")->GetValuePointer();
BlockThick[2] = *(Double_t *)gHcParms->Find("hcal_3ta_thick")->GetValuePointer();
BlockThick[3] = *(Double_t *)gHcParms->Find("hcal_4ta_thick")->GetValuePointer();
cout << "Block thickness: " << BlockThick[2] << endl;
fNBlocks = new Int_t [fNLayers];
fNBlocks[0] = *(Int_t *)gHcParms->Find("hcal_1pr_nr")->GetValuePointer();
fNBlocks[1] = *(Int_t *)gHcParms->Find("hcal_2ta_nr")->GetValuePointer();
fNBlocks[2] = *(Int_t *)gHcParms->Find("hcal_3ta_nr")->GetValuePointer();
fNBlocks[3] = *(Int_t *)gHcParms->Find("hcal_4ta_nr")->GetValuePointer();
cout << "Number of blocks per layer: " << fNBlocks[2] << endl;
fNLayerZPos = new Double_t [fNLayers]; fNLayerZPos = new Double_t [fNLayers];
fNLayerZPos[0] = *(Double_t *)gHcParms->Find("hcal_1pr_zpos")->GetValuePointer();
fNLayerZPos[1] = *(Double_t *)gHcParms->Find("hcal_2ta_zpos")->GetValuePointer();
fNLayerZPos[2] = *(Double_t *)gHcParms->Find("hcal_3ta_zpos")->GetValuePointer();
fNLayerZPos[3] = *(Double_t *)gHcParms->Find("hcal_4ta_zpos")->GetValuePointer();
cout << "Z Position: " << fNLayerZPos[2] << endl;
XPos = new Double_t [2*fNLayers]; XPos = new Double_t [2*fNLayers];
XPos[0] = *(Double_t *)gHcParms->Find("hcal_1pr_left")->GetValuePointer(); for(Int_t i=0;i<fNLayers;i++) {
XPos[1] = *(Double_t *)gHcParms->Find("hcal_1pr_right")->GetValuePointer(); DBRequest list[]={
XPos[2] = *(Double_t *)gHcParms->Find("hcal_2ta_left")->GetValuePointer(); {Form("cal_%s_thick",fLayerNames[i]), &BlockThick[i], kDouble},
XPos[3] = *(Double_t *)gHcParms->Find("hcal_2ta_right")->GetValuePointer(); {Form("cal_%s_nr",fLayerNames[i]), &fNBlocks[i], kInt},
XPos[4] = *(Double_t *)gHcParms->Find("hcal_3ta_left")->GetValuePointer(); {Form("cal_%s_zpos",fLayerNames[i]), &fNLayerZPos[i], kDouble},
XPos[5] = *(Double_t *)gHcParms->Find("hcal_3ta_right")->GetValuePointer(); {Form("cal_%s_left",fLayerNames[i]), &XPos[2*i], kDouble},
XPos[6] = *(Double_t *)gHcParms->Find("hcal_4ta_left")->GetValuePointer(); {Form("cal_%s_right",fLayerNames[i]), &XPos[2*i+1], kDouble},
XPos[7] = *(Double_t *)gHcParms->Find("hcal_4ta_right")->GetValuePointer(); {0}
};
cout << "X Positions: " << XPos[0] << ", " << XPos[1] << endl; gHcParms->LoadParmValues((DBRequest*)&list, prefix);
YPos = new Double_t* [4];
cout << "Y Positions:";
Double_t* p;
Int_t ilayer;
ilayer = 0;
p = (Double_t *)gHcParms->Find("hcal_1pr_top")->GetValuePointer();
YPos[ilayer] = new Double_t [fNBlocks[ilayer]];
// Print out some parameters just to demonstrate that it works
for(Int_t i=0;i<fNBlocks[ilayer];i++) {
YPos[ilayer][i] = p[i];
cout << " " << YPos[ilayer][i];
}
cout << endl;
ilayer = 1;
p = (Double_t *)gHcParms->Find("hcal_2ta_top")->GetValuePointer();
YPos[ilayer] = new Double_t [fNBlocks[ilayer]];
for(Int_t i=0;i<fNBlocks[ilayer];i++) {
YPos[ilayer][i] = p[i];
} }
YPos = new Double_t* [fNLayers];
ilayer = 2; for(Int_t i=0;i<fNLayers;i++) {
p = (Double_t *)gHcParms->Find("hcal_3ta_top")->GetValuePointer(); YPos[i] = new Double_t [fNBlocks[i]];
YPos[ilayer] = new Double_t [fNBlocks[ilayer]]; DBRequest list[]={
{Form("cal_%s_top",fLayerNames[i]),YPos[i], kDouble, fNBlocks[i]},
for(Int_t i=0;i<fNBlocks[ilayer];i++) { {0}
YPos[ilayer][i] = p[i]; };
gHcParms->LoadParmValues((DBRequest*)&list, prefix);
} }
for(Int_t i=0;i<fNLayers;i++) {
ilayer = 3; cout << "Plane " << fLayerNames[i] << ":" << endl;
p = (Double_t *)gHcParms->Find("hcal_4ta_top")->GetValuePointer(); cout << " Block thickness: " << BlockThick[i] << endl;
YPos[ilayer] = new Double_t [fNBlocks[ilayer]]; cout << " NBlocks : " << fNBlocks[i] << endl;
cout << " Z Position : " << fNLayerZPos[i] << endl;
for(Int_t i=0;i<fNBlocks[ilayer];i++) { cout << " X Positions : " << XPos[2*i] << ", " << XPos[2*i+1] << endl;
YPos[ilayer][i] = p[i]; cout << " Y Positions :";
for(Int_t j=0; j<fNBlocks[i]; j++) {
cout << " " << YPos[i][j];
}
cout << endl;
} }
fIsInit = true; fIsInit = true;
......
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