#include "AliOADBPhysicsSelection.h"
#include "AliOADBFillingScheme.h"
#include "AliOADBTriggerAnalysis.h"
+#include "AliInputEventHandler.h"
+#include "AliAnalysisManager.h"
using std::cout;
using std::endl;
Bool_t AliPhysicsSelection::Initialize(const AliESDEvent* aEsd)
{
+ DetectPassName();
// initializes the object for the given ESD
AliInfo(Form("Initializing for beam type: %s", aEsd->GetESDRun()->GetBeamType()));
fUsingCustomClasses = kTRUE;
}
+
+
+void AliPhysicsSelection::DetectPassName(){
+ if (fMC) return;
+ AliInputEventHandler* handler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+ if (!handler) return;
+ TObject* prodInfoData = handler->GetUserInfo()->FindObject("alirootVersion");
+ TString filePath = handler->GetTree()->GetCurrentFile()->GetName();
+ if (prodInfoData) {
+ // try to take filePath from UserInfo - available only from ~LHC12d period
+ TString str(prodInfoData->GetTitle());
+ TObjArray* tokens = str.Tokenize(";");
+ for (Int_t i=0;i<=tokens->GetLast();i++) {
+ TObjString* stObj = (TObjString*) tokens->At(i);
+ TString s = stObj->GetString();
+ if (s.Contains("OutputDir")) {
+ filePath = s;
+ break;
+ }
+ }
+ delete tokens;
+ }
+
+ TString passName="";
+
+ TObjArray* tokens = filePath.Tokenize("/");
+ for (Int_t i=0;i<=tokens->GetLast();i++) {
+ TObjString* stObj = (TObjString*) tokens->At(i);
+ TString s = stObj->GetString();
+ if (s.Contains("pass")) {
+ passName = s;
+ break;
+ }
+ }
+ delete tokens;
+ //
+ // temporary patch for LEGO train runners
+ //
+ if (passName.Contains("_pass")){ // try with "_" as a fallback (as it is the case in the test data of the LEGO train) and do further tokenize
+ TObjArray* tokens2 = filePath.Tokenize("_");
+ for (Int_t i=0;i<=tokens2->GetLast();i++) {
+ TObjString* stObj = (TObjString*) tokens2->At(i);
+ TString s = stObj->GetString();
+ if (s.Contains("pass")) {
+ passName = s;
+ break;
+ }
+ }
+ delete tokens2;
+ }
+
+
+ if (!passName.Contains("pass")){
+ AliError(" Failed to find reconstruction pass name:");
+ AliError(" --> If these are MC data: please set kTRUE first argument of AddTaskPhysicsSelection");
+ AliFatal(" --> If these are real data: please insert pass name inside the path of your local file, e.g. /your_path/pass2/AliESDs.root");
+ }
+
+ AliInfo(Form("pass name: %s\n",passName.Data()));
+ fPassName = passName;
+}