43 #include <Riostream.h> 44 #include <TMethodCall.h> 63 using std::setiosflags;
64 using std::setprecision;
97 SetTitle(
fType->GetName());
118 Int_t ncons = cont.
fConsumers->GetEntriesFast();
138 TNamed::operator=(cont);
149 Int_t ncons = cont.
fConsumers->GetEntriesFast();
157 void AliAnalysisDataContainer::Streamer(TBuffer &R__b)
161 if (R__b.IsReading()) {
162 R__b.ReadClassBuffer(AliAnalysisDataContainer::Class(),
this);
165 R__b.WriteClassBuffer(AliAnalysisDataContainer::Class(),
this);
175 if (!slot || !slot->
GetType()) {
176 cout<<
"Consumer task "<< consumer->GetName()<<
" does not have an input/type #"<<islot<<endl;
181 cout<<
"Data type "<<slot->GetTitle()<<
" for input slot "<<islot<<
" of task "<<consumer->GetName()<<
" does not match container type "<<GetTitle()<<endl;
212 cout<<
"Data not ready or not all clients of container "<<GetName()<<
" executed. Data not deleted."<<endl;
217 cout<<
"Data not owned by container "<<GetName()<<
". Not deleted."<<endl;
233 if (!
fType)
printf(
"AliAnalysisDataContainer: Unknown class: %s\n", GetTitle());
244 Bool_t istree =
fType->InheritsFrom(TTree::Class());
247 if (tree->GetReadEntry() != ientry) tree->GetEntry(ientry);
250 Bool_t isbranch =
fType->InheritsFrom(TBranch::Class());
252 TBranch *branch = (TBranch*)
fData;
253 if (branch->GetReadEntry() != ientry) branch->GetEntry(ientry);
264 if (!list || !
fData)
return 0;
265 AliInfo(Form(
"Merging %d containers %s\n", list->GetEntries(), GetName()));
268 callEnv.InitWithPrototype(
fData->IsA(),
"Merge",
"TCollection*");
269 if (!callEnv.IsValid() && !list->IsEmpty()) {
270 cout <<
"No merge interface for data stored by " << GetName() <<
". Merging not possible !" << endl;
274 if (list->IsEmpty())
return 1;
279 TList *collectionData =
new TList();
282 TObject *data = cont->
GetData();
284 if (strcmp(cont->GetName(), GetName())) {
285 cout <<
"Not merging containers with different names !" << endl;
288 AliInfo(Form(
" ... merging object %s\n", data->GetName()));
289 collectionData->Add(data);
292 callEnv.SetParam((Long_t) collectionData);
293 callEnv.Execute(
fData);
294 delete collectionData;
305 for (Int_t i=0; i<indent; i++) ind +=
" ";
308 TString ctype =
"Container";
309 if (
IsExchange()) ctype =
"Exchange container";
310 Bool_t dep = (opt.Contains(
"dep"))?kTRUE:kFALSE;
312 if (
IsPostEventLoop())
printf(
"%s%s: %s DATA TYPE: %s POST_LOOP task\n", ind.Data(), ctype.Data(), GetName(), GetTitle());
313 else printf(
"%s%s: %s DATA TYPE: %s\n", ind.Data(), ctype.Data(), GetName(), GetTitle());
317 printf(
"%s= Not connected to a data producer\n",ind.Data());
319 printf(
"%s = Client tasks indented below:\n", ind.Data());
340 Bool_t
init = kFALSE;
343 if (data !=
fData) init = kTRUE;
348 for (i=0; i<nc; i++) {
361 for (i=0; i<nc; i++) {
392 Fatal(
"SetFileName",
"Empty file name");
394 Fatal(
"SetFileName",
"No slashes (/) allowed in the file name");
403 cout<<
"Data container "<<GetName()<<
" already has a producer: "<<
fProducer->GetName()<<endl;
407 cout<<GetName()<<
" container contains data - cannot change producer!"<<endl;
413 cout<<
"Producer task "<<prod->GetName()<<
" does not have an output #"<<islot<<endl;
418 cout<<
"Data type "<<slot->GetTitle()<<
"for output slot "<<islot<<
" of task "<<prod->GetName()<<
" does not match container type "<<GetTitle()<<endl;
428 if (!prod->GetListOfTasks()->FindObject(cons)) prod->Add(cons);
439 Error(
"ExportData",
"Container %s - No data to be wrapped !", GetName());
443 if (mgr && mgr->
GetDebugLevel() > 1)
printf(
" ExportData: Wrapping data %s for container %s\n",
fData->GetName(),GetName());
445 pack->SetName(fName.Data());
457 Error(
"ImportData",
"No data was wrapped for container %s", GetName());
461 if (mgr && mgr->
GetDebugLevel() > 1)
printf(
" ImportData: Unwrapping data %s for container %s\n",
fData->GetName(),GetName());
476 if (data) SetName(data->GetName());
490 if (&other !=
this) {
491 TNamed::operator=(other);
502 if (TH1::AddDirectoryStatus()) TH1::AddDirectory(kFALSE);
503 if (!
fData)
return 0;
504 if (!list || list->IsEmpty())
return 1;
510 callEnv.InitWithPrototype(
fData->IsA(),
"Merge",
"TCollection*");
511 if (!callEnv.IsValid()) {
512 cout <<
"No merge interface for data stored by " << GetName() <<
". Merging not possible !" << endl;
519 TList *collectionData =
new TList();
524 TObject *data = cont->
Data();
527 collectionData->Add(data);
530 callEnv.SetParam((Long_t) collectionData);
531 callEnv.Execute(
fData);
532 delete collectionData;
541 :TObject(), fLfn(), fGUID(), fUrl(), fPfn(), fSE(),
542 fIsArchive(kFALSE), fImage(0), fNreplicas(0),
543 fStartBytes(0), fReadBytes(0), fSize(0), fOpenedAt(0),
544 fOpenTime(0.), fProcessingTime(0.), fThroughput(0.), fTimer()
551 :TObject(), fLfn(), fGUID(), fUrl(), fPfn(), fSE(),
552 fIsArchive(kFALSE), fImage(0), fNreplicas(0),
553 fStartBytes(0), fReadBytes(0), fSize(0), fOpenedAt(0),
554 fOpenTime(0.), fProcessingTime(0.), fThroughput(0.), fTimer()
557 if (file->InheritsFrom(
"TAlienFile")) {
558 fLfn =(
const char*)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetLfn();", file));
559 fGUID =(
const char*)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetGUID();", file));
560 fUrl =(
const char*)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetUrl();", file));
561 fPfn =(
const char*)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetPfn();", file));
562 fSE = (
const char*)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetSE();", file));
563 fImage = (Int_t)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetImage();", file));
564 fNreplicas = (Int_t)
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetNreplicas();", file));
565 fOpenedAt =
gROOT->ProcessLine(Form(
"((TAlienFile*)%p)->GetOpenTime();", file));
566 gROOT->ProcessLine(Form(
"((AliAnalysisFileDescriptor*)%p)->SetOpenTime(((TAlienFile*)%p)->GetElapsed());",
this, file));
568 fLfn = file->GetName();
569 fPfn = file->GetName();
570 fUrl = file->GetName();
572 if (!
fPfn.BeginsWith(
"/"))
fPfn.Prepend(Form(
"%s/",gSystem->WorkingDirectory()));
577 fSize = file->GetSize();
596 if (&other ==
this)
return *
this;
597 TObject::operator=(other);
627 const Double_t megabyte = 1048576.;
640 const Double_t megabyte = 1048576.;
641 printf(
"===== Logical file name: %s =====\n",
fLfn.Data());
655 const Double_t megabyte = 1048576.;
656 out <<
"#################################################################" << endl;
657 out <<
"pfn " <<
fPfn.Data() << endl;
658 out <<
"url " <<
fUrl.Data() << endl;
659 out <<
"se " <<
fSE.Data() << endl;
660 out <<
"image " <<
fImage << endl;
662 out <<
"openstamp " <<
fOpenedAt << endl;
663 std::ios_base::fmtflags original_flags = out.flags();
664 out << setiosflags(std::ios::fixed) << std::setprecision(3);
667 out <<
"filesize " <<
fSize/megabyte << endl;
668 out <<
"readsize " <<
fReadBytes/megabyte << endl;
670 out.flags(original_flags);
AliAnalysysTask - Class representing a basic analysis task. Any user-defined task should derive from...
Bool_t IsExchange() const
AliAnalysisDataWrapper * ExportData() const
Wrapping.
TObject * GetPublishedData() const
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
void CheckNotify(Bool_t init=kFALSE)
virtual ~AliAnalysisFileDescriptor()
TFile * fFile
! Opened file
AliAnalysisFileDescriptor()
TObject * fData
Wrapped data.
TString fUrl
url for the opened copy
void SetDataOwned(Bool_t flag)
Int_t fImage
Image number.
virtual Long64_t Merge(TCollection *list)
Container merging.
virtual void PrintTask(Option_t *option="all", Int_t indent=0) const
static AliAnalysisManager * GetAnalysisManager()
TObject * GetData() const
Getters.
AliAnalysysManager Manager analysis class. Allows creation of several analysis tasks and data contain...
Bool_t fOwnedData
Flag data ownership.
void PrintContainer(Option_t *option="all", Int_t indent=0) const
Print connected tasks/status.
AliAnalysisTask * fProducer
Analysis task to which the slot belongs.
TString fSE
Storage element.
Long64_t fReadBytes
Number of bytes read.
AliAnalysisDataContainer()
TObjArray * fConsumers
List of consumers of the data.
Double_t fProcessingTime
Processing.
AliAnalysysDataContainer AliAnalysysDataContainer - Container of data of arbitrary type deriving from...
Long64_t fOpenedAt
Absolute value for time when opened.
TStopwatch fTimer
! Processing time
Bool_t ClientsExecuted() const
void SetType(TClass *type)
UInt_t GetDebugLevel() const
virtual Long64_t Merge(TCollection *list)
Merging.
Bool_t IsPostEventLoop() const
Long64_t fSize
Size of the file in bytes.
TClass * fType
! Type of contained data
Bool_t fDataReady
Flag that data is ready.
AliAnalysisDataContainer & operator=(const AliAnalysisDataContainer &cont)
Assignment.
void ImportData(AliAnalysisDataWrapper *pack)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Long64_t fStartBytes
Total number of read bytes at start.
AliAnalysysDataSlot Class representing a data slot of an analysis task. An analysis slot enforces a c...
TString fPfn
physical file name
AliAnalysisDataSlot * GetOutputSlot(Int_t islot) const
AliAnalysisDataWrapper & operator=(const AliAnalysisDataWrapper &other)
Assignment.
virtual ~AliAnalysisDataContainer()
TString fFolderName
Folder name in the output file.
virtual ~AliAnalysisDataWrapper()
Double_t fThroughput
Throughput.
TObject * fData
Contained data.
void SetDeleteData(Bool_t flag=kTRUE)
AliAnalysisDataSlot * GetInputSlot(Int_t islot) const
virtual void Print(Option_t *option="") const
Bool_t fIsArchive
Archive flag.
TString fFileName
File storing the data.
Int_t fNreplicas
Number of replicas.
void SetFileName(const char *filename)
AliAnalysisFileDescriptor & operator=(const AliAnalysisFileDescriptor &other)
Assignment.
virtual Bool_t SetData(TObject *data, Option_t *option="")
void AddConsumer(AliAnalysisTask *cons, Int_t islot)
Bool_t HasExecuted() const
void SetProducer(AliAnalysisTask *prod, Int_t islot)
TString fLfn
logical file name
Double_t fOpenTime
Time elapsed to open file.
virtual void GetEntry(Long64_t ientry)