]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEpidQAmanager.cxx
Coverity fixes (Ivana, Markus)
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEpidQAmanager.cxx
CommitLineData
3a72645a 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**************************************************************************/
27de2dfb 15
16/* $Id$ */
17
3a72645a 18//
19// Class AliHFEpidQAmanager
20// Does steering of the PID QA. The PID QA manager is initialized according
21// to the configuration used for PID. It contains PID objects inheriting
22// from AliHFEdetPIDqa, which are
23// AliHFEtpcPIDqa
24// AliHFEtrdPIDqaV1
25// AliHFEtofPIDqa
26// PID QA objects are filled for every detector before PID decision and
27// after PID decision for tracks which are selected by the given detector
28// as electron candidates.
29//
30// Author
31// Markus Fasel <M.Fasel@gsi.de>
32//
33#include <TList.h>
34
35#include "AliAODpidUtil.h"
36#include "AliESDpid.h"
37#include "AliVParticle.h"
38
39#include "AliHFEtpcPIDqa.h"
40#include "AliHFEtrdPIDqaV1.h"
41#include "AliHFEtofPIDqa.h"
42#include "AliHFEpidQAmanager.h"
43
44ClassImp(AliHFEpidQAmanager)
45
46//____________________________________________________________
47AliHFEpidQAmanager::AliHFEpidQAmanager():
48 TObject()
49{
50 //
51 // Dummy constructor
52 //
53 memset(fDetPIDqa, 0, sizeof(AliHFEdetPIDqa *) * AliHFEpid::kNdetectorPID);
6555e2ad 54 memset(fDetPID, 0, sizeof(AliHFEdetPIDqa *) * AliHFEpid::kNdetectorPID);
3a72645a 55 SetOwner();
56}
57
58//____________________________________________________________
59AliHFEpidQAmanager::AliHFEpidQAmanager(const AliHFEpidQAmanager &ref):
60 TObject(ref)
61{
62 //
63 // Copy constructor
64 //
65 ref.Copy(*this);
66 SetOwner();
67}
68
69//____________________________________________________________
70AliHFEpidQAmanager &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//____________________________________________________________
80void 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++){
6555e2ad 88 target.fDetPID[idet] = fDetPID[idet];
3a72645a 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//____________________________________________________________
95AliHFEpidQAmanager::~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//____________________________________________________________
106void AliHFEpidQAmanager::Initialize(AliHFEpid *pid){
107 //
108 // Initialize PID QA manager according to the detector
109 // configuration used in the PID
110 //
6555e2ad 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));
3a72645a 114 if(pid->HasDetector(static_cast<AliHFEpid::EDETtype_t>(idet))){
115 CreateDetPIDqa(static_cast<AliHFEpid::EDETtype_t>(idet));
ccc37cdc 116 if(fDetPIDqa[idet]){
117 fDetPIDqa[idet]->SetPIDqaManager(this);
118 fDetPIDqa[idet]->Initialize();
119 }
3a72645a 120 }
6555e2ad 121 }
3a72645a 122}
123
124//____________________________________________________________
125void 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 default:
140 break;
141 };
142}
143
144//____________________________________________________________
6555e2ad 145void AliHFEpidQAmanager::ProcessTrack(const AliHFEpidObject *track, AliHFEpid::EDETtype_t det, AliHFEdetPIDqa::EStep_t step){
3a72645a 146 //
147 // Process single Track
148 //
149 if(!fDetPIDqa[det]){
150 AliDebug(1, Form("QA for detector %d not available", det));
151 return;
152 }
153 AliDebug(1, Form("Doing QA for detector %d\n", det));
154 fDetPIDqa[det]->ProcessTrack(track, step);
155}
156
157//____________________________________________________________
158TList *AliHFEpidQAmanager::MakeList(const Char_t *name){
159 //
160 // Make List of PID QA objects
161 //
162 TList *list = new TList;
163 list->SetName(name);
164 list->SetOwner();
165 for(Int_t idet = 0; idet < AliHFEpid::kNdetectorPID; idet++){
166 if(fDetPIDqa[idet]) list->Add(fDetPIDqa[idet]);
167 }
168 ReleaseOwnerShip();
169 return list;
170}
171