GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Analysis » loop over PndMcTracks
loop over PndMcTracks [message #15698] Sat, 09 November 2013 16:07 Go to next message
Yuri Naryshkin is currently offline  Yuri Naryshkin
Messages: 42
Registered: August 2008
continuous participant
From: *desy.de
Hi, I produced sim_complete.root file with sim_complete.C example (using dpm generator) and try to use it for the Lambda analysis. I use example macro ana_Lambda.C, just slightly modofy it (attached). When I try to access MC track information I found out that fMcCands->GetEntriesFast() is equal to zero -> no loop over fMcCands. MCTrack tree is not enmpty. Could you please tell me what is wrong?
  • Attachment: ana_Lambda.C
    (Size: 6.64KB, Downloaded 182 times)
Re: loop over PndMcTracks [message #15699 is a reply to message #15698] Sat, 09 November 2013 19:43 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 2.235.190*
    TClonesArray *fMcCands=new TClonesArray("PndMCTrack");
    t->SetBranchAddress("MCTrack",&fMcCands);


However your code is quite obsolete, I would suggest to check the latest tutorial wiki pages, since the analysis structure has changed.
Re: loop over PndMcTracks [message #15701 is a reply to message #15699] Sun, 10 November 2013 21:00 Go to previous messageGo to next message
Yuri Naryshkin is currently offline  Yuri Naryshkin
Messages: 42
Registered: August 2008
continuous participant
From: *desy.de
Thank you Stefano! Now I use the latest version:
pandaroot/tutorials/apr13/
do simulation full chain with: tut_runall.sh
and analysis with tut_ana.C
I get information about MC track with:

// *** loop over MC track
for (jl=0;jl<mctrk.GetLength();++jl)
{
cout << "all MC tracks " << jl
<< " " << mctrk[jl].PdgCode()
<< " " << mctrk[jl].Px()
<< endl;
}
But when I try to extract mother particle ID and StartX:

<< " " << mctrk[jl].MotherID();
<< " " << mctrk[jl].StartX();

it is the problem. Could you please tell me how I can get this?
Re: loop over PndMcTracks [message #15702 is a reply to message #15701] Sun, 10 November 2013 22:18 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 2.235.190*
What is the problem exactly? Which crash do you have?
Re: loop over PndMcTracks [message #15704 is a reply to message #15702] Mon, 11 November 2013 11:22 Go to previous messageGo to next message
Yuri Naryshkin is currently offline  Yuri Naryshkin
Messages: 42
Registered: August 2008
continuous participant
From: *desy.de
Dear Stefano,
the piece of code is:
//YN
// *** loop over MC track
for (jl=0;jl<mctrk.GetLength();++jl)
{
cout << "all MC tracks " << jl
<< " " << mctrk[jl].PdgCode()
<< " " << mctrk[jl].Px()
<< " " << mctrk[jl]->MotherID();
<< endl;
}
//YN


the error message is:

*************************************************************
initialisation for run id 372981311
*************************************************************
[ERROR ] init() ANAPidSelections not initialized
Error in <FairRuntimeDb::initContainers()>: Error occured during initialization
evt aaa1
[INFO ] The number of entries in chain is 5000
Warning: wrong member access operator '->' tut_ana.C:140:
Error: Can't call TCandidate::MotherID() in current scope tut_ana.C:140:
Possible candidates are...
(in TCandidate)
(in TFitParams)
*** Interpreter error recovered ***
all MC tracks 0 211 -0.0498608 root [1]
Re: loop over PndMcTracks [message #15705 is a reply to message #15704] Mon, 11 November 2013 12:29 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
It is ->GetMcMotherIdx().
For the startX I believe you should use ->Origin().Dead).
Re: loop over PndMcTracks [message #15707 is a reply to message #15705] Mon, 11 November 2013 16:48 Go to previous messageGo to next message
Yuri Naryshkin is currently offline  Yuri Naryshkin
Messages: 42
Registered: August 2008
continuous participant
From: *desy.de
Thank you very much Stefano! Working Smile
I also would like to extract FtofPoint information in the same loop
over event (of course, loop over FtofPoints is defferent)

theAnalysis->FillList(ftof, "FtofPoint");

I've got an error message:

Error in <FillList>: Unknown list key: FtofPoint

Should I add some more classes or add something else?
Re: loop over PndMcTracks [message #15732 is a reply to message #15707] Fri, 15 November 2013 16:39 Go to previous message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
Hi, PndAnalysis is written as framework to perform physics analysis (invariant mass distributions, fitters,etc...) and not for detector studies. The only think you can do there is, from the charged candidate, retrieve the Tof Index and from the index recover the FtofHit.

I can suggest you to take a look into the macro macro/pid/track_check.C.
This macro loops over MCTrack, select only primary particles (GetMotherID()==-1), and for each mctrack it find the pid candidate correlated to such track. This is a basic scheme, but if you substitute the names with ftof classes you can do whatever you want. Also the macro pid_check.c could help you to understand the mechanism (I am not tousching them since a while then maybe they could crash, but all the basics are inside).
Previous Topic: [FIXED] use MC particle hypothesis in PndRecoKalmanTask
Next Topic: PndKinFitter Mass constraints and resolution
Goto Forum:
  


Current Time: Sat Dec 04 08:21:50 CET 2021

Total time taken to generate the page: 0.02134 seconds