X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FQA%2FAliHLTQADataMakerRec.cxx;h=d444bafdeceb1b3dd4149077a0b1eb1979818c0d;hb=a44cd39eb50f2152b6a2a8630e93dc93c4637fb1;hp=74fa33e52f3058c91399a767053b23ce70220138;hpb=019f778faf92bc605662c1995608fda17c037a4a;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/QA/AliHLTQADataMakerRec.cxx b/HLT/QA/AliHLTQADataMakerRec.cxx index 74fa33e52f3..d444bafdece 100644 --- a/HLT/QA/AliHLTQADataMakerRec.cxx +++ b/HLT/QA/AliHLTQADataMakerRec.cxx @@ -4,8 +4,7 @@ //* This file is property of and copyright by the ALICE HLT Project * //* ALICE Experiment at CERN, All rights reserved. * //* * -//* Primary Authors: Zhong-Bao Yin * -//* Matthias Richter * +//* Primary Authors: Matthias Richter * //* for The ALICE HLT Project. * //* * //* Permission to use, copy, modify and distribute this software and its * @@ -17,19 +16,20 @@ //* provided "as is" without express or implied warranty. * //************************************************************************** -/** @file AliHLTQADataMakerRec.cxx - @author Zhongbao Yin, Matthias Richter - @date 2009-05-14 - @brief Container for the HLT offline QA -*/ +/// @file AliHLTQADataMakerRec.cxx +/// @author Matthias Richter +/// @date 2010-03-10 +/// @brief Steering class for the HLT offline QA +/// #include "AliHLTQADataMakerRec.h" -#include "AliESDEvent.h" +#include "AliHLTMisc.h" +#include "AliHLTModuleAgent.h" +#include "AliRecoParam.h" #include - -#include "TH1F.h" -#include "TH2F.h" - -#include "AliESDtrack.h" +#include "TString.h" +#include "TObjString.h" +#include "TObjArray.h" +#include "TDirectory.h" using namespace std; @@ -37,12 +37,17 @@ using namespace std; ClassImp(AliHLTQADataMakerRec) AliHLTQADataMakerRec::AliHLTQADataMakerRec() + : AliHLTQADataMakerBase() + , fPlugins() + , fFlags(0) { // see header file for class documentation // or // refer to README to build package // or // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + + LoadAgents(); } AliHLTQADataMakerRec::~AliHLTQADataMakerRec() @@ -50,336 +55,150 @@ AliHLTQADataMakerRec::~AliHLTQADataMakerRec() // see header file for class documentation } -void AliHLTQADataMakerRec::Exec(AliQAv1::TASKINDEX_t task, TObject * data) -{ - // special handling for esds - if ( task == AliQAv1::kESDS ) { - AliESDEvent * esd = NULL; - AliESDEvent * hltesd = NULL; - if (data->IsA() == AliESDEvent::Class()) { - // silently skip this. Currently HLT QA is still called as - // part of AliQAManager::RunOneEvent with the esd - return; - } - if (data->InheritsFrom("TObjArray")) { - TObjArray* array=dynamic_cast(data); - if (array && array->GetEntriesFast()>0) { - esd = dynamic_cast(array->At(0)) ; - } - if (array && array->GetEntriesFast()>1) { - hltesd = dynamic_cast(array->At(1)) ; - } - } else { - esd = static_cast(data) ; - } - - if (esd && strcmp(esd->ClassName(), "AliESDEvent") == 0) { - if (hltesd) { - MakeESDs(esd, hltesd); - } else { - AliError(Form("HLT ESD missing or wrong class type (%p), skipping HLT QA task kESDs", hltesd)); - } - } else { - AliError(Form("ESD missing or wrong class type (%p), skipping HLT QA task kESDSs", esd)); - } - } else { - // forward for all other types - AliQADataMakerRec::Exec(task, data); +int AliHLTQADataMakerRec::LoadAgents() +{ + // iterate over available agents and query class names of plugins + TString plugins; + for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent(); + pAgent!=NULL; + pAgent=AliHLTModuleAgent::GetNextAgent()) { + const char* modulePlugins=pAgent->GetQAPlugins(); + if (!modulePlugins || !modulePlugins[0]) continue; + if (!plugins.IsNull() && !plugins.EndsWith(" ")) plugins+=" "; + plugins+=modulePlugins; } + if (!plugins.IsNull()) return LoadPlugins(plugins); + return 0; } -void AliHLTQADataMakerRec::StartOfDetectorCycle() +int AliHLTQADataMakerRec::LoadPlugins(const char* plugins) { - // see header file for class documentation + // load plugins from list of blank separated class names + int iResult=0; + TString strPlugins=plugins; + TObjArray* tokens=strPlugins.Tokenize(" "); + if (tokens) { + TIter next(tokens); + TObject* obj=NULL; + while ((obj=next())) { + TObjString* objstring=dynamic_cast(obj); + if (!objstring) continue; + AliHLTQADataMakerBase* plugin=AliHLTMisc::LoadInstance((AliHLTQADataMakerBase*)0, + objstring->GetString().Data()); + if (!plugin) continue; + AliInfo(Form("using HLT QA plugin %s", plugin->IsA()->GetName())); + fPlugins.Add(plugin); + } + delete tokens; + } + return iResult; } -void AliHLTQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t, TObjArray** /*list*/) +void AliHLTQADataMakerRec::StartOfDetectorCycle() { // see header file for class documentation - if(GetESDsData(kPHLT)->GetEntries()){ - GetESDsData(kPRatio)->Sumw2(); - GetESDsData(kPRatio)->Add(GetESDsData(kPOffline)); - GetESDsData(kPRatio)->Divide(GetESDsData(kPHLT)); + // this function is called multiple times by the framework, actually for every QA task + // however, here we don't have any argument for the task + // this class is initialized right before StartOfDetectorCycle is called, and depending + // on the availibility of thr histogram arrays one can tell where we are ;-) + unsigned init=0; + if (fDigitsQAList!=NULL && (fFlags&kDigitsListInit)==0) { + init|=kDigitsListInit; // indicate that plugins should be initialized for that task + fFlags|=kDigitsListInit; // indicate that it was initialized + } + if (fESDsQAList!=NULL && (fFlags&kESDsListInit)==0) { + init|=kESDsListInit; // indicate that plugins should be initialized for that task + fFlags|=kESDsListInit; // indicate that it was initialized + } + if (fRawsQAList!=NULL && (fFlags&kRawsListInit)==0) { + init|=kRawsListInit; // indicate that plugins should be initialized for that task + fFlags|=kRawsListInit; // indicate that it was initialized + } + if (fRecPointsQAList!=NULL && (fFlags&kRecPointsListInit)==0) { + init|=kRecPointsListInit; // indicate that plugins should be initialized for that task + fFlags|=kRecPointsListInit; // indicate that it was initialized } - - if(GetESDsData(kPHLTFired)->GetEntries()){ - GetESDsData(kPRatioFired)->Sumw2(); - GetESDsData(kPRatioFired)->Add(GetESDsData(kPOfflineFired)); - GetESDsData(kPRatioFired)->Divide(GetESDsData(kPHLTFired)); - } - + TIter next(&fPlugins); + TObject* obj=NULL; + while ((obj=next())) { + AliHLTQADataMakerBase* plugin=dynamic_cast(obj); + if (!plugin) continue; + // transfer the properties set in AliQAManager::GetQADataMaker to the plugin + plugin->SetName(GetName()); + plugin->SetUniqueID(GetUniqueID()); + if (init&kDigitsListInit) plugin->Init(AliQAv1::GetTaskIndex("Digits"), 0); + if (init&kESDsListInit) plugin->Init(AliQAv1::GetTaskIndex("ESDs"), 0); + if (init&kRawsListInit) plugin->Init(AliQAv1::GetTaskIndex("Raws"), 0); + if (init&kRecPointsListInit) plugin->Init(AliQAv1::GetTaskIndex("RecPoints"), 0); + plugin->StartOfDetectorCycle(); + } } -void AliHLTQADataMakerRec::MakeRaws(AliRawReader * rawReader) +void AliHLTQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list) { // see header file for class documentation - if (!rawReader) return; -} - -void AliHLTQADataMakerRec::InitESDs(){ - - //create ESDs histograms in ESDs subdir - const Bool_t expert = kTRUE ; - const Bool_t image = kTRUE ; - - TH2F * histESDMultiplicity = - new TH2F("hESDMultiplicity", - "Number of tracks from all events; Number of offline tracks; Number of HLT tracks", - 300, 0, 300, 300, 0, 300); - histESDMultiplicity->Sumw2(); - Add2ESDsList(histESDMultiplicity, kMultiplicity, !expert, image); - - TH2F * histESDMultiplicityFired = - new TH2F("hESDMultiplicityFired", - "Number of tracks from HLT triggered events; Number of offline tracks; Number of HLT tracks", - 300, 0, 300, 300, 0, 300); - histESDMultiplicityFired->Sumw2(); - Add2ESDsList(histESDMultiplicityFired, kMultiplicityFired, !expert, image); - - TH2F * histESDNCls = - new TH2F("hESDNCls", "Mean number of TPC clusters from all events; Offline; HLT", - 200, 0, 200, 200, 0, 200); - histESDNCls->Sumw2(); - Add2ESDsList(histESDNCls, kNCls, !expert, image); - - TH2F * histESDNClsFired = - new TH2F("hESDNClsFired", "Mean number of TPC clusters from triggered events; Offline; HLT", - 200, 0, 200, 200, 0, 200); - histESDNClsFired->Sumw2(); - Add2ESDsList(histESDNClsFired, kNClsFired, !expert, image); - - TH1F * histPHLT - = new TH1F("hPHLT", "P distribution for all events from HLT; P [GeV/c]", - 100, -0.5, 99.5); - histPHLT->Sumw2(); - Add2ESDsList(histPHLT, kPHLT, !expert, image); - - TH1F * histPOffline - = new TH1F("hPOffline", - "P distribution for all events from offline; P [GeV/c]", - 100, -0.5, 99.5); - histPOffline->Sumw2(); - Add2ESDsList(histPOffline, kPOffline, !expert, image); - - TH1F * histPHLTFired - = new TH1F("hPHLTFired", - "P distribution for fired events from HLT; P [GeV/c]", - 100, -0.5, 99.5); - histPHLTFired->Sumw2(); - Add2ESDsList(histPHLTFired, kPHLTFired, !expert, image); - - TH1F * histPOfflineFired - = new TH1F("hPOfflineFired", - "P distribution for fired events from offline; P [GeV/c]", - 100, -0.5, 99.5); - histPOfflineFired->Sumw2(); - Add2ESDsList(histPOfflineFired, kPOfflineFired, !expert, image); - - TH1F * histPRatio - = new TH1F("hPRatio", - "Ratio of P distribution for all events; P [GeV/c]", - 100, -0.5, 99.5); - histPRatio->Sumw2(); - Add2ESDsList(histPRatio, kPRatio, !expert, image); - - TH1F * histPRatioFired - = new TH1F("hPRatioFired", - "Ratio of P distribution for fired events; P [GeV/c]", - 100, -0.5, 99.5); - histPRatioFired->Sumw2(); - Add2ESDsList(histPRatioFired, kPRatioFired, !expert, image); - - TH1F * histPtHLT - = new TH1F("hPtHLT", - "P_{T} distribution for all events from HLT; P_{T} [GeV/c]", - 200, -100.5, 99.5); - histPtHLT->Sumw2(); - Add2ESDsList(histPtHLT, kPtHLT, !expert, image); - - TH1F * histPtOffline - = new TH1F("hPtOffline", - "P_{T} distribution for all events from offline; P_{T} [GeV/c]", - 200, -100.5, 99.5); - histPtOffline->Sumw2(); - Add2ESDsList(histPtOffline, kPtOffline, !expert, image); - - TH1F * histPtHLTFired - = new TH1F("hPtHLTFired", - "P_{T} distribution for fired events from HLT; P_{T} [GeV/c]", - 200, -100.5, 99.5); - histPtHLTFired->Sumw2(); - Add2ESDsList(histPtHLTFired, kPtHLTFired, !expert, image); - - TH1F * histPtOfflineFired - = new TH1F("hPtOfflineFired", - "P_{T} distribution for fired events from offline; P_{T} [GeV/c]", - 200, -100.5, 99.5); - histPtOfflineFired->Sumw2(); - Add2ESDsList(histPtOfflineFired, kPtOfflineFired, !expert, image); - - TH1F * histNClsPerTrkHLT - = new TH1F("hNClsPerTrkHLT", "Clusters per HLT track; N cluster; Counts", - 200, 0, 200); - histNClsPerTrkHLT->Sumw2(); - Add2ESDsList(histNClsPerTrkHLT, kNClsPerTrkHLT, !expert, image); - - TH1F * histNClsPerTrkOffline - = new TH1F("hNClsPerTrkOffline", - "Clusters per offline track; N cluster; Counts", - 200, 0, 200); - histNClsPerTrkOffline->Sumw2(); - Add2ESDsList(histNClsPerTrkOffline, kNClsPerTrkOffline, !expert, image); - -TH1F * histNClsPerTrkHLTFired - = new TH1F("hNClsPerTrkHLTFired", - "Clusters per HLT track from HLT fired events; N cluster; Counts", - 200, 0, 200); - histNClsPerTrkHLTFired->Sumw2(); - Add2ESDsList(histNClsPerTrkHLTFired, kNClsPerTrkHLTFired, !expert, image); - - TH1F * histNClsPerTrkOfflineFired - = new TH1F("hNClsPerTrkOfflineFired", - "Clusters per offline track from HLT fired events; N cluster; Counts", - 200, 0, 200); - histNClsPerTrkOfflineFired->Sumw2(); - Add2ESDsList(histNClsPerTrkOfflineFired, kNClsPerTrkOfflineFired, !expert, image); - - TH1F * histPhiHLT = - new TH1F("hPhiHLT", "Phi distribution of HLT tracks; Phi; Counts", - 360, 0, 360); - histPhiHLT->Sumw2(); - Add2ESDsList(histPhiHLT, kPhiHLT, !expert, image); - - TH1F * histPhiOffline = - new TH1F("hPhiOffline", - "Phi distribution of offline tracks; Phi; Counts", - 360, 0, 360); - histPhiOffline->Sumw2(); - Add2ESDsList(histPhiOffline, kPhiOffline, !expert, image); - - TH1F * histPhiHLTFired = - new TH1F("hPhiHLTFired", "Phi distribution of HLT tracks from HLT fired event ; Phi; Counts", - 360, 0, 360); - histPhiHLTFired->Sumw2(); - Add2ESDsList(histPhiHLTFired, kPhiHLTFired, !expert, image); - - TH1F * histPhiOfflineFired = - new TH1F("hPhiOfflineFired", - "Phi distribution of offline tracks from HLT fired events; Phi; Counts", - 360, 0, 360); - histPhiOfflineFired->Sumw2(); - Add2ESDsList(histPhiOfflineFired, kPhiOfflineFired, !expert, image); - - TH1F * histEtaHLT = - new TH1F("hEtaHLT", "Eta distribution of HLT tracks; Eta; Counts", - 200, -1, 1); - histEtaHLT->Sumw2(); - Add2ESDsList(histEtaHLT, kEtaHLT, !expert, image); - - TH1F * histEtaOffline = - new TH1F("hEtaOffline", "Eta distribution of offline tracks; Eta; Counts", - 200, -1, 1); - histEtaHLT->Sumw2(); - Add2ESDsList(histEtaOffline, kEtaOffline, !expert, image); - - TH1F * histEtaHLTFired = - new TH1F("hEtaHLTFired", - "Eta distribution of HLT tracks from HLT fired events; Eta; Counts", - 200, -1, 1); - histEtaHLTFired->Sumw2(); - Add2ESDsList(histEtaHLTFired, kEtaHLTFired, !expert, image); - - TH1F * histEtaOfflineFired = - new TH1F("hEtaOfflineFired", - "Eta distribution of offline tracks from HLT fired events; Eta; Counts", - 200, -1, 1); - histEtaHLTFired->Sumw2(); - Add2ESDsList(histEtaOfflineFired, kEtaOfflineFired, !expert, image); + TIter next(&fPlugins); + TObject* obj=NULL; + TDirectory* dirBackup=gDirectory; + gDirectory=NULL; + while ((obj=next())) { + AliHLTQADataMakerBase* plugin=dynamic_cast(obj); + if (!plugin) continue; + plugin->SetEventSpecie(GetEventSpecie()); + + TObjArray** pluginList=NULL; + if (task==AliQAv1::kESDS) { + pluginList=plugin->GetESDsQAList(); + } else if (task==AliQAv1::kRECPOINTS) { + pluginList=plugin->GetRecPointsQAList(); + } else if (task==AliQAv1::kDIGITS) { + pluginList=plugin->GetDigitsQAList(); + } else if (task==AliQAv1::kRAWS) { + pluginList=plugin->GetRawsQAList(); + } + if (pluginList) { + plugin->EndOfDetectorCycle(task, pluginList); + for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { + if (!pluginList[specie]) continue; + TIter nextentry(pluginList[specie]); + TObject* entry=NULL; + while ((entry=nextentry())) { + AliInfo(Form("cloning histogram %s for specie %d", entry->GetName(), specie)); + list[specie]->Add(entry->Clone()); + } + } + } + } + gDirectory=dirBackup; } -void AliHLTQADataMakerRec::MakeESDs(AliESDEvent * esd) +void AliHLTQADataMakerRec::MakeRaws(AliRawReader * rawReader) { // see header file for class documentation - - // as an extension in the QA interface also the hlt esd can be sent - // in order to preserve backward compatibility, a new function has been - // introduced. - // - // NOTE: This function is not the place for HLT QA - if (!esd) return; + if (!rawReader) return; + + TIter next(&fPlugins); + TObject* obj=NULL; + while ((obj=next())) { + AliHLTQADataMakerBase* plugin=dynamic_cast(obj); + if (!plugin) continue; + plugin->SetEventSpecie(GetEventSpecie()); + plugin->MakeRaws(rawReader); + } } void AliHLTQADataMakerRec::MakeESDs(AliESDEvent * esd, AliESDEvent* hltesd) { // HLT QA on ESDs - if (!esd || !hltesd) { - AliError("invalid parameter: missing ESDs"); - return; - } - - // make QA data from ESDs - - const Int_t nESDTracks = esd->GetNumberOfTracks(); - const Int_t nHLTesdTracks = hltesd->GetNumberOfTracks(); - GetESDsData(kMultiplicity)->Fill(nESDTracks, nHLTesdTracks); - - Int_t nClsHLT = 0; - Int_t nClsOffline = 0; - - for(Int_t i = 0; i < nESDTracks; i++){ - AliESDtrack * esdTrk = esd->GetTrack(i); - GetESDsData(kPOffline)->Fill(esdTrk->P()); - GetESDsData(kPtOffline)->Fill(esdTrk->GetSignedPt()); - GetESDsData(kNClsPerTrkOffline)->Fill(esdTrk->GetTPCNcls()); - GetESDsData(kPhiOffline)->Fill(esdTrk->Phi()*TMath::RadToDeg()); - GetESDsData(kEtaOffline)->Fill(esdTrk->Eta()); - nClsOffline+=esdTrk->GetTPCNcls(); + TIter next(&fPlugins); + TObject* obj=NULL; + while ((obj=next())) { + AliHLTQADataMakerBase* plugin=dynamic_cast(obj); + if (!plugin) continue; + plugin->SetEventSpecie(GetEventSpecie()); + plugin->MakeESDs(esd, hltesd); } - - for(Int_t i = 0; i < nHLTesdTracks; i++){ - AliESDtrack * hltEsdTrk = hltesd->GetTrack(i); - GetESDsData(kPHLT)->Fill(hltEsdTrk->P()); - GetESDsData(kPtHLT)->Fill(hltEsdTrk->GetSignedPt()); - GetESDsData(kNClsPerTrkHLT)->Fill(hltEsdTrk->GetTPCNcls()); - GetESDsData(kPhiHLT)->Fill(hltEsdTrk->Phi()*TMath::RadToDeg()); - GetESDsData(kEtaHLT)->Fill(hltEsdTrk->Eta()); - nClsHLT += hltEsdTrk->GetTPCNcls(); - } - - if(nESDTracks) - nClsOffline /= Float_t(nESDTracks); - if(nHLTesdTracks) - nClsHLT /= Float_t(nHLTesdTracks); - - GetESDsData(kNCls)->Fill(nClsOffline, nClsHLT); - - - if(hltesd->IsHLTTriggerFired()){ - GetESDsData(kMultiplicityFired)->Fill(nESDTracks, nHLTesdTracks); - GetESDsData(kNClsFired)->Fill(nClsOffline, nClsHLT); - - for(Int_t i = 0; i < nESDTracks; i++){ - AliESDtrack * esdTrk = esd->GetTrack(i); - GetESDsData(kPOfflineFired)->Fill(esdTrk->P()); - GetESDsData(kPtOfflineFired)->Fill(esdTrk->GetSignedPt()); - GetESDsData(kNClsPerTrkOfflineFired)->Fill(esdTrk->GetTPCNcls()); - GetESDsData(kPhiOfflineFired)->Fill(esdTrk->Phi()*TMath::RadToDeg()); - GetESDsData(kEtaOfflineFired)->Fill(esdTrk->Eta()); - } - - for(Int_t i = 0; i < nHLTesdTracks; i++){ - AliESDtrack * hltEsdTrk = hltesd->GetTrack(i); - GetESDsData(kPHLTFired)->Fill(hltEsdTrk->P()); - GetESDsData(kPtHLTFired)->Fill(hltEsdTrk->GetSignedPt()); - GetESDsData(kNClsPerTrkHLTFired)->Fill(hltEsdTrk->GetTPCNcls()); - GetESDsData(kPhiHLTFired)->Fill(hltEsdTrk->Phi()*TMath::RadToDeg()); - GetESDsData(kEtaHLTFired)->Fill(hltEsdTrk->Eta()); - } - - - } - }