/* $Id$ */
-//---
-// Produces the data needed to calculate the quality assurance.
-// All data must be mergeable objects.
-// A. Mastroserio
-//---
-
// --- ROOT system ---
#include <TClonesArray.h>
#include <TFile.h>
#include <TH1F.h>
#include <TH2F.h>
-#include <TH1I.h>
-#include <TDirectory.h>
#include <Riostream.h>
// --- Standard library ---
// --- AliRoot header files ---
+#include "AliESDCaloCluster.h"
+#include "AliESDEvent.h"
+#include "AliQAChecker.h"
#include "AliLog.h"
#include "AliHMPIDDigit.h"
#include "AliHMPIDHit.h"
+#include "AliHMPIDCluster.h"
#include "AliHMPIDQADataMakerSim.h"
+#include "AliHMPIDParam.h"
+#include "AliHMPIDRawStream.h"
+#include "AliLog.h"
+
+//.
+// HMPID AliHMPIDQADataMakerSim base class
+// for QA of simulation
+// here also errors are calculated
+//.
ClassImp(AliHMPIDQADataMakerSim)
//____________________________________________________________________________
AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
- AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker"),
- fhHitQdc(0x0),
- fhSDigits(0x0),
- fhDigPcEvt(0x0),
- fhDigChEvt(0x0),
- fhDigQ(0x0)
- // fhCluEvt(0x0),
-// fhCluChi2(0x0),
-// fhCluQ(0x0),
-// fhCluFlg(0x0),
-// fhCluSize(0x0),
-// fhMipCluSize(0x0),
-// fhCkovP(0x0),
-// fhSigP(0x0),
-// fhMipXY(0x0),
-// fhDifXY(0x0)
+ AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kHMPID), "HMPID Quality Assurance Data Maker"), fChannel(0)
{
// ctor
- for(Int_t i=0; i<7; i++) fhHitMap[i]=0x0;
-// for(Int_t j=0; j<5; j++) fhPid[j]=0x0;
-// fDetectorDir = fOutput->GetDirectory(GetName()) ;
-// if (!fDetectorDir)
-// fDetectorDir = fOutput->mkdir(GetName()) ;
}
//____________________________________________________________________________
AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
- AliQADataMakerSim(),
- fhHitQdc(qadm.fhHitQdc),
- fhSDigits(qadm.fhSDigits),
- fhDigPcEvt(qadm.fhDigPcEvt),
- fhDigChEvt(qadm.fhDigChEvt),
- fhDigQ(qadm.fhDigQ)
-// fhCluEvt(qadm.fhCluEvt),
-// fhCluChi2(qadm.fhCluChi2),
-// fhCluQ(qadm.fhCluQ),
-// fhCluFlg(qadm.fhCluFlg),
-// fhCluSize(qadm.fhCluSize),
-// fhMipCluSize(qadm.fhMipCluSize),
-// fhCkovP(qadm.fhCkovP),
-// fhSigP(qadm.fhSigP),
-// fhMipXY(qadm.fhMipXY),
-// fhDifXY(qadm.fhDifXY)
+ AliQADataMakerSim(),fChannel(0)
{
//copy ctor
- for(Int_t i=0; i<7; i++) fhHitMap[i]=qadm.fhHitMap[i];
-// for(Int_t j=0; j<5; j++) fhPid[j]=qadm.fhPid[j];
-
SetName((const char*)qadm.GetName()) ;
SetTitle((const char*)qadm.GetTitle());
}
void AliHMPIDQADataMakerSim::InitHits()
{
// create Hits histograms in Hits subdir
- fhHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
- for(Int_t iCh=0;iCh<7;iCh++)
- fhHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);
+ const Bool_t expert = kTRUE ;
+ const Bool_t image = kTRUE ;
+
+ TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC;Entries",500,0,4000);
+ Add2HitsList(hHitQdc,0, !expert, image);
+ TH2F *hHitMap[7];
+ for(Int_t iCh=0;iCh<7;iCh++) {
+ hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit};Entries",iCh),162,-1,161,146,-1,145);
+ Add2HitsList(hHitMap[iCh],iCh+1,expert,!image);
+ }
}
//____________________________________________________________________________
void AliHMPIDQADataMakerSim::InitDigits()
{
// create Digits histograms in Digits subdir
- fhDigPcEvt=new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
- fhDigChEvt=new TH1F("hDigChEvt","Chamber occupancy",32,-1,7);
- fhDigQ =new TH1F("Q "," digit charge ",3000,0,3000);
+ const Bool_t expert = kTRUE ;
+ const Bool_t image = kTRUE ;
+
+ TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event;Occupanc [%];Entries",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
+ TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
+ TH2F *hDigMap[7];
+ TH1F *hDigQ[42];
+ for(Int_t iCh =0; iCh < 7; iCh++){
+ hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i;Digit #;Entries",iCh),159,0,159,143,0,143);
+ for(Int_t iPc =0; iPc < 6; iPc++ ){
+ hDigQ[iCh*6+iPc] = new TH1F(Form("QCh%iPc%i ",iCh,iPc),Form("Charge of digits (ADC) in Chamber %i and PC %i;Charge;Entries",iCh,iPc),4100,0,4100);
+ }
+ }
+
+ Add2DigitsList(hDigChEvt,0, !expert, image);
+ Add2DigitsList(hDigPcEvt,1,expert, !image);
+ for(Int_t iMap=0; iMap < 7; iMap++) Add2DigitsList(hDigMap[iMap],2+iMap,expert, !image);
+ for(Int_t iH =0; iH < 42 ; iH++) Add2DigitsList(hDigQ[iH] ,9+iH,expert,!image);
}
//____________________________________________________________________________
void AliHMPIDQADataMakerSim::InitSDigits()
{
// create SDigits histograms in SDigits subdir
- fhSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
+ const Bool_t expert = kTRUE ;
+ const Bool_t image = kTRUE ;
+
+ TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID;QDC;Entries", 500, 0., 5000.) ;
+ Add2SDigitsList(hSDigits,0, !expert, image);
+}
+
+//____________________________________________________________________________
+
+void AliHMPIDQADataMakerSim::MakeHits()
+{
+ //
+ //filling QA histos for Hits
+ //
+
+ TIter next(fHitsArray);
+ AliHMPIDHit * hit ;
+ while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
+ if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
+ if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
+ }
+}
+
+//___________________________________________________________________________
+void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
+{
+//
+//Opening of the Hit TTree
+//
+ if (fHitsArray)
+ fHitsArray->Clear() ;
+ else
+ fHitsArray=new TClonesArray("AliHMPIDHit");
+ data->SetBranchAddress("HMPID",&fHitsArray);
+ for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
+ data->GetEntry(iEnt);
+ MakeHits();
+ }//entries loop
+}
+//___________________________________________________________________________
+void AliHMPIDQADataMakerSim::MakeDigits()
+{
+ //
+ //filling QA histos for Digits
+ //
+
+ Int_t i = fChannel ;
+ GetDigitsData(0)->Fill(i,fDigitsArray->GetEntriesFast()/(48.*80.*6.));
+ TIter next(fDigitsArray);
+ AliHMPIDDigit * digit;
+ while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
+ GetDigitsData(1)->Fill(10.*i+digit->Pc(),1./(48.*80.));
+ GetDigitsData(2+i)->Fill(digit->PadChX(),digit->PadChY());
+ GetDigitsData(9+i*6+digit->Pc())->Fill(digit->Q());
+ }
+}
+//___________________________________________________________________________
+void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
+{
+ //
+ //Opening the Digit Tree
+ //
+
+ if(fDigitsArray)
+ fDigitsArray->Clear() ;
+ else
+ fDigitsArray=new TClonesArray("AliHMPIDDigit");
+
+ for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
+ fChannel = iCh ;
+ data->SetBranchAddress(Form("HMPID%i",iCh),&fDigitsArray);
+ data->GetEntry(0);
+ MakeDigits();
+ fDigitsArray->Clear() ;
+ }
}
//____________________________________________________________________________
-void AliHMPIDQADataMakerSim::MakeHits(TObject * data)
+
+void AliHMPIDQADataMakerSim::MakeSDigits()
{
- //fills QA histos for Hits
- TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
- if (!hits){
- AliError("Wrong type of hits container") ;
- } else {
- TIter next(hits);
- AliHMPIDHit * hit ;
- while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
- if(hit->Pid()<500000) fhHitQdc->Fill(hit->Q()) ;
- if(hit->Pid()<500000) fhHitMap[hit->Ch()]->Fill(hit->LorsX(),hit->LorsY());
- }
+ //
+ //filling QA histos for SDigits
+ //
+
+ TIter next(fSDigitsArray) ;
+ AliHMPIDDigit * sdigit ;
+ while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
+ GetSDigitsData(0)->Fill(sdigit->Q());
}
}
+//___________________________________________________________________________
+void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
+{
+ //
+ // Opening the SDigit Tree
+ //
+ if (fSDigitsArray)
+ fSDigitsArray->Clear() ;
+ else
+ fSDigitsArray = new TClonesArray("AliHMPIDDigit", 1000) ;
+ TBranch * branch = data->GetBranch("HMPID") ;
+ if ( ! branch ) {
+ AliError("HMPID SDigit Tree not found") ;
+ return;
+ }
+ branch->SetAddress(&fSDigitsArray) ;
+ branch->GetEntry(0) ;
+ MakeSDigits() ;
+}
//____________________________________________________________________________
-void AliHMPIDQADataMakerSim::MakeDigits( TObject * data)
+void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
{
- //fills QA histos for Digits
- TObjArray *chambers = dynamic_cast<TObjArray*>(data);
- if ( !chambers) {
- AliError("Wrong type of digits container") ;
- } else {
- for(Int_t i =0; i< chambers->GetEntries(); i++)
- {
- TClonesArray * digits = dynamic_cast<TClonesArray*>(chambers->At(i));
- fhDigChEvt->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
- TIter next(digits);
- AliHMPIDDigit * digit;
- while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
- fhDigPcEvt->Fill(10.*i+digit->Pc(),1./(48.*80.));
- fhDigQ->Fill(digit->Q());
- }
- }
- }
+ //Detector specific actions at start of cycle
+
}
-//____________________________________________________________________________
-void AliHMPIDQADataMakerSim::MakeSDigits( TObject * data)
+void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray **obj)
{
- //fills QA histos for SDigits
- TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
- if (!sdigits) {
- AliError("Wrong type of sdigits container") ;
- } else {
- AliHMPIDDigit *ref = (AliHMPIDDigit *)sdigits->At(0);
- Float_t zero = ref->GetTrack(0);
- TIter next(sdigits) ;
- AliHMPIDDigit * sdigit ;
- while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
- fhSDigits->Fill(sdigit->Q()) ;
- if(zero == sdigit->GetTrack(0)) continue;
- else zero = sdigit->GetTrack(0);
- }
- }
+ //Detector specific actions at end of cycle
+ // do the QA checking
+ AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;
}
+