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