// The default output is to the signal file (stream 0). This can be
// changed with the SetOutputFile(TString fn) method.
//
-// Single input file is permitted. Maximum kMaxStreamsToMerge can be merged.
+// Single input file is permitted. Maximum MAXSTREAMSTOMERGE can be merged.
// Input from the memory (on-the-fly merging) is not yet
// supported, as well as access to the input data by invoking methods
// on the output data.
// system includes
-#include <Riostream.h>
-
// ROOT includes
-#include "TFile.h"
-#include "TList.h"
-#include "TTree.h"
+#include <Riostream.h>
+class TList;
// AliROOT includes
+#include "AliLog.h"
#include "AliDigitizer.h"
-#include "AliMergeCombi.h"
-#include "AliRunLoader.h"
+#include "AliHeader.h"
#include "AliLoader.h"
+#include "AliMergeCombi.h"
#include "AliRun.h"
#include "AliRunDigitizer.h"
-#include "AliStream.h"
-#include "AliHeader.h"
+#include "AliRunLoader.h"
ClassImp(AliRunDigitizer)
//_______________________________________________________________________
-AliRunDigitizer::AliRunDigitizer():
+AliRunDigitizer::AliRunDigitizer(): TTask("AliRunDigitizer","The manager for Merging"),
fkMASKSTEP(0),
fOutputFileName(0),
fOutputDirName(0),
fOutputInitialized(kFALSE),
fCombi(0),
fCombination(0),
- fCombinationFileName(0),
- fDebug(0)
+ fCombinationFileName(0)
{
-// root requires default ctor, where no new objects can be created
-// do not use this ctor, it is supplied only for root needs
-
-// fOutputStream = 0x0;
+ //
+ // root requires default ctor, where no new objects can be created
+ // do not use this ctor, it is supplied only for root needs
}
//_______________________________________________________________________
fOutRunLoader(0x0),
fOutputInitialized(kFALSE),
fCombi(new AliMergeCombi(nInputStreams,sperb)),
- fCombination(kMaxStreamsToMerge),
- fCombinationFileName(0),
- fDebug(0)
+ fCombination(MAXSTREAMSTOMERGE),
+ fCombinationFileName(0)
{
-// ctor which should be used to create a manager for merging/digitization
+ //
+ // ctor which should be used to create
+ // a manager for merging/digitization
+ //
if (nInputStreams == 0)
{//kidding
- Fatal("AliRunDigitizer","Specify nr of input streams");
+ AliFatal("Specify nr of input streams");
return;
}
Int_t i;
fkMASK[0] = 0;
- for (i=1;i<kMaxStreamsToMerge;i++)
+ for (i=1;i<MAXSTREAMSTOMERGE;i++)
{
fkMASK[i] = fkMASK[i-1] + fkMASKSTEP;
}
fOutputInitialized(kFALSE),
fCombi(0),
fCombination(0),
- fCombinationFileName(0),
- fDebug(0)
+ fCombinationFileName(0)
{
//
// Copy ctor
void AliRunDigitizer::Copy(TObject&) const
{
- Fatal("Copy","Not installed\n");
+ //
+ // Non implemented copy function
+ //
+ AliFatal("Not installed");
}
//_______________________________________________________________________
-AliRunDigitizer::~AliRunDigitizer() {
-// dtor
+AliRunDigitizer::~AliRunDigitizer()
+{
+ //
+ // dtor
+ //
delete fInputStreams;
delete fCombi;
delete fOutRunLoader;
//_______________________________________________________________________
void AliRunDigitizer::AddDigitizer(AliDigitizer *digitizer)
{
-// add digitizer to the list of active digitizers
+ //
+ // add digitizer to the list of active digitizers
+ //
this->Add(digitizer);
}
//_______________________________________________________________________
// Sets the name of the input file
//
if (i > fInputStreams->GetLast()) {
- Error("SetInputStream","Input stream number too high");
+ AliError("Input stream number too high");
return;
}
AliStream * stream = static_cast<AliStream*>(fInputStreams->At(i)) ;
// take gAlice from the first input file. It is needed to access
// geometry data
// If gAlice is already in memory, use it
- SetDebug(10);
if (!static_cast<AliStream*>(fInputStreams->At(0))->ImportgAlice())
{
- Error("Digitize","Error occured while getting gAlice from Input 0");
+ AliError("Error occured while getting gAlice from Input 0");
return;
}
if (!InitGlobal()) //calls Init() for all (sub)digitizers
{
- Error("Digitize","InitGlobal returned error");
+ AliError("InitGlobal returned error");
return;
}
//_______________________________________________________________________
Bool_t AliRunDigitizer::ConnectInputTrees()
{
-//loads events
- Int_t eventNr[kMaxStreamsToMerge], delta[kMaxStreamsToMerge];
+ //
+ // loads events
+ //
+ Int_t eventNr[MAXSTREAMSTOMERGE], delta[MAXSTREAMSTOMERGE];
fCombi->Combination(eventNr, delta);
for (Int_t i=0;i<fNinputs;i++)
{
}
else if (delta[i] != 0)
{
- Error("ConnectInputTrees","Only delta 0 or 1 is implemented");
+ AliError("Only delta 0 or 1 is implemented");
return kFALSE;
}
}
//_______________________________________________________________________
Bool_t AliRunDigitizer::InitGlobal()
{
-// called once before Digitize() is called, initialize digitizers and output
+ //
+ // Method called once before Digitize() is called
+ // initialize digitizers and output
+ //
fOutputInitialized = kFALSE;
TList* subTasks = this->GetListOfTasks();
if (subTasks) {
void AliRunDigitizer::SetOutputFile(TString fn)
{
-// the output will be to separate file, not to the signal file
- //here should be protection to avoid setting the same file as any input
- Info("SetOutputFile","Setting Output File Name %s ",fn.Data());
+ //
+ // The output will be to separate file,
+ // not to the signal file here should be protection
+ //to avoid setting the same file as any input
+ //
+ AliInfo(Form("Setting Output File Name %s ",fn.Data()));
fOutputFileName = fn;
-// InitOutputGlobal();
+ // InitOutputGlobal();
}
//_______________________________________________________________________
Bool_t AliRunDigitizer::InitOutputGlobal()
{
-// Creates the output file, called by InitEvent()
-//Needs to be called after all inputs are opened
+ //
+ // Creates the output file, called by InitEvent()
+ // Needs to be called after all inputs are opened
+ //
if (fOutputInitialized) return kTRUE;
if ( !fOutputFileName.IsNull())
if (fOutRunLoader == 0x0)
{
- Error("InitOutputGlobal","Can not open ooutput");
+ AliError("Can not open output");
return kFALSE;
}
Info("InitOutputGlobal", " 1 %s = ", GetInputFolderName(0).Data()) ;
AliRunLoader* inrl = AliRunLoader::GetRunLoader(GetInputFolderName(0));
if (inrl == 0x0)
{
- Error("InitOutputGlobal","Can not get Run Loader Input 0. Maybe yet not initialized?");
+ AliError("Can not get Run Loader Input 0. Maybe yet not initialized?");
return kFALSE;
}
- Info("InitOutputGlobal", " 2 %#x = ", inrl) ;
+ AliDebug(2, Form(" 2 %#x = ", inrl)) ;
//Copy all detector loaders from input 0 to output
const TObjArray* inloaders = inrl->GetArrayOfLoaders();
fOutRunLoader->MakeTree("E");
- if (GetDebug()>2) Info("InitOutputGlobal","file %s was opened.",fOutputFileName.Data());
+ AliDebug(3,Form("file %s was opened.",fOutputFileName.Data()));
}
fOutputInitialized = kTRUE;
return kTRUE;
void AliRunDigitizer::InitEvent()
{
-//redirects output properly
- if (GetDebug()>2)
- {
- Info("InitEvent","fEvent = %d",fEvent);
- Info("InitEvent","fOutputFileName \"%s\"",fOutputFileName.Data());
- }
+ //
+ // redirects output properly
+ //
+ AliDebug(3,Form("fEvent = %d",fEvent));
+ AliDebug(3,Form("fOutputFileName \"%s\"",fOutputFileName.Data()));
if (fOutputInitialized == kFALSE) InitOutputGlobal();
-// if fOutputFileName was not given, write output to signal directory
+ // if fOutputFileName was not given, write output to signal directory
}
//_______________________________________________________________________
void AliRunDigitizer::FinishEvent()
{
-// called at the end of loop over digitizers
-
+ //
+ // called at the end of loop over digitizers
+ //
if (GetOutRunLoader() == 0x0)
{
- Error("FinishEvent","fOutRunLoader is null");
+ AliError("fOutRunLoader is null");
return;
}
{
inrl->LoadHeader();
inheader = inrl->GetHeader();
- if (inheader == 0x0) Fatal("FinishEvent","Can not get header from input 0");
+ if (inheader == 0x0) AliFatal("Can not get header from input 0");
}
outheader->SetNprimary(inheader->GetNprimary());
{
//this is sensless since no information would be coherent in case of merging
//
- cout<<"Copy trees from input: Copy or link files manually"<<endl;
+ AliWarning("Copy trees from input: Copy or link files manually");
return;
}
}
void AliRunDigitizer::FinishGlobal()
{
-// called at the end of Exec
-// save unique objects to the output file
-
+ //
+ // called at the end of Exec
+ // save unique objects to the output file
+ //
if (GetOutRunLoader() == 0x0)
{
- Error("FinishGlobal","Can not get RunLoader from Output Stream folder");
+ AliError("Can not get RunLoader from Output Stream folder");
return;
}
GetOutRunLoader()->CdGAFile();
TFolder* outfolder = fOutRunLoader->GetEventFolder();
if (outfolder == 0x0)
{
- Error("FinishEvent","Can not get Event Folder");
+ AliError("Can not get Event Folder");
return;
}
// merged in the output event event
// simplified for now, implement later
- Int_t * a = new Int_t[kMaxStreamsToMerge];
+ Int_t * a = new Int_t[MAXSTREAMSTOMERGE];
for (Int_t i = 0; i < fNinputs; i++) {
a[i] = event;
}
//_______________________________________________________________________
void AliRunDigitizer::ExecuteTask(Option_t* option)
{
-// overwrite ExecuteTask to do Digitize only
-
+ //
+ // overwrite ExecuteTask to do Digitize only
+ //
if (!IsActive()) return;
Digitize(option);
fHasExecuted = kTRUE;
//_______________________________________________________________________
const TString& AliRunDigitizer::GetInputFolderName(Int_t i) const
{
+ //
+ // Get the input Folder Name
+ //
AliStream* stream = dynamic_cast<AliStream*>(fInputStreams->At(i));
if (stream == 0x0)
- {
- Fatal("GetInputFolderName","Can not get the input stream. Index = %d. Exiting",i);
- }
+ AliFatal(Form("Can not get the input stream. Index = %d. Exiting",i));
return stream->GetFolderName();
}
//_______________________________________________________________________
const char* AliRunDigitizer::GetOutputFolderName()
{
+ //
+ // Get output folder name
+ //
return GetOutRunLoader()->GetEventFolder()->GetName();
}
//_______________________________________________________________________
AliRunLoader* AliRunDigitizer::GetOutRunLoader()
{
+ //
+ // Returns Run Loader
+ //
if (fOutRunLoader) return fOutRunLoader;
if ( fOutputFileName.IsNull() )
{//guard that sombody calls it without settting file name
- cout<<"Output file name is empty. Using Input 0 for output\n";
+ AliDebug(1,"Output file name is empty. Using Input 0 for output");
return AliRunLoader::GetRunLoader(GetInputFolderName(0));
}
// InitOutputGlobal();