--- /dev/null
+#! /bin/sh
+
+make
--- /dev/null
+void SETUP()
+{
+ // Load the ANALYSIS library
+ gSystem->Load("libTENDER");
+
+ // Set the include paths
+ gROOT->ProcessLine(".include TENDER/Tender");
+
+ // Set our location, so that other packages can find us
+ gSystem->Setenv("Tender_INCLUDE", "TENDER/Tender");
+}
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include <TChain.h>
+#include <TFile.h>
+
+#include "AliTender.h"
+#include "AliTenderSupply.h"
+#include "AliAnalysisManager.h"
+#include "AliCDBManager.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliLog.h"
+
+
+ClassImp(AliTender)
+
+//______________________________________________________________________________
+AliTender::AliTender():
+ AliAnalysisTask(),
+ fDebug(0),
+ fRun(0),
+ fRunChanged(kFALSE),
+ fCDBkey(0),
+ fDefaultStorage(),
+ fCDB(NULL),
+ fESDhandler(NULL),
+ fESD(NULL),
+ fSupplies(NULL)
+{
+// Dummy constructor
+}
+
+//______________________________________________________________________________
+AliTender::AliTender(const char* name):
+ AliAnalysisTask(name, "ESD analysis tender car"),
+ fDebug(0),
+ fRun(0),
+ fRunChanged(kFALSE),
+ fCDBkey(0),
+ fDefaultStorage(),
+ fCDB(NULL),
+ fESDhandler(NULL),
+ fESD(NULL),
+ fSupplies(NULL)
+{
+// Default constructor
+ DefineInput (0, TChain::Class());
+ DefineOutput(0, AliESDEvent::Class());
+}
+
+//______________________________________________________________________________
+AliTender::~AliTender()
+{
+// Destructor
+}
+
+//______________________________________________________________________________
+void AliTender::ConnectInputData(Option_t* /*option*/)
+{
+// Connect the input data, create CDB manager.
+ if (fDebug > 1) Printf("AliTender::ConnectInputData()\n");
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) AliFatal("No tender without an analysis manager");
+ fESDhandler = dynamic_cast<AliESDInputHandler *>(mgr->GetInputEventHandler());
+
+ if (fESDhandler) {
+ fESD = fESDhandler->GetEvent();
+ } else {
+ AliFatal("No ESD input event handler connected") ;
+ }
+ // Create CDB manager
+ if (!fDefaultStorage.Length()) AliFatal("Default CDB storage not set.");
+ fCDB = AliCDBManager::Instance();
+ // SetDefault storage. Specific storages must be set by AliTenderSupply::Init()
+ fCDB->SetDefaultStorage(fDefaultStorage);
+ fRun = fESD->GetRunNumber();
+ fCDB->SetRun(fRun);
+ // Unlock CDB
+ fCDBkey = fCDB->SetLock(kFALSE, fCDBkey);
+ TIter next(fSupplies);
+ AliTenderSupply *supply;
+ while ((supply=(AliTenderSupply*)next())) supply->Init();
+ // Lock CDB
+ fCDBkey = fCDB->SetLock(kTRUE, fCDBkey);
+}
+
+//______________________________________________________________________________
+void AliTender::CreateOutputObjects()
+{
+// Nothing for the moment, but we may need ESD event replication here.
+ if (fDebug > 1) Printf("AliTender::CreateOutputObjects()\n");
+}
+
+//______________________________________________________________________________
+void AliTender::Exec(Option_t* /*option*/)
+{
+//
+// Execute all supplied analysis of one event. Notify run change via RunChanged().
+ if (fDebug > 1) {
+ Long_t entry = fESDhandler->GetReadEntry();
+ Printf("AliTender::Exec() %s ==> processing event %lld\n", fESDhandler->GetTree()->GetCurrentFile()->GetName(),entry);
+ }
+ fESD = fESDhandler->GetEvent();
+
+// Call the user analysis
+ // Unlock CDB
+ fCDBkey = fCDB->SetLock(kFALSE, fCDBkey);
+ // Intercept when the run number changed
+ if (fRun != fESD->GetRunNumber()) {
+ fRunChanged = kTRUE;
+ fRun = fESD->GetRunNumber();
+ fCDB->SetRun(fRun);
+ }
+ TIter next(fSupplies);
+ AliTenderSupply *supply;
+ while ((supply=(AliTenderSupply*)next())) supply->ProcessEvent();
+ fRunChanged = kFALSE;
+ // Lock CDB
+ fCDBkey = fCDB->SetLock(kTRUE, fCDBkey);
+ PostData(0, fESD);
+}
--- /dev/null
+#ifndef ALITENDER_H
+#define ALITENDER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+// Author: Andrei Gheata, 31/08/2009
+
+//==============================================================================
+// AliTender - Tender wagon providing access to ESD event and CDB.
+// The tender calls an arbitrary number of user algorithms that add or
+// correct information in ESD based on CDB info that was not available
+// during pass1 reconstruction.
+//==============================================================================
+
+#ifndef ALIANALYSISTASK_H
+#include "AliAnalysisTask.h"
+#endif
+
+class AliCDBManager;
+class AliESDEvent;
+class AliESDInputHandler;
+
+class AliTender : public AliAnalysisTask {
+
+private:
+ Int_t fDebug; // Debug level
+ Int_t fRun; // Current run
+ Bool_t fRunChanged; // Flag for run change.
+ ULong_t fCDBkey; // Key to unlock CDB manager
+ TString fDefaultStorage; // Default CDB storage
+ AliCDBManager *fCDB; // Pointer to CDB manager
+ AliESDInputHandler *fESDhandler; // Pointer to ESD input handler
+ AliESDEvent *fESD; // Pointer to current ESD event
+ TObjArray *fSupplies; // Array of tender supplies
+
+ AliTender(const AliTender &other);
+ AliTender& operator=(const AliTender &other);
+
+public:
+ AliTender();
+ AliTender(const char *name);
+ virtual ~AliTender();
+
+ // Getters
+ Int_t GetRun() const {return fRun;}
+ AliCDBManager *GetCDBManager() const {return fCDB;}
+ AliESDInputHandler *GetESDhandler() const {return fESDhandler;}
+ AliESDEvent *GetEvent() const {return fESD;}
+ TObjArray *GetSupplies() const {return fSupplies;}
+ Bool_t RunChanged() const {return fRunChanged;}
+ // Configuration
+ void SetDefaultCDBStorage(const char *dbString="local://$ALICE_ROOT/OCDB");
+
+ // Run control
+ virtual void ConnectInputData(Option_t *option = "");
+ virtual void CreateOutputObjects();
+ virtual Bool_t Notify() {return kTRUE;}
+ virtual void Exec(Option_t *option);
+
+ ClassDef(AliTender,1) // Class describing the tender car for ESD analysis
+};
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include "AliTender.h"
+#include "AliTenderSupply.h"
+
+ClassImp(AliTenderSupply)
+
+//______________________________________________________________________________
+AliTenderSupply::AliTenderSupply()
+ :TNamed(),
+ fTender(NULL)
+{
+// Dummy constructor
+}
+
+//______________________________________________________________________________
+AliTenderSupply::AliTenderSupply(const char* name, AliTender *tender)
+ :TNamed(name, "ESD analysis tender car"),
+ fTender(tender)
+{
+// Default constructor
+}
+
+//______________________________________________________________________________
+AliTenderSupply::AliTenderSupply(const AliTenderSupply &other)
+ :TNamed(other),
+ fTender(other.fTender)
+
+{
+// Copy constructor
+}
+
+//______________________________________________________________________________
+AliTenderSupply::~AliTenderSupply()
+{
+// Destructor
+}
+
+//______________________________________________________________________________
+AliTenderSupply& AliTenderSupply::operator=(const AliTenderSupply &other)
+{
+// Assignment
+ if (&other == this) return *this;
+ TNamed::operator=(other);
+ fTender = other.fTender;
+ return *this;
+}
--- /dev/null
+#ifndef ALITENDERSUPPLY_H
+#define ALITENDERSUPPLY_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+// Author: Andrei Gheata, 01/09/2009
+
+//==============================================================================
+// AliTenderSupply - Base class for user-defined ESD additions and corrections.
+//==============================================================================
+
+#ifndef ROOT_TNamed
+#include "TNamed.h"
+#endif
+
+class AliTender;
+
+class AliTenderSupply : public TNamed {
+
+private:
+ AliTender *fTender; // Tender car
+
+public:
+ AliTenderSupply();
+ AliTenderSupply(const char *name, AliTender *tender);
+ AliTenderSupply(const AliTenderSupply &other);
+ virtual ~AliTenderSupply();
+ AliTenderSupply& operator=(const AliTenderSupply &other);
+
+ // Run control
+ virtual void Init() = 0;
+ virtual void ProcessEvent() = 0;
+
+ ClassDef(AliTenderSupply,1) // Base class for tender user algorithms
+};
+#endif