Main Page | Class List | File List | Class Members | Related Pages

EEmcTTDisplay Class Reference

EEmc Tower and Track Display class. More...

List of all members.

Public Member Functions

 EEmcTTDisplay (const char *name="eemc")
 ~EEmcTTDisplay ()
 the destructor

TGeoVolume * operator() ()
 returns top EEMC TGeoVolume

TGeoVolume * GetVolume ()
 returns top TGeoVolume

Bool_t AddTower (const char *tile)
Bool_t AddTower (int sec, int sub, int eta)
Bool_t AddTower (const EEmcTower &tower)
Bool_t AddTrack (Double_t x, Double_t y, Double_t z, Double_t px, Double_t py, Double_t pz, Double_t qB, Double_t zMin=0.0, Double_t zMax=0.0)
Bool_t AddTrack (const StMuTrack &track)
Bool_t AddMatch (EEmcTTMatch &tmatch)
void Draw (const Option_t *option="")
void Clear (const Option_t *option="")
void Out (ostream &out, EEmcTTMatch &tmatch)
void Out (TString &out, EEmcTTMatch &tmatch)
void SetMagneticField (double B)
double GetMagneticField ()
 returns STAR magnetic fiels in Tesla

void SetShowExtrapolatedTracks (bool f)
bool GetShowExtrapolatedTracks ()


Detailed Description

EEmc Tower and Track Display class.

This is a simple root TGeoXXXX based class. It displays EEMC tower geometry (the class inherits from EEmcGeomSimple) and allows for "turning on/off" individual towers as well as it displays muDST tracks (StMuTrack).

Author:
Piotr A. Zolnierczuk
Date
2004/05/06 16:02:48
Revision
1.10

Short example how to use EEmcTTDisplay

for details consult StRoot/StEEmcPool/macros/TTM/show.C
// example macro to use  EEmcTTMMaker
// Author: Piotr A. Zolnierczuk
class TGeoNode;
class TGeoVolume;

class StPhysicalHelixD;
class StThreeVectorD;

class StChain;
class StMuTrack;
class StMuDstMaker;
class StEventInfo;
class StEventSummary;


class EEmcTower;
class EEmcTTDisplay;
class EEmcTTMMaker;


StChain       *chain=0;
EEmcTTMMaker  *ttm  =0;
StMuDstMaker  *muDstMk   = 0;
EEmcTTDisplay *eemc      = 0;
TPaveText     *eventInfo = 0;
TPaveLabel    *dateInfo  = 0;
TDatime       *now       = 0;

void      printNodeTree(TObjArray *nodeList, Int_t level=0);
TGeoNode *findNode     (TObjArray *nodeList,const char *name);


void
show
(
 char* inpDir  = "",         // MuDST directory
 char* inpFile = "show.lis", // MuDST file(s);                      
 char* outFile = "show.root",// output tree file
 Int_t nFiles  = 50,         // # of MuDST file(s)
 Int_t nEvents = 100         // # of events
 )
  // remeber to adjust dbase timestamp below !!!! 
  // what a ... design
{ 
  //gErrorIgnoreLevel=1999;

  // load root/root4star libraries
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  // load more libraries :)
  gSystem->Load("libmysqlclient");
  gSystem->Load("libGeom");
  gSystem->Load("StDbLib");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");

  // load even more libraries (EEMC stuff) 
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StEEmcPoolTTM");

  // create the chain    
  chain = new StChain("StChain"); 
  //

  now = new TDatime;
  // for display
  TCanvas    *c1   = new TCanvas("eemc","eemc",10,10,1000,1000);
  TPaveLabel *tlab = new TPaveLabel(-0.99,+0.99,+0.99,+0.90,
                                    "EEMC TOWERS & TPC TRACKS     Piotr A Zolnierczuk (IU)");

  eventInfo = new TPaveText (-0.99,-0.99,+0.0 ,-0.75);
  dateInfo  = new TPaveLabel(+0.60,-0.99,+0.99,-0.95,now->AsString());

  TGeoManager  *gm    = new TGeoManager("eemc", "eemc tower display");
  TGeoVolume   *top   = gm->MakeBox("star",0, 200., 200., 350.);
  TGeoVolume   *smbox = gm->MakeBox("smbox1",0, 2., 2., 2.);
  smbox->SetLineColor(kRed);
  // eemc 
  eemc  = new EEmcTTDisplay();
  eemc->SetMagneticField(0.5); // in Tesla
  eemc->SetShowExtrapolatedTracks(true);
 
  TGeoTranslation *etra = new TGeoTranslation(0.0,0.0,0.5*(eemc->getZ1()+eemc->getZ2()));
  top->AddNode(smbox, 1,NULL);
  top->AddNode(eemc(),1,etra);
  gm->SetTopVolume(top);
  gm->CloseGeometry();
  gm->SetVisLevel(4);
  gm->SetVisOption(0);

  c1->SetTheta(90);
  c1->SetPhi(0);

  top->Draw();
  tlab->Draw();

  gPad->Update();
  
  // now we add Makers to the chain...  some of that is black magic :) 
  muDstMk  = new StMuDstMaker(0,0,inpDir,inpFile,"",nFiles);       // muDST main chain
  StMuDbReader  *db       = StMuDbReader::instance();              // need the database
  StEEmcDbMaker *eemcDbMk =new StEEmcDbMaker("eemcDb");                     // need EEMC database  
  St_db_Maker   *dbMk        = new St_db_Maker("StarDb", "MySQL:StarDb");   // need another db(?) 

  // now comment in/out/change the below if you want it your way
  eemcDbMk->setSectors(1,12);            // request EEMC DB for sectors you need (dafault:1-12)
  eemcDbMk->setTimeStampDay(20040331);   // format: yyyymmdd
  eemcDbMk->setPreferedFlavor("onlped","eemcPMTped"); // request alternative flavor

  // finally after so many lines we arrive at the good stuff

  ttm = new  EEmcTTMMaker ("TTM",muDstMk,eemcDbMk);
  ttm->Summary(cout);    // 

  StMuDebug::setLevel(0);

  chain->Init();
  chain->ls(3);

  //---------------------------------------------------
  next();
}



void 
next(int nMatch=1)
{
  char buffer[1024];
  int  stat=0;
  int  match=0;
  while(match<nMatch) {
    stat=chain->Make();
    if( stat==2 || stat==4) break;
    if( stat!=0 ) continue;

    TList       *matchList = ttm->GetMatchList();
    if(matchList->IsEmpty()) continue;
    TIter  nextMatch(matchList);

    match++;
    
    StEventInfo    &evinfo = muDstMk->muDst()->event()->eventInfo();   // event info
    StEventSummary &evsumm = muDstMk->muDst()->event()->eventSummary();// event summary
    sprintf(buffer,"Run #%d Event #%d\n",evinfo.runId(),evinfo.id());
    eventInfo->Clear();
    eventInfo->SetTextAlign(12);
    eventInfo->AddText(buffer);

    eemc->Clear();
    cerr << "<Event";
    cerr << "Run=\""  << evinfo.runId() << "\"\t";
    cerr << "Event=\""<< evinfo.id()    << "\">\n";

    EEmcTTMatch *tmatch;
    while ((tmatch = (EEmcTTMatch *) nextMatch())) {
      TString outs;
      eemc->AddMatch(*tmatch);
      eemc->Out(cerr,*tmatch);
      eemc->Out(outs,*tmatch);
      eventInfo->AddText(outs);
    }
    cerr << "</Event>" << endl;

    now->Set();
    dateInfo->SetLabel(now->AsString());

    eemc->Draw();
    eventInfo->Draw();
    dateInfo->Draw();
    gPad->Update();

  }
  ttm->Summary(cerr);
}







void printNodeTree(TObjArray *nodeList, Int_t level) 
{
  TIter nextNode(nodeList);
  TGeoNode *node;
  while( (node=(TGeoNode *)nextNode())!=NULL ) {
    for(int k=0;k<level;k++) cerr << "\t";
    cerr << node->GetVolume()->GetName() << endl;
    printNodeTree(node->GetNodes(),level+1);
  }
}



TGeoNode *
findNode(TObjArray *nodeList,const char *name)
{
  TIter nextNode(nodeList);
  TGeoNode *node;
  while( (node=(TGeoNode *)nextNode())!=NULL ) {
    if(strcmp(node->GetVolume()->GetName(),name)==0)     return node;
    if( (node=findNode(node->GetNodes(),name))!= NULL ) return node;
  }
  return NULL;
}

snapshot.jpg

Sample snapshot

Remarks

Todo:
[medium] private member volumeName is not best implemented

[minor] speed of light redefined (should be taken from StarClassLibrary)

Bug:
the class requires an explitic set of magnetic field via SetMagneticField


Constructor & Destructor Documentation

EEmcTTDisplay::EEmcTTDisplay const char *  name = "eemc"  ) 
 

the constructor

Parameters:
name the top EEMC volume (TGeoVolume) label


Member Function Documentation

Bool_t EEmcTTDisplay::AddMatch EEmcTTMatch tmatch  ) 
 

adds a tower with matched tracks to the list of displayed tower/tracks

Parameters:
tmatch a refence to EEmcTTMatchp
Returns:
kTRUE on success and kFALSE on failure

Bool_t EEmcTTDisplay::AddTower const EEmcTower tower  ) 
 

adds a tower to the list of displayed towers

Parameters:
tower a reference to EEmcTower
Returns:
kTRUE on success and kFALSE on failure

Bool_t EEmcTTDisplay::AddTower int  sec,
int  sub,
int  eta
[inline]
 

adds tower to the list

Parameters:
sec sector index [0,mNumSec)
sub subsector index [0,mNumSSec)
eta eta index [0,mNumEta)
Returns:
kTRUE on success and kFALSE on failure

Bool_t EEmcTTDisplay::AddTower const char *  tile  ) 
 

adds a tower to the list of displayed towers

Parameters:
tile name (in the form of 05TC11)
Returns:
kTRUE on success and kFALSE on failure

Bool_t EEmcTTDisplay::AddTrack const StMuTrack &  track  ) 
 

adds a track to the list of displayed tracks

Parameters:
track a refence to StMuTrack
Returns:
kTRUE on success and kFALSE on failure

Bool_t EEmcTTDisplay::AddTrack Double_t  x,
Double_t  y,
Double_t  z,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t  qB,
Double_t  zMin = 0.0,
Double_t  zMax = 0.0
 

adds a track to the list of displayed tracks

Parameters:
x x-component of the track origin
y y-component of the track origin
z z-component of the track origin
px x-component of the track momentum
py y-component of the track momentum
pz z-component of the track momentum
qB sign sensitive product of the particle charge and magnetic field
zMin to BE DOCUMENTED
zMax to BE DOCUMENTED
Returns:
kTRUE on success and kFALSE on failure

void EEmcTTDisplay::Clear const Option_t *  option = ""  ) 
 

clears tower/track lists

Parameters:
option - not uset at the moment

void EEmcTTDisplay::Draw const Option_t *  option = ""  ) 
 

draws towers/tracks

Parameters:
option - not uset at the moment

bool EEmcTTDisplay::GetShowExtrapolatedTracks  )  [inline]
 

gets a flag that controls how TPC trackcs are displayed, if f is true - tracks are plotted from vertex to endcap if f is false - tracks are plotted from first to last point in the track

Returns:
true or false

void EEmcTTDisplay::Out TString &  out,
EEmcTTMatch tmatch
 

prints EEmcTTMatch information to a TString

Parameters:
out a reference to TString
tmatch a reference to struct EEmcTTMatch

void EEmcTTDisplay::Out ostream &  out,
EEmcTTMatch tmatch
 

prints EEmcTTMatch information to an ostream

Parameters:
out a reference to std::ostream
tmatch a reference to struct EEmcTTMatch

void EEmcTTDisplay::SetMagneticField double  B  )  [inline]
 

sets STAR magnetic field

Parameters:
B magnetic field (sign sensitive) in Tesla

void EEmcTTDisplay::SetShowExtrapolatedTracks bool  f  )  [inline]
 

sets a flag that controls how TPC trackcs are displayed, if f is true - tracks are plotted from vertex to endcap if f is false - tracks are plotted from first to last point in the track

Parameters:
f flag true/false


Generated on Thu Jun 3 17:02:37 2004 for Tower to Track Match Maker by doxygen 1.3.5