diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index ada99394e141ea96257048863e0ebce3aacc407a..fcfcbac1291d29d2660edfbd6a70b559c55d603c 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -18,12 +18,13 @@ RUN ls -lrth /usr/local/lib/lib*.so \ && export PATH=/usr/local/bin:$PATH \ && git clone https://eicweb.phy.anl.gov/jlab/analyzer.git \ && mkdir analyzer/build && cd analyzer/build && git checkout scandalizer && git pull \ - && cmake ../. && make -j20 && make install && cd /tmp \ + && cmake ../. && make -j20 && make install \ + && cd /tmp && rm -rf analyzer \ && git clone https://eicweb.phy.anl.gov/jlab/hcana.git \ && mkdir hcana/build && cd hcana/build \ && git checkout scandalizer && git pull \ && cmake ../. && make -j20 && make install \ - && cd /tmp && rm -rf analyzer && rm -rf hcana + && cd /tmp && rm -rf hcana #-DCMAKE_CXX_FLAGS=" -march=haswell -O3 -mfma -malign-data=cacheline -finline-functions " diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index 5fd05c0f6f72b9b1a80cd59add97e267c9e7f6fa..5dc6ae05dbf785ca6f1c3374fedda1fac4df7495 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -36,7 +36,7 @@ using namespace std; //_____________________________________________________________________________ THcAerogel::THcAerogel( const char* name, const char* description, THaApparatus* apparatus ) : - hcana::ConfigLogging<THaNonTrackingDetector>(name,description,apparatus), + THaNonTrackingDetector(name,description,apparatus), fPresentP(0), fAdcPosTimeWindowMin(0), fAdcPosTimeWindowMax(0), fAdcNegTimeWindowMin(0), fAdcNegTimeWindowMax(0), fRegionValue(0), fPosGain(0), fNegGain(0), @@ -57,7 +57,7 @@ THcAerogel::THcAerogel( const char* name, const char* description, //_____________________________________________________________________________ THcAerogel::THcAerogel( ) : - hcana::ConfigLogging<THaNonTrackingDetector>(), + THaNonTrackingDetector(), fAdcPosTimeWindowMin(0), fAdcPosTimeWindowMax(0), fAdcNegTimeWindowMin(0), fAdcNegTimeWindowMax(0), fRegionValue(0), fPosGain(0), fNegGain(0), frPosAdcPedRaw(0), frPosAdcPulseIntRaw(0), frPosAdcPulseAmpRaw(0), @@ -165,7 +165,7 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) EngineDID[0] = toupper(GetApparatus()->GetName()[0]); if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; - Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + _det_logger->error( "{} Error filling detectormap for {}.", "THcAerogel::Init", EngineDID ); return kInitError; } @@ -182,7 +182,7 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) if( !app || !(fglHod = dynamic_cast<THcHodoscope*>(app->GetDetector("hod"))) ) { static const char* const here = "ReadDatabase()"; - Warning(Here(here),"Hodoscope \"%s\" not found. ","hod"); + _det_logger->warn("{} Hodoscope \"{}\" not found. ",Here(here),"hod"); } fPresentP = 0; @@ -218,8 +218,7 @@ Int_t THcAerogel::ReadDatabase( const TDatime& date ) Bool_t optional = true; - _logger->info("Created aerogel detector {}.{} with {} PMT pairs.", GetApparatus()->GetName(), - GetName(), fNelem); + _det_logger->info("Created aerogel detector {}.{} with {} PMT pairs.", GetApparatus()->GetName(), GetName(), fNelem); //cout << "Created aerogel detector " << GetApparatus()->GetName() << "." // << GetName() << " with " << fNelem << " PMT pairs" << endl; diff --git a/src/THcAerogel.h b/src/THcAerogel.h index 4bd9f5e34214d8ad7dbf1478e574f6b0ccd69eb5..1a755523539b6364c39339e8d61d38a37199d4b6 100644 --- a/src/THcAerogel.h +++ b/src/THcAerogel.h @@ -16,7 +16,7 @@ class THcHodoscope; -class THcAerogel : public hcana::ConfigLogging<THaNonTrackingDetector>, public THcHitList { +class THcAerogel : public THaNonTrackingDetector, public THcHitList { public: THcAerogel(const char* name, const char* description = "", THaApparatus* a = NULL); diff --git a/src/THcCherenkov.cxx b/src/THcCherenkov.cxx index 65c19f1a9cae5be15f0ab19273baf3c5cb2449bd..33d4571642f548e5d7a45259b4ca9246e5dfe946 100644 --- a/src/THcCherenkov.cxx +++ b/src/THcCherenkov.cxx @@ -45,7 +45,7 @@ using std::setprecision; //_____________________________________________________________________________ THcCherenkov::THcCherenkov( const char* name, const char* description, THaApparatus* apparatus ) : - hcana::ConfigLogging<THaNonTrackingDetector>(name,description,apparatus) + THaNonTrackingDetector(name,description,apparatus) { // Normal constructor with name and description frAdcPedRaw = new TClonesArray("THcSignalHit", MaxNumCerPmt*MaxNumAdcPulse); @@ -76,8 +76,7 @@ THcCherenkov::THcCherenkov( const char* name, const char* description, } //_____________________________________________________________________________ -THcCherenkov::THcCherenkov( ) : - hcana::ConfigLogging<THaNonTrackingDetector>() +THcCherenkov::THcCherenkov( ) { // Constructor frAdcPedRaw = NULL; @@ -203,7 +202,7 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date ) Bool_t optional = true; - _logger->info("Created Cherenkov detector {}.{} with {} PMTs",GetApparatus()->GetName(), GetName(), fNelem); + _det_logger->info("Created Cherenkov detector {}.{} with {} PMTs",GetApparatus()->GetName(), GetName(), fNelem); //cout << "Created Cherenkov detector " << GetApparatus()->GetName() << "." // << GetName() << " with " << fNelem << " PMTs" << endl; diff --git a/src/THcCherenkov.h b/src/THcCherenkov.h index 84dce6c91ae12da8bb4c314b405466710aaed62f..53ff2d6921956f74fdfebe3157ba03a89f418766 100644 --- a/src/THcCherenkov.h +++ b/src/THcCherenkov.h @@ -16,7 +16,7 @@ class THcHodoscope; -class THcCherenkov : public hcana::ConfigLogging<THaNonTrackingDetector>, public THcHitList { +class THcCherenkov : public THaNonTrackingDetector, public THcHitList { using vec = std::vector<Double_t>; diff --git a/src/THcDC.cxx b/src/THcDC.cxx index f50e9450c5e72f9c13e2e5d18ca5829c72d73c36..6f6215d0005721cae6d3197cfadb2adde9eea6e6 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -44,7 +44,7 @@ using namespace std; THcDC::THcDC( const char* name, const char* description, THaApparatus* apparatus ) : - hcana::ConfigLogging<THaTrackingDetector>(name,description,apparatus) + THaTrackingDetector(name,description,apparatus) { // Constructor @@ -142,8 +142,8 @@ void THcDC::Setup(const char* name, const char* description) fHMSStyleChambers = 0; } - _logger->info("Plane Name List: {}", planenamelist); - _logger->info("Drift Chambers: {} planes in {} chambers", fNPlanes, fNChambers); + _det_logger->info("Plane Name List: {}", planenamelist); + _det_logger->info("Drift Chambers: {} planes in {} chambers", fNPlanes, fNChambers); //cout << "Plane Name List: " << planenamelist << endl; //cout << "Drift Chambers: " << fNPlanes << " planes in " << fNChambers << " chambers" << endl; @@ -151,7 +151,7 @@ void THcDC::Setup(const char* name, const char* description) 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; - _logger->error("ERROR: Number of planes {} doesn't agree with number of plane names {}", + _det_logger->error("ERROR: Number of planes {} doesn't agree with number of plane names {}", fNPlanes, plane_names.size()); // Should quit. Is there an official way to quit? @@ -173,7 +173,7 @@ void THcDC::Setup(const char* name, const char* description) THcDriftChamberPlane* newplane = new THcDriftChamberPlane(fPlaneNames[i], desc, i+1, this); if( !newplane or newplane->IsZombie() ) { - Error( Here(here), "Error creating Drift Chamber plane %s. Call expert.", name); + _det_logger->error( "{} Error creating Drift Chamber plane {}. Call expert.", Here(here), name); MakeZombie(); delete [] desc; delete [] desc1; @@ -193,7 +193,7 @@ void THcDC::Setup(const char* name, const char* description) THcDriftChamber* newchamber = new THcDriftChamber(desc1, desc, i+1, this); fChambers.push_back(newchamber); //cout << "Created Drift Chamber " << i+1 << ", " << desc1 << endl; - _logger->info("Created Drift Chamber {}, {}" , i+1 , desc1); + _det_logger->info("Created Drift Chamber {}, {}" , i+1 , desc1); newchamber->SetHMSStyleFlag(fHMSStyleChambers); // Tell the chamber its style } delete [] desc; @@ -201,8 +201,7 @@ void THcDC::Setup(const char* name, const char* description) } //_____________________________________________________________________________ -THcDC::THcDC( ) : - hcana::ConfigLogging<THaTrackingDetector>() +THcDC::THcDC( ) { // Constructor } @@ -219,13 +218,13 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) EngineDID[0] = toupper(GetApparatus()->GetName()[0]); if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; - Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + _det_logger->error("{} Error filling detectormap for {}.", Here(here), EngineDID ); return kInitError; } // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - _logger->info("DC tdc ref time cut = {} ", fTDC_RefTimeCut); + _det_logger->info("DC tdc ref time cut = {} ", fTDC_RefTimeCut); //cout << " DC tdc ref time cut = " << fTDC_RefTimeCut << endl; InitHitList(fDetMap, "THcRawDCHit", fDetMap->GetTotNumChan()+1, fTDC_RefTimeCut, 0); @@ -397,7 +396,7 @@ Int_t THcDC::ReadDatabase( const TDatime& date ) plane_counts_string += std::to_string(fNWires[i]); } //cout << endl; - _logger->info("Plane counts: {}", plane_counts_string); + _det_logger->info("Plane counts: {}", plane_counts_string); fIsInit = true; diff --git a/src/THcDC.h b/src/THcDC.h index 8c3d82fb081bcb636296788215eb7158df454e03..4665ec396e594a0be2fca2a5996fe0d8e5b6acc2 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -15,10 +15,6 @@ #include "THcDriftChamber.h" #include "TMath.h" -#include "spdlog/spdlog.h" -#include "spdlog/sinks/stdout_color_sinks.h" //support for stdout logging -#include "spdlog/sinks/basic_file_sink.h" // support for basic file logging - #include "hcana/Logger.h" #define NUM_FPRAY 4 @@ -26,9 +22,7 @@ //class THaScCalib; class TClonesArray; -class THcDC : public hcana::ConfigLogging<THaTrackingDetector>, public THcHitList { -//private: -// std::shared_ptr<spdlog::logger> _logger; +class THcDC : public THaTrackingDetector, public THcHitList { public: THcDC( const char* name, const char* description = "", diff --git a/src/THcHitList.cxx b/src/THcHitList.cxx index 2b0b09d0b160f0b2f5d7c08ff3defce63a26519e..368d9cedca80985130a71d0af06979f20bbb475c 100644 --- a/src/THcHitList.cxx +++ b/src/THcHitList.cxx @@ -21,13 +21,8 @@ using namespace std; #define SUPPRESSMISSINGADCREFTIMEMESSAGES 1 -THcHitList::THcHitList() : fMap(0), fTISlot(0), fDisableSlipCorrection(kFALSE) +THcHitList::THcHitList() : podd2::HitLogging<podd2::EmptyBase>(), fMap(0), fTISlot(0), fDisableSlipCorrection(kFALSE) { - _hitlist_logger = spdlog::get("hitlst"); - if(!_hitlist_logger) { - _hitlist_logger = spdlog::stdout_color_mt("hitlst"); - _hitlist_logger->set_pattern("[%t] [%n] %^[%l]%$ %v"); - } /// Normal constructor. @@ -67,7 +62,7 @@ void THcHitList::InitHitList(THaDetMap* detmap, const char *hitclass, Int_t maxhits, Int_t tdcref_cut, Int_t adcref_cut) { - _hitlist_logger->info("InitHitList: {} RefTimeCuts: {} {}", hitclass, tdcref_cut, adcref_cut); + _hit_logger->info("InitHitList: {} RefTimeCuts: {} {}", hitclass, tdcref_cut, adcref_cut); //cout << "InitHitList: " << hitclass << " RefTimeCuts: " << tdcref_cut << " " << adcref_cut << endl; fRawHitList = new TClonesArray(hitclass, maxhits); fRawHitClass = fRawHitList->GetClass(); @@ -525,7 +520,7 @@ void THcHitList::CreateMissReportParms(const char *prefix) Parameters created are ${prefix}_tdcref_miss and ${prefix}_adcref_miss */ - _hitlist_logger->info("Defining {}_tdcref_miss and {}_adcref_miss", prefix, prefix); + _hit_logger->info("Defining {}_tdcref_miss and {}_adcref_miss", prefix, prefix); //cout << "Defining " << Form("%s_tdcref_miss", prefix) << " and " << Form("%s_adcref_miss", prefix) << endl; gHcParms->Define(Form("%s_tdcref_miss", prefix), "Missing TDC reference times", fNTDCRef_miss); gHcParms->Define(Form("%s_adcref_miss", prefix), "Missing ADC reference times", fNADCRef_miss); @@ -533,7 +528,7 @@ Parameters created are ${prefix}_tdcref_miss and ${prefix}_adcref_miss void THcHitList::MissReport(const char *name) { - _hitlist_logger->warn("Missing Ref times: {:20} {:10} {:10}", name, fNTDCRef_miss, fNADCRef_miss); + _hit_logger->warn("Missing Ref times: {:20} {:10} {:10}", name, fNTDCRef_miss, fNADCRef_miss); //cout << "Missing Ref times:" << setw(20) << name << setw(10) << fNTDCRef_miss << setw(10) << fNADCRef_miss << endl; } diff --git a/src/THcHitList.h b/src/THcHitList.h index 7a0b70534c415ad967689f69021e567f61d0d36e..6e1855bdd8054f1982b178faa5cd1ef89521a7a1 100644 --- a/src/THcHitList.h +++ b/src/THcHitList.h @@ -26,9 +26,7 @@ using namespace std; //class THaDetMap; class THcConfigEvtHandler; -class THcHitList { - protected: - std::shared_ptr<spdlog::logger> _hitlist_logger; +class THcHitList : public podd2::HitLogging<podd2::EmptyBase> { public: diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index 6beaa08eccca4f9ec315f8aec835c0a685652099..e3917cef830a8de874d811311d8d4b472c2ca81a 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -112,7 +112,7 @@ void THcHodoscope::Setup(const char* name, const char* description) fADC_RefTimeCut = 0; gHcParms->LoadParmValues((DBRequest*)&listextra,prefix); - _logger->info("Plane Name List : {}" , planenamelist); + _det_logger->info("Plane Name List : {}" , planenamelist); //cout << "Plane Name List : " << planenamelist << endl; vector<string> plane_names = vsplit(planenamelist); @@ -165,7 +165,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; //Error( Here(here), "Error filling detectormap for %s.", EngineDID ); - _logger->error("Error filling detectormap for {}.",EngineDID); + _det_logger->error("THcHodoscope::Init : Error filling detectormap for {}.",EngineDID); return kInitError; } @@ -173,7 +173,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // maximum number of hits after setting up the detector map // But it needs to happen before the sub detectors are initialized // so that they can get the pointer to the hitlist. - _logger->info("Hodo tdc ref time cut = {} {}", fTDC_RefTimeCut, fADC_RefTimeCut); + _det_logger->info("Hodo tdc ref time cut = {} {}", fTDC_RefTimeCut, fADC_RefTimeCut); //cout << " Hodo tdc ref time cut = " << fTDC_RefTimeCut << " " << fADC_RefTimeCut << endl; InitHitList(fDetMap, "THcRawHodoHit", fDetMap->GetTotNumChan()+1, @@ -522,12 +522,12 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) // if ((fTofTolerance > 0.5) && (fTofTolerance < 10000.)) { //cout << "USING "<<fTofTolerance<<" NSEC WINDOW FOR FP NO_TRACK CALCULATIONS.\n"; - _logger->info("Using {} nsec window for fp no_track calculations.",fTofTolerance); + _det_logger->info("THcHodoscope: Using {} nsec window for fp no_track calculations.",fTofTolerance); } else { fTofTolerance= 3.0; //cout << "*** USING DEFAULT 3 NSEC WINDOW FOR FP NO_TRACK CALCULATIONS!! ***\n"; - _logger->warn("Using default {} nsec window for fp no_track calculations.",fTofTolerance); + _det_logger->warn("THcHodoscope: Using default {} nsec window for fp no_track calculations.",fTofTolerance); } fIsInit = true; return kOK; @@ -1583,7 +1583,7 @@ void THcHodoscope::TrackEffTest(void) clust_positions.push_back(avg_pos); n_good_clusters[ip]++; if (n_hit > 10) { - _logger->warn("cluster in hodoscope track efficiency has {} hits", n_hit); + _det_logger->warn("cluster in hodoscope track efficiency has {} hits", n_hit); } } }