]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONQAChecker.cxx
Setting compilaton directory to current one
[u/mrichter/AliRoot.git] / MUON / AliMUONQAChecker.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 // $Id$
17
18 #include "AliMUONQAChecker.h"
19
20 /// \class AliMUONQAChecker
21 ///
22 /// Implementation of AliQACheckerBase for MCH and MTR
23 ///
24 /// \author Laurent Aphecetche, Subatech
25
26 #include "AliMUONRecoParam.h"
27 #include "AliMUONTrackerQAChecker.h"
28 #include "AliMUONTriggerQAChecker.h"
29 #include "AliCodeTimer.h"
30 #include "AliMUONQAIndices.h"
31
32 /// \cond CLASSIMP
33 ClassImp(AliMUONQAChecker)
34 /// \endcond
35
36 namespace
37 {
38   const Int_t TRACKER=0;
39   const Int_t TRIGGER=1;
40 }
41
42 //__________________________________________________________________
43 AliMUONQAChecker::AliMUONQAChecker() : 
44     AliQACheckerBase("MUON","MUON Quality Assurance Data Maker"),
45 fCheckers(new TObjArray)
46 {
47         /// ctor
48   fCheckers->SetOwner(kTRUE);
49   fCheckers->AddAt(new AliMUONTrackerQAChecker(),TRACKER);
50   fCheckers->AddAt(new AliMUONTriggerQAChecker(),TRIGGER);
51 }          
52
53 //__________________________________________________________________
54 AliMUONQAChecker::~AliMUONQAChecker() 
55 {
56         /// dtor
57   delete fCheckers;
58 }
59
60 //______________________________________________________________________________
61 void
62 AliMUONQAChecker::Check(Double_t* rv, AliQAv1::ALITASK_t index, 
63                         TObjArray** list, 
64                         const AliDetectorRecoParam * recoParam)
65 {
66   /// Check objects in list
67   
68   AliCodeTimerAuto(AliQAv1::GetTaskName(index),0);
69   
70   const AliMUONRecoParam* muonRecoParam = static_cast<const AliMUONRecoParam*>(recoParam);
71   AliMUONVQAChecker::ECheckCode* ecc(0x0);
72
73   for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i ) 
74   {
75     rv[i] = -1.0;
76   }
77   
78   for ( Int_t ic = 0; ic <= fCheckers->GetLast(); ++ic )
79   {
80     if ( ic != TRACKER && ic != TRIGGER ) continue;
81
82     Bool_t trackerRequested(kFALSE);
83     Bool_t triggerRequested(kFALSE);
84     
85     for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i ) 
86     {
87       // no need to take into account detector that was not requested
88       if ( ic == TRACKER && AliQAv1::GetData(list,AliMUONQAIndices::kTrackerIsThere,AliRecoParam::ConvertIndex(i)) ) trackerRequested=kTRUE;
89       if ( ic == TRIGGER && AliQAv1::GetData(list,AliMUONQAIndices::kTriggerIsThere,AliRecoParam::ConvertIndex(i)) ) triggerRequested=kTRUE;
90     }
91     
92     if ( ic == TRACKER && !trackerRequested ) 
93     {
94       AliInfo("Skipping tracker check as tracker not requested");
95       continue;      
96     }
97     
98     if ( ic == TRIGGER && !triggerRequested ) 
99     {
100       AliInfo("Skipping trigger check as trigger not requested");
101       continue;      
102     }
103     
104     AliMUONVQAChecker* qac = static_cast<AliMUONVQAChecker*>(fCheckers->At(ic));
105     
106     if ( index == AliQAv1::kRAW ) 
107     {    
108       ecc = qac->CheckRaws(list,muonRecoParam);
109     }
110
111     if ( index == AliQAv1::kREC)
112     {
113       ecc = qac->CheckRecPoints(list,muonRecoParam);
114     }
115     
116     if ( index == AliQAv1::kESD )
117     {
118       ecc = qac->CheckESD(list,muonRecoParam);
119     }
120     
121     if ( ecc ) 
122     {
123       for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i ) 
124       {
125         // no need to take into account detector that was not requested
126         if ( ic == TRACKER && AliQAv1::GetData(list,AliMUONQAIndices::kTrackerIsThere,AliRecoParam::ConvertIndex(i))==0x0 ) continue;
127         if ( ic == TRIGGER && AliQAv1::GetData(list,AliMUONQAIndices::kTriggerIsThere,AliRecoParam::ConvertIndex(i))==0x0 ) continue;
128                 
129         switch ( ecc[i] ) 
130         {
131           case AliMUONVQAChecker::kInfo:
132             rv[i] = 1.0;
133             break;
134           case AliMUONVQAChecker::kWarning:
135             rv[i] = 0.75;
136             break;
137           case AliMUONVQAChecker::kError:
138             rv[i] = 0.25;
139             break;
140           case AliMUONVQAChecker::kFatal:
141             rv[i] = -1.0;
142             break;
143           default:
144             AliError("Invalid ecc value. FIXME !");
145             rv[i] = -1.0;
146             break;
147         }
148       }
149     }
150
151     delete[] ecc;
152   }
153 }
154
155 //______________________________________________________________________________
156 void AliMUONQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) 
157 {
158   /// intialises QA and QA checker settings
159   AliQAv1::Instance(det) ; 
160   Float_t hiValue[AliQAv1::kNBIT] ; 
161   Float_t lowValue[AliQAv1::kNBIT] ;
162   lowValue[AliQAv1::kINFO]      = 0.999   ; 
163   hiValue[AliQAv1::kINFO]       = 1.0 ; 
164   hiValue[AliQAv1::kWARNING]    = 0.99 ; 
165   lowValue[AliQAv1::kWARNING]   = 0.5 ; 
166   lowValue[AliQAv1::kERROR]     = 0.0   ; 
167   hiValue[AliQAv1::kERROR]      = 0.5 ; 
168   lowValue[AliQAv1::kFATAL]     = -1.0   ; 
169   hiValue[AliQAv1::kFATAL]      = 0.0 ; 
170   SetHiLo(&hiValue[0], &lowValue[0]) ; 
171 }