UgliScintPlnHandle Class Reference

#include <UgliScintPlnHandle.h>

Inheritance diagram for UgliScintPlnHandle:

UgliPlnHandle UgliScintPlnABC UgliPlnABC List of all members.

Public Member Functions

 UgliScintPlnHandle (UgliScintPlnNode *scintNode)
 UgliScintPlnHandle (GeoScintPlnNode *scintNode)
 UgliScintPlnHandle (const UgliScintPlnHandle &that)
UgliScintPlnHandleoperator= (const UgliScintPlnHandle &that)
 UgliScintPlnHandle ()
virtual ~UgliScintPlnHandle ()
virtual Bool_t IsValid () const
virtual Bool_t IsFrozen () const
virtual Int_t NumberOfStrips () const
virtual UgliStripHandle GetStripHandle (PlexStripEndId seid)
std::vector< UgliStripHandleGetStripHandleVector ()
std::vector< UgliScintMdlHandleGetScintMdlHandleVector ()
UgliStripHandle GetClosestStrip (Float_t tpos, Float_t orthCoord=9999.)
virtual TVector3 GlobalToLocal (const TVector3 &global, const Bool_t globalInXYZ=true) const
virtual TVector3 LocalToGlobal (const TVector3 &local, const Bool_t globalInXYZ=true) const
Float_t GetZRotRelSteelRad () const
Float_t GetX0RelSteel () const
Float_t GetY0RelSteel () const
Bool_t AttemptSet (const char *what="?") const
void SetZRotRelSteelRad (Float_t radians)
void SetXY0RelSteel (Float_t x0, Float_t y0)
void RotateRelSteelBy (Float_t deltaRadians)
void ShiftXY0RelSteelBy (Float_t dx, Float_t dy)

Protected Attributes

UgliScintPlnNodefUgliScintPlnNode
GeoScintPlnNodefGeoScintPlnNode

Detailed Description

Definition at line 33 of file UgliScintPlnHandle.h.


Constructor & Destructor Documentation

UgliScintPlnHandle::UgliScintPlnHandle ( UgliScintPlnNode scintNode  ) 

Definition at line 45 of file UgliScintPlnHandle.cxx.

00046   : UgliPlnHandle(node), fUgliScintPlnNode(node), fGeoScintPlnNode(0)
00047 {
00048    // ctor keeps reference count up-to-date
00049    // done by super-class UgliPlnHandle
00050    // don't do it here or we'll get two counts for every handle
00051 
00052    // if (fUgliScintPlnNode) fUgliScintPlnNode->IncrementRef();
00053 }

UgliScintPlnHandle::UgliScintPlnHandle ( GeoScintPlnNode scintNode  ) 

Definition at line 56 of file UgliScintPlnHandle.cxx.

00057   : UgliPlnHandle(node), fUgliScintPlnNode(0), fGeoScintPlnNode(node)
00058 {
00059    // ctor keeps reference count up-to-date
00060    // done by super-class UgliPlnHandle
00061    // don't do it here or we'll get two counts for every handle
00062 
00063    // if (fGeoScintPlnNode) fGeoScintPlnNode->IncrementRef();
00064 }

UgliScintPlnHandle::UgliScintPlnHandle ( const UgliScintPlnHandle that  ) 

Definition at line 67 of file UgliScintPlnHandle.cxx.

00068    : UgliPlnHandle(that),
00069      UgliScintPlnABC(),
00070      fUgliScintPlnNode(that.fUgliScintPlnNode),
00071      fGeoScintPlnNode(that.fGeoScintPlnNode)
00072 {
00073    // copy constructor keeps reference counts up-to-date
00074    // done by super-class UgliPlnHandle
00075    // don't do it here or we'll get two counts for every handle
00076 
00077    // if (fUgliScintPlnNode) fUgliScintPlnNode->IncrementRef();
00078    // if (fGeoScintPlnNode) fGeoScintPlnNode->IncrementRef();
00079 }

UgliScintPlnHandle::UgliScintPlnHandle (  ) 

Definition at line 23 of file UgliScintPlnHandle.cxx.

References Msg::kDebug, and MSG.

00024   : UgliPlnHandle((UgliPlnNode*)0), fUgliScintPlnNode(0), fGeoScintPlnNode(0)
00025 {
00026    // Default constructor
00027 
00028    MSG("Ugli",Msg::kDebug) 
00029      << "UgliScintPlnHandle created by default ctor" << endl;
00030 //   assert(0);
00031 }

UgliScintPlnHandle::~UgliScintPlnHandle (  )  [virtual]

Definition at line 34 of file UgliScintPlnHandle.cxx.

00035 {
00036    // handle deletion updates reference count
00037    // done by super-class UgliPlnHandle
00038    // don't do it here or we'll get two counts for every handle
00039 
00040    // if (fUgliScintPlnNode) fUgliScintPlnNode->DecrementRef();
00041    // if (fGeoScintPlnNode) fGeoScintPlnNode->DecrementRef();
00042 }


Member Function Documentation

Bool_t UgliScintPlnHandle::AttemptSet ( const char *  what = "?"  )  const

Definition at line 186 of file UgliScintPlnHandle.cxx.

References UgliPlnHandle::GetPlexPlaneId(), IsFrozen(), Msg::kError, and MSG.

Referenced by SetXY0RelSteel(), and SetZRotRelSteelRad().

00187 {
00188   if (!IsFrozen()) return true;
00189 
00190   MSG("Ugli",Msg::kError) 
00191     << "AttemptSet " << what << " on Frozen " 
00192     << GetPlexPlaneId() << " twarted!" << endl;
00193   return false;
00194 }

UgliStripHandle UgliScintPlnHandle::GetClosestStrip ( Float_t  tpos,
Float_t  orthCoord = 9999. 
)

Definition at line 152 of file UgliScintPlnHandle.cxx.

References Munits::cm, fGeoScintPlnNode, fUgliScintPlnNode, UgliScintPlnNode::GetStripNodePtrVector(), and UgliPlnHandle::IsGeo().

Referenced by DmxShowerPlane::GetHypothesisLowerBound(), DmxMuonPlane::GetHypothesisLowerBound(), DmxShowerPlane::SetStrips(), DmxMuonPlane::SetStrips(), and GeoValidate::TestScintPln_GetClosestStrip().

00153 {
00154   // return the handle to the strip in the plane with a position
00155   // closest to "tpos", orthCoord is position in orthogonal coordinate
00156 
00157   if ( !IsGeo() ) {
00158     vector<UgliStripNode*>  stripNodes = 
00159       fUgliScintPlnNode->GetStripNodePtrVector();
00160 
00161     UgliStripNode* closestNode  = 0;
00162     Float_t        closestDtpos = 999999.;
00163 
00164     // very dumb approach ... 
00165     // strips are ordered? when delta start getting larger we could possibly quit
00166     // (is this guaranteed in the vector?)
00167     // and/or a binary search might be better
00168     for (unsigned int i=0; i<stripNodes.size(); ++i) {
00169       Float_t strip_tpos = stripNodes[i]->GetTPos(orthCoord);
00170       Float_t dtpos = TMath::Abs(strip_tpos-tpos);
00171       if ( dtpos < closestDtpos ) {
00172         closestNode  = stripNodes[i];
00173         closestDtpos = dtpos;
00174       }
00175     }
00176     return UgliStripHandle(closestNode);
00177   }
00178   else { 
00179     return UgliStripHandle(fGeoScintPlnNode -> GetClosestStrip(
00180                                     tpos/Munits::cm,orthCoord/Munits::cm));
00181   }
00182   
00183 }

vector< UgliScintMdlHandle > UgliScintPlnHandle::GetScintMdlHandleVector (  ) 

Definition at line 131 of file UgliScintPlnHandle.cxx.

References fGeoScintPlnNode, fUgliScintPlnNode, GeoScintPlnNode::GetScintMdlNodePtrVector(), UgliScintPlnNode::GetScintMdlNodePtrVector(), and UgliPlnHandle::IsGeo().

Referenced by GeoValidate::TestScintMdl(), and GeoValidate::TestScintPln_GetScintMdlHandleVector().

00132 {
00133 //{ return fUgliScintPlnNode->GetScintMdlHandleVector(); }
00134   vector<UgliScintMdlHandle> scintMdlHandles;
00135   if ( !IsGeo() ) {
00136     vector<UgliScintMdlNode*>  scintMdlNodes =
00137       fUgliScintPlnNode->GetScintMdlNodePtrVector();
00138     for (unsigned int i=0; i<scintMdlNodes.size(); ++i)
00139       scintMdlHandles.push_back(UgliScintMdlHandle(scintMdlNodes[i]));
00140   }
00141   else {
00142     vector<GeoScintMdlNode*>  scintMdlNodes =
00143       fGeoScintPlnNode->GetScintMdlNodePtrVector();
00144     for (unsigned int i=0; i<scintMdlNodes.size(); ++i)
00145       scintMdlHandles.push_back(UgliScintMdlHandle(scintMdlNodes[i]));
00146   }
00147   
00148   return scintMdlHandles;
00149 }

UgliStripHandle UgliScintPlnHandle::GetStripHandle ( PlexStripEndId  seid  )  [virtual]

Definition at line 104 of file UgliScintPlnHandle.cxx.

References fGeoScintPlnNode, fUgliScintPlnNode, GeoScintPlnNode::GetStripNode(), UgliScintPlnNode::GetStripNode(), and UgliPlnHandle::IsGeo().

Referenced by CandStripHandle::GetTPos(), ParticleTruthHelper::Process(), GeoValidate::TestScintPln_GetStripHandle(), and GeoValidate::TestStrip().

00105 { if (!IsGeo()) return UgliStripHandle(fUgliScintPlnNode->GetStripNode(seid)); 
00106        else return UgliStripHandle(fGeoScintPlnNode->GetStripNode(seid));
00107 }

vector< UgliStripHandle > UgliScintPlnHandle::GetStripHandleVector (  ) 

Definition at line 110 of file UgliScintPlnHandle.cxx.

References fGeoScintPlnNode, fUgliScintPlnNode, GeoScintPlnNode::GetStripNodePtrVector(), UgliScintPlnNode::GetStripNodePtrVector(), and UgliPlnHandle::IsGeo().

Referenced by ToyMCModule::Get(), GeoValidate::TestScintPln_GetStripHandle(), GeoValidate::TestScintPln_GetStripHandleVector(), and GeoValidate::TestStrip().

00111 {
00112 //{ return fUgliScintPlnNode->GetStripHandleVector(); }
00113   vector<UgliStripHandle> stripHandles;
00114   if ( !IsGeo() ) {
00115     vector<UgliStripNode*>  stripNodes = 
00116       fUgliScintPlnNode->GetStripNodePtrVector();
00117     for (unsigned int i=0; i<stripNodes.size(); ++i)
00118       stripHandles.push_back(UgliStripHandle(stripNodes[i]));
00119   }
00120   else {
00121     vector<GeoStripNode*>  stripNodes = 
00122       fGeoScintPlnNode->GetStripNodePtrVector();
00123     for (unsigned int i=0; i<stripNodes.size(); ++i)
00124       stripHandles.push_back(UgliStripHandle(stripNodes[i]));
00125   }
00126   
00127   return stripHandles;
00128 }

Float_t UgliScintPlnHandle::GetX0RelSteel (  )  const [inline]

Definition at line 113 of file UgliScintPlnHandle.h.

References Munits::cm, fGeoScintPlnNode, fUgliScintPlnNode, GeoScintPlnNode::GetX0RelSteel(), UgliScintPlnNode::GetX0RelSteel(), and UgliPlnHandle::IsGeo().

Referenced by ShiftXY0RelSteelBy(), and GeoValidate::TestScintPln_GetX0RelSteel().

00114 { if ( !IsGeo() ) return fUgliScintPlnNode->GetX0RelSteel();
00115   else return (fGeoScintPlnNode->GetX0RelSteel())*Munits::cm; }

Float_t UgliScintPlnHandle::GetY0RelSteel (  )  const [inline]

Definition at line 117 of file UgliScintPlnHandle.h.

References Munits::cm, fGeoScintPlnNode, fUgliScintPlnNode, GeoScintPlnNode::GetY0RelSteel(), UgliScintPlnNode::GetY0RelSteel(), and UgliPlnHandle::IsGeo().

Referenced by ShiftXY0RelSteelBy(), and GeoValidate::TestScintPln_GetY0RelSteel().

00118 { if ( !IsGeo() ) return fUgliScintPlnNode->GetY0RelSteel();
00119   else return (fGeoScintPlnNode->GetY0RelSteel())*Munits::cm; }

Float_t UgliScintPlnHandle::GetZRotRelSteelRad (  )  const [inline]

Definition at line 109 of file UgliScintPlnHandle.h.

References fGeoScintPlnNode, fUgliScintPlnNode, GeoScintPlnNode::GetZRotRelSteelRad(), UgliScintPlnNode::GetZRotRelSteelRad(), and UgliPlnHandle::IsGeo().

Referenced by RotateRelSteelBy(), and GeoValidate::TestScintPln_GetZRotRelSteelRad().

00110 { if ( !IsGeo() ) return fUgliScintPlnNode->GetZRotRelSteelRad();
00111   else return fGeoScintPlnNode->GetZRotRelSteelRad(); }

TVector3 UgliScintPlnHandle::GlobalToLocal ( const TVector3 &  global,
const Bool_t  globalInXYZ = true 
) const [virtual]

Definition at line 213 of file UgliScintPlnHandle.cxx.

References Munits::cm, dummy, fGeoScintPlnNode, fUgliScintPlnNode, DataUtil::GetDetector(), UgliPlnHandle::GetPlexPlaneId(), GeoNode::GlobalToLocal(), UgliScintPlnNode::GlobalToLocal(), UgliPlnHandle::IsGeo(), IsValid(), Msg::kWarning, MSG, and Ugli::uvz2xyz().

Referenced by GeoValidate::TestScintPln_GlobalToLocal().

00215 { 
00216 
00217   if ( !IsValid() ) {
00218     MSG("Ugli",Msg::kWarning) << "UgliScintPlnHandle::GlobalToLocal "
00219                               << "called for InValid scint pln." << endl;
00220     TVector3 dummy;
00221     return dummy;
00222   }
00223   
00224   // convert a global position into a local (volume) one
00225   // globalInXYZ determines whether result is in XYZ or UVZ
00226   TVector3 globalXYZ = (globalInXYZ) ? 
00227       global : Ugli::uvz2xyz(GetPlexPlaneId().GetDetector(),global);
00228 
00229   if ( !IsGeo() ) 
00230       return fUgliScintPlnNode->GlobalToLocal(global);
00231   else { 
00232       TVector3 scaledglobal(global); scaledglobal *= 1./Munits::cm;
00233       return (fGeoScintPlnNode->GlobalToLocal(scaledglobal) *= Munits::cm); 
00234   }
00235 }

Bool_t UgliScintPlnHandle::IsFrozen (  )  const [inline, virtual]

Definition at line 101 of file UgliScintPlnHandle.h.

References fGeoScintPlnNode, fUgliScintPlnNode, GeoNode::GetGeoGeometry(), UgliScintPlnNode::GetUgliGeometry(), GeoGeometry::IsFrozen(), UgliGeometry::IsFrozen(), and UgliPlnHandle::IsGeo().

Referenced by AttemptSet().

00102 { if ( !IsGeo() ) return fUgliScintPlnNode->GetUgliGeometry()->IsFrozen();
00103   else return fGeoScintPlnNode->GetGeoGeometry()->IsFrozen(); }

Bool_t UgliScintPlnHandle::IsValid (  )  const [inline, virtual]

Reimplemented from UgliPlnHandle.

Definition at line 97 of file UgliScintPlnHandle.h.

References fGeoScintPlnNode, fUgliScintPlnNode, and UgliPlnHandle::IsGeo().

Referenced by CandTrackHandle::BelongsWithShower(), CandShowerHandle::BelongsWithShower(), CandTrackHandle::BelongsWithTrack(), CandShowerHandle::BelongsWithTrack(), AlgTrackSRList::FindNumSkippedPlanes(), ToyMCModule::Get(), GlobalToLocal(), AlgFitTrackMS::InitArrays(), LocalToGlobal(), AlgFitTrackCam::SetRangeAnddS(), AlgFitTrackMS::SetupAlg(), AlgShowerSR::SetUV(), and AlgTrack::SetUVZ().

00098 { if ( !IsGeo() ) return (fUgliScintPlnNode) ? kTRUE : kFALSE;
00099   else return (fGeoScintPlnNode) ? kTRUE : kFALSE; }

TVector3 UgliScintPlnHandle::LocalToGlobal ( const TVector3 &  local,
const Bool_t  globalInXYZ = true 
) const [virtual]

Definition at line 238 of file UgliScintPlnHandle.cxx.

References Munits::cm, dummy, fGeoScintPlnNode, fUgliScintPlnNode, DataUtil::GetDetector(), UgliPlnHandle::GetPlexPlaneId(), UgliPlnHandle::IsGeo(), IsValid(), Msg::kWarning, GeoNode::LocalToGlobal(), UgliScintPlnNode::LocalToGlobal(), MSG, and Ugli::xyz2uvz().

Referenced by GeoValidate::TestScintPln_GlobalToLocal(), and GeoValidate::TestScintPln_LocalToGlobal().

00240 { 
00241 
00242   if ( !IsValid() ) {
00243     MSG("Ugli",Msg::kWarning) << "UgliScintPlnHandle::LocalToGlobal "
00244                               << "called for InValid scint pln." << endl;
00245     TVector3 dummy;
00246     return dummy;
00247   }
00248 
00249   // convert a global position into a local (volume) one
00250   // globalInXYZ determines whether result is in XYZ or UVZ
00251   TVector3 globalXYZ;
00252   if ( !IsGeo() ) 
00253       globalXYZ = fUgliScintPlnNode->LocalToGlobal(local);
00254   else { 
00255       TVector3 scaledlocal(local); scaledlocal *= 1./Munits::cm;
00256       globalXYZ = (fGeoScintPlnNode->LocalToGlobal(scaledlocal) *= Munits::cm); 
00257   }
00258 
00259   if (globalInXYZ ) return globalXYZ;
00260   else              return Ugli::xyz2uvz(GetPlexPlaneId().GetDetector(),
00261                                          globalXYZ);
00262 }

Int_t UgliScintPlnHandle::NumberOfStrips (  )  const [inline, virtual]

Implements UgliScintPlnABC.

Definition at line 105 of file UgliScintPlnHandle.h.

References fGeoScintPlnNode, fUgliScintPlnNode, UgliPlnHandle::IsGeo(), GeoScintPlnNode::NumberOfStrips(), and UgliScintPlnNode::NumberOfStrips().

Referenced by GeoValidate::TestScintPln_NumberOfStrips().

00106 { if ( !IsGeo() ) return fUgliScintPlnNode->NumberOfStrips();
00107   else return fGeoScintPlnNode->NumberOfStrips(); }

UgliScintPlnHandle & UgliScintPlnHandle::operator= ( const UgliScintPlnHandle that  ) 

Definition at line 82 of file UgliScintPlnHandle.cxx.

References fGeoScintPlnNode, fUgliScintPlnNode, and UgliPlnHandle::operator=().

00083 {
00084    // assignment keeps reference counts up-to-date
00085    // done by super-class UgliPlnHandle
00086    // don't do it here or we'll get two counts for every handle
00087 
00088    // if (fUgliScintPlnNode) fUgliScintPlnNode->DecrementRef();
00089    // fUgliScintPlnNode = that.fUgliScintPlnNode;
00090    // if (fUgliScintPlnNode) fUgliScintPlnNode->IncrementRef();
00091   
00092    if ( this != &that ) {
00093      UgliPlnHandle::operator=(that);
00094      fUgliScintPlnNode = that.fUgliScintPlnNode;
00095      fGeoScintPlnNode = that.fGeoScintPlnNode;
00096    }
00097    return *this;
00098 }

void UgliScintPlnHandle::RotateRelSteelBy ( Float_t  deltaRadians  )  [inline]

Definition at line 121 of file UgliScintPlnHandle.h.

References GetZRotRelSteelRad(), and SetZRotRelSteelRad().

00122 { SetZRotRelSteelRad(GetZRotRelSteelRad()+deltaRadians); }

void UgliScintPlnHandle::SetXY0RelSteel ( Float_t  x0,
Float_t  y0 
)

Definition at line 204 of file UgliScintPlnHandle.cxx.

References AttemptSet(), Munits::cm, fGeoScintPlnNode, fUgliScintPlnNode, UgliPlnHandle::IsGeo(), and GeoScintPlnNode::SetXY0RelSteel().

Referenced by ShiftXY0RelSteelBy().

00205 {
00206   if (!AttemptSet("XY0RelPln")) return;
00207   if ( !IsGeo() ) fUgliScintPlnNode->SetPosition(x0,y0);
00208   else fGeoScintPlnNode->SetXY0RelSteel(x0/Munits::cm,y0/Munits::cm);
00209   
00210 }

void UgliScintPlnHandle::SetZRotRelSteelRad ( Float_t  radians  ) 

Definition at line 196 of file UgliScintPlnHandle.cxx.

References AttemptSet(), fGeoScintPlnNode, fUgliScintPlnNode, UgliPlnHandle::IsGeo(), GeoScintPlnNode::SetZRotRelSteelRad(), and UgliScintPlnNode::SetZRotRelSteelRad().

Referenced by RotateRelSteelBy().

00197 {
00198   if (!AttemptSet("ZRotRelSteelRad")) return;
00199   if ( !IsGeo() ) fUgliScintPlnNode->SetZRotRelSteelRad(radians);
00200   else fGeoScintPlnNode->SetZRotRelSteelRad(radians);
00201   
00202 }

void UgliScintPlnHandle::ShiftXY0RelSteelBy ( Float_t  dx,
Float_t  dy 
) [inline]

Definition at line 124 of file UgliScintPlnHandle.h.

References Munits::cm, GetX0RelSteel(), GetY0RelSteel(), and SetXY0RelSteel().


Member Data Documentation

GeoScintPlnNode* UgliScintPlnHandle::fGeoScintPlnNode [protected]

Definition at line 84 of file UgliScintPlnHandle.h.

Referenced by GetClosestStrip(), GetScintMdlHandleVector(), GetStripHandle(), GetStripHandleVector(), GetX0RelSteel(), GetY0RelSteel(), GetZRotRelSteelRad(), GlobalToLocal(), IsFrozen(), IsValid(), LocalToGlobal(), NumberOfStrips(), operator=(), SetXY0RelSteel(), and SetZRotRelSteelRad().

UgliScintPlnNode* UgliScintPlnHandle::fUgliScintPlnNode [protected]

Definition at line 83 of file UgliScintPlnHandle.h.

Referenced by GetClosestStrip(), GetScintMdlHandleVector(), GetStripHandle(), GetStripHandleVector(), GetX0RelSteel(), GetY0RelSteel(), GetZRotRelSteelRad(), GlobalToLocal(), IsFrozen(), IsValid(), LocalToGlobal(), NumberOfStrips(), operator=(), SetXY0RelSteel(), and SetZRotRelSteelRad().


The documentation for this class was generated from the following files:
Generated on Wed Sep 10 22:52:16 2014 for loon by  doxygen 1.4.7