From df592c3b8846a8826720213c5a6dfb9a55f5dc72 Mon Sep 17 00:00:00 2001
From: Vardan Tadevosyan <tadevosn@jlab.org>
Date: Thu, 19 Feb 2015 16:58:15 +0400
Subject: [PATCH] Modify debug outputs in the THcShower class to distinguish
 apparatuses.

---
 src/THcShower.cxx      | 25 +++++++++++++++++--------
 src/THcShowerPlane.cxx | 25 ++++++++++++++++++-------
 2 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/THcShower.cxx b/src/THcShower.cxx
index 590d756..b547562 100644
--- a/src/THcShower.cxx
+++ b/src/THcShower.cxx
@@ -96,7 +96,9 @@ void THcShower::Setup(const char* name, const char* description)
   delete [] desc;
 
   cout << "---------------------------------------------------------------\n";
-  cout << "From THcShower::Setup: created Shower planes ";
+  cout << "From THcShower::Setup: created Shower planes for "
+       << GetApparatus()->GetName() << ": ";
+
   for(UInt_t i=0;i < fNLayers;i++) {
     cout << fLayerNames[i];
     i < fNLayers-1 ? cout << ", " : cout << ".\n";
@@ -138,7 +140,8 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date )
 
 
   cout << "---------------------------------------------------------------\n";
-  cout << "From THcShower::Init: initialized " << GetName() << endl;
+  cout << "From THcShower::Init: initialized " << GetApparatus()->GetName()
+       <<  GetName() << endl;
   cout << "---------------------------------------------------------------\n";
 
   return fStatus = kOK;
@@ -196,7 +199,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
   // Debug output.
   if (fdbg_init_cal) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShower::ReadDatabase\n";
+    cout << "Debug output from THcShower::ReadDatabase for "
+	 << GetApparatus()->GetName() << endl;
 
     cout << "  Number of neg. columns      = " << fNegCols << endl;
     cout << "  Slop parameter              = " << fSlop << endl;
@@ -223,7 +227,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
 
   // Debug output.
   if (fdbg_init_cal) {
-    cout << "  HMS Calorimeter coordinate correction constants:" << endl;
+    cout << "  Coordinate correction constants:\n";
     cout << "    fAcor = " << fAcor << endl;
     cout << "    fBcor = " << fBcor << endl;
     cout << "    fCcor = " << fCcor[0] << ", " << fCcor[1] << endl;
@@ -625,7 +629,9 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks)
 
   if (fdbg_clusters_cal) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShower::CoarseProcess\n";
+    cout << "Debug output from THcShower::CoarseProcess for "
+	 << GetApparatus()->GetName() << endl;
+
     cout << "  List of unclustered hits. Total hits:     " << fNhits << endl;
     THcShowerHitIt it = HitSet.begin();    //<set> version
     for (Int_t i=0; i!=fNhits; i++) {
@@ -897,7 +903,8 @@ Int_t THcShower::MatchCluster(THaTrack* Track,
 
   if (fdbg_tracks_cal) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShower::MatchCluster\n";
+    cout << "Debug output from THcShower::MatchCluster for "
+	 << GetApparatus()->GetName() << endl;
 
     cout << "  Track at DC:"
 	 << "  X = " << Track->GetX()
@@ -974,7 +981,8 @@ Float_t THcShower::GetShEnergy(THaTrack* Track) {
 
   if (fdbg_tracks_cal) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShower::GetShEnergy\n";
+    cout << "Debug output from THcShower::GetShEnergy for "
+	 << GetApparatus()->GetName() << endl;
 
     cout << "  Track at the calorimeter: X = " << Xtr << "  Y = " << Ytr;
     if (mclust >= 0)
@@ -1011,7 +1019,8 @@ Int_t THcShower::FineProcess( TClonesArray& tracks )
 
   if (fdbg_tracks_cal) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShower::FineProcess\n";
+    cout << "Debug output from THcShower::FineProcess for "
+	 << GetApparatus()->GetName() << endl;
 
     cout << "  Number of tracks = " << Ntracks << endl;
 
diff --git a/src/THcShowerPlane.cxx b/src/THcShowerPlane.cxx
index a34c955..75bc422 100644
--- a/src/THcShowerPlane.cxx
+++ b/src/THcShowerPlane.cxx
@@ -151,7 +151,8 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date )
 
   if (fParent->fdbg_init_cal) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShowerPlane::ReadDatabase\n";
+    cout << "Debug output from THcShowerPlane::ReadDatabase for "
+	 << GetApparatus()->GetName() << ":" << endl;
 
     cout << "  Layer #" << fLayerNum << ", number of elements " << fNelem
 	 << endl;
@@ -211,7 +212,9 @@ void THcShowerPlane::Clear( Option_t* )
   // Debug output.
   if ( ((THcShower*) GetParent())->fdbg_decoded_cal ) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShowerPlane::Clear\n";
+    cout << "Debug output from THcShowerPlane::Clear for "
+	 << GetApparatus()->GetName() << ":" << endl;
+
     cout << " Cleared ADC hits for plane " << GetName() << endl;
     cout << "---------------------------------------------------------------\n";
   }
@@ -225,7 +228,9 @@ Int_t THcShowerPlane::Decode( const THaEvData& evdata )
   //Debug output.
   if ( ((THcShower*) GetParent())->fdbg_decoded_cal ) {
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShowerPlane::Decode\n";
+    cout << "Debug output from THcShowerPlane::Decode for "
+	 << GetApparatus()->GetName() << ":" << endl;
+
     cout << " Called for plane " << GetName() << endl;
     cout << "---------------------------------------------------------------\n";
   }
@@ -350,7 +355,9 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
   if (fParent->fdbg_decoded_cal) {
 
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShowerPlane::ProcessHits\n";
+    cout << "Debug output from THcShowerPlane::ProcessHits for "
+	 << GetApparatus()->GetName() << ":" << endl;
+
     cout << "  nrawhits =  " << nrawhits << "  nexthit =  " << nexthit << endl;
     cout << "  Sparsified hits for HMS calorimeter plane #" << fLayerNum
 	 << ", " << GetName() << ":" << endl;
@@ -434,7 +441,9 @@ Int_t THcShowerPlane::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit)
   if ( ((THcShower*) GetParent())->fdbg_raw_cal ) {
 
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShowerPlane::AcculatePedestals\n";
+    cout << "Debug output from THcShowerPlane::AcculatePedestals for "
+	 << GetApparatus()->GetName() << ":" << endl;
+
     cout << "Processed hit list for plane " << GetName() << ":\n";
 
     for (Int_t ih=nexthit; ih<nrawhits; ih++) {
@@ -488,8 +497,10 @@ void THcShowerPlane::CalculatePedestals( )
   if ( ((THcShower*) GetParent())->fdbg_raw_cal ) {
 
     cout << "---------------------------------------------------------------\n";
-    cout << "Debug output from THcShowerPlane::CalculatePedestals\n";
-    cout << "  ADC pedestals and thresholds for HMS calorimeter plane "
+    cout << "Debug output from THcShowerPlane::CalculatePedestals for"
+	 << GetApparatus()->GetName() << ":" << endl;
+
+    cout << "  ADC pedestals and thresholds for calorimeter plane "
 	 << GetName() << endl;
     for(Int_t i=0; i<fNelem;i++) {
       cout << "  element " << i << ": "
-- 
GitLab