AliAnalysisTask for AliAnalysisVertexingHF (Julien)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2007 19:07:50 +0000 (19:07 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2007 19:07:50 +0000 (19:07 +0000)
PWG3/AliAnalysisTaskVertexingHF.cxx [new file with mode: 0644]
PWG3/AliAnalysisTaskVertexingHF.h [new file with mode: 0644]
PWG3/AliAnalysisTaskVertexingHFTest.C [new file with mode: 0644]
PWG3/ConfigVertexingHF.C [new file with mode: 0644]
PWG3/PWG3baseLinkDef.h
PWG3/libPWG3base.pkg

diff --git a/PWG3/AliAnalysisTaskVertexingHF.cxx b/PWG3/AliAnalysisTaskVertexingHF.cxx
new file mode 100644 (file)
index 0000000..902ae02
--- /dev/null
@@ -0,0 +1,141 @@
+/**************************************************************************
+ * Copyright(c) 1998-2007, 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.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//
+//     AliAnalysisTask for the reconstruction of heavy flavor
+// decays, using the class AliAnalysisVertexingHF.
+//
+// Author: J.Faivre, julien.faivre@pd.infn.it
+/////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include <TChain.h>
+#include <TCanvas.h>
+#include <TSystem.h>
+#include "Riostream.h"
+
+#include "AliAnalysisTask.h"
+#include "AliESDEvent.h"
+#include "AliAnalysisVertexingHF.h"
+#include "AliAnalysisTaskVertexingHF.h"
+
+ClassImp(AliAnalysisTaskVertexingHF)
+
+
+//________________________________________________________________________
+AliAnalysisTaskVertexingHF::AliAnalysisTaskVertexingHF(const char *name) :
+AliAnalysisTask(name,""), 
+fESD(0), 
+fChain(0), 
+vHF(0), 
+mTrees(0)
+{
+  //Constructor
+
+  //Input slot #0 works with an Ntuple
+  DefineInput(0, TChain::Class());
+  //Output slots 0 to 3 write into a TTree
+  DefineOutput(0, TTree::Class());
+  DefineOutput(1, TTree::Class());
+  DefineOutput(2, TTree::Class());
+  DefineOutput(3, TTree::Class());
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::ConnectInputData(Option_t *)
+{
+  //Implementation of AliAnalysisTask::ConnectInputData
+
+  Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
+  fChain = (TChain*)GetInputData(0);
+  fESD = new AliESDEvent();
+  fESD->ReadFromTree(fChain);
+
+  return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::CreateOutputObjects()
+{
+  //Implementation of AliAnalysisTask::CreateOutputObjects
+  //4 output trees (D0 in 2-prongs, J/Psi to e+e-, 3-prongs (D+, Ds, /\c), D0 in 4-prongs)
+
+  mTrees = new TTree[4];
+  AliAODRecoDecayHF2Prong *rd2=0;
+  AliAODRecoDecayHF3Prong *rd3=0;
+  AliAODRecoDecayHF4Prong *rd4=0;
+  mTrees[0].SetName("NameD0toKpi");
+  mTrees[0].SetTitle("TitleD0toKpi");
+  mTrees[1].SetName("NameJPSItoEle");
+  mTrees[1].SetTitle("TitleJPSItoEle");
+  mTrees[2].SetName("NameCharmto3Prong");
+  mTrees[2].SetTitle("TitleCharmto3Prong");
+  mTrees[3].SetName("NameD0to4Prong");
+  mTrees[3].SetTitle("TitleD0to4Prong");
+  mTrees[0].Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
+  mTrees[1].Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
+  mTrees[2].Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
+  mTrees[3].Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
+
+  return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::LocalInit()
+{
+  //Instanciates vHF and loads its parameters
+
+  gROOT->LoadMacro("ConfigVertexingHF.C");
+
+  vHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");  
+  vHF->PrintStatus();
+
+  return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::Exec(Option_t *)
+{
+  //Performs heavy flavor vertexing
+
+  //Transition to new ESD format (from AliRoot v4-06 ?) :
+  fESD->GetAliESDOld();
+  if (fESD->GetAliESDOld()) fESD->CopyFromOldESD();
+  
+  //Heavy flavor vertexing :
+  vHF->FindCandidates(fESD,mTrees);
+  
+  //Post final data. It will be written to a file with option "RECREATE"
+  PostData(0, &mTrees[0]);
+  PostData(1, &mTrees[1]);
+  PostData(2, &mTrees[2]);
+  PostData(3, &mTrees[3]);
+
+  return;
+}      
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::Terminate(Option_t *)
+{
+  //Implementation of AliAnalysisTask::Terminate
+
+  return;
+}
+
+
+
+
+
+
+
+
+
diff --git a/PWG3/AliAnalysisTaskVertexingHF.h b/PWG3/AliAnalysisTaskVertexingHF.h
new file mode 100644 (file)
index 0000000..7b0cd61
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIANALYSISTASKVERTEXINGHF_H
+#define ALIANALYSISTASKVERTEXINGHF_H
+
+/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//*************************************************************************
+// Class AliAnalysisTaskVertexingHF
+// AliAnalysisTask for the reconstruction of heavy-flavour decay candidates
+// Author: J.Faivre, julien.faivre@pd.infn.it
+//*************************************************************************
+
+
+#include <TH1.h>
+#include <TChain.h>
+#include "AliESDEvent.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliAnalysisVertexingHF.h"
+
+
+class AliAnalysisTaskVertexingHF : public AliAnalysisTask
+{
+ public:
+
+  AliAnalysisTaskVertexingHF() : AliAnalysisTask(), fESD(0), fChain(0), vHF(0), mTrees(0) {}
+  AliAnalysisTaskVertexingHF(const char *name);
+  
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+  virtual void   LocalInit();
+  
+ private:
+
+  AliESDEvent            *fESD;   //ESD
+  TChain                 *fChain; //Chain
+  AliAnalysisVertexingHF *vHF;    //Vertexer heavy flavour
+  TTree                  *mTrees; //Output trees (D0 in 2-prongs, J/Psi to e+e-, 3-prongs (D+, Ds, Lc), D0 in 4-prongs)
+  
+  ClassDef(AliAnalysisTaskVertexingHF,1); //AliAnalysisTask for the reconstruction of heavy-flavour decay candidates
+};
+
+#endif
+
diff --git a/PWG3/AliAnalysisTaskVertexingHFTest.C b/PWG3/AliAnalysisTaskVertexingHFTest.C
new file mode 100644 (file)
index 0000000..8854ccc
--- /dev/null
@@ -0,0 +1,74 @@
+void AliAnalysisTaskVertexingHFTest() {
+
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISRL");
+  gSystem->Load("libAOD.so");
+  gSystem->Load("libPWG3base.so");
+  //This file can cause problems :
+  if (!gSystem->AccessPathName("$ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so",kFileExists)) {
+    printf("File $ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so exists and can cause problems, delete it if you can...");
+    return;
+  }
+
+  //Run over local files :
+  TChain *chain= new TChain("esdTree");
+  chain->Add("AliESDs.root"); // put path to your files here
+  
+  // OR :
+  /*
+  //Fetch files with AliEn :
+  const char *collectionfile = "essai6000CollectionTags1.xml";
+  TGrid::Connect("alien://") ;
+  //Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria
+  AliRunTagCuts      *runCuts   = new AliRunTagCuts();
+  AliEventTagCuts    *eventCuts = new AliEventTagCuts();
+  AliLHCTagCuts      *lhcCuts   = new AliLHCTagCuts();
+  AliDetectorTagCuts *detCuts   = new AliDetectorTagCuts();
+  eventCuts->SetMultiplicityRange(0,20000);
+  //Create an AliTagAnalysis Object and chain the tags
+  AliTagAnalysis   *tagAna = new AliTagAnalysis();
+  tagAna->SetType("ESD");
+  TAlienCollection *coll   = TAlienCollection::Open(collectionfile);
+  TGridResult      *tagResult = coll->GetGridResult("",0,0);
+  tagResult->Print();
+  tagAna->ChainGridTags(tagResult);
+  //Create a new esd chain and assign the chain that is returned by querying the tags
+  TChain* chain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts);
+  */
+  //Temporary solution to avoid memory leaks : 
+  chain->SetBranchStatus("*FMD*",0);
+  chain->SetBranchStatus("*CaloClusters*",0);
+
+  //Create tasks
+  AliAnalysisManager *analManager = new AliAnalysisManager("myAnalysisManager");
+  //analManager->SetDebugLevel(10);
+  AliAnalysisTaskVertexingHF *task1 = new AliAnalysisTaskVertexingHF("myTask");
+  analManager->AddTask(task1);
+  //Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = analManager->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = analManager->CreateContainer("tree1", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+  AliAnalysisDataContainer *coutput2 = analManager->CreateContainer("tree2", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+  AliAnalysisDataContainer *coutput3 = analManager->CreateContainer("tree3", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+  AliAnalysisDataContainer *coutput4 = analManager->CreateContainer("tree4", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+  analManager->ConnectInput(task1,0,cinput1);
+  analManager->ConnectOutput(task1,0,coutput1);
+  analManager->ConnectOutput(task1,1,coutput2);
+  analManager->ConnectOutput(task1,2,coutput3);
+  analManager->ConnectOutput(task1,3,coutput4);
+  cinput1->SetData(chain);
+  printf("CHAIN HAS %d ENTRIES\n",(Int_t)chain->GetEntries());
+  if (analManager->InitAnalysis()) {
+    analManager->PrintStatus();
+    //analManager->StartAnalysis("grid",chain);
+    analManager->StartAnalysis("local",chain);
+  }
+  return;
+}
+
+
+
diff --git a/PWG3/ConfigVertexingHF.C b/PWG3/ConfigVertexingHF.C
new file mode 100644 (file)
index 0000000..0059a52
--- /dev/null
@@ -0,0 +1,22 @@
+AliAnalysisVertexingHF* ConfigVertexingHF() {
+
+  printf("Call to AliAnalysisVertexingHF parameters setting :\n");
+  vHF = new AliAnalysisVertexingHF();
+  //vHF->SetJPSItoEleOff();
+  vHF->Set3ProngOff();
+  vHF->Set4ProngOff();
+  vHF->SetITSrefitRequired();
+  vHF->SetBothSPDNotRequired();
+  vHF->SetMinITSCls(5);
+  vHF->SetMinPtCut(0.5);
+  vHF->SetMind0Cut(0.);
+  vHF->SetD0toKpiCuts(0.2,999999.,1.1,0.,0.,999999.,999999.,999999.,0.3);
+  vHF->SetBtoJPSICuts(0.350);
+  vHF->SetDplusCuts(0.2,0.,0.,0.,0.,0.01,0.06,0.,0.,0.8);
+  return vHF;
+}
+
+
+
index 12cf895f214808c7d4d6e9912b90114259c70494..32929fc152a3ff76effc17aee2395d45d97e6865 100644 (file)
@@ -17,6 +17,7 @@
 #pragma link C++ class AliAODRecoDecayHF3Prong+;
 #pragma link C++ class AliAODRecoDecayHF4Prong+;
 #pragma link C++ class AliAnalysisVertexingHF+;
+#pragma link C++ class AliAnalysisTaskVertexingHF+;
 
 #endif
 
index 41d567cb3086b36d06c3a2b9c952dcabdfdfcf11..7e755d28ba6d5178bea9e2a2cb6521a6d5df8a59 100644 (file)
@@ -5,7 +5,7 @@ SRCS:= AliQuarkoniaAcceptance.cxx \
        AliAODRecoDecayHF.cxx \
        AliAODRecoDecayHF2Prong.cxx  AliAODRecoDecayHF3Prong.cxx \
        AliAODRecoDecayHF4Prong.cxx \
-       AliAnalysisVertexingHF.cxx
+       AliAnalysisVertexingHF.cxx AliAnalysisTaskVertexingHF.cxx
      
 HDRS:= $(SRCS:.cxx=.h)