diff --git a/examples/PARAM/hcana.param b/examples/PARAM/hcana.param index 1adc39f38a2daf844245c92dac90bde6d0122d8d..e8fb336b8633c98b4b9f4f71aea8f6cad7b1f985 100644 --- a/examples/PARAM/hcana.param +++ b/examples/PARAM/hcana.param @@ -8,3 +8,6 @@ hhodo_num_planes = 4 hshower_num_layers = 4 haero_num_pairs = 8 + +# Names of planes so that parameter names can be constructed +hdc_plane_names = "1x1 1y1 1u1 1v1 1y2 1x2 2x1 2y1 2u1 2v1 2y2 2x2" diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx index ea45f0678d544755809a999f8be920db55ac4a75..c8fd9be90ca75eff0ff40dca5f6bf241a2e393a5 100644 --- a/src/THcDriftChamber.cxx +++ b/src/THcDriftChamber.cxx @@ -72,45 +72,21 @@ void THcDriftChamber::Setup(const char* name, const char* description) cout << "Drift Chambers: " << fNPlanes << " planes in " << fNChambers << " chambers" << endl; + // Can't put strings in DBRequest yet + string planelistvarname=" dc_plane_names"; + planelistvarname[0] = prefix[0]; + vector<string> plane_names = vsplit(gHcParms->GetString(planelistvarname)); + + if(plane_names.size() != (UInt_t) fNPlanes) { + cout << "ERROR: Number of planes " << fNPlanes << " doesn't agree with number of plane names " << plane_names.size() << endl; + // Should quit. Is there an official way to quit? + } fPlaneNames = new char* [fNPlanes]; - for(Int_t i=0;i<fNPlanes;i++) {fPlaneNames[i] = new char[4];} - - // Big hack needed because the drift map parameters are in parameters with - // names like hwc1x1fract. Need to do some kind of parameter name mapping - // or generate the names from the wire angle (alpha) - if(prefix[0] == 'h') { - strcpy(fPlaneNames[0],"1x1"); - strcpy(fPlaneNames[1],"1y1"); - strcpy(fPlaneNames[2],"1u1"); - strcpy(fPlaneNames[3],"1v1"); - strcpy(fPlaneNames[4],"1y2"); - strcpy(fPlaneNames[5],"1x2"); - strcpy(fPlaneNames[6],"2x1"); - strcpy(fPlaneNames[7],"2y1"); - strcpy(fPlaneNames[8],"2u1"); - strcpy(fPlaneNames[9],"2v1"); - strcpy(fPlaneNames[10],"2y2"); - strcpy(fPlaneNames[11],"2x2"); - } else if (prefix[0] == 's') { - strcpy(fPlaneNames[0],"1u1"); - strcpy(fPlaneNames[1],"1u2"); - strcpy(fPlaneNames[2],"1x1"); - strcpy(fPlaneNames[3],"1x2"); - strcpy(fPlaneNames[4],"1v1"); - strcpy(fPlaneNames[5],"1v2"); - strcpy(fPlaneNames[6],"2u1"); - strcpy(fPlaneNames[7],"2u2"); - strcpy(fPlaneNames[8],"2x1"); - strcpy(fPlaneNames[9],"2x2"); - strcpy(fPlaneNames[10],"2v1"); - strcpy(fPlaneNames[11],"2v2"); - } else { - cout << "Unknown Spectrometer Prefix '" << prefix << "' Guessing names" << endl; - for(Int_t i=0;i<fNPlanes;i++) { - sprintf(fPlaneNames[i],"%d",i+1); - } + for(Int_t i=0;i<fNPlanes;i++) { + fPlaneNames[i] = new char[plane_names[i].length()]; + strcpy(fPlaneNames[i], plane_names[i].c_str()); } - + char *desc = new char[strlen(description)+100]; fPlanes = new THcDriftChamberPlane* [fNPlanes];