954d4d9fd97a383448608cd5e403a04eced892a0
[u/mrichter/AliRoot.git] / TRD / qaRec / macros / AliTRDperformanceTrain.h
1 #ifndef ALITRDPERFORMANCETRAIN_H
2 #define ALITRDPERFORMANCETRAIN_H
3
4 #define BIT(n)      (1 << (n))
5 #define SETBIT(n,i) ((n) |= BIT(i))
6 #define TSTBIT(n,i) ((Bool_t)(((n) & BIT(i)) != 0))
7 #define CLRBIT(n,i) ((n) &= ~BIT(i))
8
9 #define NTRDQATASKS 6
10 #define NTRDCALIBTASKS 6
11 const Int_t NTRDTASKS = NTRDQATASKS+NTRDCALIBTASKS;
12
13 enum AliTRDrecoTasks{
14    kCheckESD      = 0
15   ,kInfoGen       = 1
16   ,kCheckDET      = 2
17   ,kEfficiency    = 3
18   ,kResolution    = 4
19   ,kCheckPID      = 5
20   ,kCalibration   = 6
21   ,kEfficiencyMC  = 7
22   ,kAlignment     = 8
23   ,kPIDRefMaker   = 9
24   ,kClErrParam    =10
25   ,kMultiplicity  =11
26 };
27
28 const Char_t* fgkTRDtaskClassName[NTRDTASKS] = {
29   "AliTRDcheckESD"
30   ,"AliTRDinfoGen"
31   ,"AliTRDcheckDET"
32   ,"AliTRDefficiency"
33   ,"AliTRDresolution"
34   ,"AliTRDcheckPID"
35   ,"AliTRDcalibration"
36   ,"AliTRDefficiencyMC"
37   ,"AliTRDalignmentTask"
38   ,"AliTRDpidRefMaker"
39   ,"AliTRDclusterResolution"
40   ,"AliTRDmultiplicity"
41 };
42
43 const Char_t *fgkTRDtaskOpt[NTRDTASKS+1] = {
44   ""
45   ,"GEN"
46   ,"DET"
47   ,"EFF"
48   ,"RES"
49   ,"PID"
50   ,"CAL"
51   ,"EFFC"
52   ,"ALGN"
53   ,"PIDR"
54   ,"CLRES"
55   ,"MULT"
56   ,"ALL"
57 };
58
59 #if ! defined (__CINT__) || defined (__MAKECINT__)
60 #include "TString.h"
61 #include "TObjString.h"
62 #include "TObjArray.h"
63 #include "TError.h"
64 #endif
65
66 #include <cstring>
67
68 //____________________________________________
69 Int_t ParseOptions(Char_t *trd)
70 {
71   Int_t fSteerTask = 1;
72   TObjArray *tasksArray = TString(trd).Tokenize(" ");
73   for(Int_t isel = 0; isel < tasksArray->GetEntriesFast(); isel++){
74     TString s = (dynamic_cast<TObjString *>(tasksArray->UncheckedAt(isel)))->String();
75     if(s.CompareTo("ALL") == 0){
76       for(Int_t itask = 0; itask < NTRDQATASKS; itask++) SETBIT(fSteerTask, itask);
77       continue;
78     } else { 
79       Bool_t foundOpt = kFALSE;  
80       for(Int_t itask = 2; itask < NTRDTASKS; itask++){
81         if(s.CompareTo(fgkTRDtaskOpt[itask]) != 0) continue;
82         SETBIT(fSteerTask, itask); SETBIT(fSteerTask, kInfoGen);
83         foundOpt = kTRUE;
84         break;
85       }
86       if(!foundOpt) Info("run.C", Form("TRD task %s not implemented (yet).", s.Data()));
87     }
88   }
89   // extra rules for calibration tasks
90   if(TSTBIT(fSteerTask, kCalibration)) SETBIT(fSteerTask, kCheckDET);
91   if(TSTBIT(fSteerTask, kMultiplicity)) SETBIT(fSteerTask, kEfficiency);
92   if(TSTBIT(fSteerTask, kEfficiencyMC)) SETBIT(fSteerTask, kEfficiency);
93   if(TSTBIT(fSteerTask, kClErrParam)) SETBIT(fSteerTask, kResolution);
94   if(TSTBIT(fSteerTask, kAlignment)) SETBIT(fSteerTask, kResolution);
95   if(TSTBIT(fSteerTask, kPIDRefMaker)) SETBIT(fSteerTask, kCheckPID);
96
97   return fSteerTask;
98 }
99
100 //____________________________________________
101 Bool_t HasReadMCData(Char_t *opt){
102   return !(Bool_t)strstr(opt, "NOMC");
103 }
104
105 //____________________________________________
106 Bool_t HasReadFriendData(Char_t *opt){
107   return !(Bool_t)strstr(opt, "NOFR");
108 }
109 #endif
110