MC Truth propagation with FairLinks in timebased sim [message #18993] |
Fri, 05 February 2016 17:59 |
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 #19087 is a reply to message #19035] |
Fri, 26 February 2016 13:53 |
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 #19125 is a reply to message #19124] |
Tue, 08 March 2016 17:22 |
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...
|
|
|