From 7b326aac546d88d9e6475050ae9e9d3b47f9f57f Mon Sep 17 00:00:00 2001 From: schutz Date: Tue, 5 Jun 2001 15:49:17 +0000 Subject: [PATCH] added the QA checkable-chekers using TTask and TFolder --- PHOS/AliPHOS.cxx | 101 ++++++++++++++++++++++++++++------------- PHOS/AliPHOS.h | 21 +++++---- PHOS/AliPHOSv1.cxx | 110 ++++++++++++++++++++++++++++++++++++++++++++- PHOS/AliPHOSv1.h | 13 +++++- PHOS/Makefile | 3 +- PHOS/PHOSLinkDef.h | 10 +++-- 6 files changed, 209 insertions(+), 49 deletions(-) diff --git a/PHOS/AliPHOS.cxx b/PHOS/AliPHOS.cxx index ded47ea6890..f6398b72652 100644 --- a/PHOS/AliPHOS.cxx +++ b/PHOS/AliPHOS.cxx @@ -27,10 +27,9 @@ // --- ROOT system --- class TFile; -#include "TTree.h" -#include "TTask.h" #include "TROOT.h" -#include "TFolder.h" +#include "TTree.h" +#include "TFolder.h" // --- Standard library --- @@ -42,26 +41,76 @@ class TFile; #include "AliRun.h" #include "AliMagF.h" #include "AliPHOSGeometry.h" +#include "AliPHOSQAChecker.h" ClassImp(AliPHOS) - - //____________________________________________________________________________ - AliPHOS::AliPHOS():AliDetector() +AliPHOS:: AliPHOS(const char* name, const char* title=""): AliDetector(name, title) { - // ctor. creates task PHOS - TTask * phosTask = new TTask("PHOS",""); - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(phosTask) ; -} + // create the ALICE TFolder + // create the ALICE TTasks + // add the Alice QA TTAsks + // create the ALICE main TFolder + // add the Alice QA Alarms + // this should be done of course by AliRun + + TFolder * alice = new TFolder(); + alice->SetNameTitle("YSAlice", "Alice Folder") ; + gROOT->GetListOfBrowsables()->Add(alice) ; + + TFolder * aliceF = alice->AddFolder("folders", "Alice memory Folder") ; + // make it the owner of the objects that it contains + aliceF->SetOwner() ; + TFolder * alarmsF = aliceF->AddFolder("QAAlarms", "Alarms raised by QA check") ; + // make it the owner of the objects that it contains + alarmsF->SetOwner() ; + TFolder * aliceT = alice->AddFolder("tasks", "Alice tasks Folder") ; + // make it the owner of the objects that it contains + aliceT->SetOwner() ; + + TTask * aliceQA = new TTask("QA", "Alice QA tasks") ; + aliceT->Add(aliceQA); + + TTask * aliceDi = new TTask("(S)Digitizer", "Alice SDigitizer & Digitizer") ; + aliceT->Add(aliceDi); + + TTask * aliceRe = new TTask("Reconstructioner", "Alice Reconstructioner") ; + aliceT->Add(aliceRe); + + char * tempo = new char[80] ; + + // creates the PHOSQA and adds it to alice main QA task + sprintf(tempo, "%sCheckers container",GetName() ) ; + fQATask = new AliPHOSQAChecker(GetName(), tempo); + aliceQA->Add(fQATask) ; + // creates the PHOS(S)Digitizer and adds it to alice main (S)Digitizer task + sprintf(tempo, "%sDigitizers container",GetName() ) ; + fSDTask = new AliPHOSQAChecker(GetName(), tempo); + aliceDi->Add(fSDTask) ; + // creates the PHOS reconstructioner and adds it to alice main Reconstructioner task + sprintf(tempo, "%sReconstructioner container",GetName() ) ; + fReTask = new AliPHOSQAChecker(GetName(), tempo); + aliceRe->Add(fReTask) ; + + delete tempo ; + + // creates the PHOSQA alarm folder + alarmsF->AddFolder("PHOS", "QA alarms from PHOS") ; +} //____________________________________________________________________________ - AliPHOS::AliPHOS(const char* name, const char* title=""):AliDetector(name, title) -{ - // ctor. creates task PHOS - TTask * phosTask = new TTask("PHOS",""); - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(phosTask) ; +AliPHOS::~AliPHOS() +{ + // remove the alice folder and alice QA task that PHOS creates instead of AliRun + + // remove and delete the PHOS QA tasks + TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ; + TTask * aliceQA = (TTask*)alice->FindObject("tasks/QA") ; + fQATask->GetListOfTasks()->Delete() ; + aliceQA->GetListOfTasks()->Remove(fQATask) ; + delete fQATask ; + + // remove and delete aliceQA (should be done by AliRun) } //____________________________________________________________________________ @@ -244,7 +293,7 @@ void AliPHOS::CreateMaterials() // The Silicon of the pin diode to read out the calorimeter crystal -> idtmed[705] AliMedium(6, "Si PIN $", 6, 0, - isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.01, 0.00001, 0, 0) ; + isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.01, 0.01, 0, 0) ; // The thermo insulating material of the box which contains the calorimeter module -> idtmed[706] AliMedium(7, "Thermo Insul.$", 7, 0, @@ -303,21 +352,8 @@ void AliPHOS::CreateMaterials() gMC->Gstpar(idtmed[701], "LOSS",3.) ; gMC->Gstpar(idtmed[701], "DRAY",1.) ; // --- and in PIN diode - //setting local cuts to 10 keV OHO 20.04.2001 gMC->Gstpar(idtmed[705], "LOSS",3) ; gMC->Gstpar(idtmed[705], "DRAY",1) ; - gMC->Gstpar(idtmed[705], "STRA",1.); - gMC->Gstpar(idtmed[705], "CUTGAM",1.E-5) ; - gMC->Gstpar(idtmed[705], "CUTELE",1.E-5) ; - gMC->Gstpar(idtmed[705], "CUTNEU",1.E-5) ; - gMC->Gstpar(idtmed[705], "CUTHAD",1.E-5) ; - gMC->Gstpar(idtmed[705], "CUTMUO",1.E-5) ; - gMC->Gstpar(idtmed[705], "BCUTE",1.E-5) ; - gMC->Gstpar(idtmed[705], "BCUTM",1.E-5) ; - gMC->Gstpar(idtmed[705], "DCUTE",1.E-5) ; - gMC->Gstpar(idtmed[705], "DCUTM",1.E-5) ; - gMC->Gstpar(idtmed[705], "PPCUTM",1.E-5) ; - // // --- and in the passive convertor gMC->Gstpar(idtmed[712], "LOSS",3) ; gMC->Gstpar(idtmed[712], "DRAY",1) ; @@ -340,7 +376,8 @@ void AliPHOS::CreateMaterials() //____________________________________________________________________________ void AliPHOS::SetTreeAddress() { - // called by AliRun + + // TBranch *branch; // AliDetector::SetTreeAddress(); diff --git a/PHOS/AliPHOS.h b/PHOS/AliPHOS.h index 66ae58633fd..b5f5684c73b 100644 --- a/PHOS/AliPHOS.h +++ b/PHOS/AliPHOS.h @@ -6,34 +6,32 @@ //_________________________________________________________________________ // Base Class for PHOS -// PHOS consists of a PbWO4 calorimeter (EMCA) and a gazeous charged -// particles detector (CPV or PPSD). -// The only provided method here is CreateMaterials, -// which defines the materials common to all PHOS versions. // //*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH) // --- ROOT system --- class TString ; +class TTask ; // --- AliRoot header files --- #include "AliDetector.h" class AliPHOSGeometry ; +class AliPHOSQAChecker ; class AliPHOS : public AliDetector { public: - AliPHOS(); - AliPHOS(const char* name, const char* title=""); + AliPHOS() : AliDetector() {fQATask=0;} + AliPHOS(const char* name, const char* title="") ; AliPHOS(const AliPHOS & phos) { // cpy ctor: no implementation yet // requested by the Coding Convention abort() ; } - virtual ~AliPHOS() {} + virtual ~AliPHOS() ; virtual void AddHit(Int_t, Int_t*, Float_t *) { // do not use this definition but the one below abort() ; @@ -41,18 +39,23 @@ class AliPHOS : public AliDetector { virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) = 0 ; virtual void CreateMaterials() ; virtual AliPHOSGeometry * GetGeometry() const = 0 ; - Int_t IsVersion(void) const { return -1 ; } + AliPHOSQAChecker * QAChecker() {return fQATask;} virtual void SetTreeAddress(); virtual TString Version() {return TString(" ") ; } AliPHOS & operator = (const AliPHOS & rvalue) { - // assignement operator requested by coding convention but not needed + // assignement operator requested by coding convention + // but not needed abort() ; return *this ; } protected: + + AliPHOSQAChecker * fQATask ; // PHOS checkers container + TTask * fSDTask ; // PHOS (S)Digitizer container + TTask * fReTask ; // PHOS Reconstructioner container ClassDef(AliPHOS,2) // Photon Spectrometer Detector (base class) diff --git a/PHOS/AliPHOSv1.cxx b/PHOS/AliPHOSv1.cxx index e28e8661408..bbe53bef6b1 100644 --- a/PHOS/AliPHOSv1.cxx +++ b/PHOS/AliPHOSv1.cxx @@ -54,6 +54,9 @@ #include "AliConst.h" #include "AliMC.h" #include "AliPHOSGeometry.h" +#include "AliPHOSQAIntCheckable.h" +#include "AliPHOSQAFloatCheckable.h" +#include "AliPHOSQAMeanChecker.h" ClassImp(AliPHOSv1) @@ -62,11 +65,12 @@ AliPHOSv1::AliPHOSv1(): AliPHOSv0() { // ctor + } //____________________________________________________________________________ AliPHOSv1::AliPHOSv1(const char *name, const char *title): -AliPHOSv0(name,title) + AliPHOSv0(name,title) { // ctor : title is used to identify the layout // GPS2 = 5 modules (EMC + PPSD) @@ -84,14 +88,50 @@ AliPHOSv0(name,title) // We do not want to save in TreeH the raw hits // But save the cumulated hits instead (need to create the branch myself) // It is put in the Digit Tree because the TreeH is filled after each primary - // and the TreeD at the end of the event (branch is set in FinishEvent() ). + // and the TreeD at the end of the event (branch is set in FinishEvent() ). fHits= new TClonesArray("AliPHOSHit",1000) ; fNhits = 0 ; fIshunt = 1 ; // All hits are associated with primary particles + + Int_t nb = fGeom->GetNModules() ; + // create checkables + fQAHitsMul = new AliPHOSQAIntCheckable("HitsM") ; + fQATotEner = new AliPHOSQAFloatCheckable("TotEn") ; + fQAHitsMulB = new TClonesArray("AliPHOSQAIntCheckable",nb) ; + fQATotEnerB = new TClonesArray("AliPHOSQAFloatCheckable", nb); + char tempo[20] ; + Int_t i ; + for ( i = 0 ; i < nb ; i++ ) { + sprintf(tempo, "HitsMB%d", i+1) ; + new( (*fQAHitsMulB)[i]) AliPHOSQAIntCheckable(tempo) ; + sprintf(tempo, "TotEnB%d", i+1) ; + new( (*fQATotEnerB)[i] ) AliPHOSQAFloatCheckable(tempo) ; + } + + // create checkers + // the container (QAChecker()) owns and deletes this local checker (see Hara-Kiri) + // the local checker can be accessed by + // AliPHOSQAChecker * phos = + // (AliPHOSQAChecker*)(gROOT->GetListOfBrowsables()->FindObject("YSALICE")->FindObject("tasks/QA/PHOS")) + // AliPHOSQAMeanChecker * ch = (AliPHOSQAMeanChecker*)(phos->FindObject("QAHitsMul")) + // or directly from the root/Tasks folder + + AliPHOSQAMeanChecker * hmc = new AliPHOSQAMeanChecker("HitsMul", 100. ,25.) ; + AliPHOSQAMeanChecker * emc = new AliPHOSQAMeanChecker("TotEner", 10. ,5.) ; + AliPHOSQAMeanChecker * bhmc = new AliPHOSQAMeanChecker("HitsMulB", 100. ,5.) ; + AliPHOSQAMeanChecker * bemc = new AliPHOSQAMeanChecker("TotEnerB", 2. ,.5) ; + + // associate checkables and checkers + fQAHitsMul->AddChecker(hmc) ; + fQATotEner->AddChecker(emc) ; + for ( i = 0 ; i < nb ; i++ ) { + ((AliPHOSQAIntCheckable*)(*fQAHitsMulB)[i])->AddChecker(bhmc) ; + ((AliPHOSQAFloatCheckable*)(*fQATotEnerB)[i])->AddChecker(bemc) ; + } } //____________________________________________________________________________ @@ -131,12 +171,72 @@ void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, if ( !deja ) { new((*fHits)[fNhits]) AliPHOSHit(*newHit) ; + // get the block Id number + Int_t * relid = new Int_t[fGeom->GetNModules()] ; + fGeom->AbsToRelNumbering(Id, relid) ; + // and fill the relevant QA checkable (only if in PbW04) + if ( relid[1] == 0 ) { + fQAHitsMul->Update(1) ; + ((AliPHOSQAIntCheckable*)(*fQAHitsMulB)[relid[0]-1])->Update(1) ; + } + delete relid ; fNhits++ ; } delete newHit; } +//____________________________________________________________________________ +void AliPHOSv1::FinishPrimary() +{ + // called at the end of each track (primary) by AliRun + // hits are reset for each new track + // accumulate the total hit-multiplicity +// if ( fQAHitsMul ) +// fQAHitsMul->Update( fHits->GetEntriesFast() ) ; + +} + +//____________________________________________________________________________ +void AliPHOSv1::FinishEvent() +{ + // called at the end of each event by AliRun + // accumulate the hit-multiplicity and total energy per block + // if the values have been updated check it + + if ( fQATotEner ) { + if ( fQATotEner->HasChanged() ) { + fQATotEner->CheckMe() ; + fQATotEner->Reset() ; + } + } + + Int_t i ; + if ( fQAHitsMulB && fQATotEnerB ) { + for (i = 0 ; i < fGeom->GetNModules() ; i++) { + AliPHOSQAIntCheckable * ci = (AliPHOSQAIntCheckable*)(*fQAHitsMulB)[i] ; + AliPHOSQAFloatCheckable* cf = (AliPHOSQAFloatCheckable*)(*fQATotEnerB)[i] ; + if ( ci->HasChanged() ) { + ci->CheckMe() ; + ci->Reset() ; + } + if ( cf->HasChanged() ) { + cf->CheckMe() ; + cf->Reset() ; + } + } + } + + // check the total multiplicity + + if ( fQAHitsMul ) { + if ( fQAHitsMul->HasChanged() ) { + fQAHitsMul->CheckMe() ; + fQAHitsMul->Reset() ; + } + } +} + //____________________________________________________________________________ void AliPHOSv1::StepManager(void) { @@ -296,6 +396,10 @@ void AliPHOSv1::StepManager(void) if ( xyze[3] != 0 ) { // Track is inside the crystal and deposits some energy gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ; + + // fill the relevant QA Checkables + fQATotEner->Update( xyze[3] ) ; // total energy in PHOS + ((AliPHOSQAFloatCheckable*)(*fQATotEnerB)[relid[0]-1])->Update( xyze[3] ) ; // energy in this block if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 ) relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules(); @@ -349,6 +453,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe Float_t pNorm = p.Py(); Float_t eloss = kdEdx; +// cout << "CPVDigitize: YVK : "<GetCPVGasThickness(); Float_t dXY = pX/pNorm * fGeom->GetCPVGasThickness(); gRandom->Rannor(rnor1,rnor2); diff --git a/PHOS/AliPHOSv1.h b/PHOS/AliPHOSv1.h index 22a5948a18b..3fd8a78653d 100644 --- a/PHOS/AliPHOSv1.h +++ b/PHOS/AliPHOSv1.h @@ -17,6 +17,8 @@ class TFile; // --- AliRoot header files --- #include "AliPHOSv0.h" +class AliPHOSQAIntCheckable ; +class AliPHOSQAFloatCheckable ; class AliPHOSv1 : public AliPHOSv0 { @@ -31,8 +33,10 @@ public: } virtual ~AliPHOSv1(void) ; - virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits); - virtual Int_t IsVersion(void) const { + virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits) ; + virtual void FinishEvent() ; + virtual void FinishPrimary() ; + virtual Int_t IsVersion(void) const { // Gives the version number return 1 ; } @@ -55,6 +59,11 @@ public: protected: + + AliPHOSQAIntCheckable * fQAHitsMul ; // QA Hits Multiplicity checkable + TClonesArray * fQAHitsMulB ; // QA Hits Multiplicity / Block checkable + AliPHOSQAFloatCheckable * fQATotEner ; // QA Total Energy checkable + TClonesArray * fQATotEnerB ; // QA Total Energy / Block checkable ClassDef(AliPHOSv1,1) // Implementation of PHOS manager class for layout EMC+PPSD diff --git a/PHOS/Makefile b/PHOS/Makefile index ea1baaf3f37..d4df3473ad7 100644 --- a/PHOS/Makefile +++ b/PHOS/Makefile @@ -26,7 +26,8 @@ SRCS = AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx AliPHOSv2.cxx \ AliPHOSRecParticle.cxx AliPHOSPID.cxx AliPHOSPIDv1.cxx \ AliPHOSAnalyze.cxx AliPHOSFastRecParticle.cxx \ AliPHOSIndexToObject.cxx \ - AliDBPPR.cxx AliDBPPRS.cxx + AliPHOSQAVirtualCheckable.cxx AliPHOSQAIntCheckable.cxx AliPHOSQAFloatCheckable.cxx\ + AliPHOSQAObjectCheckable.cxx AliPHOSQAChecker.cxx AliPHOSQAMeanChecker.cxx AliPHOSQAAlarm.cxx # C++ Headers diff --git a/PHOS/PHOSLinkDef.h b/PHOS/PHOSLinkDef.h index 63f98ef8337..a515eee6c23 100644 --- a/PHOS/PHOSLinkDef.h +++ b/PHOS/PHOSLinkDef.h @@ -38,7 +38,11 @@ #pragma link C++ class AliPHOSIndexToObject+; #pragma link C++ class AliPHOSAnalyze+; #pragma link C++ class AliPHOSCPVDigit+; -#pragma link C++ class AliDBPPR+; -#pragma link C++ class AliDBPPRS+; - +#pragma link C++ class AliPHOSQAVirtualCheckable+; +#pragma link C++ class AliPHOSQAIntCheckable+; +#pragma link C++ class AliPHOSQAFloatCheckable+; +#pragma link C++ class AliPHOSQAObjectCheckable+; +#pragma link C++ class AliPHOSQAChecker+; +#pragma link C++ class AliPHOSQAMeanChecker+; +#pragma link C++ class AliPHOSQAAlarm+; #endif -- 2.43.0