diff --git a/docs/Doxyfile b/docs/Doxyfile index f48b1f3748500784e4ba4fc4be5e5594ccf7ec87..abd3cd9a297b9475b29ddc124ca4b89be4cda9f0 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -402,7 +402,7 @@ EXTRACT_ALL = YES # be included in the documentation. # The default value is: NO. -EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = YES # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. diff --git a/docs/Makefile b/docs/Makefile index cc33e7d78732d47cdb16ee3d11c290c92418a6e5..9ccf3420f4d90b65b7617416e349d2f1ea090297 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -7,10 +7,11 @@ export DOXYGEN_SOURCE_DIRECTORY := .. PODDDIR = ../podd/docs # THISDIR is location of this directory relative to the podd docs directory THISDIR = ../../docs +INSTALLPATH = jlabl1:/group/hallc/www/hallcweb/html/hcana/docs/ all: doxygen -doxygen: Doxyfile Doxygen_podd.tag ROOT.tag +doxygen html/index.html: Doxyfile Doxygen_podd.tag ROOT.tag doxygen Doxyfile_podd: $(PODDDIR)/Doxyfile @@ -28,3 +29,6 @@ clean: rm Doxyfile_podd rm Doxygen_podd.tag +# Must have permission to write to $(INSTALLPATH) +install: doxygen + rsync -av --delete html/ $(INSTALLPATH) diff --git a/src/THcAnalyzer.cxx b/src/THcAnalyzer.cxx index e5ba03014828fb75e355f2bb4d555e0a6c91db57..63f18b7409821bcfc01562200c2e2d434d75a64c 100644 --- a/src/THcAnalyzer.cxx +++ b/src/THcAnalyzer.cxx @@ -13,8 +13,8 @@ defined. It performs a standard analysis consisting of At the end of each step, testing and histogramming are done for the appropriate block defined in the global test/histogram lists. -Hall C has their own analyzer class because some things are bound to -be different. +Hall C ENGINE style reports are implemented with the PrintReport +method. This can be used for generating end of run summary sheets. \author S. A. Wood, 13-March-2012 @@ -59,10 +59,10 @@ THcAnalyzer::~THcAnalyzer() //_____________________________________________________________________________ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile) { - // Generate "reports" such as end of run scaler/efficiency sheets - // Reads a template file, copying that file to the output, replacing - // variables and expressions inside of braces ({}) with evaluated values. - // Similar but not identical to ENGINE/CTP report templates. + /// Generate "reports" such as end of run scaler/efficiency sheets + /// Reads a template file, copying that file to the output, replacing + /// variables and expressions inside of braces ({}) with evaluated values. + /// Similar but not identical to ENGINE/CTP report templates. ifstream ifile; ifile.open(templatefile); @@ -139,12 +139,12 @@ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile) //_____________________________________________________________________________ void THcAnalyzer::LoadInfo() { - // Create several THcParms variables in gHcParms containing - // run information such as + /// Create several THcParms variables in gHcParms containing + /// run information such as // run number, first event analyzed, number of events, etc. - // gen_run_number - Current run - // gen_run_starting_event - Id of first event analyzed - // gen_event_id_number - Id of last event analyzed + /// `gen_run_number` - Current run + /// `gen_run_starting_event` - Id of first event analyzed + /// `gen_event_id_number` - Id of last event analyzed Int_t* runnum; Int_t* firstevent; Int_t* lastevent; diff --git a/src/THcFormula.cxx b/src/THcFormula.cxx index d9467c8489225d286778bd0eedda6d9c905f5052..857e0cd95ea0f820e368edf1a77a6aaf0dca7495 100644 --- a/src/THcFormula.cxx +++ b/src/THcFormula.cxx @@ -1,10 +1,14 @@ /** \class THcFormula \ingroup Base - Tweaked THaFormula. If cutname.scaler is used in a formula, then - it is evaluated as the number of times that the cut passed. - Use EVariableType of kUndefined to indicate cut scaler in list of - variables used in the formula +Enhanced THaFormula for use in report files. + +In addition to global variables (gHaVars) and cuts (gHaCuts), +THcFormula expressions have access hcana parameters (gHcParms). + +The number of times a cut has been try, as well as the number of times +that the cut has been tested can be accessed with cutname.`scaler` (or +.`npassed`) and cutname.`ncalled`. \author S. A. Wood @@ -32,8 +36,8 @@ enum EFuncCode { kLength, kSum, kMean, kStdDev, kMax, kMin, //_____________________________________________________________________________ static inline Int_t NumberOfSetBits( UInt_t v ) { - // Count number of bits set in 32-bit integer. From - // http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + /// Count number of bits set in 32-bit integer. From + /// http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); @@ -43,7 +47,7 @@ static inline Int_t NumberOfSetBits( UInt_t v ) //_____________________________________________________________________________ static inline Int_t NumberOfSetBits( ULong64_t v ) { - // Count number of bits in 64-bit integer + /// Count number of bits in 64-bit integer const ULong64_t mask32 = (1LL<<32)-1; return NumberOfSetBits( static_cast<UInt_t>(mask32 & v) ) + diff --git a/src/THcInterface.cxx b/src/THcInterface.cxx index ceea259da3e6c98525f042bc7708b17b98e53739..f6bff8bccf405c2ecad338c1e927b14a56149174 100644 --- a/src/THcInterface.cxx +++ b/src/THcInterface.cxx @@ -1,7 +1,7 @@ /** \class THcInterface \ingroup Base - THcInterface is the interactive interface to the Hall A Analyzer. + THcInterface is the interactive interface to the Hall C Analyzer. It allows interactive access to all analyzer classes as well as all of standard ROOT. @@ -57,9 +57,14 @@ THcInterface::THcInterface( const char* appClassName, int* argc, char** argv, void* options, int numOptions, Bool_t noLogo ) : TRint( appClassName, argc, argv, options, numOptions, kTRUE ) { - // Create the Hall A analyzer application environment. The THcInterface - // environment provides an interface to the the interactive ROOT system - // via inheritance of TRint as well as access to the Hall A analyzer classes. + /** +Create the Hall A/C analyzer application environment. The THcInterface +environment provides an interface to the the interactive ROOT system +via inheritance of TRint as well as access to the Hall A/C analyzer classes. + +This class is copy of THaInterface with the addition of of the global +`gHcParms` to hold parameters. It does not inherit from THaInterface. + */ if( fgAint ) { Error("THcInterface", "only one instance of THcInterface allowed"); @@ -70,7 +75,7 @@ THcInterface::THcInterface( const char* appClassName, int* argc, char** argv, if( !noLogo ) PrintLogo(); - SetPrompt("analyzerThcInterface [%d] "); + SetPrompt("hcana [%d] "); gHaVars = new THaVarList; gHcParms = new THcParmList; gHaCuts = new THaCutList( gHaVars ); @@ -176,7 +181,7 @@ void THcInterface::PrintLogo() void THcInterface::PrintLogo( Bool_t lite ) #endif { - // Print the Hall A analyzer logo on standard output. + /// Print the Hall C analyzer logo on standard output. Int_t iday,imonth,iyear,mille; static const char* months[] = {"Jan","Feb","Mar","Apr","May", @@ -206,12 +211,13 @@ void THcInterface::PrintLogo( Bool_t lite ) Printf(" * W E L C O M E to the *"); Printf(" * H A L L C ++ A N A L Y Z E R *"); Printf(" * *"); - Printf(" * Release %10s %18s *",halla_version,__DATE__); + Printf(" * Based on *"); + Printf(" * PODD Release %10s %18s *",halla_version,__DATE__); Printf(" * Based on ROOT %8s %20s *",root_version,root_date); // Printf(" * Development version *"); Printf(" * *"); Printf(" * For information visit *"); - Printf(" * http://hallaweb.jlab.org/root/ *"); + Printf(" * http://hallcweb.jlab.org/hcana/docs/ *"); Printf(" * *"); Printf(" ************************************************"); #if ROOT_VERSION_CODE >= ROOT_VERSION(5,18,0) @@ -230,7 +236,7 @@ void THcInterface::PrintLogo( Bool_t lite ) //_____________________________________________________________________________ TClass* THcInterface::GetDecoder() { - // Get class of the current decoder + /// Get class of the current decoder cout << "In THcInterface::GetDecoder ... " << gHaDecoder << endl; return gHaDecoder; } @@ -238,9 +244,9 @@ TClass* THcInterface::GetDecoder() //_____________________________________________________________________________ TClass* THcInterface::SetDecoder( TClass* c ) { - // Set the type of decoder to be used. Make sure the specified class - // actually inherits from the standard THaEvData decoder. - // Returns the decoder class (i.e. its argument) or NULL if error. + /// Set the type of decoder to be used. Make sure the specified class + /// actually inherits from the standard THaEvData decoder. + /// Returns the decoder class (i.e. its argument) or NULL if error. if( !c ) { ::Error("THcInterface::SetDecoder", "argument is NULL"); @@ -258,6 +264,27 @@ TClass* THcInterface::SetDecoder( TClass* c ) return gHaDecoder; } +//_____________________________________________________________________________ +//_____________________________________________________________________________ +const char* THcInterface::SetPrompt( const char* newPrompt ) +{ + /// Make sure the prompt is and stays "hcana [%d]". ROOT 6 resets the + /// interpreter prompt for every line without respect to any user-set + /// default prompt. + +#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) + return TRint::SetPrompt(newPrompt); +#else + TString s; + if( newPrompt ) { + s = newPrompt; + if( s.Index("root") == 0 ) + s.Replace(0,4,"hcana"); + } + return TRint::SetPrompt(s.Data()); +#endif +} + //_____________________________________________________________________________ ClassImp(THcInterface) diff --git a/src/THcInterface.h b/src/THcInterface.h index 839b2ad77c6853d3e95269dac9bd922ef2582ee8..d89c3db81e2b8c3f2415bc07b30c5a31b2f4584e 100644 --- a/src/THcInterface.h +++ b/src/THcInterface.h @@ -28,6 +28,8 @@ public: static TClass* GetDecoder(); static TClass* SetDecoder( TClass* c ); + virtual const char* SetPrompt(const char *newPrompt); + protected: static THcInterface* fgAint; //Pointer indicating that interface already exists diff --git a/src/THcParmList.cxx b/src/THcParmList.cxx index 0b58db2ca5f317363e3a4719828cdccb98568c90..3f898d69341786980a5d2c89cd11357b1ed5713d 100644 --- a/src/THcParmList.cxx +++ b/src/THcParmList.cxx @@ -1,8 +1,21 @@ /** \class THcParmList \ingroup Base -A class that can read and hold the parmaters from the CTP formatted -parameter files used by the Fortran ENGINE. +A THcParmList object holds an arbitrary list of parameters and +their values. Parameters may be integers, real numbers or strings. +Integers and floating point numbers can be one dimensional arrays. +(Strings can not be arrays.) In addition to values, each parameter +may have a title/description. (No titles are saved for string parameters.) + +The Hall C analyzer make one instance of this class available via the +global `gHcParms`. The detector classes look for their +configuration parameters in that list. + +This class is built on THaVarList, adding a method to load the list of +parameters from Hall C ENGINE style CTP parameter files and a method +to retrieve a set of parameters from the list. + +An instance of THaTextvars is created to hold the string parameters. */ @@ -29,6 +42,7 @@ Int_t fDebug = 1; // Keep this at one while we're working on the code ClassImp(THcParmList) +/// Create empty numerical and string parameter lists THcParmList::THcParmList() : THaVarList() { TextList = new THaTextvars; @@ -43,19 +57,42 @@ inline static bool IsComment( const string& s, string::size_type pos ) void THcParmList::Load( const char* fname, Int_t RunNumber ) { /** -Read a CTP style parameter file. +Load the parameter cache by reading a CTP style parameter file. Most +parameter files used in the ENGINE should work. + +A line in the file of the form +~~~ + varname = value1[, value2, value3, value4] [; Comment] +~~~ +adds the variable `varname` to the parameter cache and the value after +the equal sign is stored. If a list of values is given, then the +values are saved as an array. Lists of values may be continued on +additional lines. Lines without a `=` are interpreted as such continuation +lines. Text after a ";" is treated as a comment. If this comment is +on a line defining a parameter, then it is saved as the +title/description for the parameter. + +Values may be expressions composed of numbers and previously defined +parameters. These expressions are evaluated with THaFormula. + +Lines of the form +~~~ + varname = "A string" +~~~ +or +~~~ + varname = 'A string' +~~~ +create string parameters. -Parameter values and arrays of values are cached in a THaVarList -and are available for use elsewhere in the analyzer. -Text strings are saved in a THaTextvars list. -Parameter files can contain "include" statements of the form +A parameter file can load other files with the include statement ~~~ #include "filename" ~~~ -If a run number is given, ignore input until a line with a matching -run number or run number range is found. All parameters following -the are read until a non matching run number or range is encountered. +The ENGINE CTP support parameter "blocks" which were marked with +`begin` and `end` statements. These statements are ignored. + */ static const char* const whtspc = " \t"; @@ -438,13 +475,32 @@ the are read until a non matching run number or range is encountered. //_____________________________________________________________________________ Int_t THcParmList::LoadParmValues(const DBRequest* list, const char* prefix) { - // Load a number of entries from the database. - // For array entries, the number of elements to be read in - // must be given, and the memory already allocated - // NOTE: initial code taken wholesale from THaDBFile. - // GN 2012 - // If prefix is specified, prepend each requested parameter name with - // the prefix. + /** + +Retrieve parameter values from the parameter cache. + +The following example loads several parameters held in the `gHcParms` +parameter cache into scalar variables or arrays. +~~~ + DBRequest list[]={ + {"nplanes", &fNPlanes, kInt}, + {"name", &fName, kString}, + {"array", fArray, kDouble, fArraySize}, + {"optional", &FOptionalvar, kDouble, 0, 1}, + {0} + }; + gHcParms->LoadParmValues((DBRequest*)&list,"h"); +~~~ +If a string is passed as the second parameter of LoadParmValues, then +that string is prepended to the parameter names given in the DBRequest +list. In the above example, the values for the parameters `hnplanes`, +`hname`, `harray`, and `hoptional` are loaded. + +If a requested parameter is not found in the parameter cache, an error +is printed. If the 5th element of a DBRequest structure is true (non +zero), then there will be no error if the parameter is missing. + + */ const DBRequest *ti = list; Int_t cnt=0; @@ -455,7 +511,7 @@ Int_t THcParmList::LoadParmValues(const DBRequest* list, const char* prefix) while ( ti && ti->name ) { string keystr(prefix); keystr.append(ti->name); const char* key = keystr.c_str(); - /// cout <<"Now at "<<ti->name<<endl; + // cout <<"Now at "<<ti->name<<endl; this_cnt = 0; if(this->Find(key)) { VarType ty = this->Find(key)->GetType(); diff --git a/src/THcParmList.h b/src/THcParmList.h index d1a2fd667976fdfb3c5dbcafb5af2417d541b37d..13743888270c0d4ea8f3df721b6d55cd0e5ed648 100644 --- a/src/THcParmList.h +++ b/src/THcParmList.h @@ -61,7 +61,7 @@ public: private: - THaTextvars* TextList; + THaTextvars* TextList; //! Dictionary of string parameters #ifdef WITH_CCDB SQLiteCalibration* CCDB_obj; diff --git a/src/THcScalerEvtHandler.cxx b/src/THcScalerEvtHandler.cxx index 9e5fb58a0debc01c1d7f71cce1af783aacd7799e..5d722e5596889ff6230c2c7143050ee44b1eb865 100644 --- a/src/THcScalerEvtHandler.cxx +++ b/src/THcScalerEvtHandler.cxx @@ -1,32 +1,35 @@ /** \class THcScalerEvtHandler \ingroup Base - Event handler for Hall C scalers - - - This class does the following - For a particular set of event types (here, event type 0) - decode the scalers and put some variables into global variables. - The global variables can then appear in the Podd output tree T. - In addition, a tree "TS" is created by this class; it contains - just the scaler data by itself. Note, the "fName" is concatenated - with "TS" to ensure the tree is unqiue; further, "fName" is - concatenated with the name of the global variables, for uniqueness. - The list of global variables and how they are tied to the - scaler module and channels is defined here; eventually this - will be modified to use a scaler.map file - NOTE: if you don't have the scaler map file (e.g. Leftscalevt.map) - there will be no variable output to the Trees. - - To use in the analyzer, your setup script needs something like this - gHaEvtHandlers->Add (new THcScalerEvtHandler("HMS","HC scaler event type 0")); - - To enable debugging you may try this in the setup script - + Event handler for Hall C scalers + + +This class does the following + +For a particular set of event types (here, event type 0) +decode the scalers and put some variables into global variables. +The global variables can then appear in the Podd output tree T. +In addition, a tree "TS" is created by this class; it contains +just the scaler data by itself. Note, the "fName" is concatenated +with "TS" to ensure the tree is unqiue; further, "fName" is +concatenated with the name of the global variables, for uniqueness. +The list of global variables and how they are tied to the +scaler module and channels is defined here; eventually this +will be modified to use a scaler.map file + +NOTE: if you don't have the scaler map file (e.g. Leftscalevt.map) +there will be no variable output to the Trees. + +To use in the analyzer, your setup script needs something like this +~~~ + gHaEvtHandlers->Add (new THcScalerEvtHandler("HMS","HC scaler event type 0")); +~~~ +To enable debugging you may try this in the setup script +~~~ THcScalerEvtHandler *hscaler = new THcScalerEvtHandler("HS","HC scaler event type 0"); hscaler->SetDebugFile("HScaler.txt"); gHaEvtHandlers->Add (hscaler); - +~~~ \author E. Brash based on THaScalerEvtHandler by R. Michaels */