From 5dfa9b7188de20773ced81e32ab223a0b63d20ea Mon Sep 17 00:00:00 2001 From: masera Date: Wed, 16 Apr 2008 14:00:05 +0000 Subject: [PATCH] First implementation of QA checkers (P. Cerello) --- ITS/AliITSQAChecker.cxx | 49 ++++++++++++++++++++- ITS/AliITSQAChecker.h | 35 +++++++++++++-- ITS/AliITSQADataMakerSim.cxx | 5 ++- ITS/AliITSQASDDChecker.h | 41 +++++++++++++++++ ITS/AliITSQASPDChecker.cxx | 83 +++++++++++++++++++++++++++++++++++ ITS/AliITSQASPDChecker.h | 40 +++++++++++++++++ ITS/AliITSQASSDChecker.cxx | 85 ++++++++++++++++++++++++++++++++++++ ITS/AliITSQASSDChecker.h | 41 +++++++++++++++++ ITS/ITSrecLinkDef.h | 3 ++ ITS/libITSrec.pkg | 6 ++- 10 files changed, 381 insertions(+), 7 deletions(-) create mode 100644 ITS/AliITSQASDDChecker.h create mode 100644 ITS/AliITSQASPDChecker.cxx create mode 100644 ITS/AliITSQASPDChecker.h create mode 100644 ITS/AliITSQASSDChecker.cxx create mode 100644 ITS/AliITSQASSDChecker.h diff --git a/ITS/AliITSQAChecker.cxx b/ITS/AliITSQAChecker.cxx index 05a5ce45f24..88352523ede 100644 --- a/ITS/AliITSQAChecker.cxx +++ b/ITS/AliITSQAChecker.cxx @@ -22,13 +22,33 @@ // INFN Torino // --- ROOT system --- - +#include "TH1.h" // --- AliRoot header files --- #include "AliITSQAChecker.h" +#include "AliITSQASPDChecker.h" +#include "AliITSQASDDChecker.h" +#include "AliITSQASSDChecker.h" ClassImp(AliITSQAChecker) +//____________________________________________________________________________ +AliITSQAChecker::AliITSQAChecker(Bool_t kMode, Short_t subDet, Short_t ldc) : +AliQACheckerBase("ITS","SDD Quality Assurance Checker") +{ + fkOnline = kMode; fDet = subDet; fLDC = ldc; + if(fDet == 0 || fDet == 1) { + AliDebug(1,"AliITSQAChecker::Create SPD Checker\n"); + } + if(fDet == 0 || fDet == 2) { + AliDebug(1,"AliITSQAChecker::Create SDD Checker\n"); + } + if(fDet == 0 || fDet == 3) { + AliDebug(1,"AliITSQAChecker::Create SSD Checker\n"); + } + +} + //__________________________________________________________________ AliITSQAChecker& AliITSQAChecker::operator = (const AliITSQAChecker& qac ) { @@ -37,3 +57,30 @@ AliITSQAChecker& AliITSQAChecker::operator = (const AliITSQAChecker& qac ) new(this) AliITSQAChecker(qac); return *this; } + +//____________________________________________________________________________ +const Double_t AliITSQAChecker::Check(TObjArray * list) +{ + + // Super-basic check on the QA histograms on the input list: + // look whether they are empty! + if(fDet == 0 || fDet == 1) { + AliDebug(1,"AliITSQAChecker::Create SPD Checker\n"); + if(!fSPDChecker) fSPDChecker = new AliITSQASPDChecker(); + Double_t SPDcheck = fSPDChecker->Check(); + } + if(fDet == 0 || fDet == 2) { + AliDebug(1,"AliITSQAChecker::Create SDD Checker\n"); + if(!fSDDChecker) fSDDChecker = new AliITSQASDDChecker(); + Double_t SDDcheck = fSDDChecker->Check(); + } + if(fDet == 0 || fDet == 3) { + AliDebug(1,"AliITSQAChecker::Create SSD Checker\n"); + if(!fSSDChecker) fSSDChecker = new AliITSQASSDChecker(); + Double_t SSDcheck = fSSDChecker->Check(); + } + // here merging part for common ITS QA result + return 0; +} + + diff --git a/ITS/AliITSQAChecker.h b/ITS/AliITSQAChecker.h index 3407a60a167..99b84f537bb 100644 --- a/ITS/AliITSQAChecker.h +++ b/ITS/AliITSQAChecker.h @@ -20,19 +20,46 @@ class TH2F ; // --- AliRoot header files --- #include "AliQACheckerBase.h" + +class AliITSQASPDChecker; +class AliITSQASDDChecker; +class AliITSQASSDChecker; class AliITSLoader ; class AliITSQAChecker: public AliQACheckerBase { +friend class AliITSQASPDChecker; +friend class AliITSQASDDChecker; +friend class AliITSQASSDChecker; + public: - AliITSQAChecker() : AliQACheckerBase("ITS","SDD Quality Assurance Data Maker") {;} // ctor - AliITSQAChecker(const AliITSQAChecker& qac) : AliQACheckerBase(qac.GetName(), qac.GetTitle()) {;} // cpy ctor + AliITSQAChecker(Bool_t kMode = kFALSE, Short_t subDet = 0, Short_t ldc = 0) ; // ctor + AliITSQAChecker(const AliITSQAChecker& qac) : AliQACheckerBase(qac.GetName(), qac.GetTitle()), fkOnline(kFALSE), fDet(0), fLDC(0), fSPDChecker(0), fSDDChecker(0), fSSDChecker(0) {;} // cpy ctor AliITSQAChecker& operator = (const AliITSQAChecker& qac) ; //operator = virtual ~AliITSQAChecker() {;} // dtor + void SetMode(Bool_t kMode) { fkOnline = kMode; } + void SetSubDet(Short_t subdet) { fDet = subdet; } + void SetLDC(Short_t ldc) { fLDC = ldc; } + Bool_t GetMode() { return fkOnline; } + Short_t GetSubDet() { return fDet; } + Short_t GetLDC() { return fLDC; } + + protected: + + virtual const Double_t Check(TObjArray * list) ; + virtual const Double_t Check() {return 0.;} ; private: - - ClassDef(AliITSQAChecker,1) // description + + Bool_t fkOnline; + Short_t fDet; + Short_t fLDC; + + AliITSQASPDChecker *fSPDChecker; // SPD Checker + AliITSQASDDChecker *fSDDChecker; // SDD Checker + AliITSQASSDChecker *fSSDChecker; // SSD Checker + + ClassDef(AliITSQAChecker,3) // description }; diff --git a/ITS/AliITSQADataMakerSim.cxx b/ITS/AliITSQADataMakerSim.cxx index 4413f12ca24..61f03f5eea1 100644 --- a/ITS/AliITSQADataMakerSim.cxx +++ b/ITS/AliITSQADataMakerSim.cxx @@ -35,6 +35,7 @@ #include "AliLog.h" #include "AliQA.h" #include "AliQAChecker.h" +#include "AliITSQAChecker.h" #include "AliRawReader.h" ClassImp(AliITSQADataMakerSim) @@ -121,7 +122,9 @@ void AliITSQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->EndOfDetectorCycle(task, list); if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->EndOfDetectorCycle(task, list); - //AliQAChecker::Instance()->Run( AliQA::kITS , task, list); //temporary skipping the checking + AliQAChecker *qac = AliQAChecker::Instance(); + AliITSQAChecker *qacb = (AliITSQAChecker *) qac->GetDetQAChecker(0); + qac->Run( AliQA::kITS , task, list); //temporary skipping the checking } //____________________________________________________________________________ diff --git a/ITS/AliITSQASDDChecker.h b/ITS/AliITSQASDDChecker.h new file mode 100644 index 00000000000..6edf0f8e0c8 --- /dev/null +++ b/ITS/AliITSQASDDChecker.h @@ -0,0 +1,41 @@ +#ifndef ALIITSQASDDCHECKER_H +#define ALIITSQASDDCHECKER_H +/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +/* $Id$ */ + +// +// Checks the quality assurance. +// By comparing with reference data +// INFN Torino +// P. Cerello - apr 2008 +// + + +// --- ROOT system --- +class TFile ; +class TH2F ; + +// --- AliRoot header files --- +#include "AliQACheckerBase.h" +#include "AliITSQAChecker.h" +class AliITSLoader ; + +class AliITSQASDDChecker: public TObject { + +public: + AliITSQASDDChecker() {;} // ctor + AliITSQASDDChecker& operator = (const AliITSQASDDChecker& qac) ; //operator = + virtual ~AliITSQASDDChecker() {;} // dtor + const Double_t Check(); + +private: + AliITSQASDDChecker(const AliITSQASDDChecker& qac) {;} // cpy ctor + + ClassDef(AliITSQASDDChecker,1) // description + +}; + +#endif // AliITSQASDDChecker_H diff --git a/ITS/AliITSQASPDChecker.cxx b/ITS/AliITSQASPDChecker.cxx new file mode 100644 index 00000000000..b186c49c187 --- /dev/null +++ b/ITS/AliITSQASPDChecker.cxx @@ -0,0 +1,83 @@ +/************************************************************************** + * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +// ***************************************** +// Checks the quality assurance +// by comparing with reference data +// P. Cerello Apr 2008 +// INFN Torino + +// --- ROOT system --- + +// --- AliRoot header files --- +#include "AliITSQASPDChecker.h" + +ClassImp(AliITSQASPDChecker) + +//__________________________________________________________________ +AliITSQASPDChecker& AliITSQASPDChecker::operator = (const AliITSQASPDChecker& qac ) +{ + // Equal operator. + this->~AliITSQASPDChecker(); + new(this) AliITSQASPDChecker(qac); + return *this; +} + +//__________________________________________________________________ +const Double_t AliITSQASPDChecker::Check() +{ +/* + TObjArray * list + Double_t test = 0.0 ; + Int_t count = 0 ; + + if (list->GetEntries() == 0){ + test = 1. ; // nothing to check + } + else { + TIter next(list) ; + TH1 * hdata ; + count = 0 ; + while ( (hdata = dynamic_cast(next())) ) { + if (hdata) { + Double_t rv = 0.; + if(hdata->GetEntries()>0)rv=1; + AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ; + count++ ; + test += rv ; + } + else{ + AliError("Data type cannot be processed") ; + } + + } + if (count != 0) { + if (test==0) { + AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING"); + test = 0.5; //upper limit value to set kWARNING flag for a task + } + else { + test /= count ; + } + } + } + + AliInfo(Form("Test Result = %f", test)) ; + return test ; +*/ + return 0.; +} diff --git a/ITS/AliITSQASPDChecker.h b/ITS/AliITSQASPDChecker.h new file mode 100644 index 00000000000..26074119a0d --- /dev/null +++ b/ITS/AliITSQASPDChecker.h @@ -0,0 +1,40 @@ +#ifndef ALIITSQASPDCHECKER_H +#define ALIITSQASPDCHECKER_H +/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +/* $Id$ */ + +// +// Checks the quality assurance. +// By comparing with reference data +// INFN Torino +// P. Cerello - apr 2008 +// + + +// --- ROOT system --- +class TFile ; +class TH2F ; + +// --- AliRoot header files --- +#include "AliQACheckerBase.h" +#include "AliITSQAChecker.h" +class AliITSLoader ; + +class AliITSQASPDChecker: public TObject { + +public: + AliITSQASPDChecker() {;} // ctor + AliITSQASPDChecker& operator = (const AliITSQASPDChecker& qac) ; //operator = + virtual ~AliITSQASPDChecker() {;} // dtor + const Double_t Check(); +private: + + AliITSQASPDChecker(const AliITSQASPDChecker& qac){;} // cpy ctor + ClassDef(AliITSQASPDChecker,1) // description + +}; + +#endif // AliITSQASPDChecker_H diff --git a/ITS/AliITSQASSDChecker.cxx b/ITS/AliITSQASSDChecker.cxx new file mode 100644 index 00000000000..ab68f83818d --- /dev/null +++ b/ITS/AliITSQASSDChecker.cxx @@ -0,0 +1,85 @@ +/************************************************************************** + * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +// ***************************************** +// Checks the quality assurance +// by comparing with reference data +// P. Cerello Apr 2008 +// INFN Torino + +// --- ROOT system --- + +// --- AliRoot header files --- +#include "AliITSQASSDChecker.h" + +ClassImp(AliITSQASSDChecker) + +//__________________________________________________________________ +AliITSQASSDChecker& AliITSQASSDChecker::operator = (const AliITSQASSDChecker& qac ) +{ + // Equal operator. + this->~AliITSQASSDChecker(); + new(this) AliITSQASSDChecker(qac); + return *this; +} + +//__________________________________________________________________ +const Double_t AliITSQASSDChecker::Check() +{ +/* + TObjArray * list + Double_t test = 0.0 ; + Int_t count = 0 ; + + if (list->GetEntries() == 0){ + test = 1. ; // nothing to check + } + else { + TIter next(list) ; + TH1 * hdata ; + count = 0 ; + while ( (hdata = dynamic_cast(next())) ) { + if (hdata) { + Double_t rv = 0.; + if(hdata->GetEntries()>0)rv=1; + AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ; + count++ ; + test += rv ; + } + else{ + AliError("Data type cannot be processed") ; + } + + } + if (count != 0) { + if (test==0) { + AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING"); + test = 0.5; //upper limit value to set kWARNING flag for a task + } + else { + test /= count ; + } + } + } + + AliInfo(Form("Test Result = %f", test)) ; + return test ; +*/ + return 0.; +} + + diff --git a/ITS/AliITSQASSDChecker.h b/ITS/AliITSQASSDChecker.h new file mode 100644 index 00000000000..9a26634e7ca --- /dev/null +++ b/ITS/AliITSQASSDChecker.h @@ -0,0 +1,41 @@ +#ifndef ALIITSQASSDCHECKER_H +#define ALIITSQASSDCHECKER_H +/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +/* $Id$ */ + +// +// Checks the quality assurance. +// By comparing with reference data +// INFN Torino +// P. Cerello - apr 2008 +// + + +// --- ROOT system --- +class TFile ; +class TH2F ; + +// --- AliRoot header files --- +#include "AliQACheckerBase.h" +#include "AliITSQAChecker.h" +class AliITSLoader ; + +class AliITSQASSDChecker: public TObject { + +public: + AliITSQASSDChecker() {;} // ctor + AliITSQASSDChecker& operator = (const AliITSQASSDChecker& qac) ; //operator = + virtual ~AliITSQASSDChecker() {;} // dtor + const Double_t Check(); + +private: + + AliITSQASSDChecker(const AliITSQASSDChecker& qac){;} // cpy ctor + ClassDef(AliITSQASSDChecker,1) // description + +}; + +#endif // AliITSQASSDChecker_H diff --git a/ITS/ITSrecLinkDef.h b/ITS/ITSrecLinkDef.h index 49db3ab791d..2c5348f980a 100644 --- a/ITS/ITSrecLinkDef.h +++ b/ITS/ITSrecLinkDef.h @@ -122,5 +122,8 @@ #pragma link C++ class AliITSQASPDDataMakerRec+; #pragma link C++ class AliITSQASDDDataMakerRec+; #pragma link C++ class AliITSQASSDDataMakerRec+; +#pragma link C++ class AliITSQASPDChecker+; +#pragma link C++ class AliITSQASDDChecker+; +#pragma link C++ class AliITSQASSDChecker+; #endif diff --git a/ITS/libITSrec.pkg b/ITS/libITSrec.pkg index bd79a962655..a028b1a4636 100644 --- a/ITS/libITSrec.pkg +++ b/ITS/libITSrec.pkg @@ -88,7 +88,11 @@ SRCS = AliITSDetTypeRec.cxx \ AliITSQADataMakerRec.cxx \ AliITSQASPDDataMakerRec.cxx \ AliITSQASDDDataMakerRec.cxx \ - AliITSQASSDDataMakerRec.cxx + AliITSQASSDDataMakerRec.cxx \ + AliITSQASPDChecker.cxx \ + AliITSQASDDChecker.cxx \ + AliITSQASSDChecker.cxx + HDRS:= $(SRCS:.cxx=.h) -- 2.39.3