GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » MCTrack
MCTrack [message #5410] Thu, 15 November 2007 12:47 Go to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi!

I somehow stumbling always about the same problems... my question is, where and when the MCTrack array is created and filled, so that I can access that from a task.
What I'd like to do is to access the MCTrack array of a simulated event, without running a transport code. My simple idea would be to init an arbitrary event generator, which produces the tracks and somehow stores these primaries.
A code snippet form my macro looks like:
.
.
.

CbmRunSim *fRun = new CbmRunSim();

fRun->SetOutputFile("fastsim.root");

CbmPrimaryGenerator* primGen = new CbmPrimaryGenerator();
fRun->SetGenerator(primGen);

CbmEvtGenGenerator* evtGen = new CbmEvtGenGenerator("output.evt");
primGen->AddGenerator(evtGen);

primGen->DoTracking(kFALSE);


CbmFastSim* fastSim = new CbmFastSim();
fRun->AddTask(fastSim);

.
.
.

but in my task CbmFastSim MCTrack is not accessible, I get the message

-E- CbmRootManager Branch: MCTrack not found in Tree
-W- CbmFastSim::Init: No MCStack array!

Most likely this is no big deal to solve. Somebody has a hint for me?

Cheers,
Klaus
Re: MCTrack [message #5411 is a reply to message #5410] Thu, 15 November 2007 13:20 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi klaus,

The MCTrack is filled when finishing an event (in your case
after filling the Stack). but your task is trying to access the
MCTrack in the initialization phase of a simulation session
(CbmRunSim!). So either you do this in two steps:

1. in your macro, remove the CbmFastSim and run it. It will
produce an output file(fastsim.root)
In fact, here you just copy the information from your event
generator format to a format similar to the full simulation
(There is not transport at all here)
2. create a new macro (Analysis macro, ie: CbmRunAna), set
input file (output of step 1), add
your task , and you will see the MCTrack and can use them


Or:

if you want to do it in one step, you have to use Stack, instead of MCTrack:
CbmStack *fStack= gMC->GetStack();
and from CbmStack you have access to all info on the fly
before they are filtered(if?) and written out as an array of
MCTracks


regards
Mohammad


Re: MCTrack [message #5412 is a reply to message #5411] Thu, 15 November 2007 13:57 Go to previous messageGo to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi Mohammad!

Thanks for your reply! The first method I just discussed with Dipak some minutes ago. I'd like to try the second option as well, but I don't know where this gMC comes from. I already tried to grep over all source code without finding out what to include to have access to it. There are thousand matches where gMC is accessed, but none where it is initialized ...

Regards,
Klaus
Re: MCTrack [message #5413 is a reply to message #5412] Thu, 15 November 2007 14:24 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *physik.uni-giessen.de
Hi,
gMC is a global variable which is defined by root/vmc, not by PandaRoot but somewhere "higher" (such as gStyle gROOT and similar) in TVirtualMC.h, and it is of a TVirtualMC type (of course)

I don't know if these informations can be of help.

[Updated on: Thu, 15 November 2007 14:31]

Report message to a moderator

Re: MCTrack [message #5414 is a reply to message #5413] Thu, 15 November 2007 15:10 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

gMC is the global pointer to TGean3/TGeant4. it is created when ever you start a simulation session. As Stefano wrote it is of type TVirtualMC which is the base class for Tgeant3 and TGeant4.

Is it not initialized or what is going wrong?

Mohammad
Re: MCTrack [message #5415 is a reply to message #5414] Thu, 15 November 2007 15:17 Go to previous messageGo to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi!

No, I just had to include "TVirtualMC.h", that was the problem. In principle it's working fine now!

But maybe I could ask another (more general) question. I'm trying to port some of the classes from the FastSim in the other framework to that directory (for instance FsmTrack, FsmResponse etc.) So I simply copied over FsmTrack.cc and FsmTrack.hh.
The compiling and linking works, but in runtime, I get at the first point I try to use the FsmTrack the error

/misc/cbmsoft/Debian3.1/new/tools/root/bin/root.exe: relocation error: /u/kgoetzen/work/fairroot3/build/lib/libfastsim.so: undefined symbol: _ZN8FsmTrackC1Ev

Probably I have to add the class somewhere in a config/linkdef/Makefile?

Regards,
Klaus

PS: Yees, I know.... simple C++/C basics Wink
Re: MCTrack [message #5416 is a reply to message #5415] Thu, 15 November 2007 15:25 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

In this new classes do you have ClassDef and ClassImp macros?

you have also to add these classes to the XXXLinkDef.h file in your directory.

Mohammad
Re: MCTrack [message #5417 is a reply to message #5415] Thu, 15 November 2007 15:27 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *physik.uni-giessen.de
You forgot to add FsmTrack.cc in CMakeLists.txt, maybe this is the problem. And I cannot see your fastsim in the main Makefile.am.

In each case I remember you that all the classes should be named PndXXX Smile
Bye

Ste

[Updated on: Thu, 15 November 2007 15:29]

Report message to a moderator

Re: MCTrack [message #5418 is a reply to message #5417] Thu, 15 November 2007 15:47 Go to previous message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi Mohammad and Stefano!

Thanks a lot, now everything basically works as I wanted!

Best regards,
Klaus
Previous Topic: Drc Flow Diagram
Next Topic: stt alligned to PandaRoot nomenclature
Goto Forum:
  


Current Time: Fri Apr 19 18:03:24 CEST 2024

Total time taken to generate the page: 0.01115 seconds