]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDMCTrackInspectorTask.cxx
Merge branch 'master_patch'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCTrackInspectorTask.cxx
1 #include "AliFMDMCTrackInspectorTask.h"
2 #include "AliForwardCorrectionManager.h"
3 #include "AliAODForwardMult.h"
4 #include <TROOT.h>
5 #include <TTree.h>
6
7 //____________________________________________________________________
8 AliFMDMCTrackInspectorTask::AliFMDMCTrackInspectorTask(const char* name, 
9                                                        Bool_t      useTree)
10   : AliBaseESDTask(name, "", &(AliForwardCorrectionManager::Instance())),
11     fEventInspector("event"), 
12     fTrackInspector("fitter")
13 {
14   fCloneList = true;
15   fTrackInspector.GetTracker().SetUseTree(useTree);
16   if (useTree) DefineOutput(3, TTree::Class());
17 }
18
19 //____________________________________________________________________
20 TAxis*
21 AliFMDMCTrackInspectorTask::DefaultEtaAxis() const
22 {
23   static TAxis* a = new TAxis(0, 0, 0);
24   return a;
25 }
26 //____________________________________________________________________
27 TAxis*
28 AliFMDMCTrackInspectorTask::DefaultVertexAxis() const
29 {
30   static TAxis* a = new TAxis(10, -10, 10);
31   return a;
32 }
33
34 //____________________________________________________________________
35 Bool_t 
36 AliFMDMCTrackInspectorTask::Setup()
37 {
38   DGUARD(fDebug,1,"Setting up the MC hit energy loss task");
39   fTrackInspector.Init(); 
40   return true; 
41 }
42
43 //____________________________________________________________________
44 Bool_t 
45 AliFMDMCTrackInspectorTask::Book()
46 {
47   DGUARD(fDebug,1,"Booking histograms for the MC hit energy loss task");
48   fNeededCorrections = 0;
49   fExtraCorrections  = 0;
50
51   fTrackInspector.CreateOutputObjects(fList);  
52   return true;
53 }
54
55 //____________________________________________________________________
56 Bool_t 
57 AliFMDMCTrackInspectorTask::PreData(const TAxis& /*ipz*/, const TAxis& eta)
58 {
59   DGUARD(fDebug,2,"Final setup of the MC hit energy loss task");
60   fTrackInspector.SetupForData(eta);
61   if (fTrackInspector.GetTracker().GetTree()) 
62     PostData(3, fTrackInspector.GetTracker().GetTree());
63   return true;
64 }
65 //____________________________________________________________________
66 Bool_t 
67 AliFMDMCTrackInspectorTask::Event(AliESDEvent& esd)
68 {
69   // --- Read in the data --------------------------------------------
70   LoadBranches();
71
72   Bool_t   lowFlux   = kFALSE;
73   UInt_t   triggers  = 0;
74   UShort_t ivz       = 0;
75   TVector3 ip;
76   Double_t cent      = 0;
77   UShort_t nClusters = 0;
78   UInt_t   found     = fEventInspector.Process(&esd, triggers, lowFlux, 
79                                                ivz, ip, cent, nClusters);
80   if (found & AliFMDEventInspector::kNoEvent)    return false;
81   if (found & AliFMDEventInspector::kNoTriggers) return false;
82   if (found & AliFMDEventInspector::kNoSPD)      return false;
83   if (found & AliFMDEventInspector::kNoFMD)      return false;
84   if (found & AliFMDEventInspector::kNoVertex)   return false;
85   if (found & AliFMDEventInspector::kBadVertex)  return false;
86
87   // do not process pile-up, A, C, and E events 
88   if (triggers & AliAODForwardMult::kPileUp)     return false;
89   if (triggers & AliAODForwardMult::kA)          return false;
90   if (triggers & AliAODForwardMult::kC)          return false;
91   if (triggers & AliAODForwardMult::kE)          return false;
92   
93   // We want only the events found by off-line 
94   if (!(triggers & AliAODForwardMult::kOffline)) return false;
95
96   // Perhaps we should also insist on MB only 
97   // if (fOnlyMB && (!(triggers & AliAODForwardMult::kInel))) return false;
98
99   AliMCEvent* mc = MCEvent();
100   if (!mc) return false;
101   
102   Bool_t ret = fTrackInspector.Event(esd, *mc, cent);
103
104   if (fTrackInspector.GetTracker().GetTree()) 
105     PostData(3, fTrackInspector.GetTracker().GetTree());
106
107   return ret;
108 }
109 #define PFB(N,FLAG)                             \
110   do {                                                                  \
111     AliForwardUtil::PrintName(N);                                       \
112     std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
113   } while(false)
114
115 //____________________________________________________________________
116 void   
117 AliFMDMCTrackInspectorTask::Print(Option_t* option) const
118 {
119   AliBaseESDTask::Print(option);
120   gROOT->IncreaseDirLevel();
121   fTrackInspector.Print(option);
122   gROOT->DecreaseDirLevel();
123 }
124
125 //
126 // EOF
127 // 
128
129