]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AddTaskForwarddNdeta.C
Now use gSystem->Exec("gbbox ps -Ax > tmpfile") to work
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwarddNdeta.C
1 /**
2  * @file   AddTaskForwarddNdeta.C
3  * @author Christian Holm Christensen <cholm@nbi.dk>
4  * @date   Fri Jan 28 10:22:26 2011
5  * 
6  * @brief Script to add a multiplicity task for the central
7  *        @f$\eta@f$ region
8  * 
9  * 
10  * @ingroup pwglf_forward_scripts_tasks
11  */
12 /** 
13  * Create the Forward @f$ dN/d\eta@f$ analysis task 
14  * 
15  * @param trig      Trigger to use 
16  * @param vzMin     Smallest @f$ v_z@f$
17  * @param vzMax     Biggest @f$ v_z@f$
18  * @param useCent   Whether to use the centrality or not
19  * @param scheme    Normalisation scheme
20  * @param cutEdges  Whether to cut edges when rebinning 
21  * @param mcanalysisfilename Take final MC corrections from this - if present
22  * @param trigEff   Trigger efficiency 
23  * @param trigEff0  Trigger efficiency for 0-bin
24  * @param corrEmpty Correct for empty bins 
25  * 
26  * @return Newly created and configured task
27  *
28  * @ingroup pwglf_forward_dndeta
29  */
30 AliAnalysisTask*
31 AddTaskForwarddNdeta(const char* trig     = "INEL", 
32                      Double_t    vzMin    = -10, 
33                      Double_t    vzMax    = +10, 
34                      Bool_t      useCent  = false,
35                      const char* scheme   = 0,
36                      Bool_t      cutEdges = false,
37                      Double_t    trigEff  = 1, 
38                      Double_t    trigEff0 = 1,
39                      Bool_t      corrEmpty= false,
40                      Bool_t      satVtx   = false,
41                      const char* mcanalysisfilename = "/home/hehi/alex/work/dispVtxDNdeta/mcCorrectionPos.root")
42 {
43   // --- Load libraries ----------------------------------------------
44   gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
45
46   // --- Analysis manager --------------------------------------------
47   AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
48
49   // --- Check that we have an AOD input handler ---------------------
50   UShort_t aodInput = 0;
51   if (!(aodInput = AliForwardUtil::CheckForAOD())) 
52     Fatal("","Cannot proceed without and AOD handler");
53   if (aodInput == 2 &&
54       !AliForwardUtil::CheckForTask("AliForwardMultiplicityBase")) 
55     Fatal("","The relevant task wasn't added to the train");
56
57
58   // --- Make our object ---------------------------------------------
59   AliForwarddNdetaTask* task = new AliForwarddNdetaTask("Forward");
60   //Set the filename of the corresponding MC analysis
61   task->SetMCFinalCorrFilename(mcanalysisfilename);
62   
63   // Set the vertex range to use 
64   task->SetVertexRange(vzMin, vzMax);
65   // Set the trigger mask to use (INEL,INEL>0,NSD)
66   task->SetTriggerMask(trig);
67   // Set the trigger efficiency 
68   task->SetTriggerEff(trigEff); // 0.997535);
69   task->SetTriggerEff0(trigEff0); 
70   // Whether to cut edges when re-binning 
71   task->SetCutEdges(cutEdges);
72   // Whether to correct for empty bins when projecting 
73   // task->SetCorrEmpty(true);
74   task->SetCorrEmpty(corrEmpty);
75   // Whether to use TH2::ProjectionX 
76   task->SetUseROOTProjectX(false);
77   // Bit mask of 
78   // 
79   //    kNone           Normalise to accepted events 
80   //    kEventLevel     Normalise to all events in selected range 
81   //    kAltEventLevel  Normalise to all events in selected range 
82   //    kBackground     Also correct for background triggers 
83   //    kShape          Correct shape 
84   // 
85   // kNone, kEventLevel, and kAltEventLevel are mutually exclusive.
86   // If neither kEventLevel, nor kAltEventLevel is specified, then
87   // kNone is assumed.  kBackground (when implemented) only makes
88   // sense with kEventLevel and kAltEventLevel.  Furthermore, there
89   // are some constants that encode the common cases
90   //     
91   //    kFull    = kEventLevel |  kBackground | kShape 
92   //    kAltFull = kAltEventLevel |  kBackground | kShape 
93   // 
94   // Default is kFull
95   task->SetNormalizationScheme(AliBasedNdetaTask::kFull);
96   if (scheme) task->SetNormalizationScheme(scheme);
97   // Set the centrality bins to use.  These are mutually exclusive.
98   // Note, that a bin specified as a-b, covers the interval from a,
99   // inclusive to b exclusive.  An upper bound of 100 is treated
100   // especially, and the upper bound is inclusive in that case .
101   if (useCent) {
102     Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
103     task->SetCentralityAxis(11, bins);
104   }
105   // Set satellite vertex flag
106   task->SetSatelliteVertices(satVtx);
107
108   mgr->AddTask(task);
109
110   // --- create containers for input/output --------------------------
111   AliAnalysisDataContainer *sums = 
112     mgr->CreateContainer("ForwardSums", TList::Class(), 
113                          AliAnalysisManager::kOutputContainer, 
114                          AliAnalysisManager::GetCommonFileName());
115   AliAnalysisDataContainer *output = 
116     mgr->CreateContainer("ForwardResults", TList::Class(), 
117                          AliAnalysisManager::kParamContainer, 
118                          AliAnalysisManager::GetCommonFileName());
119   
120   // --- connect input/output ----------------------------------------
121   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
122   mgr->ConnectOutput(task, 1, sums);
123   mgr->ConnectOutput(task, 2, output);
124
125   return task;
126 }
127
128   
129 //________________________________________________________________________
130 //
131 // EOF
132 //