diff --git a/SConstruct b/SConstruct deleted file mode 120000 index 0fe1cae2e2aaa80a9dbba1a7c62ed71003c29aeb..0000000000000000000000000000000000000000 --- a/SConstruct +++ /dev/null @@ -1 +0,0 @@ -SConstruct.py \ No newline at end of file diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000000000000000000000000000000000000..6d89421a9253a794b3dfcaaca6f1cac10d911a52 --- /dev/null +++ b/SConstruct @@ -0,0 +1,167 @@ +###### Hall C Software Main SConstruct Build File ##### +###### Author: Edward Brash (brash@jlab.org) June 2013 + +import os +import sys +import platform +import commands +import SCons + +def rootcint(target,source,env): + """Executes the ROOT dictionary generator over a list of headers.""" + dictname = target[0] + headers = "" + cpppath = env.subst('$_CCCOMCOM') + ccflags = env.subst('$CCFLAGS') + rootcint = env.subst('$ROOTCINT') + print "Doing rootcint call now ..." + for f in source: + headers += str(f) + " " + command = rootcint + " -f %s -c -pthread -fPIC %s %s" % (dictname,cpppath,headers) + print ('RootCint Command = %s\n' % command) + ok = os.system(command) + return ok + +baseenv = Environment(ENV = os.environ) +#dict = baseenv.Dictionary() +#keys = dict.keys() +#keys.sort() +#for key in keys: +# print "Construction variable = '%s', value = '%s'" % (key, dict[key]) + +####### Check SCons version ################## +print('!!! Building the Hall C analyzer and libraries with SCons requires') +print('!!! SCons version 2.1.0 or newer.') +EnsureSConsVersion(2,1,0) + +####### Hall A Build Environment ############# +# +baseenv.Append(MAIN_DIR= Dir('.').abspath) +baseenv.Append(HC_DIR= baseenv.subst('$MAIN_DIR')) +baseenv.Append(HC_SRC= baseenv.subst('$HC_DIR')+'/src ') +baseenv.Append(HA_DIR= baseenv.subst('$HC_DIR')+'/podd ') +baseenv.Append(HA_SRC= baseenv.subst('$HA_DIR')+'/src ') +baseenv.Append(HA_DC= baseenv.subst('$HA_DIR')+'/hana_decode ') +baseenv.Append(HA_SCALER= baseenv.subst('$HA_DIR')+'/hana_scaler ') +baseenv.Append(MAJORVERSION = '1') +baseenv.Append(MINORVERSION = '5') +baseenv.Append(PATCH = '25') +baseenv.Append(SOVERSION = baseenv.subst('$MAJORVERSION')+'.'+baseenv.subst('$MINORVERSION')) +baseenv.Append(VERSION = baseenv.subst('$SOVERSION')+'.'+baseenv.subst('$PATCH')) +baseenv.Append(EXTVERS = '') +baseenv.Append(HA_VERSION = baseenv.subst('$VERSION')+baseenv.subst('$EXTVERS')) +print "Hall C Main Directory = %s" % baseenv.subst('$HC_DIR') +print "Hall C Source Directory = %s" % baseenv.subst('$HC_SRC') +print "Hall A Main Directory = %s" % baseenv.subst('$HA_DIR') +print "Software Version = %s" % baseenv.subst('$VERSION') +ivercode = 65536*int(float(baseenv.subst('$SOVERSION')))+ 256*int(10*(float(baseenv.subst('$SOVERSION'))-int(float(baseenv.subst('$SOVERSION')))))+ int(float(baseenv.subst('$PATCH'))) +baseenv.Append(VERCODE = ivercode) +baseenv.Append(CPPPATH = ['$HC_SRC','$HA_SRC','$HA_DC','$HA_SCALER']) + +proceed = "1" or "y" or "yes" or "Yes" or "Y" +######## Configure Section ####### + +import configure +configure.config(baseenv,ARGUMENTS) + +Export('baseenv') + +conf = Configure(baseenv) + +if not conf.CheckCXX(): + print('!!! Your compiler and/or environment is not correctly configured.') + Exit(0) + +if not conf.CheckFunc('printf'): + print('!! Your compiler and/or environment is not correctly configured.') + Exit(0) + +if baseenv.subst('$CHECKHEADERS')==proceed: + system_header_list = ['arpa/inet.h','errno.h','assert.h','netdb.h','netinet/in.h','pthread.h','signal.h','stddef.h','stdio.h','stdlib.h','string.h','strings.h','sys/ioctl.h','sys/socket.h','sys/time.h','sys/types.h','time.h','unistd.h','memory.h','math.h','limits.h'] + + for header_file in system_header_list: + if not conf.CheckHeader(header_file): + print('!! Header file %s not found.' % header_file) + Exit(0) + +baseenv = conf.Finish() + +######## ROOT Dictionaries ######### +baseenv.Append(ROOTCONFIG = 'root-config') +baseenv.Append(ROOTCINT = 'rootcint') + +try: + baseenv.ParseConfig('$ROOTCONFIG --cflags') + baseenv.ParseConfig('$ROOTCONFIG --libs') + baseenv.MergeFlags('-fPIC') +except OSError: + try: + baseenv.Replace(ROOTCONFIG = baseenv['ENV']['ROOTSYS'] + '/bin/root-config') + baseenv.Replace(ROOTCINT = baseenv['ENV']['ROOTSYS'] + '/bin/rootcint') + baseenv.ParseConfig('$ROOTCONFIG --cflags') + baseenv.ParseConfig('$ROOTCONFIG --libs') + baseenv.MergeFlags('-fPIC') + except KeyError: + print('!!! Cannot find ROOT. Check if root-config is in your PATH.') + Exit(1) + +bld = Builder(action=rootcint) +baseenv.Append(BUILDERS = {'RootCint': bld}) + +######## cppcheck ########################### + +def which(program): + import os + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + return None + +if baseenv.subst('$CPPCHECK')==proceed: + is_cppcheck = which('cppcheck') + print "Path to cppcheck is %s\n" % is_cppcheck + + if(is_cppcheck == None): + print('!!! cppcheck not found on this system. Check if cppcheck is installed and in your PATH.') + Exit(1) + else: + cppcheck_command = baseenv.Command('cppcheck_report.txt',[],"cppcheck --quiet --enable=all src/ 2> $TARGET") + baseenv.AlwaysBuild(cppcheck_command) + +####### Start of main SConstruct ############ + +hallclib = 'HallC' +hallalib = 'HallA' +dclib = 'dc' +scalerlib = 'scaler' + +baseenv.Append(LIBPATH=['$HC_DIR','$HA_DIR','$HC_SRC','$HA_SRC','$HA_DC','$HA_SCALER']) +baseenv.Replace(SHLIBSUFFIX = '.so') +baseenv.Append(CPPDEFINES = '-DHALLC_MODS') + +directorylist = ['./','src','podd','podd/src','podd/hana_decode','podd/hana_scaler'] + +baseenv.Append(SHLIBSUFFIX ='.'+baseenv.subst('$VERSION')) +pbaseenv=baseenv.Clone() +pbaseenv.Append(LIBS=[hallclib,hallalib,dclib,scalerlib]) +baseenv.Append(LIBS=[hallalib,dclib,scalerlib]) +Export('pbaseenv') + +#SConscript('podd/SConscript.py',exports='baseenv') +#SConscript('podd/hana_scaler/SConscript.py',exports='baseenv') +#SConscript('podd/hana_decode/SConscript.py',exports='baseenv') +#SConscript('src/SConscript.py',exports='baseenv') +#SConscript('./SConscript.py',exports='baseenv') +SConscript(dirs = directorylist,name='SConscript.py',exports='baseenv') + +####### End of SConstruct ######### diff --git a/examples/PARAM/52949/hcana.param b/examples/PARAM/52949/hcana.param deleted file mode 120000 index 7fd888b6ebf1fb22416f5b98f23bbabf7f0d745c..0000000000000000000000000000000000000000 --- a/examples/PARAM/52949/hcana.param +++ /dev/null @@ -1 +0,0 @@ -../hcana.param \ No newline at end of file diff --git a/examples/PARAM/52949/hcana.param b/examples/PARAM/52949/hcana.param new file mode 100644 index 0000000000000000000000000000000000000000..47b4766b5526cbf1fd9f0da9393347d6fe98188a --- /dev/null +++ b/examples/PARAM/52949/hcana.param @@ -0,0 +1,79 @@ +; +; 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 +hhodo_plane_names = "1x 1y 2x 2y" + +hcal_num_layers = 4 + +# Exclusion band width for the calorimeter's fiducial volume. +hcal_fv_delta = 5. + +# Constants for the coordiante correction of the calorimeter energy depositions +hcal_a_cor = 200. +hcal_b_cor = 8000. +hcal_c_cor = 64.36 +hcal_d_cor = 1.66 + +hcal_layer_names = "1pr 2ta 3ta 4ta" + +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" + +# The following were defined in REPLAY.PARAM +h_recon_coeff_filename = 'PARAM/hms_recon_coeff.dat' ;hms optics matrix + +# The following are set to zero to replicate historical ENGINE behavior +# For new analyses they should be set to 1. If not defined here, +# hcana will default 1, the new and correct behaviour. + +# If 1, Let a hit have different L/R assignment for different space points +# instead of L/R assignment from first sp it appears in. +hdc_fix_lr = 0 +# If 1, don't do the the propagation along the wire each time the hit +# appears in a space point. (Which means the correction accumulates) +hdc_fix_propcorr = 0 + +# SOS parameters +shodo_num_planes = 4 +shodo_plane_names = "1x 1y 2x 2y" + +scal_num_layers = 4 + +# Exclusion band width for the calorimeter's fiducial volume. +# (saw) Don't know what this should be. Copied it from HMS. +scal_fv_delta = 5. + +# Constants for the coordiante correction of the calorimeter energy depositions +# (saw) Copied from HMS +scal_a_cor = 200. +scal_b_cor = 8000. +scal_c_cor = 64.36 +scal_d_cor = 1.66 + +scal_layer_names = "1pr 2ta 3ta 4ta" + +# Names of planes so that parameter names can be constructed +sdc_plane_names = "1u1 1u2 1x1 1x2 1v1 1v2 2u1 2u2 2x1 2x2 2v1 2v2" + +# The following were defined in REPLAY.PARAM +s_recon_coeff_filename = 'PARAM/sos_recon_coeff.dat' ;sos optics matrix + +# Fortran ENGINE only had this as a parameter for HMS. Need it here +# because same code used for both spectrometers +sntracks_max_fp = 10 + +# The following are set to zero to replicate historical ENGINE behavior +# For new analyses they should be set to 1. If not defined here, +# hcana will default 1, the new and correct behaviour. + +# If 1, Let a hit have different L/R assignment for different space points +# instead of L/R assignment from first sp it appears in. +sdc_fix_lr = 0 +# If 1, don't do the the propagation along the wire each time the hit +# appears in a space point. (Which means the correction accumulates) +sdc_fix_propcorr = 0 diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index 60f92df71cdd542ce9652b29b1cad7329a510012..8d5e47b6672a4693fe11cfb07256e0d4ae7fe2ca 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -80,7 +80,7 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcAerogelHit", 100); + InitHitList(fDetMap, "THcAerogelHit", 100); EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -237,7 +237,7 @@ void THcAerogel::Clear(Option_t* opt) Int_t THcAerogel::Decode( const THaEvData& evdata ) { // Get the Hall C style hitlist (fRawHitList) for this event - fNhits = THcHitList::DecodeToHitList(evdata); + fNhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { diff --git a/src/THcAerogelHit.h b/src/THcAerogelHit.h index 0c8ac63327be3dcfbcbe809f055da216e86c0b0d..49ddd246adb84eecf18c6214fb2e12e05bb2026d 100644 --- a/src/THcAerogelHit.h +++ b/src/THcAerogelHit.h @@ -6,12 +6,13 @@ class THcAerogelHit : public THcHodoscopeHit { public: + friend class THcAerogel; protected: private: - ClassDef(THcAerogelHit,0); // Aerogel hit class + ClassDef(THcAerogelHit,0); // Raw Aerogel hit }; #endif diff --git a/src/THcAnalyzer.cxx b/src/THcAnalyzer.cxx index 6c97bba481b5793e99d0a1a9568d61d7053fee0e..6d3f0c9fd92b9d609b5c47cc239b4ea7d5708b0c 100644 --- a/src/THcAnalyzer.cxx +++ b/src/THcAnalyzer.cxx @@ -61,8 +61,10 @@ THcAnalyzer::~THcAnalyzer() //_____________________________________________________________________________ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile) { - // Copy template to ofile, replacing {stuff} with the evaluated - // value of stuff. + // 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,9 +141,12 @@ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile) //_____________________________________________________________________________ void THcAnalyzer::LoadInfo() { - // Copy some run information into gHcParms variables so that in can - // be used in reports. - // For example run number, first event analyzed, number of events, etc. + // 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 Int_t* runnum; Int_t* firstevent; Int_t* lastevent; diff --git a/src/THcCherenkov.cxx b/src/THcCherenkov.cxx index 2db648b6e83b1100106b6bcb58ce88916bf1188c..5587a54c3a50baaa1a4e345c350cea433e37cb35 100644 --- a/src/THcCherenkov.cxx +++ b/src/THcCherenkov.cxx @@ -95,7 +95,7 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcCherenkovHit", 100); // 100 is max hits + InitHitList(fDetMap, "THcCherenkovHit", 100); // 100 is max hits EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -206,7 +206,7 @@ void THcCherenkov::Clear(Option_t* opt) Int_t THcCherenkov::Decode( const THaEvData& evdata ) { // Get the Hall C style hitlist (fRawHitList) for this event - fNhits = THcHitList::DecodeToHitList(evdata); + fNhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { diff --git a/src/THcCherenkovHit.h b/src/THcCherenkovHit.h index 67ef4c13c1e0a344a06803a581d81b869d79e426..63a0aab95b7faf61220b5709bfc5d50f7eed1919 100644 --- a/src/THcCherenkovHit.h +++ b/src/THcCherenkovHit.h @@ -6,12 +6,13 @@ class THcCherenkovHit : public THcHodoscopeHit { public: + friend class THcCherenkov; protected: private: - ClassDef(THcCherenkovHit,0); // Cherenkov hit class + ClassDef(THcCherenkovHit,0); // Raw Cherenkov hit }; #endif diff --git a/src/THcDC.cxx b/src/THcDC.cxx index be89cfc5f2c3f65137b51c0336d7a99c5b06a37e..63199d525b6b534a8fafb6e4f1531ff6931fdd15 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -170,7 +170,7 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcRawDCHit", 1000); + InitHitList(fDetMap, "THcRawDCHit", 1000); EStatus status; // This triggers call of ReadDatabase and DefineVariables @@ -427,7 +427,7 @@ Int_t THcDC::Decode( const THaEvData& evdata ) Int_t num_event = evdata.GetEvNum(); if (fdebugprintrawdc ||fdebugprintdecodeddc || fdebuglinkstubs || fdebugtrackprint) cout << " event num = " << num_event << endl; // Get the Hall C style hitlist (fRawHitList) for this event - fNhits = THcHitList::DecodeToHitList(evdata); + fNhits = DecodeToHitList(evdata); // Let each plane get its hits Int_t nexthit = 0; @@ -1017,6 +1017,7 @@ Double_t THcDC::DpsiFun(Double_t ray[4], Int_t plane) Int_t THcDC::End(THaRunBase* run) { // EffCalc(); + return 0; } //_____________________________________________________________________________ diff --git a/src/THcDC.h b/src/THcDC.h index 68ea8072538fb3fa7112d25aac64a30987c23bfc..05d5def06181cd6bed17bdba9c9716f418e0e693 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -173,7 +173,7 @@ protected: void Setup(const char* name, const char* description); void PrintSpacePoints(); - ClassDef(THcDC,0) // Drift Chamber class + ClassDef(THcDC,0) // Set of Drift Chambers detector }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDCHit.h b/src/THcDCHit.h index 80302bd549954fb18dd65c1dd315d0b6ffcef71b..c5ca7a74d3e14038ab2fc037cfd7bc31be6adee5 100644 --- a/src/THcDCHit.h +++ b/src/THcDCHit.h @@ -78,7 +78,7 @@ private: THcDCHit( const THcDCHit& ); THcDCHit& operator=( const THcDCHit& ); - ClassDef(THcDCHit,2) // VDCHit class + ClassDef(THcDCHit,2) // Drift Chamber Hit }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDCLookupTTDConv.h b/src/THcDCLookupTTDConv.h index e1bbea121d91a039e4b477ceabc0c75895bc438e..3d6157436ddca4ab5150af81744fa6e831ef7b23 100644 --- a/src/THcDCLookupTTDConv.h +++ b/src/THcDCLookupTTDConv.h @@ -29,7 +29,7 @@ protected: Int_t fNumBins; Double_t* fTable; - ClassDef(THcDCLookupTTDConv,0) // VDC Analytic TTD Conv class + ClassDef(THcDCLookupTTDConv,0) // Time to Distance conversion lookup }; diff --git a/src/THcDCTimeToDistConv.h b/src/THcDCTimeToDistConv.h index 960a5c373c8396a57c593c8657df78430d70bc2d..2ff706206455a2e40d4ed6b8cfa574fc1145b800 100644 --- a/src/THcDCTimeToDistConv.h +++ b/src/THcDCTimeToDistConv.h @@ -24,7 +24,7 @@ private: THcDCTimeToDistConv( const THcDCTimeToDistConv& ); THcDCTimeToDistConv& operator=( const THcDCTimeToDistConv& ); - ClassDef(THcDCTimeToDistConv,0) // DCTimeToDistConv class + ClassDef(THcDCTimeToDistConv,0) // Time to Distance conversion base class }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDCTrack.h b/src/THcDCTrack.h index a9b84c6fbf4ee6ab8392baf357fbfdd44e2cd81f..cc97ff1c03c7e924bef06e537b78be51417e3c43 100644 --- a/src/THcDCTrack.h +++ b/src/THcDCTrack.h @@ -85,6 +85,6 @@ private: THcDCTrack( const THcDCTrack& ); THcDCTrack& operator=( const THcDCTrack& ); - ClassDef(THcDCTrack,0) // DCTrack class + ClassDef(THcDCTrack,0) // Full Drift Chamber track }; #endif diff --git a/src/THcDCWire.h b/src/THcDCWire.h index 0e3ce6dce6122392e1e54f4e965b7b797861b529..53f6fcbe39e317c450dfb8440b59c72cfd14c027 100644 --- a/src/THcDCWire.h +++ b/src/THcDCWire.h @@ -43,7 +43,7 @@ private: THcDCWire( const THcDCWire& ); THcDCWire& operator=( const THcDCWire& ); - ClassDef(THcDCWire,0) // VDCWire class + ClassDef(THcDCWire,0) // Drift Chamber Wire class }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDetectorMap.cxx b/src/THcDetectorMap.cxx index 187c465db60946ed96919af5618a3ad64b04bf61..a4ff120c9cc6dfe477596163af65859494b52acd 100644 --- a/src/THcDetectorMap.cxx +++ b/src/THcDetectorMap.cxx @@ -4,12 +4,8 @@ // // THcDetectorMap // -// Class to read and hold Hall C style detector map -// -// Will need method to retrieve all map entries for a given -// detector id. -// -// Not sure we will keep this class, but still need the parsing of the map file +// Class to read and Hall C style detector map +// FillMap method builds a map for a specific detector // ////////////////////////////////////////////////////////////////////////// @@ -54,8 +50,11 @@ struct Functor }; //_____________________________________________________________________________ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname) -// Should probably return a status { + // Build a DAQ hardware to detector element map for detector detectorname + // Reads through the entire list of mappings, adding one element to + // detmap for each electronics channel that maps to detectorname. + list<ModChanList>::iterator imod; list<ChaninMod>::iterator ichan; ChaninMod Achan; @@ -171,8 +170,35 @@ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname) return(0); } +//_____________________________________________________________________________ void THcDetectorMap::Load(const char *fname) { +// Load a Hall C ENGINE style detector map file. The map file maps +// a given roc, slot/module, and channel # into a given detector id#, plane +// number, counter number and signal type. The mapping between detector +// names and ids is found in the comments at the begging of the map file. +// This method looks for those comments, of the form: +// XXX_ID = n +// to establish that mapping between detector name and detector ID. +// +// Lines of the form +// DETECTOR = n +// ROC = n +// SLOT = n +// are used to establish the module (roc and slot) and the detector +// for the mapping lines that follow. +// The actual mappings are of the form +// subadd, plane, counter [, signal] +// Each of these lines, combined with the detector, roc, slot values +// establish the roc, slot, subadess -> detector, plane, counter#, sigtype map +// Other lines that may be in the map file are +// NSUBADD = n +// BSUB = n +// MASK = hex value +// These define characteristics of the electronics module (# channels, +// The bit number specifying the location of the subaddress in a data word +// and hex mask that the data word is anded with to retrieve data) + static const char* const whtspc = " \t"; ifstream ifile; diff --git a/src/THcDetectorMap.h b/src/THcDetectorMap.h index 1dd95b2471267ffd7dee8ef096caf6e381b2091b..420f7de84400227c5352079a1a88d4b938e5d8de 100644 --- a/src/THcDetectorMap.h +++ b/src/THcDetectorMap.h @@ -60,7 +60,7 @@ class THcDetectorMap : public TObject { protected: - ClassDef(THcDetectorMap,0); + ClassDef(THcDetectorMap,0); // Map electronics channels to Detector, Plane, Counter, Signal }; #endif diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx index 69f0c75cbded9475653eec9b4958d992a1d834e5..9d7f93612fcd16844da7d837cf9eca983230b6ec 100644 --- a/src/THcDriftChamber.cxx +++ b/src/THcDriftChamber.cxx @@ -309,7 +309,8 @@ Int_t THcDriftChamber::FindSpacePoints( void ) if(fHMSStyleChambers) { if(fRemove_Sppt_If_One_YPlane == 1) { // The routine is specific to HMS - Int_t ndest=DestroyPoorSpacePoints(); // Only for HMS? + //Int_t ndest= + DestroyPoorSpacePoints(); // Only for HMS? // Loop over space points and remove those with less than 4 planes // hit and missing hits in Y,Y' planes } @@ -855,7 +856,7 @@ void THcDriftChamber::ChooseSingleHit() // Gather the remaining hits Int_t finalnum = 0; for(Int_t ihit=0;ihit<startnum;ihit++) { - THcDCHit* hit = sp->GetHit(ihit); + //THcDCHit* hit = sp->GetHit(ihit); // if (fhdebugflagpr) cout << " good hit = "<< ihit << " " << goodhit[ihit] << " time = " << hit->GetTime() << endl; if(goodhit[ihit] > 0) { // Keep this hit if (ihit > finalnum) { // Move hit @@ -910,7 +911,7 @@ void THcDriftChamber::SelectSpacePoints() //if (fhdebugflagpr) cout << " sp pt = " << isp+1 << " # of hits = " << sp->GetNHits() << endl; for(Int_t ihit=0;ihit<sp->GetNHits();ihit++) { THcDCHit* hit = sp->GetHit(ihit); - THcDriftChamberPlane* plane=hit->GetWirePlane(); + //THcDriftChamberPlane* plane=hit->GetWirePlane(); // if (fhdebugflagpr) cout << ihit+1 << "selecting " << plane->GetPlaneNum() << " " << plane->GetChamberNum() << " " << hit->GetTime() << " " << hit->GetDist() << " " << plane->GetCentralTime() << " " << plane->GetDriftTimeSign() << endl; } } diff --git a/src/THcDriftChamber.h b/src/THcDriftChamber.h index b77fca45ed75f682d81e0de0737e9201216f16b1..a7884461cb2e337027420deb215fc2692d7c8f77 100644 --- a/src/THcDriftChamber.h +++ b/src/THcDriftChamber.h @@ -134,7 +134,7 @@ protected: Double_t* stubcoef[4]; std::map<int,TMatrixD*> fAA3Inv; - ClassDef(THcDriftChamber,0) // Drift Chamber class + ClassDef(THcDriftChamber,0) // A single drift chamber }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index d6aa10c896ab37b1bb7349a8deeab219c3ffd4ea..b7aac91b7f1b5b9f18b2ca562b8dc91a0cac3cb0 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -109,7 +109,7 @@ protected: THcHodoscope* fglHod; // Hodoscope to get start time - ClassDef(THcDriftChamberPlane,0) + ClassDef(THcDriftChamberPlane,0); // A single plane within a THcDriftChamber }; #endif diff --git a/src/THcHallCSpectrometer.h b/src/THcHallCSpectrometer.h index 19826c076097e3aef7867211e542c3c3aa2cc18c..f906546ec9c187e94ec3f607d90b2089420ae0ad 100644 --- a/src/THcHallCSpectrometer.h +++ b/src/THcHallCSpectrometer.h @@ -57,7 +57,7 @@ protected: // Flag for fProperties indicating that tracks are to be sorted by chi2 static const UInt_t kSortTracks = BIT(16); - ClassDef(THcHallCSpectrometer,0) //A Hall A High Resolution Spectrometer + ClassDef(THcHallCSpectrometer,0) //A Hall C Spectrometer }; #endif diff --git a/src/THcHitList.cxx b/src/THcHitList.cxx index 4659785a0495a78dc04e5fe89c67c1d5653d0700..c133fbfbcbdd65ec5b6da0cb960460125c33af1c 100644 --- a/src/THcHitList.cxx +++ b/src/THcHitList.cxx @@ -4,9 +4,9 @@ // // THcHitList // -// Add hitlist to the Hall A detector base -// May not need to inherit from THaDetectorBase since we may end up -// replacing most of the methods +// Class to build a Hall C ENGINE style list of raw hits from the raw data. +// Detectors that use hit lists need to inherit from this class +// as well as THaTrackingDetector or THaNonTrackingDetector // ////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,8 @@ THcHitList::~THcHitList() { void THcHitList::InitHitList(THaDetMap* detmap, const char *hitclass, Int_t maxhits) { - // Probably called by ReadDatabase + // Save the electronics to detector mapping + // Initialize a hit array of hits of class hitclass fRawHitList = new TClonesArray(hitclass, maxhits); fRawHitClass = fRawHitList->GetClass(); @@ -44,6 +45,14 @@ void THcHitList::InitHitList(THaDetMap* detmap, } Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) { + // Clear the hit list + // Find all populated channels belonging to the detector and add + // the data to the hitlist. A given counter in the detector can have + // at most one entry in the hit list. However, the raw "hit" can contain + // multiple signal types (e.g. ADC+, ADC-, TDC+, TDC-), or multiple + // hits for multihit tdcs. + // The hit list is sorted (by plane, counter) after filling. + THcRawHit* rawhit; // cout << " Clearing TClonesArray " << endl; fRawHitList->Clear( ); diff --git a/src/THcHitList.h b/src/THcHitList.h index 494866bcb875b326dc40d246e126a7dbc25c3383..040d4c061a70c19ef2106e06c34eaf35d1842f47 100644 --- a/src/THcHitList.h +++ b/src/THcHitList.h @@ -41,6 +41,6 @@ public: protected: - ClassDef(THcHitList,0) + ClassDef(THcHitList,0); // List of raw hits sorted by plane, counter }; #endif diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index a2c401064566f04d9b2771af18d799d2f856e1c0..202b97c3944f7c6b3c6e79efbc32c99f43c877bb 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -142,7 +142,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // But it needs to happen before the sub detectors are initialized // so that they can get the pointer to the hitlist. - THcHitList::InitHitList(fDetMap, "THcHodoscopeHit", 100); + InitHitList(fDetMap, "THcHodoscopeHit", 100); EStatus status; // This triggers call of ReadDatabase and DefineVariables @@ -596,7 +596,7 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) { // Get the Hall C style hitlist (fRawHitList) for this event - Int_t nhits = THcHitList::DecodeToHitList(evdata); + Int_t nhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { Int_t nexthit = 0; diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 7d18bc8d808b8ea6cead145c8c615e79544b0504..2c90d460172b2d0f00090210ff900c64502c9fe5 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -131,7 +131,7 @@ protected: void Setup(const char* name, const char* description); - ClassDef(THcHodoscope,0) // Generic hodoscope class + ClassDef(THcHodoscope,0) // Hodoscope detector }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcHodoscopeHit.h b/src/THcHodoscopeHit.h index 0bac2d1a1f9a231325dfb83a2a31e58f1ef95e67..ef88875d11635a8a696bc1ac4ffdfb6a2439e0b1 100644 --- a/src/THcHodoscopeHit.h +++ b/src/THcHodoscopeHit.h @@ -6,8 +6,9 @@ class THcHodoscopeHit : public THcRawHit { public: + friend class THcScintillatorPlane; - THcHodoscopeHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), + THcHodoscopeHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), fADC_pos(-1), fADC_neg(-1), fTDC_pos(-1), fTDC_neg(-1) { } @@ -23,16 +24,15 @@ class THcHodoscopeHit : public THcRawHit { // virtual Bool_t IsSortable () const {return kTRUE; } // virtual Int_t Compare(const TObject* obj) const; + protected: Int_t fADC_pos; Int_t fADC_neg; Int_t fTDC_pos; Int_t fTDC_neg; - protected: - private: - ClassDef(THcHodoscopeHit, 0); // Hodoscope hit class + ClassDef(THcHodoscopeHit, 0); // Raw Hodoscope hit }; #endif diff --git a/src/THcParmList.cxx b/src/THcParmList.cxx index d75c690c11fa07a916eed61a8f1867af33b24579..a645b9328ccfc58f65b410704299da7c003e122a 100644 --- a/src/THcParmList.cxx +++ b/src/THcParmList.cxx @@ -42,6 +42,17 @@ 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. + // + // 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 + // #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. static const char* const whtspc = " \t"; @@ -420,6 +431,8 @@ Int_t THcParmList::LoadParmValues(const DBRequest* list, const char* prefix) // 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. const DBRequest *ti = list; Int_t cnt=0; @@ -561,6 +574,8 @@ Int_t THcParmList::ReadArray(const char* attrC, T* array, Int_t size) //_____________________________________________________________________________ void THcParmList::PrintFull( Option_t* option ) const { + // Print all the numeric parameter desciptions and values. + // Print all the text parameters THaVarList::PrintFull(option); TextList->Print(); } diff --git a/src/THcRawDCHit.h b/src/THcRawDCHit.h index 4eb2c55ad9755ce6a179807c415e38bd8dbe408f..5e077878e66b710a68183ce8618a465d0ba98ffb 100644 --- a/src/THcRawDCHit.h +++ b/src/THcRawDCHit.h @@ -8,6 +8,8 @@ class THcRawDCHit : public THcRawHit { public: + friend class THcDriftChamberPlane; + friend class THcDC; THcRawDCHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), fNHits(0) { @@ -24,14 +26,14 @@ public: virtual Bool_t IsSortable () const {return kTRUE; } virtual Int_t Compare(const TObject* obj) const; - Int_t fNHits; - Int_t fTDC[MAXHITS]; protected: + Int_t fNHits; + Int_t fTDC[MAXHITS]; private: - ClassDef(THcRawDCHit, 0); // DC hit class + ClassDef(THcRawDCHit, 0); // Raw Drift Chamber hit }; #endif diff --git a/src/THcRawHit.cxx b/src/THcRawHit.cxx index 3e37972a189932d7dd987a50bcbdf8ec59388f37..e2cd54e6116145954a70011f6c9888519cec4dd6 100644 --- a/src/THcRawHit.cxx +++ b/src/THcRawHit.cxx @@ -10,12 +10,10 @@ #include "THcRawHit.h" -//THcRawHit::~THcRawHit() -//{} Int_t THcRawHit::Compare(const TObject* obj) const { - // Compare to sort by plane and counter + // Comparision function for Sort(). const THcRawHit* hit = dynamic_cast<const THcRawHit*>(obj); diff --git a/src/THcRawHit.h b/src/THcRawHit.h index 7372463c724a5e66229e48ad9bfb3b3bf270a6af..1ee7d16431cc7d2d6e95b32e2750e5ccdabdf3f4 100644 --- a/src/THcRawHit.h +++ b/src/THcRawHit.h @@ -39,7 +39,7 @@ public: private: - ClassDef(THcRawHit,0) // Track ID abstract base class + ClassDef(THcRawHit,0) // Raw Hit Base Class }; #endif diff --git a/src/THcRawShowerHit.h b/src/THcRawShowerHit.h index 1671ddcbfcc7645315c2e99e7440c1b40927d067..76f0d140a5cae64d1dbff7ce837d276ee6da002f 100644 --- a/src/THcRawShowerHit.h +++ b/src/THcRawShowerHit.h @@ -6,8 +6,9 @@ class THcRawShowerHit : public THcRawHit { public: + friend class THcShowerPlane; - THcRawShowerHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), + THcRawShowerHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), fADC_pos(-1), fADC_neg(-1){ } THcRawShowerHit& operator=( const THcRawShowerHit& ); @@ -22,14 +23,13 @@ class THcRawShowerHit : public THcRawHit { // virtual Bool_t IsSortable () const {return kTRUE; } // virtual Int_t Compare(const TObject* obj) const; + protected: Int_t fADC_pos; Int_t fADC_neg; - protected: - private: - ClassDef(THcRawShowerHit, 0); // Shower hit class + ClassDef(THcRawShowerHit, 0); // Raw Shower counter hit }; #endif diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index cb832fa7dd0975bf1eb0d064e6e6cb91a2e60cfb..9b5f33e5cc5a40300b3c93bfc7e7755d2ccb1bc1 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -113,7 +113,7 @@ class THcScintillatorPlane : public THaSubDetector { virtual Int_t DefineVariables( EMode mode = kDefine ); virtual void InitializePedestals( ); - ClassDef(THcScintillatorPlane,0) + ClassDef(THcScintillatorPlane,0); // Scintillator bars in a plane }; #endif diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 67c2ca0ef61d301fdb93e5c0542957b4b7dcdc5a..2047500b70ba5a58635c99363448b27371a4cf89 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -111,7 +111,7 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcRawShowerHit", 100); + InitHitList(fDetMap, "THcRawShowerHit", 100); EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -514,7 +514,7 @@ Int_t THcShower::Decode( const THaEvData& evdata ) Clear(); // Get the Hall C style hitlist (fRawHitList) for this event - Int_t nhits = THcHitList::DecodeToHitList(evdata); + Int_t nhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { Int_t nexthit = 0; diff --git a/src/THcShower.h b/src/THcShower.h index 4286a8252b1b169efb2b52fd473c49adf22a7b44..89e6c053558b36af11955fd09c1ed7f41838f587 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -197,7 +197,7 @@ protected: friend class THcShowerPlane; //to access debug flags. - ClassDef(THcShower,0) // Generic class + ClassDef(THcShower,0) // Shower counter detector }; /////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index 8cb7e141d6c2cf355d56a25a50f62dc98a3f1356..41fecdfcb29768015bca2e7ec96828da94a01e8b 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -147,6 +147,6 @@ protected: virtual Int_t ReadDatabase( const TDatime& date ); virtual Int_t DefineVariables( EMode mode = kDefine ); virtual void InitializePedestals( ); - ClassDef(THcShowerPlane,0) + ClassDef(THcShowerPlane,0); // Calorimeter bars in a plane }; #endif diff --git a/src/THcSignalHit.h b/src/THcSignalHit.h index 6af80a6e68a203261d306336022d015a237a71cf..808c730b287d256ade1d35f8dab854c9c0445d7f 100644 --- a/src/THcSignalHit.h +++ b/src/THcSignalHit.h @@ -29,7 +29,7 @@ class THcSignalHit : public TObject { Int_t fPaddleNumber; Double_t fData; - ClassDef(THcSignalHit,0) + ClassDef(THcSignalHit,0); // Single signal value and wire/counter number }; ///////////////////////////////////////////////////////////////// #endif diff --git a/src/THcSpacePoint.h b/src/THcSpacePoint.h index bf63699e881b5d921b4aefea52ec1d3d7518d4c1..36faa3d347b911c4728e5baab1422ba3459b9b92 100644 --- a/src/THcSpacePoint.h +++ b/src/THcSpacePoint.h @@ -84,7 +84,7 @@ protected: Double_t fStub[4]; // Should we also have a pointer back to the chamber object - ClassDef(THcSpacePoint,0) // Drift Chamber class + ClassDef(THcSpacePoint,0); // Space Point/stub track in a single drift chamber }; ////////////////////////////////////////////////////////////////////////////////