+//______________________________________________________________________________
+Bool_t AliReconstruction::ProcessEvent(void* event)
+{
+ // Method that is used in case the event loop
+ // is steered from outside, for example by AMORE
+ // 'event' is a pointer to the DATE event in the memory
+
+ if (fRawReader) delete fRawReader;
+ fRawReader = new AliRawReaderDate(event);
+ fStatus = ProcessEvent(fRunLoader->GetNumberOfEvents());
+ delete fRawReader;
+ fRawReader = NULL;
+
+ return fStatus;
+}
+
+//______________________________________________________________________________
+Bool_t AliReconstruction::ParseOutput()
+{
+ // The method parses the output file
+ // location string in order to steer
+ // properly the selector
+
+ TPMERegexp re1("(\\w+\\.zip#\\w+\\.root):([,*\\w+\\.root,*]+)@dataset://(\\w++)");
+ TPMERegexp re2("(\\w+\\.root)?@?dataset://(\\w++)");
+
+ if (re1.Match(fESDOutput) == 4) {
+ // root archive with output files stored and regustered
+ // in proof dataset
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",re1[1].Data()));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",re1[3].Data()));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_DATASET",""));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_ARCHIVE",re1[2].Data()));
+ AliInfo(Form("%s files will be stored within %s in dataset %s",
+ re1[2].Data(),
+ re1[1].Data(),
+ re1[3].Data()));
+ }
+ else if (re2.Match(fESDOutput) == 3) {
+ // output file stored and registered
+ // in proof dataset
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",(re2[1].IsNull()) ? "AliESDs.root" : re2[1].Data()));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",re2[2].Data()));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_DATASET",""));
+ AliInfo(Form("%s will be stored in dataset %s",
+ (re2[1].IsNull()) ? "AliESDs.root" : re2[1].Data(),
+ re2[2].Data()));
+ }
+ else {
+ if (fESDOutput.IsNull()) {
+ // Output location not given.
+ // Assuming xrootd has been already started and
+ // the output file has to be sent back
+ // to the client machine
+ TString esdUrl(Form("root://%s/%s/",
+ TUrl(gSystem->HostName()).GetHostFQDN(),
+ gSystem->pwd()));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE","AliESDs.root"));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",esdUrl.Data()));
+ AliInfo(Form("AliESDs.root will be stored in %s",
+ esdUrl.Data()));
+ }
+ else {
+ // User specified an output location.
+ // Ones has just to parse it here
+ TUrl outputUrl(fESDOutput.Data());
+ TString outputFile(gSystem->BaseName(outputUrl.GetFile()));
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",outputFile.IsNull() ? "AliESDs.root" : outputFile.Data()));
+ TString outputLocation(outputUrl.GetUrl());
+ outputLocation.ReplaceAll(outputFile.Data(),"");
+ gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",outputLocation.Data()));
+ AliInfo(Form("%s will be stored in %s",
+ outputFile.IsNull() ? "AliESDs.root" : outputFile.Data(),
+ outputLocation.Data()));
+ }
+ }
+
+ return kTRUE;
+}