BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
// $Id: BrDCPlane.cxx,v 1.1.1.1 2001/06/21 14:55:00 hagel Exp $
//

#include "BrDCPlane.h"
#include "BrMath.h"

ClassImp(BrDCPlane);



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

 BrDCPlane::BrDCPlane()
{
  // Default Constructor. 
  // Don't use this constructor unless you have to and know
  // what you are doing
}

 BrDCPlane::BrDCPlane(Char_t *name, Char_t *title)
{
  SetName(name);
  SetTitle(title);
  SetDefaultParams();
}

 BrDCPlane::BrDCPlane(Char_t *name, Char_t *title,
		     Float_t wirdis, Float_t wirang,Float_t stagger)
  :BrPlane3D(0,0,0,1,0,0,0,1,0)
{
  //Create a DC plane with a default z=0 plane
  SetName(name);
  SetTitle(title);
  SetWirdis(wirdis);
  SetWirang(wirang);
  SetDefaultParams();
  //Needs to be called after default params because stagger set in there
  SetStagger(stagger);
}

 BrDCPlane::BrDCPlane(Char_t *name, Char_t *title,
		     Float_t wirdis, Float_t wirang,Float_t stagger,
		     const Double_t x1, const Double_t y1, const Double_t z1,
		     const Double_t x2, const Double_t y2, const Double_t z2,
		     const Double_t x3, const Double_t y3, const Double_t z3 )
  :BrPlane3D(x1,y1,z1,x2,y2,z2,x3,y3,z3)
{
  // Create a DC plane with the specified plane points.  The plane
  // points are in the local coordinate system of the DC Submodule.
  SetName(name);
  SetTitle(title);
  SetWirdis(wirdis);
  SetWirang(wirang);
  SetStagger(stagger);
}

 BrDCPlane::BrDCPlane(Char_t *name, Char_t *title,
		     Float_t wirdis, Float_t wirang,
		     Float_t stagger,const Double_t z)
  :BrPlane3D(0,0,z,1.0,0,z,0,1.0,z)
{
  // Create a DC plane with the specified z.  The center of the plane
  // is assumed to be at (x,y) = (0,0).  The plane points are in the
  // local coordinate system  of the DC Submodule.
  SetName(name);
  SetTitle(title);
  SetWirdis(wirdis);
  SetWirang(wirang);
  SetDefaultParams();
  SetStagger(stagger);
}

 BrDCPlane::BrDCPlane(Char_t *name, Char_t *title,
		     Float_t wirdis, Float_t wirang,Float_t stagger,
		     const BrVector3D &p1, const BrVector3D &p2, 
		     const BrVector3D &p3 )
  :BrPlane3D(p1,p2,p3)
{
  // Create a DC plane with at the specified points given by the
  // vectors (points) p1,p2, and p3
  SetName(name);
  SetTitle(title);
  SetWirdis(wirdis);
  SetWirang(wirang);
  SetDefaultParams();
  SetStagger(stagger);
}

 BrDCPlane::~BrDCPlane()
{
  // int ijk = 1;
}

 void BrDCPlane::ListParameters()
{
  printf("The name is %sn",GetName());
}

 void BrDCPlane::SetDefaultParams() {
  fStagger = (Float_t)0.0;
  //fTdcConv   = (Float_t)0.25;       //250 ps
  fTdcConv   = (Float_t)0.00025;       //250 ps
  fTdcOffset = (Float_t)25;      //25 channels.
}

 Int_t BrDCPlane::GetNwire() {
  if(fStagger == 0) return 1; else return 0;
}

 Float_t BrDCPlane::GetWirePosition(const Int_t iwire) {
  // Return the position of the wire specified in the argument.  This
  // routine is for the moment simple, but will probably get much more
  // complicated once we have real positions.  They would probably be
  // read from a database. 
  Float_t xwire;
  /*
    if( GetNwire() == 1 ) xwire = GetWirdis() *  (Float_t)iwire;
    else                  xwire = GetWirdis() * ((Float_t)iwire + 0.5);
  */
  xwire = GetWirdis() * (Float_t)iwire + fStagger;
  return xwire;


}

 Int_t BrDCPlane::GetWireNumber(const Float_t xpos) {
  //Given an x-position, return the wire number associated.
  //Description
  //
  //wire #     -2    -1     0     1     2 ...      GetNwire() == 1
  //            o     o     o     o     o
  //	  
  // u                      0
  // -     -----+-----+-----+-----+-----+----->  +
  //         o     o     o     o     o     o       GetNwire() == 0 if eg fStagger == .5
  //wire #   -3    -2    -1    0     1     2
  //       o     o     o     o     o     o         GetNwire() == 0 if eg fStagger == .2
  //wire # -3    -2    -1    0     1     2
  //
  Int_t iwire;
  iwire = BrMath::Int(xpos/ GetWirdis() - fStagger);
  /*
    Int_t iwire;
    if( GetNwire() == 1 ) {
    // TMath::Int appears to behave as FORTRAN NINT
    iwire  = BrMath::Int(xpos /GetWirdis());
    }
    else {
    // (Int_t) appears to behave as FORTRAN INT
    iwire  = (Int_t)(xpos /GetWirdis());
    if( xpos < 0 ) iwire = iwire - 1;
    }
  */
  return iwire;
}

 Float_t BrDCPlane::GetTdcConv(const Int_t iwire) {
  // Return the TDC slope for the specified wire.  At the moment
  // 15-MAR-1999, do simple thing and always return the same value.
  return fTdcConv;
}

 Float_t BrDCPlane::GetTdcOffset(const Int_t iwire) {
  // Return the TDC slope for the specified wire.  At the moment
  // 15-MAR-1999, do simple thing and always return the same value.
  return fTdcOffset;
}

 Float_t BrDCPlane::GetRealTime(const Int_t adc_time,const Int_t iwire) {
  // Return the calibrated time.  For now simple and always return the
  // same value regardless of wire, but will become more complicated
  // as we get more realistic 
  return((adc_time - GetTdcOffset(iwire)) * GetTdcConv(iwire));

}


 void BrDCPlane::SetName(const Text_t *name) {
  //Set Name of object.  
  if(strlen(name)>64) strncpy(fName,name,64);
  else strcpy(fName,name);
}

 void BrDCPlane::SetTitle(const Text_t *title) {
  //Set Title of object.  
  if(strlen(title)>64) strncpy(fTitle,title,64);
  else strcpy(fTitle,title);
}

// $Log: BrDCPlane.cxx,v $
// Revision 1.1.1.1  2001/06/21 14:55:00  hagel
// Initial revision of brat2
//
// Revision 1.6  2000/09/29 02:15:59  hagel
// Changes having to do with development of BrDCTrackingModule
//
// Revision 1.5  2000/03/21 21:22:00  cholm
// Several changes: A few hacks where needed to compile on Digital Unix, noticably in my - Christian Holm - classes for the DB and Exceptions. Proberly still need to do something to some of Konstantins stuff. Also, I removed a lot of warnings fromt the compiler, by teddying up the code. Several places, old C-style indecies in for loops were assumed. Corrected. Unused variables have been commented out.
//
// Revision 1.4  1999/04/07 21:10:33  hagel
// Add support for BrDCPlane to specify stagger
//
// Revision 1.3  1999/03/16 21:04:12  hagel
// 1. Make BrDCPlane inherit from BrPlane3D.  BrDCPlane how has information about
//    where it is located.
// 2. Change BrDigitizeDC and BrLocalTrackDC to make use of new BrDCPlane information.
// 3. Move Decode(...) from BrDigitizeDC to BrLocalTrackDC.
// 4. Change cut parameters to be member data with defaults rather than hardwired.
//
// Revision 1.2  1999/01/12 20:25:13  hagel
// Add CVS logs to several modules missing it
//

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS