GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Setting detector component colors in Geant (4)
Setting detector component colors in Geant (4) [message #10999] Fri, 17 September 2010 14:26 Go to next message
Jochen Schwiening is currently offline  Jochen Schwiening
Messages: 85
Registered: June 2009
Location: GSI, Darmstadt
continuous participant
From: *gsi.de
Dear all,
in my ongoing struggle with Geant in PandaRoot I found that the Barrel DIRC, which was nice and colorful in the event display (using /macro/drc/eventDisplay.C) for a run generated with Geant 3 becomes drab and brownish for a run generated with Geant 4.
Mind you, this is with the identical source code, other than the SetName command in /macro/drc/sim_dirc.C, no recompile in between.
This may seem unimportant but colors are not only useful for publication plots but also for making plots that are easier to understand and to chase down design issues.
How do I control the colors used by Geant 4 vs doing the same in Geant 3 (I may want to change the colors there as well)? How do I manage to get a consistent set of good colors using the eventDisplay and using draw_geom?
Thanks, Jochen
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]);
}
}


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


Current Time: Tue Dec 10 18:01:24 CET 2024

Total time taken to generate the page: 0.00571 seconds