// --- AliRoot header files ---
#include "AliESDEvent.h"
#include "AliLog.h"
+#include "AliRawReader.h"
#include "AliTRDcluster.h"
#include "AliTRDQADataMakerRec.h"
#include "AliTRDgeometry.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDrawStreamTB.h"
-
+//#include "AliTRDdataArrayI.h"
+#include "AliTRDrawStream.h"
+#include "AliTRDdigitsManager.h"
+#include "AliTRDdigit.h"
+#include "AliTRDarrayADC.h"
#include "AliQAChecker.h"
ClassImp(AliTRDQADataMakerRec)
//____________________________________________________________________________
AliTRDQADataMakerRec::AliTRDQADataMakerRec() :
- AliQADataMakerRec(AliQA::GetDetName(AliQA::kTRD), "TRD Quality Assurance Data Maker")
+ AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTRD), "TRD Quality Assurance Data Maker")
{
//
// Default constructor
}
//____________________________________________________________________________
-void AliTRDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
+void AliTRDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
{
//
// Detector specific actions at end of cycle
//TStopwatch watch;
//watch.Start();
- AliInfo("End of TRD cycle");
+ AliDebug(AliQAv1::GetQADebugLevel(), "End of TRD cycle");
- if (task == AliQA::kRECPOINTS) {
-
- TH1D *hist = new TH1D("fitHist", "", 200, -0.5, 199.5);
- //list->Print();
+ if (task == AliQAv1::kRECPOINTS) {
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ TH1D * hist = new TH1D("fitHist", "", 200, -0.5, 199.5);
+ //list[specie]->Print();
- // fill detector map;
- for(int i=0; i<540; i++) {
- Double_t v = ((TH1D*)list->At(0))->GetBinContent(i+1);
- Int_t sm = i/30;
- Int_t det = i%30;
-
- TH2D *detMap = (TH2D*)list->At(87);
- Int_t bin = detMap->FindBin(sm, det);
- detMap->SetBinContent(bin, v);
- }
-
-
- // Rec points full chambers
- for (Int_t i=0; i<540; i++) {
+ // fill detector map;
+ for(Int_t i = 0 ; i < 540 ; i++) {
+ Double_t v = ((TH1D*)list[specie]->At(0))->GetBinContent(i+1);
+ Int_t sm = i/30;
+ Int_t det = i%30;
+ TH2D *detMap = (TH2D*)list[specie]->At(87);
+ Int_t bin = detMap->FindBin(sm, det);
+ detMap->SetBinContent(bin, v);
+ }
+ // Rec points full chambers
+ for (Int_t i = 0 ; i < 540 ; i++) {
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("I = %d", i));
+ //TH1D *h = ((TH2D*)list[specie]->At(1))->ProjectionY(Form("qaTRD_recPoints_amp_%d",i), i+1, i+1);
+ hist->Reset();
+ for(Int_t b = 1 ; b < hist->GetXaxis()->GetNbins()-1 ; b++) {
+ Double_t xvalue = hist->GetBinCenter(b);
+ Int_t bin = ((TH2D*)list[specie]->At(1))->FindBin(i,xvalue);
+ Double_t value = ((TH2D*)list[specie]->At(1))->GetBinContent(bin);
+ hist->SetBinContent(b, value);
+ }
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("Sum = %d %f\n", i, hist->GetSum()));
+ if (hist->GetSum() < 100)
+ continue; // chamber not present
- //AliInfo(Form("I = %d", i));
-
- //TH1D *h = ((TH2D*)list->At(1))->ProjectionY(Form("qaTRD_recPoints_amp_%d",i), i+1, i+1);
- hist->Reset();
- for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
- Double_t xvalue = hist->GetBinCenter(b);
- Int_t bin = ((TH2D*)list->At(1))->FindBin(i,xvalue);
- Double_t value = ((TH2D*)list->At(1))->GetBinContent(bin);
- hist->SetBinContent(b, value);
+ hist->Fit("landau", "q0", "goff", 10, 180);
+ TF1 *fit = hist->GetFunction("landau");
+ ((TH1D*)list[specie]->At(12))->Fill(fit->GetParameter(1));
+ ((TH1D*)list[specie]->At(13))->Fill(fit->GetParameter(2));
}
-
- //printf("Sum = %d %f\n", i, hist->GetSum());
- if (hist->GetSum() < 100) continue; // chamber not present
-
- hist->Fit("landau", "q0", "goff", 10, 180);
- TF1 *fit = hist->GetFunction("landau");
- ((TH1D*)list->At(12))->Fill(fit->GetParameter(1));
- ((TH1D*)list->At(13))->Fill(fit->GetParameter(2));
- }
-
- // time-bin by time-bin sm by sm
- for(Int_t i=0; i<18; i++) { // loop over super-modules
-
- for(Int_t j=0; j<35; j++) { // loop over time bins
-
- //TH1D *h = ((TH3D*)list->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, j+1, j+1);
- hist->Reset();
- for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
- Double_t xvalue = hist->GetBinCenter(b);
- Double_t svalue = 0;
-
- for(Int_t det=i*30; det<(i+1)*30; det++) { // loop over detectors
- Int_t bin = ((TH3D*)list->At(10))->FindBin(det,j,xvalue);
- Double_t value = ((TH3D*)list->At(10))->GetBinContent(bin);
- svalue += value;
- }
- //printf("v = %f\n", value);
- hist->SetBinContent(b, svalue);
- }
+ // time-bin by time-bin sm by sm
+ for(Int_t i = 0 ; i < 18 ; i++) { // loop over super-modules
+ for(Int_t j = 0 ; j < 35 ; j++) { // loop over time bins
+ //TH1D *h = ((TH3D*)list[specie]->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, j+1, j+1);
+ hist->Reset();
+ for(Int_t b = 1 ; b < hist->GetXaxis()->GetNbins()-1 ; b++) {
+ Double_t xvalue = hist->GetBinCenter(b);
+ Double_t svalue = 0.0;
+ for(Int_t det = i*30 ; det < (i+1)*30 ; det++) { // loop over detectors
+ Int_t bin = ((TH3D*)list[specie]->At(10))->FindBin(det,j,xvalue);
+ Double_t value = ((TH3D*)list[specie]->At(10))->GetBinContent(bin);
+ svalue += value;
+ }
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("v = %f\n", value));
+ hist->SetBinContent(b, svalue);
+ }
- if (hist->GetSum() < 100) continue;
- //printf("fitting %d %d %f\n", i, j, hist->GetSum());
+ if (hist->GetSum() < 100)
+ continue;
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("fitting %d %d %f\n", i, j, hist->GetSum()));
- hist->Fit("landau", "q0", "goff", 10, 180);
- TF1 *fit = hist->GetFunction("landau");
+ hist->Fit("landau", "q0", "goff", 10, 180);
+ TF1 *fit = hist->GetFunction("landau");
- TH1D *h1 = (TH1D*)list->At(14+18+i);
- Int_t bin = h1->FindBin(j);
- // printf("%d %d %d\n", det, j, bin);
- h1->SetBinContent(bin, TMath::Abs(fit->GetParameter(1)));
+ TH1D *h1 = (TH1D*)list[specie]->At(14+18+i);
+ Int_t bin = h1->FindBin(j);
+ // AliDebug(AliQAv1::GetQADebugLevel(), Form("%d %d %d\n", det, j, bin));
+ h1->SetBinContent(bin, TMath::Abs(fit->GetParameter(1)));
+ }
}
- }
-
- // time-bin by time-bin chamber by chamber
- for (Int_t i=0; i<540; i++) {
+ // time-bin by time-bin chamber by chamber
+ for(Int_t i = 0 ; i < 540 ; i++) {
+ //TH1D *test = ((TH3D*)list[specie]->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, 0, 35);
+ //if (test->GetSum() < 100) continue;
- //TH1D *test = ((TH3D*)list->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, 0, 35);
- //if (test->GetSum() < 100) continue;
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("fitting det = %d", i));
- //AliInfo(Form("fitting det = %d", i));
-
- for(Int_t j=0; j<35; j++) {
-
- //TH1D *h = ((TH3D*)list->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, j+1, j+1);
- hist->Reset();
- for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
- Double_t xvalue = hist->GetBinCenter(b);
- Int_t bin = ((TH3D*)list->At(10))->FindBin(i,j,xvalue);
- Double_t value = ((TH3D*)list->At(10))->GetBinContent(bin);
- //printf("v = %f\n", value);
- hist->SetBinContent(b, value);
- }
+ for(Int_t j = 0 ; j < 35 ; j++) {
+ //TH1D *h = ((TH3D*)list[specie]->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, j+1, j+1);
+ hist->Reset();
+ for(Int_t b = 1 ; b < hist->GetXaxis()->GetNbins()-1 ; b++) {
+ Double_t xvalue = hist->GetBinCenter(b);
+ Int_t bin = ((TH3D*)list[specie]->At(10))->FindBin(i,j,xvalue);
+ Double_t value = ((TH3D*)list[specie]->At(10))->GetBinContent(bin);
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("v = %f\n", value));
+ hist->SetBinContent(b, value);
+ }
- if (hist->GetSum() < 100) continue;
- //printf("fitting %d %d %f\n", i, j, hist->GetSum());
+ if (hist->GetSum() < 100) continue;
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("fitting %d %d %f\n", i, j, hist->GetSum()));
- hist->Fit("landau", "q0", "goff", 10, 180);
- TF1 *fit = hist->GetFunction("landau");
+ hist->Fit("landau", "q0", "goff", 10, 180);
+ TF1 *fit = hist->GetFunction("landau");
- Int_t sm = i/30;
- Int_t det = i%30;
- TH2D *h2 = (TH2D*)list->At(14+sm);
- Int_t bin = h2->FindBin(det,j);
- // printf("%d %d %d\n", det, j, bin);
- h2->SetBinContent(bin, TMath::Abs(fit->GetParameter(1)));
- h2->SetBinError(bin,fit->GetParError(1));
+ Int_t sm = i/30;
+ Int_t det = i%30;
+ TH2D *h2 = (TH2D*)list[specie]->At(14+sm);
+ Int_t bin = h2->FindBin(det,j);
+ // AliDebug(AliQAv1::GetQADebugLevel(), Form("%d %d %d\n", det, j, bin));
+ h2->SetBinContent(bin, TMath::Abs(fit->GetParameter(1)));
+ h2->SetBinError(bin,fit->GetParError(1));
+ }
}
+ if (hist)
+ delete hist;
}
-
- if (hist) delete hist;
}
-
//////////////////////////
// const Int_t knbits = 6;
// const char *suf[knbits] = {"TPCi", "TPCo", "TPCz", "TRDo", "TRDr", "TRDz"};
//const char *sufRatio[4] = {"TRDrTRDo", "TRDoTPCo", "TRDrTPCo", "TRDzTPCo"};
- if (task == AliQA::kESDS) {
+ if (task == AliQAv1::kESDS) {
const Int_t knRatio = 4;
const Int_t kN[knRatio] = {4,3,4,5};
const Int_t kD[knRatio] = {3,1,1,3};
// create ratios
- for(Int_t type=0; type<2; type++) {
- for(Int_t i=0; i<knRatio; i++) {
-
- TH1D *ratio = (TH1D*)list->At(19 + 2*i + type);
- TH1D *histN = (TH1D*)list->At(3 + 2*kN[i] + type);
- TH1D *histD = (TH1D*)list->At(3 + 2*kD[i] + type);
-
- BuildRatio(ratio, histN, histD);
- //ratio->Reset();
- //ratio->Add(histN);
- //ratio->Divide(histD);
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ for(Int_t type = 0 ; type < 2 ; type++) {
+ for(Int_t i = 0 ; i < knRatio ; i++) {
+ TH1D *ratio = (TH1D*)list[specie]->At(19 + 2*i + type);
+ TH1D *histN = (TH1D*)list[specie]->At(3 + 2*kN[i] + type);
+ TH1D *histD = (TH1D*)list[specie]->At(3 + 2*kD[i] + type);
+ BuildRatio(ratio, histN, histD);
+ //ratio->Reset();
+ //ratio->Add(histN);
+ //ratio->Divide(histD);
+ }
}
+ // ratio for the fraction of electrons per stack
+ TH1D *histN = (TH1D*)list[specie]->At(33);
+ TH1D *histD = (TH1D*)list[specie]->At(32);
+ TH1D *ratio = (TH1D*)list[specie]->At(34);
+ BuildRatio(ratio, histN, histD);
}
-
- // ratio for the fraction of electrons per stack
- TH1D *histN = (TH1D*)list->At(33);
- TH1D *histD = (TH1D*)list->At(32);
- TH1D *ratio = (TH1D*)list->At(34);
- BuildRatio(ratio, histN, histD);
}
-
-
// call the checker
- AliQAChecker::Instance()->Run(AliQA::kTRD, task, list) ;
+ AliQAChecker::Instance()->Run(AliQAv1::kTRD, task, list) ;
}
//____________________________________________________________________________
//
// Create ESDs histograms in ESDs subdir
//
-
+ const Bool_t expert = kTRUE ;
+ const Bool_t image = kTRUE ;
+
const Int_t kNhist = 36+5+4;
TH1 *hist[kNhist];
for(Int_t i=0; i<kNhist; i++) {
//hist[i]->Sumw2();
- Add2ESDsList(hist[i], i);
+ Add2ESDsList(hist[i], i, !expert, image);
}
}
+//____________________________________________________________________________
+void AliTRDQADataMakerRec::InitDigits()
+{
+ //
+ // Create Digits histograms in Digits subdir
+ //
+ const Bool_t expert = kTRUE ;
+ const Bool_t image = kTRUE ;
+
+ const Int_t kNhist = 3;
+ TH1D *hist[kNhist];
+
+ hist[0] = new TH1D("qaTRD_digits_det", ";Detector Id of the digit", 540, -0.5, 539.5);
+ hist[1] = new TH1D("qaTRD_digits_time", ";Time bin", 40, -0.5, 39.5);
+ hist[2] = new TH1D("qaTRD_digits_amp", ";Amplitude", 100, -5.5, 94.5);
+
+ for(Int_t i=0; i<kNhist; i++) {
+ hist[i]->Sumw2();
+ Add2DigitsList(hist[i], i, !expert, image);
+ }
+
+}
+
//____________________________________________________________________________
void AliTRDQADataMakerRec::InitRecPoints()
{
//
// Create Reconstructed Points histograms in RecPoints subdir
//
-
+ const Bool_t expert = kTRUE ;
+ const Bool_t image = kTRUE ;
+
const Int_t kNhist = 14 + 4 * 18 + 2;
TH1 *hist[kNhist];
hist[11] = new TProfile("qaTRD_recPoints_prf", ";distance;center of gravity"
, 120, -0.6, 0.6, -1.2, 1.2, "");
- hist[12] = new TH1D("qaTRD_recPoints_ampMPV", ";amplitude MPV", 200, 0, 200);
+ hist[12] = new TH1D("qaTRD_recPoints_ampMPV", ";amplitude MPV", 150, 0, 150);
hist[13] = new TH1D("qaTRD_recPoints_ampSigma", ";amplitude Sigma", 200, 0, 200);
// chamber by chamber
for(Int_t i=0; i<kNhist; i++) {
//hist[i]->Sumw2();
- Add2RecPointsList(hist[i], i);
+ Add2RecPointsList(hist[i], i, !expert, image);
}
}
//
// create Raws histograms in Raws subdir
//
-
+ const Bool_t expert = kTRUE ;
+ const Bool_t saveCorr = kTRUE ;
+ const Bool_t image = kTRUE ;
+
const Int_t kSM = 18;
//const Int_t kNCh = 540;
const Int_t kNhist = 4+kSM;
// register
for(Int_t i=0; i<kNhist; i++) {
//hist[i]->Sumw2();
- Add2RawsList(hist[i], i);
+ Add2RawsList(hist[i], i, !expert, image, !saveCorr);
}
}
GetESDsData(0)->Fill(nTracks);
// track loop
- for (Int_t i=0; i<nTracks; i++) {
+ for (Int_t iTrack = 0; iTrack<nTracks; iTrack++) {
- AliESDtrack *track = esd->GetTrack(i);
+ AliESDtrack *track = esd->GetTrack(iTrack);
const AliExternalTrackParam *paramOut = track->GetOuterParam();
const AliExternalTrackParam *paramIn = track->GetInnerParam();
GetESDsData(28)->Fill(track->GetTRDBudget());
GetESDsData(29)->Fill(track->GetTRDchi2());
GetESDsData(30)->Fill(track->GetTRDTimBin(0));
- GetESDsData(31)->Fill(track->GetTRDpidQuality());
+ GetESDsData(31)->Fill(track->GetTRDntrackletsPID());
// dedx
- for(Int_t i=0; i<4; i++) {
+ for(Int_t k=0; k<4; ++k) {
Double_t dedx = 0;
for(Int_t j=0; j<6; j++) {
- dedx += track->GetTRDsignals(j, i-1);
+ dedx += track->GetTRDslice(j, k-1);
}
- GetESDsData(41+i)->Fill(paramOut->GetP(), dedx/6.);
+ GetESDsData(41+k)->Fill(paramOut->GetP(), dedx/6.);
}
// probabilities
if (status & AliESDtrack::kTRDpid) {
- for(Int_t i=0; i<AliPID::kSPECIES; i++)
- GetESDsData(36+i)->Fill(track->GetTRDpid(i));
+ for(Int_t k=0; k<AliPID::kSPECIES; ++k)
+ GetESDsData(36+k)->Fill(track->GetTRDpid(k));
}
// probabilities uniformity
- if (track->GetTRDpidQuality() < 6) continue;
+ if (track->GetTRDntrackletsPID() < 6) continue;
GetESDsData(35)->Fill(paramOut->GetZ()/paramOut->GetX());
Int_t idx = 5 * sector + stack;
const Int_t kMCM = 16;
// const Int_t kADC = 22;
+ rawReader->Reset() ;
//AliTRDrawStreamBase::SetRawStreamVersion("TB");
AliTRDrawStreamBase *raw = AliTRDrawStreamBase::GetRawStream(rawReader);
AliDebug(2,Form("Stream version: %s", raw->IsA()->GetName()));
delete raw;
}
+//____________________________________________________________________________
+void AliTRDQADataMakerRec::MakeDigits(TClonesArray * digits)
+{
+ //
+ // Makes data from Digits
+ //
+
+ TIter next(digits) ;
+ AliTRDdigit * digit ;
+
+ // Info("Make digits", "From the arrya");
+
+ while ( (digit = dynamic_cast<AliTRDdigit *>(next())) ) {
+ if (digit->GetAmp() < 1) continue;
+ GetDigitsData(0)->Fill(digit->GetDetector());
+ GetDigitsData(1)->Fill(digit->GetTime());
+ GetDigitsData(2)->Fill(digit->GetAmp());
+ }
+
+}
+
+//____________________________________________________________________________
+void AliTRDQADataMakerRec::MakeDigits(TTree * digits)
+{
+ //
+ // Makes data from digits tree
+ //
+
+ // Info("Make digits", "From a tree");
+
+ AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
+ digitsManager->CreateArrays();
+ digitsManager->ReadDigits(digits);
+
+ TH1D *histDet = (TH1D*)GetDigitsData(0);
+ TH1D *histTime = (TH1D*)GetDigitsData(1);
+ TH1D *histSignal = (TH1D*)GetDigitsData(2);
+
+ for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
+ {
+ AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i);
+
+ // This is to take care of switched off super modules
+ if (digitsIn->GetNtime() == 0) continue;
+
+ digitsIn->Expand();
+
+ //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
+ //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
+
+ Int_t nRows = digitsIn->GetNrow();
+ Int_t nCols = digitsIn->GetNcol();
+ Int_t nTbins = digitsIn->GetNtime();
+
+ for(Int_t row = 0; row < nRows; row++)
+ for(Int_t col = 0; col < nCols; col++)
+ for(Int_t time = 0; time < nTbins; time++)
+ {
+ Float_t signal = digitsIn->GetData(row,col,time);
+ if (signal < 1) continue;
+ histDet->Fill(i);
+ histTime->Fill(time);
+ histSignal->Fill(signal);
+ }
+
+ //delete digitsIn;
+ }
+ delete digitsManager;
+}
+
//____________________________________________________________________________
void AliTRDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
{