X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONTrackerQADataMakerRec.cxx;h=b7d206b09e8947c4c34a3dc1312c2a97109d5c68;hb=2176e8cffb1bf74705a0b9654e040ab08dc57210;hp=f38f0516c7fae891ec862e97b11c1881d44464cc;hpb=64c2397e2d714a7b28efda2f2c5c283f19e40a4e;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONTrackerQADataMakerRec.cxx b/MUON/AliMUONTrackerQADataMakerRec.cxx index f38f0516c7f..b7d206b09e8 100644 --- a/MUON/AliMUONTrackerQADataMakerRec.cxx +++ b/MUON/AliMUONTrackerQADataMakerRec.cxx @@ -1,4 +1,4 @@ -/************************************************************************** + /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * @@ -18,50 +18,57 @@ // --- MUON header files --- #include "AliMUONTrackerQADataMakerRec.h" -#include "AliQAv1.h" +#include "AliCDBManager.h" +#include "AliCodeTimer.h" +#include "AliDAQ.h" +#include "AliESDEvent.h" +#include "AliESDMuonTrack.h" +#include "AliLog.h" +#include "AliMUON2DMap.h" +#include "AliMUONCalibParamND.h" +#include "AliMUONCalibrationData.h" #include "AliMUONConstants.h" #include "AliMUONDigitMaker.h" +#include "AliMUONESDInterface.h" +#include "AliMUONLogger.h" +#include "AliMUONQADataMakerRec.h" #include "AliMUONQAIndices.h" #include "AliMUONQAMappingCheck.h" -#include "AliMUONLogger.h" +#include "AliMUONTrack.h" +#include "AliMUONTrackParam.h" +#include "AliMUONTrackerData.h" #include "AliMUONTrackerDataMaker.h" #include "AliMUONVCluster.h" #include "AliMUONVClusterStore.h" #include "AliMUONVDigit.h" +#include "AliMUONVDigit.h" #include "AliMUONVDigitStore.h" -#include "AliMUONVTrackerData.h" -#include "AliMUONTrack.h" -#include "AliMUONTrackParam.h" -#include "AliMUONESDInterface.h" -#include "AliMUONCalibrationData.h" #include "AliMpBusPatch.h" #include "AliMpConstants.h" +#include "AliMpDDL.h" #include "AliMpDDLStore.h" #include "AliMpDEIterator.h" #include "AliMpDEManager.h" #include "AliMpDetElement.h" - -// --- AliRoot header files --- -#include "AliCDBManager.h" -#include "AliESDEvent.h" -#include "AliESDMuonTrack.h" -#include "AliLog.h" +#include "AliMpManuIterator.h" +#include "AliQAv1.h" #include "AliRawReader.h" -#include "AliCodeTimer.h" -#include "AliMUONVDigit.h" - -// --- ROOT system --- +#include "AliRawEventHeaderBase.h" +#include #include #include #include -#include #include +#include #include //----------------------------------------------------------------------------- /// \class AliMUONTrackerQADataMakerRec /// -/// MUON base class for quality assurance data (histo) maker +/// Quality assurance data (histo) maker for MUON tracker +/// +/// +/// Note that all the methods of this class shoud not be called when eventSpecie is AliRecoParam::kCalib ! /// /// \author C. Finck, D. Stocco, L. Aphecetche @@ -69,21 +76,31 @@ ClassImp(AliMUONTrackerQADataMakerRec) /// \endcond -Double_t AliMUONTrackerQADataMakerRec::fgkRawNofGlitchErrors(0.0); -Double_t AliMUONTrackerQADataMakerRec::fgkRawNofTokenLostErrors(1.0); -Double_t AliMUONTrackerQADataMakerRec::fgkRawNofParityErrors(2.0); -Double_t AliMUONTrackerQADataMakerRec::fgkRawNofPaddingErrors(3.0); +namespace +{ + Double_t ProtectedSqrt(Double_t x) + { + return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 ); + } + +} //____________________________________________________________________________ AliMUONTrackerQADataMakerRec::AliMUONTrackerQADataMakerRec(AliQADataMakerRec* master) : AliMUONVQADataMakerRec(master), -fDigitStore(AliMUONVDigitStore::Create("AliMUONDigitStoreV1")), +fDigitStore(0x0), fDigitMaker(new AliMUONDigitMaker(kTRUE)), fClusterStore(0x0), -fTrackerDataMaker(0x0), -fMappingCheckRecPoints(0x0), fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())), -fLogger(0x0) +fLogger(0x0), +fBusPatchConfig(0x0), +fBPxmin(0), +fBPxmax(0), +fBPnbins(0), +fTrackerDataMakerArray(0x0), +fTrackerCalDataArray(0x0), +fTrackerRecDataArray(0x0), +fMappingCheckRecPointsArray(0x0) { /// ctor } @@ -95,9 +112,8 @@ AliMUONTrackerQADataMakerRec::~AliMUONTrackerQADataMakerRec() delete fDigitStore; delete fDigitMaker; delete fClusterStore; - delete fTrackerDataMaker; delete fCalibrationData; - delete fMappingCheckRecPoints; + delete fMappingCheckRecPointsArray; if (fLogger) { if ( fLogger->NumberOfEntries() != 0 ) @@ -106,11 +122,17 @@ AliMUONTrackerQADataMakerRec::~AliMUONTrackerQADataMakerRec() } delete fLogger; } + delete fTrackerDataMakerArray; + delete fTrackerCalDataArray; + delete fTrackerRecDataArray; + delete fBusPatchConfig; } //____________________________________________________________________________ -void AliMUONTrackerQADataMakerRec::InsertTrackerData(Int_t specie, TObjArray** list, - TObject* object, Int_t indexNumber, +void AliMUONTrackerQADataMakerRec::InsertTrackerData(Int_t specie, + TObjArray** list, + TObject* object, + Int_t indexNumber, Bool_t replace) { /// Insert an object to a given list @@ -119,13 +141,17 @@ void AliMUONTrackerQADataMakerRec::InsertTrackerData(Int_t specie, TObjArray** l TObject* o; TObject* old(0x0); Bool_t alreadyThere(kFALSE); + while ( ( o = next() ) && !alreadyThere ) { TString classname(o->ClassName()); if ( classname.Contains("TrackerData") ) { - alreadyThere = kTRUE; - old = o; + if ( !strcmp(object->GetName(),o->GetName()) ) + { + alreadyThere = kTRUE; + old = o; + } } } if ( (!alreadyThere && object) || (alreadyThere && replace) ) @@ -146,6 +172,8 @@ void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleESDs(Int_t, TObjArray**) if (!GetESDsData(AliMUONQAIndices::kESDnClustersPerTrack)) return; + AliCodeTimerAuto("",0); + Double_t nTracks = GetESDsData(AliMUONQAIndices::kESDnClustersPerTrack)->GetEntries(); if (nTracks <= 0) return; @@ -251,13 +279,13 @@ void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleESDs(Int_t, TObjArray**) Double_t meanResX = hESDSumResidualXPerDE->GetBinContent(iDE+1)/nClusters; hESDResidualXPerDEMean->SetBinContent(iDE+1, meanResX); hESDResidualXPerDEMean->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(nClusters)); - hESDResidualXPerDESigma->SetBinContent(iDE+1, TMath::Sqrt(hESDSumResidualX2PerDE->GetBinContent(iDE+1)/nClusters - meanResX*meanResX)); + hESDResidualXPerDESigma->SetBinContent(iDE+1, ProtectedSqrt(hESDSumResidualX2PerDE->GetBinContent(iDE+1)/nClusters - meanResX*meanResX)); hESDResidualXPerDESigma->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(2.*nClusters)); Double_t meanResY = hESDSumResidualYPerDE->GetBinContent(iDE+1)/nClusters; hESDResidualYPerDEMean->SetBinContent(iDE+1, meanResY); hESDResidualYPerDEMean->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(nClusters)); - hESDResidualYPerDESigma->SetBinContent(iDE+1, TMath::Sqrt(hESDSumResidualY2PerDE->GetBinContent(iDE+1)/nClusters - meanResY*meanResY)); + hESDResidualYPerDESigma->SetBinContent(iDE+1, ProtectedSqrt(hESDSumResidualY2PerDE->GetBinContent(iDE+1)/nClusters - meanResY*meanResY)); hESDResidualYPerDESigma->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(2.*nClusters)); hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1)/nClusters); @@ -322,6 +350,8 @@ void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t specie, TOb if (!GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChMean)) return; + AliCodeTimerAuto("",0); + TH1* hTrackerClusterChargePerChMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChMean); TH1* hTrackerClusterChargePerChSigma = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChSigma); TH1* hTrackerClusterMultiplicityPerChMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChMean); @@ -369,50 +399,197 @@ void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t specie, TOb } } - if ( fMappingCheckRecPoints ) InsertTrackerData(specie,list,fMappingCheckRecPoints->CreateData("RecPoints"),AliMUONQAIndices::kTrackerRecPoints,kTRUE); + if ( MappingCheckRecPoints(specie) ) + { + InsertTrackerData(specie,list,MappingCheckRecPoints(specie)->CreateData("RecPoints"),AliMUONQAIndices::kTrackerRecPoints,kTRUE); + } + + if ( TrackerRecData(specie) ) + { + /// put the trackerdata in the pipeline + InsertTrackerData(specie,list,TrackerRecData(specie),AliMUONQAIndices::kTrackerData); + + TH1* hbp = GetRecPointsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); + TH1* hnevents = GetRecPointsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed); + TH1* hddl = GetRecPointsData(AliMUONQAIndices::kTrackerDDLOccupancy); + TH1* hddlevents = GetRecPointsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed); + + if ( !hbp || !hnevents || !hddl || !hddlevents) + { + AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents)); + return; + } + + ProjectTrackerData(TrackerRecData(specie), + *hbp,*hnevents,*hddl,*hddlevents); + } + else + { + AliError(Form("TrackerRecData is null for specie %s",AliRecoParam::GetEventSpecieName(specie))); + } + } +//____________________________________________________________________________ +void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleDigits(Int_t specie, TObjArray** list) +{ + /// create digits histograms in digits subdir + + if ( TrackerCalData(specie) ) + { + AliCodeTimerAuto("",0); + + /// put the trackerdata in the pipeline + InsertTrackerData(specie,list,TrackerCalData(specie),AliMUONQAIndices::kTrackerData); + + TH1* hbp = GetDigitsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); + TH1* hnevents = GetDigitsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed); + TH1* hddl = GetDigitsData(AliMUONQAIndices::kTrackerDDLOccupancy); + TH1* hddlevents = GetDigitsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed); + + if ( !hbp || !hnevents || !hddl || !hddlevents) + { + AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents)); + return; + } + + ProjectTrackerData(TrackerCalData(specie), + *hbp,*hnevents,*hddl,*hddlevents); + } +} + +//____________________________________________________________________________ +AliMUONQADataMakerRec* AliMUONTrackerQADataMakerRec::Master() const +{ + /// Get our master + return static_cast(fMaster); +} + +//____________________________________________________________________________ +void AliMUONTrackerQADataMakerRec::ProjectTrackerData(AliMUONVTrackerData* data, + TH1& hbp, + TH1& hnevents, + TH1& hddl, + TH1& hddlevents) +{ + /// Project tracker data into shifter-friendly histograms + + AliCodeTimerAuto(Form("%s",data->Name()),0); + + /// project the tracerdata into buspatch occupancies (for the experts) + hbp.Reset(); + hbp.SetStats(kFALSE); + + TIter nextBP(AliMpDDLStore::Instance()->CreateBusPatchIterator()); + AliMpBusPatch* bp(0x0); + Int_t occDim = 2; + + while ( ( bp = static_cast(nextBP())) ) + { + Int_t busPatchId = bp->GetId(); + Int_t bin = hbp.FindBin(busPatchId); + if ( data->HasBusPatch(busPatchId) ) + { + hbp.SetBinContent(bin,data->BusPatch(busPatchId,occDim)*100.0); // occupancy, in percent + } + } + + /// log the readout errors (for the shifter) + hnevents.Reset(); + hnevents.SetStats(kFALSE); + hnevents.SetBinContent(1,data->NumberOfEvents(-1)); + + /// project tracker data into DDL occupancies (for the shifter) + hddl.Reset(); + hddl.SetStats(kFALSE); + hddlevents.Reset(); + hddlevents.SetStats(kFALSE); + + const Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK"); + const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK"); + + for ( Int_t iddl = 0; iddl < nddls; ++iddl ) + { + AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(iddl); + + Int_t ddlId = offset + ddl->GetId(); + Int_t npads = 0; + + Int_t nevents = data->NumberOfEvents(iddl); + + hddlevents.Fill(ddlId,nevents); + + Double_t occ(0.0); + + if ( nevents > 0 ) + { + for ( Int_t ide = 0; ide < ddl->GetNofDEs(); ++ide ) + { + Int_t de = ddl->GetDEId(ide); + + npads += TMath::Nint(data->DetectionElement(de,3)); + + occ += data->DetectionElement(de,4); + } + + if ( npads > 0 ) + { + occ = occ/npads/nevents; + } + else + { + occ = 0.0; + } + } + + hddl.Fill(ddlId,100.0*occ); // occ in percent + } + + TPaveText* text = new TPaveText(0.50,0.8,0.9,0.9,"NDC"); + + text->AddText(Form("MCH RUN %d - %d events",AliCDBManager::Instance()->GetRun(),data->NumberOfEvents(-1))); + + hddl.GetListOfFunctions()->Add(text); +} //____________________________________________________________________________ void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRaws(Int_t specie, TObjArray** list) { /// create Raws histograms in Raws subdir - if ( !GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy) ) return; - - if ( fTrackerDataMaker ) + if ( TrackerDataMaker(specie) && TrackerDataMaker(specie)->Data() ) { - InsertTrackerData(specie,list,fTrackerDataMaker->Data(),AliMUONQAIndices::kTrackerData); - - TH1* hbp = GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); - hbp->Reset(); - TIter nextBP(AliMpDDLStore::Instance()->CreateBusPatchIterator()); - AliMpBusPatch* bp(0x0); - AliMUONVTrackerData* data = fTrackerDataMaker->Data(); - Int_t occDim = 2; + AliCodeTimerAuto("",0); + + /// put the trackerdata in the pipeline + InsertTrackerData(specie,list,TrackerDataMaker(specie)->Data(),AliMUONQAIndices::kTrackerData); + TrackerDataMaker(specie)->SetOwnerOfData(kFALSE); // now that it's attached to list, list will take care of the deletion - while ( ( bp = static_cast(nextBP())) ) + TH1* hbp = GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); + TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed); + TH1* hddl = GetRawsData(AliMUONQAIndices::kTrackerDDLOccupancy); + TH1* hddlevents = GetRawsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed); + + if ( !hbp || !hnevents || !hddl || !hddlevents) { - Int_t busPatchId = bp->GetId(); - Int_t bin = hbp->FindBin(busPatchId); - hbp->SetBinContent(bin,data->BusPatch(busPatchId,occDim)*100.0); // occupancy, in percent + AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents)); + return; } - TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofRawEventSeen); - hnevents->Reset(); - hnevents->Fill(0.0,fTrackerDataMaker->Data()->NumberOfEvents(-1)); + ProjectTrackerData(TrackerDataMaker(specie)->Data(), + *hbp,*hnevents,*hddl,*hddlevents); if ( fLogger->NumberOfEntries() > 0 ) { // readout errors - FillErrors(*fLogger); + FillReadoutStatus(*fLogger,TrackerDataMaker(specie)->Data()); fLogger->Clear(); } - } + } } //____________________________________________________________________________ -void AliMUONTrackerQADataMakerRec::FillErrors(AliMUONLogger& log) +void AliMUONTrackerQADataMakerRec::FillReadoutStatus(AliMUONLogger& log, AliMUONVTrackerData* data) { log.ResetItr(); @@ -425,9 +602,9 @@ void AliMUONTrackerQADataMakerRec::FillErrors(AliMUONLogger& log) TH1* hpadding = GetRawsData(AliMUONQAIndices::kTrackerBusPatchPaddingErrors); - TH1* hroe = GetRawsData(AliMUONQAIndices::kTrackerReadoutErrors); + TH1* hrostatus = GetRawsData(AliMUONQAIndices::kTrackerReadoutStatus); - TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofRawEventSeen); + TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofPhysicsEventsSeen); Int_t nevents = TMath::Nint(hnevents->GetBinContent(1)); @@ -436,25 +613,58 @@ void AliMUONTrackerQADataMakerRec::FillErrors(AliMUONLogger& log) TPaveText* text = new TPaveText(0,0,0.99,0.99,"NDC"); text->AddText("FATAL : 0 event seen ? That's NOT normal..."); text->SetFillColor(2); // red = FATAL - hroe->GetListOfFunctions()->Add(text); + hrostatus->GetListOfFunctions()->Add(text); return; } + ///////////////////////////////////////////////////////////////// + /// Start by counting the number of errors + ///////////////////////////////////////////////////////////////// + while ( log.Next(msg,occurence) ) { AliDebug(1,Form("msg=%s occurence=%d",msg.Data(),occurence)); if ( msg.Contains("token") ) { - Int_t dsp(-1),ddl(-1),ecode(-1); + Int_t dsp(-1),iddl(-1),ecode(-1); - sscanf(msg.Data(),"Lost token error detected in DSP 0x%X of DDL %d and code %d.", - &dsp,&ddl,&ecode); + sscanf(msg.Data(),"Lost token error detected with address 0x%X of DDL %d and code %d.", + &dsp,&iddl,&ecode); Int_t localBP = ((dsp >> 16)- 4)*5 + 1; - Int_t buspatch = localBP + ddl*100; - htoken->Fill(buspatch,occurence); - hroe->Fill(fgkRawNofTokenLostErrors,occurence); - AliDebug(1,Form("DDL %d DSP %d busPatch %d",ddl,dsp,buspatch)); + Int_t buspatch = localBP + iddl*100; + + // Let's try to get all the suspected bus patches (i.e. one full FRT, as currently + // we don't have more precise information to locate the faulty bus patch(es)). + + AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(buspatch,kFALSE); + if (bp) + { + Int_t frt = bp->GetFrtId(); + AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(bp->GetDdlId()); + Int_t* b = new Int_t[ddl->GetMaxDsp()]; + ddl->GetBusPerDsp(b); + Int_t nbus(0); + for ( Int_t i = 0; i < ddl->GetNofFrts() && !nbus; ++i ) + { + if ( ddl->GetFrtId(i) == frt ) + { + nbus = b[i]; + } + } + if (nbus<=0) + { + AliError("GOT NBUS<=0 ! THAT IS BAD ! CHECK !"); + nbus=1; + } + delete[] b; + + while (nbus) { + htoken->Fill(buspatch+nbus-1,occurence); + --nbus; + } + } + hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofTokenLostErrors,occurence); } if ( msg.Contains("Parity") ) @@ -462,12 +672,12 @@ void AliMUONTrackerQADataMakerRec::FillErrors(AliMUONLogger& log) Int_t buspatch; sscanf(msg.Data(),"Parity error in buspatch %d (0x%X).",&buspatch,&buspatch); hparity->Fill(buspatch,occurence); - hroe->Fill(fgkRawNofParityErrors,occurence); + hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofParityErrors,occurence); } if ( msg.Contains("Glitch") ) { - hroe->Fill(fgkRawNofGlitchErrors,occurence); + hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofGlitchErrors,occurence); } if ( msg.Contains("Padding") ) @@ -475,151 +685,296 @@ void AliMUONTrackerQADataMakerRec::FillErrors(AliMUONLogger& log) Int_t block, dsp, buspatch; sscanf(msg.Data(),"Padding word error for iBlock %d, iDsp %d, iBus %d.",&block,&dsp,&buspatch); hpadding->Fill(buspatch,occurence); - hroe->Fill(fgkRawNofPaddingErrors,occurence); + hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofPaddingErrors,occurence); } } - /// Finally we normalize to the number of events, for the shifter plot only - hroe->Scale(100.0/nevents); + ///////////////////////////////////////////////////////////////// + /// + /// Then make the status about number of missing bus patches + /// + ///////////////////////////////////////////////////////////////// + + Int_t nofBusPatchesNotInConfig(0); + + for ( int i = 1; i <= fBusPatchConfig->GetNbinsX(); ++i ) + { + Double_t buspatchId = fBusPatchConfig->GetBinCenter(i); + if ( TMath::Nint(buspatchId) != i ) + { + AliError(Form("buspathId=%e i=%d",buspatchId,i)); + } + Double_t content = fBusPatchConfig->GetBinContent(i); + + if ( content <= 0. /* no content */ + && + AliMpDDLStore::Instance()->GetBusPatch(i,kFALSE) /* but a valid bus patch */ ) + { + ++nofBusPatchesNotInConfig; + } + } + + Double_t nbuspatches = fBusPatchConfig->GetEntries(); + + Int_t bin = hrostatus->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromConfig); + hrostatus->SetBinContent(bin,nofBusPatchesNotInConfig*nevents/nbuspatches); + + Double_t nofBusPatchesNotInData(0); + + TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator()); + AliMpBusPatch* bp; + + while ( ( bp = static_cast(next()) ) ) + { + if ( !data->HasBusPatch(bp->GetId()) ) ++nofBusPatchesNotInData; + } + + bin = hrostatus->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromDataStream); + hrostatus->SetBinContent(bin,nofBusPatchesNotInData*nevents/nbuspatches); } +//____________________________________________________________________________ +void AliMUONTrackerQADataMakerRec::FillEventSize(AliRawReader* rawReader) +{ + /// Fill event size histogram(s) + + TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofPhysicsEventsSeen); + + TH1* hddlevents = GetRawsData(AliMUONQAIndices::kTrackerDDLNofEventsSeen); + + TH1* hDDLEventSize = GetRawsData(AliMUONQAIndices::kTrackerDDLEventSize); + + hnevents->Fill(0.0); + + Int_t offset = AliDAQ::DdlIDOffset("MUONTRK"); + + for ( int i = 0; i < AliDAQ::NumberOfDdls("MUONTRK"); ++i ) + { + rawReader->Reset(); + rawReader->Select("MUONTRK",i,i); + if (rawReader->ReadHeader() ) + { + UInt_t ddlsize = rawReader->GetEquipmentSize(); + hDDLEventSize->Fill(i+offset,ddlsize); + hddlevents->Fill(i+offset); + } + } + rawReader->Reset(); +} //____________________________________________________________________________ -void AliMUONTrackerQADataMakerRec::InitRaws() +void AliMUONTrackerQADataMakerRec::InitCommon() +{ + if (!fBusPatchConfig) + { + Int_t bpmin(999999); + Int_t bpmax(0); + + TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator()); + AliMpBusPatch* bp(0x0); + while ( ( bp = static_cast(next())) ) + { + bpmin = TMath::Min(bpmin,bp->GetId()); + bpmax = TMath::Max(bpmax,bp->GetId()); + } + + fBPxmin = bpmin-0.5; + fBPxmax = bpmax+0.5; + fBPnbins = TMath::Nint(fBPxmax-fBPxmin); + + AliMUONVStore* config = fCalibrationData->Config(); + + if (config) + { + fBusPatchConfig = new TH1F("hTrackerBusPatchConfig","Configuration of bus patches",fBPnbins,fBPxmin,fBPxmax); + fBusPatchConfig->SetDirectory(0); + } + else + { + AliWarning("Tracker configuration not found. Will not be able to cut on low occupancies"); + } + + next.Reset(); + while ( ( bp = static_cast(next())) ) + { + if ( config ) + { + Int_t nofManusInConfig(0); + + for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu ) + { + Int_t manuId = bp->GetManuId(imanu); + if ( config->FindObject(bp->GetDEId(),manuId)) ++nofManusInConfig; + } + + if ( nofManusInConfig > 0 ) + { + fBusPatchConfig->Fill(bp->GetId(),1.0); + } + else + { + fBusPatchConfig->Fill(bp->GetId(),0.0); + } + } + else // no config, we assume all is there... + { + fBusPatchConfig->Fill(bp->GetId()); + } + } + } +} + +//____________________________________________________________________________ +void AliMUONTrackerQADataMakerRec::BookHistograms(AliQAv1::TASKINDEX_t task) { - /// create Raws histograms in Raws subdir - AliCodeTimerAuto("",0); + + InitCommon(); const Bool_t expert = kTRUE ; const Bool_t saveCorr = kTRUE ; const Bool_t image = kTRUE ; - - Int_t bpmin(999999); - Int_t bpmax(0); - TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator()); - AliMpBusPatch* bp(0x0); - while ( ( bp = static_cast(next())) ) + TH1* hbp = new TH1F("hTrackerBusPatchOccupancy","Occupancy of bus patches",fBPnbins,fBPxmin,fBPxmax); + + Master()->Add2List(hbp,AliMUONQAIndices::kTrackerBusPatchOccupancy, task, expert, !image, !saveCorr); + + TH1* h = new TH1F("hTrackerBusPatchParityErrors","Number of parity errors per bus patch",fBPnbins,fBPxmin,fBPxmax); + + Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchParityErrors,task,expert,!image,!saveCorr); + + h = new TH1F("hTrackerBusPatchTokenLostErrors","Number of token lost errors per bus patch",fBPnbins,fBPxmin,fBPxmax); + Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchTokenLostErrors,task,expert,!image,!saveCorr); + + h = new TH1F("hTrackerBusPatchPaddingErrors","Number of padding errors per bus patch",fBPnbins,fBPxmin,fBPxmax); + + Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchPaddingErrors,task,expert,!image,!saveCorr); + + + TH1* hnevents(0x0); + + if ( task == AliQAv1::kRAWS ) { - bpmin = TMath::Min(bpmin,bp->GetId()); - bpmax = TMath::Max(bpmax,bp->GetId()); + // for raw data, we differentiate events seen from events used to be able to detect + // severe decoder errors that lead to no event decoded (i.e. zero event used) even if + // events are there (i.e non-zero event seen). + hnevents = new TH1F("hTrackerNofPhysicsEventsSeen","Number of physics events seen",1,-0.5,0.5); + // this one will count the number of physics event the rawdatamaker is *seeing* + TAxis* a = hnevents->GetXaxis(); + a->SetBinLabel(1,"NPhysicsEvents"); + hnevents->SetStats(kFALSE); + Master()->Add2List(hnevents,AliMUONQAIndices::kTrackerNofPhysicsEventsSeen,task,expert,!image,!saveCorr); } - Double_t xmin = bpmin-0.5; - Double_t xmax = bpmax+0.5; - Int_t nbins = bpmax-bpmin+1; - - TH1* hbp = new TH1F("hTrackerBusPatchOccupancy","Occupancy of bus patches",nbins,xmin,xmax); - - TH1* hbpnpads = new TH1F("hTrackerBusPatchNofPads","Number of pads per bus patch",nbins,xmin,xmax); - - TH1* hbpnmanus = new TH1F("hTrackerBusPatchNofManus","Number of manus per bus patch",nbins,xmin,xmax); + hnevents = new TH1F("hTrackerNofGoodPhysicsEventsUsed","Number of good physics events used",1,-0.5,0.5); + // this one will get its content from the TrackerData, i.e. it will count the number of *good* physics events *used* + // (i.e. not empty and with no fatal readout error) + TAxis* a = hnevents->GetXaxis(); + a->SetBinLabel(1,"NGoodPhysicsEvents"); + hnevents->SetStats(kFALSE); - Add2RawsList(hbp,AliMUONQAIndices::kTrackerBusPatchOccupancy, !expert, image, !saveCorr); - Add2RawsList(hbpnpads,AliMUONQAIndices::kTrackerBusPatchNofPads, expert, !image, !saveCorr); - Add2RawsList(hbpnmanus,AliMUONQAIndices::kTrackerBusPatchNofManus, expert, !image, !saveCorr); + Master()->Add2List(hnevents,AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed,task,expert,!image,!saveCorr); - Add2RawsList(new TH1F("hTrackerBusPatchParityErrors","Number of parity errors per bus patch",nbins,xmin,xmax), - AliMUONQAIndices::kTrackerBusPatchParityErrors,expert,!image,!saveCorr); + Master()->Add2List(static_cast(fBusPatchConfig->Clone()),AliMUONQAIndices::kTrackerBusPatchConfig, task,expert, !image, !saveCorr); - Add2RawsList(new TH1F("hTrackerBusPatchTokenLostErrors","Number of token lost errors per bus patch",nbins,xmin,xmax), - AliMUONQAIndices::kTrackerBusPatchTokenLostErrors,expert,!image,!saveCorr); + Int_t nbins = AliDAQ::NumberOfDdls("MUONTRK"); + const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK"); + + Double_t xmin = offset - 0.5; + Double_t xmax = offset + nbins - 0.5; + + TString what(AliQAv1::GetTaskName(task)); + + h = new TH1F(Form("hTrackerDDL%sOccupancy",what.Data()),Form(";DDLId;DDL Occupancy in %% (from %s)",what.Data()),nbins,xmin,xmax); + + Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLOccupancy,task,expert,!image,!saveCorr); - Add2RawsList(new TH1F("hTrackerBusPatchPaddingErrors","Number of padding errors per bus patch",nbins,xmin,xmax), - AliMUONQAIndices::kTrackerBusPatchPaddingErrors,expert,!image,!saveCorr); + if ( task == AliQAv1::kRAWS ) + { + // see above the comment about why we have event seen vs used for raw data. + h = new TH1F("hTrackerDDLNofEventsSeen","Number of events seen by DDL;DDLId",nbins,xmin,xmax); + Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLNofEventsSeen,task,expert,!image,!saveCorr); + } + + h = new TH1F("hTrackerDDLNofEventsUsed","Number of events used by DDL;DDLId",nbins,xmin,xmax); + Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLNofEventsUsed,task,expert,!image,!saveCorr); + +} - TH1* h = new TH1F("hTrackerReadoutErrors","Number of readout errors per event;;Error rate in %",4,-0.5,3.5); +//____________________________________________________________________________ +void AliMUONTrackerQADataMakerRec::InitRaws() +{ + /// create monitor objects for RAWS + + TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE); + + /// Book histograms that are common to Raws and Digits + BookHistograms(AliQAv1::kRAWS); + + /// Now the Raws specific parts + TH1* h = new TH1F("hTrackerReadoutStatus","Readout status (x events)",7,-0.5,6.5); h->SetStats(kFALSE); - // The QA shifter will only see the summary plot below TAxis* a = h->GetXaxis(); - a->SetBinLabel(h->FindBin(fgkRawNofGlitchErrors),"Glitch errors"); - a->SetBinLabel(h->FindBin(fgkRawNofTokenLostErrors),"Token lost errors"); - a->SetBinLabel(h->FindBin(fgkRawNofParityErrors),"Parity errors"); - a->SetBinLabel(h->FindBin(fgkRawNofPaddingErrors),"Padding errors"); - - Add2RawsList(h,AliMUONQAIndices::kTrackerReadoutErrors,!expert,image,!saveCorr); - - TH1* hnevents = new TH1F("hTrackerNofRawEventSeen","Number of events seen",1,-0.5,0.5); - a = hnevents->GetXaxis(); - a->SetBinLabel(1,"Nevents"); - hnevents->SetStats(kFALSE); + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofGlitchErrors),"Glitch errors"); + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofTokenLostErrors),"Token lost errors"); + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofParityErrors),"Parity errors"); + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofPaddingErrors),"Padding errors"); - Add2RawsList(hnevents,AliMUONQAIndices::kTrackerNofRawEventSeen,expert,!image,!saveCorr); - - const Bool_t histogram(kFALSE); - - if(!fTrackerDataMaker) - { - - AliMUONTrackerDataMaker* dm = new AliMUONTrackerDataMaker(GetRecoParam(), - AliCDBManager::Instance()->GetRun(), - 0x0, - "", - "NOGAIN", - histogram, - 0.0,0.0); - - fLogger = new AliMUONLogger(-1); - dm->EnableErrorLogger(fLogger); - fTrackerDataMaker = dm; - } + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofEmptyEvents),"Empty events"); - fTrackerDataMaker->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromConfig),"Not readout bus patches"); + a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromDataStream),"Missing bus patches"); - fTrackerDataMaker->SetRunning(kTRUE); + TH1* h1 = static_cast(h->Clone("hTrackerReadoutStatusPerEvent")); + h1->SetTitle("Readout status per event"); + h1->GetYaxis()->SetTitle("Percentage"); - next.Reset(); + // The QA shifter will only see the summary plot below - AliMUONVStore* config = fCalibrationData->Config(); + Add2RawsList(h,AliMUONQAIndices::kTrackerReadoutStatus,kTRUE,kFALSE,kFALSE); + Add2RawsList(h1,AliMUONQAIndices::kTrackerReadoutStatusPerEvent,kFALSE,kTRUE,kFALSE); - TH1* hbpconfig(0x0); + // Lastly the event size histograms - if (config) - { - hbpconfig = new TH1F("hTrackerBusPatchConfig","Configuration of bus patches",nbins,xmin,xmax); - Add2RawsList(hbpconfig,AliMUONQAIndices::kTrackerBusPatchConfig, expert, !image, !saveCorr); - } - else - { - AliWarning("Tracker configuration not found. Will not be able to cut on low occupancies"); - } + Int_t nbins = AliDAQ::NumberOfDdls("MUONTRK"); + const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK"); - while ( ( bp = static_cast(next())) ) - { - Int_t n(0); - Bool_t inConfig(kTRUE); + Double_t xmin = offset - 0.5; + Double_t xmax = offset + nbins - 0.5; + + h = new TH1F("hTrackerDDLEventSize","DDL event size (bytes);DDL Id;Data size (bytes)",nbins,xmin,xmax); + h->SetStats(kFALSE); + Add2RawsList(h,AliMUONQAIndices::kTrackerDDLEventSize,kTRUE,kFALSE,kFALSE); + + h = new TH1F("hTrackerDDLMeanEventSize","DDL mean event size (KB) per event;DDL Id;Mean Event size (KB)",nbins,xmin,xmax); + h->SetStats(kFALSE); + Add2RawsList(h,AliMUONQAIndices::kTrackerDDLEventSizePerEvent,kFALSE,kTRUE,kFALSE); - for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu ) - { - Int_t manuId = bp->GetManuId(imanu); - AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(bp->GetDEId()); - n += de->NofChannelsInManu(manuId); - if ( config && !config->FindObject(de->GetId(),manuId)) inConfig=kFALSE; - } - hbpnpads->Fill(bp->GetId(),n*1.0); - hbpnmanus->Fill(bp->GetId(),bp->GetNofManus()*1.0); - if ( hbpconfig && inConfig ) - { - hbpconfig->Fill(bp->GetId()); - } - } + Add2RawsList(new TH1F("hTrackerIsThere","tracker is there",1,0,1),AliMUONQAIndices::kTrackerIsThere,kTRUE,kFALSE,kFALSE); } //__________________________________________________________________ void AliMUONTrackerQADataMakerRec::InitDigits() { - /// Initialized Digits spectra - const Bool_t expert = kTRUE ; - const Bool_t image = kTRUE ; + /// create monitor objects for DIGITS - TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 1400, 100, 1500); - Add2DigitsList(h0, 0, !expert, image); + AliCodeTimerAuto("",0); + + if ( GetRecoParam()->TryRecover() ) + { + fDigitMaker->SetTryRecover(kTRUE); + } + else + { + fDigitMaker->SetTryRecover(kFALSE); + } + + TrackerCalData(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE); - TH1I* h1 = new TH1I("hDigitsADC", "ADC distribution in Digits;ACD value;Counts", 4096, 0, 4095); - Add2DigitsList(h1, 1, !expert, image); + /// Book histograms that are common to Raws and Digits + BookHistograms(AliQAv1::kDIGITSR); } //____________________________________________________________________________ @@ -631,6 +986,10 @@ void AliMUONTrackerQADataMakerRec::InitRecPoints() const Bool_t image = kTRUE ; AliCodeTimerAuto("",0); + + TrackerRecData(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE); + + BookHistograms(AliQAv1::kRECPOINTS); TH1I *h1I; TH1F *h1F; @@ -717,7 +1076,7 @@ void AliMUONTrackerQADataMakerRec::InitRecPoints() h1F->SetMarkerColor(kRed); Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerDEMean, !expert, image); - if (!fMappingCheckRecPoints) fMappingCheckRecPoints = new AliMUONQAMappingCheck(RunNumber()); + MappingCheckRecPoints(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE); } //____________________________________________________________________________ @@ -958,27 +1317,41 @@ void AliMUONTrackerQADataMakerRec::MakeRaws(AliRawReader* rawReader) { /// make QA for rawdata tracker - AliCodeTimerAuto("",0); + AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0); /// forces init GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); - ((AliMUONTrackerDataMaker*)fTrackerDataMaker)->SetRawReader(rawReader); + AliMUONTrackerDataMaker* dm = static_cast(TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()))); + + dm->SetRawReader(rawReader); - fTrackerDataMaker->ProcessEvent(); - + Int_t eventType = rawReader->GetType(); + if (eventType == AliRawEventHeaderBase::kPhysicsEvent ) + { + dm->ProcessEvent(); + + FillEventSize(rawReader); + + if ( dm->LastEventWasEmpty() ) + { + TH1* hrostatus = GetRawsData(AliMUONQAIndices::kTrackerReadoutStatus); + + if (hrostatus) hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofEmptyEvents); + } + } } //__________________________________________________________________ void AliMUONTrackerQADataMakerRec::MakeDigits(TTree* digitsTree) { /// makes data from Digits - - AliCodeTimerAuto("",0); + AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0); - // Do nothing in case of calibration event - if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return; + /// forces init + + GetDigitsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create(*digitsTree); @@ -989,14 +1362,33 @@ void AliMUONTrackerQADataMakerRec::MakeDigits(TTree* digitsTree) AliMUONVDigit* dig = 0x0; + AliMUON2DMap oneEventData(true); + while ( ( dig = static_cast(next()) ) ) + { + if ( dig->IsTracker() ) { - GetDigitsData(0)->Fill(dig->DetElemId()); - GetDigitsData(1)->Fill(dig->ADC()); + if ( dig->Charge() > 0.0 ) + { + + Int_t detElemId = dig->DetElemId(); + Int_t manuId = dig->ManuId(); + + AliMUONVCalibParam* param = static_cast(oneEventData.FindObject(detElemId,manuId)); + if (!param) + { + param = new AliMUONCalibParamND(1,AliMpConstants::ManuNofChannels(),detElemId,manuId, + AliMUONVCalibParam::InvalidFloatValue()); + oneEventData.Add(param); + } + param->SetValueAsDouble(dig->ManuChannel(),0,dig->Charge()); + } } + } + + TrackerCalData(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Add(oneEventData); } - //____________________________________________________________________________ void AliMUONTrackerQADataMakerRec::MakeRecPoints(TTree* clustersTree) { @@ -1009,10 +1401,9 @@ void AliMUONTrackerQADataMakerRec::MakeRecPoints(TTree* clustersTree) // then we have clusters in TreeR, so let's take that opportunity // to QA them... - AliCodeTimerAuto("",0); - - // Do nothing in case of calibration event - if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return; + AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0); + // Forces init by requesting an histogram + GetRecPointsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); if (!fClusterStore) { @@ -1030,7 +1421,11 @@ void AliMUONTrackerQADataMakerRec::MakeRecPoints(TTree* clustersTree) TIter next(fClusterStore->CreateIterator()); AliMUONVCluster* cluster; - if ( fMappingCheckRecPoints ) fMappingCheckRecPoints->NewEvent(); + AliMUONQAMappingCheck* mcr = MappingCheckRecPoints(AliRecoParam::AConvert(Master()->GetEventSpecie())); + + if ( mcr ) mcr->NewEvent(); + + AliMUON2DMap oneEventData(true); while ( ( cluster = static_cast(next()) ) ) { @@ -1044,12 +1439,29 @@ void AliMUONTrackerQADataMakerRec::MakeRecPoints(TTree* clustersTree) GetRecPointsData(AliMUONQAIndices::kTrackerNumberOfClustersPerChamber)->Fill(chamberId); GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChamber+chamberId)->Fill(cluster->GetCharge()); GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+chamberId)->Fill(cluster->GetNDigits()); - GetRecPointsData(AliMUONQAIndices::kTrackerClusterHitMapPerChamber+chamberId)->Fill(cluster->GetX(),cluster->GetY()); + GetRecPointsData(AliMUONQAIndices::kTrackerClusterHitMapPerChamber+chamberId)->Fill(cluster->GetX(),cluster->GetY()); - if ( fMappingCheckRecPoints ) fMappingCheckRecPoints->Store(*cluster); + if ( mcr ) mcr->Store(*cluster); + for ( int i = 0; i < cluster->GetNDigits(); ++i ) + { + UInt_t digitId = cluster->GetDigitId(i); + + Int_t manuId = AliMUONVDigit::ManuId(digitId); + Int_t manuChannel = AliMUONVDigit::ManuChannel(digitId); + + AliMUONVCalibParam* param = static_cast(oneEventData.FindObject(detElemId,manuId)); + if (!param) + { + param = new AliMUONCalibParamND(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,AliMUONVCalibParam::InvalidFloatValue()); + oneEventData.Add(param); + } + param->SetValueAsDouble(manuChannel,0,1.0); + } } + TrackerRecData(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Add(oneEventData); + fClusterStore->Clear(); } @@ -1058,11 +1470,8 @@ void AliMUONTrackerQADataMakerRec::MakeESDs(AliESDEvent* esd) { /// make QA data from ESDs - AliCodeTimerAuto("",0); - - // Do nothing in case of calibration event - if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return; - + AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0); + // load ESD event in the interface AliMUONESDInterface esdInterface; if (GetRecoParam()) AliMUONESDInterface::ResetTracker(GetRecoParam(), kFALSE); @@ -1151,8 +1560,180 @@ void AliMUONTrackerQADataMakerRec::MakeESDs(AliESDEvent* esd) //____________________________________________________________________________ AliMUONVTrackerData* AliMUONTrackerQADataMakerRec::GetTrackerData() const { -/// Return tracker data + /// Return tracker data + + return TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Data(); +} + +//____________________________________________________________________________ +void +AliMUONTrackerQADataMakerRec::ResetDetectorRaws(TObjArray* list) +{ + /// Reset those histograms that must be reset (and only those), plus + /// the trackerdata itself. + + TIter next(list); + TObject* o; + while ( ( o = next() ) ) + { + TH1* h = dynamic_cast(o); + if (h) + { + TString hn(h->GetName()); + + if ( !hn.Contains("TrackerBusPatchConfig") ) + { + AliDebug(1,Form("Resetting %s",hn.Data())); + + h->Reset(); + } + else + { + AliDebug(1,Form("Will not reset histogram %s",hn.Data())); + } + } + else + { + AliMUONVTrackerData* d = dynamic_cast(o); + if (d) + { + AliDebug(1,Form("Resetting %s",d->GetName())); + d->Clear(); + } + else + { + AliError(Form("Found an object of class %s. Do not know how to reset.",o->ClassName())); + } + } + } +} + +//____________________________________________________________________________ +TObjArray* AliMUONTrackerQADataMakerRec::GetArray(TObjArray*& array, Bool_t create) +{ + /// Get (or create) the array + + if ( ! array ) + { + if ( create ) + { + array = new TObjArray(AliRecoParam::kNSpecies); + } + } + + return array; +} + +//____________________________________________________________________________ +AliMUONVTrackerDataMaker* +AliMUONTrackerQADataMakerRec::TrackerDataMaker(Int_t specieIndex) const +{ + /// const version of the getter + if ( fTrackerDataMakerArray ) + { + return static_cast(fTrackerDataMakerArray->At(specieIndex)); + } + return 0x0; +} + +//____________________________________________________________________________ +AliMUONVTrackerDataMaker* +AliMUONTrackerQADataMakerRec::TrackerDataMaker(Int_t specieIndex, Bool_t create) +{ + /// Get (or create) TrackerDataMaker object for a given specie - return fTrackerDataMaker->Data(); + TObjArray* array = GetArray(fTrackerDataMakerArray,create); + TObject* o(0x0); + + if ( array ) + { + array->SetOwner(kTRUE); + o = array->At(specieIndex); + if (!o && create) + { + + AliMUONTrackerDataMaker* dm = new AliMUONTrackerDataMaker(0x0, + AliCDBManager::Instance()->GetRun(), + 0x0, + "", + "", + kFALSE, + 0.0,0.0); + + if (!fLogger) fLogger = new AliMUONLogger(-1); // note that we share the logger between species... should not be a big deal though + dm->EnableErrorLogger(fLogger); + dm->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level + dm->Data()->SetName("RawCharges"); + dm->SetRunning(kTRUE); + + o = dm; + array->AddAt(o,specieIndex); + } + } + return static_cast(o); +} + +//____________________________________________________________________________ +AliMUONVTrackerData* +AliMUONTrackerQADataMakerRec::TrackerCalData(Int_t specieIndex, Bool_t create) +{ + TObjArray* array = GetArray(fTrackerCalDataArray,create); + TObject* o(0x0); + if (array) + { + o = array->At(specieIndex); + if (!o && create) + { + AliMUONTrackerData* data = new AliMUONTrackerData("CalCharges",Form("Calibrated charges (fC) %s",GetRecoParam()->GetCalibrationMode()),1); + data->SetDimensionName(0,"charge"); + data->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level + o=data; + array->AddAt(o,specieIndex); + } + } + return static_cast(o); +} + +//____________________________________________________________________________ +AliMUONVTrackerData* +AliMUONTrackerQADataMakerRec::TrackerRecData(Int_t specieIndex, Bool_t create) +{ + TObjArray* array = GetArray(fTrackerRecDataArray,create); + TObject* o(0x0); + + if (array) + { + o = array->At(specieIndex); + if (!o && create) + { + AliMUONTrackerData* data = new AliMUONTrackerData("RecCharges",Form("Calibrated charges (fC) %s for digits belonging to a reconstructed cluster",GetRecoParam()->GetCalibrationMode()),1); + data->SetDimensionName(0,"one"); + data->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level + o=data; + array->AddAt(o,specieIndex); + } + } + return static_cast(o); +} + +//____________________________________________________________________________ +AliMUONQAMappingCheck* +AliMUONTrackerQADataMakerRec::MappingCheckRecPoints(Int_t specieIndex, Bool_t create) +{ + TObjArray* array = GetArray(fMappingCheckRecPointsArray,create); + TObject* o(0x0); + + if (array) + { + o = array->At(specieIndex); + array->SetOwner(kTRUE); + if (!o && create) + { + AliMUONQAMappingCheck* mcheck = new AliMUONQAMappingCheck(RunNumber()); + o=mcheck; + array->AddAt(o,specieIndex); + } + } + return static_cast(o); }