+
+//_____________________________________________________________________________
+Bool_t AliReconstruction::InitAliEVE()
+{
+ // This method should be called only in case
+ // AliReconstruction is run
+ // within the alieve environment.
+ // It will initialize AliEVE in a way
+ // so that it can visualize event processed
+ // by AliReconstruction.
+ // The return flag shows whenever the
+ // AliEVE initialization was successful or not.
+
+ TString macroStr;
+ macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT"));
+ AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data()));
+ if (gROOT->LoadMacro(macroStr.Data()) != 0) return kFALSE;
+
+ gROOT->ProcessLine("if (!gAliEveEvent) {gAliEveEvent = new AliEveEventManager();gAliEveEvent->AddNewEventCommand(\"alieve_online_on_new_event()\");gEve->AddEvent(gAliEveEvent);};");
+ gROOT->ProcessLine("alieve_online_init()");
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliReconstruction::RunAliEVE()
+{
+ // Runs AliEVE visualisation of
+ // the current event.
+ // Should be executed only after
+ // successful initialization of AliEVE.
+
+ AliInfo("Running AliEVE...");
+ gROOT->ProcessLine(Form("gAliEveEvent->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p);",fRunLoader,fRawReader,fesd));
+ gSystem->Run();
+}
+
+//_____________________________________________________________________________
+Bool_t AliReconstruction::SetRunQA(TString detAndAction)
+{
+ // Allows to run QA for a selected set of detectors
+ // and a selected set of tasks among RAWS, RECPOINTS and ESDS
+ // all selected detectors run the same selected tasks
+
+ if (!detAndAction.Contains(":")) {
+ AliError( Form("%s is a wrong syntax, use \"DetectorList:ActionList\" \n", detAndAction.Data()) ) ;
+ fRunQA = kFALSE ;
+ return kFALSE ;
+ }
+ Int_t colon = detAndAction.Index(":") ;
+ fQADetectors = detAndAction(0, colon) ;
+ if (fQADetectors.Contains("ALL") )
+ fQADetectors = fFillESD ;
+ fQATasks = detAndAction(colon+1, detAndAction.Sizeof() ) ;
+ if (fQATasks.Contains("ALL") ) {
+ fQATasks = Form("%d %d %d", AliQA::kRAWS, AliQA::kRECPOINTS, AliQA::kESDS) ;
+ } else {
+ fQATasks.ToUpper() ;
+ TString tempo("") ;
+ if ( fQATasks.Contains("RAW") )
+ tempo = Form("%d ", AliQA::kRAWS) ;
+ if ( fQATasks.Contains("RECPOINT") )
+ tempo += Form("%d ", AliQA::kRECPOINTS) ;
+ if ( fQATasks.Contains("ESD") )
+ tempo += Form("%d ", AliQA::kESDS) ;
+ fQATasks = tempo ;
+ if (fQATasks.IsNull()) {
+ AliInfo("No QA requested\n") ;
+ fRunQA = kFALSE ;
+ return kTRUE ;
+ }
+ }
+ TString tempo(fQATasks) ;
+ tempo.ReplaceAll(Form("%d", AliQA::kRAWS), AliQA::GetTaskName(AliQA::kRAWS)) ;
+ tempo.ReplaceAll(Form("%d", AliQA::kRECPOINTS), AliQA::GetTaskName(AliQA::kRECPOINTS)) ;
+ tempo.ReplaceAll(Form("%d", AliQA::kESDS), AliQA::GetTaskName(AliQA::kESDS)) ;
+ AliInfo( Form("QA will be done on \"%s\" for \"%s\"\n", fQADetectors.Data(), tempo.Data()) ) ;
+ fRunQA = kTRUE ;
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliReconstruction::InitRecoParams()
+{
+ // The method accesses OCDB and retrieves all
+ // the available reco-param objects from there.
+
+ Bool_t isOK = kTRUE;
+
+ TString detStr = fLoadCDB;
+ for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
+
+ if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
+
+ if (fRecoParam.GetDetRecoParamArray(iDet)) {
+ AliInfo(Form("Using custom reconstruction parameters for detector %s",fgkDetectorName[iDet]));
+ continue;
+ }
+
+ AliInfo(Form("Loading reconstruction parameter objects for detector %s",fgkDetectorName[iDet]));
+
+ AliCDBPath path(fgkDetectorName[iDet],"Calib","RecoParam");
+ AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath());
+ if(!entry){
+ AliWarning(Form("Couldn't find RecoParam entry in OCDB for detector %s",fgkDetectorName[iDet]));
+ isOK = kFALSE;
+ }
+ else {
+ TObject *recoParamObj = entry->GetObject();
+ if (dynamic_cast<TObjArray*>(recoParamObj)) {
+ // The detector has a normal TobjArray of AliDetectorRecoParam objects
+ // Registering them in AliRecoParam
+ fRecoParam.AddDetRecoParamArray(iDet,dynamic_cast<TObjArray*>(recoParamObj));
+ }
+ else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) {
+ // The detector has only onse set of reco parameters
+ // Registering it in AliRecoParam
+ AliInfo(Form("Single set of reconstruction parameters found for detector %s",fgkDetectorName[iDet]));
+ dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault();
+ fRecoParam.AddDetRecoParam(iDet,dynamic_cast<AliDetectorRecoParam*>(recoParamObj));
+ }
+ else {
+ AliError(Form("No valid RecoParam object found in the OCDB for detector %s",fgkDetectorName[iDet]));
+ isOK = kFALSE;
+ }
+ entry->SetOwner(0);
+ AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
+ }
+ }
+
+ if (AliDebugLevel() > 0) fRecoParam.Print();
+
+ return isOK;
+}
+
+//_____________________________________________________________________________
+Bool_t AliReconstruction::GetEventInfo()
+{
+ // Fill the event info object
+ // ...
+ AliCodeTimerAuto("")
+
+ AliCentralTrigger *aCTP = NULL;
+ if (fRawReader) {
+ fEventInfo.SetEventType(fRawReader->GetType());
+
+ ULong64_t mask = fRawReader->GetClassMask();
+ fEventInfo.SetTriggerMask(mask);
+ UInt_t clmask = fRawReader->GetDetectorPattern()[0];
+ fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(clmask));
+
+ aCTP = new AliCentralTrigger();
+ TString configstr("");
+ if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB
+ AliError("No trigger configuration found in OCDB! The trigger configuration information will not be used!");
+ delete aCTP;
+ return kFALSE;
+ }
+ aCTP->SetClassMask(mask);
+ aCTP->SetClusterMask(clmask);
+ }
+ else {
+ fEventInfo.SetEventType(AliRawEventHeaderBase::kPhysicsEvent);
+
+ if (fRunLoader && (!fRunLoader->LoadTrigger())) {
+ aCTP = fRunLoader->GetTrigger();
+ fEventInfo.SetTriggerMask(aCTP->GetClassMask());
+ fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(aCTP->GetClusterMask()));
+ }
+ else {
+ AliWarning("No trigger can be loaded! The trigger information will not be used!");
+ return kFALSE;
+ }
+ }
+
+ AliTriggerConfiguration *config = aCTP->GetConfiguration();
+ if (!config) {
+ AliError("No trigger configuration has been found! The trigger configuration information will not be used!");
+ if (fRawReader) delete aCTP;
+ return kFALSE;
+ }
+
+ UChar_t clustmask = 0;
+ TString trclasses;
+ ULong64_t trmask = fEventInfo.GetTriggerMask();
+ const TObjArray& classesArray = config->GetClasses();
+ Int_t nclasses = classesArray.GetEntriesFast();
+ for( Int_t iclass=0; iclass < nclasses; iclass++ ) {
+ AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass);
+ if (trclass) {
+ Int_t trindex = (Int_t)TMath::Log2(trclass->GetMask());
+ fesd->SetTriggerClass(trclass->GetName(),trindex);
+ if (trmask & (1 << trindex)) {
+ trclasses += " ";
+ trclasses += trclass->GetName();
+ trclasses += " ";
+ clustmask |= trclass->GetCluster()->GetClusterMask();
+ }
+ }
+ }
+ fEventInfo.SetTriggerClasses(trclasses);
+
+ // Set the information in ESD
+ fesd->SetTriggerMask(trmask);
+ fesd->SetTriggerCluster(clustmask);
+
+ if (!aCTP->CheckTriggeredDetectors()) {
+ if (fRawReader) delete aCTP;
+ return kFALSE;
+ }
+
+ if (fRawReader) delete aCTP;
+
+ // We have to fill also the HLT decision here!!
+ // ...
+
+ return kTRUE;
+}
+
+const char *AliReconstruction::MatchDetectorList(const char *detectorList, UInt_t detectorMask)
+{
+ // Match the detector list found in the rec.C or the default 'ALL'
+ // to the list found in the GRP (stored there by the shuttle PP which
+ // gets the information from ECS)
+ static TString resultList;
+ TString detList = detectorList;
+
+ resultList = "";
+
+ for(Int_t iDet = 0; iDet < (AliDAQ::kNDetectors-1); iDet++) {
+ if ((detectorMask >> iDet) & 0x1) {
+ TString det = AliDAQ::OfflineModuleName(iDet);
+ if ((detList.CompareTo("ALL") == 0) ||
+ detList.BeginsWith("ALL ") ||
+ detList.EndsWith(" ALL") ||
+ detList.Contains(" ALL ") ||
+ (detList.CompareTo(det) == 0) ||
+ detList.BeginsWith(det) ||
+ detList.EndsWith(det) ||
+ detList.Contains( " "+det+" " )) {
+ if (!resultList.EndsWith(det + " ")) {
+ resultList += det;
+ resultList += " ";
+ }
+ }
+ }
+ }
+
+ // HLT
+ if ((detectorMask >> AliDAQ::kHLTId) & 0x1) {
+ TString hltDet = AliDAQ::OfflineModuleName(AliDAQ::kNDetectors-1);
+ if ((detList.CompareTo("ALL") == 0) ||
+ detList.BeginsWith("ALL ") ||
+ detList.EndsWith(" ALL") ||
+ detList.Contains(" ALL ") ||
+ (detList.CompareTo(hltDet) == 0) ||
+ detList.BeginsWith(hltDet) ||
+ detList.EndsWith(hltDet) ||
+ detList.Contains( " "+hltDet+" " )) {
+ resultList += hltDet;
+ }
+ }
+
+ return resultList.Data();
+
+}
+
+//______________________________________________________________________________
+void AliReconstruction::Abort(const char *method, EAbort what)
+{
+ // Abort processing. If what = kAbortProcess, the Process() loop will be
+ // aborted. If what = kAbortFile, the current file in a chain will be
+ // aborted and the processing will continue with the next file, if there
+ // is no next file then Process() will be aborted. Abort() can also be
+ // called from Begin(), SlaveBegin(), Init() and Notify(). After abort
+ // the SlaveTerminate() and Terminate() are always called. The abort flag
+ // can be checked in these methods using GetAbort().
+ //
+ // The method is overwritten in AliReconstruction for better handling of
+ // reco specific errors
+
+ if (!fStopOnError) return;
+
+ CleanUp();
+
+ TString whyMess = method;
+ whyMess += " failed! Aborting...";
+
+ AliError(whyMess.Data());
+
+ fAbort = what;
+ TString mess = "Abort";
+ if (fAbort == kAbortProcess)
+ mess = "AbortProcess";
+ else if (fAbort == kAbortFile)
+ mess = "AbortFile";
+
+ Info(mess, whyMess.Data());
+}
+