]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEpidQAmanager.cxx
Fix of sigmaZ for crossing tracklets from Alex
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEpidQAmanager.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15 //
16 // Class AliHFEpidQAmanager
17 // Does steering of the PID QA. The PID QA manager is initialized according
18 // to the configuration used for PID. It contains PID objects inheriting 
19 // from AliHFEdetPIDqa, which are
20 //     AliHFEtpcPIDqa
21 //     AliHFEtrdPIDqaV1
22 //     AliHFEtofPIDqa
23 // PID QA objects are filled for every detector before PID decision and 
24 // after PID decision for tracks which are selected by the given detector
25 // as electron candidates.
26 //
27 // Author
28 //   Markus Fasel <M.Fasel@gsi.de>
29 //
30 #include <TList.h>
31
32 #include "AliAODpidUtil.h"
33 #include "AliESDpid.h"
34 #include "AliVParticle.h"
35
36 #include "AliHFEtpcPIDqa.h"
37 #include "AliHFEtrdPIDqaV1.h"
38 #include "AliHFEtofPIDqa.h"
39 #include "AliHFEitsPIDqa.h"
40 #include "AliHFEemcalPIDqa.h"  //s.s
41 #include "AliHFEbayesPIDqa.h"
42 #include "AliHFEpidQAmanager.h"
43
44 ClassImp(AliHFEpidQAmanager)
45
46 //____________________________________________________________
47 AliHFEpidQAmanager::AliHFEpidQAmanager():
48   TObject()
49 {
50   //
51   // Dummy constructor
52   //
53   memset(fDetPIDqa, 0, sizeof(AliHFEdetPIDqa *) * AliHFEpid::kNdetectorPID);
54   memset(fDetPID, 0, sizeof(AliHFEdetPIDqa *) * AliHFEpid::kNdetectorPID);
55   SetOwner(); 
56 }
57
58 //____________________________________________________________
59 AliHFEpidQAmanager::AliHFEpidQAmanager(const AliHFEpidQAmanager &ref):
60   TObject(ref)
61 {
62   //
63   // Copy constructor
64   //
65   ref.Copy(*this);
66   SetOwner();
67 }
68
69 //____________________________________________________________
70 AliHFEpidQAmanager &AliHFEpidQAmanager::operator=(const AliHFEpidQAmanager &ref){
71   //
72   // Assignment operator
73   //
74   if(this != &ref) ref.Copy(*this);
75   SetOwner();
76   return *this;
77 }
78
79 //____________________________________________________________
80 void AliHFEpidQAmanager::Copy(TObject &o) const{
81   //
82   // Make copy
83   //
84   TObject::Copy(o);
85   AliHFEpidQAmanager &target = dynamic_cast<AliHFEpidQAmanager &>(o);
86
87   for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
88     target.fDetPID[idet] = fDetPID[idet]; 
89     if(target.fDetPIDqa[idet]) delete target.fDetPIDqa[idet];
90     if(fDetPIDqa[idet]) target.CreateDetPIDqa(static_cast<AliHFEpid::EDETtype_t>(idet));
91   }
92 }
93
94 //____________________________________________________________
95 AliHFEpidQAmanager::~AliHFEpidQAmanager(){
96   //
97   // Destructor
98   //
99   if(IsOwner())
100     for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
101       if(fDetPIDqa[idet]) delete fDetPIDqa[idet];
102     }
103 }
104
105 //____________________________________________________________
106 void AliHFEpidQAmanager::Initialize(AliHFEpid *pid){
107   //
108   // Initialize PID QA manager according to the detector
109   // configuration used in the PID
110   //
111   for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
112     // Initialize Array for detector PID for all detectors
113     fDetPID[idet] = pid->GetDetPID(static_cast<AliHFEpid::EDETtype_t>(idet));
114     if(pid->HasDetector(static_cast<AliHFEpid::EDETtype_t>(idet))){
115       CreateDetPIDqa(static_cast<AliHFEpid::EDETtype_t>(idet));
116       if(fDetPIDqa[idet]){
117         fDetPIDqa[idet]->SetPIDqaManager(this);
118         fDetPIDqa[idet]->Initialize();
119       }
120     }
121   }
122 }
123
124 //____________________________________________________________
125 void AliHFEpidQAmanager::CreateDetPIDqa(AliHFEpid::EDETtype_t idet){
126   //
127   // Create new PID QA object
128   //
129   switch(idet){
130     case AliHFEpid::kTPCpid: 
131           fDetPIDqa[idet] = new AliHFEtpcPIDqa("TPCQA"); 
132           break;
133     case AliHFEpid::kTRDpid: 
134           fDetPIDqa[idet] = new AliHFEtrdPIDqaV1("TRDQA"); 
135           break;
136     case AliHFEpid::kTOFpid: 
137           fDetPIDqa[idet] = new AliHFEtofPIDqa("TOFQA"); 
138           break;
139   case AliHFEpid::kITSpid:
140           fDetPIDqa[idet] = new AliHFEitsPIDqa("ITSQA");
141           break;
142     case AliHFEpid::kEMCALpid: //s.s (name) 
143           fDetPIDqa[idet] = new AliHFEemcalPIDqa("EMCALQA"); // s.s 
144           break;  //s.s
145     case AliHFEpid::kBAYESpid:
146           fDetPIDqa[idet] = new AliHFEbayesPIDqa("BAYESQA");
147           break;
148
149     default:
150           break;
151   };
152 }
153
154 //____________________________________________________________
155 void AliHFEpidQAmanager::ProcessTrack(const AliHFEpidObject *track, AliHFEpid::EDETtype_t det, AliHFEdetPIDqa::EStep_t step){
156   //
157   // Process single Track
158   //
159   if(!fDetPIDqa[det]){
160     AliDebug(1, Form("QA for detector %d not available", det));
161     return;
162   }
163   AliDebug(1, Form("Doing QA for detector %d\n", det));
164   fDetPIDqa[det]->ProcessTrack(track, step);
165 }
166
167 //____________________________________________________________
168 TList *AliHFEpidQAmanager::MakeList(const Char_t *name){
169   //
170   // Make List of PID QA objects
171   //
172   TList *list = new TList;
173   list->SetName(name);
174   list->SetOwner();
175   for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
176     if(fDetPIDqa[idet]) list->Add(fDetPIDqa[idet]);
177   }
178   ReleaseOwnerShip();
179   return list;
180 }
181