Support and analysis code modified
authorauras <antonio.uras@cern.ch>
Wed, 19 Mar 2014 15:41:36 +0000 (16:41 +0100)
committerhristov <Peter.Hristov@cern.ch>
Thu, 27 Mar 2014 15:25:15 +0000 (16:25 +0100)
MFT/AliAnalysisTaskMFTExample.cxx
MFT/AliAnalysisTaskMFTExample.h
MFT/AliMFTSupport.cxx
MFT/RunAnalysisTaskMFTExample.C

index 4768137..52e2cd6 100755 (executable)
@@ -13,6 +13,7 @@
 #include "AliMFTConstants.h"
 #include "AliMFTSupport.h"
 #include "TRandom.h"
+#include "TList.h"
 
 ClassImp(AliAnalysisTaskMFTExample)
 
@@ -21,6 +22,7 @@ ClassImp(AliAnalysisTaskMFTExample)
 AliAnalysisTaskMFTExample::AliAnalysisTaskMFTExample() : 
   AliAnalysisTaskSE(),
   fVertexMode(0),
+  fHistogramList(0),
   fHistPtSingleMuons(0),
   fHistPtSingleMuonsFromJpsi(0),
   fHistPtDimuonsOS(0),
@@ -45,6 +47,7 @@ AliAnalysisTaskMFTExample::AliAnalysisTaskMFTExample() :
 AliAnalysisTaskMFTExample::AliAnalysisTaskMFTExample(const Char_t *name) : 
   AliAnalysisTaskSE(name),
   fVertexMode(0),
+  fHistogramList(0),
   fHistPtSingleMuons(0),
   fHistPtSingleMuonsFromJpsi(0),
   fHistPtDimuonsOS(0),
@@ -63,15 +66,7 @@ AliAnalysisTaskMFTExample::AliAnalysisTaskMFTExample(const Char_t *name) :
   fVtxResolutionITS[2] = 4.e-4;
 
   // Define input and output slots here
-  DefineOutput(1, TH1D::Class());
-  DefineOutput(2, TH1D::Class());
-  DefineOutput(3, TH1D::Class());
-  DefineOutput(4, TH1D::Class());
-  DefineOutput(5, TH1D::Class());
-  DefineOutput(6, TH1D::Class());
-  DefineOutput(7, TH1D::Class());
-  DefineOutput(8, TH1D::Class());
-  DefineOutput(9, TH1D::Class());
+  DefineOutput(1, TList::Class());
 
 }
 
@@ -81,6 +76,9 @@ void AliAnalysisTaskMFTExample::UserCreateOutputObjects() {
 
   // Called once
 
+  fHistogramList = new TList();
+  fHistogramList->SetOwner(kTRUE);
+  
   fHistPtSingleMuons = new TH1D("fHistPtSingleMuons","p_{T} of single muons (All)", 100, 0, 10);
   fHistPtSingleMuons -> SetXTitle("p_{T}  [GeV/c]");
   fHistPtSingleMuons -> Sumw2();
@@ -117,16 +115,18 @@ void AliAnalysisTaskMFTExample::UserCreateOutputObjects() {
   fHistResidualZVtxJpsi -> SetXTitle("Residual  [#mum]");
   fHistResidualZVtxJpsi -> Sumw2();
 
-  PostData(1, fHistPtSingleMuons);
-  PostData(2, fHistPtSingleMuonsFromJpsi);
-  PostData(3, fHistMassDimuonsOS);
-  PostData(4, fHistMassDimuonsJpsi);
-  PostData(5, fHistPtDimuonsOS);
-  PostData(6, fHistPtDimuonsJpsi);
-  PostData(7, fHistResidualXVtxJpsi);
-  PostData(8, fHistResidualYVtxJpsi);
-  PostData(9, fHistResidualZVtxJpsi);
-  
+  fHistogramList->Add(fHistPtSingleMuons);
+  fHistogramList->Add(fHistPtSingleMuonsFromJpsi);
+  fHistogramList->Add(fHistMassDimuonsOS);
+  fHistogramList->Add(fHistMassDimuonsJpsi);
+  fHistogramList->Add(fHistPtDimuonsOS);
+  fHistogramList->Add(fHistPtDimuonsJpsi);
+  fHistogramList->Add(fHistResidualXVtxJpsi);
+  fHistogramList->Add(fHistResidualYVtxJpsi);
+  fHistogramList->Add(fHistResidualZVtxJpsi);
+
+  PostData(1, fHistogramList);
+
 }
 
 //====================================================================================================================================================
@@ -227,15 +227,7 @@ void AliAnalysisTaskMFTExample::UserExec(Option_t *) {
  
   //--------------------------------------------------------------------------------------------------
    
-  PostData(1, fHistPtSingleMuons);
-  PostData(2, fHistPtSingleMuonsFromJpsi);
-  PostData(3, fHistMassDimuonsOS);
-  PostData(4, fHistMassDimuonsJpsi);
-  PostData(5, fHistPtDimuonsOS);
-  PostData(6, fHistPtDimuonsJpsi);
-  PostData(7, fHistResidualXVtxJpsi);
-  PostData(8, fHistResidualYVtxJpsi);
-  PostData(9, fHistResidualZVtxJpsi);
+  PostData(1, fHistogramList);
 
 }
 
index f49c181..4ab6884 100755 (executable)
@@ -3,6 +3,7 @@
 
 #include "AliAnalysisTaskSE.h"
 #include "TH1D.h"
+#include "TList.h"
 
 //====================================================================================================================================================
 
@@ -43,6 +44,8 @@ private:
   Double_t fPrimaryVertex[3], fVtxResolutionITS[3];
   Int_t fVertexMode;
 
+  TList *fHistogramList;
+
   TH1D *fHistPtSingleMuons, *fHistPtSingleMuonsFromJpsi;
   TH1D *fHistPtDimuonsOS, *fHistMassDimuonsOS;
   TH1D *fHistPtDimuonsJpsi, *fHistMassDimuonsJpsi;
index a67dc10..d280020 100644 (file)
@@ -45,7 +45,7 @@ Bool_t AliMFTSupport::ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t x
 
   param -> SetNonBendingCoor(muon->XAtDCA());
   param -> SetBendingCoor(muon->YAtDCA());
-  param -> SetZ(0.);
+  param -> SetZ(AliMFTConstants::fZEvalKinem);
   param -> SetNonBendingSlope(muon->Px()/muon->Pz());
   param -> SetBendingSlope(muon->Py()/muon->Pz());
   param -> SetInverseBendingMomentum( muon->Charge() * (1./muon->Pz()) / (TMath::Sqrt(1+TMath::Power(muon->Py()/muon->Pz(),2))) );
@@ -78,8 +78,8 @@ Bool_t AliMFTSupport::RefitAODDimuonWithCommonVertex(AliAODDimuon *dimuon, Doubl
   param0 -> SetBendingCoor(muon0->YAtDCA());
   param1 -> SetBendingCoor(muon1->YAtDCA());
 
-  param0 -> SetZ(0.);
-  param1 -> SetZ(0.);
+  param0 -> SetZ(AliMFTConstants::fZEvalKinem);
+  param1 -> SetZ(AliMFTConstants::fZEvalKinem);
  
   param0 -> SetNonBendingSlope(muon0->Px()/muon0->Pz());
   param1 -> SetNonBendingSlope(muon1->Px()/muon1->Pz());
@@ -90,6 +90,8 @@ Bool_t AliMFTSupport::RefitAODDimuonWithCommonVertex(AliAODDimuon *dimuon, Doubl
   param0 -> SetInverseBendingMomentum( muon0->Charge() * (1./muon0->Pz()) / (TMath::Sqrt(1+TMath::Power(muon0->Py()/muon0->Pz(),2))) );
   param1 -> SetInverseBendingMomentum( muon1->Charge() * (1./muon1->Pz()) / (TMath::Sqrt(1+TMath::Power(muon1->Py()/muon1->Pz(),2))) );
 
+  // here we understand in which direction we have to search the minimum...
+
   Double_t step = 1.;  // in cm
   Double_t startPoint = 0.;
 
@@ -138,6 +140,8 @@ Bool_t AliMFTSupport::RefitAODDimuonWithCommonVertex(AliAODDimuon *dimuon, Doubl
     if      (r[0]>r[1] && r[1]>r[2]) researchDirection = +1.;   // towards z positive
     else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1.;   // towards z negative
   }
+
+  // now we now that the minimum is between z[0] and z[2] and we search it
     
   step *= 0.5;
   while (step>AliMFTConstants::fPrecisionPointOfClosestApproach) {
index 86d6d0a..8bbf88a 100755 (executable)
@@ -24,28 +24,12 @@ Bool_t RunAnalysisTaskMFTExample(const Char_t *runType="local",       // "grid"
   mgr->AddTask(task);
   
   // create output container(s)
-  AliAnalysisDataContainer *output1 = mgr->CreateContainer("output1",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output2 = mgr->CreateContainer("output2",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output3 = mgr->CreateContainer("output3",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output4 = mgr->CreateContainer("output4",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output5 = mgr->CreateContainer("output5",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output6 = mgr->CreateContainer("output6",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output7 = mgr->CreateContainer("output7",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output8 = mgr->CreateContainer("output8",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
-  AliAnalysisDataContainer *output9 = mgr->CreateContainer("output9",   TH1D::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
+  AliAnalysisDataContainer *histogramList = mgr->CreateContainer("list", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
   
   // connect input and output
   mgr->ConnectInput(task,  0, mgr->GetCommonInputContainer());
-  mgr->ConnectOutput(task, 1, output1);
-  mgr->ConnectOutput(task, 2, output2);
-  mgr->ConnectOutput(task, 3, output3);
-  mgr->ConnectOutput(task, 4, output4);
-  mgr->ConnectOutput(task, 5, output5);
-  mgr->ConnectOutput(task, 6, output6);
-  mgr->ConnectOutput(task, 7, output7);
-  mgr->ConnectOutput(task, 8, output8);
-  mgr->ConnectOutput(task, 9, output9);
-  
+  mgr->ConnectOutput(task, 1, histogramList);
+
   // RUN ANALYSIS
 
   TStopwatch timer;