#include <TFile.h>
#include <TH1F.h>
#include <TH1I.h>
+#include <TH2I.h>
// --- AliRoot header files ---
#include "AliESDEvent.h"
#include "AliFMDRawReader.h"
#include "AliRawReader.h"
#include "AliFMDAltroMapping.h"
+#include "AliFMDDebug.h"
+namespace {
+ Int_t colors[3] = {kRed,kGreen,kBlue};
+}
//_____________________________________________________________________
// This is the class that collects the QA data for the FMD during
// reconstruction.
}
//_____________________________________________________________________
-AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
+AliFMDQADataMakerRec&
+AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
{
+ //
+ // Assignment operator
+ //
+ // Parameters:
+ // qadm What to assign from
+ //
+ // Return:
+ // Reference to this
+ //
fRecPointsArray = qadm.fRecPointsArray;
return *this;
//_____________________________________________________________________
AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
{
-
+ //
+ // Destrcutor
+ //
}
{
// Detector specific actions at end of cycle
// do the QA checking
+ ResetEventTrigClasses(); // reset triggers list to select all histos
AliLog::Message(5,"FMD: end of detector cycle",
"AliFMDQADataMakerRec","AliFMDQADataMakerRec",
"AliFMDQADataMakerRec::EndOfDetectorCycle",
AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list);
}
+//_____________________________________________________________________
+TH1* AliFMDQADataMakerRec::MakeADCHist(UShort_t d, Char_t r, Short_t b)
+{
+ TString name("adc");
+ TString title("ADC counts");
+ Int_t color = kRed+1;
+ if (d > 0) {
+ name.Append(Form("FMD%d%c", d, r));
+ title.Append(Form(" in FMD%d%c", d, r));
+ color = colors[d-1]+3+(r == 'I' || r == 'i' ? 0 : 1);
+ if (b >= 0) {
+ name.Append(Form("_0x%02x", b));
+ title.Append(Form("[0x%02x]", b));
+ }
+ }
+ TH1* hist = new TH1F(name, title,1024,0,1024);
+ hist->SetXTitle("Amplitude [ADC counts]");
+ hist->SetYTitle("Events [log]");
+ hist->SetFillStyle(3001);
+ hist->SetFillColor(color);
+ hist->SetLineColor(color);
+ hist->SetMarkerColor(color);
+ hist->GetXaxis()->SetNdivisions(408,false);
+ hist->SetDirectory(0);
+ // hist->SetStats(0);
+
+ return hist;
+}
+//_____________________________________________________________________
+TH1* AliFMDQADataMakerRec::MakeELossHist(UShort_t d, Char_t r, Short_t b)
+{
+ TString name("eloss");
+ TString title("Energy loss");
+ Int_t color = kBlue+1;
+ if (d > 0) {
+ name.Append(Form("FMD%d%c", d, r));
+ title.Append(Form(" in FMD%d%c", d, r));
+ color = colors[d-1]+3+(r == 'I' || r == 'i' ? 0 : 1);
+ if (b >= 0) {
+ name.Append(Form("_0x%02x", b));
+ title.Append(Form("[0x%02x]", b));
+ }
+ }
+ TH1* hist = new TH1F(name, title,300,0, 15);
+ hist->SetXTitle("#Delta E/#Delta_{mip}");
+ hist->SetYTitle("Events [log]");
+ hist->SetFillStyle(3001);
+ hist->SetFillColor(color);
+ hist->SetLineColor(color);
+ hist->SetMarkerColor(color);
+ hist->SetDirectory(0);
+ // hist->SetStats(0);
+
+ return hist;
+}
+
+
//_____________________________________________________________________
void AliFMDQADataMakerRec::InitESDs()
{
const Bool_t expert = kTRUE ;
const Bool_t image = kTRUE ;
- TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
- hEnergyOfESD->SetXTitle("Edep/Emip");
- hEnergyOfESD->SetYTitle("Counts");
- Add2ESDsList(hEnergyOfESD, 0, !expert, image);
-
+ TH1* hist = MakeELossHist();
+ Add2ESDsList(hist, 0, !expert, image);
+ ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
}
//_____________________________________________________________________
const Bool_t expert = kTRUE ;
const Bool_t image = kTRUE ;
- TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts;ADC counts;Counts",1024,0,1024);
- Add2DigitsList(hADCCounts, 0, !expert, image);
+ TH1* hist = MakeADCHist();
+ Add2DigitsList(hist, 0, !expert, image);
+ ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
}
-
//_____________________________________________________________________
void AliFMDQADataMakerRec::InitRecPoints()
{
const Bool_t expert = kTRUE ;
const Bool_t image = kTRUE ;
- TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
- "Energy Distribution",100,0,3);
- hEnergyOfRecpoints->SetXTitle("Edep/Emip");
- hEnergyOfRecpoints->SetYTitle("Counts");
- Add2RecPointsList(hEnergyOfRecpoints,0, !expert, image);
+ TH1* hist = MakeELossHist();
+ Add2RecPointsList(hist,0, !expert, image);
+ ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last linea
}
//_____________________________________________________________________
const Bool_t expert = kTRUE ;
const Bool_t saveCorr = kTRUE ;
const Bool_t image = kTRUE ;
+ TH2I* hErrors = new TH2I("readoutErrors", "Read out errors", 3, .5, 3.5,
+ 160, -.5, 159.5);
+ hErrors->GetXaxis()->SetBinLabel(1, "FMD1");
+ hErrors->GetXaxis()->SetBinLabel(2, "FMD2");
+ hErrors->GetXaxis()->SetBinLabel(3, "FMD3");
+ hErrors->SetYTitle("# errors");
+ hErrors->SetZTitle("Events [log]");
+ hErrors->SetDirectory(0);
+ Add2RawsList(hErrors, 1, !expert, image, !saveCorr);
+ //AliInfo(Form("Adding %30s to raw list @ %2d", hErrors->GetName(), 1));
- TH1I* hADCCounts;
- for(Int_t det = 1; det<=3; det++) {
- Int_t firstring = (det==1 ? 1 : 0);
- for(Int_t iring = firstring;iring<=1;iring++) {
- Char_t ring = (iring == 1 ? 'I' : 'O');
- hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c",
- det, ring), "ADC counts;Amplitude [ADC counts];Counts",
- 1024,0,1023);
-
- Int_t index1 = GetHalfringIndex(det, ring, 0,1);
- Add2RawsList(hADCCounts, index1, expert, !image, !saveCorr);
+ TH1* hist;
+ Int_t idx = 0;
+ for(UShort_t d = 1; d<=3; d++) {
+ UShort_t nR = (d == 1 ? 1 : 2);
+ for(UShort_t q = 0; q < nR; q++) {
+ Char_t r = (q == 1 ? 'O' : 'I');
+ hist = MakeADCHist(d, r, -1);
+
+ Int_t index1 = GetHalfringIndex(d, r, 0, 1);
+ idx = TMath::Max(index1, idx);
+ Add2RawsList(hist, index1, !expert, image, !saveCorr);
+ //AliInfo(Form("Adding %30s to raw list @ %2d", hist->GetName(), index1));
- for(Int_t b = 0; b<=1;b++) {
-
+ for(UShort_t b = 0; b <= 1; b++) {
//Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
- UInt_t board = (iring == 1 ? 0 : 1);
- board = board + b*16;
-
-
- hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
- det, ring, board), "ADC counts;Amplitude [ADC counts];Counts",
- 1024,0,1023);
- hADCCounts->SetXTitle("ADC counts");
- hADCCounts->SetYTitle("");
- Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
- Add2RawsList(hADCCounts, index2, !expert, image, !saveCorr);
+ UShort_t board = (q == 1 ? 0 : 1) + b*16;
+ hist = MakeADCHist(d, r, board);
+ Int_t index2 = GetHalfringIndex(d, r, board/16,0);
+ idx = TMath::Max(index2, idx);
+ Add2RawsList(hist, index2, expert, !image, !saveCorr);
+ //AliInfo(Form("Adding %30s to raw list @ %2d",hist->GetName(),index2));
}
}
}
+ //
+ ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
}
+#if 0
+struct FillESDHist : public AliESDFMD::ForOne
+{
+ FillESDHist(AliFMDQADataMakerRec* m) : fM(m) {}
+ FillESDHist(const FillESDHist& o) : fM(o.fM) {}
+ FillESDHist& operator=(const FillESDHist& o) { fM = o.fM; return *this; }
+ Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Float_t m, Float_t)
+ {
+ // Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
+ if(m == AliESDFMD::kInvalidMult) return true;
+
+ fM->FillESDsData(0,m);
+ return true;
+ }
+ AliFMDQADataMakerRec* fM;
+};
+#endif
+
//_____________________________________________________________________
void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
{
+ //
+ // Analyse ESD event
+ //
+ // Parameters:
+ // esd ESD event
+ //
if(!esd) {
AliError("FMD ESD object not found!!") ;
return;
}
+ AliFMDDebug(2, ("Will loop over ESD data and fill histogram"));
+
AliESDFMD* fmd = esd->GetFMDData();
if (!fmd) return;
-
+
+#if 0
+ FillESDHist f(this);
+ fmd->ForEach(f);
+#else
+
+
+
+ // FIXME - we should use AliESDFMD::ForOne subclass to do this!
for(UShort_t det=1;det<=3;det++) {
- for (UShort_t ir = 0; ir < 2; ir++) {
+ UShort_t nrng = (det == 1 ? 1 : 2);
+ for (UShort_t ir = 0; ir < nrng; ir++) {
Char_t ring = (ir == 0 ? 'I' : 'O');
UShort_t nsec = (ir == 0 ? 20 : 40);
UShort_t nstr = (ir == 0 ? 512 : 256);
Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
if(mult == AliESDFMD::kInvalidMult) continue;
- GetESDsData(0)->Fill(mult);
+ FillESDsData(0,mult);
}
}
}
}
+#endif
+ IncEvCountCycleESDs();
+ IncEvCountTotalESDs();
}
for(Int_t i=0;i<fDigitsArray->GetEntriesFast();i++) {
//Raw ADC counts
AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
- GetDigitsData(0)->Fill(digit->Counts());
+ FillDigitsData(0,digit->Counts());
}
}
//_____________________________________________________________________
void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
{
-
+ //
+ // Analyse digits
+ //
+ // Parameters:
+ // digitTree Tree of digits
+ //
if (fDigitsArray)
fDigitsArray->Clear();
else
branch->SetAddress(&fDigitsArray);
branch->GetEntry(0);
MakeDigits();
+ //
+ IncEvCountCycleDigits();
+ IncEvCountTotalDigits();
}
//_____________________________________________________________________
void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
{
+ //
+ // Analyse raw
+ //
+ // Parameters:
+ // rawReader Raw reader
+ //
- AliFMDRawReader fmdReader(rawReader,0);
+ AliFMDRawReader fmdReader(rawReader,0);
if (fDigitsArray)
fDigitsArray->Clear();
Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec);
Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
- GetRawsData(index1)->Fill(digit->Counts());
+ FillRawsData(index1,digit->Counts());
Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
- GetRawsData(index2)->Fill(digit->Counts());
+ FillRawsData(index2,digit->Counts());
}
+ //
+ FillRawsData(1,1, fmdReader.GetNErrors(0));
+ FillRawsData(1,2, fmdReader.GetNErrors(1));
+ FillRawsData(1,3, fmdReader.GetNErrors(2));
+ //
+ IncEvCountCycleRaws();
+ IncEvCountTotalRaws();
}
//_____________________________________________________________________
TIter next(RecPointsAddress) ;
AliFMDRecPoint * rp ;
while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
-
- GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
-
+ FillRecPointsData(0,rp->Edep()/pars->GetEdepMip());
}
-
+ IncEvCountCycleRecPoints();
+ IncEvCountTotalRecPoints();
+ //
}
//_____________________________________________________________________
Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
Char_t ring,
UShort_t board,
- UShort_t monitor) {
-
- UShort_t iring = (ring == 'I' ? 1 : 0);
-
- Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0));
-
+ UShort_t monitor) const
+{
+ //
+ // Get the half-ring index
+ //
+ // Parameters:
+ // det Detector
+ // ring Ring
+ // board Board number
+ // monitor Monitor
+ //
+ // Return:
+ // Half ring index
+ //
+ UShort_t iring = (ring == 'I' || ring == 'i' ? 1 : 0);
+ Int_t index = ((((det-1) & 0x3) << 3) |
+ ((iring & 0x1) << 2) |
+ ((board & 0x1) << 1) |
+ ((monitor & 0x1) << 0));
+#if 0
+ AliInfo(Form("d=%d, r=%c, b=%d, m=%d -> (%d<<3)|(%d<<2)|(%d<<1)|(%d<<0)=%2d",
+ det, ring, board, monitor, (det-1) & 0x3, iring & 0x1,
+ board & 0x1, monitor & 0x1, index));
+#endif
return index-2;
-
}
//_____________________________________________________________________