From b91fdd71f0a3988a93f7f7a2fab6b325ed13d00f Mon Sep 17 00:00:00 2001 From: abercuci Date: Fri, 4 Dec 2009 10:53:27 +0000 Subject: [PATCH] prepare PID LQ ref maker for production - new class to exchange PID info between tasks (AliTRDpidInfo) - new exchange data container between checkPID and PIDrefMaker - prepare to avoid writing to debug tree (at least for LQ) --- PWG1/PWG1LinkDef.h | 6 ++- PWG1/TRD/AliTRDcheckPID.cxx | 65 ++++++++++++------ PWG1/TRD/AliTRDcheckPID.h | 2 + PWG1/TRD/AliTRDpidRefMaker.cxx | 27 ++++--- PWG1/TRD/AliTRDpidRefMaker.h | 1 + PWG1/TRD/AliTRDpidRefMakerLQ.cxx | 145 +++++++++++++++++++++++-------------- PWG1/TRD/AliTRDpidRefMakerLQ.h | 14 ++-- PWG1/TRD/AliTRDrecoTask.h | 2 +- PWG1/TRD/AliTRDresolution.cxx | 100 +++++++++++++------------- PWG1/TRD/info/AliTRDpidInfo.cxx | 53 ++++++++++++++ PWG1/TRD/info/AliTRDpidInfo.h | 40 +++++++++++ PWG1/TRD/run.C | 2 +- 12 files changed, 310 insertions(+), 147 deletions(-) create mode 100644 PWG1/TRD/info/AliTRDpidInfo.cxx create mode 100644 PWG1/TRD/info/AliTRDpidInfo.h diff --git a/PWG1/PWG1LinkDef.h b/PWG1/PWG1LinkDef.h index 7818a2e..038307e 100644 --- a/PWG1/PWG1LinkDef.h +++ b/PWG1/PWG1LinkDef.h @@ -4,6 +4,8 @@ #pragma link off all classes; #pragma link off all functions; +#pragma link C++ class AliTenderSupplyTRD+; + #pragma link C++ class AliAnaFwdDetsQA+; #pragma link C++ class AliAnalysisTaskVtXY+; #pragma link C++ class AliESDresolParams+; @@ -72,9 +74,11 @@ #pragma link C++ class AliTRDclusterInfo+; #pragma link C++ class AliTRDv0Info+; #pragma link C++ class AliTRDtrackInfo+; -#pragma link C++ class AliTRDeventInfo+; #pragma link C++ class AliTRDtrackInfo::AliESDinfo+; #pragma link C++ class AliTRDtrackInfo::AliMCinfo+; +#pragma link C++ class AliTRDeventInfo+; +#pragma link C++ class AliTRDpidInfo+; +#pragma link C++ class AliTRDpidInfo::AliTRDpidData+; #pragma link C++ class AliTRDcheckESD+; #pragma link C++ class AliTRDinfoGen+; #pragma link C++ class AliTRDrecoTask+; diff --git a/PWG1/TRD/AliTRDcheckPID.cxx b/PWG1/TRD/AliTRDcheckPID.cxx index c58cb4d..99a0fd3 100644 --- a/PWG1/TRD/AliTRDcheckPID.cxx +++ b/PWG1/TRD/AliTRDcheckPID.cxx @@ -51,6 +51,7 @@ #include "Cal/AliTRDCalPIDNN.h" #include "AliTRDcheckPID.h" #include "info/AliTRDtrackInfo.h" +#include "info/AliTRDpidInfo.h" Char_t const * AliTRDcheckPID::fgMethod[3] = {"LQ", "NN", "ESD"}; @@ -59,10 +60,11 @@ ClassImp(AliTRDcheckPID) //________________________________________________________________________ AliTRDcheckPID::AliTRDcheckPID() :AliTRDrecoTask("checkPID", "TRD PID checker") - ,fReconstructor(0x0) - ,fUtil(0x0) - ,fGraph(0x0) - ,fMomentumAxis(0x0) + ,fReconstructor(NULL) + ,fUtil(NULL) + ,fGraph(NULL) + ,fPID(NULL) + ,fMomentumAxis(NULL) ,fMinNTracklets(AliTRDgeometry::kNlayer) ,fMaxNTracklets(AliTRDgeometry::kNlayer) { @@ -83,15 +85,17 @@ AliTRDcheckPID::AliTRDcheckPID() fUtil = new AliTRDpidUtil(); InitFunctorList(); + DefineOutput(1, TObjArray::Class()); // PID for reference maker } //________________________________________________________________________ AliTRDcheckPID::~AliTRDcheckPID() { - if(fGraph){fGraph->Delete(); delete fGraph;} - if(fReconstructor) delete fReconstructor; - if(fUtil) delete fUtil; + if(fPID){fPID->Delete(); delete fPID;} + if(fGraph){fGraph->Delete(); delete fGraph;} + if(fReconstructor) delete fReconstructor; + if(fUtil) delete fUtil; } @@ -103,6 +107,23 @@ void AliTRDcheckPID::CreateOutputObjects() OpenFile(0, "RECREATE"); fContainer = Histos(); + + fPID = new TObjArray(); + fPID->SetOwner(kTRUE); +} + +//________________________________________________________ +void AliTRDcheckPID::Exec(Option_t *opt) +{ + // + // Execution part + // + + fPID->Delete(); + + AliTRDrecoTask::Exec(opt); + + PostData(1, fPID); } @@ -118,7 +139,7 @@ TObjArray * AliTRDcheckPID::Histos(){ fContainer = new TObjArray(); fContainer->Expand(kNPlots); const Float_t epsilon = 1./(2*(AliTRDpidUtil::kBins-1)); // get nice histos with bin center at 0 and 1 - TH1 *h = 0x0; + TH1 *h = NULL; const Int_t kNmethodsPID=Int_t(sizeof(fgMethod)/sizeof(Char_t*)); // histos with posterior probabilities for all particle species @@ -427,7 +448,9 @@ TH1 *AliTRDcheckPID::PlotESD(const AliTRDtrackV1 *track) AliWarning("No Histogram defined."); return NULL; } - + + AliTRDpidInfo *pid = new AliTRDpidInfo(); + fPID->Add(pid); hPID->Fill(FindBin(species, momentum), pidESD[is]); } return hPID; @@ -475,7 +498,7 @@ TH1 *AliTRDcheckPID::PlotdEdx(const AliTRDtrackV1 *track) // (const_cast(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(kFALSE); Float_t sumdEdx = 0; Int_t iBin = FindBin(species, momentum); - AliTRDseedV1 *tracklet = 0x0; + AliTRDseedV1 *tracklet = NULL; for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ sumdEdx = 0; tracklet = cTrack.GetTracklet(iChamb); @@ -530,7 +553,7 @@ TH1 *AliTRDcheckPID::PlotdEdxSlice(const AliTRDtrackV1 *track) Int_t iMomBin = fMomentumAxis->FindBin(momentum); Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); Float_t *fdEdx; - AliTRDseedV1 *tracklet = 0x0; + AliTRDseedV1 *tracklet = NULL; for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ tracklet = cTrack.GetTracklet(iChamb); if(!tracklet) continue; @@ -560,7 +583,7 @@ TH1 *AliTRDcheckPID::PlotPH(const AliTRDtrackV1 *track) if(!CheckTrackQuality(fkTrack)) return NULL; - TObjArray *arr = 0x0; + TObjArray *arr = NULL; TProfile2D *hPHX, *hPHT; if(!(arr = dynamic_cast(fContainer->At(kPH)))){ AliWarning("No Histogram defined."); @@ -583,8 +606,8 @@ TH1 *AliTRDcheckPID::PlotPH(const AliTRDtrackV1 *track) } if(!IsInRange(momentum)) return NULL;; - AliTRDseedV1 *tracklet = 0x0; - AliTRDcluster *cluster = 0x0; + AliTRDseedV1 *tracklet = NULL; + AliTRDcluster *cluster = NULL; Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); Int_t iBin = FindBin(species, momentum); for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ @@ -639,7 +662,7 @@ TH1 *AliTRDcheckPID::PlotNClus(const AliTRDtrackV1 *track) Int_t species = AliTRDpidUtil::AliTRDpidUtil::Pdg2Pid(pdg); Int_t iBin = FindBin(species, momentum); - AliTRDseedV1 *tracklet = 0x0; + AliTRDseedV1 *tracklet = NULL; for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ tracklet = fkTrack->GetTracklet(iChamb); if(!tracklet) continue; @@ -772,12 +795,12 @@ Bool_t AliTRDcheckPID::GetRefFigure(Int_t ifig) // Steering function to retrieve performance plots Bool_t kFIRST = kTRUE; - TGraphErrors *g = 0x0; - TAxis *ax = 0x0; - TObjArray *arr = 0x0; - TH1 *h1 = 0x0, *h=0x0; - TH2 *h2 = 0x0; - TList *content = 0x0; + TGraphErrors *g = NULL; + TAxis *ax = NULL; + TObjArray *arr = NULL; + TH1 *h1 = NULL, *h=NULL; + TH2 *h2 = NULL; + TList *content = NULL; switch(ifig){ case kEfficiency:{ gPad->Divide(2, 1, 1.e-5, 1.e-5); diff --git a/PWG1/TRD/AliTRDcheckPID.h b/PWG1/TRD/AliTRDcheckPID.h index 456c148..38037fd 100644 --- a/PWG1/TRD/AliTRDcheckPID.h +++ b/PWG1/TRD/AliTRDcheckPID.h @@ -49,6 +49,7 @@ public: virtual void CreateOutputObjects(); virtual Bool_t GetRefFigure(Int_t ifig); + virtual void Exec(Option_t *opt); virtual Bool_t PostProcess(); TH1 *PlotLQ(const AliTRDtrackV1 *track = 0x0); @@ -84,6 +85,7 @@ private: AliTRDReconstructor *fReconstructor; //! reconstructor needed for recalculation the PID AliTRDpidUtil *fUtil; //! utility class for PID calculations TObjArray *fGraph; //! array of graphs filled in PostProcess + TObjArray *fPID; //! array of PID info/track for calibration TObjArray *fEfficiency[AliPID::kSPECIES]; //! array of histograms with efficiency TAxis *fMomentumAxis; //! helper mementum binning Int_t fMinNTracklets; // minimum number of required Tracklets (for systematic studies) diff --git a/PWG1/TRD/AliTRDpidRefMaker.cxx b/PWG1/TRD/AliTRDpidRefMaker.cxx index be8d4e6..b6d01e1 100644 --- a/PWG1/TRD/AliTRDpidRefMaker.cxx +++ b/PWG1/TRD/AliTRDpidRefMaker.cxx @@ -36,7 +36,7 @@ ClassImp(AliTRDpidRefMaker::AliTRDpidRefDataArray) //________________________________________________________________________ AliTRDpidRefMaker::AliTRDpidRefDataArray::AliTRDpidRefDataArray() : fNtracklets(0) - ,fData(0x0) + ,fData(NULL) { // Constructor of data array fData = new AliTRDpidRefData[AliTRDgeometry::kNlayer]; @@ -74,10 +74,11 @@ void AliTRDpidRefMaker::AliTRDpidRefDataArray::Reset() //________________________________________________________________________ AliTRDpidRefMaker::AliTRDpidRefMaker(const char *name, const char *title) :AliTRDrecoTask(name, title) - ,fReconstructor(0x0) - ,fV0s(0x0) - ,fData(0x0) - ,fPIDdataArray(0x0) + ,fReconstructor(NULL) + ,fV0s(NULL) + ,fData(NULL) + ,fInfo(NULL) + ,fPIDdataArray(NULL) ,fRefPID(kMC) ,fRefP(kMC) ,fPIDbin(0xff) @@ -95,6 +96,7 @@ AliTRDpidRefMaker::AliTRDpidRefMaker(const char *name, const char *title) memset(fPID, 0, AliPID::kSPECIES*sizeof(Float_t)); DefineInput(1, TObjArray::Class()); + DefineInput(2, TObjArray::Class()); DefineOutput(1, TTree::Class()); } @@ -127,8 +129,9 @@ Float_t* AliTRDpidRefMaker::CookdEdx(AliTRDseedV1 *trklt) void AliTRDpidRefMaker::ConnectInputData(Option_t *opt) { AliTRDrecoTask::ConnectInputData(opt); - fV0s = dynamic_cast(GetInputData(1)); -} + fV0s = dynamic_cast(GetInputData(1)); + fInfo = dynamic_cast(GetInputData(2)); +} //________________________________________________________________________ void AliTRDpidRefMaker::CreateOutputObjects() @@ -161,10 +164,10 @@ void AliTRDpidRefMaker::Exec(Option_t *) // Main loop // Called for each event - AliTRDtrackInfo *track = 0x0; - AliTRDtrackV1 *trackTRD = 0x0; - AliTrackReference *ref = 0x0; - const AliTRDtrackInfo::AliESDinfo *infoESD = 0x0; + AliTRDtrackInfo *track = NULL; + AliTRDtrackV1 *trackTRD = NULL; + AliTrackReference *ref = NULL; + const AliTRDtrackInfo::AliESDinfo *infoESD = NULL; for(Int_t itrk=0; itrkGetEntriesFast(); itrk++){ track = (AliTRDtrackInfo*)fTracks->UncheckedAt(itrk); if(!track->HasESDtrack()) continue; @@ -192,7 +195,7 @@ void AliTRDpidRefMaker::Exec(Option_t *) // fill P & dE/dx information if(HasFriends()){ // from TRD track if(!trackTRD) continue; - AliTRDseedV1 *trackletTRD(0x0); + AliTRDseedV1 *trackletTRD(NULL); trackTRD -> SetReconstructor(fReconstructor); if(!(trackletTRD = trackTRD -> GetTracklet(ily))) continue; if(!CheckQuality(trackletTRD)) continue; diff --git a/PWG1/TRD/AliTRDpidRefMaker.h b/PWG1/TRD/AliTRDpidRefMaker.h index bb92e46..9110096 100644 --- a/PWG1/TRD/AliTRDpidRefMaker.h +++ b/PWG1/TRD/AliTRDpidRefMaker.h @@ -100,6 +100,7 @@ protected: AliTRDReconstructor *fReconstructor; //! reconstructor needed for recalculation the PID TObjArray *fV0s; //! v0 array TTree *fData; //! dEdx-P data + TObjArray *fInfo; //! list of PID info AliTRDpidRefDataArray *fPIDdataArray; //! pid data array ETRDpidRefMakerSource fRefPID; // reference PID source ETRDpidRefMakerSource fRefP; // reference momentum source diff --git a/PWG1/TRD/AliTRDpidRefMakerLQ.cxx b/PWG1/TRD/AliTRDpidRefMakerLQ.cxx index ec96330..bd58d63 100644 --- a/PWG1/TRD/AliTRDpidRefMakerLQ.cxx +++ b/PWG1/TRD/AliTRDpidRefMakerLQ.cxx @@ -21,26 +21,21 @@ // TRD calibration class for building reference data for PID // - 2D reference histograms (responsible A.Bercuci) // - 3D reference histograms (not yet implemented) (responsible A.Bercuci) -// - Neural Network (responsible A.Wilk) // // Origin // Alex Bercuci (A.Bercuci@gsi.de) // /////////////////////////////////////////////////////////////////////////////// -#include +#include #include +#include #include #include #include #include #include -#include -//#include -//#include #include -//#include -//#include #include "AliLog.h" #include "../STAT/TKDPDF.h" @@ -54,8 +49,8 @@ ClassImp(AliTRDpidRefMakerLQ) //__________________________________________________________________ -AliTRDpidRefMakerLQ::AliTRDpidRefMakerLQ() - :AliTRDpidRefMaker("PIDrefMakerLQ", "PID(LQ) Reference Maker") +AliTRDpidRefMakerLQ::AliTRDpidRefMakerLQ() : + AliTRDpidRefMaker("PIDrefMakerLQ", "PID(LQ) Reference Maker") { // // AliTRDpidRefMakerLQ default constructor @@ -70,45 +65,46 @@ AliTRDpidRefMakerLQ::~AliTRDpidRefMakerLQ() // } -//________________________________________________________________________ +// //________________________________________________________________________ void AliTRDpidRefMakerLQ::CreateOutputObjects() { // Create histograms // Called once - AliTRDpidRefMaker::CreateOutputObjects(); + //OpenFile(0, "RECREATE"); + fContainer = Histos(); +} + + +//__________________________________________________________________ +TObjArray* AliTRDpidRefMakerLQ::Histos() +{ + // Create histograms + + if(fContainer) return fContainer; + + fContainer = new TObjArray(AliTRDCalPID::kNMom); + //fContainer->SetOwner(kTRUE); + //fContainer->SetName(Form("Moni%s", GetName())); // save dE/dx references TH2 *h2 = 0x0; for(Int_t ip=AliTRDCalPID::kNMom; ip--;){ TObjArray *arr = new TObjArray(AliPID::kSPECIES); - arr->SetName(Form("Pbin%02d", ip)); + arr->SetName(Form("Pbin%02d", ip)); arr->SetOwner(); for(Int_t is=AliPID::kSPECIES; is--;) { - h2 = new TH2D(Form("h%s%d", AliPID::ParticleShortName(is), ip), Form("%s ref. dEdx @ Pbin[%d]", AliPID::ParticleName(is), ip), 50, 5., 10., 50, 5., 10.); + h2 = new TH2D(Form("h%s%d", AliPID::ParticleShortName(is), ip), Form("%s @ Pbin[%d]", AliPID::ParticleName(is), ip), 50, 5., 10., 50, 5., 10.); h2->GetXaxis()->SetTitle("log(dE/dx_{am}) [au]"); h2->GetYaxis()->SetTitle("log(dE/dx_{dr}) [au]"); h2->GetZaxis()->SetTitle("#"); arr->AddAt(h2, is); } - fContainer->AddAt(arr, 1+ip); + fContainer->AddAt(arr, ip); } + fNRefFigures=AliTRDCalPID::kNMom; + return fContainer; } -/* -//________________________________________________________________________ -Float_t* AliTRDpidRefMakerLQ::CookdEdx(AliTRDseedV1 *trklt) -{ -// Fill dEdx array for multidim LQ PID - - trklt->CookdEdx(AliTRDpidUtil::kLQslices); - const Float_t *dedx = trklt->GetdEdx(); - if(dedx[0]+dedx[1] <= 0.) return 0x0; - if(dedx[2] <= 0.) return 0x0; - - fdEdx[0] = TMath::Log(dedx[0]+dedx[1]); - fdEdx[1] = TMath::Log(dedx[2]); - return fdEdx; -}*/ //__________________________________________________________________ TObject* AliTRDpidRefMakerLQ::GetOCDBEntry(Option_t *opt) @@ -128,7 +124,7 @@ Bool_t AliTRDpidRefMakerLQ::GetRefFigure(Int_t ifig) { // Steering reference picture - if(ifig<0 || ifig>AliTRDCalPID::kNMom-1){ + if(ifig<0 || ifig>=fNRefFigures){ AliError("Ref fig requested outside definition."); return kFALSE; } @@ -137,18 +133,71 @@ Bool_t AliTRDpidRefMakerLQ::GetRefFigure(Int_t ifig) return kFALSE; } - TObjArray *arr = (TObjArray*)fContainer->At(ifig); - gPad->Divide(3, 2, 1.e-5, 1.e-5); - TList *l=gPad->GetListOfPrimitives(); - for(Int_t is=0; isAt(is))->cd(); - ((TH2*)arr->At(is))->Draw("cont4z"); + TObjArray *arr(NULL);TList *l(NULL);TH2 *h2(NULL); + switch(ifig){ + case 0: // PDG plot + if(!(h2=(TH2*)fContainer->At(0))){ + AliError("Abundance Plot missing."); + return kFALSE; + } + h2->Draw("cont4z"); + break; + default: + if(!(arr = (TObjArray*)fContainer->At(ifig))){ + AliError(Form("2D container @ pBin[%d] missing.", ifig-1)); + return kFALSE; + } + gPad->Divide(3, 2, 1.e-5, 1.e-5);l=gPad->GetListOfPrimitives(); + for(Int_t is=0; isAt(is))->cd(); + if(!(h2=(TH2*)arr->At(is))){ + AliError(Form("2D for %s @ pBin[%d] missing.", AliPID::ParticleShortName(is), ifig-1)); + return kFALSE; + } + h2->Draw("cont4z"); + } + } + return kTRUE; +} + + +//________________________________________________________________________ +Bool_t AliTRDpidRefMakerLQ::Load(const Char_t */*fname*/) +{ + const Char_t *name("PIDrefMaker"); + if(gSystem->AccessPathName(Form("TRD.Calib%s.root", name), kReadPermission)){ + AliError(Form("File TRD.Calib%s.root not readable", name)); + return kFALSE; + } + if(!TFile::Open(Form("TRD.Calib%s.root", name))){ + AliError(Form("File TRD.Calib%s.root corrupted", name)); + return kFALSE; + } + if (!(fData = dynamic_cast(gFile->Get(name)))) { + AliError(Form("Tree %s not available", name)); + return kFALSE; } + LinkPIDdata(); + TObjArray *o(NULL); + if(!(o = (TObjArray*)gFile->Get(Form("Moni%s", name)))){ + AliWarning(Form("Monitor container Moni%s not available.", name)); + return kFALSE; + } + fContainer = (TObjArray*)o->Clone("monitor"); return kTRUE; } //________________________________________________________________________ +void AliTRDpidRefMakerLQ::Exec(Option_t */*opt*/) +{ +// Mock up function to load PID data into local data storage + AliInfo(Form("fInfo[%d]\n", fInfo->GetEntriesFast())); + PostData(0, fContainer); +} + + +//________________________________________________________________________ Bool_t AliTRDpidRefMakerLQ::PostProcess() { // Analyse merged dedx = f(p) distributions. @@ -159,20 +208,6 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() // - write pdf to file for loading to OCDB // - - TFile *fCalib = TFile::Open(Form("TRD.Calib%s.root", GetName()), "update"); - fData = dynamic_cast(gFile->Get(GetName())); - if (!fData) { - AliError("Calibration data not available"); - return kFALSE; - } - TObjArray *o = 0x0; - if(!(o = (TObjArray*)gFile->Get(Form("Moni%s", GetName())))){ - AliWarning("Missing monitoring container."); - return kFALSE; - } - fContainer = (TObjArray*)o->Clone("monitor"); - TDatime d; TDirectoryFile *pdfs = new TDirectoryFile(Form("PDF_%d", d.GetDate()), "PDFs for LQ TRD-PID", "", gFile); pdfs->Write(); @@ -180,10 +215,10 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() pdfs->cd(); //TCanvas *cc = new TCanvas("cc", "", 500, 500); - LinkPIDdata(); - Float_t *data[] = {0x0, 0x0}; - // allocate storage - data[0] = new Float_t[kMaxStat];data[1] = new Float_t[kMaxStat]; + // allocate working storage + Float_t *data[] = { + new Float_t[kMaxStat], + new Float_t[kMaxStat]}; for(Int_t ip=AliTRDCalPID::kNMom; ip--; ){ for(Int_t is=AliPID::kSPECIES; is--;) { Int_t n(0); // index of data @@ -264,7 +299,7 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() } delete [] data[0]; delete [] data[1]; pdfs->Write(); - fCalib->Close(); delete fCalib; + //fCalib->Close(); delete fCalib; return kTRUE; // testing protection } diff --git a/PWG1/TRD/AliTRDpidRefMakerLQ.h b/PWG1/TRD/AliTRDpidRefMakerLQ.h index a791a2c..4a64e8e 100644 --- a/PWG1/TRD/AliTRDpidRefMakerLQ.h +++ b/PWG1/TRD/AliTRDpidRefMakerLQ.h @@ -34,17 +34,19 @@ public: }; AliTRDpidRefMakerLQ(); ~AliTRDpidRefMakerLQ(); - - void CreateOutputObjects(); - TObject* GetOCDBEntry(Option_t *opt); - Bool_t GetRefFigure(Int_t ifig); - Bool_t PostProcess(); + + void CreateOutputObjects(); + void Exec(Option_t *opt); + TObject* GetOCDBEntry(Option_t *opt); + Bool_t GetRefFigure(Int_t ifig); + TObjArray* Histos(); + Bool_t Load(const Char_t *filename = "TRD.CalibPIDrefMaker.root"); + Bool_t PostProcess(); private: AliTRDpidRefMakerLQ(const AliTRDpidRefMakerLQ &ref); AliTRDpidRefMakerLQ& operator=(const AliTRDpidRefMakerLQ &ref); -private: ClassDef(AliTRDpidRefMakerLQ, 5) // Reference builder for Multidim-LQ TRD-PID }; diff --git a/PWG1/TRD/AliTRDrecoTask.h b/PWG1/TRD/AliTRDrecoTask.h index 66d2805..5d9448e 100644 --- a/PWG1/TRD/AliTRDrecoTask.h +++ b/PWG1/TRD/AliTRDrecoTask.h @@ -38,7 +38,7 @@ public: void ConnectInputData(Option_t *); virtual void CreateOutputObjects() = 0; - virtual void Exec(Option_t *); + virtual void Exec(Option_t *opt); Int_t GetNRefFigures() const { return fNRefFigures; } TList* GetPlotFunctors() const { return fPlotFuncList;} diff --git a/PWG1/TRD/AliTRDresolution.cxx b/PWG1/TRD/AliTRDresolution.cxx index a8c7ce5..93eb6d7 100644 --- a/PWG1/TRD/AliTRDresolution.cxx +++ b/PWG1/TRD/AliTRDresolution.cxx @@ -158,14 +158,14 @@ AliTRDresolution::AliTRDresolution() :AliTRDrecoTask("resolution", "Spatial and momentum TRD resolution checker") ,fStatus(0) ,fIdxPlot(0) - ,fReconstructor(0x0) - ,fGeo(0x0) - ,fGraphS(0x0) - ,fGraphM(0x0) - ,fCl(0x0) - ,fTrklt(0x0) - ,fMCcl(0x0) - ,fMCtrklt(0x0) + ,fReconstructor(NULL) + ,fGeo(NULL) + ,fGraphS(NULL) + ,fGraphM(NULL) + ,fCl(NULL) + ,fTrklt(NULL) + ,fMCcl(NULL) + ,fMCtrklt(NULL) { // // Default constructor @@ -250,17 +250,17 @@ TH1* AliTRDresolution::PlotCharge(const AliTRDtrackV1 *track) if(track) fkTrack = track; if(!fkTrack){ AliWarning("No Track defined."); - return 0x0; + return NULL; } - TObjArray *arr = 0x0; + TObjArray *arr = NULL; if(!(arr = ((TObjArray*)fContainer->At(kCharge)))){ AliWarning("No output container defined."); - return 0x0; + return NULL; } - TH3S* h = 0x0; + TH3S* h = NULL; - AliTRDseedV1 *fTracklet = 0x0; - AliTRDcluster *c = 0x0; + AliTRDseedV1 *fTracklet = NULL; + AliTRDcluster *c = NULL; for(Int_t ily=0; ilyGetTracklet(ily))) continue; if(!fTracklet->IsOK()) continue; @@ -295,18 +295,18 @@ TH1* AliTRDresolution::PlotCluster(const AliTRDtrackV1 *track) if(track) fkTrack = track; if(!fkTrack){ AliWarning("No Track defined."); - return 0x0; + return NULL; } - TObjArray *arr = 0x0; + TObjArray *arr = NULL; if(!(arr = ((TObjArray*)fContainer->At(kCluster)))){ AliWarning("No output container defined."); - return 0x0; + return NULL; } ULong_t status = fkESD ? fkESD->GetStatus():0; Double_t cov[7]; Float_t x0, y0, z0, dy, dydx, dzdx; - AliTRDseedV1 *fTracklet = 0x0; + AliTRDseedV1 *fTracklet = NULL; for(Int_t ily=0; ilyGetTracklet(ily))) continue; if(!fTracklet->IsOK()) continue; @@ -319,7 +319,7 @@ TH1* AliTRDresolution::PlotCluster(const AliTRDtrackV1 *track) dzdx = fTracklet->GetZref(1); fTracklet->GetCovRef(cov); Float_t tilt = fTracklet->GetTilt(); - AliTRDcluster *c = 0x0; + AliTRDcluster *c = NULL; fTracklet->ResetClusterIter(kFALSE); while((c = fTracklet->PrevCluster())){ Float_t xc = c->GetX(); @@ -379,17 +379,17 @@ TH1* AliTRDresolution::PlotTracklet(const AliTRDtrackV1 *track) if(track) fkTrack = track; if(!fkTrack){ AliWarning("No Track defined."); - return 0x0; + return NULL; } - TObjArray *arr = 0x0; + TObjArray *arr = NULL; if(!(arr = (TObjArray*)fContainer->At(kTrackTRD ))){ AliWarning("No output container defined."); - return 0x0; + return NULL; } Double_t cov[3], covR[7]/*, sqr[3], inv[3]*/; Float_t x, dx, dy, dz; - AliTRDseedV1 *fTracklet = 0x0; + AliTRDseedV1 *fTracklet = NULL; for(Int_t il=AliTRDgeometry::kNlayer; il--;){ if(!(fTracklet = fkTrack->GetTracklet(il))) continue; if(!fTracklet->IsOK()) continue; @@ -439,24 +439,24 @@ TH1* AliTRDresolution::PlotTrackTPC(const AliTRDtrackV1 *track) if(track) fkTrack = track; if(!fkTrack){ AliWarning("No Track defined."); - return 0x0; + return NULL; } - AliExternalTrackParam *tin = 0x0; + AliExternalTrackParam *tin = NULL; if(!(tin = fkTrack->GetTrackLow())){ AliWarning("Track did not entered TRD fiducial volume."); - return 0x0; + return NULL; } - TH1 *h = 0x0; + TH1 *h = NULL; Double_t x = tin->GetX(); - AliTRDseedV1 *tracklet = 0x0; + AliTRDseedV1 *tracklet = NULL; for(Int_t ily=0; ilyGetTracklet(ily))) continue; break; } if(!tracklet || TMath::Abs(x-tracklet->GetX())>1.e-3){ AliWarning("Tracklet did not match TRD entrance."); - return 0x0; + return NULL; } const Int_t kNPAR(5); Double_t parR[kNPAR]; memcpy(parR, tin->GetParameter(), kNPAR*sizeof(Double_t)); @@ -576,15 +576,15 @@ TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track) if(!HasMCdata()){ AliWarning("No MC defined. Results will not be available."); - return 0x0; + return NULL; } if(track) fkTrack = track; if(!fkTrack){ AliWarning("No Track defined."); - return 0x0; + return NULL; } - TObjArray *arr = 0x0; - TH1 *h = 0x0; + TObjArray *arr = NULL; + TH1 *h = NULL; UChar_t s; Int_t pdg = fkMC->GetPDG(), det=-1; Int_t label = fkMC->GetLabel(); @@ -613,7 +613,7 @@ TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track) } AliTRDReconstructor rec; - AliTRDseedV1 *fTracklet = 0x0; + AliTRDseedV1 *fTracklet = NULL; for(Int_t ily=0; ilyGetTracklet(ily)))/* || !fTracklet->IsOK())*/ continue; @@ -751,7 +751,7 @@ TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track) //Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(1.5); arr = (TObjArray*)fContainer->At(kMCcluster); - AliTRDcluster *c = 0x0; + AliTRDcluster *c = NULL; fTracklet->ResetClusterIter(kFALSE); while((c = fTracklet->PrevCluster())){ Float_t q = TMath::Abs(c->GetQ()); @@ -806,7 +806,7 @@ Bool_t AliTRDresolution::GetRefFigure(Int_t ifig) AliWarning("Please provide a canvas to draw results."); return kFALSE; } - TList *l = 0x0; TVirtualPad *pad=0x0; + TList *l = NULL; TVirtualPad *pad=NULL; switch(ifig){ case kCharge: gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives(); @@ -1038,9 +1038,9 @@ Bool_t AliTRDresolution::PostProcess() AliError("ERROR: list not available"); return kFALSE; } - TGraph *gm= 0x0, *gs= 0x0; + TGraph *gm= NULL, *gs= NULL; if(!fGraphS && !fGraphM){ - TObjArray *aM(0x0), *aS(0x0), *a(0x0); + TObjArray *aM(NULL), *aS(NULL), *a(NULL); Int_t n = fContainer->GetEntriesFast(); fGraphS = new TObjArray(n); fGraphS->SetOwner(); fGraphM = new TObjArray(n); fGraphM->SetOwner(); @@ -1251,8 +1251,8 @@ TObjArray* AliTRDresolution::Histos() fContainer = new TObjArray(kNhistos); //fContainer->SetOwner(kTRUE); - TH1 *h = 0x0; - TObjArray *arr = 0x0; + TH1 *h = NULL; + TObjArray *arr = NULL; const Int_t kPbins(12); // binning in momentum range should depend on the statistics analyzed @@ -1505,7 +1505,7 @@ TObjArray* AliTRDresolution::Histos() arr->AddAt(h, 7); // Kalman track Pt resolution const Int_t n = AliPID::kSPECIES; - TObjArray *arr2 = 0x0; TH3S* h3=0x0; + TObjArray *arr2 = NULL; TH3S* h3=NULL; arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 8); arr2->SetName("Track Pt Resolution"); for(Int_t il=0; ilGetEntriesFast(); ix++){ if(!(h3 = (TH3S*)arr->At(ix))) return kFALSE; if(!(gm[1] = (TObjArray*)gm[0]->At(ix))) return kFALSE; @@ -1866,7 +1866,7 @@ Bool_t AliTRDresolution::GetGraphPlot(Float_t *bb, ETRDresolutionPlot ip, Int_t } // axis range - TAxis *ax = 0x0; + TAxis *ax = NULL; ax = gs->GetHistogram()->GetXaxis(); ax->SetRangeUser(bb[0], bb[2]); ax->SetTitle(at[1]);ax->CenterTitle(); @@ -1876,7 +1876,7 @@ Bool_t AliTRDresolution::GetGraphPlot(Float_t *bb, ETRDresolutionPlot ip, Int_t ax->SetTitleOffset(1.1); ax->SetTitle(at[2]);ax->CenterTitle(); - TGaxis *gax = 0x0; + TGaxis *gax = NULL; gax = new TGaxis(bb[2], bb[1], bb[2], bb[3], bb[1], bb[3], 510, "+U"); gax->SetLineColor(kRed);gax->SetLineWidth(2);gax->SetTextColor(kRed); //gax->SetVertical(); @@ -1907,8 +1907,8 @@ Bool_t AliTRDresolution::GetGraphTrack(Float_t *bb, Int_t idx, Int_t il) for(Int_t jc=0; jcAt(kMCtrackTRD); a0 = a1; a1 = (TObjArray*)a0->At(idx); a0 = a1; a1 = (TObjArray*)a0->At(il); a0 = a1; @@ -1933,7 +1933,7 @@ Bool_t AliTRDresolution::GetGraphTrack(Float_t *bb, Int_t idx, Int_t il) ax->SetTitleOffset(.5);ax->SetTitleSize(.06); ax->SetTitle(at[2]);ax->CenterTitle(); - TGaxis *gax = 0x0; + TGaxis *gax = NULL; gax = new TGaxis(bb[2], bb[1], bb[2], bb[3], bb[1], bb[3], 510, "+U"); gax->SetLineColor(kRed);gax->SetLineWidth(2);gax->SetTextColor(kRed); //gax->SetVertical(); @@ -1972,8 +1972,8 @@ Bool_t AliTRDresolution::GetGraphTrackTPC(Float_t *bb, Int_t sel) for(Int_t jc=0; jcAt(kMCtrackTPC); a0 = a1; a1 = (TObjArray*)a0->At(sel); a0 = a1; for(Int_t is=AliPID::kSPECIES; is--;){ @@ -1996,7 +1996,7 @@ Bool_t AliTRDresolution::GetGraphTrackTPC(Float_t *bb, Int_t sel) ax->SetTitleOffset(1.);ax->SetTitleSize(0.05); ax->SetTitle(at[2]);ax->CenterTitle(); - TGaxis *gax = 0x0; + TGaxis *gax = NULL; gax = new TGaxis(bb[2], bb[1], bb[2], bb[3], bb[1], bb[3], 510, "+U"); gax->SetLineColor(kRed);gax->SetLineWidth(2);gax->SetTextColor(kRed); //gax->SetVertical(); diff --git a/PWG1/TRD/info/AliTRDpidInfo.cxx b/PWG1/TRD/info/AliTRDpidInfo.cxx new file mode 100644 index 0000000..d59abb1 --- /dev/null +++ b/PWG1/TRD/info/AliTRDpidInfo.cxx @@ -0,0 +1,53 @@ +#include "AliTRDpidInfo.h" +#include "AliTRDgeometry.h" + +#include "string.h" + +ClassImp(AliTRDpidInfo) +ClassImp(AliTRDpidInfo::AliTRDpidData) + +//________________________________________________________________________ +AliTRDpidInfo::AliTRDpidData::AliTRDpidData() : fPLbin(0xff) +{ + memset(fdEdx, 0, 8*sizeof(Float_t)); +} + +//________________________________________________________________________ +AliTRDpidInfo::AliTRDpidInfo() : + TObject() + , fNtracklets(0) + ,fData(0x0) +{ + // Constructor of data array + fData = new AliTRDpidData[AliTRDgeometry::kNlayer]; +} + +//________________________________________________________________________ +AliTRDpidInfo::~AliTRDpidInfo() +{ + // Destructor + delete [] fData; +} + +//________________________________________________________________________ +void AliTRDpidInfo::PushBack(Int_t ly, Int_t p, Float_t *dedx) +{ +// Add PID data to the end of the array + fData[fNtracklets].fPLbin= (ly<<4) | (p&0xf); + memcpy(fData[fNtracklets].fdEdx, dedx, 8*sizeof(Float_t)); + fNtracklets++; +} + +//________________________________________________________________________ +void AliTRDpidInfo::Reset() +{ +// Reset content + + if(!fNtracklets) return; + while(fNtracklets--){ + fData[fNtracklets].fPLbin = 0xff; + memset(fData[fNtracklets].fdEdx, 0, 8*sizeof(Float_t)); + } + fNtracklets=0; +} + diff --git a/PWG1/TRD/info/AliTRDpidInfo.h b/PWG1/TRD/info/AliTRDpidInfo.h new file mode 100644 index 0000000..8087361 --- /dev/null +++ b/PWG1/TRD/info/AliTRDpidInfo.h @@ -0,0 +1,40 @@ +#ifndef ALITRDPIDINFO_H +#define ALITRDPIDINFO_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#ifndef ROOT_TObject +#include "TObject.h" +#endif + +class AliTRDpidInfo : public TObject +{ +public: + struct AliTRDpidData { + AliTRDpidData(); + virtual ~AliTRDpidData(){} + UChar_t fPLbin; // momentum / layer bin + Float_t fdEdx[8]; // dEdx array + ClassDef(AliTRDpidData, 1) // PID layer representation + }; + + AliTRDpidInfo(); + virtual ~AliTRDpidInfo(); + AliTRDpidData const* GetData() const { return fData;} + Int_t GetNtracklets() const { return fNtracklets;} + void PushBack(Int_t ly, Int_t p, Float_t *dedx); + void Reset(); + +private: + Int_t fNtracklets; // number of tracklets + AliTRDpidData *fData; //[fNtracklets] PID data array + + AliTRDpidInfo(const AliTRDpidInfo::AliTRDpidInfo& ref); + AliTRDpidInfo& operator=(const AliTRDpidInfo::AliTRDpidInfo& ref); + + ClassDef(AliTRDpidInfo, 1) // track PID data representation +}; + +#endif + diff --git a/PWG1/TRD/run.C b/PWG1/TRD/run.C index 346cad9..0d662e2 100644 --- a/PWG1/TRD/run.C +++ b/PWG1/TRD/run.C @@ -160,7 +160,7 @@ void run(Char_t *optList="ALL", const Char_t *files=0x0, Long64_t nev=1234567890 AliAnalysisTask *task=(AliAnalysisTask*)taskList->At(itask); printf(" %s [%s]\n", task->GetName(), task->GetTitle()); } - + //mgr->PrintStatus(); mgr->StartAnalysis("local", chain, nev, first); timer.Stop(); -- 1.7.1