GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » EMC » MC Truth propagation with FairLinks in timebased sim
MC Truth propagation with FairLinks in timebased sim [message #18993] Fri, 05 February 2016 17:59 Go to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Dear all,

I'm experiencing trouble with the MC propagation in the timebased simulation. Already at the digitisation stage, the link propagation appears to be broken. The digitisation macro returns
"-E- FairMultiLinkedData_Interface::AddInterfaceData EntryNr == (-1/-1/-1/-1/1)" for each hit.
SetUseFairLinks is set to true in all macros. As fas as I can grasp together from the code, this is the way the links are propagated:

PndEmcHitProducer: MCTrack->EmcHit:
PndEmcPoint* point  = (PndEmcPoint*) fPointArray->At(iPoint);
DetId = point->GetDetectorID();

if (point->GetEntering()){
	fTrackEntering[DetId].AddLinks(point->GetLinksWithType(FairRootManager::Instance()->GetBranchId("MCTrack")));
}
if (point->GetExiting()){
	fTrackExiting[DetId].AddLinks(point->GetLinksWithType(FairRootManager::Instance()->GetBranchId("MCTrack")));


PndEmcFWEndcapTimebasedWaveforms: EmcHit->EmcWaveform:
FairLink linkToHit(-1, ioman->GetEntryNr(), "EmcHit", iHit, 1.0);
wfData.AddHit(linkToHit, ioman->GetEventTime() + theHit->GetTime()*1.0e9, theHit->GetEnergy());


PndEmcFWEndcapDigi: EmcWaveform->EmcDigi:
myDigi->AddLink(FairLink("EmcWaveform", iWaveform));


PndEmcMakeClusterOnline: EmcDigi->EmcCluster:
cluster->addDigi(fDigiArray,myDigi); 
cluster->AddLink(FairLink("EmcDigi", myDigi));


Can anyone see where it goes wrong, and maybe even if there is a simple fix for this? It would be preferable to have the ability to use the MC information.
Re: MC Truth propagation with FairLinks in timebased sim [message #18994 is a reply to message #18993] Sat, 06 February 2016 02:41 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 106.2.197*
Which FairSoft/FairRoot/PandaRoot versions are you using?
Re: MC Truth propagation with FairLinks in timebased sim [message #18995 is a reply to message #18994] Mon, 08 February 2016 10:23 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
For FairSoft and FairRoot I have the versions from the mar15 release. PandaRoot is at revision 28807
Re: MC Truth propagation with FairLinks in timebased sim [message #18996 is a reply to message #18995] Mon, 08 February 2016 11:21 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 106.2.197*
Hi,
for FairRoot you should use v15.11, where several fixes n FairLink were included. Can you please try and let us know?
Re: MC Truth propagation with FairLinks in timebased sim [message #18997 is a reply to message #18996] Mon, 08 February 2016 13:57 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Okay... How do you update FairROOT? I can't seem to find instructions for that anywhere. Only on how to install it. Is there a GIT equivalent of "svn update"?
Re: MC Truth propagation with FairLinks in timebased sim [message #18998 is a reply to message #18997] Mon, 08 February 2016 15:18 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 106.2.197*
I think it is better to have a separate installation in different folders.
Re: MC Truth propagation with FairLinks in timebased sim [message #19025 is a reply to message #18998] Thu, 11 February 2016 14:21 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
All right, after some wrestling, I installed the new FairRoot release, this time with ROOT 5, as ROOT 6 wasn't really working out for me. However, I still get the same warning from the timebased digitisation macro:
-E- FairMultiLinkedData_Interface::AddInterfaceData EntryNr == (-1/-1/-1/-1/1)

I first reran the simulation macro as well to be sure everything was done using the new FairRoot.
Re: MC Truth propagation with FairLinks in timebased sim [message #19027 is a reply to message #19025] Thu, 11 February 2016 16:08 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 106.2.197*
In theory with FairSoft mar15 there is no root6. Are you sure you are using the correct stuff?
Re: MC Truth propagation with FairLinks in timebased sim [message #19028 is a reply to message #19027] Thu, 11 February 2016 16:29 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
I'm pretty sure I have the new FairRoot, as some functions have be changed (SetInputFile has moved to FairFileSource, SetEventMeanTime to FairSource [I think]).

I now see why I was offered the choice for ROOT 6 (which also started my other thread on the compilation errors); I was using the instructions from the Step-by-step installation on https://github.com/FairRootGroup/FairRoot, which tells you to use

git clone -b dev https://github.com/FairRootGroup/FairSoft.git,

which I guess downloads a development version of FairSoft. But in my recent install, I followed the instructions on the Wiki.
Re: MC Truth propagation with FairLinks in timebased sim [message #19029 is a reply to message #19028] Thu, 11 February 2016 16:33 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 106.2.197*
Please use the pandaroot wiki installation, I am not able to follow random versions. In particular of the FairSoft dev.

https://panda-wiki.gsi.de/foswiki/bin/view/Computing/PandaRootInstallGit

How to reproduce your problem? Please send the macro.
Re: MC Truth propagation with FairLinks in timebased sim [message #19030 is a reply to message #19029] Thu, 11 February 2016 16:45 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
I'm using the attached macros for the simulation and digitisation, which are based on sim_complete.C and digi_complete.C in /macro/run/
Maybe you also need the par file.
Re: MC Truth propagation with FairLinks in timebased sim [message #19031 is a reply to message #19025] Thu, 11 February 2016 18:04 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 106.2.197*
This is what I get with 1000 events:

Toggle Spoiler


What do all these messages mean? What is the error here?
Re: MC Truth propagation with FairLinks in timebased sim [message #19034 is a reply to message #19031] Fri, 12 February 2016 17:26 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
I found why it wasn't fixed. I made some changes to some of the base classes (EmcDigi and EmcCluster), and then got too enthousiastic with copying stuff from my previous pandaroot install. I needed the new versions of PndEmcWaveformBuffer.cxx, PndEmcFWEndcapTimebasedWaveforms.cxx, PndEmcFWEndcapDigi.cxx, and PndEmcFullStackedWaveformSimulator.cxx

But for some reason, root creates unreadable root files now. When I click a leaf in the digi file root tree, nothing happens, though tree->GetEntries() tells me there are 100 entries (I ran with 100 events just to test)... Does anyone know what could cause this to happen?
Re: MC Truth propagation with FairLinks in timebased sim [message #19035 is a reply to message #19034] Sat, 13 February 2016 23:34 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 93.49.201*
Maybe there is some condition which is skipping the add of the new elements into the TClonesArray. Do you have only emc TCAs empty, or even for the other detectors? Is the EventHeader empty? In any case, I would suggest to put some cout and check all the conditions.
Re: MC Truth propagation with FairLinks in timebased sim [message #19087 is a reply to message #19035] Fri, 26 February 2016 13:53 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
I tried tracing the problem, but I still don't understand what's causing it. As far as I can see, this is where it goes wrong:
PndEmcFWEndcapTimebasedWaveforms puts EmcWaveforms somewhere using FairWriteoutBuffer, but for some reason the next step, PndEmcFWEndcapDigi, has zero entries in its input waveform array.
Hits are converted to waveforms using
(Init)
...
// Create and activiate output Buffer....choose between PndEmcWaveform and PndEmcMultiWaveform
#ifndef MULTI
    fWaveformBuffer = new PndEmcWaveformBuffer("EmcWaveform", "PndEmcWaveform", "Emc", fStoreWaves);	
#else
    fWaveformBuffer = new PndEmcWaveformBuffer("EmcWaveform", "PndEmcMultiWaveform", "Emc", fStoreWaves);	
#endif

    fWaveformBuffer = (PndEmcWaveformBuffer*) ioman ->RegisterWriteoutBuffer("EmcTimebasedWaveform", fWaveformBuffer);
...etc

(Exec)
...
// construct corresponding waveform data Object
PndEmcWaveformData wfData(theHit->GetDetectorID(),  wfSimulator);

//register hit...timebased framework uses ns, whereas emc deals with seconds as time unit
FairLink linkToHit(-1, ioman->GetEntryNr(), "EmcHit", iHit, 1.0);
wfData.AddHit(linkToHit, ioman->GetEventTime() + theHit->GetTime()*1.0e9, theHit->GetEnergy());

fWaveformBuffer->FillNewData(&wfData);	
...etc

, and it looks like the buffer is written out only at the end. The next task tries to make digis out of them using
(Init)
...
// Get input array
fWaveformArray = (TClonesArray*) ioman->GetObject("EmcMultiWaveform");
    if (!fWaveformArray) {
    //check if EmcWaveform contains MultiWaveforms
    fWaveformArray = (TClonesArray*) ioman->GetObject("EmcWaveform");
    if((!fWaveformArray) || (!fWaveformArray->GetClass()->InheritsFrom("PndEmcMultiWaveform"))){
    cout << "-W- PndEmcFWEndcapDigi::Init: "
    << "No PndEmcWaveform array containing multi waveforms!" << endl;
    return kERROR;
    }

}
// Create and register output array
fDigiArray = ioman->Register("EmcDigi","PndEmcDigi", "Emc", fStoreDigis);
...etc

, but then fWaveformArray->GetEntriesFast() yields zero in the Exec part.

Also, the macros in /macro/run/ return a segmentation violation from PndFileNameCreator:
===========================================================
#5 0x00007f74fe344850 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007f74ec5c6ce3 in PndFileNameCreator::GetPath (this=0x7ffeea9a6c70) at /home/marcel/jan16/pandaroot/PndTools/generalTools/PndFileNameCreator.cx x:188
#7 0x00007f74ec5c70a0 in PndFileNameCreator::TruncateFileName (this=0x7ffeea9a6c70, cut=false) at /home/marcel/jan16/pandaroot/PndTools/generalTools/PndFileNameCreator.cx x:212
#8 0x00007f74ec5c6910 in PndFileNameCreator::GetCustomFileName (this=0x7ffeea9a6c70, ext="par", addon="", cut=false) at /home/marcel/jan16/pandaroot/PndTools/generalTools/PndFileNameCreator.cx x:147
#9 0x00007f74ec5c6121 in PndFileNameCreator::GetParFileName (this=0x7ffeea9a6c70, addon="", cut=false) at /home/marcel/jan16/pandaroot/PndTools/generalTools/PndFileNameCreator.cx x:28
#10 0x00007f74e4c30d53 in PndMasterRunSim::Setup (this=0x26529b0) at /home/marcel/jan16/pandaroot/PndTools/master/PndMasterRunSim.cxx:64
===========================================================
Re: MC Truth propagation with FairLinks in timebased sim [message #19092 is a reply to message #19087] Fri, 26 February 2016 18:31 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
About macros, if you update the folder you will have the correct macros. There was a wrong commit few weeks ago.
Re: MC Truth propagation with FairLinks in timebased sim [message #19122 is a reply to message #19092] Tue, 08 March 2016 12:04 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Yes, the default macros are working now.

In another attempt to fix my problems, which you apperantly don't have, I performed svn update and tried to recompile pandaroot completely. It finishes with the following:
[100%] Generating ../lib/libCATracking.rootmap
cannot open linkdef file CATrackingLinkDef.h
[100%] Built target libCATracking.rootmap

Then, when I try to run the root macros, root gives the following error:
dlopen error: /home/marcel/jan16/pandaroot/buildPanda/lib/libEmc.so: undefined symbol: _ZN20PndEmcCRRCPulseshape11ShowMembersER16TMemberInspector
Load Error: Failed to load Dynamic link library /home/marcel/jan16/pandaroot/buildPanda/lib/libEmc.so

So, some automatically generated symbol is not defined, apparently in an inherited function in PndEmcCRRCPulseshape. I think I've seen this error before, but don't know how to fix it. Any suggestions?
Re: MC Truth propagation with FairLinks in timebased sim [message #19123 is a reply to message #19122] Tue, 08 March 2016 12:10 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
EMC package has been updated. Are you sure you are using the most recent version? Because the problem you are describing was already fixed few versions ago, check the following link:

https://subversion.gsi.de/trac/fairroot/changeset?reponame=&new=2893 4%40pandaroot%2Ftrunk%2Femc&old=28851%40pandaroot%2Ftrunk%2Femc
Re: MC Truth propagation with FairLinks in timebased sim [message #19124 is a reply to message #19123] Tue, 08 March 2016 13:00 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Ah yes, the EmcLinkDef was not updated; I used my own version because I'm adding a few new classes. Now that I added that one to it as well, it works. I feel a bit emberassed that it was again due to something silly that I did myself... Oh well.
Re: MC Truth propagation with FairLinks in timebased sim [message #19125 is a reply to message #19124] Tue, 08 March 2016 17:22 Go to previous message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
But, what I want to test still doesn't work. If I compare with what's done in the default macros, which use PndEmcHitsToWaveform and PndEmcWaveformToDigi, these are the main differences:

1) PndEmcHitsToWaveform uses PndEmcWaveformWriteoutBuffer, and PndEmcFWEndcapTimebasedWaveforms uses PndEmcWaveformBuffer.

2) PndEmcWaveformToDigi uses a functor to get waveforms from a given timeslot in this way:
fDigiArray->Delete();

Double_t fevtTime = FairRootManager::Instance()->GetEventTime();

if(fTimeOrderedDigi){
	if(FairRunAna::Instance()->IsTimeStamp()){
		fWaveformArray->Delete();
		Double_t time_length = 40.;//99.98%
		if(fVerbose >0)
			cout<<"--I-- time-based simulation, read data to later #"<<time_length<<" ns"<<endl;
		fWaveformArray  = FairRootManager::Instance()->GetData("EmcSortedWaveform"
				, fFunctor
				, fevtTime + time_length);
	}
	if(fVerbose>0)
		std::cout<<"fDigiArrayTBD size #"<<PndEmcDigi::fDigiArrayTBD->GetEntriesFast()<<std::endl;
}
Int_t nWaveforms = fWaveformArray->GetEntriesFast();
...

while PndEmcFWEndcapDigi just asks for the length of the waveform array right away:
 	fDigiArray->Delete();

	Int_t nWaveforms = fWaveformArray->GetEntriesFast(); 
...

That could be why it's not working. But the point is, it did work before! But with the new FairRoot and PandaRoot version not anymore...
Previous Topic: refining the EMC geometry ... help needed ....
Next Topic: TClonesArray Trouble with PndEmcDigi
Goto Forum:
  


Current Time: Tue Dec 03 19:40:55 CET 2024

Total time taken to generate the page: 0.00799 seconds