From 967eae0d923f4e1e3ea85b4ffc02252733e0e9e2 Mon Sep 17 00:00:00 2001 From: marian Date: Thu, 15 May 2008 17:42:07 +0000 Subject: [PATCH] Changes in order to correct fot edge effects changes (Marian) Currently only cut on distance to the edge AliTPCtracklet.h AliTPCtracklet.cxx Adding cut on distance to the edge macros/CalbrateTPC.C Adding possibility to use the Memory chcecker AliTPCcalibAlign.cxx AliTPCcalibAlign.h Adding functionality to monitor edge effects - currently only wirting to the debug stream --- TPC/AliTPCTracklet.cxx | 33 ++++++++++---- TPC/AliTPCTracklet.h | 12 +++++ TPC/AliTPCcalibAlign.cxx | 92 +++++++++++++++++++++++++++++++++++++-- TPC/AliTPCcalibAlign.h | 7 +++ TPC/macros/CalibrateTPC.C | 62 ++++++++++++++++---------- 5 files changed, 172 insertions(+), 34 deletions(-) diff --git a/TPC/AliTPCTracklet.cxx b/TPC/AliTPCTracklet.cxx index ab462722128..51a2b059ff7 100755 --- a/TPC/AliTPCTracklet.cxx +++ b/TPC/AliTPCTracklet.cxx @@ -37,6 +37,8 @@ using namespace std; ClassImp(AliTPCTracklet) const Double_t AliTPCTracklet::kB2C=0.299792458e-3; +Float_t AliTPCTracklet::fgEdgeCutY=3; +Float_t AliTPCTracklet::fgEdgeCutX=0; AliTPCTracklet::AliTPCTracklet() : fNClusters(0),fNStoredClusters(0),fClusters(0),fSector(-1),fOuter(0), @@ -59,7 +61,7 @@ AliTPCTracklet::AliTPCTracklet(const AliTPCseed *track,Int_t sector, for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=track->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c)) continue; if (c&&c->GetDetector()==sector) ++fNClusters; } @@ -68,7 +70,7 @@ AliTPCTracklet::AliTPCTracklet(const AliTPCseed *track,Int_t sector, fClusters=new AliTPCclusterMI[fNClusters]; for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=track->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c)) continue; if (c&&c->GetDetector()==sector) fClusters[fNStoredClusters]=*c; ++fNStoredClusters; @@ -194,7 +196,7 @@ void AliTPCTracklet::FitKalman(const AliTPCseed *track,Int_t sector) { Int_t n=0; for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=t->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c,outerSeed)) continue; if (c&&c->GetDetector()==sector) { if (n==1) { outerSeed->ResetCovariance(100.); @@ -218,7 +220,7 @@ void AliTPCTracklet::FitKalman(const AliTPCseed *track,Int_t sector) { n=0; for (Int_t i=159;i>=0;--i) { AliTPCclusterMI *c=t->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c, innerSeed)) continue; if (c&&c->GetDetector()==sector) { if (n==1) { innerSeed->ResetCovariance(100.); @@ -279,7 +281,7 @@ void AliTPCTracklet::FitLinear(const AliTPCseed *track,Int_t sector, Double_t xmin=1000.; for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=track->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c)) continue; if (c&&c->GetDetector()==sector) { Double_t x=c->GetX(); fy.AddPoint(&x,c->GetY()); @@ -389,7 +391,7 @@ void AliTPCTracklet::FitRiemann(const AliTPCseed *track,Int_t sector) { Double_t xmin=1000.; for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=track->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c)) continue; if (c&&c->GetDetector()==sector) { Double_t x=c->GetX(); Double_t y=c->GetY(); @@ -423,7 +425,7 @@ void AliTPCTracklet::FitRiemann(const AliTPCseed *track,Int_t sector) { Double_t phi=0.; for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=track->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c)) continue; if (c&&c->GetDetector()==sector) { Double_t x=c->GetX(); Double_t y=c->GetY(); @@ -514,7 +516,7 @@ TObjArray AliTPCTracklet::CreateTracklets(const AliTPCseed *track, Int_t sectors[72]={0}; for (Int_t i=0;i<160;++i) { AliTPCclusterMI *c=track->GetClusterPointer(i); - if (c && c->GetType()<0) continue; + if (c && RejectCluster(c)) continue; if (c) ++sectors[c->GetDetector()]; } @@ -711,3 +713,18 @@ void AliTPCTracklet::Test(const char* filename) { } */ } + + +Bool_t AliTPCTracklet::RejectCluster(AliTPCclusterMI* cl, AliExternalTrackParam * param){ + // + // check the acceptance of cluster + // Cut on edge effects + // + Bool_t isReject = kFALSE; + Float_t edgeY = cl->GetX()*TMath::Tan(TMath::Pi()/18); + Float_t dist = edgeY - TMath::Abs(cl->GetY()); + if (param) dist = edgeY - TMath::Abs(param->GetY()); + if (distGetType()<0) isReject=kTRUE; + return isReject; +} diff --git a/TPC/AliTPCTracklet.h b/TPC/AliTPCTracklet.h index efaab0d3277..d837727741a 100755 --- a/TPC/AliTPCTracklet.h +++ b/TPC/AliTPCTracklet.h @@ -69,9 +69,13 @@ public: Double_t *x); static TEllipse ErrorEllipse(Double_t x,Double_t y, Double_t sx,Double_t sy,Double_t sxy); + static inline void SetEdgeCut(Float_t edgeX, Float_t edgeY); private: + static Bool_t RejectCluster(AliTPCclusterMI* cl,AliExternalTrackParam * param=0); static const Double_t kB2C; //! ugly to have the track parametrised in a way, that constand is allways needed static double GetBz(Double_t *xyz); + static Float_t fgEdgeCutY; //cut on the edge effect in local Y + static Float_t fgEdgeCutX; //cut on the edge effect in local X void FitLinear(const AliTPCseed *track,Int_t sector,TrackType type); void FitKalman(const AliTPCseed *track,Int_t sector); void FitRiemann(const AliTPCseed *track,Int_t sector); @@ -94,4 +98,12 @@ private: ClassDef(AliTPCTracklet,1) }; + +void AliTPCTracklet::SetEdgeCut(Float_t edgeX, Float_t edgeY){ + // + // + fgEdgeCutY=edgeY; + fgEdgeCutX=edgeX; +} + #endif diff --git a/TPC/AliTPCcalibAlign.cxx b/TPC/AliTPCcalibAlign.cxx index ed31ff2fbb5..66ae44f8eec 100644 --- a/TPC/AliTPCcalibAlign.cxx +++ b/TPC/AliTPCcalibAlign.cxx @@ -18,6 +18,10 @@ // // // Class to make a internal alignemnt of TPC chambers // // +// Requierements - Warnings: +// 1. Before using this componenent the magnetic filed has to be set properly // +// 2. Teh systematic effects - unlinearities has to be understood +// // Different linear tranformation investigated // 12 parameters - arbitrary linear transformation @@ -48,6 +52,10 @@ #include "TFile.h" #include "TF1.h" #include "TGraphErrors.h" +#include "AliTPCclusterMI.h" +#include "AliTPCseed.h" +#include "AliTracker.h" +#include "TClonesArray.h" #include "TTreeStream.h" @@ -127,7 +135,7 @@ void AliTPCcalibAlign::Process(AliTPCseed *seed) { } AliExternalTrackParam *common1=0,*common2=0; if (AliTPCTracklet::PropagateToMeanX(*t1,*t2,common1,common2)) - ProcessTracklets(*common1,*common2,t1->GetSector(),t2->GetSector()); + ProcessTracklets(*common1,*common2,seed, t1->GetSector(),t2->GetSector()); delete common1; delete common2; } @@ -147,7 +155,7 @@ void AliTPCcalibAlign::Terminate(){ // Terminate function // call base terminate + Eval of fitters // - if (GetDebugLevel()>0) Info("AliTPCcalibAlign","Teminate"); + if (GetDebugLevel()>0) Info("AliTPCcalibAlign","Terminate"); EvalFitters(); AliTPCcalibBase::Terminate(); } @@ -157,6 +165,7 @@ void AliTPCcalibAlign::Terminate(){ void AliTPCcalibAlign::ProcessTracklets(const AliExternalTrackParam &tp1, const AliExternalTrackParam &tp2, + const AliTPCseed * seed, Int_t s1,Int_t s2) { // @@ -246,9 +255,84 @@ void AliTPCcalibAlign::ProcessTracklets(const AliExternalTrackParam &tp1, Process12(t1,t2,GetOrMakeFitter12(s1,s2)); Process9(t1,t2,GetOrMakeFitter9(s1,s2)); Process6(t1,t2,GetOrMakeFitter6(s1,s2)); + ProcessDiff(tp1,tp2, seed,s1,s2); ++fPoints[GetIndex(s1,s2)]; } +void AliTPCcalibAlign::ProcessDiff(const AliExternalTrackParam &t1, + const AliExternalTrackParam &t2, + const AliTPCseed *seed, + Int_t s1,Int_t s2) +{ + // + // Process local residuals function + // + TVectorD vecX(160); + TVectorD vecY(160); + TVectorD vecZ(160); + TVectorD vecClY(160); + TVectorD vecClZ(160); + TClonesArray arrCl("AliTPCclusterMI",160); + arrCl.ExpandCreateFast(160); + Int_t count1=0, count2=0; + for (Int_t i=0;i<160;++i) { + AliTPCclusterMI *c=seed->GetClusterPointer(i); + vecX[i]=0; + vecY[i]=0; + vecZ[i]=0; + if (!c) continue; + AliTPCclusterMI & cl = (AliTPCclusterMI&) (*arrCl[i]); + if (c->GetDetector()!=s1 && c->GetDetector()!=s2) continue; + vecClY[i] = c->GetY(); + vecClZ[i] = c->GetZ(); + cl=*c; + const AliExternalTrackParam *par = (c->GetDetector()==s1)? &t1:&t2; + if (c->GetDetector()==s1) ++count1; + if (c->GetDetector()==s2) ++count2; + Double_t gxyz[3],xyz[3]; + t1.GetXYZ(gxyz); + Float_t bz = AliTracker::GetBz(gxyz); + par->GetYAt(c->GetX(), bz, xyz[1]); + par->GetZAt(c->GetX(), bz, xyz[2]); + vecX[i] = c->GetX(); + vecY[i]= xyz[1]; + vecZ[i]= xyz[2]; + } + // + // + if (fStreamLevel>5){ + // + // huge output - cluster residuals to be investigated + // + TTreeSRedirector *cstream = GetDebugStreamer(); + AliTPCseed * t = (AliTPCseed*) seed; + //AliExternalTrackParam *p0 = &((AliExternalTrackParam&)seed); + AliExternalTrackParam *p1 = &((AliExternalTrackParam&)t1); + AliExternalTrackParam *p2 = &((AliExternalTrackParam&)t2); + + if (cstream){ + (*cstream)<<"Track"<< + "Cl.="<<&arrCl<< + //"tp0.="<Load("$ROOTSYS/lib/libTree.so"); + gSystem->Load("$MEMSTAT/libMemStat.so"); + TMemStat *memstat = new TMemStat(100000000,10000000,kTRUE); + AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack); - + AliSysInfo::AddStamp("Start"); //1. Load needed libraries gSystem->Load("libANALYSIS"); gSystem->Load("libTPCcalib"); - //increased memstat - gSystem->Load("$ROOTSYS/lib/libGui.so"); - gSystem->Load("$ROOTSYS/lib/libTree.so"); - gSystem->Load("$MEMSTAT/libMemStat.so"); - TMemStat memstat(100000000,10000000,kTRUE); - memstat->AddStamp("aaaa"); // // Setup analysis manager // - gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+") .L $ALICE_ROOT/TPC/macros/CalibrateTPC.C AliAnalysisManager * mgr = SetupCalibTask(); // @@ -23,15 +24,23 @@ gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros"); gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+") AliXRDPROOFtoolkit tool; - TChain * chain = tool.MakeChain("chain.txt","esdTree",0,30); + TChain * chain = tool.MakeChain("chain.txt","esdTree",0,1000); chain->Lookup(); // memory mgr->SetNSysInfo(100); - AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack); // + mgr->SetDebugLevel(1); mgr->StartAnalysis("local",chain); - - + // delete manager + // + delete mgr; + AliSysInfo::AddStamp("End"); + // + // analyze memstat report + // + delete memstat; + TMemStat draw("memstat.root"); + draw.MakeReport(0,0,"order 0 sortstat 3 sortstamp 0 sortdeep 10 stackdeep 15 maxlength 50") */ @@ -41,7 +50,11 @@ AliAnalysisManager * SetupCalibTask() { // TStopwatch stopwatch; stopwatch.Start(); - + // + // set magnetic field form the cosmos - it should be provided by framework + AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 2); + AliTracker::SetFieldMap(field,0); + // AliAnalysisManager *mgr=new AliAnalysisManager("TestManager"); AliESDInputHandler* esdH=new AliESDInputHandler; @@ -53,21 +66,26 @@ AliAnalysisManager * SetupCalibTask() { AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); AliTPCClusterParam * clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); - AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("foo bar"); + AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("TPC calibration task"); AliTPCcalibTracksCuts *cuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018); + // AliTPCcalibTracks *calibTracks = new AliTPCcalibTracks("calibTracks", "Resolution calibration object for tracks", clusterParam, cuts); - AliTPCcalibTracksGain *calibTracksGain = new AliTPCcalibTracksGain("TPCGainTracks","TPCGainTracks",cuts); - calibTracks->SetDebugLevel(5); - calibTracks->SetStreamLevel(5); - calibTracksGain->SetDebugLevel(1); - calibTracksGain->SetStreamLevel(1); + AliTPCcalibTracksGain *calibTracksGain = new AliTPCcalibTracksGain("calibTracksGain","Gain calibration using tracks",cuts); + AliTPCcalibAlign *calibAlign = new AliTPCcalibAlign("alignTPC","Alignment of the TPC sectors"); + calibTracks->SetDebugLevel(0); + calibTracks->SetStreamLevel(0); + calibTracksGain->SetDebugLevel(0); + calibTracksGain->SetStreamLevel(0); + calibAlign->SetDebugLevel(20); + calibAlign->SetStreamLevel(2); + // // ---*---*-----*-*-----*----------*--- // ADD CALIB JOBS HERE!!!!!!!!!!!!!!!! - task1->AddJob(new AliTPCcalibAlign);//"align","The kewl alignment job")); - task1->AddJob(calibTracksGain); - task1->AddJob(calibTracks); + task1->AddJob(calibAlign); + //task1->AddJob(calibTracksGain); + //task1->AddJob(calibTracks); // task1->AddJob(new AliTPCcalibBase); // task1->AddJob(new AliTPCcalibV0); // -*----*----*---*-*------*-------**-- -- 2.43.0