]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AddTaskForwarddNdeta.C
4e84b99ffbb1e789a416e62576f0b965b56bb7aa
[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 trigEff   Trigger efficiency 
22  * @param trigEff0  Trigger efficiency for 0-bin
23  * @param corrEmpty Correct for empty bins 
24  * @param satVtx    Set to true for satellite analysis
25  * @param mcanalysisfilename Take final MC corrections from this - if present
26  * 
27  * @return Newly created and configured task
28  *
29  * @ingroup pwglf_forward_dndeta
30  */
31 AliAnalysisTask*
32 AddTaskForwarddNdeta(const char* trig     = "INEL", 
33                      Double_t    vzMin    = -10, 
34                      Double_t    vzMax    = +10, 
35                      Bool_t      useCent  = false,
36                      const char* scheme   = 0,
37                      Bool_t      cutEdges = false,
38                      Double_t    trigEff  = 1, 
39                      Double_t    trigEff0 = 1,
40                      Bool_t      corrEmpty= false,
41                      Bool_t      satVtx   = false,
42                      const char* mcanalysisfilename = "/home/hehi/alex/work/dispVtxDNdeta/mcCorrectionPos.root")
43 {
44   // --- Load libraries ----------------------------------------------
45   gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
46
47   // --- Analysis manager --------------------------------------------
48   AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
49
50   // --- Check that we have an AOD input handler ---------------------
51   UShort_t aodInput = 0;
52   if (!(aodInput = AliForwardUtil::CheckForAOD())) 
53     Fatal("","Cannot proceed without and AOD handler");
54   if (aodInput == 2 &&
55       !AliForwardUtil::CheckForTask("AliForwardMultiplicityBase")) 
56     Fatal("","The relevant task wasn't added to the train");
57
58
59   // --- Make our object ---------------------------------------------
60   AliForwarddNdetaTask* task = new AliForwarddNdetaTask("Forward");
61   //Set the filename of the corresponding MC analysis
62   task->SetMCFinalCorrFilename(mcanalysisfilename);
63   
64   // Set the vertex range to use 
65   task->SetIpZRange(vzMin, vzMax);
66   // Set the trigger mask to use (INEL,INEL>0,NSD)
67   task->SetTriggerMask(trig);
68   // Set the trigger efficiency 
69   task->SetTriggerEff(trigEff); // 0.997535);
70   task->SetTriggerEff0(trigEff0); 
71   // Whether to cut edges when re-binning 
72   task->SetCutEdges(cutEdges);
73   // Whether to correct for empty bins when projecting 
74   // task->SetCorrEmpty(true);
75   task->SetCorrEmpty(corrEmpty);
76   // Whether to use TH2::ProjectionX 
77   task->SetUseROOTProjectX(false);
78   // Bit mask of 
79   // 
80   //    kNone           Normalise to accepted events 
81   //    kEventLevel     Normalise to all events in selected range 
82   //    kAltEventLevel  Normalise to all events in selected range 
83   //    kBackground     Also correct for background triggers 
84   //    kShape          Correct shape 
85   // 
86   // kNone, kEventLevel, and kAltEventLevel are mutually exclusive.
87   // If neither kEventLevel, nor kAltEventLevel is specified, then
88   // kNone is assumed.  kBackground (when implemented) only makes
89   // sense with kEventLevel and kAltEventLevel.  Furthermore, there
90   // are some constants that encode the common cases
91   //     
92   //    kFull    = kEventLevel |  kBackground | kShape 
93   //    kAltFull = kAltEventLevel |  kBackground | kShape 
94   // 
95   // Default is kFull
96   task->SetNormalizationScheme(AliBasedNdetaTask::kFull);
97   if (scheme) task->SetNormalizationScheme(scheme);
98   // Set the centrality bins to use.  These are mutually exclusive.
99   // Note, that a bin specified as a-b, covers the interval from a,
100   // inclusive to b exclusive.  An upper bound of 100 is treated
101   // especially, and the upper bound is inclusive in that case .
102   if (useCent) {
103     Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 };
104     task->SetCentralityAxis(10, bins);
105   }
106   // Set satellite vertex flag
107   task->SetSatelliteVertices(satVtx);
108
109   task->Connect(0,0);
110   return task;
111 }
112
113   
114 //________________________________________________________________________
115 //
116 // EOF
117 //