GSI Helmholtzzentrum für Schwerionenforschung
MC Truth propagation with FairLinks in timebased sim
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
Which FairSoft/FairRoot/PandaRoot versions are you using?
For FairSoft and FairRoot I have the versions from the mar15 release. PandaRoot is at revision 28807
Hi, for FairRoot you should use v15.11, where several fixes n FairLink were included. Can you please try and let us know?
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"?
I think it is better to have a separate installation in different folders.
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.
In theory with FairSoft mar15 there is no root6. Are you sure you are using the correct stuff?
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.
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.
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.
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?
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.
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 ===========================================================
About macros, if you update the folder you will have the correct macros. There was a wrong commit few weeks ago.
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?
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
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.
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...