AddTaskMuonDistribution.C -> possibility to swich on/off the invariant mass fit from...
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 29 Nov 2009 22:06:23 +0000 (22:06 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 29 Nov 2009 22:06:23 +0000 (22:06 +0000)
PWG3/muon/AddPWG3MuonTrain.C [new file with mode: 0644]
PWG3/muon/AddTaskMuonDistributions.C
PWG3/muon/AliAnalysisTaskMuonDistributions.cxx

diff --git a/PWG3/muon/AddPWG3MuonTrain.C b/PWG3/muon/AddPWG3MuonTrain.C
new file mode 100644 (file)
index 0000000..1e62cbf
--- /dev/null
@@ -0,0 +1,31 @@
+Int_t AddPWG3MuonTrain(Int_t iESDAnalysis,
+                       Int_t iAODAnalyis,
+                       Int_t addMuonDistributions,
+                      Int_t addSingleMuonAnalysis) {
+  //
+  // Analysis wagons for PWG3Muon (Roberta)
+  //
+  TString taskName="",loadMacroPath="$ALICE_ROOT/PWG3/muon/";
+  Int_t ntasks=0;
+  
+  if(addMuonDistributions) {
+    taskName="AddTaskMuonDistributions.C"; taskName.Prepend(loadMacroPath.Data());
+    gROOT->LoadMacro(taskName.Data());
+    Bool_t doInvMassFit = kTRUE;
+    if(iESDAnalysis){
+      AliAnalysisTaskMuonDistributions *esdmuondistributionstask = AddTaskMuonDistributions("ESD",doInvMassFit);       
+    } else if(iAODAnalysis){
+      AliAnalysisTaskMuonDistributions *aodmuondistributionstask = AddTaskMuonDistributions("AOD",doInvMassFit);       
+    }
+    ntasks++;
+  }
+
+  if(addSingleMuonAnalysis) {
+    taskName="AddTaskSingleMuonAnalysis.C"; taskName.Prepend(loadMacroPath.Data());
+    gROOT->LoadMacro(taskName.Data());
+    AliAnalysisTaskSingleMu *singlemutask = AddTaskSingleMuonAnalysis();       
+    ntasks++;
+  }
+
+  return ntasks;
+}
index 38da142..8a3ec72 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTaskMuonDistributions *AddTaskMuonDistributions(const char *kAnalysisType){
+AliAnalysisTaskMuonDistributions *AddTaskMuonDistributions(const char *kAnalysisType, Bool_t doFitInvMass){
 
 //****************************************************************************************
 // Add task class.
@@ -37,7 +37,7 @@ AliAnalysisTaskMuonDistributions *AddTaskMuonDistributions(const char *kAnalysis
    //
    // perform fit to the invariant mass spectrum
    //
-   MuonDistributionsTask->FitInvariantMassSpectrum(kFALSE);
+   MuonDistributionsTask->FitInvariantMassSpectrum(doFitInvMass);
   
    mgr->AddTask(MuonDistributionsTask);
  
index b3b188a..065225f 100755 (executable)
@@ -343,7 +343,7 @@ void AliAnalysisTaskMuonDistributions::Terminate(Option_t *)
   TCanvas *c3_MuonDistributions = new TCanvas("c3_MuonDistributions","Invariant Mass Plots",xmin,ymin,600,600);
   gPad->SetLogy(1);
   hMassDimu->Draw();  
-  if(fInvariantMassFit) FitInvMass(hMassDimu);
+  if(fInvariantMassFit && hMassDimu->GetEntries()>100) FitInvMass(hMassDimu);
   c3_MuonDistributions->Update();
 }
 
@@ -527,6 +527,7 @@ void AliAnalysisTaskMuonDistributions::FitInvMass(TH1D *histo)
   
   printf("\n\n****************************************************************************\n");
   char psitext[100];
+  if(nPsiFit<0) nPsiFit = 0;  
   sprintf(psitext,"N. J/#psi = %10.0f",nPsiFit);
   printf("\nN. J/psi = %10.0f\n",nPsiFit);
   TLatex *psilatex = new TLatex(4.,0.85*histo->GetMaximum(),psitext);
@@ -554,6 +555,7 @@ void AliAnalysisTaskMuonDistributions::FitInvMass(TH1D *histo)
   sblatex->Draw();
   
   char psiptext[100];
+  if(nPsiPFit<0) nPsiPFit = 0;  
   sprintf(psiptext,"N. #psi(2S) = %10.0f",nPsiPFit);
   printf("\npsi(2S) = %10.0f\n",nPsiPFit);
   TLatex *psiplatex = new TLatex(4.,0.106*histo->GetMaximum(),psiptext);