From 684602c87d8bd23eafc5f5ad459c0f6b9561ed07 Mon Sep 17 00:00:00 2001 From: marian Date: Fri, 25 Jul 2008 09:14:18 +0000 Subject: [PATCH] (Marian Ivanov) AliTPCCalPadRegion - ::SetObject - Expand to max size AliTPCAnalysisTaskcalib - Remove unneccessary printing AliTPCcalibTracksGain - Adding angular and dr attenutaion fit - without chameber gain alignment AliTPCClusterParam - Cosmetic change --- TPC/AliTPCAnalysisTaskcalib.cxx | 2 +- TPC/AliTPCCalPadRegion.cxx | 7 +- TPC/AliTPCClusterParam.cxx | 3 +- TPC/AliTPCcalibTracksGain.cxx | 189 +++++++++++++++++++++++++++++--- TPC/AliTPCcalibTracksGain.h | 13 ++- 5 files changed, 194 insertions(+), 20 deletions(-) diff --git a/TPC/AliTPCAnalysisTaskcalib.cxx b/TPC/AliTPCAnalysisTaskcalib.cxx index c46b0ee27f0..9602687d71c 100644 --- a/TPC/AliTPCAnalysisTaskcalib.cxx +++ b/TPC/AliTPCAnalysisTaskcalib.cxx @@ -117,7 +117,7 @@ void AliTPCAnalysisTaskcalib::ConnectInputData(Option_t *) { } else { fESD = esdH->GetEvent(); - Printf("*** CONNECTED NEW EVENT ****"); + //Printf("*** CONNECTED NEW EVENT ****"); } } } diff --git a/TPC/AliTPCCalPadRegion.cxx b/TPC/AliTPCCalPadRegion.cxx index 33dc3ea34d7..7cd5601d892 100644 --- a/TPC/AliTPCCalPadRegion.cxx +++ b/TPC/AliTPCCalPadRegion.cxx @@ -84,9 +84,12 @@ AliTPCCalPadRegion& AliTPCCalPadRegion::operator=(const AliTPCCalPadRegion& rhs) void AliTPCCalPadRegion::SetObject(TObject* obj, UInt_t segment, UInt_t padType) -{ +{ + // + // Set the object for given segment + // if (BoundsOk("SetObject", segment, padType)){ - if (segment+fgkNSegments*padType>fObjects->GetEntriesFast()) fObjects->Expand(2*(segment+fgkNSegments*padType)); + if (segment+fgkNSegments*padType>fObjects->GetEntriesFast()) fObjects->Expand(fgkNSegments * fgkNPadTypes); fObjects->AddAt(obj, segment+fgkNSegments*padType); } } diff --git a/TPC/AliTPCClusterParam.cxx b/TPC/AliTPCClusterParam.cxx index 80f6d05e98d..dcf2430ee94 100644 --- a/TPC/AliTPCClusterParam.cxx +++ b/TPC/AliTPCClusterParam.cxx @@ -1254,7 +1254,8 @@ Float_t AliTPCClusterParam::Qnorm(Int_t ipad, Int_t itype, Float_t dr, Float_t t TVectorD * norm = (TVectorD*)fQNorm->At(3*itype+ipad); if (!norm) return 0; TVectorD &no = *norm; - Float_t res = no[0]+ + Float_t res = + no[0]+ no[1]*dr+ no[2]*ty+ no[3]*tz+ diff --git a/TPC/AliTPCcalibTracksGain.cxx b/TPC/AliTPCcalibTracksGain.cxx index 5ffef1af7dc..8a446b08d40 100644 --- a/TPC/AliTPCcalibTracksGain.cxx +++ b/TPC/AliTPCcalibTracksGain.cxx @@ -96,8 +96,72 @@ // the fitters after loading this object from file. // (This will be gone for a new ROOT version > v5-17-05) // +// +// In order to debug some numerical algorithm all data data which are used for +// fitters can be stored in the debug streamers. In case of fitting roblems the +// errors and tendencies can be checked. +// +// Debug Streamers: +// +// +// +// +// //////////////////////////////////////////////////////////////////////////// +/* + .x ~/UliStyle.C + gSystem->Load("libANALYSIS"); + gSystem->Load("libTPCcalib"); + TFile fcalib("CalibObjects.root"); + TObjArray * array = (TObjArray*)fcalib.Get("TPCCalib"); + AliTPCcalibTracksGain * gain = ( AliTPCcalibTracksGain *)array->FindObject("calibTracksGain"); + + // + // Make visual Tree - compare with Kr calibration + // + AliTPCCalPad * gain010 = gain->CreateFitCalPad(0,kTRUE,0); gain010->SetName("CGain010"); + AliTPCCalPad * gain110 = gain->CreateFitCalPad(1,kTRUE,0); gain110->SetName("CGain110"); + AliTPCCalPad * gain210 = gain->CreateFitCalPad(2,kTRUE,0); gain210->SetName("CGain210"); + TFile fkr("/u/akalweit/macros/GainCalibration/GainMap.root"); + AliTPCCalPad *gainKr = fkr.Get("GainMap"); fkr->SetName("KrGain"); + // + AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline; + preprocesor->AddComponent(gain010); + preprocesor->AddComponent(gain110); + preprocesor->AddComponent(gain210); + preprocesor->AddComponent(gainKr); + preprocesor->DumpToFile("cosmicGain.root"); + // + // + // + // Simple session using the debug streamers + // + + gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros"); + gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+") + AliXRDPROOFtoolkit tool; + + TChain * chain0 = tool.MakeChain("gain.txt","dEdx",0,1000000); + TChain * chain1 = tool.MakeChain("gain.txt","Track",0,1000000); + TChain * chain2 = tool.MakeChain("gain.txt","TrackG",0,1000000); + chain0->Lookup(); + chain1->Lookup(); + chain2->Lookup(); + + chain2->SetAlias("k1","1/0.855"); + chain2->SetAlias("k0","1/0.9928"); + chain2->SetAlias("k2","1/1.152"); + + + + +*/ + + + + + #include #include #include "TSystem.h" @@ -185,12 +249,21 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain() : fSimpleFitter(0), // simple fitter for short pads fSqrtFitter(0), // sqrt fitter for medium pads fLogFitter(0), // log fitter for long pads + fFitter0M(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter1M(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter2M(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter0T(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter1T(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter2T(0), // fitting of the atenuation, angular correction, and mean chamber gain + // + fDFitter0M(0), // fitting of the atenuation, angular correction + fDFitter1M(0), // fitting of the atenuation, angular correction + fDFitter2M(0), // fitting of the atenuation, angular correction + fDFitter0T(0), // fitting of the atenuation, angular correction + fDFitter1T(0), // fitting of the atenuation, angular correction + fDFitter2T(0), // fitting of the atenuation, angular correction + // fSingleSectorFitter(0), // just for debugging // // Counters @@ -231,6 +304,13 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj) : fFitter0T(obj.fFitter0T), fFitter1T(obj.fFitter1T), fFitter2T(obj.fFitter2T), + // + fDFitter0M(obj.fDFitter0M), + fDFitter1M(obj.fDFitter1M), + fDFitter2M(obj.fDFitter2M), + fDFitter0T(obj.fDFitter0T), + fDFitter1T(obj.fDFitter1T), + fDFitter2T(obj.fDFitter2T), fSingleSectorFitter(obj.fSingleSectorFitter), // just for debugging // // Counters @@ -290,6 +370,13 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const char* name, const char* title fFitter0T(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter1T(0), // fitting of the atenuation, angular correction, and mean chamber gain fFitter2T(0), // fitting of the atenuation, angular correction, and mean chamber gain + // + fDFitter0M(0), // fitting of the atenuation, angular correction + fDFitter1M(0), // fitting of the atenuation, angular correction + fDFitter2M(0), // fitting of the atenuation, angular correction + fDFitter0T(0), // fitting of the atenuation, angular correction + fDFitter1T(0), // fitting of the atenuation, angular correction + fDFitter2T(0), // fitting of the atenuation, angular correction fSingleSectorFitter(0), // just for debugging // // Counters @@ -323,6 +410,13 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const char* name, const char* title fFitter1T = new TLinearFitter(45,"hyp44"); fFitter2T = new TLinearFitter(45,"hyp44"); // + fDFitter0M = new TLinearFitter(10,"hyp9"); + fDFitter1M = new TLinearFitter(10,"hyp9"); + fDFitter2M = new TLinearFitter(10,"hyp9"); + fDFitter0T = new TLinearFitter(10,"hyp9"); + fDFitter1T = new TLinearFitter(10,"hyp9"); + fDFitter2T = new TLinearFitter(10,"hyp9"); + // // fFitter0M->StoreData(kFALSE); fFitter1M->StoreData(kFALSE); @@ -331,6 +425,13 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const char* name, const char* title fFitter1T->StoreData(kFALSE); fFitter2T->StoreData(kFALSE); // + fDFitter0M->StoreData(kFALSE); + fDFitter1M->StoreData(kFALSE); + fDFitter2M->StoreData(kFALSE); + fDFitter0T->StoreData(kFALSE); + fDFitter1T->StoreData(kFALSE); + fDFitter2T->StoreData(kFALSE); + // // // Add profile histograms -JUST for visualization - Not used for real calibration // @@ -427,7 +528,14 @@ void AliTPCcalibTracksGain::Process(AliTPCseed* seed) { fFitter0T = new TLinearFitter(45,"hyp44"); fFitter1T = new TLinearFitter(45,"hyp44"); fFitter2T = new TLinearFitter(45,"hyp44"); - doinit=kTRUE; + // + fDFitter0M = new TLinearFitter(10,"hyp9"); + fDFitter1M = new TLinearFitter(10,"hyp9"); + fDFitter2M = new TLinearFitter(10,"hyp9"); + fDFitter0T = new TLinearFitter(10,"hyp9"); + fDFitter1T = new TLinearFitter(10,"hyp9"); + fDFitter2T = new TLinearFitter(10,"hyp9"); + doinit=kFALSE; } //} @@ -490,6 +598,13 @@ void AliTPCcalibTracksGain::Add(AliTPCcalibTracksGain* cal) { fFitter1T->Add(cal->fFitter1T); fFitter2T->Add(cal->fFitter2T); // + fDFitter0M->Add(cal->fDFitter0M); + fDFitter1M->Add(cal->fDFitter1M); + fDFitter2M->Add(cal->fDFitter2M); + fDFitter0T->Add(cal->fDFitter0T); + fDFitter1T->Add(cal->fDFitter1T); + fDFitter2T->Add(cal->fDFitter2T); + // // // histograms // @@ -625,7 +740,7 @@ void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster, Float_t /*momen } if (dedge < 3.) return; - if (fraction2 > 0.7) return; + if (fraction2 > 0.9) return; //Int_t padType = GetPadType(cluster->GetX()); Double_t xx[7]; @@ -664,10 +779,19 @@ void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster, Float_t /*momen Double_t sqrtQ = TMath::Sqrt(q); Double_t logQ = fgkM * TMath::Log(1 + q / fgkM); - fSimpleFitter->GetFitter(segment, padType)->AddPoint(xx, q); - fSqrtFitter->GetFitter(segment, padType)->AddPoint(xx, sqrtQ); - fLogFitter->GetFitter(segment, padType)->AddPoint(xx, logQ); - fSingleSectorFitter->GetFitter(0, padType)->AddPoint(xx, q); + TLinearFitter * fitter =0; + // + fitter = fSimpleFitter->GetFitter(segment, padType); + fitter->AddPoint(xx, q); + // + fitter = fSqrtFitter->GetFitter(segment, padType); + fitter->AddPoint(xx, sqrtQ); + // + fitter = fLogFitter->GetFitter(segment, padType); + fitter->AddPoint(xx, logQ); + // + fitter=fSingleSectorFitter->GetFitter(0, padType); + fitter->AddPoint(xx, q); // this will be gone for the a new ROOT version > v5-17-05 if (padType == kShortPads) @@ -696,6 +820,13 @@ void AliTPCcalibTracksGain::Evaluate(Bool_t robust, Double_t frac) { fFitter0T->Eval(); fFitter1T->Eval(); fFitter2T->Eval(); + // + fDFitter0M->Eval(); + fDFitter1M->Eval(); + fDFitter2M->Eval(); + fDFitter0T->Eval(); + fDFitter1T->Eval(); + fDFitter2T->Eval(); } AliTPCCalPad* AliTPCcalibTracksGain::CreateFitCalPad(UInt_t fitType, Bool_t undoTransformation, Bool_t normalizeToPadSize) { @@ -841,15 +972,24 @@ AliTPCCalROC* AliTPCcalibTracksGain::CreateCombinedCalROC(const AliTPCCalROC* ro return roc; } -void AliTPCcalibTracksGain::GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam) { +Bool_t AliTPCcalibTracksGain::GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam) { // // Puts the fit parameters for the specified segment (IROC & OROC), padType and fitType // into the fitParam TVectorD (which should contain 8 elements). // padType is one of kShortPads, kMediumPads, kLongPads. fitType is one of kSimpleFitter, kSqrtFitter, kLogFitter. // Note: The fitter has to be evaluated first! // - - GetFitter(segment, padType, fitType)->GetParameters(fitParam); + TLinearFitter * fitter = GetFitter(segment, padType, fitType); + if (fitter){ + fitter->Eval(); + fitter->GetParameters(fitParam); + return kTRUE; + }else{ + Error("AliTPCcalibTracksGain::GetParameters", + Form("Fitter%d_%d_%d not availble", segment, padType, fitType)); + return kFALSE; + } + return kFALSE; } void AliTPCcalibTracksGain::GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError) { @@ -1062,6 +1202,8 @@ Bool_t AliTPCcalibTracksGain::GetDedx(AliTPCseed* track, Int_t padType, Int_t* / static TLinearFitter fitY(2, "pol1"); static TLinearFitter fitZ(2, "pol1"); + fitY.StoreData(kFALSE); + fitZ.StoreData(kFALSE); // // Int_t firstRow = 0, lastRow = 0; @@ -1279,6 +1421,16 @@ void AliTPCcalibTracksGain::AddTracklet(UInt_t sector, UInt_t padType,TVectorD & if (padType==1) fitterT = fFitter1T; if (padType==2) fitterT = fFitter2T; fitterT->AddPoint(xxx,dedxQ[1]); + // + TLinearFitter *dfitterM = fDFitter0M; + if (padType==1) dfitterM=fDFitter1M; + if (padType==2) dfitterM=fDFitter2M; + dfitterM->AddPoint(xxx,dedxM[1]); + // + TLinearFitter *dfitterT = fDFitter0T; + if (padType==1) dfitterT = fDFitter1T; + if (padType==2) dfitterT = fDFitter2T; + dfitterT->AddPoint(xxx,dedxQ[1]); } @@ -1323,19 +1475,26 @@ void AliTPCcalibTracksGain::UpdateClusterParam(AliTPCClusterParam* clparam){ // void SetQnorm(Int_t ipad, Int_t itype, TVectorD * norm); TVectorD vec; + // - fFitter0T->GetParameters(vec); + fDFitter0T->Eval(); + fDFitter1T->Eval(); + fDFitter2T->Eval(); + fDFitter0M->Eval(); + fDFitter1M->Eval(); + fDFitter2M->Eval(); + fDFitter0T->GetParameters(vec); clparam->SetQnorm(0,0,&vec); - fFitter1T->GetParameters(vec); + fDFitter1T->GetParameters(vec); clparam->SetQnorm(1,0,&vec); - fFitter2T->GetParameters(vec); + fDFitter2T->GetParameters(vec); clparam->SetQnorm(2,0,&vec); // - fFitter0M->GetParameters(vec); + fDFitter0M->GetParameters(vec); clparam->SetQnorm(0,1,&vec); - fFitter1M->GetParameters(vec); + fDFitter1M->GetParameters(vec); clparam->SetQnorm(1,1,&vec); - fFitter2M->GetParameters(vec); + fDFitter2M->GetParameters(vec); clparam->SetQnorm(2,1,&vec); // diff --git a/TPC/AliTPCcalibTracksGain.h b/TPC/AliTPCcalibTracksGain.h index 405e4cc1a46..926fe5f3efa 100644 --- a/TPC/AliTPCcalibTracksGain.h +++ b/TPC/AliTPCcalibTracksGain.h @@ -94,7 +94,7 @@ public: AliTPCCalROC* CreateCombinedCalROC(const AliTPCCalROC* roc1, const AliTPCCalROC* roc2); // void Evaluate(Bool_t robust = kFALSE, Double_t frac = -1.); - void GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam); + Bool_t GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam); void GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError); Double_t GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType); void GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix); @@ -132,12 +132,23 @@ public: AliTPCFitPad* fSimpleFitter; // simple fitter for short pads AliTPCFitPad* fSqrtFitter; // sqrt fitter for medium pads AliTPCFitPad* fLogFitter; // log fitter for long pads + // TLinearFitter* fFitter0M; // fitting of the atenuation, angular correction, and mean chamber gain TLinearFitter* fFitter1M; // fitting of the atenuation, angular correction, and mean chamber gain TLinearFitter* fFitter2M; // fitting of the atenuation, angular correction, and mean chamber gain TLinearFitter* fFitter0T; // fitting of the atenuation, angular correction, and mean chamber gain TLinearFitter* fFitter1T; // fitting of the atenuation, angular correction, and mean chamber gain TLinearFitter* fFitter2T; // fitting of the atenuation, angular correction, and mean chamber gain + // + // angular adn diffusion effect fitter + // + TLinearFitter* fDFitter0M; // fitting of the atenuation, angular correction + TLinearFitter* fDFitter1M; // fitting of the atenuation, angular correction + TLinearFitter* fDFitter2M; // fitting of the atenuation, angular correction + TLinearFitter* fDFitter0T; // fitting of the atenuation, angular correction + TLinearFitter* fDFitter1T; // fitting of the atenuation, angular correction + TLinearFitter* fDFitter2T; // fitting of the atenuation, angular correction + // AliTPCFitPad* fSingleSectorFitter; // just for debugging // // Conters -- 2.43.0