new analysis classes, not yet in build system
authorjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 29 May 2009 08:30:26 +0000 (08:30 +0000)
committerjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 29 May 2009 08:30:26 +0000 (08:30 +0000)
HLT/JET/analysis/AliHLTJETAnalysisBase.cxx [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisBase.h [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisComponent.cxx [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisComponent.h [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisJets.cxx [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisJets.h [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisMerge.cxx [new file with mode: 0644]
HLT/JET/analysis/AliHLTJETAnalysisMerge.h [new file with mode: 0644]

diff --git a/HLT/JET/analysis/AliHLTJETAnalysisBase.cxx b/HLT/JET/analysis/AliHLTJETAnalysisBase.cxx
new file mode 100644 (file)
index 0000000..bbfe0b2
--- /dev/null
@@ -0,0 +1,82 @@
+//-*- Mode: C++ -*-
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* 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.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETAnalysisBase.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Base functionality for HLT JET analysis package
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "AliHLTJETAnalysisBase.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETAnalysisBase)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+  AliHLTJETAnalysisBase::AliHLTJETAnalysisBase() {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+
+//##################################################################################
+AliHLTJETAnalysisBase::~AliHLTJETAnalysisBase() {
+  // see header file for class documentation
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                              Initialize static const
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+const Char_t *AliHLTJETAnalysisBase::fgkDeltaType[] = { 
+  "all", "leading", 
+  "Matched - all", "Matched -Leading" 
+};
+
+//##################################################################################
+const Char_t *AliHLTJETAnalysisBase::fgkSpectraType[] = { 
+  "Pythia",        "Pythia - Matched",        "Pythia - UnMatched",
+  "Reconstructed", "Reconstructed - Matched", "Reconstructed - UnMatched",
+  "Reco Leading",  "Reco Leading - Matched",  "Reco Leading - UnMatched"
+};
+
+//##################################################################################
+const Char_t *AliHLTJETAnalysisBase::fgkPlotType[] = { 
+  "all", "leading", 
+};
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisBase.h b/HLT/JET/analysis/AliHLTJETAnalysisBase.h
new file mode 100644 (file)
index 0000000..e980fa7
--- /dev/null
@@ -0,0 +1,121 @@
+//-*- Mode: C++ -*-
+#ifndef ALIHLTJETANALYSISBASE_H
+#define ALIHLTJETANALYSISBASE_H
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETAnalysisBase.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Base functionality for HLT JET analysis package
+*/
+
+#include "TObject.h"
+
+#include "AliHLTLogging.h"
+
+/**
+ * @class AliHLTJETAnalysisBase
+ * This class contains basic constants for the Jet Analysis.
+ *
+ * @ingroup alihlt_jet
+ * @ingroup alihlt_jet_analysis
+ */
+
+class AliHLTJETAnalysisBase : public TObject, public AliHLTLogging {
+
+ public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+  /** Standard constructor */
+  AliHLTJETAnalysisBase();
+
+  /** Destructor */
+  ~AliHLTJETAnalysisBase();  
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                          Histogram enum's - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Plot type of Delta histograms */
+  enum JetDeltaType_t {
+    kDeltaAll,                /**< Delta of all jets */
+    kDeltaLead,               /**< Delta of leading jets */
+    kDeltaMatchedAll,         /**< Delta of all matched jets */
+    kDeltaMatchedLead,        /**< Delta of all matched leading jets */
+    kDeltaMax                 /**< Number of enum entries */
+  };
+  /** Plot type of Spectra histograms */
+  enum JetSpectraType_t {
+    kSpectraPythiaAll,        /**< Spectra of all pythia jets */
+    kSpectraPythiaMatched,    /**< Spectra of matched pythia jets */
+    kSpectraPythiaUnmatched,  /**< Spectra of unmatched pythia jets */
+    kSpectraRecoAll,          /**< Spectra of all reco jets */
+    kSpectraRecoMatched,      /**< Spectra of matched reco jets */
+    kSpectraRecoUnmatched,    /**< Spectra of unmatched reco jets */
+    kSpectraRecoLeadAll,      /**< Spectra of all leading reco jets */
+    kSpectraRecoLeadMatched,  /**< Spectra of matched leading reco jets */
+    kSpectraRecoLeadUnmatched,/**< Spectra of unmatched leading reco jets */
+    kSpectraMax               /**< Number of enum entries */
+  };
+  
+  /** Plot type of histograms */
+  enum JetPlotType_t {
+    kPlotAll,                 /**< All jets */
+    kPlotLead,                /**< Leading jets */
+    kPlotMax                  /**< Number of enum entries */
+  };
+
+  /** Type of histgrams */
+  enum JetHistogramType_t {
+    kHistDeltaEt,             /**< Delta E_t histogram */
+    kHistDeltaEta,            /**< Delta Eta histogram */
+    kHistDeltaPhi,            /**< Delta Phi histogram */
+    kHistDeltaEtaDeltaPhi,    /**< Delta Eta Delta Phi histogram */
+    kHistSpectraEt,           /**< Spectra E_t histogram */
+    kHistSpectraEta,          /**< Spectra Eta histogram */
+    kHistSpectraPhi,          /**< Spectra Phi histogram */
+    kHistCorrelationsJetEt,   /**< Correlation Et histogram */
+    kHistResolutionsJetEt,    /**< Resolution Et Jet histogram */
+    kHistResolutionsDiJetEt,  /**< Resolution Et DiJet histogram */
+    kHistMax                  /**< Number of enum entries */
+  };
+
+  /** Array of types of the Delta histograms */
+  static const Char_t *fgkDeltaType[];        //! transient
+
+  /** Array of types of the Spectra histograms */
+  static const Char_t *fgkSpectraType[];      //! transient
+
+  /** Array of types of histograms */
+  static const Char_t *fgkPlotType[];         //! transient
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+ private:
+
+  /** copy constructor prohibited */
+  AliHLTJETAnalysisBase(const AliHLTJETAnalysisBase&);
+
+  /** assignment operator prohibited */
+  AliHLTJETAnalysisBase& operator=(const AliHLTJETAnalysisBase&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+    
+  ClassDef(AliHLTJETAnalysisBase, 0)
+};
+#endif
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisComponent.cxx b/HLT/JET/analysis/AliHLTJETAnalysisComponent.cxx
new file mode 100644 (file)
index 0000000..fe0103b
--- /dev/null
@@ -0,0 +1,233 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETAnalysisComponent.cxx $
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* 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.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETAnalysisComponent.cxx
+    @author Jochen Thaeder <thaeder@kip.uni-heidelberg.de>
+    @date   
+    @brief   Component to run the ConeJet jetfinder
+*/
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include <cstdlib>
+#include <cerrno>
+#include <sys/time.h>
+
+#include "TString.h"
+#include "TObjString.h"
+#include "TObjArray.h"
+
+#include "AliHLTJETAnalysisComponent.h" 
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETAnalysisComponent)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+AliHLTJETAnalysisComponent::AliHLTJETAnalysisComponent() :
+  fAnalysisJets(NULL) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTJETAnalysisComponent::~AliHLTJETAnalysisComponent() {
+  // see header file for class documentation
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Public functions to implement AliHLTComponent's interface.
+ * These functions are required for the registration process
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+const Char_t* AliHLTJETAnalysisComponent::GetComponentID() {
+  // see header file for class documentation
+  return "JETAnalysis";
+}
+
+// #################################################################################
+void AliHLTJETAnalysisComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
+  // see header file for class documentation
+  list.clear(); 
+  list.push_back( kAliHLTDataTypeJet|kAliHLTDataOriginHLT );
+  list.push_back( kAliHLTDataTypeJet|kAliHLTDataOriginOffline );
+  list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline );
+  list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT );
+}
+
+// #################################################################################
+AliHLTComponentDataType AliHLTJETAnalysisComponent::GetOutputDataType() {
+  // see header file for class documentation
+  return (kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); // XXX To Be CHANGED
+}
+
+// #################################################################################
+void AliHLTJETAnalysisComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
+  // see header file for class documentation
+
+  constBase = 20000000;
+  inputMultiplier = 0.3;
+}
+
+// #################################################################################
+AliHLTComponent* AliHLTJETAnalysisComponent::Spawn() {
+  // see header file for class documentation
+  return new AliHLTJETAnalysisComponent();
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Protected functions to implement AliHLTComponent's interface.
+ * These functions provide initialization as well as the actual processing
+ * capabilities of the component. 
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTJETAnalysisComponent::DoInit( Int_t argc, const Char_t** argv ) {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  if ( fAnalysisJets )
+    return -EINPROGRESS;
+
+  Int_t bMissingParam=0;
+  TString argument="";
+
+  // -- Loop over all arguments
+  for ( Int_t iter = 0; iter<argc && iResult>=0; iter++) {
+    argument=argv[iter];
+
+    if (argument.IsNull()) 
+      continue;
+
+#if 0
+    /*
+    // -- nEvents
+    if ( !argument.CompareTo("-nevents") ) {
+    if ((bMissingParam=(++iter>=argc))) break;
+    
+    TString parameter(argv[iter]);
+    parameter.Remove(TString::kLeading, ' ');
+    
+    if ( parameter.IsDigit() ) {
+    fNEventsMax = parameter.Atoi() - 1;
+    }
+    else {
+    HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
+    iResult=-EINVAL;
+    }
+    } 
+    
+    // -- Argument not known
+    else {
+    HLTError("Unknown argument %s.", argument.Data());
+    iResult = -EINVAL;
+    }
+    */
+#endif
+  } // for ( Int iter = 0; iter<argc && iResult>=0; iter++) {
+  
+  // -- Check if parameter is missing
+  if ( bMissingParam ) {
+    HLTError("Missing parameter for argument %s.", argument.Data());
+    iResult=-EINVAL;
+  }
+
+  if ( !iResult ) {
+    fAnalysisJets = new AliHLTJETAnalysisJets();
+    fAnalysisJets->Initialize();
+  }
+  
+  return iResult;
+}
+
+// #################################################################################
+Int_t AliHLTJETAnalysisComponent::DoDeinit() {
+  // see header file for class documentation
+
+  if ( fAnalysisJets )
+    delete fAnalysisJets;
+  fAnalysisJets = NULL;
+
+  return 0;
+}
+
+// #################################################################################
+Int_t AliHLTJETAnalysisComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/,
+                                         AliHLTComponentTriggerData& /*trigData*/ ) {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  const TObject* iter = NULL;
+
+  // ------------------------------------------------
+  // -- DATA Event 
+  // ------------------------------------------------
+  if ( IsDataEvent() ) {
+
+    fAnalysisJets->ResetEvent();
+    
+    // -- Loop over jet objects
+    // ------------------------------
+    for ( iter=GetFirstInputObject(kAliHLTDataTypeJet|kAliHLTDataOriginHLT); 
+         iter != NULL && !iResult; iter=GetNextInputObject() ) {
+      
+      fAnalysisJets->SetJets(reinterpret_cast<AliHLTJETJets*>(const_cast<TObject*>(iter)));
+    }
+    
+    // -- ADD MC Object -- On-line
+    // ------------------------------
+    for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT); 
+         iter != NULL && !iResult; iter=GetNextInputObject() ) {
+      
+      fAnalysisJets->SetHLTMC(reinterpret_cast<AliHLTMCEvent*>(const_cast<TObject*>(iter)));
+    }
+        
+    // -- Process event
+    // ------------------
+    iResult = fAnalysisJets->Analyze();
+  }
+
+  // ------------------------------------------------
+  // -- DATA Event 
+  // ------------------------------------------------
+  else {
+    if ( GetFirstInputBlock(kAliHLTDataTypeEOR) ) {
+      PushBack(fAnalysisJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification());
+    }
+  }
+   
+  return iResult;
+}
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisComponent.h b/HLT/JET/analysis/AliHLTJETAnalysisComponent.h
new file mode 100644 (file)
index 0000000..4568fec
--- /dev/null
@@ -0,0 +1,137 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETAnalysisComponent.h  $
+
+#ifndef ALIHLTJETANALYSISCOMPONENT_H
+#define ALIHLTJETANALYSISCOMPONENT_H
+
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/** @file   AliHLTJETAnalysisComponent.h
+    @author Jochen Thaeder <thaeder@kip.uni-heidelberg.de>
+    @date   
+    @brief  Component to run the ConeJet jetfinder
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTProcessor.h"
+
+#include "AliHLTJETAnalysisJets.h"
+
+/**
+ * @class AliHLTJETAnalysisComponent
+ * Component to analyse jets produced by the HLT
+ *
+ * @ingroup alihlt_jet
+ */
+
+class AliHLTJETAnalysisComponent : public AliHLTProcessor {
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** constructor */
+  AliHLTJETAnalysisComponent();
+
+  /** destructor */
+  virtual ~AliHLTJETAnalysisComponent();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   * Public functions to implement AliHLTComponent's interface.
+   * These functions are required for the registration process
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** interface function, see @ref AliHLTComponent for description */
+  const Char_t* GetComponentID();
+
+  /** interface function, see @ref AliHLTComponent for description */
+  void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+
+  /** interface function, see @ref AliHLTComponent for description */
+  AliHLTComponentDataType GetOutputDataType();
+
+  /** interface function, see @ref AliHLTComponent for description */
+  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+
+  /** interface function, see @ref AliHLTComponent for description */
+  AliHLTComponent* Spawn();
+
+protected:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   * Protected functions to implement AliHLTComponent's interface.
+   * These functions provide initialization as well as the actual processing
+   * capabilities of the component. 
+   * ---------------------------------------------------------------------------------
+   */
+       
+  /** Initialization
+   * Overwrites the AliHLTProcessor::DoInit() method.  
+   * @param argc           size of the argument array
+   * @param argv           agument array for component initialization
+   * @return number of processed members of the argv <br>
+   *         -EINVAL unknown argument <br>
+   *         -EPROTO parameter for argument missing
+   */
+  Int_t DoInit( Int_t argc, const Char_t** argv );
+
+  /** DeInitialization 
+   * Calls also the one of AliHLTProcessor.
+   */
+  Int_t DoDeinit();
+  
+  /** EventLoop 
+   * Data processing method for the component.
+   * The component uses the @ref alihltcomponent-high-level-interface
+   * to retrieve and put serialized Root object into the output stream.
+   * @param evtData       event data structure
+   * @param trigData     trigger data structure
+   * @return
+   */
+  Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
+
+  using AliHLTProcessor::DoEvent;
+  
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+private:
+  /*
+   * ---------------------------------------------------------------------------------
+   * Private functions to implement AliHLTComponent's interface.
+   * These functions provide initialization as well as the actual processing
+   * capabilities of the component. 
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** copy constructor prohibited */
+  AliHLTJETAnalysisComponent(const AliHLTJETAnalysisComponent&);
+
+  /** assignment operator prohibited */
+  AliHLTJETAnalysisComponent& operator=(const AliHLTJETAnalysisComponent&);
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+  
+  AliHLTJETAnalysisJets       *fAnalysisJets;          //! transient
+
+  ClassDef(AliHLTJETAnalysisComponent, 0)
+    
+};
+#endif
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisJets.cxx b/HLT/JET/analysis/AliHLTJETAnalysisJets.cxx
new file mode 100644 (file)
index 0000000..199a7cf
--- /dev/null
@@ -0,0 +1,810 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETAnalysisJets.cxx  $
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* 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.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETAnalysisJets.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Container holding analysis objects
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "TH2F.h"
+
+#include "AliHLTJETAnalysisJets.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETAnalysisJets)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+AliHLTJETAnalysisJets::AliHLTJETAnalysisJets() :
+  fJets(NULL ),
+  fJetsMC(NULL ),
+  fMatchedJets(NULL),
+  fMatchedJetsMC(NULL),
+  fDeltaEt(NULL),
+  fDeltaEta(NULL),
+  fDeltaPhi(NULL),
+  fDeltaEtaDeltaPhi(NULL),
+  fSpectraEt(NULL),
+  fSpectraEta(NULL),
+  fSpectraPhi(NULL),
+  fCorrelationsJetEt(NULL),
+  fResolutionsJetEt(NULL),
+  fResolutionsDiJetEt(NULL) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+  
+}
+
+//##################################################################################
+AliHLTJETAnalysisJets::~AliHLTJETAnalysisJets() {
+  // see header file for class documentation
+
+  if ( fJetsMC )
+    delete fJetsMC;
+  fJetsMC = NULL;
+
+  if ( fMatchedJets )
+    delete fMatchedJets;
+  fMatchedJets = NULL;
+
+  if ( fMatchedJetsMC )
+    delete fMatchedJetsMC;
+  fMatchedJetsMC = NULL;
+
+  if ( fDeltaEt ) {
+    fDeltaEt->Clear();
+    delete fDeltaEt;
+  }
+  fDeltaEt = NULL;
+
+  if ( fDeltaEta ) {
+    fDeltaEta->Clear();
+    delete fDeltaEta;
+  }
+  fDeltaEta = NULL;
+
+  if ( fDeltaPhi ) {
+    fDeltaPhi->Clear();
+    delete fDeltaPhi;
+  }
+  fDeltaPhi = NULL;
+  
+  if ( fDeltaEtaDeltaPhi ) {
+    fDeltaEtaDeltaPhi->Clear();
+    delete fDeltaEtaDeltaPhi;
+  }
+  fDeltaEtaDeltaPhi = NULL;
+
+  if ( fSpectraEt ) {
+    fSpectraEt->Clear();
+    delete fSpectraEt;
+  }
+  fSpectraEt = NULL;
+
+  if ( fSpectraEta ) {
+    fSpectraEta->Clear();
+    delete fSpectraEta;
+  }
+  fSpectraEta = NULL;
+
+  if ( fSpectraPhi ) {
+    fSpectraPhi->Clear();
+    delete fSpectraPhi;
+  }
+  fSpectraPhi = NULL;
+
+  if ( fCorrelationsJetEt ) {
+    fCorrelationsJetEt->Clear();
+    delete fCorrelationsJetEt;   
+  }
+  fCorrelationsJetEt = NULL;
+
+  if ( fResolutionsJetEt ) {
+    fResolutionsJetEt->Clear();
+    delete fResolutionsJetEt;   
+  }
+  fResolutionsJetEt = NULL;
+
+  if ( fResolutionsDiJetEt ) {
+    fResolutionsDiJetEt->Clear();
+    delete fResolutionsDiJetEt;   
+  }
+  fResolutionsDiJetEt = NULL;
+
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                   Initialize / Reset
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETAnalysisJets::Initialize() {
+  // see header file for class documentation  
+
+  Int_t iResult = 0;
+
+  // -- Setup match arrays
+  fMatchedJets = new TArrayI(100);
+  fMatchedJetsMC = new TArrayI(100);
+
+  // -- Setup Delta histograms  
+  SetupDeltaHistograms();
+
+  // -- Setup Spectra histograms
+  SetupSpectraHistograms();
+
+  // -- Setup Matched histograms
+  SetupMatchedHistograms();
+
+  return iResult;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::ResetEvent() {
+  // see header file for class documentation  
+
+  if ( fJetsMC )
+    delete fJetsMC;
+  fJetsMC = NULL;
+
+  fJets = NULL;
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                Setter - public
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetHLTMC( AliHLTMCEvent* mcEvent ) {
+  // see header file for class documentation
+
+  // -- New MC jets 
+  if ( fJetsMC )
+    delete fJetsMC;
+  fJetsMC = new AliHLTJETJets();
+  
+  AliAODJet* jet = NULL;
+
+  while ( (jet = mcEvent->NextGenJet()) )
+    fJetsMC->AddJet(jet);
+
+  // -- Sort jets
+  fJetsMC->Sort();
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetMC( AliMCEvent* /*mcEvent*/ ) {
+  // see header file for class documentation
+
+  HLTFatal("No implemented!");
+  
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetJets( AliHLTJETJets* jets ) {
+  // see header file for class documentation
+
+  fJets = jets;
+
+  // -- Sort jets
+  fJets->Sort();
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                 Getter - public
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+TH1* AliHLTJETAnalysisJets::GetHistogram( Int_t histIdx, Int_t plotIdx ) {
+  // see header file for class documentation
+  
+  if ( histIdx >= AliHLTJETAnalysisBase::kHistMax ) {
+    HLTError("Histogram index out of bound : %d - max = %d", histIdx, AliHLTJETAnalysisBase::kHistMax );
+    return NULL; 
+  }
+  
+  TClonesArray *hist = NULL;
+  Int_t maxIdx = -1;
+  
+  switch (histIdx ) {
+  case AliHLTJETAnalysisBase::kHistDeltaEt : 
+    hist = fDeltaEt;
+    maxIdx = AliHLTJETAnalysisBase::kDeltaMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistDeltaEta : 
+    hist = fDeltaEta;
+    maxIdx = AliHLTJETAnalysisBase::kDeltaMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistDeltaPhi : 
+    hist = fDeltaPhi;
+    maxIdx = AliHLTJETAnalysisBase::kDeltaMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistDeltaEtaDeltaPhi : 
+    hist = fDeltaEtaDeltaPhi;
+    maxIdx = AliHLTJETAnalysisBase::kDeltaMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistSpectraEt :
+    hist = fSpectraEt;
+    maxIdx = AliHLTJETAnalysisBase::kSpectraMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistSpectraEta :
+    hist = fSpectraEta;
+    maxIdx = AliHLTJETAnalysisBase::kSpectraMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistSpectraPhi :
+    hist = fSpectraPhi;
+    maxIdx = AliHLTJETAnalysisBase::kSpectraMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistCorrelationsJetEt :
+    hist = fCorrelationsJetEt;
+    maxIdx = AliHLTJETAnalysisBase::kPlotMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistResolutionsJetEt :
+    hist = fResolutionsJetEt;
+    maxIdx = AliHLTJETAnalysisBase::kPlotMax;
+    break;
+  case AliHLTJETAnalysisBase::kHistResolutionsDiJetEt :
+    hist = fResolutionsDiJetEt;
+    maxIdx = AliHLTJETAnalysisBase::kPlotMax;
+    break;
+  }
+  // -- Check Boundaries
+  if ( plotIdx >= maxIdx ) {
+    HLTError("Index out of bound : %d - max = %d", plotIdx, maxIdx );
+    return NULL; 
+  }
+  else if ( maxIdx == -1 ) {
+    HLTError("Histogram index not found." );
+    return NULL; 
+  }
+
+  // -- Retrieve histogram
+  return reinterpret_cast<TH1*>((*hist)[plotIdx]);  
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                              Analysis - public
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETAnalysisJets::Analyze() {
+  // see header file for class documentation
+  
+  Int_t iResult = 0;
+
+  if ( !fJets ) {
+    HLTError("No input jets set.");
+    iResult = -1;
+  }
+  if ( !fJetsMC ) {
+    HLTError("No input MC jets set.");
+    iResult = -1;
+  }
+
+  if ( !iResult) {    
+    
+    // -- Fill unmatched jets into histograms
+    FillBasicSpectraHistograms();
+    FillUnmatchedDeltaHistograms();
+    
+    // -- Match jets
+    MatchJets();
+   
+    // -- Fill matched jets into histograms
+    FillMatchedDeltaHistograms();  
+    FillMatchedSpectraHistograms();  
+    FillMatchedHistograms();  
+  }
+
+  return iResult;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///                                                                                                              ///
+//////                                               PRIVATE                                                  //////
+///                                                                                                              ///
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Setup / Reset - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetupDeltaHistograms() {
+  // see header file for class documentation
+  
+  // ---------------------------------------------------
+  // -- Difference in reconstruction
+  //    All / Matched jets
+  // ---------------------------------------------------
+
+  fDeltaEt                 = new TClonesArray( "TH1F", AliHLTJETAnalysisBase::kDeltaMax );
+  fDeltaEta                = new TClonesArray( "TH1F", AliHLTJETAnalysisBase::kDeltaMax );
+  fDeltaPhi                = new TClonesArray( "TH1F", AliHLTJETAnalysisBase::kDeltaMax );
+  fDeltaEtaDeltaPhi        = new TClonesArray( "TH2F", AliHLTJETAnalysisBase::kDeltaMax );
+
+  for ( Int_t idx = 0; idx < AliHLTJETAnalysisBase::kDeltaMax; ++idx ) {
+
+    // -- Delta Et -------------------------------------------------
+    new ((*fDeltaEt)[idx]) TH1F(Form("delta E_{t} : %s", 
+                                    AliHLTJETAnalysisBase::fgkDeltaType[idx] ), 
+                               Form("#DeltaE_{t} : %s;#DeltaE_{t};dN/d#DeltaE_{t}", 
+                                    AliHLTJETAnalysisBase::fgkDeltaType[idx] ),
+                               100, -200., 200.);
+    SetupHist(reinterpret_cast<TH1F*>((*fDeltaEt)[idx]));
+        
+    // -- Delta Eta ------------------------------------------------
+    new ((*fDeltaEta)[idx]) TH1F(Form("delta Eta : %s", 
+                                     AliHLTJETAnalysisBase::fgkDeltaType[idx] ), 
+                                Form("#Delta#eta : %s;#Delta#eta;dN/d#Delta#eta", 
+                                     AliHLTJETAnalysisBase::fgkDeltaType[idx] ),
+                                100, -1.2, 1.2);
+    SetupHist(reinterpret_cast<TH1F*>((*fDeltaEta)[idx]));
+    
+    // -- Delta Phi ------------------------------------------------
+    new ((*fDeltaPhi )[idx]) TH1F(Form("delta Phi : %s", 
+                                      AliHLTJETAnalysisBase::fgkDeltaType[idx] ), 
+                                 Form("#Delta#phi : %s;#Delta #phi;dN/d#Delta#phi", 
+                                      AliHLTJETAnalysisBase::fgkDeltaType[idx] ), 
+                                 100, -7., 7.);
+    SetupHist(reinterpret_cast<TH1F*>((*fDeltaPhi)[idx]));
+    
+    // -- Delta Eta Delta Phi --------------------------------------
+    new ((*fDeltaEtaDeltaPhi) [idx] ) TH2F(Form("delta Eta delta Phi : %s", 
+                                               AliHLTJETAnalysisBase::fgkDeltaType[idx] ), 
+                                          Form("#Delta#eta #Delta#phi : %s;#Delta#eta;#Delta#phi", 
+                                               AliHLTJETAnalysisBase::fgkDeltaType[idx] ), 
+                                          100, -1.2, 1.2, 100, -7., 7.);
+    SetupHist(reinterpret_cast<TH2F*>((*fDeltaEtaDeltaPhi)[idx]));
+
+  } //  for ( Int_t idx = 0; idx < AliHLTJETAnalysisBase::kDeltaMax; ++idx ) {
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetupSpectraHistograms() {
+  // see header file for class documentation
+    
+  // ---------------------------------------------------
+  // -- Jet spectra
+  // ---------------------------------------------------
+
+  fSpectraEt  = new TClonesArray( "TH1F", AliHLTJETAnalysisBase::kSpectraMax );
+  fSpectraEta = new TClonesArray( "TH1F", AliHLTJETAnalysisBase::kSpectraMax );
+  fSpectraPhi = new TClonesArray( "TH1F", AliHLTJETAnalysisBase::kSpectraMax );
+
+  for ( Int_t idx = 0; idx < AliHLTJETAnalysisBase::kSpectraMax; ++idx ) {
+    
+    // -- Spectra Et -----------------------------------------------
+    new ((*fSpectraEt)[idx]) TH1F(Form("E_{t} : %s", 
+                                      AliHLTJETAnalysisBase::fgkSpectraType[idx] ), 
+                                 Form("E_{t} : %s;E_{t} (GeV/c);dN/dE_{t}", 
+                                      AliHLTJETAnalysisBase::fgkSpectraType[idx] ),
+                                 100, 0., 200.);
+    SetupHist(reinterpret_cast<TH1F*>((*fSpectraEt)[idx]));
+    
+    // -- Spectra Eta ----------------------------------------------
+    new ((*fSpectraEta)[idx]) TH1F(Form("#eta : %s", 
+                                       AliHLTJETAnalysisBase::fgkSpectraType[idx] ), 
+                                  Form("#eta : %s;#eta;dN/d#eta",
+                                       AliHLTJETAnalysisBase::fgkSpectraType[idx] ),
+                                  80, -0.9, 0.9);
+    SetupHist(reinterpret_cast<TH1F*>((*fSpectraEta)[idx]));
+    
+    // -- Spectra Phi ----------------------------------------------
+    new ((*fSpectraPhi)[idx]) TH1F(Form("#phi : %s", 
+                                       AliHLTJETAnalysisBase::fgkSpectraType[idx] ), 
+                                  Form("#phi : %s;#phi;dN/d#phi",
+                                       AliHLTJETAnalysisBase::fgkSpectraType[idx] ),
+                                  50, 0., 7.);
+    SetupHist(reinterpret_cast<TH1F*>((*fSpectraPhi)[idx]));
+    
+  } // for ( Int_t idx = 0; idx < AliHLTJETAnalysisBase::kSpectraMax; ++idx ) {
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetupMatchedHistograms() {
+  // see header file for class documentation
+  
+  // ---------------------------------------------------
+  // -- Correlations
+  // -- Resolutions
+  // ---------------------------------------------------
+  
+  fCorrelationsJetEt  = new TClonesArray( "TH2F", AliHLTJETAnalysisBase::kPlotMax );
+  fResolutionsJetEt   = new TClonesArray( "TH2F", AliHLTJETAnalysisBase::kPlotMax );
+  fResolutionsDiJetEt = new TClonesArray( "TH2F", AliHLTJETAnalysisBase::kPlotMax );
+
+  for ( Int_t idx = 0; idx < AliHLTJETAnalysisBase::kPlotMax; ++idx ) {
+
+    // -- Correlations ---------------------------------------------
+    new ((*fCorrelationsJetEt)[idx]) TH2F(Form("Correlations : %s", 
+                                              AliHLTJETAnalysisBase::fgkPlotType[idx] ), 
+                                         Form("Correlations : %s; E_{t,Pythia} (GeV/c); E_{t,Rec} (GeV/c)", 
+                                              AliHLTJETAnalysisBase::fgkPlotType[idx] ),
+                                         100, 0., 200.,100, 0., 200.);
+    SetupHist(reinterpret_cast<TH1F*>((*fCorrelationsJetEt)[idx]));
+    
+    // -- Jet Resolutions ------------------------------------------
+    new ((*fResolutionsJetEt)[idx]) TH2F(Form("Resolutions : %s", 
+                                             AliHLTJETAnalysisBase::fgkPlotType[idx] ), 
+                                        Form("Resolutions : %s; E_{t,Pythia} (GeV/c); f", 
+                                             AliHLTJETAnalysisBase::fgkPlotType[idx] ),
+                                        200, 0., 200.,200, -2., 2.);
+                                       
+    SetupHist(reinterpret_cast<TH1F*>((*fResolutionsJetEt)[idx]));
+
+    // -- Di-Jet Resolutions ---------------------------------------
+    new ((*fResolutionsDiJetEt)[idx]) TH2F(Form("Di Jet Resolutions : %s", 
+                                               AliHLTJETAnalysisBase::fgkPlotType[idx] ), 
+                                          Form("Di Jet Resolutions : %s; E_{t,Pythia} (GeV/c); f", 
+                                               AliHLTJETAnalysisBase::fgkPlotType[idx] ),
+                                          100, -200., 200.,100, -200., 200.);
+                                       
+    SetupHist(reinterpret_cast<TH1F*>((*fResolutionsDiJetEt)[idx]));
+
+  } // for ( Int_t idx = 0; idx < kJetPlotMax; ++idx ) {
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Analysis - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETAnalysisJets::MatchJets() {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  // -- Reset match arrays
+  Int_t maxNJets;
+  if ( fJets->GetNAODJets() > fJetsMC->GetNAODJets() )
+    maxNJets = fJets->GetNAODJets();
+  else
+    maxNJets = fJetsMC->GetNAODJets();
+
+  for ( Int_t idx = 0; idx < maxNJets; ++idx ) {
+    (*fMatchedJets)[idx] = -1;
+    (*fMatchedJetsMC)[idx] = -1;
+  }
+
+  // -- Match Jets - pythia fixed
+  for ( Int_t jetIterMC = 0; jetIterMC < fJetsMC->GetNAODJets(); ++jetIterMC ) {
+
+    Float_t minDistance2 = 100.;
+    Int_t idxClosest = -1;
+
+    for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+
+      // -- very Jet matched only once
+      if ( (*fMatchedJets)[jetIter] != -1 )
+       continue;
+                          
+      Float_t distance2 = GetDistance2( fJetsMC->GetJet(jetIterMC), 
+                                       fJets->GetJet(jetIter) );
+      
+      // -- Get Closest
+      if ( distance2 < minDistance2 ) {
+       minDistance2 = distance2;
+       idxClosest = jetIter;
+      }
+
+    } //     for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+    // -- Match found
+    if  ( minDistance2 < 10. ) {
+      (*fMatchedJetsMC)[jetIterMC] = idxClosest;
+      (*fMatchedJets)[idxClosest] = jetIterMC;
+    }
+
+  } //  for ( Int_t jetIterMC = 0; jetIterMC < fJetsMC->GetNAODJets(); ++jetIterMC ) {
+
+  return iResult;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                Fill - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisJets::FillBasicSpectraHistograms() {
+  // see header file for class documentation
+
+  // -- Fill basic MC spectras
+  // ---------------------------
+  for ( Int_t jetIter = 0; jetIter < fJetsMC->GetNAODJets(); ++jetIter ) {
+    FillHist(fSpectraEt, AliHLTJETAnalysisBase::kSpectraPythiaAll, fJetsMC->GetJet(jetIter)->Pt());
+    FillHist(fSpectraEta, AliHLTJETAnalysisBase::kSpectraPythiaAll, fJetsMC->GetJet(jetIter)->Eta());
+    FillHist(fSpectraPhi, AliHLTJETAnalysisBase::kSpectraPythiaAll, fJetsMC->GetJet(jetIter)->Phi());
+  } // for ( Int_t jetIter = 0; jetIter < fJetsMC->GetNAODJets(); ++jetIter ) {
+
+  // -- Fill basic Reco spectras
+  // -----------------------------
+  for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+    FillHist(fSpectraEt, AliHLTJETAnalysisBase::kSpectraRecoAll, fJets->GetJet(jetIter)->Pt());
+    FillHist(fSpectraEta, AliHLTJETAnalysisBase::kSpectraRecoAll, fJets->GetJet(jetIter)->Eta());
+    FillHist(fSpectraPhi, AliHLTJETAnalysisBase::kSpectraRecoAll, fJets->GetJet(jetIter)->Phi());
+  } // for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+
+  // -- Fill basic Reco leading spectras
+  // -------------------------------------
+  if ( fJets->GetNAODJets() > 0 ) {
+    FillHist(fSpectraEt, AliHLTJETAnalysisBase::kSpectraRecoLeadAll, fJets->GetJet(0)->Pt());
+    FillHist(fSpectraEta, AliHLTJETAnalysisBase::kSpectraRecoLeadAll, fJets->GetJet(0)->Eta());
+    FillHist(fSpectraPhi, AliHLTJETAnalysisBase::kSpectraRecoLeadAll, fJets->GetJet(0)->Phi());
+  } 
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::FillUnmatchedDeltaHistograms() {
+  // see header file for class documentation
+
+  for ( Int_t jetIterMC = 0; jetIterMC < fJetsMC->GetNAODJets(); ++jetIterMC ) {
+    AliAODJet *jetMC = fJetsMC->GetJet(jetIterMC);
+    
+    for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+      AliAODJet *jet = fJets->GetJet(jetIter);
+
+      FillHist(fDeltaEt, AliHLTJETAnalysisBase::kDeltaAll, jetMC->Pt()-jet->Pt());
+      FillHist(fDeltaEta, AliHLTJETAnalysisBase::kDeltaAll, jetMC->Eta()-jet->Eta());
+      FillHist(fDeltaPhi, AliHLTJETAnalysisBase::kDeltaAll, jetMC->Phi()-jet->Phi());
+      FillHist(fDeltaEtaDeltaPhi, AliHLTJETAnalysisBase::kDeltaAll,
+              jetMC->Eta()-jet->Eta(), jetMC->Phi()-jet->Phi());
+      
+    } // for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+  } // for ( Int_t jetIterMC = 0; jetIterMC < fJetsMC->GetNAODJets(); ++jetIterMC ) {
+
+  // -- Leading Jets
+  // -----------------
+  if ( fJets->GetNAODJets() > 0 && fJetsMC->GetNAODJets() > 0 ) {
+    AliAODJet *jetMC = fJetsMC->GetJet(0);
+    AliAODJet *jet = fJets->GetJet(0);
+
+    FillHist(fDeltaEt, AliHLTJETAnalysisBase::kDeltaLead, jetMC->Pt()-jet->Pt());
+    FillHist(fDeltaEta, AliHLTJETAnalysisBase::kDeltaLead, jetMC->Eta()-jet->Eta());
+    FillHist(fDeltaPhi, AliHLTJETAnalysisBase::kDeltaLead, jetMC->Phi()-jet->Phi());
+    FillHist(fDeltaEtaDeltaPhi, AliHLTJETAnalysisBase::kDeltaLead,
+            jetMC->Eta()-jet->Eta(), jetMC->Phi()-jet->Phi());
+  }
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::FillMatchedDeltaHistograms() {
+  // see header file for class documentation
+
+  for ( Int_t jetIterMC = 0; jetIterMC < fJetsMC->GetNAODJets(); ++jetIterMC ) {
+
+    // -- Not matched jet
+    if ( (*fMatchedJetsMC)[jetIterMC] == -1 )
+      continue;
+    
+    AliAODJet *jetMC = fJetsMC->GetJet(jetIterMC);
+    AliAODJet *jet = fJets->GetJet((*fMatchedJetsMC)[jetIterMC]);
+
+    FillHist(fDeltaEt, AliHLTJETAnalysisBase::kDeltaMatchedAll, jetMC->Pt()-jet->Pt());
+    FillHist(fDeltaEta, AliHLTJETAnalysisBase::kDeltaMatchedAll, jetMC->Eta()-jet->Eta());
+    FillHist(fDeltaPhi, AliHLTJETAnalysisBase::kDeltaMatchedAll, jetMC->Phi()-jet->Phi());
+    FillHist(fDeltaEtaDeltaPhi, AliHLTJETAnalysisBase::kDeltaMatchedAll,
+            jetMC->Eta()-jet->Eta(), jetMC->Phi()-jet->Phi());
+    
+  } // for ( Int_t jetIter = 0; jetIter < fJetsMC->GetNAODJets(); ++jetIter ) {
+  
+  // -- Leading Jets
+  // -----------------
+  if ((*fMatchedJetsMC)[0] != -1 ) {
+
+    AliAODJet *jetMC = fJetsMC->GetJet(0);
+    AliAODJet *jet = fJets->GetJet((*fMatchedJetsMC)[0]);
+    
+    FillHist(fDeltaEt, AliHLTJETAnalysisBase::kDeltaMatchedLead, jetMC->Pt()-jet->Pt());
+    FillHist(fDeltaEta, AliHLTJETAnalysisBase::kDeltaMatchedLead, jetMC->Eta()-jet->Eta());
+    FillHist(fDeltaPhi, AliHLTJETAnalysisBase::kDeltaMatchedLead, jetMC->Phi()-jet->Phi());
+    FillHist(fDeltaEtaDeltaPhi, AliHLTJETAnalysisBase::kDeltaMatchedLead,
+            jetMC->Eta()-jet->Eta(), jetMC->Phi()-jet->Phi());
+  }
+  
+  return;
+}
+//##################################################################################
+void AliHLTJETAnalysisJets::FillMatchedSpectraHistograms() {
+  // see header file for class documentation
+
+  Int_t idx = 0;
+
+  // -- Fill matched MC spectras
+  // ---------------------------
+  for ( Int_t jetIter = 0; jetIter < fJetsMC->GetNAODJets(); ++jetIter ) {
+    if ( (*fMatchedJetsMC)[jetIter] == -1 )
+      idx = AliHLTJETAnalysisBase::kSpectraPythiaUnmatched;
+    else
+      idx = AliHLTJETAnalysisBase::kSpectraPythiaMatched;
+
+    FillHist(fSpectraEt, idx, fJetsMC->GetJet(jetIter)->Pt());
+    FillHist(fSpectraEta, idx, fJetsMC->GetJet(jetIter)->Eta());
+    FillHist(fSpectraPhi, idx, fJetsMC->GetJet(jetIter)->Phi());
+  } // for ( Int_t jetIter = 0; jetIter < fJetsMC->GetNAODJets(); ++jetIter ) {
+
+  // -- Fill matched Reco spectras
+  // -----------------------------
+  for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+    if ( (*fMatchedJets)[jetIter] == -1 )
+      idx = AliHLTJETAnalysisBase::kSpectraRecoUnmatched;
+    else
+      idx = AliHLTJETAnalysisBase::kSpectraRecoMatched;
+    
+    FillHist(fSpectraEt, idx, fJets->GetJet(jetIter)->Pt());
+    FillHist(fSpectraEta, idx, fJets->GetJet(jetIter)->Eta());
+    FillHist(fSpectraPhi, idx, fJets->GetJet(jetIter)->Phi());
+  } // for ( Int_t jetIter = 0; jetIter < fJets->GetNAODJets(); ++jetIter ) {
+
+  // -- Fill matched Reco leading spectras
+  // -------------------------------------
+  if ( fJets->GetNAODJets() > 0 ) {
+    if ( (*fMatchedJets)[0] == -1 )
+      idx = AliHLTJETAnalysisBase::kSpectraRecoLeadUnmatched;
+    else
+      idx = AliHLTJETAnalysisBase::kSpectraRecoLeadMatched;
+
+    FillHist(fSpectraEt, idx, fJets->GetJet(0)->Pt());
+    FillHist(fSpectraEta, idx, fJets->GetJet(0)->Eta());
+    FillHist(fSpectraPhi, idx, fJets->GetJet(0)->Phi());
+  } 
+  
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::FillMatchedHistograms() {
+  // see header file for class documentation
+
+  for ( Int_t jetIterMC = 0; jetIterMC < fJetsMC->GetNAODJets(); ++jetIterMC ) {
+
+    // -- Not matched jet
+    if ( (*fMatchedJetsMC)[jetIterMC] == -1 )
+      continue;
+    
+    AliAODJet *jetMC = fJetsMC->GetJet(jetIterMC);
+    AliAODJet *jet = fJets->GetJet((*fMatchedJetsMC)[jetIterMC]);
+
+    // -- Correlations    
+    FillHist(fCorrelationsJetEt, AliHLTJETAnalysisBase::kPlotAll, jetMC->Pt(), jet->Pt());
+
+    // -- Resolutions
+    FillHist(fResolutionsJetEt, AliHLTJETAnalysisBase::kPlotAll, jetMC->Pt(),
+            (jetMC->Pt()-jet->Pt())/(jetMC->Pt()+jet->Pt()));
+
+  } // for ( Int_t jetIter = 0; jetIter < fJetsMC->GetNAODJets(); ++jetIter ) {
+  
+  // -- Leading Jets
+  // -----------------
+  if ((*fMatchedJetsMC)[0] != -1 ) {
+
+    AliAODJet *jetMC = fJetsMC->GetJet(0);
+    AliAODJet *jet = fJets->GetJet((*fMatchedJetsMC)[0]);
+    
+    // -- Correlations    
+    FillHist(fCorrelationsJetEt, AliHLTJETAnalysisBase::kPlotLead, jetMC->Pt(), jet->Pt());
+    
+    // -- Resolutions
+    FillHist(fResolutionsJetEt, AliHLTJETAnalysisBase::kPlotLead, jetMC->Pt(),
+            (jetMC->Pt()-jet->Pt())/(jetMC->Pt()+jet->Pt()));
+  }
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                               Helper - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisJets::SetupHist( TH1* hist ) {
+  // see header file for class documentation
+  
+  hist->GetXaxis()->CenterTitle();
+  hist->GetYaxis()->CenterTitle();
+  hist->SetMarkerStyle(kFullCircle);
+  //  hist->SetStats(kFALSE);
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::FillHist( TClonesArray* array, Int_t idx, Float_t valueX ) {
+    // see header file for class documentation
+  
+  reinterpret_cast<TH1F*>((*array)[idx])->Fill(valueX);
+  
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisJets::FillHist( TClonesArray* array, Int_t idx, Float_t valueX, Float_t valueY ) {
+  // see header file for class documentation
+  
+  reinterpret_cast<TH2F*>((*array)[idx])->Fill(valueX, valueY);
+  
+  return;
+}
+
+//################################################################################## 
+Float_t AliHLTJETAnalysisJets::GetDistance2( AliAODJet *jet1, AliAODJet *jet2 ) {
+  // see header file for class documentation
+  
+  return ( (jet1->Eta()-jet2->Eta())*(jet1->Eta()-jet2->Eta()) ) + 
+    ( (jet1->Phi()-jet2->Phi())*(jet1->Phi()-jet2->Phi()) );
+}
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisJets.h b/HLT/JET/analysis/AliHLTJETAnalysisJets.h
new file mode 100644 (file)
index 0000000..be6d49b
--- /dev/null
@@ -0,0 +1,304 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETAnalysisJets.h  $
+
+#ifndef ALIHLTJETANALYSISJETS_H
+#define ALIHLTJETANALYSISJETS_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETAnalysisJets.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Container holding analysis objects
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+//#include "TH1.h"
+//#include "TClonesArray.h"
+
+class TH1; 
+class TClonesArray; 
+
+class AliAODJet;
+class AliMCEvent;
+
+#include "AliHLTLogging.h"
+#include "AliHLTMCEvent.h"
+
+#include "AliHLTJETBase.h"
+#include "AliHLTJETJets.h"
+
+#include "AliHLTJETAnalysisBase.h"
+
+/**
+ * @class AliHLTJETAnalysisJets
+ * This class is a container which holds TClonesArrys of 
+ * histograms needed for the Jet Analysis.
+ *
+ * It need a ptr to MC information (pythia jets) and 
+ * reconstructed jets in the form of AliHLTJETJets.
+ *
+ * @ingroup alihlt_jet
+ * @ingroup alihlt_jet_analysis
+ */
+
+class AliHLTJETAnalysisJets : public TObject, public AliHLTLogging {
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Constructor */
+  AliHLTJETAnalysisJets();
+  
+  /** Destructor */
+  ~AliHLTJETAnalysisJets();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                         Initialize / Setup / Reset - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Setup analysis class 
+   *  @return 0 on success, <0 on failure
+   */
+  Int_t Initialize();
+
+  /** Reset input for current event */
+  void ResetEvent();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                Setter - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Set pythia jets in HLT environment
+   *  @param mcEvent    Ptr to AliHLTMCEvent
+   */
+  void SetHLTMC( AliHLTMCEvent* mcEvent );
+
+  /** Set pythia jets in Off-line environment
+   *  @param mcEvent    Ptr to AliMCEvent
+   */
+  void SetMC( AliMCEvent* mcEvent );
+
+  /** Set reconstructed jets
+   *  @param jets       Ptr to AliHLTJETJets
+   */
+  void SetJets( AliHLTJETJets* jets );
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                 Getter - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Returns histogram dependent of histogram type and plot type 
+   *  @param histIdx    histogram type (Ptr to TClonesArray),
+   *                    @see AliHLTJETAnalysisBase
+   *  @param plotIdx    plot type (Entry Idx in TClonesArray),
+   *                    @see AliHLTJETAnalysisBase
+   *  @return           Ptr to TH1 on success, NULL on failure
+   */
+  TH1* GetHistogram ( Int_t histIdx, Int_t plotIdx );
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                          Analysis - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Anlayze Data Set 
+   *  -Fill unmatched jets into histograms
+   *  -Match jets
+   *  -Fill matched jets into histograms
+   *  @return 0 on success, <0 on failure
+   */
+  Int_t Analyze();
+
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+ private:
+  /** copy constructor prohibited */
+  AliHLTJETAnalysisJets(const AliHLTJETAnalysisJets&);
+  
+  /** assignment operator prohibited */
+  AliHLTJETAnalysisJets& operator=(const AliHLTJETAnalysisJets&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Setup / Reset - private
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Setup Delta histograms */
+  void SetupDeltaHistograms();
+
+  /** Setup Spectra histograms */
+  void SetupSpectraHistograms();
+
+  /** Setup matched histograms */
+  void SetupMatchedHistograms();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Analysis - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Match Pythia and Reconstructed Jets  
+   *  @return 0 on success, <0 on failure
+   */
+  Int_t MatchJets();
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                Fill - private
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Fill basic Spectra histogram */
+  void FillBasicSpectraHistograms();
+
+  /** Fill unmatched Delta histogram */
+  void FillUnmatchedDeltaHistograms();
+
+  /** Fill matched Delta histogram */
+  void FillMatchedDeltaHistograms();
+
+  /** Fill matched Spectra histogram */
+  void FillMatchedSpectraHistograms();
+
+  /** Fill matched histogram */
+  void FillMatchedHistograms();
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                               Helper - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Setup histogram with common parameters 
+   *  @param hist    Ptr to histogram 
+   */
+  void SetupHist( TH1* hist );
+
+  /** Fill 1D histogram, in a TClonesArray
+   *  @param array   Ptr to TClonesArray of histograms
+   *  @param idx     Index in the TClonesArray
+   *  @param valueX  x value
+   */
+  void FillHist( TClonesArray* array, Int_t idx, Float_t valueX  );
+  
+  /** Fill 2D histogram, in a TClonesArray
+   *  @param array   Ptr to TClonesArray of histograms
+   *  @param idx     Index in the TClonesArray
+   *  @param valueX  x value
+   *  @param valueY  y value
+   */
+  void FillHist( TClonesArray* array, Int_t idx, Float_t valueX,Float_t valueY );
+  
+  /** Get Distance^2 in eta phi space of 2 jets
+   *  @param jet1    Ptr to jet 1
+   *  @param jet2    Ptr to jet 2
+   *  @return        Distance^2
+   */
+  Float_t GetDistance2( AliAODJet *jet1, AliAODJet *jet2); 
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  // ++ Data Members 
+  // ++
+  // ++-> replaced every event
+  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+  // ---------------------------------------------------
+  // -- Members filled per event
+  // ---------------------------------------------------
+
+  /** jets */
+  AliHLTJETJets *fJets;                          //! transient      
+
+  /** MC jets */
+  AliHLTJETJets *fJetsMC;                        //! transient      
+
+  /** Array of indices of the matched reconstructed jets */
+  TArrayI       *fMatchedJets;                   //! transient      
+
+  /** Array of indices of the matched MC jets */
+  TArrayI       *fMatchedJetsMC;                 //! transient      
+
+  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  // ++ Analysis Output 
+  // ++
+  // ++ -> Created once
+  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+  // ---------------------------------------------------
+  // -- Difference in reconstruction
+  // ---------------------------------------------------
+  
+  /** Matched Jets - delta Et */
+  TClonesArray  *fDeltaEt;                       // see above
+
+  /** Delta eta ( pythia - jetfinder ) */
+  TClonesArray  *fDeltaEta;                      // see above
+  
+  /** Delta phi ( pythia - jetfinder ) */
+  TClonesArray  *fDeltaPhi;                      // see above
+  
+  /** Delta eta, delta phi( pythia - jetfinder ) */
+  TClonesArray  *fDeltaEtaDeltaPhi;              // see above
+  
+  // ---------------------------------------------------
+  // -- Jet spectra
+  // ---------------------------------------------------
+  
+  /** Jet spectra in Et */
+  TClonesArray  *fSpectraEt;                     // see above
+
+  /** Jet spectra in eta */
+  TClonesArray  *fSpectraEta;                    // see above
+  
+  /** Jet spectra in phi */
+  TClonesArray  *fSpectraPhi;                    // see above
+           
+  // ---------------------------------------------------
+  // -- Correlations
+  // ---------------------------------------------------
+
+  /** Correleation pythia vs jet finder */
+  TClonesArray  *fCorrelationsJetEt;             // see above
+
+  // ---------------------------------------------------
+  // -- Resolutions
+  // ---------------------------------------------------
+  
+  /** Resolutions for Et for jetfinder - pythia fixed */
+  TClonesArray  *fResolutionsJetEt;              // see above
+
+  /** Resolutions for Et for jetfinder - nearside fixed */
+  TClonesArray  *fResolutionsDiJetEt;            // see above
+
+  ClassDef(AliHLTJETAnalysisJets, 2);
+};
+#endif
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisMerge.cxx b/HLT/JET/analysis/AliHLTJETAnalysisMerge.cxx
new file mode 100644 (file)
index 0000000..8ccce81
--- /dev/null
@@ -0,0 +1,376 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETAnalysisMerge.cxx  $
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* 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.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETAnalysisMerge.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Container merging analysis objects
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "TCanvas.h"
+#include "TH2F.h"
+
+#include "AliHLTJETJets.h"
+
+#include "AliHLTJETAnalysisMerge.h"
+#include "AliHLTJETAnalysisJets.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETAnalysisMerge)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+AliHLTJETAnalysisMerge::AliHLTJETAnalysisMerge() :
+  fCanvasArray(NULL),
+  fAnalysisJetsArray(NULL) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+  
+}
+
+//##################################################################################
+AliHLTJETAnalysisMerge::~AliHLTJETAnalysisMerge() {
+  // see header file for class documentation
+
+  if ( fCanvasArray ) {
+    fCanvasArray->Clear();
+    delete fCanvasArray;
+  }
+  fCanvasArray = NULL;
+
+  if ( fAnalysisJetsArray ) {
+    fAnalysisJetsArray->Clear();
+    delete fAnalysisJetsArray;
+  }
+  fAnalysisJetsArray = NULL;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                   Initialize / Reset
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETAnalysisMerge::Initialize() {
+  // see header file for class documentation  
+
+  Int_t iResult = 0;
+
+  fCanvasArray = new TObjArray();
+  fCanvasArray->SetOwner();
+
+  fAnalysisJetsArray = new TObjArray();
+
+  return iResult;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                Setter - public
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisMerge::AddJets( AliHLTJETAnalysisJets* jets ) {
+  // see header file for class documentation  
+
+  fAnalysisJetsArray->Add( jets );
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Output - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisMerge::CreateCanvas() {
+  // see header file for class documentation  
+
+  CreateCanvasSpectra();
+
+  CreateCanvasDelta();
+  
+  CreateCanvasMatched();
+
+  return;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///                                                                                                              ///
+//////                                               PRIVATE                                                  //////
+///                                                                                                              ///
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Output - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETAnalysisMerge::CreateCanvasSpectra() {
+  // see header file for class documentation  
+
+  TString canvasName = "JetSpectra";
+  
+  AliHLTJETAnalysisJets* jets = 
+    reinterpret_cast<AliHLTJETAnalysisJets*>((*fAnalysisJetsArray)[fAnalysisJetsArray->GetLast()]);     
+  
+  // -- Spectra E_t
+  // ----------------
+  TCanvas* canvas = AddCanvas( Form("E_{t} ")+canvasName, 3, 3 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoUnmatched),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 5, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 6, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadUnmatched),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 7, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 8, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 9, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEt, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaUnmatched),kTRUE, kFALSE);
+  
+  // -- Spectra eta
+  // ----------------
+  canvas = AddCanvas( Form("#eta ")+canvasName, 3, 3 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoUnmatched),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 5, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 6, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadUnmatched),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 7, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 8, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 9, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraEta, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaUnmatched),kTRUE, kFALSE);
+
+  // -- Spectra phi
+  // ----------------
+  canvas = AddCanvas( Form("#phi ")+canvasName, 3, 3);
+  
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoUnmatched),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 5, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 6, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraRecoLeadUnmatched),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 7, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 8, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaMatched),kTRUE, kFALSE);
+  DrawHistogram(canvas, 9, jets->GetHistogram(AliHLTJETAnalysisBase::kHistSpectraPhi, 
+                                             AliHLTJETAnalysisBase::kSpectraPythiaUnmatched),kTRUE, kFALSE);
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisMerge::CreateCanvasDelta() {
+  // see header file for class documentation  
+
+  TString canvasName = "JetDelta";
+  
+  AliHLTJETAnalysisJets* jets = 
+    reinterpret_cast<AliHLTJETAnalysisJets*>((*fAnalysisJetsArray)[fAnalysisJetsArray->GetLast()]);     
+  
+  // -- Delta E_t
+  // --------------
+  TCanvas* canvas = AddCanvas( Form("#DeltaE_{t} ")+canvasName, 2, 2 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEt, 
+                                             AliHLTJETAnalysisBase::kDeltaAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEt, 
+                                             AliHLTJETAnalysisBase::kDeltaMatchedAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEt, 
+                                             AliHLTJETAnalysisBase::kDeltaLead),kTRUE, kFALSE);
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEt, 
+                                             AliHLTJETAnalysisBase::kDeltaMatchedLead),kTRUE, kFALSE);
+
+  // -- Delta Eta
+  // --------------
+  canvas = AddCanvas( Form("#Delta#eta} ")+canvasName, 2, 2 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEta, 
+                                             AliHLTJETAnalysisBase::kDeltaAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEta, 
+                                             AliHLTJETAnalysisBase::kDeltaMatchedAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEta, 
+                                             AliHLTJETAnalysisBase::kDeltaLead),kTRUE, kFALSE);
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaEta, 
+                                             AliHLTJETAnalysisBase::kDeltaMatchedLead),kTRUE, kFALSE);
+
+  // -- Delta Phi
+  // --------------
+  canvas = AddCanvas( Form("#Delta#phi ")+canvasName, 2, 2 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaPhi, 
+                                             AliHLTJETAnalysisBase::kDeltaAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaPhi, 
+                                             AliHLTJETAnalysisBase::kDeltaMatchedAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaPhi, 
+                                             AliHLTJETAnalysisBase::kDeltaLead),kTRUE, kFALSE);
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistDeltaPhi, 
+                                             AliHLTJETAnalysisBase::kDeltaMatchedLead),kTRUE, kFALSE);
+
+  // -- Delta Eta Delta Phi
+  // ------------------------
+  canvas = AddCanvas( Form("#Delta#eta#Delta#phi ")+canvasName, 2, 2 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram( AliHLTJETAnalysisBase::kHistDeltaEtaDeltaPhi, 
+                                              AliHLTJETAnalysisBase::kDeltaAll ),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram( AliHLTJETAnalysisBase::kHistDeltaEtaDeltaPhi, 
+                                              AliHLTJETAnalysisBase::kDeltaMatchedAll ),kTRUE, kFALSE);
+  DrawHistogram(canvas, 3, jets->GetHistogram( AliHLTJETAnalysisBase::kHistDeltaEtaDeltaPhi, 
+                                              AliHLTJETAnalysisBase::kDeltaLead ),kTRUE, kFALSE);
+  DrawHistogram(canvas, 4, jets->GetHistogram( AliHLTJETAnalysisBase::kHistDeltaEtaDeltaPhi, 
+                                              AliHLTJETAnalysisBase::kDeltaMatchedLead ),kTRUE, kFALSE);
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETAnalysisMerge::CreateCanvasMatched() {
+  // see header file for class documentation  
+
+  TString canvasName = "JetMatched";
+  
+  AliHLTJETAnalysisJets* jets = 
+    reinterpret_cast<AliHLTJETAnalysisJets*>((*fAnalysisJetsArray)[fAnalysisJetsArray->GetLast()]);     
+  
+  // -- Resolutions
+  // ----------------
+  TCanvas* canvas = AddCanvas( Form("Correlations + Resolutions")+canvasName, 2, 3 );
+
+  DrawHistogram(canvas, 1, jets->GetHistogram(AliHLTJETAnalysisBase::kHistCorrelationsJetEt, 
+                                             AliHLTJETAnalysisBase::kPlotAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 2, jets->GetHistogram(AliHLTJETAnalysisBase::kHistCorrelationsJetEt, 
+                                             AliHLTJETAnalysisBase::kPlotLead),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 3, jets->GetHistogram(AliHLTJETAnalysisBase::kHistResolutionsJetEt,
+                                             AliHLTJETAnalysisBase::kPlotAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 4, jets->GetHistogram(AliHLTJETAnalysisBase::kHistResolutionsJetEt, 
+                                             AliHLTJETAnalysisBase::kPlotLead),kTRUE, kFALSE);
+
+  DrawHistogram(canvas, 5, jets->GetHistogram(AliHLTJETAnalysisBase::kHistResolutionsDiJetEt, 
+                                             AliHLTJETAnalysisBase::kPlotAll),kTRUE, kFALSE);
+  DrawHistogram(canvas, 6, jets->GetHistogram(AliHLTJETAnalysisBase::kHistResolutionsDiJetEt, 
+                                             AliHLTJETAnalysisBase::kPlotLead),kTRUE, kFALSE);
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                               Helper - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+TCanvas* AliHLTJETAnalysisMerge::AddCanvas( TString name, Int_t divideX=1, Int_t divideY=1 ) {
+  // see header file for class documentation
+
+  fCanvasArray->Add (new TCanvas(name, name, 10, 10, 1400, 800));
+  reinterpret_cast<TCanvas*>((*fCanvasArray)[fCanvasArray->GetLast()])->Divide(divideX,divideY);
+  
+  return reinterpret_cast<TCanvas*>((*fCanvasArray)[fCanvasArray->GetLast()]);
+}
+
+//##################################################################################
+void AliHLTJETAnalysisMerge::DrawHistogram( TCanvas* canvas, Int_t idx, TH1* hist, 
+                                           Bool_t bScale=kFALSE, Bool_t bLogY=kFALSE) {
+  // see header file for class documentation
+
+  if ( hist == NULL )
+    return;
+
+  TVirtualPad* pad = canvas->cd(idx);
+  
+  if ( bScale ) 
+    hist->Scale( 1./hist->GetBinWidth(0) );
+  
+  if ( bLogY && hist->GetEntries() != 0 )
+    pad->SetLogy();
+  
+  pad->SetGridy();
+  pad->SetGridx();
+  
+  if ( !strcmp(hist->ClassName(),"TH2F") )
+    hist->Draw("COLZ");
+  else 
+    hist->Draw("");
+  
+  return;
+}
diff --git a/HLT/JET/analysis/AliHLTJETAnalysisMerge.h b/HLT/JET/analysis/AliHLTJETAnalysisMerge.h
new file mode 100644 (file)
index 0000000..e801232
--- /dev/null
@@ -0,0 +1,161 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETAnalysisMerge.h  $
+
+#ifndef ALIHLTJETANALYSISMERGE_H
+#define ALIHLTJETANALYSISMERGE_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETAnalysisMerge.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Container merging analysis objects
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+
+#include "AliHLTLogging.h"
+
+#include "AliHLTJETAnalysisBase.h"
+#include "AliHLTJETAnalysisJets.h"
+
+class TH1;
+class TCanvas;
+class TObjArray;
+
+class AliHLTJETJets;
+
+
+/**
+ * @class AliHLTJETAnalysisMerge
+ * This class merges analysis objects oft the type
+ * AliHLTJETAnalysisJets. It takes care of the plotting.
+ *
+ * @ingroup alihlt_jet
+ * @ingroup alihlt_jet_analysis
+ */
+
+class AliHLTJETAnalysisMerge : public TObject, public AliHLTLogging {
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Constructor */
+  AliHLTJETAnalysisMerge();
+  
+  /** Destructor */
+  ~AliHLTJETAnalysisMerge();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                         Initialize / Setup / Reset - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Initialize class and members */
+  Int_t Initialize();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                Setter - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Add analysis histogram object to list of AliHLTJETAnalysisJets
+   * param jets  Ptr to AliHLTJETAnalysisJets
+   */
+  void AddJets( AliHLTJETAnalysisJets* jets );
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                 Getter - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Get List of canvases */
+  TObjArray* GetCanvasList() const { return fCanvasArray; }
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Output - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Create all Canvases */
+  void CreateCanvas();
+  
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+ private:
+  /** copy constructor prohibited */
+  AliHLTJETAnalysisMerge(const AliHLTJETAnalysisMerge&);
+  
+  /** assignment operator prohibited */
+  AliHLTJETAnalysisMerge& operator=(const AliHLTJETAnalysisMerge&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Output - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Create canvas for spectra histograms */
+  void CreateCanvasSpectra();
+
+  /** Create canvas for delta histograms */
+  void CreateCanvasDelta();
+
+  /** Create canvas for matched histograms */
+  void CreateCanvasMatched();
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                               Helper - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Add a new canvas to the canvas list
+   *  @param name     Name of the canvas
+   *  @param divideX  Number of columns of histograms
+   *  @param divideY  Number of lines of histograms
+   *  @return         Ptr to new created canvas
+   */
+  TCanvas* AddCanvas( TString name, Int_t divideX, Int_t divideY ); 
+
+  /** Draw a histogram
+   *  @param canvas  Ptr to canvas, to be drawn in.
+   *  @param idx     Pad index in the canvas
+   *  @param hist    Ptr to histogram
+   *  @param bScale  If hist should be scaled 
+   *  @param bLogY   If hist Y-axis should be logarithmic 
+   */
+  void DrawHistogram( TCanvas* canvas, Int_t idx, TH1* hist, Bool_t bScale, Bool_t bLogY);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** List of canvases */ 
+  TObjArray *fCanvasArray;            //! transient
+
+  /** List of AliHLTJETAnalysisJets objects */
+  TObjArray *fAnalysisJetsArray;      //! transient
+
+  ClassDef(AliHLTJETAnalysisMerge, 2);
+};
+#endif