GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Setting detector component colors in Geant (4)
Re: Setting detector component colors in Geant (4) [message #11000 is a reply to message #10999] Fri, 17 September 2010 15:05 Go to previous message
asanchez is currently offline  asanchez
Messages: 350
Registered: March 2006
first-grade participant
From: *kph.uni-mainz.de
Dear Johen, ere you are the script I'm using to put
colors to my detectors using geant4.

You only have to take a look into.

best regards
ALicia.

eventDisplay()
{
// Load basic libraries
gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
rootlogon();
gSystem->Load("libEve");
gSystem->Load("libEventDisplay");
gSystem->Load("libHypGe");
gSystem->Load("librazhyp");
gSystem->Load("libHyp");
gSystem->Load("libTof");

// ----- Reconstruction run -------------------------------------------
FairRunAna *fRun= new FairRunAna();
//fRun->SetInputFile("points.x3872.jpsipipi.phsp.root");
// fRun->SetInputFile("../qa/lhetrack/points_tpccombi.root");
fRun->SetInputFile("/d/pndint02/asanchez/FOct09/sim_hypFSG41TCIPAxxbG.root ");/
/sim_with_vis.root");
// fRun->SetInputFile("../drc/testrun1.root");
// fRun->SetInputFile("../dsk/sim_dsk.g4native.root");
fRun->SetOutputFile("tst.root");
// fRun->LoadGeometry();



FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
FairParRootFileIo* parInput1 = new FairParRootFileIo();
// parInput1->open("../drc/testparams.root");
parInput1->open("../hyp/SimG41TCIPAxxbGparams.root");//params_with_vis.root ");

rtdb->setFirstInput(parInput1);


FairEventManager *fMan= new FairEventManager();
FairMCTracks *Track = new FairMCTracks ("Monte-Carlo Tracks");
// FairMCPointDraw *MvdPoints = new FairMCPointDraw ("MVDPoint",kBlue, kFul
lSquare);
// FairMCPointDraw *EMCPoints = new FairMCPointDraw ("EmcPoint",kOrange, kF
ullSquare);
FairMCPointDraw *TofPoint = new FairMCPointDraw ("TofPoint",kYellow, kFull
Square);
FairMCPointDraw *TofSciFPoint= new FairMCPointDraw ("TofSciFPoint",kTeal, kFul
lSquare);
FairMCPointDraw *MuoPoint = new FairMCPointDraw ("HypPoint",kAzure, kFullSq
uare);
// FairMCPointDraw *PndDrcPoint = new FairMCPointDraw ("PndDrcPoint",kViolet,
kFullSquare);
// FairMCPointDraw *PndDchPoint = new FairMCPointDraw ("PndDchPoint",kPink, kF
ullSquare);
FairMCPointDraw *PndTpcPoint = new FairMCPointDraw ("PndTpcPoint",kCyan, kFul
lSquare);
// FairMCPointDraw *PndSTTPoint = new FairMCPointDraw ("STTPoint",kMagenta, kFu
llSquare);


fMan->AddTask(Track);

// fMan->AddTask(MvdPoints);
// fMan->AddTask(EMCPoints);
fMan->AddTask(TofPoint);
fMan->AddTask( TofSciFPoint);
fMan->AddTask( MuoPoint);
// fMan->AddTask( PndDrcPoint);
// fMan->AddTask( PndDchPoint);
fMan->AddTask( PndTpcPoint);
// fMan->AddTask( PndSTTPoint);


fMan->Init();
char str[80];
char str1[80];
char str2[80];
char str3[80];

TGeoNode* trk;
TGeoNode* trl;
TGeoNode* trab;
TGeoNode* trsi;

std::cout<<" gGeoM "<<gGeoManager<<std::endl;
int k;

TGeoVolume* top = gGeoManager->GetTopVolume();
for(int i=0;i<4;i++)
{


sprintf(str,"stg0%d_1",i+1);
std::cout<<" name "<<str<<std::endl;

TGeoNode* trk = top->FindNode(str);
cout<<" tr "<<trk<<endl;

for(int j=0;j<20;j++){
if(i==0) k = j;
if(i==1) k = j+20;
if(i==2) k = j+40;
if(i==3) k = j+60;

sprintf(str1,"stglay%d_1",k);
TGeoNode* trl = trk->GetVolume()->FindNode(str1);
//cout<<" trl "<<trl<<" name "<<str1<<endl;


sprintf(str2,"stglAb%d_1",k);
TGeoNode* tra = trl->GetVolume()->FindNode(str2);
//cout<<" tra "<<tra<< " same "<<str2<<endl;
tra->GetVolume()->SetLineColor(kYellow);
sprintf(str3,"stglSi%d_1",k);
TGeoNode* trs = trl->GetVolume()->FindNode(str3);
//cout<<" tra "<<tra<< " same "<<str2<<endl;
trs->GetVolume()->SetLineColor(kMagenta);
//fMan->AddGlobalElement(tra[k]);
}
}


}
 
Read Message
Read Message
Previous Topic: Cherenkov photons generation (FairBoxGenerator) updated!
Next Topic: export PANDA geometry
Goto Forum:
  


Current Time: Sun Nov 03 06:55:34 CET 2024

Total time taken to generate the page: 0.00801 seconds