Improved muon AOD's from Laurent
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jan 2011 10:14:08 +0000 (10:14 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jan 2011 10:14:08 +0000 (10:14 +0000)
14 files changed:
PWG3/CMakelibPWG3muon.pkg
PWG3/PWG3muonLinkDef.h
PWG3/muon/AliAODMuonReplicator.cxx [new file with mode: 0644]
PWG3/muon/AliAODMuonReplicator.h [new file with mode: 0644]
PWG3/muon/AliAnalysisTaskESDMuonFilter.cxx
PWG3/muon/AliAnalysisTaskESDMuonFilter.h
STEER/AODLinkDef.h
STEER/AliAODBranchReplicator.cxx [new file with mode: 0644]
STEER/AliAODBranchReplicator.h [new file with mode: 0644]
STEER/AliAODHandler.cxx
STEER/AliAODHandler.h
STEER/AliAODVertex.cxx
STEER/AliAODVertex.h
STEER/CMakelibAOD.pkg

index 414653c..cc26896 100644 (file)
@@ -25,7 +25,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS      muon/AliAnalysisTaskESDMuonFilter.cxx muon/AliAnalysisTaskMuonAODfromGeneral.cxx muon/AliAnalysisTaskFromStandardToMuonAOD.cxx muon/AliAnalysisTaskSingleMu.cxx muon/AliAnalysisTaskLUT.cxx muon/AliAnalysisTaskTrigChEff.cxx muon/AliAnalysisTaskLinkToMC.cxx muon/AliAODEventInfo.cxx muon/AliESDMuonTrackCuts.cxx muon/AliAnalysisTaskSingleMuESD.cxx muon/AliCFMuonResTask1.cxx muon/AliCFMuonSingleTask1.cxx muon/AliEventPoolMuon.cxx muon/AliAnalysisTaskCreateMixedDimuons.cxx muon/AliAnalysisTaskMuonAODCreation.cxx muon/AliAnalysisTaskMuonDistributions.cxx muon/AliMuonInfoStoreRD.cxx muon/AliDimuInfoStoreRD.cxx muon/AliMuonInfoStoreMC.cxx muon/AliDimuInfoStoreMC.cxx muon/AliMuonsHFHeader.cxx muon/AliAnalysisTaskSEMuonsHF.cxx muon/AliAnalysisTaskDimuonCFContainerBuilder.cxx muon/AliAnalysisTaskMuonTreeBuilder.cxx muon/AliAnalysisTaskMuonQA.cxx)
+set ( SRCS      muon/AliAnalysisTaskESDMuonFilter.cxx muon/AliAnalysisTaskMuonAODfromGeneral.cxx muon/AliAnalysisTaskFromStandardToMuonAOD.cxx muon/AliAnalysisTaskSingleMu.cxx muon/AliAnalysisTaskLUT.cxx muon/AliAnalysisTaskTrigChEff.cxx muon/AliAnalysisTaskLinkToMC.cxx muon/AliAODEventInfo.cxx muon/AliESDMuonTrackCuts.cxx muon/AliAnalysisTaskSingleMuESD.cxx muon/AliCFMuonResTask1.cxx muon/AliCFMuonSingleTask1.cxx muon/AliEventPoolMuon.cxx muon/AliAnalysisTaskCreateMixedDimuons.cxx muon/AliAnalysisTaskMuonAODCreation.cxx muon/AliAnalysisTaskMuonDistributions.cxx muon/AliMuonInfoStoreRD.cxx muon/AliDimuInfoStoreRD.cxx muon/AliMuonInfoStoreMC.cxx muon/AliDimuInfoStoreMC.cxx muon/AliMuonsHFHeader.cxx muon/AliAnalysisTaskSEMuonsHF.cxx muon/AliAnalysisTaskDimuonCFContainerBuilder.cxx muon/AliAnalysisTaskMuonTreeBuilder.cxx muon/AliAnalysisTaskMuonQA.cxx muon/AliAODMuonReplicator.cxx)
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
index 5f78784..b5e0c30 100644 (file)
@@ -10,6 +10,9 @@
 #pragma link C++ class AliAnalysisTaskSingleMu+;
 #pragma link C++ class AliAnalysisTaskLUT+;
 #pragma link C++ class AliAnalysisTaskESDMuonFilter+;
+#pragma link C++ class AliAODMuonReplicator+;
+#pragma link C++ class AliAnalysisNonMuonTrackCuts+;
+#pragma link C++ class AliAnalysisNonPrimaryVertices+;
 #pragma link C++ class AliAnalysisTaskTrigChEff+;
 #pragma link C++ class AliESDMuonTrackCuts+;
 #pragma link C++ class AliAnalysisTaskSingleMuESD+;
diff --git a/PWG3/muon/AliAODMuonReplicator.cxx b/PWG3/muon/AliAODMuonReplicator.cxx
new file mode 100644 (file)
index 0000000..75cc905
--- /dev/null
@@ -0,0 +1,107 @@
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
+
+// $Id$
+
+#include "AliAODMuonReplicator.h"
+#include "AliAnalysisCuts.h"
+#include "AliAODEvent.h"
+#include "AliAODTrack.h"
+#include <cassert>
+
+ClassImp(AliAODMuonReplicator)
+
+//_____________________________________________________________________________
+AliAODMuonReplicator::AliAODMuonReplicator(const char* name, const char* title,
+                                                 AliAnalysisCuts* trackCut,
+                                                 AliAnalysisCuts* vertexCut)
+: AliAODBranchReplicator(name,title), 
+fTrackCut(trackCut), fTracks(0x0), 
+fVertexCut(vertexCut), fVertices(0x0),
+fList(0x0)
+{
+  // default ctor
+}
+
+//_____________________________________________________________________________
+AliAODMuonReplicator::~AliAODMuonReplicator()
+{
+  // dtor
+  delete fTrackCut;
+  delete fVertexCut;
+  delete fList;
+}
+
+//_____________________________________________________________________________
+TList* AliAODMuonReplicator::GetList() const
+{
+  // return (and build if not already done) our internal list of managed objects
+  if (!fList)
+  {
+    fList = new TList;
+    fList->SetOwner(kTRUE);
+    fTracks = new TClonesArray("AliAODTrack",100);
+               fTracks->SetName("tracks");    
+    fVertices = new TClonesArray("AliAODVertex",10);
+               fVertices->SetName("vertices");    
+    fList->Add(fTracks);
+    fList->Add(fVertices);
+  }
+  return fList;
+}
+
+//_____________________________________________________________________________
+void AliAODMuonReplicator::ReplicateAndFilter(const AliAODEvent& source)
+{
+  // Replicate (and filter if filters are there) the relevant parts we're interested in AODEvent
+  
+  static int n(0);
+  
+  ++n;
+  
+  assert(fTracks!=0x0);
+  fTracks->Clear("C");
+  TIter next(source.GetTracks());
+  AliAODTrack* t;
+  Int_t ntracks(0);
+  
+  
+  while ( ( t = static_cast<AliAODTrack*>(next()) ) )
+  {
+    if ( !fTrackCut || fTrackCut->IsSelected(t) ) 
+    {
+      new((*fTracks)[ntracks++]) AliAODTrack(*t);
+    }
+  }
+  
+  assert(fVertices!=0x0);
+  fVertices->Clear("C");
+  TIter nextV(source.GetVertices());
+  AliAODVertex* v;
+  Int_t nvertices(0);
+  
+  while ( ( v = static_cast<AliAODVertex*>(nextV()) ) )
+  {
+    if ( !fVertexCut || fVertexCut->IsSelected(v) ) 
+    {
+      AliAODVertex* tmp = v->CloneWithoutRefs();
+      new((*fVertices)[nvertices++]) AliAODVertex(*tmp);
+      delete tmp;
+    }
+  }
+  
+  AliInfo(Form("n=%d tracks=%d vertices=%d",n,fTracks->GetEntries(),fVertices->GetEntries()));
+}
+
diff --git a/PWG3/muon/AliAODMuonReplicator.h b/PWG3/muon/AliAODMuonReplicator.h
new file mode 100644 (file)
index 0000000..b942ea4
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALIAODMUONREPLICATOR_H
+#define ALIAODMUONREPLICATOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+
+#ifndef ALIDAODBRANCHREPLICATOR_H
+#  include "AliAODBranchReplicator.h"
+#endif
+
+class AliAnalysisCuts;
+class TClonesArray;
+
+class AliAODMuonReplicator : public AliAODBranchReplicator
+{
+public:
+  AliAODMuonReplicator(const char* name="AliAODMuonReplicator", 
+                       const char* title="Branch Replicator for muon related branches",
+                       AliAnalysisCuts* trackCut=0x0,
+                       AliAnalysisCuts* vertexCut=0x0);
+  virtual ~AliAODMuonReplicator();
+  
+  virtual TList* GetList() const;
+  
+  virtual void ReplicateAndFilter(const AliAODEvent& source);
+  
+public:
+  AliAnalysisCuts* fTrackCut; // decides which tracks to keep
+  mutable TClonesArray* fTracks; //! internal array of muon tracks
+  AliAnalysisCuts* fVertexCut; // decides which vertices to keep
+  mutable TClonesArray* fVertices; //! internal array of vertices
+  mutable TList* fList; //! internal list of managed objects (fVertices and fTracks)
+  
+private:
+  AliAODMuonReplicator(const AliAODMuonReplicator&);
+  AliAODMuonReplicator& operator=(const AliAODMuonReplicator&);
+  
+  ClassDef(AliAODMuonReplicator,1) // Branch replicator for ESD to muon AOD.
+};
+
+#endif
index f3f8365..e4233ba 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+//
 // Add the muon tracks to the generic AOD track branch during the 
-// filtering of the ESD - R. Arnaldi 5/5/08
+// filtering of the ESD. 
+//
+// Authors: R. Arnaldi 5/5/08 and L. Aphecetche January 2011
+//
+// Note that we :
+//   - completely disable all the branches that are not required by (most) the muon analyses,
+//     e.g. cascades, v0s, kinks, jets, etc...
+//   - filter severely the tracks (keep only muon tracks) and vertices (keep only primary -including
+//     pile-up - vertices) branches 
+// 
+// (see AddFilteredAOD method)
+//
 
 #include <TChain.h>
 #include <TFile.h>
 #include "AliMCEventHandler.h"
 #include "AliAODMCParticle.h"
 #include "AliAODDimuon.h"
+#include "AliAODMuonReplicator.h"
+#include "AliAODVertex.h"
 
 ClassImp(AliAnalysisTaskESDMuonFilter)
+ClassImp(AliAnalysisNonMuonTrackCuts)
 
 ////////////////////////////////////////////////////////////////////////
 
-AliAnalysisTaskESDMuonFilter::AliAnalysisTaskESDMuonFilter():
+AliAnalysisNonMuonTrackCuts::AliAnalysisNonMuonTrackCuts()
+{
+  // default ctor 
+}
+
+Bool_t AliAnalysisNonMuonTrackCuts::IsSelected(TObject* obj)
+{
+  // Returns true if the object is a muon track
+  AliAODTrack* track = dynamic_cast<AliAODTrack*>(obj);
+  if (track && track->IsMuonTrack()) return kTRUE;
+  return kFALSE;
+}
+
+AliAnalysisNonPrimaryVertices::AliAnalysisNonPrimaryVertices()
+{
+  // default ctor   
+}
+
+Bool_t AliAnalysisNonPrimaryVertices::IsSelected(TObject* obj)
+{
+  // Returns true if the object is a primary vertex
+
+  AliAODVertex* vertex = dynamic_cast<AliAODVertex*>(obj);
+  if (vertex)
+  {
+    if ( vertex->GetType() == AliAODVertex::kPrimary ||
+        vertex->GetType() == AliAODVertex::kMainSPD ||
+        vertex->GetType() == AliAODVertex::kPileupSPD ||
+        vertex->GetType() == AliAODVertex::kPileupTracks ||
+        vertex->GetType() == AliAODVertex::kMainTPC )
+    {
+      return kTRUE;
+    }
+  }
+  
+//  enum AODVtx_t {kUndef=-1, kPrimary, kKink, kV0, kCascade, kMulti, kMainSPD, kPileupSPD, kPileupTracks,kMainTPC};
+
+  return kFALSE;
+  
+}
+
+AliAnalysisTaskESDMuonFilter::AliAnalysisTaskESDMuonFilter(Bool_t onlyMuon, Bool_t keepAllEvents):
   AliAnalysisTaskSE(),
   fTrackFilter(0x0),
   fEnableMuonAOD(kFALSE),
-  fEnableDimuonAOD(kFALSE)
+  fEnableDimuonAOD(kFALSE),
+  fOnlyMuon(onlyMuon),
+  fKeepAllEvents(keepAllEvents)
 {
   // Default constructor
 }
 
-AliAnalysisTaskESDMuonFilter::AliAnalysisTaskESDMuonFilter(const char* name):
+AliAnalysisTaskESDMuonFilter::AliAnalysisTaskESDMuonFilter(const char* name, Bool_t onlyMuon, Bool_t keepAllEvents):
   AliAnalysisTaskSE(name),
   fTrackFilter(0x0),
   fEnableMuonAOD(kFALSE),
-  fEnableDimuonAOD(kFALSE)
+  fEnableDimuonAOD(kFALSE),
+  fOnlyMuon(onlyMuon),
+  fKeepAllEvents(keepAllEvents)
 {
   // Constructor
 }
@@ -66,21 +126,51 @@ void AliAnalysisTaskESDMuonFilter::UserCreateOutputObjects()
   if (fTrackFilter) OutputTree()->GetUserInfo()->Add(fTrackFilter);
 }
 
+void AliAnalysisTaskESDMuonFilter::AddFilteredAOD(const char* aodfilename, const char* title)
+{
+  // Add an output filtered and replicated aod
+  
+  AliAODHandler *aodH = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
+  if (!aodH) Fatal("UserCreateOutputObjects", "No AOD handler");
+
+  AliAODExtension* ext = aodH->AddFilteredAOD(aodfilename,title);
+
+  if ( ext && fOnlyMuon ) 
+  {
+    ext->DisableReferences();
+    
+    ext->FilterBranch("cascades",0x0);
+    ext->FilterBranch("v0s",0x0);
+    ext->FilterBranch("kinks",0x0);
+    ext->FilterBranch("jets",0x0);
+    ext->FilterBranch("emcalCells",0x0);
+    ext->FilterBranch("phosCells",0x0);
+    ext->FilterBranch("caloClusters",0x0);
+    ext->FilterBranch("fmdClusters",0x0);
+    ext->FilterBranch("pmdClusters",0x0);
+    ext->FilterBranch("tracklets",0x0);
+    
+    AliAODBranchReplicator* murep = new AliAODMuonReplicator("MuonReplicator",
+                                                             "remove non muon tracks and non primary or pileup vertices",
+                                                             new AliAnalysisNonMuonTrackCuts,
+                                                             new AliAnalysisNonPrimaryVertices);
+    ext->FilterBranch("tracks",murep);    
+    ext->FilterBranch("vertices",murep);    
+  }  
+}
+
 void AliAnalysisTaskESDMuonFilter::Init()
 {
   // Initialization
-  if (fDebug > 1) AliInfo("Init() \n");
-  // From Andrei
-  AliAODHandler *aodH = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
-  if (!aodH) Fatal("UserCreateOutputObjects", "No AOD handler. Aborting.");
-  if(fEnableMuonAOD)aodH->AddFilteredAOD("AliAOD.Muons.root", "MuonEvents");
-  if(fEnableDimuonAOD)aodH->AddFilteredAOD("AliAOD.Dimuons.root", "DimuonEvents");
+  if(fEnableMuonAOD) AddFilteredAOD("AliAOD.Muons.root", "MuonEvents");
+  if(fEnableDimuonAOD) AddFilteredAOD("AliAOD.Dimuons.root", "DimuonEvents");    
 }
 
 
 void AliAnalysisTaskESDMuonFilter::UserExec(Option_t */*option*/)
 {
   // Execute analysis for current event                                            
+  
   Long64_t ientry = Entry();
   if(fDebug)printf("Muon Filter: Analysing event # %5d\n", (Int_t) ientry);
   
@@ -134,22 +224,19 @@ void AliAnalysisTaskESDMuonFilter::ConvertESDtoAOD()
   TClonesArray &dimuons = *(AODEvent()->GetDimuons());
   AliAODDimuon *aodDimuon = 0x0;
   
-  Bool_t MuonsExist = kFALSE;
-  Bool_t DimuonsExist = kFALSE;
   Int_t nMuons=0;
   Int_t nDimuons=0;
   Int_t jDimuons=0;
   Int_t nMuonTrack[100];
   
   for(int imuon=0;imuon<100;imuon++) nMuonTrack[imuon]=0;
-
-  for (Int_t nMuTrack = 0; nMuTrack < nMuTracks; ++nMuTrack) {
+  
+  for (Int_t nMuTrack = 0; nMuTrack < nMuTracks; ++nMuTrack)
+  {
     esdMuTrack = esd->GetMuonTrack(nMuTrack);
     
     if (!esdMuTrack->ContainTrackerData()) continue;
     
-    MuonsExist = kTRUE;
-       
     UInt_t selectInfo = 0;
     // Track selection
     if (fTrackFilter) {
@@ -158,7 +245,7 @@ void AliAnalysisTaskESDMuonFilter::ConvertESDtoAOD()
          continue;
        }  
     }
-
+    
     p[0] = esdMuTrack->Px(); 
     p[1] = esdMuTrack->Py(); 
     p[2] = esdMuTrack->Pz();
@@ -170,20 +257,20 @@ void AliAnalysisTaskESDMuonFilter::ConvertESDtoAOD()
     if(mcH)mcH->SelectParticle(esdMuTrack->GetLabel());
     
     aodTrack = new(tracks[jTracks++]) AliAODTrack(esdMuTrack->GetUniqueID(), // ID
-                                                 esdMuTrack->GetLabel(), // label
-                                                 p, // momentum
-                                                 kTRUE, // cartesian coordinate system
-                                                 pos, // position
-                                                 kFALSE, // isDCA
-                                                 0x0, // covariance matrix
-                                                 esdMuTrack->Charge(), // charge
-                                                 0, // ITSClusterMap
-                                                 pid, // pid
-                                                 primary, // primary vertex
-                                                 kFALSE, // used for vertex fit?
-                                                 kFALSE, // used for primary vertex fit?
-                                                 AliAODTrack::kPrimary,// track type
-                                                 selectInfo); 
+                                                  esdMuTrack->GetLabel(), // label
+                                                  p, // momentum
+                                                  kTRUE, // cartesian coordinate system
+                                                  pos, // position
+                                                  kFALSE, // isDCA
+                                                  0x0, // covariance matrix
+                                                  esdMuTrack->Charge(), // charge
+                                                  0, // ITSClusterMap
+                                                  pid, // pid
+                                                  primary, // primary vertex
+                                                  kFALSE, // used for vertex fit?
+                                                  kFALSE, // used for primary vertex fit?
+                                                  AliAODTrack::kPrimary,// track type
+                                                  selectInfo); 
     
     aodTrack->SetXYAtDCA(esdMuTrack->GetNonBendingCoorAtDCA(), esdMuTrack->GetBendingCoorAtDCA());
     aodTrack->SetPxPyPzAtDCA(esdMuTrack->PxAtDCA(), esdMuTrack->PyAtDCA(), esdMuTrack->PzAtDCA());
@@ -201,29 +288,29 @@ void AliAnalysisTaskESDMuonFilter::ConvertESDtoAOD()
     else nNegTracks++;
     
     nMuonTrack[nMuons]= jTracks-1.;
-    nMuons++;
+    ++nMuons;
   }
-    
-    if(nMuons>=2) DimuonsExist = kTRUE;   
-    if(DimuonsExist) { 
-      for(int i=0;i<nMuons;i++){
-        Int_t index0 = nMuonTrack[i];
-       for(int j=i+1;j<nMuons;j++){
-          Int_t index1 = nMuonTrack[j];
-          aodDimuon = new(dimuons[jDimuons++]) AliAODDimuon(tracks.At(index0),tracks.At(index1));
-         nDimuons++;
-          if (fDebug > 1){
-            AliAODDimuon *dimuon0 = (AliAODDimuon*)dimuons.At(jDimuons-1);
-            printf("Dimuon: mass = %f, px=%f, py=%f, pz=%f\n",dimuon0->M(),dimuon0->Px(),dimuon0->Py(),dimuon0->Pz());  
-            AliAODTrack  *mu0 = (AliAODTrack*) dimuon0->GetMu(0);
-            AliAODTrack  *mu1 = (AliAODTrack*) dimuon0->GetMu(1);
-            printf("Muon0 px=%f py=%f pz=%f\n",mu0->Px(),mu0->Py(),mu0->Pz());
-            printf("Muon1 px=%f py=%f pz=%f\n",mu1->Px(),mu1->Py(),mu1->Pz());
-         }  
-        }
+  
+  if(nMuons>=2) 
+  { 
+    for(int i=0;i<nMuons;i++){
+      Int_t index0 = nMuonTrack[i];
+      for(int j=i+1;j<nMuons;j++){
+        Int_t index1 = nMuonTrack[j];
+        aodDimuon = new(dimuons[jDimuons++]) AliAODDimuon(tracks.At(index0),tracks.At(index1));
+        ++nDimuons;
+        if (fDebug > 1){
+          AliAODDimuon *dimuon0 = (AliAODDimuon*)dimuons.At(jDimuons-1);
+          printf("Dimuon: mass = %f, px=%f, py=%f, pz=%f\n",dimuon0->M(),dimuon0->Px(),dimuon0->Py(),dimuon0->Pz());  
+          AliAODTrack  *mu0 = (AliAODTrack*) dimuon0->GetMu(0);
+          AliAODTrack  *mu1 = (AliAODTrack*) dimuon0->GetMu(1);
+          printf("Muon0 px=%f py=%f pz=%f\n",mu0->Px(),mu0->Py(),mu0->Pz());
+          printf("Muon1 px=%f py=%f pz=%f\n",mu1->Px(),mu1->Py(),mu1->Pz());
+        }  
       }
     }
-
+  }
+  
   
   header->SetRefMultiplicity(jTracks); 
   header->SetRefMultiplicityPos(nPosTracks);
@@ -231,19 +318,20 @@ void AliAnalysisTaskESDMuonFilter::ConvertESDtoAOD()
   header->SetNumberOfMuons(nMuons);
   header->SetNumberOfDimuons(nDimuons);
   
-  // From Andrei
-  if(fEnableMuonAOD && MuonsExist){
+  if ( fEnableMuonAOD && ( (nMuons>0) || fKeepAllEvents ) )
+  {
     AliAODExtension *extMuons = dynamic_cast<AliAODHandler*>
     ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler())->GetFilteredAOD("AliAOD.Muons.root");
     extMuons->SelectEvent();
   }
-
-  if(fEnableDimuonAOD && DimuonsExist){
+  
+  if ( fEnableDimuonAOD && ( (nMuons>1) || fKeepAllEvents )  )
+  {
     AliAODExtension *extDimuons = dynamic_cast<AliAODHandler*>
-   ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler())->GetFilteredAOD("AliAOD.Dimuons.root");
+    ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler())->GetFilteredAOD("AliAOD.Dimuons.root");
     extDimuons->SelectEvent();
   }
-
+  
 }
 
 void AliAnalysisTaskESDMuonFilter::Terminate(Option_t */*option*/)
@@ -253,7 +341,9 @@ void AliAnalysisTaskESDMuonFilter::Terminate(Option_t */*option*/)
   if (fDebug > 1) printf("AnalysisESDfilter: Terminate() \n");
 }
 
-void  AliAnalysisTaskESDMuonFilter::PrintMCInfo(AliStack *pStack,Int_t label){
+void  AliAnalysisTaskESDMuonFilter::PrintMCInfo(AliStack *pStack,Int_t label)
+{
+  // print mc info
   if(!pStack)return;
   label = TMath::Abs(label);
   TParticle *part = pStack->Particle(label);
index b4723c5..a6af6aa 100644 (file)
@@ -4,8 +4,18 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
  * See cxx source for full Copyright notice                               */\r
 \r
-#include <TList.h> \r
-#include "AliAnalysisTaskSE.h"\r
+//\r
+// Add the muon tracks to the generic AOD track branch during the \r
+// filtering of the ESD. \r
+//\r
+// Authors: R. Arnaldi 5/5/08 and L. Aphecetche January 2011\r
+\r
+#ifndef ALIANALYSISTASKSE_H\r
+#  include "AliAnalysisTaskSE.h"\r
+#endif\r
+#ifndef ALIANALYSISCUTS_H\r
+#  include "AliAnalysisCuts.h"\r
+#endif\r
 \r
 class AliAnalysisFilter;\r
 class AliStack;\r
@@ -13,8 +23,8 @@ class AliStack;
 class AliAnalysisTaskESDMuonFilter : public AliAnalysisTaskSE\r
 {\r
  public:\r
-    AliAnalysisTaskESDMuonFilter();\r
-    AliAnalysisTaskESDMuonFilter(const char* name);\r
+    AliAnalysisTaskESDMuonFilter(Bool_t onlyMuon=kTRUE, Bool_t keepAllEvents=kTRUE);\r
+    AliAnalysisTaskESDMuonFilter(const char* name, Bool_t onlyMuon=kTRUE, Bool_t keepAllEvents=kTRUE);\r
     virtual ~AliAnalysisTaskESDMuonFilter() {;}\r
     // Implementation of interface methods\r
     virtual void UserCreateOutputObjects();\r
@@ -34,11 +44,37 @@ class AliAnalysisTaskESDMuonFilter : public AliAnalysisTaskSE
     AliAnalysisTaskESDMuonFilter(const AliAnalysisTaskESDMuonFilter&);\r
     AliAnalysisTaskESDMuonFilter& operator=(const AliAnalysisTaskESDMuonFilter&);\r
     void PrintMCInfo(AliStack *pStack,Int_t label); // for debugging\r
-    AliAnalysisFilter* fTrackFilter; //  Track Filter\r
-    Bool_t fEnableMuonAOD; // flag for enabling Muon AOD production\r
-    Bool_t fEnableDimuonAOD; // flag for enabling Dimuon AOD production\r
-    ClassDef(AliAnalysisTaskESDMuonFilter, 1); // Analysis task for standard ESD filtering\r
+  void AddFilteredAOD(const char* aodfilename, const char* title);\r
 \r
+  AliAnalysisFilter* fTrackFilter; //  Track Filter\r
+  Bool_t fEnableMuonAOD; // flag for enabling Muon AOD production\r
+  Bool_t fEnableDimuonAOD; // flag for enabling Dimuon AOD production\r
+  Bool_t fOnlyMuon; // flag for disabling branches irrelevant for (most) muon analyses\r
+  Bool_t fKeepAllEvents; // keep even events where there's no muons (to get e.g. unbiased vertex distribution)\r
+  \r
+  ClassDef(AliAnalysisTaskESDMuonFilter, 3); // Analysis task for standard ESD filtering\r
 };\r
  \r
+class AliAnalysisNonMuonTrackCuts : public AliAnalysisCuts\r
+{\r
+public:\r
+  AliAnalysisNonMuonTrackCuts();\r
+  virtual ~AliAnalysisNonMuonTrackCuts() {}\r
+  virtual Bool_t IsSelected(TObject* obj);\r
+  virtual Bool_t IsSelected(TList*   /* list */ ) { return kTRUE; }\r
+\r
+  ClassDef(AliAnalysisNonMuonTrackCuts,1); // Select muon spectrometer tracks\r
+};\r
+\r
+class AliAnalysisNonPrimaryVertices : public AliAnalysisCuts\r
+{\r
+public:\r
+  AliAnalysisNonPrimaryVertices();\r
+  virtual ~AliAnalysisNonPrimaryVertices() {}\r
+  virtual Bool_t IsSelected(TObject* obj);\r
+  virtual Bool_t IsSelected(TList*   /* list */ ) { return kTRUE; }\r
+  \r
+  ClassDef(AliAnalysisNonPrimaryVertices,1); // Select primary vertices\r
+};\r
+\r
 #endif\r
index ccf371e..3a1c427 100644 (file)
@@ -34,6 +34,7 @@
 #pragma link C++ class AliAODcascade+;
 #pragma link C++ class AliAODHandler+;
 #pragma link C++ class AliAODExtension+;
+#pragma link C++ class AliAODBranchReplicator+;
 #pragma link C++ class AliAODInputHandler+;
 #pragma link C++ class AliAODTracklets+;
 #pragma link C++ class AliAODTagCreator+;
diff --git a/STEER/AliAODBranchReplicator.cxx b/STEER/AliAODBranchReplicator.cxx
new file mode 100644 (file)
index 0000000..0a6b3d7
--- /dev/null
@@ -0,0 +1,61 @@
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
+
+// $Id$
+
+//
+// Base class of an object used for the replication 
+// (and possibly filtering) of one (or several) AOD branches.
+//
+// Author: L. Aphecetche (Subatech)
+//
+// Intended usage is to be able to produce, besides the standard AOD (AliAOD.root)
+// some light-weight AODs, by filtering (or skipping completely) the unwanted branches.
+// 
+// Exemple usage (pseudo-code) :
+// 
+// AliAODHandler* aodH = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
+//
+// AliAODExtension* ext = aodH->AddFilteredAOD("AliAOD.filtered.root","filtered AOD");
+//
+// ext->DisableReferences();
+//  
+// ext->FilterBranch("cascades",0x0); // AliAOD.filtered.root will *not* contain the cascades branch
+//
+//  
+// AliAODBranchReplicator* murep = new AliAODMuonReplicator("MuonReplicator",
+//                                                           "remove non muon tracks and non primary or pileup vertices",
+//                                                           new AliAnalysisNonMuonTrackCuts,
+//                                                           new AliAnalysisNonPrimaryVertices);
+// ext->FilterBranch("tracks",murep);   // both the tracks and vertices branches 
+// ext->FilterBranch("vertices",murep); // will be filtered by the MuonReplicator
+//  
+
+#include "AliAODBranchReplicator.h"
+
+ClassImp(AliAODBranchReplicator)
+
+//______________________________________________________________________________
+AliAODBranchReplicator::AliAODBranchReplicator(const char* name, const char* title)
+: TNamed(name,title)
+{
+  // default ctor (nop)
+}
+
+//______________________________________________________________________________
+AliAODBranchReplicator::~AliAODBranchReplicator()
+{
+  // dtor (nop)
+}
diff --git a/STEER/AliAODBranchReplicator.h b/STEER/AliAODBranchReplicator.h
new file mode 100644 (file)
index 0000000..b472701
--- /dev/null
@@ -0,0 +1,111 @@
+#ifndef ALIAODBRANCHREPLICATOR_H
+#define ALIAODBRANCHREPLICATOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+// Base class of an object used for the replication 
+// (and possibly filtering) of one (or several) AOD branches.
+//
+// Author L. Aphecetche (Subatech)
+
+#ifndef ROOT_TNamed
+#  include "TNamed.h"
+#endif
+
+class AliAODEvent;
+
+class AliAODBranchReplicator : public TNamed
+{
+public:
+  AliAODBranchReplicator(const char* name="", const char* title="");
+  
+  virtual ~AliAODBranchReplicator();
+
+  /// Return the list of object we manage
+  virtual TList* GetList() const = 0;
+  
+  /// Replicate (and optionally filter) the given aod event
+  virtual void ReplicateAndFilter(const AliAODEvent& source) = 0;
+
+  ClassDef(AliAODBranchReplicator,1) // AOD branch replicator base class
+};
+
+#endif
+
+#ifndef ALIAODBRANCHREPLICATOR_H
+#define ALIAODBRANCHREPLICATOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+//
+// Base class of an object used for the replication 
+// (and possibly filtering) of one (or several) AOD branches.
+//
+
+#ifndef ROOT_TNamed
+#  include "TNamed.h"
+#endif
+
+class AliAODEvent;
+
+class AliAODBranchReplicator : public TNamed
+{
+public:
+  AliAODBranchReplicator(const char* name="", const char* title="");
+  
+  virtual ~AliAODBranchReplicator();
+
+  /// Return the list of object we manage
+  virtual TList* GetList() const = 0;
+  
+  /// Replicate (and optionally filter) the given aod event
+  virtual void ReplicateAndFilter(const AliAODEvent& source) = 0;
+
+  ClassDef(AliAODBranchReplicator,1) // AOD branch replicator base class
+};
+
+#endif
+
+#ifndef ALIAODBRANCHREPLICATOR_H
+#define ALIAODBRANCHREPLICATOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+//
+// Base class of an object used for the replication 
+// (and possibly filtering) of one (or several) AOD branches.
+//
+
+#ifndef ROOT_TNamed
+#  include "TNamed.h"
+#endif
+
+class AliAODEvent;
+
+class AliAODBranchReplicator : public TNamed
+{
+public:
+  AliAODBranchReplicator(const char* name="", const char* title="");
+  
+  virtual ~AliAODBranchReplicator();
+
+  /// Return the list of object we manage
+  virtual TList* GetList() const = 0;
+  
+  /// Replicate (and optionally filter) the given aod event
+  virtual void ReplicateAndFilter(const AliAODEvent& source) = 0;
+
+  ClassDef(AliAODBranchReplicator,1) // AOD branch replicator base class
+};
+
+#endif
+
index 0e7bcb7..3166b8f 100644 (file)
@@ -42,8 +42,9 @@
 #include "AliGenDPMjetEventHeader.h"
 #include "AliGenPythiaEventHeader.h"
 #include "AliGenCocktailEventHeader.h"
-
-
+#include "AliCodeTimer.h"
+#include "AliAODBranchReplicator.h"
+#include "Riostream.h"
 
 ClassImp(AliAODHandler)
 
@@ -171,6 +172,37 @@ Bool_t AliAODHandler::Init(Option_t* opt)
   return kTRUE;
 }
 
+//______________________________________________________________________________
+void AliAODHandler::Print(Option_t* opt) const
+{
+  // Print info about this object
+
+  cout << opt << Form("IsStandard %d filename=%s",fIsStandard,fFileName.Data()) << endl;
+  
+  if ( fExtensions ) 
+  {
+    cout << opt << fExtensions->GetEntries() << " extensions :" << endl;
+    PrintExtensions("Extensions",*fExtensions);    
+  }
+  if ( fFilters ) 
+  {
+    cout << opt << fFilters->GetEntries() << " filters :" << endl;
+    PrintExtensions("Filters",*fFilters);      
+  }
+}
+
+//______________________________________________________________________________
+void AliAODHandler::PrintExtensions(const char* name, const TObjArray& array) const
+{
+  // Show the list of aod extensions
+  TIter next(&array);
+  AliAODExtension* ext(0x0);
+  while ( ( ext = static_cast<AliAODExtension*>(next()) ) )
+  {
+    ext->Print("   ");
+  }
+}
+
 //______________________________________________________________________________
 void AliAODHandler::StoreMCParticles(){
 
@@ -533,6 +565,7 @@ void AliAODHandler::AddBranch(const char* cname, void* addobj, const char* filen
 AliAODExtension *AliAODHandler::AddExtension(const char *filename, const char *title)
 {
 // Add an AOD extension with some branches in a different file.
+  
    TString fname(filename);
    if (!fname.EndsWith(".root")) fname += ".root";
    if (!fExtensions) {
@@ -662,6 +695,14 @@ ClassImp(AliAODExtension)
 //     stored.
 //-------------------------------------------------------------------------
 
+//______________________________________________________________________________
+AliAODExtension::AliAODExtension() : TNamed(), 
+fAODEvent(0), fTreeE(0), fFileE(0), fNtotal(0), fNpassed(0), 
+fSelected(kFALSE), fRepFiMap(0x0), fRepFiList(0x0), fEnableReferences(kTRUE), fObjectList(0x0)
+{
+  // default ctor
+}
+
 //______________________________________________________________________________
 AliAODExtension::AliAODExtension(const char* name, const char* title, Bool_t isfilter)
                 :TNamed(name,title), 
@@ -670,7 +711,11 @@ AliAODExtension::AliAODExtension(const char* name, const char* title, Bool_t isf
                  fFileE(0), 
                  fNtotal(0), 
                  fNpassed(0),
-                 fSelected(kFALSE)
+                 fSelected(kFALSE),
+fRepFiMap(0x0),
+fRepFiList(0x0),
+fEnableReferences(kTRUE),
+fObjectList(0x0)
 {
 // Constructor.
   if (isfilter) {
@@ -691,6 +736,10 @@ AliAODExtension::~AliAODExtension()
     fAODEvent = 0;
   }
   if (fTreeE) delete fTreeE;
+  fRepFiMap->DeleteAll();
+  delete fRepFiMap; // the map is owner
+  delete fRepFiList; // the list is not
+  delete fObjectList; // not owner
 }
 
 //______________________________________________________________________________
@@ -701,6 +750,8 @@ void AliAODExtension::AddBranch(const char* cname, void* addobj)
 //       Error("AddBranch", "Not allowed to add branched to filtered AOD's.");
 //       return;
 //    }   
+  AliCodeTimerAuto(GetName(),0);
+
     if (!fAODEvent) {
        char type[20];
        gROOT->ProcessLine(Form("TString s_tmp; AliAnalysisManager::GetAnalysisManager()->GetAnalysisTypeString(s_tmp); sprintf((char*)%p, \"%%s\", s_tmp.Data());", type));
@@ -739,6 +790,15 @@ Bool_t AliAODExtension::FinishEvent()
   }  
   // Filtered AOD. Fill only if event is selected.
   if (!fSelected) return kTRUE;
+
+  TIter next(fRepFiList);
+  
+  AliAODBranchReplicator* repfi;
+
+  while ( ( repfi = static_cast<AliAODBranchReplicator*>(next()) ) )
+  {
+    repfi->ReplicateAndFilter(*fAODEvent);
+  }
   fNpassed++;
   fTreeE->Fill();
   fSelected = kFALSE; // so that next event will not be selected unless demanded
@@ -749,7 +809,13 @@ Bool_t AliAODExtension::FinishEvent()
 Bool_t AliAODExtension::Init(Option_t *option)
 {
 // Initialize IO.
-  if(!fAODEvent) fAODEvent = new AliAODEvent();
+  AliCodeTimerAuto(GetName(),0);
+  
+  if(!fAODEvent) 
+  {
+    fAODEvent = new AliAODEvent();    
+  }
+  
   TDirectory *owd = gDirectory;
   TString opt(option);
   opt.ToLower();
@@ -763,12 +829,108 @@ Bool_t AliAODExtension::Init(Option_t *option)
     fFileE = new TFile(GetName(), "RECREATE");
   }  
   fTreeE = new TTree("aodTree", "AliAOD tree");
-  fTreeE->Branch(fAODEvent->GetList());
-  fTreeE->BranchRef();
+  
+  delete fObjectList;
+  fObjectList = new TList;
+  fObjectList->SetOwner(kFALSE); // be explicit we're not the owner...
+  TIter next(fAODEvent->GetList());
+  TObject* o;
+  
+  while ( ( o = next() ) )
+  {
+    if ( fRepFiMap )
+    {
+      TObject* specified = fRepFiMap->FindObject(o->GetName());
+      if (specified)
+      {
+        AliAODBranchReplicator* repfi = dynamic_cast<AliAODBranchReplicator*>(fRepFiMap->GetValue(o->GetName()));
+        if ( repfi ) 
+        {        
+          TList* replicatedList = repfi->GetList();
+          if (replicatedList)
+          {
+            TIter nextRep(replicatedList);
+            TObject* objRep;
+            while ( ( objRep = nextRep() ) )
+            {
+              if (!fObjectList->FindObject(objRep))
+              {
+                fObjectList->Add(objRep);
+              }
+            }
+          }
+          else
+          {
+            AliError(Form("replicatedList from %s is null !",repfi->GetName()));
+          }
+        }
+      }
+      else
+      {
+        fObjectList->Add(o);
+      }
+    }    
+  }
+
+  next.Reset();
+  
+  while ( ( o = next() ) )
+  {
+    TObject* out = fObjectList->FindObject(o->GetName());
+    AliInfo(Form("OBJECT IN %20s %p -> OUT %p %s",o->GetName(),o,out,((out!=o && out) ? "REPLICATED":"-")));
+  }
+  
+  fTreeE->Branch(fObjectList);
+  
+  if (fEnableReferences) fTreeE->BranchRef();
+  
   owd->cd();
+  
   return kTRUE;
 }
 
+//______________________________________________________________________________
+void AliAODExtension::Print(Option_t* opt) const
+{
+  // Print info about this extension
+  
+  cout << opt << Form("AliAODExtension - %s - %s",GetName(),GetTitle()) << endl;
+  cout << opt << opt << Form("References are %s enabled",fEnableReferences ? "" : "not") << endl;
+  
+  TIter next(fRepFiMap);
+  TObjString* s;
+  
+  TString skipped;
+  
+  while ( ( s = static_cast<TObjString*>(next()) ) )
+  {
+    AliAODBranchReplicator* br = static_cast<AliAODBranchReplicator*>(fRepFiMap->GetValue(s->String().Data()));
+    if ( !br ) 
+    {
+      skipped += s->String();
+      skipped += ' ';
+    }
+  }
+  
+  if ( skipped.Length() )
+  {
+    cout << opt << opt << "Branches that will be skipped altogether : " << skipped.Data() << endl;
+  }
+  
+  next.Reset();
+  
+  while ( ( s = static_cast<TObjString*>(next()) ) )
+  {
+    AliAODBranchReplicator* br = static_cast<AliAODBranchReplicator*>(fRepFiMap->GetValue(s->String().Data()));
+    
+    if (br)
+    {
+      cout << opt << opt << "Branch " << s->String() 
+      << " will be filtered by class " << br->ClassName() << endl;
+    }
+  }
+}
+
 //______________________________________________________________________________
 void AliAODExtension::SetEvent(AliAODEvent *event)
 {
@@ -802,3 +964,34 @@ Bool_t AliAODExtension::TerminateIO()
   }
   return kTRUE;
 }
+
+//______________________________________________________________________________
+void AliAODExtension::FilterBranch(const char* branchName, AliAODBranchReplicator* repfi)
+{
+  // Specify a filter/replicator for a given branch
+  //
+  // If repfi=0x0, this will disable the branch (in the output) completely.
+  //
+  // repfi is adopted by this class, i.e. user should not delete it.
+  //
+  // WARNING : branch name must be exact.
+  //
+  // See also the documentation for AliAODBranchReplicator class.
+  //
+  
+  if (!fRepFiMap)
+  {
+    fRepFiMap = new TMap;
+    fRepFiMap->SetOwnerKeyValue(kTRUE,kTRUE);
+    fRepFiList = new TList;
+    fRepFiList->SetOwner(kFALSE);
+  }
+  
+  fRepFiMap->Add(new TObjString(branchName),repfi);
+  
+  if (repfi && !fRepFiList->FindObject(repfi))
+  {
+    // insure we get unique and non-null replicators in this list
+    fRepFiList->Add(repfi);
+  }
+}
index 6448d63..e920bab 100644 (file)
@@ -20,8 +20,8 @@ class AliMCEventHandler;
 class AliAODMCHeader;
 class AliAODExtension;
 class AliGenEventHeader;
-
-
+class TMap;
+class AliAnalysisFilter;
 
 class AliAODHandler : public AliVEventHandler {
     
@@ -93,10 +93,14 @@ class AliAODHandler : public AliVEventHandler {
     void                 SetMCEventHandler(AliMCEventHandler* mcH) {fMCEventH = mcH;} // For internal use
     void StoreMCParticles(); // Store MC particles, only to be called from AliAnalyisTaskMCParticleFilter
 
+  void Print(Option_t* opt="") const;
+  
  private:
     void SetMCHeaderInfo(AliAODMCHeader *mcHeader,AliGenEventHeader *genHeader); // Utility function t catch different types of eventheaders
     AliAODHandler(const AliAODHandler&);             // Not implemented
     AliAODHandler& operator=(const AliAODHandler&);  // Not implemented
+  void PrintExtensions(const char* name, const TObjArray& array) const;
+  
  private:
     Bool_t                   fIsStandard;                         // Flag for standard aod creation
     Bool_t                   fFillAOD;                            // Flag for filling of the AOD tree at the end (all or nothing evt by evt)
@@ -132,6 +136,8 @@ class AliAODHandler : public AliVEventHandler {
 //     Author: Andrei Gheata, CERN
 //-------------------------------------------------------------------------
 
+class AliAODBranchReplicator;
+
 class AliAODExtension : public TNamed {
 
 public:
@@ -140,7 +146,7 @@ enum EAliAODExtensionFlags {
    kFilteredAOD      = BIT(14)
 };
     
-    AliAODExtension() : TNamed(), fAODEvent(0), fTreeE(0), fFileE(0), fNtotal(0), fNpassed(0), fSelected(kFALSE) {}
+  AliAODExtension();
     AliAODExtension(const char* name, const char* title, Bool_t isfilter=kFALSE);
     virtual ~AliAODExtension();
     void                 AddBranch(const char* cname, void* addobj);
@@ -157,6 +163,13 @@ enum EAliAODExtensionFlags {
     void                 SetEvent(AliAODEvent *event);
     void                 SetOutputFileName(const char* fname) {TNamed::SetName(fname);}
     Bool_t               TerminateIO();
+
+  void Print(Option_t* opt="") const;
+  
+  void FilterBranch(const char* branchName, AliAODBranchReplicator* replicator=0x0);
+  void DisableReferences() { fEnableReferences=kFALSE; }
+  void EnableReferences() { fEnableReferences=kTRUE; }
+  
  private:
     AliAODExtension(const AliAODExtension&);             // Not implemented
     AliAODExtension& operator=(const AliAODExtension&);  // Not implemented
@@ -168,6 +181,13 @@ enum EAliAODExtensionFlags {
     Int_t                    fNtotal;                 //! Number of processed events
     Int_t                    fNpassed;                //! Number of events that passed the filter
     Bool_t                   fSelected;               //! Select current event for filtered AOD's. Made false at event start.
-    ClassDef(AliAODExtension, 1)                      // Support for extra AOD branches in a separate AOD file
+
+    TMap*                    fRepFiMap; // which branch(es) to filter out / and or replicate
+    TList*                   fRepFiList; // list of unique filter/replicator
+  
+    Bool_t                   fEnableReferences; // whether or not to enable the TRefTable branch
+    TList*                   fObjectList; //! internal list of which objects to keep 
+  
+  ClassDef(AliAODExtension, 2) // Support for extra AOD branches in a separate AOD file
 };
 #endif
index 0b4bf91..64285e7 100644 (file)
@@ -182,6 +182,28 @@ AliAODVertex::AliAODVertex(const AliAODVertex& vtx) :
   }
 }
 
+//______________________________________________________________________________
+AliAODVertex* AliAODVertex::CloneWithoutRefs() const
+{
+  // Special method to copy all but the refs 
+  
+  Double_t cov[6] = { 0.0 };
+      
+  if (fCovMatrix) fCovMatrix->GetCovMatrix(cov);
+  
+  AliAODVertex* v = new AliAODVertex(fPosition,
+                                     cov,
+                                     fChi2perNDF,
+                                     0x0,
+                                     fID,
+                                     fType,
+                                     0);
+  
+  v->SetNContributors(fNContributors);  
+  
+  return v;
+}
+
 //______________________________________________________________________________
 AliAODVertex& AliAODVertex::operator=(const AliAODVertex& vtx) 
 {
@@ -538,6 +560,75 @@ void AliAODVertex::PrintIndices() const
   }
 }
 
+//______________________________________________________________________________
+const char* AliAODVertex::AsString() const
+{
+  // Make a string describing this object
+  
+  TString tmp(Form("%10s pos(%7.2f,%7.2f,%7.2f)",GetTypeName((AODVtx_t)GetType()),GetX(),GetY(),GetZ()));
+  
+  if (GetType()==kPrimary || GetType()==kMainSPD || GetType()==kPileupSPD )
+  {
+    tmp += Form(" ncontrib %d chi2/ndf %4.1f",GetNContributors(),GetChi2perNDF());
+
+  }
+  
+  if ( !fParent.GetObject() ) 
+  {
+    tmp += " no parent";
+  }
+  if ( fDaughters.GetEntriesFast() > 0 )
+  {
+    if ( fDaughters.GetEntriesFast() == 1 ) 
+    {
+      tmp += " origin of 1 particle";
+    }
+    else
+    {
+      tmp += Form(" origin of %2d particles",fDaughters.GetEntriesFast());
+    }
+  }
+  
+  return tmp.Data();
+}
+
+//______________________________________________________________________________
+const char* AliAODVertex::GetTypeName(AODVtx_t type)
+{
+  // Return an ASCII version of type
+  
+  switch (type)
+  {
+    case kPrimary:
+      return "primary";
+      break;
+    case kKink:
+      return "kink";
+      break;
+    case kV0:
+      return "v0";
+      break;
+    case kCascade:
+      return "cascade";
+      break;
+    case kMainSPD:
+      return "mainSPD";
+      break;
+    case kPileupSPD:
+      return "pileupSPD";
+      break;
+    case kPileupTracks:
+      return "pileupTRK";
+      break;
+    case kMainTPC:
+      return "mainTPC";
+      break;
+    default:
+      return "unknown";
+      break;
+  };
+}
+
 //______________________________________________________________________________
 void AliAODVertex::Print(Option_t* /*option*/) const 
 {
index d3fc859..1c4c386 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef AliAODVertex_H
-#define AliAODVertex_H
+#ifndef ALIAODVERTEX_H
+#define ALIAODVERTEX_H
 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
@@ -53,6 +53,8 @@ class AliAODVertex : public AliVVertex {
   AliAODVertex(const AliAODVertex& vtx); 
   AliAODVertex& operator=(const AliAODVertex& vtx);
 
+  virtual AliAODVertex* CloneWithoutRefs() const;
+  
   void     SetX(Double_t x) { fPosition[0] = x; }
   void     SetY(Double_t y) { fPosition[1] = y; }
   void     SetZ(Double_t z) { fPosition[2] = z; }
@@ -124,7 +126,12 @@ class AliAODVertex : public AliVVertex {
   
   void     PrintIndices() const;
   void     Print(Option_t* option = "") const;
-  private:
+
+  const char* AsString() const;
+  
+  static const char* GetTypeName(AODVtx_t type);
+  
+private:
   void     MakeProngs() {if (fNprong > 0) {fProngs = new TRef[fNprong]; fIprong=0;}}
          
  private:
index 4940d44..3b023b2 100644 (file)
@@ -1,4 +1,4 @@
-set ( SRCS  AliAODEvent.cxx AliAODHeader.cxx AliAODTrack.cxx AliAODPid.cxx AliAODVertex.cxx AliAODCluster.cxx AliAODCaloCluster.cxx AliAODPmdCluster.cxx AliAODFmdCluster.cxx AliAODJet.cxx AliAODJetEventBackground.cxx AliAODPhoton.cxx AliAODRedCov.cxx AliAODRecoDecay.cxx AliAODHandler.cxx AliAODTracklets.cxx AliAODTagCreator.cxx AliAODv0.cxx AliAODcascade.cxx AliAODCaloCells.cxx AliAODInputHandler.cxx AliAODDiJet.cxx AliAODMCParticle.cxx AliAODMCHeader.cxx AliAODPWG4Particle.cxx AliAODPWG4ParticleCorrelation.cxx AliAODDimuon.cxx AliAODpidUtil.cxx AliAODCentrality.cxx)
+set ( SRCS  AliAODEvent.cxx AliAODHeader.cxx AliAODTrack.cxx AliAODPid.cxx AliAODVertex.cxx AliAODCluster.cxx AliAODCaloCluster.cxx AliAODPmdCluster.cxx AliAODFmdCluster.cxx AliAODJet.cxx AliAODJetEventBackground.cxx AliAODPhoton.cxx AliAODRedCov.cxx AliAODRecoDecay.cxx AliAODHandler.cxx AliAODTracklets.cxx AliAODTagCreator.cxx AliAODv0.cxx AliAODcascade.cxx AliAODCaloCells.cxx AliAODInputHandler.cxx AliAODDiJet.cxx AliAODMCParticle.cxx AliAODMCHeader.cxx AliAODPWG4Particle.cxx AliAODPWG4ParticleCorrelation.cxx AliAODDimuon.cxx AliAODpidUtil.cxx AliAODCentrality.cxx AliAODBranchReplicator.cxx)
 
 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")