Skip to content
Snippets Groups Projects
  • Stephen A. Wood's avatar
    b519f00b
    Implement DC Space Point finding · b519f00b
    Stephen A. Wood authored
      New class THcDC is whole set of wire chambers.
      THcDriftChamber is one chamber (6 planes)
      Implement space point finding from h_pattern_recognition up to point
         before where space point lists from the two chambers are combined.
      Includes
          FindEasySpacePoint   (h_find_easy_space_point)
          FindHardSpacePoints  (find_space_points)
          DestroyPoorSpacePoints (h_sp_destroy)
          SpacePointMultiwire  (h_sp_multiwire)
          ChooseSingleHit 	   (h_choose_single_hit)
          SelectSpacePoint	   (select_space_points)
    
    Space points are arrays of structures in the THcDriftChamber class.  Will
    probably need to take space points out class so that they can be looked at
    at the THcDC level.
    
    New code is only tested to see that it compiles and that space points
    are sometimes found.
    b519f00b
    History
    Implement DC Space Point finding
    Stephen A. Wood authored
      New class THcDC is whole set of wire chambers.
      THcDriftChamber is one chamber (6 planes)
      Implement space point finding from h_pattern_recognition up to point
         before where space point lists from the two chambers are combined.
      Includes
          FindEasySpacePoint   (h_find_easy_space_point)
          FindHardSpacePoints  (find_space_points)
          DestroyPoorSpacePoints (h_sp_destroy)
          SpacePointMultiwire  (h_sp_multiwire)
          ChooseSingleHit 	   (h_choose_single_hit)
          SelectSpacePoint	   (select_space_points)
    
    Space points are arrays of structures in the THcDriftChamber class.  Will
    probably need to take space points out class so that they can be looked at
    at the THcDC level.
    
    New code is only tested to see that it compiles and that space points
    are sometimes found.
THcDCHit.cxx 3.06 KiB
///////////////////////////////////////////////////////////////////////////////
//                                                                           //
// THcDCHit                                                                 //
//                                                                           //
// Class representing a single hit for the VDC                               //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////

#include "THcDCHit.h"
#include "THcDCTimeToDistConv.h"

#include <iostream>

using std::cout;
using std::endl;

ClassImp(THcDCHit)

const Double_t THcDCHit::kBig = 1.e38; // Arbitrary large value

//_____________________________________________________________________________
void THcDCHit::Print( Option_t* opt ) const
{
  // Print hit info

  cout << "Hit: wire=" << GetWireNum()
       << "/" << (fWirePlane ? fWirePlane->GetName() : "??")
       << " wpos="     << GetPos()
       << " time="     << GetTime()
       << " drift="    << GetDist();
  //       << " res="      << GetResolution()
    //       << " z="        << GetZ()
  if( *opt != 'C' )
    cout << endl;
}

//_____________________________________________________________________________
Double_t THcDCHit::ConvertTimeToDist()
{
  // Converts TDC time to drift distance
  // Takes the (estimated) slope of the track as an argument
  
  THcDCTimeToDistConv* ttdConv = (fWire) ? fWire->GetTTDConv() : NULL;
  
  if (ttdConv) {
    // If a time to distance algorithm exists, use it to convert the TDC time 
    // to the drift distance
    fDist = ttdConv->ConvertTimeToDist(fTime);
    return fDist;
  }
  
  Error("ConvertTimeToDist()", "No Time to dist algorithm available");
  return 0.0;

}

//_____________________________________________________________________________
Int_t THcDCHit::Compare( const TObject* obj ) const 
{
  // Used to sort hits
  // A hit is "less than" another hit if it occurred on a lower wire number.
  // Also, for hits on the same wire, the first hit on the wire (the one with
  // the smallest time) is "less than" one with a higher time.  If the hits
  // are sorted according to this scheme, they will be in order of increasing
  // wire number and, for each wire, will be in the order in which they hit
  // the wire

  if( !obj || IsA() != obj->IsA() || !fWire )
    return -1;
  const THcDCHit* hit = static_cast<const THcDCHit*>( obj );
 
  Int_t myWireNum = fWire->GetNum();
  Int_t hitWireNum = hit->GetWire()->GetNum();
  Int_t myPlaneNum = GetPlaneNum();
  Int_t hitPlaneNum = hit->GetPlaneNum();
  if (myPlaneNum < hitPlaneNum) return -1;
  if (myPlaneNum > hitPlaneNum) return 1;
  // If planes are the same, compare wire numbers
  if (myWireNum < hitWireNum) return -1;
  if (myWireNum > hitWireNum) return  1;
  // If wire numbers are the same, compare times
  Double_t hitTime = hit->GetTime();
  if (fTime < hitTime) return -1;
  if (fTime > hitTime) return  1;
  return 0;
}

////////////////////////////////////////////////////////////////////////////////