]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added this pointer to special constructor, first version of esd to flat conversion...
authorsgweber <steffen.georg.weber@cern.ch>
Tue, 5 Aug 2014 11:53:40 +0000 (13:53 +0200)
committersgweber <steffen.georg.weber@cern.ch>
Tue, 5 Aug 2014 11:53:40 +0000 (13:53 +0200)
12 files changed:
ANALYSIS/AliAnalysisTaskPt.cxx [deleted file]
ANALYSIS/AliAnalysisTaskPt.h [deleted file]
HLT/CMakelibAliHLTGlobal.pkg
HLT/global/AliFlatESDEvent.h
HLT/global/AliFlatESDTrack.h
HLT/global/AliFlatESDV0.h
HLT/global/AliFlatESDVertex.h
HLT/global/AliFlatExternalTrackParam.h
HLT/global/AliFlatTPCCluster.h
HLT/global/AliHLTGlobalAgent.cxx
HLT/global/AliHLTGlobalEsdToFlatConverterComponent.cxx [new file with mode: 0644]
HLT/global/AliHLTGlobalEsdToFlatConverterComponent.h [new file with mode: 0644]

diff --git a/ANALYSIS/AliAnalysisTaskPt.cxx b/ANALYSIS/AliAnalysisTaskPt.cxx
deleted file mode 100644 (file)
index 3f67553..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-#include "TChain.h"
-#include "TTree.h"
-#include "TH1F.h"
-#include "TCanvas.h"
-#include "TObjArray.h"
-
-#include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-
-#include "AliESDEvent.h"
-#include "AliVVevent.h"
-#include "AliVVtrack.h"
-#include "AliESDtrackCuts.h"
-#include "AliVEventHandler.h"
-#include "../TPC/Rec/AliTPCseed.h"
-#include "../TPC/Rec/AliTPCclusterMI.h"
-
-#include "AliAnalysisTaskPt.h"
-
-// example of an analysis task creating a p_t spectrum
-// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing
-
-ClassImp(AliAnalysisTaskPt)
-
-//________________________________________________________________________
-AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name) 
-: AliAnalysisTask(name, ""), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0)
-{
-  // Constructor
-
-  // Define input and output slots here
-  // Input slot #0 works with a TChain
-  DefineInput(0, TChain::Class());
-  // Output slot #0 writes into a TH1 container
-  DefineOutput(0, TList::Class());
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskPt::ConnectInputData(Option_t *) 
-{
-  // Connect ESD or AOD here
-  // Called once
-
-  printf("----> AliAnalysisTaskPt::ConnectInputData\n");
-  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
-  if (!tree) {
-    Printf("ERROR: Could not read chain from input slot 0");
-  } else {
-    // Disable all branches and enable only the needed ones
-    // The next two lines are different when data produced as AliESDEvent is read
-    /*
-    tree->SetBranchStatus("*", kFALSE);
-    tree->SetBranchStatus("fTracks.*", kTRUE);
-    */
-
-    AliVEventHandler *esdH = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
-
-    if (!esdH) {
-      Printf("ERROR: Could not get ESDInputHandler");
-    } else {
-      Printf("----> AliAnalysisTaskPt::ConnectInputData Getting the event from handler %p", esdH);
-      //fESD = dynamic_cast<AliESDEvent*>(esdH->GetEvent());
-      fESD = esdH->GetEvent();
-      fESDfriend = esdH->GetFriendEvent();
-    }
-    if (!fESD) {
-      Printf("ERROR, no ESD event");
-    }
-    if (!fESDfriend) {
-      Printf("ERROR, no ESD friend");
-    }
-  }
-
-  Printf("fESD = %p, fESDfriend = %p", fESD, fESDfriend);
-  printf("<---- AliAnalysisTaskPt::ConnectInputData\n");
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskPt::CreateOutputObjects()
-{
-  // Create histograms
-  // Called once
-
-  fListOut = new TList();
-  fListOut->SetOwner();
-  fListOut->SetName("listHistos");
-
-  fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
-  fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
-  fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
-  fHistPt->SetMarkerStyle(kFullCircle);
-
-  fHistQ = new TH1F("fHistQ", "TPC clusters: Q distribution", 1000, 0, 10000);
-  fHistQ->GetXaxis()->SetTitle("Q");
-  fHistQ->GetYaxis()->SetTitle("dN/dQ");
-  fHistQ->SetMarkerStyle(kFullCircle);
-
-  fListOut->Add(fHistPt);
-  fListOut->Add(fHistQ);
-
-  PostData(0, fListOut);
-
-  fCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(1);
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskPt::Exec(Option_t *) 
-{
-  // Main loop
-  // Called for each event
-
-  if (!fESD) {
-    Printf("ERROR: fESD not available");
-    return;
-  }
-  if (!fESDfriend) {
-    Printf("ERROR: fESDfriend not available");
-    return;
-  }
-
-  Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
-  Printf("... and there are %d friends in this event", fESDfriend->GetNumberOfTracks());
-
-  // Track loop to fill a pT spectrum
-  for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
-    AliVVtrack* track = fESD->GetTrack(iTracks);
-    if (!track) {
-      Printf("ERROR: Could not receive track %d", iTracks);
-      continue;
-    }
-
-    fHistPt->Fill(track->Pt());
-  } //track loop 
-
-
-  // Friend Track loop
-  for (Int_t iFriend = 0; iFriend < fESDfriend->GetNumberOfTracks(); iFriend++) {
-    AliESDfriendTrack* friendTrack = fESDfriend->GetTrack(iFriend);
-    if (!friendTrack) {
-      Printf("ERROR: Could not receive track %d", iFriend);
-      continue;
-    } 
-    TObject* calibObject;
-    AliTPCseed* seed = NULL;
-    for (Int_t idx = 0; (calibObject = friendTrack->GetCalibObject(idx)); ++idx) {
-      Printf(" |Cal %d = %p", idx, calibObject); 
-      if ((seed = dynamic_cast<AliTPCseed*>(calibObject))) {
-       Printf("Found TPC seed");
-       for (Int_t irow = 0; irow < 160; irow++){
-         AliTPCclusterMI* cluMI = seed->GetClusterPointer(irow);
-         if (cluMI){
-           Printf("Found cluster at row %d", irow);
-           Float_t q = cluMI->GetQ();
-           Printf("Q = %f", q);
-           fHistQ->Fill(q);
-         }
-         else {
-           Printf("Row %d does not contain clusters", irow);
-         }
-       }        
-      }
-    }    
-  }
-
-  // Post output data.
-  PostData(0, fListOut);
-  fEv++;
-}      
-
-//________________________________________________________________________
-void AliAnalysisTaskPt::Terminate(Option_t *) 
-{
-  // Draw result to the screen
-  // Called once at the end of the query
-
-  Printf("Terminate called: fESD = %p", fESD);
-
-  fListOut = dynamic_cast<TList*> (GetOutputData(0)); 
-
-  if (fListOut) {
-    fHistPt = dynamic_cast<TH1F*>(fListOut->FindObject("fHistPt")); 
-    if (!fHistPt) {
-      Printf("ERROR: fHistPt not available");
-      return;
-    }
-   
-    TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","Pt",10,10,510,510);
-    c1->cd(1)->SetLogy();
-    fHistPt->DrawCopy("E");
-  }
-  else {
-    Printf("In Terminate: no TList found");
-  }
-
-}
diff --git a/ANALYSIS/AliAnalysisTaskPt.h b/ANALYSIS/AliAnalysisTaskPt.h
deleted file mode 100644 (file)
index 153b1a2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef AliAnalysisTaskPt_cxx
-#define AliAnalysisTaskPt_cxx
-
-// example of an analysis task creating a p_t spectrum
-// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing
-
-class TH1F;
-class AliESDEvent;
-class AliESDfriend;
-class AliVVevent;
-class AliESDtrackCuts;
-class TList;
-
-#include "AliAnalysisTask.h"
-
-class AliAnalysisTaskPt : public AliAnalysisTask {
- public:
- AliAnalysisTaskPt() : AliAnalysisTask(), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0) {}
-  AliAnalysisTaskPt(const char *name);
-  virtual ~AliAnalysisTaskPt() {}
-  
-  virtual void   ConnectInputData(Option_t *);
-  virtual void   CreateOutputObjects();
-  virtual void   Exec(Option_t *option);
-  virtual void   Terminate(Option_t *);
-
- private:
-  AliVVevent*       fESD;          // ESD object
-  AliESDfriend*     fESDfriend;    // ESD friend object
-  TH1F*             fHistPt;       // Pt spectrum
-  AliESDtrackCuts*  fCuts;         // cuts
-  Int_t fEv;
-  TH1F*             fHistQ;        // TPC clusters Q spectrum
-  TList*            fListOut;      // output list
-
-  AliAnalysisTaskPt(const AliAnalysisTaskPt&); // not implemented
-  AliAnalysisTaskPt& operator=(const AliAnalysisTaskPt&); // not implemented
-  
-  ClassDef(AliAnalysisTaskPt, 1); // example of analysis
-};
-
-#endif
index 7fe4232f34cb21321d393bc1dbc3befc4604e7f6..a384db1ecb5d921aa9f19eefe876e57b897eea86 100644 (file)
@@ -30,6 +30,7 @@
 set ( CLASS_HDRS
     AliHLTGlobalFlatEsdTestComponent.h
     AliHLTGlobalFlatEsdConverterComponent.h
+    AliHLTGlobalEsdToFlatConverterComponent.h
     AliHLTGlobalEsdConverterComponent.h
     AliHLTGlobalTrackMergerComponent.h
     AliHLTGlobalTrackMerger.h
index 4f276bf5ced82b821d930143aad24acb74fd6c25..c677a68709af524688c09ae945c4d1c715587762 100644 (file)
@@ -129,7 +129,16 @@ void Reinitialize();
 // special constructor, to be called by placement new,
 // when accessing information after reinterpret_cast
 // so that vtable is generated, but values are not overwritten
-       AliFlatESDEvent(AliFlatESDSpecialConstructorFlag){}
+       AliFlatESDEvent(AliFlatESDSpecialConstructorFlag):
+  fPrimaryVertexMask(this->fPrimaryVertexMask),
+  fNTracks(this->fNTracks),
+  fTracksPointer(this->fTracksPointer),
+  fNV0s(this->fNV0s),
+  fV0Pointer(this->fV0Pointer),
+  fSize(this->fSize)
+{
+}
+
 
   void FillPrimaryVertex(const AliESDVertex *v, Byte_t flag);
   Int_t FillNextTrack( const AliESDtrack* esdTrack,  AliESDfriendTrack* friendTrack);
index 89f3bb4dbcbb6a69e2f61e641e6d90f1aa1af5ff..42d3ed2a90721a093f3f380b8e32ad2e4059be49 100644 (file)
@@ -127,7 +127,14 @@ class AliFlatESDTrack: public AliVVtrack {
  private:
   AliFlatESDTrack(const AliFlatESDTrack&);
   AliFlatESDTrack& operator=(const AliFlatESDTrack&);  
-  AliFlatESDTrack(AliFlatESDSpecialConstructorFlag){}
+  AliFlatESDTrack(AliFlatESDSpecialConstructorFlag):
+  // Default constructor
+  fTrackParamMask(this->fTrackParamMask),
+  fNTPCClusters(this->fNTPCClusters),
+  fNITSClusters(this->fNITSClusters),
+  fSize(this->fSize) {
+
+}
 
   Int_t FillExternalTrackParam(const AliExternalTrackParam* param, UShort_t flag);
 
index 91d19ec4ad088e75e49ada323ee7ac9ccfab799f..4f4130512d7741c0ae115324ed5647a6bc2dfc91 100644 (file)
@@ -24,7 +24,8 @@ class AliFlatESDV0: public AliVVv0
   Int_t fNegTrackID;
   Int_t fPosTrackID;
  private:
-       AliFlatESDV0(AliFlatESDSpecialConstructorFlag){}
+AliFlatESDV0(AliFlatESDSpecialConstructorFlag)
+ : fNegTrackID(this->fNegTrackID), fPosTrackID(this->fPosTrackID){}
 };
 //typedef struct AliFlatESDV0 AliFlatESDV0;
 
index c49130ca0893a2b37fb12923211a304b270cad44..9048f091f3c5b6a7625ea939a812b04d5350f491 100644 (file)
@@ -100,7 +100,8 @@ class AliFlatESDVertex: public AliVVvertex
 
  private:
   
-       AliFlatESDVertex(AliFlatESDSpecialConstructorFlag){}
+       AliFlatESDVertex(AliFlatESDSpecialConstructorFlag)
+       :fNContributors(this->fNContributors), fChi2(this->fChi2){}
 };
 
 #endif
index 3ec69cc7bba7c9fc6cb68918090f45f06555097b..ae4df80ae8faa752c319896561247c8197e6ba29 100644 (file)
 class AliFlatExternalTrackParam: public AliVVexternalTrackParam
 {
  public:
-  AliFlatExternalTrackParam() {}
+  AliFlatExternalTrackParam()  
+       : fAlpha(0.), fX(0.), fY(0.), fZ(0.), fSnp(0.), fTgl(0.), fSigned1Pt(0.) {
+    for( int i=0; i<15; i++) fC[i] = 0;
+       }
   virtual ~AliFlatExternalTrackParam() {}
   Float_t fAlpha;     // azimuthal angle of reference frame
   Float_t fX;         // x: radial distance
@@ -52,7 +55,8 @@ class AliFlatExternalTrackParam: public AliVVexternalTrackParam
   Float_t  GetCovEntry(Int_t idx) const {return (idx >= 0 && idx < 15) ? fC[idx] : 0.;}
   
  private:
-       AliFlatExternalTrackParam(AliFlatESDSpecialConstructorFlag){}
+       AliFlatExternalTrackParam(AliFlatESDSpecialConstructorFlag)
+       : fAlpha(this->fAlpha), fX(this->fX), fY(this->fY), fZ(this->fZ), fSnp(this->fSnp), fTgl(this->fTgl), fSigned1Pt(this->fSigned1Pt) {}
 };
 
 //typedef struct AliFlatExternalTrackParam AliFlatExternalTrackParam;
index 843bab5755ab70e92d5aad62c08ff1818e537c30..457a6c4b13fd5cd48a16eff0ad7eb1bc6d8722e9 100644 (file)
@@ -49,7 +49,8 @@ class AliFlatTPCCluster: public AliVVcluster
   }
   
   private:
-  AliFlatTPCCluster(AliFlatESDSpecialConstructorFlag){}
+  AliFlatTPCCluster(AliFlatESDSpecialConstructorFlag)
+  : fX(this->fX), fY(this->fY), fZ(this->fZ), fPadRow(this->fPadRow), fSigmaY2(this->fSigmaY2), fSigmaZ2(this->fSigmaZ2), fCharge(this->fCharge), fQMax(this->fQMax) {}
   virtual ~AliFlatTPCCluster() {}
   Float_t fX;       // X coordinate in local coordinates
   Float_t fY;       // Y coordinate in local coordinates
index 5892289161f92b86106918c52281220d69e6655f..8ae292bf249d2bd327e8460bf46cc41db2b1af51 100644 (file)
@@ -31,6 +31,7 @@
 
 // header files of library components
 #include "AliHLTGlobalTrackMergerComponent.h"
+//#include "AliHLTGlobalEsdToFlatConverterComponent.h"
 #include "AliHLTGlobalFlatEsdConverterComponent.h"
 #include "AliHLTGlobalEsdConverterComponent.h"
 #include "AliHLTGlobalVertexerComponent.h"
@@ -77,6 +78,7 @@ int AliHLTGlobalAgent::RegisterComponents(AliHLTComponentHandler* pHandler) cons
   // see header file for class documentation
   assert(pHandler);
   if (!pHandler) return -EINVAL;
+  //pHandler->AddComponent(new AliHLTGlobalEsdToFlatConverterComponent);
   pHandler->AddComponent(new AliHLTGlobalFlatEsdTestComponent);
   pHandler->AddComponent(new AliHLTGlobalTrackMergerComponent);
   pHandler->AddComponent(new AliHLTGlobalFlatEsdConverterComponent);
@@ -166,6 +168,7 @@ int AliHLTGlobalAgent::CreateConfigurations(AliHLTConfigurationHandler* pHandler
   pHandler->CreateConfiguration("GLOBAL-flat-esd-converter", "GlobalFlatEsdConverter", esdInputs.Data(), "");
   pHandler->CreateConfiguration("GLOBAL-esd-converter", "GlobalEsdConverter", esdInputs.Data(), "");
   pHandler->CreateConfiguration("GLOBAL-flat-esd-test", "GlobalFlatEsdTest", "GLOBAL-esd-converter GLOBAL-flat-esd-converter", "");
+  //pHandler->CreateConfiguration("esd-to-flat-conversion", "GlobalEsdToFlatConverter", "GLOBAL-esd-converter", "");
 
   ///////////////////////////////////////////////////////////////////////////////////////////////////
   //
diff --git a/HLT/global/AliHLTGlobalEsdToFlatConverterComponent.cxx b/HLT/global/AliHLTGlobalEsdToFlatConverterComponent.cxx
new file mode 100644 (file)
index 0000000..a3e8a51
--- /dev/null
@@ -0,0 +1,335 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTGlobalEsdToFlatConverterComponent.cxx $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Steffen Weber                                         *
+ *                                                                        *
+ * 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    AliHLTGlobalEsdToFlatConverterComponent.cxx
+    @author  Steffen Weber
+    @brief   Component to convert ESD objects to flatESD objects
+*/
+
+#include "TMap.h"
+#include "TSystem.h"
+#include "TTimeStamp.h"
+#include "TObjString.h"
+#include "TList.h"
+#include "AliESDEvent.h"
+#include "AliFlatESDEvent.h"
+#include "AliHLTErrorGuard.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTGlobalEsdToFlatConverterComponent.h"
+#include "AliHLTITSClusterDataFormat.h"
+#include "AliHLTTPCDefinitions.h"
+#include "TTree.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+
+using namespace std;
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTGlobalEsdToFlatConverterComponent)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+AliHLTGlobalEsdToFlatConverterComponent::AliHLTGlobalEsdToFlatConverterComponent() :
+  AliHLTProcessor()
+  {
+  // an example component which implements the ALICE HLT processor
+  // interface and does some analysis on the input raw data
+  //
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+  //
+  // NOTE: all helper classes should be instantiated in DoInit()
+}
+
+// #################################################################################
+AliHLTGlobalEsdToFlatConverterComponent::~AliHLTGlobalEsdToFlatConverterComponent() {
+  // see header file for class documentation
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Public functions to implement AliHLTComponent's interface.
+ * These functions are required for the registration process
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+const Char_t* AliHLTGlobalEsdToFlatConverterComponent::GetComponentID() { 
+  // see header file for class documentation
+  return "GlobalEsdToFlatConverster";
+}
+
+// #################################################################################
+void AliHLTGlobalEsdToFlatConverterComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
+  // see header file for class documentation
+  list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut);
+  list.push_back( kAliHLTDataTypeESDfriendObject|kAliHLTDataOriginOut );
+}
+
+// #################################################################################
+AliHLTComponentDataType AliHLTGlobalEsdToFlatConverterComponent::GetOutputDataType() {
+  // see header file for class documentation
+  return kAliHLTDataTypeFlatESD|kAliHLTDataOriginOut;
+}
+
+// #################################################################################
+void AliHLTGlobalEsdToFlatConverterComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
+  // see header file for class documentation
+  constBase = 100000;
+  inputMultiplier = 1.0;
+}
+
+
+// #################################################################################
+AliHLTComponent* AliHLTGlobalEsdToFlatConverterComponent::Spawn() {
+  // see header file for class documentation
+  return new AliHLTGlobalEsdToFlatConverterComponent;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Protected functions to implement AliHLTComponent's interface.
+ * These functions provide initialization as well as the actual processing
+ * capabilities of the component. 
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTGlobalEsdToFlatConverterComponent::DoInit( Int_t argc, const Char_t** argv ) {
+  // see header file for class documentation
+  printf("AliHLTGlobalEsdToFlatConverterComponent::DoInit\n");
+  // see header file for class documentation
+  int iResult=0;
+  TString argument="";
+  int bMissingParam=0;
+
+  // default list of skiped ESD objects
+  TString skipObjects=
+    // "AliESDRun,"
+    // "AliESDHeader,"
+    // "AliESDZDC,"
+    "AliESDFMD,"
+    // "AliESDVZERO,"
+    // "AliESDTZERO,"
+    // "TPCVertex,"
+    // "SPDVertex,"
+    // "PrimaryVertex,"
+    // "AliMultiplicity,"
+    // "PHOSTrigger,"
+    // "EMCALTrigger,"
+    // "SPDPileupVertices,"
+    // "TrkPileupVertices,"
+    "Cascades,"
+    "Kinks,"
+    "AliRawDataErrorLogs,"
+    "AliESDACORDE";
+
+  iResult=Reconfigure(NULL, NULL);
+  TString allArgs = "";
+  for ( int i = 0; i < argc; i++ ) {
+    if ( !allArgs.IsNull() ) allArgs += " ";
+    allArgs += argv[i];
+  }
+
+  TObjArray* pTokens=allArgs.Tokenize(" ");
+  if (pTokens) {
+    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->String();        
+      if (argument.IsNull()) continue;
+ if (argument.Contains("-skipobject=")) {
+       argument.ReplaceAll("-skipobject=", "");
+       skipObjects=argument;
+      } else {
+       HLTError("unknown argument %s", argument.Data());
+       iResult=-EINVAL;
+       break;
+      }
+    }
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+
+
+  if (iResult>=0) {
+    SetupCTPData();
+  }
+
+  return iResult;
+}
+
+
+
+// #################################################################################
+Int_t AliHLTGlobalEsdToFlatConverterComponent::DoDeinit() {
+  // see header file for class documentation
+
+       
+  return 0;
+}
+
+// #################################################################################
+Int_t AliHLTGlobalEsdToFlatConverterComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
+                                                   const AliHLTComponentBlockData* /*blocks*/, 
+                                                   AliHLTComponentTriggerData& /*trigData*/,
+                                                   AliHLTUInt8_t* outputPtr, 
+                                                   AliHLTUInt32_t& size,
+                                                   AliHLTComponentBlockDataList& outputBlocks) {
+  // see header file for class documentation
+
+  printf("AliHLTGlobalEsdToFlatConverterComponent::DoEvent\n");
+  Int_t iResult=0;
+
+  // -- Only use data event
+  if (!IsDataEvent()) 
+    return 0;
+  
+  const AliESDEvent *esd;
+  
+  for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject | kAliHLTDataOriginOut); iter != NULL; iter = GetNextInputObject() ) {
+    cout<<"Found ESD in esd test component !!!"<<endl;
+    esd = dynamic_cast<const AliESDEvent*>(iter);
+    if( esd ){
+      cout<<"N ESD tracks: "<<esd->GetNumberOfTracks()<<endl;
+                       iResult=1;
+    } else {
+      cout<<"ESD pointer is NULL "<<endl;
+    }
+  }
+
+   for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDfriendObject | kAliHLTDataOriginOut); iter != NULL; iter = GetNextInputObject() ) {     
+     //fBenchmark.AddInput(pBlock->fSize);
+    cout<<"Found ESD friend in esd test component !!!"<<endl;
+    const AliESDfriend *esdFriend = dynamic_cast<const AliESDfriend*>(iter);
+    if( esdFriend ){
+      cout<<"N friend tracks: "<<esdFriend->GetNumberOfTracks()<<endl;
+    } else {
+      cout<<"ESD friend pointer is NULL "<<endl;
+    }
+  }
+  
+       
+       
+   if (iResult>=0) {            
+                
+  Bool_t useESDFriends = 0;
+ AliFlatESDEvent *flatEsd ;
+  Byte_t *mem = new Byte_t[AliFlatESDEvent::EstimateSize(const_cast<AliESDEvent*>(esd), useESDFriends)];
+
+    flatEsd = reinterpret_cast<AliFlatESDEvent*>(mem);
+    new (flatEsd) AliFlatESDEvent;
+  flatEsd->Fill(esd,useESDFriends);  
+                
+                
+                
+                
+                
+                
+    AliHLTComponentBlockData outBlock;
+    FillBlockData( outBlock );
+    outBlock.fOffset = size;
+    outBlock.fSize = flatEsd->GetSize();
+    outBlock.fDataType = kAliHLTDataTypeFlatESD|kAliHLTDataOriginOut;
+    outBlock.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( 0, 35, 0, 5 );
+
+    outputBlocks.push_back( outBlock );
+      
+    size += outBlock.fSize;
+  }
+  return iResult;
+}
+
+
+// #################################################################################
+Int_t AliHLTGlobalEsdToFlatConverterComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
+  // see header file for class documentation
+  ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");
+  return 0;
+}
+
+
+int AliHLTGlobalEsdToFlatConverterComponent::Configure(const char* arguments)
+{
+  // see header file for class documentation
+  int iResult=0;
+  if (!arguments) return iResult;
+
+  TString allArgs=arguments;
+  TString argument;
+  int bMissingParam=0;
+
+  TObjArray* pTokens=allArgs.Tokenize(" ");
+  if (pTokens) {
+    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->String();        
+      if (argument.IsNull()) continue;      
+      HLTError("unknown argument %s", argument.Data());
+      iResult=-EINVAL;
+      break;
+    }  
+    delete pTokens;
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+
+  return iResult;
+}
+
+int AliHLTGlobalEsdToFlatConverterComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+  // see header file for class documentation
+  int iResult=0;
+  const char* path=NULL;
+  const char* defaultNotify="";
+  if (cdbEntry) {
+    path=cdbEntry;
+    defaultNotify=" (default)";
+  }
+  if (path) {
+    HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+    AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+    if (pEntry) {
+      TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+      if (pString) {
+       HLTInfo("received configuration object string: \'%s\'", pString->String().Data());
+       iResult=Configure(pString->String().Data());
+      } else {
+       HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+      }
+    } else {
+      HLTError("can not fetch object \"%s\" from CDB", path);
+    }
+  }
+  
+  return iResult;
+}
diff --git a/HLT/global/AliHLTGlobalEsdToFlatConverterComponent.h b/HLT/global/AliHLTGlobalEsdToFlatConverterComponent.h
new file mode 100644 (file)
index 0000000..376aae7
--- /dev/null
@@ -0,0 +1,151 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTGlobalEsdToFlatConverterComponent $
+
+#ifndef ALIHLTESDTOFLATCONVERTERCOMPONENT_H
+#define ALIHLTESDTOFLATCONVERTERCOMPONENT_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    AliHLTGlobalEsdToFlatConverterComponent.h
+    @author  Steffen Weber <s.weber@gsi.de>
+    @brief   Component to convert ESD objects to flatESD 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 "AliHLTProcessor.h"
+
+class TH1F;
+class TList;
+
+class AliESDVZERO;
+class AliESDtrackCuts;
+class AliHLTCTPData;
+class AliHLTMultiplicityCorrelations;
+class AliHLTGlobalTriggerDecision;
+class AliHLTTestInputHandler;
+
+class AliHLTGlobalEsdToFlatConverterComponent : public AliHLTProcessor {
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** constructor */
+  AliHLTGlobalEsdToFlatConverterComponent();
+  
+  /** destructor */
+  virtual ~AliHLTGlobalEsdToFlatConverterComponent();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   * 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 */
+  void GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier );
+
+  /** interface function, see @ref AliHLTComponent for description */
+  void GetOCDBObjectDescription( TMap* const targetMap);
+
+  /** 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. 
+   * ---------------------------------------------------------------------------------
+   */
+
+  // AliHLTComponent interface functions
+
+  /** interface function, see @ref AliHLTComponent for description */
+  Int_t DoInit( Int_t /*argc*/, const Char_t** /*argv*/ );
+
+  /** interface function, see @ref AliHLTComponent for description */
+  Int_t DoDeinit();
+
+  /** interface function, see @ref AliHLTComponent for description */
+  int DoEvent( const AliHLTComponentEventData& evtData,
+              const AliHLTComponentBlockData* blocks, 
+              AliHLTComponentTriggerData& trigData,
+              AliHLTUInt8_t* outputPtr, 
+              AliHLTUInt32_t& size,
+              AliHLTComponentBlockDataList& outputBlocks);
+
+  using AliHLTProcessor::DoEvent;
+
+
+  /**
+   * Configure the component.
+   * Parse a string for the configuration arguments and set the component
+   * properties.
+   */
+  int Configure(const char* arguments);
+
+  /** interface function, see @ref AliHLTComponent for description */
+  Int_t Reconfigure(const Char_t* cdbEntry, const Char_t* chainId);
+
+  /** interface function, see @ref AliHLTComponent for description */
+  Int_t ReadPreprocessorValues(const Char_t* modules);
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+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 */
+  AliHLTGlobalEsdToFlatConverterComponent(const AliHLTGlobalEsdToFlatConverterComponent&);
+
+  /** assignment operator prohibited */
+  AliHLTGlobalEsdToFlatConverterComponent& operator=(const AliHLTGlobalEsdToFlatConverterComponent&);
+
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                              Helper
+   * ---------------------------------------------------------------------------------
+   */
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** UID for merging */
+
+  ClassDef(AliHLTGlobalEsdToFlatConverterComponent, 0)
+};
+#endif