From d209b394a8e6ad54153dc2359d1d804dae463441 Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <zviwood@gmail.com>
Date: Sat, 1 Feb 2014 22:05:47 -0500
Subject: [PATCH] Remove some commented out, and #if 0'd code

---
 src/THcDriftChamber.cxx      | 85 +++++++++----------------------
 src/THcHallCSpectrometer.cxx | 96 ------------------------------------
 src/THcHodoscope.cxx         | 45 -----------------
 src/THcHodoscopeHit.cxx      | 21 --------
 src/THcRawShowerHit.cxx      | 21 --------
 5 files changed, 23 insertions(+), 245 deletions(-)

diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx
index 9d7f936..c1fc995 100644
--- a/src/THcDriftChamber.cxx
+++ b/src/THcDriftChamber.cxx
@@ -208,13 +208,6 @@ Int_t THcDriftChamber::ReadDatabase( const TDatime& date )
     }
   }
 
-#if 0  
-  for(map<int,TMatrixD*>::iterator pm=fHaa3map.begin();
-      pm != fHaa3map.end(); pm++) {
-    fAA3Inv[pm->first]->Print();
-  }
-#endif
-
   fIsInit = true;
   return kOK;
 }
@@ -322,21 +315,6 @@ Int_t THcDriftChamber::FindSpacePoints( void )
       //      if(fNSpacePoints == 0) if (fhdebugflagpr) cout << "SelectSpacePoints() killed SP" << endl;
     }
     //    if (fhdebugflagpr) cout << fNSpacePoints << " Space Points remain" << endl;
-    // Add these space points to the total list of space points for the
-    // the DC package.  Do this in THcDC.cxx.
-#if 0
-    for(Int_t ip=0;ip<fNPlanes;ip++) {
-      Int_t np = fPlanes[ip]->GetPlaneNum(); // Actuall plane number of this plane
-      // (0-11) or (1-12)?
-      TClonesArray* fHits = fPlanes[ip]->GetHits();
-
-      for(Int_t ihit=0;ihit<fNhits;ihit++) { // Looping over all hits in all planes of the chamber
-	THcDCHit* hit = static_cast<THcDCHit*>(fHits->At(ihit));
-	// 
-
-      }
-    }
-#endif
   }
   return(fNSpacePoints);
 }
@@ -734,7 +712,6 @@ Int_t THcDriftChamber::SpacePointMultiWire()
 	  }
 	}
       }
-      //if (fhdebugflagpr) cout << " Max plane  and hits " << maxplane[0] << " " << nhitsperplane[maxplane[0]]<< " " << maxplane[1] << " " << nhitsperplane[maxplane[1]]<< " "<< maxplane[2] << " " << nhitsperplane[maxplane[2]]<< endl;      
       // First fill clones with 1 hit each from the 3 planes with the most hits
       for(Int_t n1=0;n1<nhitsperplane[maxplane[0]];n1++) {
 	for(Int_t n2=0;n2<nhitsperplane[maxplane[1]];n2++) {
@@ -752,16 +729,16 @@ Int_t THcDriftChamber::SpacePointMultiWire()
 	      newsp->Clear();	// Clear doesn't clear X, Y
 	      // if (fhdebugflagpr) cout << " original sp #hits combos X y " << sp->GetCombos() << sp->GetNHits() << sp->GetX() << " " <<  sp->GetY() << endl;
               newsp->SetXY(sp->GetX(), sp->GetY());
-	    newsp->SetCombos(combos_save);
-	    newsp->AddHit(hits_plane[maxplane[0]][n1]);
-	    newsp->AddHit(hits_plane[maxplane[1]][n2]);
-	    newsp->AddHit(hits_plane[maxplane[2]][n3]);
-	    newsp->AddHit(hits_plane[maxplane[3]][0]);
-	    if(nhitsperplane[maxplane[4]] == 1) {
-	      newsp->AddHit(hits_plane[maxplane[4]][0]);
-	      if(nhitsperplane[maxplane[5]] == 1) 
-		newsp->AddHit(hits_plane[maxplane[5]][0]);
-	    }
+	      newsp->SetCombos(combos_save);
+	      newsp->AddHit(hits_plane[maxplane[0]][n1]);
+	      newsp->AddHit(hits_plane[maxplane[1]][n2]);
+	      newsp->AddHit(hits_plane[maxplane[2]][n3]);
+	      newsp->AddHit(hits_plane[maxplane[3]][0]);
+	      if(nhitsperplane[maxplane[4]] == 1) {
+		newsp->AddHit(hits_plane[maxplane[4]][0]);
+		if(nhitsperplane[maxplane[5]] == 1) 
+		  newsp->AddHit(hits_plane[maxplane[5]][0]);
+	      }
 	    } else {
 	      // if (fhdebugflagpr) cout << " setting other sp " << "# space pts now = " << fNSpacePoints << endl;
 	      THcSpacePoint* newsp = (THcSpacePoint*)fSpacePoints->ConstructedAt(newsp_num);
@@ -769,39 +746,23 @@ Int_t THcDriftChamber::SpacePointMultiWire()
 	      Int_t combos_save=sp->GetCombos();
 	      newsp->Clear();
 	      newsp->SetXY(sp->GetX(), sp->GetY());
-	    newsp->SetCombos(combos_save);
-	    newsp->AddHit(hits_plane[maxplane[0]][n1]);
-	    newsp->AddHit(hits_plane[maxplane[1]][n2]);
-	    newsp->AddHit(hits_plane[maxplane[2]][n3]);
-	    newsp->AddHit(hits_plane[maxplane[3]][0]);
-	    if(nhitsperplane[maxplane[4]] == 1) {
-	      newsp->AddHit(hits_plane[maxplane[4]][0]);
-	      if(nhitsperplane[maxplane[5]] == 1) 
-		newsp->AddHit(hits_plane[maxplane[5]][0]);
-	    }
-           }
-	  }
-	}
-      }
-#if 0
-      // Loop over clones and order hits in the same way as parent SP
-      // Why do we have to order the hits.
-      for(Int_t i=0;i<ntot;i++) {
-	Int_t newsp_num= nsp_tot + i;
-	if(i == 1) newsp_num = isp;
-	for(Int_t j=0;j<nplanes_hit;j++) {
-	  for(Int_t k=0;k<nplanes_hit;k++) {
-	    THcDCHit* hit1 = fSpacePointHits[newsp_num][j];
-	    THcDCHit* hit2 = fSpacePointHits[newsp_num][k];
-	    if(hit_order(hit1) > hit_order(hit2)) {
-	      THcDCHit* temp = fSpacePoints[newsp_num].hits[k];
-	      fSpacePoints[newsp_num].hits[k] = fSpacePoints[newsp_num].hits[j];
-	      fSpacePoints[newsp_num].hits[j] = temp;
+	      newsp->SetCombos(combos_save);
+	      newsp->AddHit(hits_plane[maxplane[0]][n1]);
+	      newsp->AddHit(hits_plane[maxplane[1]][n2]);
+	      newsp->AddHit(hits_plane[maxplane[2]][n3]);
+	      newsp->AddHit(hits_plane[maxplane[3]][0]);
+	      if(nhitsperplane[maxplane[4]] == 1) {
+		newsp->AddHit(hits_plane[maxplane[4]][0]);
+		if(nhitsperplane[maxplane[5]] == 1) 
+		  newsp->AddHit(hits_plane[maxplane[5]][0]);
+	      }
 	    }
 	  }
 	}
       }
-#endif
+      // In the ENGINE, we loop over the clones and order the hits in the
+      // same order as the parent SP.  It is not done here because it is a little
+      // tricky.  Is it necessary?
       nsp_tot += (ntot-1);
     } else {
       ntot=1; // space point not to be cloned
diff --git a/src/THcHallCSpectrometer.cxx b/src/THcHallCSpectrometer.cxx
index 86f5a74..34d5a39 100644
--- a/src/THcHallCSpectrometer.cxx
+++ b/src/THcHallCSpectrometer.cxx
@@ -197,14 +197,6 @@ Int_t THcHallCSpectrometer::ReadDatabase( const TDatime& date )
       Error(here, "too much data in reconstruction coefficient file %s",reconCoeffFilename.c_str());
       return kInitError; // Is this the right return code?
     }
-#if 0
-    Double_t x,y,z,t;
-    Int_t a,b,c,d,e;
-    sscanf(line.c_str()," %le %le %le %le %1d%1d%1d%1d%1d",&x,&y,&z,&t,
-	   &a,&b,&c,&d,&e);
-    cout << x << " " << y << " " << z << " " << t << " "
-	 << a << b << c << d << endl;
-#endif
     sscanf(line.c_str()," %le %le %le %le %1d%1d%1d%1d%1d"
 	   ,&fReconCoeff[fNReconTerms][0],&fReconCoeff[fNReconTerms][1]
 	   ,&fReconCoeff[fNReconTerms][2],&fReconCoeff[fNReconTerms][3]
@@ -218,16 +210,6 @@ Int_t THcHallCSpectrometer::ReadDatabase( const TDatime& date )
     fNReconTerms++;
     good = getline(ifile,line).good();    
   }
-#if 0
-  cout << fNReconTerms << " Reconstruction terms" << endl;
-  for (Int_t i=0;i<fNReconTerms;i++) {
-    cout << fReconCoeff[i][0] << " " << fReconCoeff[i][1] << " "
-	 << fReconCoeff[i][2] << " " << fReconCoeff[i][3] << " "
-	 << fReconExponents[i][0] << fReconExponents[i][1]
-	 << fReconExponents[i][2] << fReconExponents[i][3]
-	 << fReconExponents[i][4] << endl;
-  }
-#endif
   if(!good) {
     Error(here, "error processing reconstruction coefficient file %s",reconCoeffFilename.c_str());
     return kInitError; // Is this the right return code?
@@ -341,84 +323,6 @@ Int_t THcHallCSpectrometer::TrackTimes( TClonesArray* Tracks ) {
   // To be useful, a meaningful timing resolution should be assigned
   // to each Scintillator object (part of the database).
   
-#if 0
-  if ( !Tracks ) return -1;
-
-  THaTrack *track=0;
-  Int_t ntrack = GetNTracks();
-
-  THaTrack *track=0;
-
-  // linear regression to:  t = t0 + pathl/(beta*c)
-  //   where t0 is the time of the track at the reference plane (sc_ref).
-  //   t0 and beta are solved for.
-  //
-
-  for ( Int_t i=0; i < ntrack; i++ ) {
-    track = static_cast<THaTrack*>(Tracks->At(i));
-    THaTrackProj* tr_ref = static_cast<THaTrackProj*>
-      (sc_ref->GetTrackHits()->At(i));
-    
-    Double_t pathlref = tr_ref->GetPathLen();
-    
-    Double_t wgt_sum=0.,wx2=0.,wx=0.,wxy=0.,wy=0.;
-    Int_t ncnt=0;
-    
-    // linear regression to get beta and time at ref.
-    TIter nextSc( fNonTrackingDetectors );
-    THaNonTrackingDetector *det;
-    while ( ( det = static_cast<THaNonTrackingDetector*>(nextSc()) ) ) {
-      THaScintillator *sc = dynamic_cast<THaScintillator*>(det);
-      if ( !sc ) continue;
-
-      const THaTrackProj *trh = static_cast<THaTrackProj*>(sc->GetTrackHits()->At(i));
-      
-      Int_t pad = trh->GetChannel();
-      if (pad<0) continue;
-      Double_t pathl = (trh->GetPathLen()-pathlref);
-      Double_t time = (sc->GetTimes())[pad];
-      Double_t wgt = (sc->GetTuncer())[pad];
-      
-      if (pathl>.5*kBig || time>.5*kBig) continue;
-      if (wgt>0) wgt = 1./(wgt*wgt);
-      else continue;
-      
-      wgt_sum += wgt;
-      wx2 += wgt*pathl*pathl;
-      wx  += wgt*pathl;
-      wxy += wgt*pathl*time;
-      wy  += wgt*time;
-      ncnt++;
-    }
-
-    Double_t beta = kBig;
-    Double_t dbeta = kBig;
-    Double_t time = kBig;
-    Double_t dt = kBig;
-    
-    Double_t delta = wgt_sum*wx2-wx*wx;
-    
-    if (delta != 0.) {
-      time = (wx2*wy-wx*wxy)/delta;
-      dt = TMath::Sqrt(wx2/delta);
-      Double_t invbeta = (wgt_sum*wxy-wx*wy)/delta;
-      if (invbeta != 0.) {
-#if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
-	Double_t c = TMath::C();
-#else
-	Double_t c = 2.99792458e8;
-#endif
-	beta = 1./(c*invbeta);
-	dbeta = TMath::Sqrt(wgt_sum/delta)/(c*invbeta*invbeta);
-      }
-    } 
-
-    track->SetBeta(beta);
-    track->SetdBeta(dbeta);
-    track->SetTime(time);
-    track->SetdTime(dt);
-  }
-#endif  
   return 0;
 }
 
diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx
index 202b97c..3d335ad 100644
--- a/src/THcHodoscope.cxx
+++ b/src/THcHodoscope.cxx
@@ -116,21 +116,6 @@ void THcHodoscope::Setup(const char* name, const char* description)
   }
 }
 
-#if 0
-//_____________________________________________________________________________
-void THcHodoscope::SetApparatus( THaApparatus* app )
-{
-  // Set the apparatus of this detector as well as the subdetectors
-
-  cout << "In THcHodoscope::SetApparatus" << endl;
-  THaDetector::SetApparatus( app );
-  for(Int_t i=0;i < fNPlanes;i++) {
-    fPlanes[i]->SetApparatus( app );
-  }
-  return;
-}
-#endif
-
 //_____________________________________________________________________________
 THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
 {
@@ -338,25 +323,6 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date )
     gHcParms->LoadParmValues((DBRequest*)&list,prefix);
   }
 
-/*
-#if 0
-  fCenter = new Double_t* [fNPlanes];
-  for(Int_t i=0;i<fNPlanes;i++) {
-    parname[plen] = '\0';
-    strcat(parname,fPlaneNames[i]);
-    strcat(parname,"_center");
-    cout << parname << endl;
-    Double_t* p = (Double_t *)gHcParms->Find(parname)->GetValuePointer();
-    fCenter[i] = new Double_t [fNPaddle[i]];
-    cout << parname;
-    for(Int_t ipad=0;ipad<fNPaddle[i];ipad++) {
-      fCenter[i][ipad] = p[ipad];
-      if (fDebug>=1)    cout << " " << fCenter[i][ipad];
-    }
-    if (fDebug>=1)  cout << endl;
-  }
-#endif
-*/
   // GN added
   // reading variables from *hodo.param
   fMaxScinPerPlane=fNPaddle[0];
@@ -639,17 +605,6 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata )
     fStartTime=fStartTimeCenter;
   }
   fStartTime=32.; // mkj force to constant
-  //  cout <<" stats = "<<fGoodStartTime<<" "<<nfptimes<<" fStartTime = "<<fStartTime<<endl;
-  // fRawHitList is TClones array of THcHodoscopeHit objects
-#if 0
-  for(Int_t ihit = 0; ihit < fNRawHits ; ihit++) {
-    THcHodoscopeHit* hit = (THcHodoscopeHit *) fRawHitList->At(ihit);
-    cout << ihit << " : " << hit->fPlane << ":" << hit->fCounter << " : "
-	 << hit->fADC_pos << " " << hit->fADC_neg << " "  <<  hit->fTDC_pos
-	 << " " <<  hit->fTDC_neg << endl;
-  }
-  cout << endl;
-#endif
 
   ///  fStartTime = 500;		// Drift Chamber will need this
 
diff --git a/src/THcHodoscopeHit.cxx b/src/THcHodoscopeHit.cxx
index 82f1c84..3c2bf37 100644
--- a/src/THcHodoscopeHit.cxx
+++ b/src/THcHodoscopeHit.cxx
@@ -43,27 +43,6 @@ Int_t THcHodoscopeHit::GetData(Int_t signal) {
   return(-1); // Actually should throw exception
 }
 
-#if 0
-Int_t THcHodoscopeHit::Compare(const TObject* obj) const
-{
-  // Compare to sort by plane and counter
-
-  const THcHodoscopeHit* hit = dynamic_cast<const THcHodoscopeHit*>(obj);
-
-  if(!hit) return -1;
-  Int_t p1 = fPlane;
-  Int_t p2 = hit->fPlane;
-  if(p1 < p2) return -1;
-  else if(p1 > p2) return 1;
-  else {
-    Int_t c1 = fCounter;
-    Int_t c2 = hit->fCounter;
-    if(c1 < c2) return -1;
-    else if (c1 == c2) return 0;
-    else return 1;
-  }
-}
-#endif
 //_____________________________________________________________________________
 THcHodoscopeHit& THcHodoscopeHit::operator=( const THcHodoscopeHit& rhs )
 {
diff --git a/src/THcRawShowerHit.cxx b/src/THcRawShowerHit.cxx
index 75c3a32..8ced5a7 100644
--- a/src/THcRawShowerHit.cxx
+++ b/src/THcRawShowerHit.cxx
@@ -31,27 +31,6 @@ Int_t THcRawShowerHit::GetData(Int_t signal) {
   return(-1); // Actually should throw exception
 }
 
-#if 0
-Int_t THcRawShowerHit::Compare(const TObject* obj) const
-{
-  // Compare to sort by plane and counter
-
-  const THcRawShowerHit* hit = dynamic_cast<const THcRawShowerHit*>(obj);
-
-  if(!hit) return -1;
-  Int_t p1 = fPlane;
-  Int_t p2 = hit->fPlane;
-  if(p1 < p2) return -1;
-  else if(p1 > p2) return 1;
-  else {
-    Int_t c1 = fCounter;
-    Int_t c2 = hit->fCounter;
-    if(c1 < c2) return -1;
-    else if (c1 == c2) return 0;
-    else return 1;
-  }
-}
-#endif
 //_____________________________________________________________________________
 THcRawShowerHit& THcRawShowerHit::operator=( const THcRawShowerHit& rhs )
 {
-- 
GitLab