]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEpidQAmanager.cxx
reco update
[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 "AliHFEemcalPIDqa.h"  //s.s
40 #include "AliHFEbayesPIDqa.h"
41 #include "AliHFEpidQAmanager.h"
42
43 ClassImp(AliHFEpidQAmanager)
44
45 //____________________________________________________________
46 AliHFEpidQAmanager::AliHFEpidQAmanager():
47   TObject()
48 {
49   //
50   // Dummy constructor
51   //
52   memset(fDetPIDqa, 0, sizeof(AliHFEdetPIDqa *) * AliHFEpid::kNdetectorPID);
53   memset(fDetPID, 0, sizeof(AliHFEdetPIDqa *) * AliHFEpid::kNdetectorPID);
54   SetOwner(); 
55 }
56
57 //____________________________________________________________
58 AliHFEpidQAmanager::AliHFEpidQAmanager(const AliHFEpidQAmanager &ref):
59   TObject(ref)
60 {
61   //
62   // Copy constructor
63   //
64   ref.Copy(*this);
65   SetOwner();
66 }
67
68 //____________________________________________________________
69 AliHFEpidQAmanager &AliHFEpidQAmanager::operator=(const AliHFEpidQAmanager &ref){
70   //
71   // Assignment operator
72   //
73   if(this != &ref) ref.Copy(*this);
74   SetOwner();
75   return *this;
76 }
77
78 //____________________________________________________________
79 void AliHFEpidQAmanager::Copy(TObject &o) const{
80   //
81   // Make copy
82   //
83   TObject::Copy(o);
84   AliHFEpidQAmanager &target = dynamic_cast<AliHFEpidQAmanager &>(o);
85
86   for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
87     target.fDetPID[idet] = fDetPID[idet]; 
88     if(target.fDetPIDqa[idet]) delete target.fDetPIDqa[idet];
89     if(fDetPIDqa[idet]) target.CreateDetPIDqa(static_cast<AliHFEpid::EDETtype_t>(idet));
90   }
91 }
92
93 //____________________________________________________________
94 AliHFEpidQAmanager::~AliHFEpidQAmanager(){
95   //
96   // Destructor
97   //
98   if(IsOwner())
99     for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
100       if(fDetPIDqa[idet]) delete fDetPIDqa[idet];
101     }
102 }
103
104 //____________________________________________________________
105 void AliHFEpidQAmanager::Initialize(AliHFEpid *pid){
106   //
107   // Initialize PID QA manager according to the detector
108   // configuration used in the PID
109   //
110   for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
111     // Initialize Array for detector PID for all detectors
112     fDetPID[idet] = pid->GetDetPID(static_cast<AliHFEpid::EDETtype_t>(idet));
113     if(pid->HasDetector(static_cast<AliHFEpid::EDETtype_t>(idet))){
114       CreateDetPIDqa(static_cast<AliHFEpid::EDETtype_t>(idet));
115       if(fDetPIDqa[idet]){
116         fDetPIDqa[idet]->SetPIDqaManager(this);
117         fDetPIDqa[idet]->Initialize();
118       }
119     }
120   }
121 }
122
123 //____________________________________________________________
124 void AliHFEpidQAmanager::CreateDetPIDqa(AliHFEpid::EDETtype_t idet){
125   //
126   // Create new PID QA object
127   //
128   switch(idet){
129     case AliHFEpid::kTPCpid: 
130           fDetPIDqa[idet] = new AliHFEtpcPIDqa("TPCQA"); 
131           break;
132     case AliHFEpid::kTRDpid: 
133           fDetPIDqa[idet] = new AliHFEtrdPIDqaV1("TRDQA"); 
134           break;
135     case AliHFEpid::kTOFpid: 
136           fDetPIDqa[idet] = new AliHFEtofPIDqa("TOFQA"); 
137           break;
138     case AliHFEpid::kEMCALpid: //s.s (name) 
139           fDetPIDqa[idet] = new AliHFEemcalPIDqa("EMCALQA"); // s.s 
140           break;  //s.s
141     case AliHFEpid::kBAYESpid:
142           fDetPIDqa[idet] = new AliHFEbayesPIDqa("BAYESQA");
143           break;
144
145     default:
146           break;
147   };
148 }
149
150 //____________________________________________________________
151 void AliHFEpidQAmanager::ProcessTrack(const AliHFEpidObject *track, AliHFEpid::EDETtype_t det, AliHFEdetPIDqa::EStep_t step){
152   //
153   // Process single Track
154   //
155   if(!fDetPIDqa[det]){
156     AliDebug(1, Form("QA for detector %d not available", det));
157     return;
158   }
159   AliDebug(1, Form("Doing QA for detector %d\n", det));
160   fDetPIDqa[det]->ProcessTrack(track, step);
161 }
162
163 //____________________________________________________________
164 TList *AliHFEpidQAmanager::MakeList(const Char_t *name){
165   //
166   // Make List of PID QA objects
167   //
168   TList *list = new TList;
169   list->SetName(name);
170   list->SetOwner();
171   for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
172     if(fDetPIDqa[idet]) list->Add(fDetPIDqa[idet]);
173   }
174   ReleaseOwnerShip();
175   return list;
176 }
177