Adding analysis for Flat ESD case
authorzampolli <chiara.zampolli@cern.ch>
Mon, 4 Aug 2014 09:48:43 +0000 (11:48 +0200)
committerzampolli <chiara.zampolli@cern.ch>
Mon, 4 Aug 2014 09:48:43 +0000 (11:48 +0200)
HLT/CMakelibAliHLTGlobal.pkg
HLT/global/AliHLTGlobalAgent.cxx
HLT/global/physics/AliHLTAnaManagerComponent.cxx
HLT/global/physics/AliHLTFlatAnaManagerComponent.cxx [new file with mode: 0644]
HLT/global/physics/AliHLTFlatAnaManagerComponent.h [new file with mode: 0644]
HLT/global/physics/macros/README_AliHLTAnaManagerComponent
TPC/Calib/AliAnalysisTaskPt.cxx
TPC/Calib/AliAnalysisTaskPt.h

index 131f99d..a266ec4 100644 (file)
@@ -63,6 +63,7 @@ set ( CLASS_HDRS
     physics/AliHLTMultiplicityCorrelations.h
     physics/AliHLTMultiplicityCorrelationsComponent.h
     physics/AliHLTAnaManagerComponent.h
+    physics/AliHLTFlatAnaManagerComponent.h
     )
 
 string ( REPLACE ".h" ".cxx" MODULE_SRCS "${CLASS_HDRS}" )
index 5892289..ec19a73 100644 (file)
@@ -46,6 +46,7 @@
 #include "AliHLTPrimaryVertexFinderComponent.h"
 #include "AliHLTV0FinderComponent.h"
 #include "AliHLTAnaManagerComponent.h"
+#include "AliHLTFlatAnaManagerComponent.h"
 
 // header file for preprocessor plugin
 #include "AliHLTGlobalPreprocessor.h"
@@ -94,6 +95,7 @@ int AliHLTGlobalAgent::RegisterComponents(AliHLTComponentHandler* pHandler) cons
   pHandler->AddComponent(new AliHLTGlobalHistoCollector );
   pHandler->AddComponent(new AliHLTGlobalDCSPublisherComponent );
   pHandler->AddComponent(new AliHLTAnaManagerComponent);
+  pHandler->AddComponent(new AliHLTFlatAnaManagerComponent);
   return 0;
 }
 
index ffe7596..9915198 100644 (file)
@@ -148,7 +148,7 @@ Int_t AliHLTAnaManagerComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/
   fAnalysisManager->SetExternalLoop(kTRUE); 
 
   AliAnalysisTaskPt *task = new AliAnalysisTaskPt("TaskPt");
-  task->SetUseFriends(kFALSE);
+  task->SetUseFriends(kTRUE);
   fAnalysisManager->AddTask(task);
   AliAnalysisDataContainer *cinput  = fAnalysisManager->GetCommonInputContainer();
   Printf("Defining output file");
diff --git a/HLT/global/physics/AliHLTFlatAnaManagerComponent.cxx b/HLT/global/physics/AliHLTFlatAnaManagerComponent.cxx
new file mode 100644 (file)
index 0000000..973d79e
--- /dev/null
@@ -0,0 +1,292 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTFlatAnaManagerComponent.cxx $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: David Rohr, Jens Wiechula, C. Zampolli                *
+ *                                                                        *
+ * 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    AliHLTFlatAnaManagerComponent.cxx
+    @author  David Rohr, Jens Wiechula, C. Zampolli
+    @brief   Component for Testing Analysis Manager inside HLT component
+*/
+
+#include "TMap.h"
+#include "TSystem.h"
+#include "TTimeStamp.h"
+#include "TObjString.h"
+#include "TH1F.h"
+#include "TList.h"
+#include "AliESDtrackCuts.h"
+#include "AliFlatESDEvent.h"
+#include "AliESDfriend.h"
+#include "AliHLTErrorGuard.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTFlatAnaManagerComponent.h"
+#include "AliHLTITSClusterDataFormat.h"
+#include "AliAnalysisManager.h"
+#include "AliHLTTestInputHandler.h"
+#include "AliAnalysisTaskPt.h"
+#include "AliAnalysisDataContainer.h"
+#include "TTree.h"
+
+using namespace std;
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTFlatAnaManagerComponent)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+AliHLTFlatAnaManagerComponent::AliHLTFlatAnaManagerComponent() :
+  AliHLTProcessor(),
+  fUID(0),
+  fAnalysisManager(NULL),
+  fInputHandler(NULL){
+  // 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()
+}
+
+// #################################################################################
+AliHLTFlatAnaManagerComponent::~AliHLTFlatAnaManagerComponent() {
+  // see header file for class documentation
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Public functions to implement AliHLTComponent's interface.
+ * These functions are required for the registration process
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+const Char_t* AliHLTFlatAnaManagerComponent::GetComponentID() { 
+  // see header file for class documentation
+  return "FlatAnaManagerComponent";
+}
+
+// #################################################################################
+void AliHLTFlatAnaManagerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
+  // see header file for class documentation
+  list.push_back(kAliHLTDataTypeFlatESD|kAliHLTDataOriginAny);
+  //  list.push_back(kAliHLTDataTypeESDfriendObject|kAliHLTDataOriginAny);
+}
+
+// #################################################################################
+AliHLTComponentDataType AliHLTFlatAnaManagerComponent::GetOutputDataType() {
+  // see header file for class documentation
+  return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT;
+}
+
+// #################################################################################
+void AliHLTFlatAnaManagerComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
+  // see header file for class documentation
+  constBase = 100000;
+  inputMultiplier = 0.5;
+}
+
+// #################################################################################
+void AliHLTFlatAnaManagerComponent::GetOCDBObjectDescription( TMap* const targetMap) {
+  // see header file for class documentation
+
+  if (!targetMap) return;
+  /*  targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
+                new TObjString("configuration object"));
+  targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelationsCentrality"),
+                new TObjString("centrality configuration object"));
+  */
+  return;
+}
+
+// #################################################################################
+AliHLTComponent* AliHLTFlatAnaManagerComponent::Spawn() {
+  // see header file for class documentation
+  return new AliHLTFlatAnaManagerComponent;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Protected functions to implement AliHLTComponent's interface.
+ * These functions provide initialization as well as the actual processing
+ * capabilities of the component. 
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTFlatAnaManagerComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/ ) {
+  // see header file for class documentation
+  printf("AliHLTFlatAnaManagerComponent::DoInit\n");
+
+  Int_t iResult=0;
+
+  Printf("----> AliHLTFlatAnaManagerComponent::DoInit"); 
+  fAnalysisManager = new AliAnalysisManager;
+  fInputHandler    = new AliHLTTestInputHandler;
+  fAnalysisManager->SetInputEventHandler(fInputHandler);
+  fAnalysisManager->SetExternalLoop(kTRUE); 
+
+  AliAnalysisTaskPt *task = new AliAnalysisTaskPt("TaskPt");
+  task->SetUseFriends(kFALSE);
+  fAnalysisManager->AddTask(task);
+  AliAnalysisDataContainer *cinput  = fAnalysisManager->GetCommonInputContainer();
+  Printf("Defining output file");
+  AliAnalysisDataContainer *coutput1 = fAnalysisManager->CreateContainer("pt", TList::Class(),
+      AliAnalysisManager::kOutputContainer, "Pt.ESD.root");
+
+  //           connect containers
+  Printf("---> Connecting input...");
+  fAnalysisManager->ConnectInput  (task,  0, cinput ); 
+  Printf("---> ...connected.");
+  Printf("---> Connecting output...");
+  fAnalysisManager->ConnectOutput (task,  0, coutput1);
+  Printf("---> ...connected.");
+
+  Printf("----> Calling InitAnalysis");
+  fAnalysisManager->InitAnalysis();
+  Printf("----> Done.");
+  Printf("----> Calling StartAnalysis");
+  fAnalysisManager->StartAnalysis("local", (TTree*)new TTree);
+  //fAnalysisManager->StartAnalysis("local", (TTree*)NULL);
+  Printf("----> Done.");
+
+  return iResult;
+}
+
+
+
+// #################################################################################
+Int_t AliHLTFlatAnaManagerComponent::DoDeinit() {
+  // see header file for class documentation
+
+  fUID = 0;
+  fAnalysisManager->SetSkipTerminate(kTRUE);
+  fAnalysisManager->Terminate();
+
+  delete fAnalysisManager;
+
+  return 0;
+}
+
+// #################################################################################
+Int_t AliHLTFlatAnaManagerComponent::DoEvent(const AliHLTComponentEventData& evtData,
+                                       AliHLTComponentTriggerData& /*trigData*/) {
+  // see header file for class documentation
+
+  printf("AliHLTFlatAnaManagerComponent::DoEvent\n");
+  Int_t iResult=0;
+
+  // -- Only use data event
+  if (!IsDataEvent()) {
+    Printf("-------> no data event");
+    return 0;
+  }
+  
+  if( fUID == 0 ){
+    TTimeStamp t;
+    fUID = ( gSystem->GetPid() + t.GetNanoSec())*10 + evtData.fEventID;
+  }
+  
+  Bool_t isESDfound = kFALSE;
+  // -- Get ESD object
+  // -------------------
+  AliFlatESDEvent *esdEvent = NULL;
+  AliESDfriend *esdFriend = NULL;
+  Int_t dataBlockIndex = 0;
+  for ( const AliHLTComponentBlockData *iter = GetFirstInputBlock(kAliHLTDataTypeFlatESD); iter != NULL; iter = GetNextInputBlock() ) {
+    if(iter->fDataType != kAliHLTDataTypeFlatESD) {
+      Printf("Data type of block is not flatESD");
+      continue;
+    }
+    dataBlockIndex++;
+    Printf("----> dataBlockIndex = %d", dataBlockIndex);
+    //iter->Print();
+    esdEvent = (AliFlatESDEvent*)(iter->fPtr);
+    if( !esdEvent ){ 
+      HLTWarning("Wrong ESDEvent object received");
+      Printf("Current object is not ESD event");
+      iResult = -1;
+      continue;
+    }
+    else isESDfound = kTRUE;
+    //    esdEvent->GetStdContent();
+  }
+  if (!isESDfound) {
+    Printf("-------> no ESD found!!");
+    return 0;
+  }
+  printf("----> ESDEvent %p has %d tracks: \n", esdEvent, esdEvent->GetNumberOfTracks());
+
+  /* // no friends for teh time being... 
+  for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDfriendObject); iter != NULL; iter = GetNextInputObject() ) {
+    esdFriend = dynamic_cast<AliESDfriend*>(const_cast<TObject*>( iter ) );
+    if( !esdFriend ){ 
+      HLTWarning("Wrong ESDFriend object received");
+      iResult = -1;
+      continue;
+    }
+  }
+  printf("----> ESDFriend %p has %d tracks: \n", esdFriend, esdFriend->GetNumberOfTracks());
+  */
+  fAnalysisManager->InitInputData(esdEvent, esdFriend);
+  //  fInputHandler->BeginEvent(0);
+  fAnalysisManager->ExecAnalysis();
+  fInputHandler->FinishEvent();
+
+
+  // -- Send histlist
+//  PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
+//        kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,fUID);
+  return iResult;
+}
+
+// #################################################################################
+Int_t AliHLTFlatAnaManagerComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
+  // see header file for class documentation
+
+  Int_t iResult=0;
+  TString cdbPath;
+  if (cdbEntry) {
+    cdbPath=cdbEntry;
+  } else {
+    cdbPath="HLT/ConfigGlobal/";
+    cdbPath+=GetComponentID();
+  }
+
+  TString strcdb = "";
+  if (!cdbEntry) strcdb = "default";
+  Printf("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), strcdb.Data());
+  //AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
+  iResult=ConfigureFromCDBTObjString(cdbPath);
+
+  return iResult;
+}
+
+// #################################################################################
+Int_t AliHLTFlatAnaManagerComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
+  // see header file for class documentation
+  ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");
+  return 0;
+}
+
diff --git a/HLT/global/physics/AliHLTFlatAnaManagerComponent.h b/HLT/global/physics/AliHLTFlatAnaManagerComponent.h
new file mode 100644 (file)
index 0000000..faa18df
--- /dev/null
@@ -0,0 +1,230 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTFlatAnaManagerComponent $
+
+#ifndef ALIHLTFLATANAMANAGERCOMPONENT_H
+#define ALIHLTFLATANAMANAGERCOMPONENT_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    AliHLTFlatAnaManagerComponent.h
+    @author  Jochen Thaeder <jochen@thaeder.de>
+    @brief   Component for Multiplicty Correlations
+*/
+
+// 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 AliAnalysisManager;
+class AliHLTTestInputHandler;
+
+/**
+ * @class AliHLTFlatAnaManagerComponent
+ * Create Correlations for Multiplicities
+ * 
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b MultiplicityCorrelations <br>
+ * Library: \b libAliHLTGlobal.so     <br>
+ * Input Data Types:  @ref kAliHLTDataTypeESDObject <br>
+ * Output Data Types: @ref kAliHLTDataTypeTObject|kAliHLTDataOriginHLT <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> 
+ *
+ * <h2>Optional arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * \li -minpt    <i> pt  </i> <br>
+ *      minimum pt - pt range
+ * \li -maxpt    <i> pt  </i> <br>
+ *      maximum pt - pt range
+ * \li -min-ldca    <i> dca  </i> <br>
+ *      minimum longitudinal dca to reference point
+ * \li -max-ldca    <i> dca  </i> <br>
+ *      maximum longitudinal dca to reference point
+ * \li -min-tdca    <i> dca  </i> <br>
+ *      minimum transverse dca to reference point
+ * \li -max-tdca    <i> dca  </i> <br>
+ *      maximum transverse dca to reference point
+ * \li -etarange    <i> eta  </i> <br>
+ *      +/- eta range
+ *
+ * \li -binningVzero    <i> bins min max  </i> <br>
+ *       bins (Int_t), minBin (Float_t), maxBin (Float_t)
+ * \li -binningTpc      <i> bins min max  </i> <br>
+ *       bins (Int_t), minBin (Float_t), maxBin (Float_t)
+ * \li -binningZdc      <i> bins min max  </i> <br>
+ *       bins (Int_t), minBin (Float_t), maxBin (Float_t)
+ * \li -binningZnp     <i> bins min max  </i> <br>
+ *       bins (Int_t), minBin (Float_t), maxBin (Float_t)
+ * \li -binningZem     <i> bins min max  </i> <br>
+ *       bins (Int_t), minBin (Float_t), maxBin (Float_t)
+ * \li -binningCalo    <i> bins min max  </i> <br>
+ *       bins (Int_t), minBin (Float_t), maxBin (Float_t)
+ *
+ * \li -addTrigger     <i> TriggerClass beginning (eg CPBI1)  </i> <br>
+
+ * <h2>Default CDB entries:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <tt>HLT/ConfigGlobal/MultiplicityCorrelations</tt>
+ * \li -TObjString object holding a string with the configuration parameters
+ *      currently empty 
+ *
+ * <h2>Performance:</h2>
+ *
+ * <h2>Memory consumption:</h2>
+ *
+ * <h2>Input size:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * \li pp: 
+ *
+ * <h2>Output size:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * \li pp: Average : 
+ *
+ * <h2>Macros Tests</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <tt>macros/makeConfigurationObjectMultiplicityCorrelations.C</tt>
+ * \li - Create configuration TObjString
+ *
+ * <tt>macros/HLTMultiplicityCorrelationsTest.C</tt>
+ * \li - Test macro for test in off-line environment
+ *
+ * <tt>macros/runMultiplicityCorrelationsTest.sh</tt>
+ * \li - Run Test macro HLTMultiplicityCorrelationsTest.C
+ *
+ * @ingroup alihlt_physics
+ */
+class AliHLTFlatAnaManagerComponent : public AliHLTProcessor {
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** constructor */
+  AliHLTFlatAnaManagerComponent();
+  
+  /** destructor */
+  virtual ~AliHLTFlatAnaManagerComponent();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   * 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_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+
+  using AliHLTProcessor::DoEvent;
+
+
+  /** 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 */
+  AliHLTFlatAnaManagerComponent(const AliHLTFlatAnaManagerComponent&);
+
+  /** assignment operator prohibited */
+  AliHLTFlatAnaManagerComponent& operator=(const AliHLTFlatAnaManagerComponent&);
+
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                              Helper
+   * ---------------------------------------------------------------------------------
+   */
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** UID for merging */
+  AliHLTUInt32_t fUID;                        // see above
+
+  AliAnalysisManager *fAnalysisManager;        // Manger
+
+  AliHLTTestInputHandler *fInputHandler;    // input handler
+
+  ClassDef(AliHLTFlatAnaManagerComponent, 0)
+};
+#endif
index 63e7497..8307442 100644 (file)
@@ -3,3 +3,12 @@ To run an example using the AliHLTAnaManagerComponent, please, run:
 rm galice.root; aliroot -b -q -l testconfig.C'("GLOBAL-esd-converter")' $ALICE_ROOT/HLT/exa/recraw-local.C'("raw.root","local://$ALICE_ROOT/OCDB", 0, 10, "HLT", "chains=RootWriter ignore-hltout")' 2>&1| tee recHLT.log
 
 Note that you need to have a raw.root file in your folder.
+
+
+*******************************************************************************
+
+To run an example using the AliHLTFlatAnaManagerComponent, please, run:
+
+rm galice.root; aliroot -b -q -l testconfigFlat.C'("GLOBAL-flat-esd-converter")' $ALICE_ROOT/HLT/exa/recraw-local.C'("raw.root","local://$ALICE_ROOT/OCDB", 0, 10, "HLT", "chains=RootWriter ignore-hltout")' 2>&1| tee recHLT.log
+
+Note that you need to have a raw.root file in your folder.
index 31b9933..45e4ff9 100644 (file)
@@ -26,7 +26,8 @@ ClassImp(AliAnalysisTaskPt)
 
 //________________________________________________________________________
 AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name) 
-: AliAnalysisTask(name, ""), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0), fUseFriends(kFALSE)
+: AliAnalysisTask(name, ""), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0), fUseFriends(kFALSE), fHistNTPCCl(0), fHistNESDtracks(0),   fHistNESDfriendtracks(0)
+
 {
   // Constructor
 
@@ -99,8 +100,26 @@ void AliAnalysisTaskPt::CreateOutputObjects()
   fHistQ->GetYaxis()->SetTitle("dN/dQ");
   fHistQ->SetMarkerStyle(kFullCircle);
 
+  fHistNTPCCl = new TH1F("fHistNTPCCl", "Number of TPC clusters", 160, -0.5, 159.5);
+  fHistNTPCCl->GetXaxis()->SetTitle("n. TPC Cl.");
+  fHistNTPCCl->GetYaxis()->SetTitle("dN/d(n. TPC Cl)");
+  fHistNTPCCl->SetMarkerStyle(kFullCircle);
+
+  fHistNESDtracks = new TH1F("fHistNESDtracks", "Number of ESD friend tracks", 1000, -0.5, 999.5);
+  fHistNESDtracks->GetXaxis()->SetTitle("n. ESD friend tracks");
+  fHistNESDtracks->GetYaxis()->SetTitle("dN/d(n. ESD friend tracks)");
+  fHistNESDtracks->SetMarkerStyle(kFullCircle);
+
+  fHistNESDfriendtracks = new TH1F("fHistNESDfriendtracks", "Number of ESD tracks", 1000, -0.5, 999.5);
+  fHistNESDfriendtracks->GetXaxis()->SetTitle("n. ESD tracks");
+  fHistNESDfriendtracks->GetYaxis()->SetTitle("dN/d(n. ESD tracks)");
+  fHistNESDfriendtracks->SetMarkerStyle(kFullCircle);
+
   fListOut->Add(fHistPt);
   fListOut->Add(fHistQ);
+  fListOut->Add(fHistNTPCCl);
+  fListOut->Add(fHistNESDtracks);
+  fListOut->Add(fHistNESDfriendtracks);
 
   PostData(0, fListOut);
 
@@ -119,14 +138,23 @@ void AliAnalysisTaskPt::Exec(Option_t *)
   }
   if (!fESDfriend) {
     Printf("ERROR: fESDfriend not available");
-    return;
+      if (fUseFriends){
+       return;
+      }
   }
 
-  Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
-  Printf("... and there are %d friends in this event", fESDfriend->GetNumberOfTracks());
+  Int_t nESDtracks = fESD->GetNumberOfTracks();
+  Int_t nESDfriendtracks = 0;
+  if (fUseFriends) nESDfriendtracks = fESDfriend->GetNumberOfTracks();
+  Printf("There are %d tracks in this event", nESDtracks);
+  Printf("... and there are %d friends in this event", nESDfriendtracks);
+
+  fHistNESDtracks->Fill(nESDtracks);
+  fHistNESDfriendtracks->Fill(nESDfriendtracks);
 
   // Track loop to fill a pT spectrum
-  for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
+  for (Int_t iTracks = 0; iTracks < nESDtracks; iTracks++) {
+    Printf("Checking track %d: Note that with Flat, the GetTrack is not yet implemented!!!", iTracks);
     AliVVtrack* track = fESD->GetVVTrack(iTracks);
     if (!track) {
       Printf("ERROR: Could not receive track %d", iTracks);
@@ -134,12 +162,13 @@ void AliAnalysisTaskPt::Exec(Option_t *)
     }
     Printf("track %d has pt = %f", iTracks, track->GetPt());
     fHistPt->Fill(track->GetPt());
+    fHistNTPCCl->Fill(track->GetTPCNcls());
   } //track loop 
 
 
   if (fUseFriends){
     // Friend Track loop
-    for (Int_t iFriend = 0; iFriend < fESDfriend->GetNumberOfTracks(); iFriend++) {
+    for (Int_t iFriend = 0; iFriend < nESDfriendtracks; iFriend++) {
       //Printf("Getting friend %d", iFriend);
       const AliVVfriendTrack* friendTrack = fESDfriend->GetTrack(iFriend);
       if (!friendTrack) {
index b2a51ed..3481926 100644 (file)
@@ -15,7 +15,8 @@ class TList;
 
 class AliAnalysisTaskPt : public AliAnalysisTask {
  public:
- AliAnalysisTaskPt() : AliAnalysisTask(), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0) {}
+ AliAnalysisTaskPt() : AliAnalysisTask(), fESD(0), fESDfriend(0), fHistPt(0), fCuts(0), fEv(0), fHistQ(0), fListOut(0), fHistNTPCCl(0), fHistNESDtracks(0), fHistNESDfriendtracks(0) 
+ {}
   AliAnalysisTaskPt(const char *name);
   virtual ~AliAnalysisTaskPt() {}
   
@@ -28,14 +29,17 @@ class AliAnalysisTaskPt : public AliAnalysisTask {
   void   SetUseFriends(Bool_t flag) {fUseFriends = flag;}
 
  private:
-  AliVVevent*       fESD;          // ESD object
-  AliVVfriendEvent* fESDfriend;    // ESD friend object
-  TH1F*             fHistPt;       // Pt spectrum
-  AliESDtrackCuts*  fCuts;         // cuts
+  AliVVevent*       fESD;                      // ESD object
+  AliVVfriendEvent* fESDfriend;                // ESD friend object
+  TH1F*             fHistPt;                   // Pt spectrum
+  AliESDtrackCuts*  fCuts;                     // cuts
   Int_t fEv;
-  TH1F*             fHistQ;        // TPC clusters Q spectrum
-  TList*            fListOut;      // output list
-  Bool_t            fUseFriends;   // flag to decide whether friends should be used
+  TH1F*             fHistQ;                    // TPC clusters Q spectrum
+  TList*            fListOut;                  // output list
+  Bool_t            fUseFriends;               // flag to decide whether friends should be use
+  TH1F*             fHistNTPCCl;               // histo with the number of TPC clusters
+  TH1F*             fHistNESDtracks;           // histo with number of ESD tracks
+  TH1F*             fHistNESDfriendtracks;     // histo with number of ESD tracks
 
   AliAnalysisTaskPt(const AliAnalysisTaskPt&); // not implemented
   AliAnalysisTaskPt& operator=(const AliAnalysisTaskPt&); // not implemented