Task (or macro, I dont know) stops after one event [message #20346] |
Tue, 21 February 2017 16:42 |
Marcel Tiemens
Messages: 47 Registered: January 2014
|
continuous participant |
From: *kvi-cart.rug.nl
|
|
Hi,
I created a new macro to run a new task. I based the macro on existing macros, which I know to work. The task tries to get some information, using FairLinks, on a set of objects that are loaded into a TClonesArray.
The TClonesArray is initiated like this:
fClusterArray = (TClonesArray*) ioman->GetObject("EmcClusterTemp");
with ioman a pointer to the FairRootManager. The task has the standard layout of an Init(), Exec(), and a FinishTask(), which cout's some info and draw the histogram that was filled during the Exec stage. They are all defined as public virtual methods in the task's header file.
The macro looks like this, where clusFile contains the objects that need to be loaded into the TClonesArray, and simFile and digiFile contain the destination of the FairLinks:
FairRunAna *fRun= new FairRunAna();
fRun->SetInputFile(clusFile);
fRun->AddFriend(simFile);
fRun->AddFriend(digiFile);
fRun->SetOutputFile(outFile);
fRun->SetUseFairLinks(kTRUE);
// ----- Parameter database -----------------------------
FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
parIo1->open(parFile_Ascii.Data(),"in");
rtdb->setFirstInput(parIo1);
FairParRootFileIo* parInput1 = new FairParRootFileIo();
parInput1->open(parFile);
rtdb->setSecondInput(parInput1);
// ---------------------------------------------------------
fRun->RunWithTimeStamps();
PndEmcInspectClusters* inspectorTask = new PndEmcInspectClusters(iVerbose);
fRun->AddTask(inspectorTask);
// ----- Intialise and run -----------------------------
gRandom->SetSeed();
fRun->Init();
fRun->Run();
When running this macro, everything seems to work, except that it exits after processing the first event. ROOT acts like it is supposed to do that, but it isn't. Trying to provide different ranges to the call fRun->Run() doesn't change anything. Does anyone know what could be causing this behaviour?
|
|
|
|
|
Re: Task (or macro, I dont know) stops after one event [message #20354 is a reply to message #20353] |
Tue, 21 February 2017 17:02 |
Tobias Stockmanns
Messages: 489 Registered: May 2007
|
first-grade participant |
From: *ikp.kfa-juelich.de
|
|
Dear Marcel,
the problem is that you are running in time stamp mode by setting fRun->RunWithTimeStamps(). If you do that, you cannot receive the data in your exec method automatically but you have to add something like this:
if (FairRunAna::Instance() != 0 && FairRunAna::Instance()->IsTimeStamp()){
<yourArray> = FairRootManager::Instance()->GetData(fInBranchName, fFunctor, <StopTime>);
}
The fFunctor is a BinaryFunctor defined in FairTSBufferFunctional. You have to decide in which data packages you want to have your data. Either in fixed time packages, then you choose the StopTime functor with an absolute time, or all data within a certain time gap, then you choose TimeGap functor with time between two events.
You can find an example e.g. in PndMvdRiemannTrackFinderTask.
I hope it helps.
Cheers,
Tobias
|
|
|
|