diff --git a/examples/PARAM/hcana.param b/examples/PARAM/hcana.param new file mode 100644 index 0000000000000000000000000000000000000000..1adc39f38a2daf844245c92dac90bde6d0122d8d --- /dev/null +++ b/examples/PARAM/hcana.param @@ -0,0 +1,10 @@ +; +; Parameters that were built into Fortran analyzer that we want +; to pass as parameters so that the resulting code can be more generic. +; + +hhodo_num_planes = 4 + +hshower_num_layers = 4 + +haero_num_pairs = 8 diff --git a/examples/hodtest.C b/examples/hodtest.C index cc9a82ecf8e6c0538328c8de07ab29b7b8ae9129..4010df52e0efd28b2f43f8bc325f089711fddc61 100644 --- a/examples/hodtest.C +++ b/examples/hodtest.C @@ -17,6 +17,10 @@ gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename")); + // Constants not in ENGINE PARAM files that we want to be + // configurable + gHcParms->Load("PARAM/hcana.param"); + // Generate db_cratemap to correspond to map file contents char command[100]; sprintf(command,"./make_cratemap.pl < %s > db_cratemap.dat",gHcParms->GetString("g_decode_map_filename")); diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index 05c718b91296e0adf092c48a05431078579505a1..41152977a1b1dcf3ddfdac9f1c306d2f23091f39 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -87,15 +87,19 @@ Int_t THcAerogel::ReadDatabase( const TDatime& date ) // This function is called by THaDetectorBase::Init() once at the beginning // of the analysis. + cout << "THcAerogel::ReadDatabase " << GetName() << endl; + char prefix[2]; - // Pull values from THcParmList instead prefix[0]=tolower(GetApparatus()->GetName()[0]); prefix[1]='\0'; - fNelem = 8;// Number of tube pairs // The ENGINE style parameter files don't define - // this. Probably need an additional parameter file - // that contains these fixed parameters. + DBRequest listextra[]={ + {"aero_num_pairs", &fNelem, kInt}, + {0} + }; + fNelem = 8; // Default if not defined + gHcParms->LoadParmValues((DBRequest*)&listextra,prefix); fPosGain = new Double_t[fNelem]; fNegGain = new Double_t[fNelem]; diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index ac85bd85fac0cbe330cc1a3aa85120c08a91a6d9..2fc58e45b99d7f7ee835a3965a21d7d3abff700c 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -66,16 +66,19 @@ void THcHodoscope::Setup(const char* name, const char* description) if( IsZombie()) return; fDebug = 1; // Keep this at one while we're working on the code - // reading the number of planes from a param list! Still kludgy but it works - system("rm tmp.txt; cat PARAM/hhodo.param |grep hhodo_slop|wc -w>tmp.txt"); - ifstream tmpfile; - tmpfile.open("tmp.txt"); - tmpfile >> fNPlanes; - tmpfile.close(); - fNPlanes = fNPlanes-2; - cout << "fNPlanes = " << fNPlanes << endl; - // fNPlanes = 4; // Should get this from parameters -> Now we do! GN + char prefix[2]; + + prefix[0]=tolower(GetApparatus()->GetName()[0]); + prefix[1]='\0'; + + DBRequest listextra[]={ + {"hodo_num_planes", &fNPlanes, kInt}, + {0} + }; + fNPlanes = 4; // Default if not defined + gHcParms->LoadParmValues((DBRequest*)&listextra,prefix); + // Plane names fPlaneNames = new char* [fNPlanes]; for(Int_t i=0;i<fNPlanes;i++) {fPlaneNames[i] = new char[3];}