BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
// 
// Simple class that contains the track id, panel id, tof slat id 
// of the global track matching a tof hit in X (matching within
// a certain width defined in BrTofTrackMatchModule)
//
// the information is stored in the fUniqueID by byte
// shifting:
//
// fUniqueID =    tof hit 2 slat 
//             + (tof hit slat << 8)
//             + (panel id     << 16)
//             + (track id     << 24)
//
// here, tof hit 2 slat is H2 hit slat for FFS, H1 hit slat for BFS
//       tof hit slat is H1 hit slat for FFS, H2 hit slat for BFS
//       panel id is 0 for FFS and BFS, tofw panel for MRS (0, 1, ...)
//       track id is Br[FFS,Bfs,MRS]Track::GetId()
//
// in a module using this object, one has only to
// compare the ids returned with the object id:
//
// example:
//
// BrDataTable* ffsTrks = node->GetDataTable("FfsTracks");
// BrDataTable* h1hits  = node->GetDataTable("DigTof TOF1");
// BrDataTable* h2hits  = node->GetDataTable("DigTof TOF2");
// BrDataTable* match   = node->GetDataTable("FFSMatch");
//
// for (Int_t m = 0; m < match->GetEntries(); m++) {
//   BrTofTrackMatch* mtc = (BrTofTrackMatch*)match->At(m);
// 
//   BrFfsTrack* track = 0;
//   BrTofDig*   h1Hit = 0;
//   BrTofDig*   h2Hit = 0;
//
//   for (Int_t t = 0; t < ffsTrks->GetEntries(); t++) {
//     if (((BrFfsTrack*)ffsTrks->At(t))->GetId() != mtc->GetTrackId())
//       continue;
//     track = (BrFfsTrack*)ffsTrks->At(t);
//   }
//
//   for (Int_t h = 0; h < h1hits->GetEntries(); h++) {
//     if (((BrTofDig*)h1hits->At(h))->GetSlatno() != mtc->GetHitId())
//       continue;
//     h1Hit = (BrTofDig*)h1hits->At(t);
//   }
//
//   for (Int_t h = 0; h < h2hits->GetEntries(); h++) {
//     if (((BrTofDig*)h2hits->At(h))->GetSlatno() != mtc->GetHit2Id())
//       continue;
//     h2Hit = (BrTofDig*)h2hits->At(t);
//   }
// }

//____________________________________________________________________
//
// $Id: BrTofTrackMatch.cxx,v 1.3 2001/11/07 10:29:54 ouerdane Exp $
// $Author: ouerdane $
// $Date: 2001/11/07 10:29:54 $
// $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>
//

#ifndef WIN_32
#include <iostream>
#include <iomanip>
#else
#include <iostream.h>
#include <iomanip.h>
#endif

#ifndef BRAT_BrTofTrackMatch
#include "BrTofTrackMatch.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif

//------- base class --------

//____________________________________________________________________
ClassImp(BrTofTrackMatch);

//____________________________________________________________________
 BrTofTrackMatch::BrTofTrackMatch() 
  : TObject()
{
  // initialize the matching id

  UInt_t id = GetUniqueID();
  id = 0xff + (0xff << 8) + (0xff << 16) + (0xff << 24);
  SetUniqueID(id);
}

//____________________________________________________________________
 void BrTofTrackMatch::SetMatching(Int_t trk, Int_t slat, 
				  Int_t pan = 0, Int_t slat2 = 0)
{
  UInt_t id = GetUniqueID();
  id = slat2 + (slat << 8) + (pan << 16) + (trk << 24);
  SetUniqueID(id);
}

//____________________________________________________________________
 Int_t BrTofTrackMatch::GetTrackId() const 
{
  UInt_t id = GetUniqueID();
  return (id >> 24) & 0xff;
}

//____________________________________________________________________
 Int_t BrTofTrackMatch::GetPanelId() const 
{
  UInt_t id = GetUniqueID();
  return (id >> 16) & 0xff;
}

//____________________________________________________________________
 Int_t BrTofTrackMatch::GetTrack2Id() const 
{
  UInt_t id = GetUniqueID();
  return (id >> 16) & 0xff;
}

//____________________________________________________________________
 Int_t BrTofTrackMatch::GetHitId() const 
{
  UInt_t id = GetUniqueID();
  return (id >> 8) & 0xff;
}

//____________________________________________________________________
 Int_t BrTofTrackMatch::GetHit2Id() const
{
  UInt_t id = GetUniqueID();
  return id & 0xff;
}


//____________________________________________________________________
 void BrTofTrackMatch::Print(Option_t* option) const
{
  // prints out track id and tof id
  // Options:
  // M -> mid rapidity
  // F -> FFS
  // B -> BFS  

  TString op(option);
  op.ToUpper();
  
  cout << " ----- Tof-Track Match ----- " << endl;
  cout << "   Track id  : " << GetTrackId() << endl;
  if (op == "M")
    cout << "   TOFW Panel: " << GetPanelId() << endl
	 << "   Slat hit  : " << GetHitId()   << endl;
  if (op == "F")
    cout << "   TOF1 slat : " << GetHitId()  << endl;

  if (op == "B")
    cout << "   TOF2 slat : " << GetHitId()    << endl
	 << "   TOF1 slat : " << GetHit2Id()   << endl
	 << "   FFS Track : " << GetTrack2Id() << endl;
}

//____________________________________________________________________
//
// $Log: BrTofTrackMatch.cxx,v $
// Revision 1.3  2001/11/07 10:29:54  ouerdane
// added method to get FFS track id for BFS-Tof match
//
// Revision 1.2  2001/11/05 06:49:46  ouerdane
// changed FFS to Ffs and so on
//
// Revision 1.1  2001/10/02 01:48:43  ouerdane
// Added new class holding the combination Tof hit-track
//
//





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