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

Get Drift Chamber plane names from variable in hcana.param instead

of hardwiring them.
parent 97af94f2
No related branches found
No related tags found
No related merge requests found
...@@ -8,3 +8,6 @@ hhodo_num_planes = 4 ...@@ -8,3 +8,6 @@ hhodo_num_planes = 4
hshower_num_layers = 4 hshower_num_layers = 4
haero_num_pairs = 8 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"
...@@ -72,45 +72,21 @@ void THcDriftChamber::Setup(const char* name, const char* description) ...@@ -72,45 +72,21 @@ void THcDriftChamber::Setup(const char* name, const char* description)
cout << "Drift Chambers: " << fNPlanes << " planes in " << fNChambers << " chambers" << endl; 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]; fPlaneNames = new char* [fNPlanes];
for(Int_t i=0;i<fNPlanes;i++) {fPlaneNames[i] = new char[4];} for(Int_t i=0;i<fNPlanes;i++) {
fPlaneNames[i] = new char[plane_names[i].length()];
// Big hack needed because the drift map parameters are in parameters with strcpy(fPlaneNames[i], plane_names[i].c_str());
// 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);
}
} }
char *desc = new char[strlen(description)+100]; char *desc = new char[strlen(description)+100];
fPlanes = new THcDriftChamberPlane* [fNPlanes]; fPlanes = new THcDriftChamberPlane* [fNPlanes];
......
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