]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Tender wagon providing access to ESD event and CDB. The tender calls an arbitrary...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Sep 2009 13:21:10 +0000 (13:21 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Sep 2009 13:21:10 +0000 (13:21 +0000)
ANALYSIS/PROOF-INF.TENDER/BUILD.sh [new file with mode: 0755]
ANALYSIS/PROOF-INF.TENDER/SETUP.C [new file with mode: 0644]
ANALYSIS/Tender/AliTender.cxx [new file with mode: 0644]
ANALYSIS/Tender/AliTender.h [new file with mode: 0644]
ANALYSIS/Tender/AliTenderSupply.cxx [new file with mode: 0644]
ANALYSIS/Tender/AliTenderSupply.h [new file with mode: 0644]

diff --git a/ANALYSIS/PROOF-INF.TENDER/BUILD.sh b/ANALYSIS/PROOF-INF.TENDER/BUILD.sh
new file mode 100755 (executable)
index 0000000..fc9490a
--- /dev/null
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+make 
diff --git a/ANALYSIS/PROOF-INF.TENDER/SETUP.C b/ANALYSIS/PROOF-INF.TENDER/SETUP.C
new file mode 100644 (file)
index 0000000..6a7f4bb
--- /dev/null
@@ -0,0 +1,11 @@
+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");
+}
diff --git a/ANALYSIS/Tender/AliTender.cxx b/ANALYSIS/Tender/AliTender.cxx
new file mode 100644 (file)
index 0000000..5d7e22e
--- /dev/null
@@ -0,0 +1,136 @@
+/**************************************************************************
+ * 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);
+}
diff --git a/ANALYSIS/Tender/AliTender.h b/ANALYSIS/Tender/AliTender.h
new file mode 100644 (file)
index 0000000..d0b2b4a
--- /dev/null
@@ -0,0 +1,63 @@
+#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
diff --git a/ANALYSIS/Tender/AliTenderSupply.cxx b/ANALYSIS/Tender/AliTenderSupply.cxx
new file mode 100644 (file)
index 0000000..7df26de
--- /dev/null
@@ -0,0 +1,62 @@
+/**************************************************************************
+ * 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;
+}
diff --git a/ANALYSIS/Tender/AliTenderSupply.h b/ANALYSIS/Tender/AliTenderSupply.h
new file mode 100644 (file)
index 0000000..242ede3
--- /dev/null
@@ -0,0 +1,37 @@
+#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