X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=TPC%2FAliTPCQADataMakerRec.cxx;h=dc9d8c282a51bbf78c6c1976c7b36e6006c23980;hp=c23a9ad282ccbb9671c498d38fe0d8909801ad1a;hb=0a8abcad68b30cf11bb0c83a3a42cfb293f5480d;hpb=44ed7a669ab9cf51d3f37f1f6736443b71c54926 diff --git a/TPC/AliTPCQADataMakerRec.cxx b/TPC/AliTPCQADataMakerRec.cxx index c23a9ad282c..dc9d8c282a5 100644 --- a/TPC/AliTPCQADataMakerRec.cxx +++ b/TPC/AliTPCQADataMakerRec.cxx @@ -21,28 +21,53 @@ Produces the data needed to calculate the quality assurance. All data must be mergeable objects. P. Christiansen, Lund, January 2008 -*/ -/* - Implementation: + Updated July 2011: + ================== + + Major changes to accomodate updates of general DQM/QA changes to have per + trigger histograms (for a given event specie). + + 1) One instance of AliTPCdataQA only. (This also solves some old wishes by + offline team to use less memory because event the 2d arrays for this object + is not used). This now has a new flag for only keeping DQM info event by + event! For this reason there is no need for a special DQM reset any more + between runs! + + 2) Fill the histogram for each event. The histograms are no longer filled + from the AliTPCdataQA but per event. + + 3) Use profiles for the RAW info. By adding the profiles event by event we + get the correct event averages WITHOUT having to normalize in the end! + Results should therefore also be directly mergable when that feature will + come. (none of the other histograms are merged). + + This means that from the DQM/QA point of view the TPC DQM is now fully + standard and should ease future developments. + + Updated June 2010: + ================== + + The "beautification" of the online DQM histograms have been moved to + an amore macro. - We have chosen to have the histograms as non-persistent meber to - allow better debugging. In the copy constructor we then have to - assign the pointers to the existing histograms in the copied - list. This have been implemented but not tested. + The per event RAW histograms have been modified in AliTPCdataQA and + the copies have therefore also been modified here. + + The AliTPCdataQA can now be configured a bit from here: time bin + range (extended default range to 1-1000, event range at start: + 0-100000, 1000 events per bin). (At least the parameters are not + hardcoded:-) + + Implementation: + =============== For the QA of the RAW data we use the class, AliTPCdataQA, from the existing TPC Calibration framework (which is more advanced than the - standard QA framework) and extract the histograms at the end. This - has been tested with zero-suppressed data. The Analyse method of the - AliTPCdataQA class is called in the method, EndOfDetectorCycle, and - there also: 1d histogram(s) are projected and added to the QA list. -*/ - -/* - TODO: - Sumw2 for RAW histogram(s)? - RecPoints and ESD could have many more histograms + standard QA framework) and extract the histograms at the end. The + Analyse method of the AliTPCdataQA class is called in the method, + EndOfDetectorCycle, and there also: 1d histogram(s) are projected + and added to the QA list. */ #include "AliTPCQADataMakerRec.h" @@ -51,6 +76,9 @@ #include #include #include +#include +#include +#include // --- Standard library --- @@ -65,18 +93,18 @@ #include "AliTPCclusterMI.h" #include "AliSimDigits.h" + ClassImp(AliTPCQADataMakerRec) //____________________________________________________________________________ AliTPCQADataMakerRec::AliTPCQADataMakerRec() : - AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC), - "TPC Rec Quality Assurance Data Maker"), - fTPCdataQA(NULL) +AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC), + "TPC Rec Quality Assurance Data Maker"), +fTPCdataQA(NULL), +fRawFirstTimeBin(1), +fRawLastTimeBin(1000) { // ctor - fTPCdataQA = new AliTPCdataQA*[AliRecoParam::kNSpecies] ; - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) - fTPCdataQA[specie] = NULL ; for(Int_t i = 0; i < 6; i++) fMapping[i] = 0; @@ -85,7 +113,9 @@ AliTPCQADataMakerRec::AliTPCQADataMakerRec() : //____________________________________________________________________________ AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) : AliQADataMakerRec(), - fTPCdataQA(NULL) + fTPCdataQA(NULL), + fRawFirstTimeBin(qadm.GetRawFirstTimeBin()), + fRawLastTimeBin(qadm.GetRawLastTimeBin()) { //copy ctor // Does not copy the calibration object, instead InitRaws have to be @@ -93,18 +123,8 @@ AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) : SetName((const char*)qadm.GetName()) ; SetTitle((const char*)qadm.GetTitle()); - fTPCdataQA = new AliTPCdataQA*[AliRecoParam::kNSpecies] ; - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) - fTPCdataQA[specie] = NULL ; - for(Int_t i = 0; i < 6; i++) fMapping[i] = 0; - - // - // Associate class histogram objects to the copies in the list - // Could also be done with the indexes - // - } //__________________________________________________________________ @@ -120,10 +140,7 @@ AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerR AliTPCQADataMakerRec::~AliTPCQADataMakerRec() { // Destructor - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) - if ( fTPCdataQA[specie] != NULL ) - delete fTPCdataQA[specie] ; - delete[] fTPCdataQA; + delete fTPCdataQA; for(Int_t i = 0; i < 6; i++) delete fMapping[i]; @@ -133,105 +150,12 @@ AliTPCQADataMakerRec::~AliTPCQADataMakerRec() void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) { //Detector specific actions at end of cycle - - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) - continue ; - if(fTPCdataQA[specie] != NULL) { // do the final step of the QA for Raw data - - fTPCdataQA[specie]->Analyse(); // 31/1-08 Analyse is now protected against - // RAW data files with no TPC data - - SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ; - TH1F * histRawsOccupancy = (TH1F*)GetRawsData(kOccupancy) ; - TH1F * histRawsOccupancyVsSector = (TH1F*)GetRawsData(kOccupancyVsSector) ; - TH1F * histRawsNClustersPerEventVsSector = (TH1F*)GetRawsData(kNClustersPerEventVsSector) ; - TH1F * histRawsQVsSector = (TH1F*)GetRawsData(kQVsSector) ; - TH1F * histRawsQmaxVsSector = (TH1F*)GetRawsData(kQmaxVsSector) ; - if ( !histRawsOccupancy || - !histRawsOccupancyVsSector || - !histRawsNClustersPerEventVsSector || - !histRawsQVsSector || - !histRawsQmaxVsSector) { - AliError("Something very wrong here, corrupted memory ?????. Please check\n") ; - continue ; - } - - //Add2RawsList(fTPCdataQA, 0); - // get the histograms and add them to the output - // 31/8-08 Histogram is only added if the Calibration class - // receives TPC data - const Int_t eventCounter = fTPCdataQA[specie]->GetEventCounter(); - if(eventCounter>0) { // some TPC data has been processed - - // Reset histograms and refill them - histRawsOccupancy->Reset(); - histRawsOccupancyVsSector->Reset(); - histRawsNClustersPerEventVsSector->Reset(); - histRawsQVsSector->Reset(); - histRawsQmaxVsSector->Reset(); - - TH1F* hNorm72 = new TH1F("hNorm72", "histogram to normalize 72 sectors", - 72, 0, 72); - hNorm72->Sumw2(); - TH1F* hNorm108 = new TH1F("hNorm108", "histogram to normalize 108 sectors (medium and long pads are split up)", - 108, 0, 108); - hNorm108->Sumw2(); - - for (Int_t iSec = 0; iSec < 72; iSec++) { - - AliTPCCalROC* occupancyROC = - fTPCdataQA[specie]->GetNoThreshold()->GetCalROC(iSec); - AliTPCCalROC* nclusterROC = - fTPCdataQA[specie]->GetNLocalMaxima()->GetCalROC(iSec); - AliTPCCalROC* qROC = - fTPCdataQA[specie]->GetMeanCharge()->GetCalROC(iSec); - AliTPCCalROC* qmaxROC = - fTPCdataQA[specie]->GetMaxCharge()->GetCalROC(iSec); - - const Int_t nRows = occupancyROC->GetNrows(); - for (Int_t iRow = 0; iRow < nRows; iRow++) { - - Int_t helpSector = iSec; - if(iRow>=64) - helpSector += 36; // OROC (long pads) - - const Int_t nPads = occupancyROC->GetNPads(iRow); - for (Int_t iPad = 0; iPad < nPads; iPad++) { - - histRawsOccupancy->Fill(occupancyROC->GetValue(iRow, iPad)); - hNorm72->Fill(iSec); - histRawsOccupancyVsSector - ->Fill(iSec, occupancyROC->GetValue(iRow, iPad)); - - const Int_t nClusters = TMath::Nint(nclusterROC->GetValue(iRow, iPad)); - - if(nClusters>0) { - - histRawsNClustersPerEventVsSector->Fill(iSec, nClusters); - hNorm108->Fill(helpSector, nClusters); - histRawsQVsSector->Fill(helpSector, - nClusters*qROC->GetValue(iRow, iPad)); - histRawsQmaxVsSector->Fill(helpSector, - nClusters*qmaxROC->GetValue(iRow, iPad)); - } - } - } - } // end loop over sectors - - // Normalize histograms - histRawsOccupancyVsSector->Divide(hNorm72); - histRawsNClustersPerEventVsSector->Scale(1.0/Float_t(eventCounter)); - histRawsQVsSector->Divide(hNorm108); - histRawsQmaxVsSector->Divide(hNorm108); - delete hNorm72; - delete hNorm108; - } - } - } + ResetEventTrigClasses(); + AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ; } + //____________________________________________________________________________ void AliTPCQADataMakerRec::InitESDs() { @@ -243,7 +167,7 @@ void AliTPCQADataMakerRec::InitESDs() new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts", 160, 0, 160); histESDclusters->Sumw2(); - Add2ESDsList(histESDclusters, KClusters, !expert, image); + Add2ESDsList(histESDclusters, kClusters, !expert, image); TH1F * histESDratio = new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts", @@ -256,6 +180,8 @@ void AliTPCQADataMakerRec::InitESDs() 50, 0, 5); histESDpt->Sumw2(); Add2ESDsList(histESDpt, kPt, !expert, image); + // + ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line } //____________________________________________________________________________ @@ -273,43 +199,34 @@ void AliTPCQADataMakerRec::InitRaws() const Bool_t saveCorr = kTRUE ; const Bool_t image = kTRUE ; - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - fTPCdataQA[specie] = new AliTPCdataQA(AliRecoParam::ConvertIndex(specie)); - LoadMaps(); // Load Altro maps - fTPCdataQA[specie]->SetAltroMapping(fMapping); // set Altro mapping - fTPCdataQA[specie]->SetRangeTime(100, 920); // set time bin interval -// Add2RawsList(fTPCdataQA, kTPCdataQ, !expert, image, !saveCorrA); // This is used by the AMORE monitoring <------- THIS WILL FAIL (YS) - } - - TH1F * histRawsOccupancy = - new TH1F("hRawsOccupancy", "Occupancy (all pads); Occupancy; Counts", - 100, 0, 1); - histRawsOccupancy->Sumw2(); - Add2RawsList(histRawsOccupancy, kOccupancy, !expert, image, !saveCorr); + fTPCdataQA = new AliTPCdataQA(); + LoadMaps(); // Load Altro maps + fTPCdataQA->SetAltroMapping(fMapping); // set Altro mapping + fTPCdataQA->SetRangeTime(fRawFirstTimeBin, fRawLastTimeBin); // set time bin interval + fTPCdataQA->SetIsDQM(kTRUE); - TH1F * histRawsOccupancyVsSector = - new TH1F("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy", + TProfile * histRawsOccupancyVsSector = + new TProfile("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy", 72, 0, 72); - histRawsOccupancyVsSector->Sumw2(); - Add2RawsList(histRawsOccupancyVsSector, kOccupancyVsSector, !expert, image, !saveCorr); + histRawsOccupancyVsSector->SetMarkerStyle(20); + histRawsOccupancyVsSector->SetOption("P"); + histRawsOccupancyVsSector->SetStats(kFALSE); + Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, !expert, image, !saveCorr); + + TProfile * histRawsQVsSector = + new TProfile("hRawsQVsSector", " vs sector; Sector; ", + 72, 0, 72); + Add2RawsList(histRawsQVsSector, kRawsQVsSector, expert, !image, !saveCorr); - TH1F * histRawsNClustersPerEventVsSector = - new TH1F("hRawsNClustersPerEventVsSector", "Nclusters per event vs sector; Sector; Nclusters per event", + TProfile * histRawsQmaxVsSector = + new TProfile("hRawsQmaxVsSector", " vs sector; Sector; ", 72, 0, 72); - histRawsNClustersPerEventVsSector->Sumw2(); - Add2RawsList(histRawsNClustersPerEventVsSector, kNClustersPerEventVsSector, !expert, image, !saveCorr); - - TH1F * histRawsQVsSector = - new TH1F("hRawsQVsSector", " vs sector (OROC med: 36-71, long: 72-107); Sector; ", - 108, 0, 108); - histRawsQVsSector->Sumw2(); - Add2RawsList(histRawsQVsSector, kQVsSector, !expert, image, !saveCorr); - - TH1F * histRawsQmaxVsSector = - new TH1F("hRawsQmaxVsSector", " vs sector (OROC med: 36-71, long: 72-107); Sector; ", - 108, 0, 108); - histRawsQmaxVsSector->Sumw2(); - Add2RawsList(histRawsQmaxVsSector, kQmaxVsSector, !expert, image, !saveCorr); + histRawsQmaxVsSector->SetMarkerStyle(20); + histRawsQmaxVsSector->SetOption("P"); + histRawsQmaxVsSector->SetStats(kFALSE); + Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, !expert, image, !saveCorr); + // + ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line } //____________________________________________________________________________ @@ -322,6 +239,8 @@ void AliTPCQADataMakerRec::InitDigits() 1000, 0, 1000); histDigitsADC->Sumw2(); Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image); + // + ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line } //____________________________________________________________________________ @@ -371,13 +290,15 @@ void AliTPCQADataMakerRec::InitRecPoints() 159, 0, 159); histRecPointsRow->Sumw2(); Add2RecPointsList(histRecPointsRow, kRow, !expert, image); + // + ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line } //____________________________________________________________________________ void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd) { // make QA data from ESDs - + const Int_t nESDTracks = esd->GetNumberOfTracks(); Int_t nTPCtracks = 0; for(Int_t i = 0; i < nESDTracks; i++) { @@ -392,10 +313,14 @@ void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd) Int_t nTPCclusters = track->GetTPCNcls(); Int_t nTPCclustersFindable = track->GetTPCNclsF(); if ( nTPCclustersFindable<=0) continue; - GetESDsData(KClusters)->Fill(nTPCclusters); - GetESDsData(kRatio)->Fill(Float_t(nTPCclusters)/Float_t(nTPCclustersFindable)); - GetESDsData(kPt)->Fill(track->Pt()); + FillESDsData(kClusters,nTPCclusters); + FillESDsData(kRatio,Float_t(nTPCclusters)/Float_t(nTPCclustersFindable)); + FillESDsData(kPt,track->Pt()); } + // + IncEvCountCycleESDs(); + IncEvCountTotalESDs(); + // } //____________________________________________________________________________ @@ -405,13 +330,52 @@ void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader) // To make QA for the RAW data we use the TPC Calibration framework // to handle the data and then in the end extract the data // - rawReader->Reset() ; - fTPCdataQA[AliRecoParam::AConvert(fEventSpecie)]->ProcessEvent(rawReader); - } + + GetRawsData(0); // dummy call to init raw data + rawReader->Reset() ; + if (! fTPCdataQA ) { + + AliError("No TPC data QA (no call to InitRaws?)!!!!") ; + } else { + + if(fTPCdataQA->GetIsDQM() == kFALSE) + AliError("Data QA has to be initialized as DQM!!!!") ; + + // Fill profile data + fTPCdataQA->ResetProfiles(); + + if(fTPCdataQA->ProcessEvent(rawReader)) { // means that TPC data was processed + + fTPCdataQA->FillOccupancyProfile(); + + // Fill histograms + TObjArray *arrRW = GetMatchingRawsData(kRawsOccupancyVsSector); // all kRawsOccupancyVsSector clones matching to triggers + for (int ih=arrRW->GetEntriesFast();ih--;) { + TProfile* hRawsOccupancyVsSector = dynamic_cast(arrRW->At(ih)); + if (hRawsOccupancyVsSector) hRawsOccupancyVsSector->Add(fTPCdataQA->GetHistOccVsSector()); + } + arrRW = GetMatchingRawsData(kRawsQVsSector); + for (int ih=arrRW->GetEntriesFast();ih--;) { + TProfile* hRawsQVsSector = dynamic_cast(arrRW->At(ih)); + if (hRawsQVsSector) hRawsQVsSector->Add(fTPCdataQA->GetHistQVsSector()); + } + arrRW = GetMatchingRawsData(kRawsQmaxVsSector); + for (int ih=arrRW->GetEntriesFast();ih--;) { + TProfile* hRawsQmaxVsSector = dynamic_cast(arrRW->At(ih)); + if (hRawsQmaxVsSector) hRawsQmaxVsSector->Add(fTPCdataQA->GetHistQmaxVsSector()); + } + // + IncEvCountCycleRaws(); + IncEvCountTotalRaws(); + // + } + } +} //____________________________________________________________________________ void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree) { + TBranch* branch = digitTree->GetBranch("Segment"); AliSimDigits* digArray = 0; branch->SetAddress(&digArray); @@ -426,32 +390,38 @@ void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree) do { Float_t dig = digArray->CurrentDigit(); - GetDigitsData(kDigitsADC)->Fill(dig); + FillDigitsData(kDigitsADC,dig); } while (digArray->Next()); } + // + IncEvCountCycleDigits(); + IncEvCountTotalDigits(); + // } //____________________________________________________________________________ void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree) { - AliTPCClustersRow *clrow = new AliTPCClustersRow(); - clrow->SetClass("AliTPCclusterMI"); - clrow->SetArray(0); - clrow->GetArray()->ExpandCreateFast(10000); - - TBranch* branch = recTree->GetBranch("Segment"); + + AliTPCClustersRow* clrow = 0x0; + TBranch* branch = recTree->GetBranch("Segment"); branch->SetAddress(&clrow); + TClonesArray * clarray = 0x0; const Int_t nEntries = Int_t(recTree->GetEntries()); for (Int_t i = 0; i < nEntries; i++) { branch->GetEntry(i); - - const Int_t nClusters = clrow->GetArray()->GetEntriesFast(); + + clarray = clrow->GetArray(); + + if (!clarray) continue; + + const Int_t nClusters = clarray->GetEntriesFast(); for (Int_t icl=0; icl < nClusters; icl++){ AliTPCclusterMI* cluster = - (AliTPCclusterMI*)clrow->GetArray()->At(icl); + (AliTPCclusterMI*)clarray->At(icl); Float_t Qmax = cluster->GetMax(); Float_t Q = cluster->GetQ(); @@ -459,26 +429,28 @@ void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree) if(cluster->GetDetector()<36) { // IROC (short pads) - GetRecPointsData(kQmaxShort)->Fill(Qmax); - GetRecPointsData(kQShort)->Fill(Q); + FillRecPointsData(kQmaxShort,Qmax); + FillRecPointsData(kQShort,Q); } else { // OROC (medium and long pads) row += 63; if(cluster->GetRow()<64) { // medium pads - GetRecPointsData(kQmaxMedium)->Fill(Qmax); - GetRecPointsData(kQMedium)->Fill(Q); + FillRecPointsData(kQmaxMedium,Qmax); + FillRecPointsData(kQMedium,Q); } else { // long pads - GetRecPointsData(kQmaxLong)->Fill(Qmax); - GetRecPointsData(kQLong)->Fill(Q); + FillRecPointsData(kQmaxLong,Qmax); + FillRecPointsData(kQLong,Q); } } - GetRecPointsData(kRow)->Fill(row); + FillRecPointsData(kRow,row); } // end loop over clusters } // end loop over tree - - delete clrow; + // + IncEvCountCycleRecPoints(); + IncEvCountTotalRecPoints(); + // } //____________________________________________________________________________ @@ -488,6 +460,9 @@ void AliTPCQADataMakerRec::LoadMaps() path += "/TPC/mapping/Patch"; for(Int_t i = 0; i < 6; i++) { + + if(fMapping[i]!=0) // mapping already loaded + continue; TString path2 = path; path2 += i; path2 += ".data";