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