/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // // Class AliHFEtrdPIDqaV1 // Monitoring TRD PID in the HFE PID montioring framework. The following // quantities are monitored: // TRD electron likelihood // TRD dE/dx (Absolute values) // TPC dE/dx (Number of sigmas, control histogram) // (Always as function of momentum, particle species and centrality // before and after cut) // More information about the PID monitoring framework can be found in // AliHFEpidQAmanager.cxx and AliHFEdetPIDqa.cxx // // Author: // Markus Fasel // #include #include #include #include #include "AliAODTrack.h" #include "AliESDtrack.h" #include "AliESDpid.h" #include "AliExternalTrackParam.h" #include "AliPID.h" #include "AliHFEcollection.h" #include "AliHFEpidBase.h" #include "AliHFEtrdPIDqaV1.h" ClassImp(AliHFEtrdPIDqaV1) //____________________________________________________________ AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(): AliHFEdetPIDqa(), fHistos(NULL) { // // Dummy constructor // } //____________________________________________________________ AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(const Char_t *name): AliHFEdetPIDqa(name, "QA for TRD"), fHistos(NULL) { // // Default constructor // } //____________________________________________________________ AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(const AliHFEtrdPIDqaV1 &o): AliHFEdetPIDqa(o), fHistos(NULL) { // // Copy constructor // } //____________________________________________________________ AliHFEtrdPIDqaV1 &AliHFEtrdPIDqaV1::operator=(const AliHFEtrdPIDqaV1 &o){ // // Make assignment // AliHFEdetPIDqa::operator=(o); fHistos = o.fHistos; return *this; } //_________________________________________________________ Long64_t AliHFEtrdPIDqaV1::Merge(TCollection *coll){ // // Merge with other objects // if(!coll) return 0; if(coll->IsEmpty()) return 1; TIter it(coll); AliHFEtrdPIDqaV1 *refQA = NULL; TObject *o = NULL; Long64_t count = 0; TList listHistos; while((o = it())){ refQA = dynamic_cast(o); if(!refQA) continue; listHistos.Add(refQA->fHistos); count++; } fHistos->Merge(&listHistos); return count + 1; } //____________________________________________________________ void AliHFEtrdPIDqaV1::Initialize(){ // // Initialize QA histos for TRD PID // AliDebug(1, "Initializing PID QA for TRD"); // Make common binning const Int_t kPIDbins = AliPID::kSPECIES + 1; const Int_t kPbins = 100; const Int_t kSteps = 2; const Double_t kMinPID = -1; const Double_t kMinP = 0.; const Double_t kMaxPID = (Double_t)AliPID::kSPECIES; const Double_t kMaxP = 20.; fHistos = new AliHFEcollection("trdqahistos", "Collection of TRD QA histograms"); // Create Control Histogram monitoring the TPC sigma between the selection steps const Int_t kTPCSigmaBins = 140; Int_t nBinsTPCSigma[4] = {kPIDbins, kPbins, kTPCSigmaBins, kSteps}; Double_t minTPCSigma[4] = {kMinPID, kMinP, -12., 0}; Double_t maxTPCSigma[4] = {kMaxPID, kMaxP, 12., 2.}; fHistos->CreateTHnSparse("hTPCsigma", "TPC sigma; species p [GeV/c]; TPC dEdx - |_{el} [#sigma]; selection step", 4, nBinsTPCSigma, minTPCSigma, maxTPCSigma); // Create Monitoring histogram for the Likelihood distribution const Int_t kTRDLikelihoodBins = 100; Int_t nBinsTRDlike[4] = {kPIDbins, kPbins, kTRDLikelihoodBins, kSteps}; Double_t minTRDlike[4] = {kMinPID, kMinP, 0., 0.}; Double_t maxTRDlike[4] = {kMaxPID, kMaxP, 1., 2.}; fHistos->CreateTHnSparse("hTRDlikelihood", "TRD Likelihood Distribution; species; p [GeV/c]; TRD electron Likelihood; selection step", 4, nBinsTRDlike, minTRDlike, maxTRDlike); // Create Monitoring histogram for the TRD total charge const Int_t kTRDchargeBins = 1000; Int_t nBinsTRDcharge[4] = {kPIDbins, kPbins, kTRDchargeBins, kSteps}; Double_t minTRDcharge[4] = {kMinPID, kMinP, 0., 0.}; Double_t maxTRDcharge[4] = {kMaxPID, kMaxP, 100000., 2.}; fHistos->CreateTHnSparse("hTRDcharge", "Total TRD charge; species; p [GeV/c]; TRD charge [a.u.]; selection step", 4, nBinsTRDcharge, minTRDcharge, maxTRDcharge); } //____________________________________________________________ void AliHFEtrdPIDqaV1::ProcessTrack(AliHFEpidObject *track, AliHFEdetPIDqa::EStep_t step){ // // Process the track, fill the containers // AliDebug(1, Form("QA started for TRD PID for step %d", (Int_t)step)); Int_t species = track->GetAbInitioPID(); const AliVParticle *rectrack = track->GetRecTrack(); if(species >= AliPID::kSPECIES) species = -1; if(!TString(rectrack->IsA()->GetName()).CompareTo("AliESDtrack")) ProcessESDtrack(dynamic_cast(rectrack), step, species); else if(!TString(rectrack->IsA()->GetName()).CompareTo("AliAODTrack")) ProcessAODtrack(dynamic_cast(rectrack), step, species); else AliWarning(Form("Object type %s not supported\n", rectrack->IsA()->GetName())); } //____________________________________________________________ void AliHFEtrdPIDqaV1::ProcessESDtrack(const AliESDtrack *track, AliHFEdetPIDqa::EStep_t step, Int_t species){ // // Fill QA histograms // Double_t container[4]; container[0] = species; container[1] = track->GetOuterParam() ? track->GetOuterParam()->P() : track->P(); container[2] = fESDpid->NumberOfSigmasTPC(track, AliPID::kElectron); container[3] = step; fHistos->Fill("hTPCsigma", container); Double_t pid[5]; track->GetTRDpid(pid); container[2] = pid[AliPID::kElectron]; fHistos->Fill("hTRDlikelihood", container); Double_t charge = 0.; for(Int_t ily = 0; ily < 6; ily++){ charge = 0.; for(Int_t isl = 0; isl < track->GetNumberOfTRDslices(); isl++){ charge += track->GetTRDslice(ily, isl); } fHistos->Fill("hTRDcharge", container); } } //_________________________________________________________ void AliHFEtrdPIDqaV1::ProcessAODtrack(const AliAODTrack * /*track*/, AliHFEdetPIDqa::EStep_t /*step*/, Int_t /*species*/){ // // To be implemented // } //_________________________________________________________ TH2 *AliHFEtrdPIDqaV1::MakeTPCspectrumNsigma(AliHFEdetPIDqa::EStep_t step, Int_t species){ // // Get the TPC control histogram for the TRD selection step (either before or after PID) // printf("histos :%p\n", fHistos); THnSparseF *histo = dynamic_cast(fHistos->Get("hTPCsigma")); if(!histo){ AliError("QA histogram monitoring TPC nSigma not available"); return NULL; } if(species > -1 && species < AliPID::kSPECIES){ // cut on species (if available) histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow } histo->GetAxis(3)->SetRangeUser(species + 1, species + 1); TH2 *hSpec = histo->Projection(2, 1); // construct title and name TString stepname = step ? "before" : "after"; TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; TString histname = Form("hSigmaTPC%s%s", specID.Data(), stepname.Data()); TString histtitle = Form("TPC Sigma for %s %s PID", speciesname.Data(), stepname.Data()); hSpec->SetName(histname.Data()); hSpec->SetTitle(histtitle.Data()); // Unset range on the original histogram histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); return hSpec; } //_________________________________________________________ TH2 *AliHFEtrdPIDqaV1::MakeTRDlikelihoodDistribution(AliHFEdetPIDqa::EStep_t step, Int_t species){ // // Make Histogram for TRD Likelihood distribution // THnSparseF *histo = dynamic_cast(fHistos->Get("hTRDlikelihood")); if(!histo){ AliError("QA histogram monitoring TRD Electron Likelihood not available"); return NULL; } if(species > -1 && species < AliPID::kSPECIES){ // cut on species (if available) histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow } histo->GetAxis(3)->SetRangeUser(species + 1, species + 1); TH2 *hSpec = histo->Projection(2, 1); // construct title and name TString stepname = step ? "before" : "after"; TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; TString histname = Form("hLikeElTRD%s%s", specID.Data(), stepname.Data()); TString histtitle = Form("TRD electron Likelihood for %s %s PID", speciesname.Data(), stepname.Data()); hSpec->SetName(histname.Data()); hSpec->SetTitle(histtitle.Data()); // Unset range on the original histogram histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); return hSpec; } //_________________________________________________________ TH2 *AliHFEtrdPIDqaV1::MakeTRDchargeDistribution(AliHFEdetPIDqa::EStep_t step, Int_t species){ // // Make Histogram for TRD Likelihood distribution // THnSparseF *histo = dynamic_cast(fHistos->Get("hTRDcharge")); if(!histo){ AliError("QA histogram monitoring TRD total charge not available"); return NULL; } if(species > -1 && species < AliPID::kSPECIES){ // cut on species (if available) histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow } histo->GetAxis(3)->SetRangeUser(species + 1, species + 1); TH2 *hSpec = histo->Projection(2, 1); // construct title and name TString stepname = step ? "before" : "after"; TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; TString histname = Form("hChargeTRD%s%s", specID.Data(), stepname.Data()); TString histtitle = Form("TRD total charge for %s %s PID", speciesname.Data(), stepname.Data()); hSpec->SetName(histname.Data()); hSpec->SetTitle(histtitle.Data()); // Unset range on the original histogram histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); return hSpec; }