From 6e9ab565a02d665efb8d5225bd3ff3f401d39df9 Mon Sep 17 00:00:00 2001 From: kowal2 Date: Mon, 21 Jan 2002 17:08:27 +0000 Subject: [PATCH] New macroc for handling signal and background events simultanously --- TPC/AliTPCComparison2.C | 629 ++++++++++++++++++++++++++++++++ TPC/AliTPCDisplayClusters_new.C | 111 ++++++ TPC/AliTPCDisplayDigits3Dnew.C | 139 +++++++ 3 files changed, 879 insertions(+) create mode 100644 TPC/AliTPCComparison2.C create mode 100644 TPC/AliTPCDisplayClusters_new.C create mode 100644 TPC/AliTPCDisplayDigits3Dnew.C diff --git a/TPC/AliTPCComparison2.C b/TPC/AliTPCComparison2.C new file mode 100644 index 00000000000..8dcbd3b0d71 --- /dev/null +++ b/TPC/AliTPCComparison2.C @@ -0,0 +1,629 @@ +/**************************************************************************** + * Very important, delicate and rather obscure macro. * + * * + * Creates list of "trackable" tracks, * + * sorts tracks for matching with the ITS, * + * calculates efficiency, resolutions etc. * + * * + * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * + * with several nice improvements by: M.Ivanov, GSI, m.ivanov@gsi.de * + ****************************************************************************/ + +#if !defined(__CINT__) || defined(__MAKECINT__) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +/* + multievent comparison of reconstructed tracks with "exact tracks" + from silulation + +*/ + + +struct GoodTrackTPC { + Int_t fEventN; //event number + Int_t lab; + Int_t code; + Float_t px,py,pz; + Float_t x,y,z; +}; + +enum tagprimary {kPrimaryCharged = 0x4000}; + +Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn); + +Int_t FindPrimaries(Int_t nparticles); + +Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) { + + const Int_t MAX = 20000; + const Bool_t kOLD = kFALSE; // if tracking was done with a previous version + /***********************************************************************/ + + TFile *inkin = TFile::Open("rfio:galice.root"); + // if(gAlice)delete gAlice; COMMENTED BECAUSE OF A BUG (IN COMPILED MODE) + gAlice = (AliRun*)inkin->Get("gAlice"); + cout<<"AliRun object found on file "<Field()->Factor(); + AliKalmanTrack::SetConvConst(100/0.299792458/0.2/fifac); + cout<Close(); + /* + delete gAlice; COMMENTED BECAUSE OF A BUG IN COMPILED MODE + gAlice = 0; + */ + /***********************************************************************/ + cerr<<"Doing comparison...\n"; + Int_t i; + gBenchmark->Start("AliTPCComparison2"); + + TFile *cf=0; + AliTPCParam *digp=0; + if(kOLD){ + cf=TFile::Open("AliTPCclusters.root"); + if (!cf->IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 1;} + digp= (AliTPCParam*)cf->Get("75x40_100x60"); + if (!digp) { cerr<<"TPC parameters have not been found !\n"; return 2; } + } + /////////// + AliTPCtracker *tracker =0; + TObjArray tarray(MAX); + AliTPCtrack *iotrack=0; + Int_t nentr= 0; + Int_t eventptr[1000]; + TFile *tf=TFile::Open("AliTPCtracks.root"); + TTree *tracktree=0; + + eventptr[firstev]=0; + eventptr[firstev+1]=0; + for (Int_t event=firstev;eventcd(); + tracker = new AliTPCtracker(digp,event); + tracker->LoadInnerSectors(); + tracker->LoadOuterSectors(); + } + + char tname[100]; + if (eventn==-1) { + sprintf(tname,"TreeT_TPC"); + } + else { + sprintf(tname,"TreeT_TPC_%d",event); + } + + // Load tracks + if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 3;} + + tracktree=(TTree*)tf->Get(tname); + if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n"; return 4;} + TBranch *tbranch=tracktree->GetBranch("tracks"); + Int_t nentr0=(Int_t)tracktree->GetEntries(); + nentr+=nentr0; + for (i=0; iSetAddress(&iotrack); + tracktree->GetEvent(i); + if(kOLD)tracker->CookLabel(iotrack,0.1); + tarray.AddLast(iotrack); + } + eventptr[event+1] = nentr; //store end of the event + delete tracker; + delete tracktree; + } + tf->Close(); + if(kOLD)cf->Close(); + + GoodTrackTPC gt[MAX]; + + Int_t ngood=0; + ifstream in("good_tracks_tpc"); + if (in) { + cerr<<"Reading good tracks...\n"; + while (in>>gt[ngood].fEventN>>gt[ngood].lab>>gt[ngood].code>> + gt[ngood].px>>gt[ngood].py>>gt[ngood].pz>> + gt[ngood].x >>gt[ngood].y >>gt[ngood].z) { + ngood++; + cerr<SetFillColor(4); + TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-200,200);hl->SetFillColor(4); + TH1F *hpt=new TH1F("hpt","Relative Pt resolution",30,-10.,10.); + hpt->SetFillColor(2); + TH1F *hmpt=new TH1F("hmpt","Relative Pt resolution (pt>4GeV/c)",30,-60,60); + hmpt->SetFillColor(6); + + AliTPCtrack *trk=(AliTPCtrack*)tarray.UncheckedAt(0); + + Double_t pmin=0.1*(100/0.299792458/0.2/trk->GetConvConst()); + Double_t pmax=6.0+pmin; + + TH1F *hgood=new TH1F("hgood","Good tracks",30,pmin,pmax); + TH1F *hfound=new TH1F("hfound","Found tracks",30,pmin,pmax); + TH1F *hfake=new TH1F("hfake","Fake tracks",30,pmin,pmax); + TH1F *hg=new TH1F("hg","",30,pmin,pmax); //efficiency for good tracks + hg->SetLineColor(4); hg->SetLineWidth(2); + TH1F *hf=new TH1F("hf","Efficiency for fake tracks",30,pmin,pmax); + hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2); + + TH1F *he =new TH1F("he","dE/dX for pions with 0.4SetMarkerStyle(8); + hep->SetMarkerSize(0.4); + + Int_t mingood=ngood; + Int_t track_notfound[MAX], itrack_notfound=0; + Int_t track_fake[MAX], itrack_fake=0; + Int_t track_multifound[MAX], track_multifound_n[MAX], itrack_multifound=0; + while (ngood--) { + Int_t lab=gt[ngood].lab,tlab=-1; + Float_t ptg= + TMath::Sqrt(gt[ngood].px*gt[ngood].px + gt[ngood].py*gt[ngood].py); + + if (ptgFill(ptg); + Int_t ievent = gt[ngood].fEventN; + + AliTPCtrack *track=0; + for (i=eventptr[ievent]; iGetLabel(); + if (lab==TMath::Abs(tlab)) break; + } + if (i==eventptr[ievent+1]) { + track_notfound[itrack_notfound++]=lab; + continue; + } + + Int_t micount=0; + Int_t mi; + AliTPCtrack * mitrack; + for (mi=eventptr[ievent]; miGetLabel())) micount++; + } + if (micount>1) { + track_multifound[itrack_multifound]=lab; + track_multifound_n[itrack_multifound]=micount; + itrack_multifound++; + } + + // + Double_t xk=gt[ngood].x; + printf("Track =%p\n",track); + track->PropagateTo(xk); + + if (lab==tlab) hfound->Fill(ptg); + else { + track_fake[itrack_fake++]=lab; + hfake->Fill(ptg); + } + Double_t par[5]; track->GetExternalParameters(xk,par); + Float_t phi=TMath::ASin(par[2]) + track->GetAlpha(); + if (phi<-TMath::Pi()) phi+=2*TMath::Pi(); + if (phi>=TMath::Pi()) phi-=2*TMath::Pi(); + Float_t lam=TMath::ATan(par[3]); + Float_t pt_1=TMath::Abs(par[4]); + + if (TMath::Abs(gt[ngood].code)==11 && ptg>4.) { + hmpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.); + } else { + Float_t phig=TMath::ATan2(gt[ngood].py,gt[ngood].px); + hp->Fill((phi - phig)*1000.); + + Float_t lamg=TMath::ATan2(gt[ngood].pz,ptg); + hl->Fill((lam - lamg)*1000.); + + hpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.); + } + + Float_t mom=1./(pt_1*TMath::Cos(lam)); + Float_t dedx=track->GetdEdx(); + hep->Fill(mom,dedx,1.); + if (TMath::Abs(gt[ngood].code)==211) + if (mom>0.4 && mom<0.5) { + he->Fill(dedx,1.); + } + + } + + cout<<"\nList of Not found tracks :\n"; + for ( i = 0; i< itrack_notfound; i++){ + cout<GetEntries(), nf=hfound->GetEntries(); + if (ng!=0) cerr<<"\n\nIntegral efficiency is about "<SetOptStat(111110); + gStyle->SetOptFit(1); + + TCanvas *c1=new TCanvas("c1","",0,0,700,850); + + TPad *p1=new TPad("p1","",0,0.3,.5,.6); p1->Draw(); + p1->cd(); p1->SetFillColor(42); p1->SetFrameFillColor(10); + hp->SetFillColor(4); hp->SetXTitle("(mrad)"); hp->Fit("gaus"); c1->cd(); + + TPad *p2=new TPad("p2","",0.5,.3,1,.6); p2->Draw(); + p2->cd(); p2->SetFillColor(42); p2->SetFrameFillColor(10); + hl->SetXTitle("(mrad)"); hl->Fit("gaus"); c1->cd(); + + TPad *p3=new TPad("p3","",0,0,0.5,0.3); p3->Draw(); + p3->cd(); p3->SetFillColor(42); p3->SetFrameFillColor(10); + hpt->SetXTitle("(%)"); hpt->Fit("gaus"); c1->cd(); + + TPad *p4=new TPad("p4","",0.5,0,1,0.3); p4->Draw(); + p4->cd(); p4->SetFillColor(42); p4->SetFrameFillColor(10); + hmpt->SetXTitle("(%)"); hmpt->Fit("gaus"); c1->cd(); + + TPad *p5=new TPad("p5","",0,0.6,1,1); p5->Draw(); p5->cd(); + p5->SetFillColor(41); p5->SetFrameFillColor(10); + hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2(); + hg->Divide(hfound,hgood,1,1.,"b"); + hf->Divide(hfake,hgood,1,1.,"b"); + hg->SetMaximum(1.4); + hg->SetYTitle("Tracking efficiency"); + hg->SetXTitle("Pt (GeV/c)"); + hg->Draw(); + + TLine *line1 = new TLine(pmin,1.0,pmax,1.0); line1->SetLineStyle(4); + line1->Draw("same"); + TLine *line2 = new TLine(pmin,0.9,pmax,0.9); line2->SetLineStyle(4); + line2->Draw("same"); + + hf->SetFillColor(1); + hf->SetFillStyle(3013); + hf->SetLineColor(2); + hf->SetLineWidth(2); + hf->Draw("histsame"); + TText *text = new TText(0.461176,0.248448,"Fake tracks"); + text->SetTextSize(0.05); + text->Draw(); + text = new TText(0.453919,1.11408,"Good tracks"); + text->SetTextSize(0.05); + text->Draw(); + + + + TCanvas *c2=new TCanvas("c2","",320,32,530,590); + + TPad *p6=new TPad("p6","",0.,0.,1.,.5); p6->Draw(); + p6->cd(); p6->SetFillColor(42); p6->SetFrameFillColor(10); + he->SetFillColor(2); he->SetFillStyle(3005); + he->SetXTitle("Arbitrary Units"); + he->Fit("gaus"); c2->cd(); + + TPad *p7=new TPad("p7","",0.,0.5,1.,1.); p7->Draw(); + p7->cd(); p7->SetFillColor(42); p7->SetFrameFillColor(10); + hep->SetXTitle("p (Gev/c)"); hep->SetYTitle("dE/dX (Arb. Units)"); + hep->Draw(); c1->cd(); + + gBenchmark->Stop("AliTPCComparison2"); + gBenchmark->Show("AliTPCComparison2"); + + + return 0; +} + + +Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) { + //eventn - number of events in file + + TFile *file=TFile::Open("rfio:galice.root"); + if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);} + // delete gAlice; gAlice = 0; + if (!(gAlice=(AliRun*)file->Get("gAlice"))) { + cerr<<"gAlice have not been found on galice.root !\n"; + exit(5); + } + + + AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC"); + Int_t ver = TPC->IsVersion(); + cerr<<"TPC version "<Get("75x40_100x60"); + if (!digp) { cerr<<"TPC parameters have not been found !\n"; exit(6); } + TPC->SetParam(digp); + + Int_t nrow_up=digp->GetNRowUp(); + Int_t nrows=digp->GetNRowLow()+nrow_up; + Int_t zero=digp->GetZeroSup(); + Int_t gap=Int_t(0.125*nrows), shift=Int_t(0.5*gap); + Int_t good_number=Int_t(0.4*nrows); + + Int_t nt=0; //reset counter + char treeName[100]; //declare event identifier + + for (Int_t event=firstev;eventGetEvent(event); + Int_t nopr = FindPrimaries(np); + cout<<"function good_tracks -- event "<IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n";exit(5);} + AliTPCClustersArray *ca=new AliTPCClustersArray; + ca->Setup(digp); + ca->SetClusterType("AliTPCcluster"); + ca->ConnectTree("TreeC_TPC_0"); + Int_t nrows=Int_t(ca->GetTree()->GetEntries()); + for (Int_t n=0; nLoadEntry(n); + Int_t sec,row; + digp->AdjustSectorRow(s->GetID(),sec,row); + AliTPCClustersRow &clrow = *ca->GetRow(sec,row); + Int_t ncl=clrow.GetArray()->GetEntriesFast(); + while (ncl--) { + AliTPCcluster *c=(AliTPCcluster*)clrow[ncl]; + Int_t lab=c->GetLabel(0); + if (lab<0) continue; //noise cluster + lab=TMath::Abs(lab); + if (sec>=digp->GetNInnerSector()) + if (row==nrow_up-1 ) good[lab]|=0x1000; + if (sec>=digp->GetNInnerSector()) + if (row==nrow_up-1-gap) good[lab]|=0x800; + good[lab]++; + } + ca->ClearRow(sec,row); + } + delete ca; + cf->Close(); + } + break; + case 2: + { + sprintf(treeName,"TreeD_75x40_100x60_%d",event); + TD=(TTree*)gDirectory->Get(treeName); + TD->GetBranch("Segment")->SetAddress(&digits); + count = new Int_t[np]; + Int_t i; + for (i=0; iGetEntries(); + for (i=0; iGetEvent(i)) continue; + Int_t sec,row; + digp->AdjustSectorRow(digits->GetID(),sec,row); + digits->First(); + do { //Many thanks to J.Chudoba who noticed this + Int_t it=digits->CurrentRow(), ip=digits->CurrentColumn(); + Short_t dig = digits->GetDigit(it,ip); + Int_t idx0=digits->GetTrackID(it,ip,0); + Int_t idx1=digits->GetTrackID(it,ip,1); + Int_t idx2=digits->GetTrackID(it,ip,2); + if (idx0>=0 && dig>=zero && idx0=0 && dig>=zero && idx1=0 && dig>=zero && idx2Next()); + for (Int_t j=0; j1) { + if (sec>=digp->GetNInnerSector()) + if (row==nrow_up-1 ) good[j]|=0x4000; + if (sec>=digp->GetNInnerSector()) + if (row==nrow_up-1-gap) good[j]|=0x1000; + + if (sec>=digp->GetNInnerSector()) + if (row==nrow_up-1-shift) good[j]|=0x2000; + if (sec>=digp->GetNInnerSector()) + if (row==nrow_up-1-gap-shift) good[j]|=0x800; + good[j]++; + } + count[j]=0; + } + + } + delete[] count; + delete TD; //Thanks to Mariana Bondila + } + break; + default: + cerr<<"Invalid TPC version !\n"; + file->Close(); + exit(7); + } + + /** select tracks which are "good" enough **/ + for (Int_t i=0; iParticle(i); + + if (p->Pt()<0.100) continue; + if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue; + // THIS IS GOOD IF YOU WANT SECONDARIES + Int_t j=p->GetFirstMother(); + if (j>=0) { + TParticle *pp = (TParticle*)gAlice->Particle(j); + //if (!(pp->TestBit(kPrimaryCharged))) continue; //only one decay is allowed + } + + //if(!(p->TestBit(kPrimaryCharged)))continue; // only primaries + + gt[nt].fEventN=event; + gt[nt].lab=i; + gt[nt].code=p->GetPdgCode(); + gt[nt].px=0.; gt[nt].py=0.; gt[nt].pz=0.; + gt[nt].x=0.; gt[nt].z=0.; gt[nt].z=0.; + nt++; + if (nt==max) {cerr<<"Too many good tracks !\n"; break;} + cerr<TreeH(); np=(Int_t)TH->GetEntries(); + cout<ResetHits(); + TH->GetEvent(i); + AliTPChit *phit = (AliTPChit*)TPC->FirstHit(-1); + for ( ; phit; phit=(AliTPChit*)TPC->NextHit() ) { + if (phit->fQ !=0. ) continue; + + Double_t px=phit->X(), py=phit->Y(), pz=phit->Z(); + + if ((phit=(AliTPChit*)TPC->NextHit())==0) break; + if (phit->fQ != 0.) continue; + + Double_t x=phit->X(), y=phit->Y(), z=phit->Z(); + if (TMath::Sqrt(x*x+y*y)>90.) continue; + + Int_t j, lab=phit->Track(); + for (j=0; jAdjustCosSin(phit->fSector,cs,sn); + gt[j].x = x*cs + y*sn; + gt[j].y =-x*sn + y*cs; + gt[j].z = z; + } + cerr<Close(); + gBenchmark->Stop("AliTPCComparison2"); + gBenchmark->Show("AliTPCComparison2"); + return nt; + +} + +Int_t FindPrimaries(Int_t nparticles){ + + // cuts: + Double_t vertcut = 0.001; + Double_t decacut = 3.; + Double_t timecut = 0.; + Int_t nprch1=0; + TParticle * part = gAlice->Particle(0); + Double_t xori = part->Vx(); + Double_t yori = part->Vy(); + Double_t zori = part->Vz(); + for(Int_t iprim = 0; iprimParticle(iprim); + char *xxx=strstr(part->GetName(),"XXX"); + if(xxx)continue; + + TParticlePDG *ppdg = part->GetPDG(); + if(TMath::Abs(ppdg->Charge())!=3)continue; // only charged (no quarks) + + Double_t dist=TMath::Sqrt((part->Vx()-xori)*(part->Vx()-xori)+(part->Vy()-yori)*(part->Vy()-yori)+(part->Vz()-zori)*(part->Vz()-zori)); + if(dist>vertcut)continue; // cut on the vertex + + if(part->T()>timecut)continue; + + Double_t ptot=TMath::Sqrt(part->Px()*part->Px()+part->Py()*part->Py()+part->Pz()*part->Pz()); + if(ptot==(TMath::Abs(part->Pz())))continue; // no beam particles + + Bool_t prmch = kTRUE; // candidate primary track + Int_t fidau=part->GetFirstDaughter(); // cut on daughters + Int_t lasdau=0; + Int_t ndau=0; + if(fidau>=0){ + lasdau=part->GetLastDaughter(); + ndau=lasdau-fidau+1; + } + if(ndau>0){ + for(Int_t j=fidau;j<=lasdau;j++){ + TParticle *dau=gAlice->Particle(j); + Double_t distd=TMath::Sqrt((dau->Vx()-xori)*(dau->Vx()-xori)+(dau->Vy()-yori)*(dau->Vy()-yori)+(dau->Vz()-zori)*(dau->Vz()-zori)); + if(distdSetBit(kPrimaryCharged); + } + } + + return nprch1; +} + + + + + + diff --git a/TPC/AliTPCDisplayClusters_new.C b/TPC/AliTPCDisplayClusters_new.C new file mode 100644 index 00000000000..cc37ea9ecac --- /dev/null +++ b/TPC/AliTPCDisplayClusters_new.C @@ -0,0 +1,111 @@ +#ifndef __CINT__ + #include "alles.h" + #include "AliTPCtracker.h" + #include "TView.h" + #include "TPolyMarker3D.h" + #include "AliSimDigits.h" + +#endif +Int_t AliTPCDisplayClusters(Int_t eventn=0, Int_t noiseth=15) { + cerr<<"Displaying clusters...\n"; + + TFile *file=TFile::Open("galice.root"); + if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} + + TFile *cf=TFile::Open("AliTPCclusters.root"); + if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;} + + AliTPCParam *dig=(AliTPCParam *)cf->Get("75x40_100x60"); + if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 2;} + + + // some "constants" + Int_t markerColorSignal = 5; + Int_t markerColorBgr = 2; + Int_t MASK = 10000000; + + + TCanvas *c1=new TCanvas("cdisplay", "Cluster display",0,0,700,730); + TView *v=new TView(1); + v->SetRange(-430,-560,-430,430,560,1710); + c1->Clear(); + c1->SetFillColor(1); + c1->SetTheta(90.); + c1->SetPhi(0.); + + AliTPCClustersArray *ca=new AliTPCClustersArray; + ca->Setup(dig); + ca->SetClusterType("AliTPCcluster"); + char cname[100]; + sprintf(cname,"TreeC_TPC_%d",eventn); + + ca->ConnectTree(cname); + Int_t nrows=Int_t(ca->GetTree()->GetEntries()); + for (Int_t n=0; nLoadEntry(n); + Int_t sec,row; + dig->AdjustSectorRow(s->GetID(),sec,row); + AliTPCClustersRow &clrow = *ca->GetRow(sec,row); + Int_t ncl=clrow.GetArray()->GetEntriesFast(); + TPolyMarker3D *pm=new TPolyMarker3D(ncl); + TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal + Int_t imarBgr=0; + Int_t imarSignal=0; + while (ncl--) { + AliTPCcluster *cl=(AliTPCcluster*)clrow[ncl]; + Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ(); + if (cl->GetQ()AdjustCosSin(sec,cs,sn); + tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; + if (TMath::Abs(z)>50) continue; + Int_t trackId = cl->GetLabel(0); + if (trackId<0) continue; //bug in tracks ID + if (trackId < MASK-1) { + pmSignal->SetPoint(imarSignal,x,y,z); + imarSignal++; + } else { + pm->SetPoint(imarBgr,x,y,z); + imarBgr++; + } + } + ca->ClearRow(sec,row); + + // change color for signal + pm->SetMarkerSize(1); + pm->SetMarkerColor(markerColorBgr); + pm->SetMarkerStyle(1); + pm->Draw(); + + pmSignal->SetMarkerSize(1); + pmSignal->SetMarkerColor(markerColorSignal); + pmSignal->SetMarkerStyle(1); + pmSignal->Draw(); + } + delete ca; + cf->Close(); + + TGeometry *geom=(TGeometry*)file->Get("AliceGeom"); + // TList *list = geom->GetListOfNodes(); + TNode * main = (TNode*)((geom->GetListOfNodes())->First()); + TIter next(main->GetListOfNodes()); + TNode *module=0; + while((module = (TNode*)next())) { + char ch[100]; + sprintf(ch,"%s\n",module->GetTitle()); + //printf("%s\n",module->GetTitle()); + if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw + module->SetVisibility(3); + else + module->SetVisibility(-1); + } + + + geom->Draw("same"); + //v->Draw(); + c1->Modified(); c1->Update(); + + file->Close(); + return 0; +} + diff --git a/TPC/AliTPCDisplayDigits3Dnew.C b/TPC/AliTPCDisplayDigits3Dnew.C new file mode 100644 index 00000000000..562f777bfc4 --- /dev/null +++ b/TPC/AliTPCDisplayDigits3Dnew.C @@ -0,0 +1,139 @@ +#ifndef __CINT__ + #include "alles.h" + #include "AliTPCtracker.h" + #include "TView.h" + #include "TPolyMarker3D.h" + #include "AliSimDigits.h" +#endif + +// +// display 3D digits +// input parameter is event number - threshol to the noise +// if sdigits=kTRUE it will display Sdigits - otherwise it display digits +// signal event is displayed with yellow color + +Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15, Bool_t sdigits=kFALSE) { + cerr<<"Displaying digits...\n"; + + TFile *file=TFile::Open("galice.root"); + if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} + + TFile *cf=TFile::Open("galice.root"); + // if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;} + + AliTPCParam *param=(AliTPCParam *)cf->Get("75x40_100x60"); + if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;} + + TCanvas *c1=new TCanvas("ddisplay", "Digits display",0,0,700,730); + TView *v=new TView(1); + v->SetRange(-430,-560,-430,430,560,1710); + c1->Clear(); + c1->SetFillColor(1); + c1->SetTheta(90.); + c1->SetPhi(0.); + + AliTPCDigitsArray *digarr=new AliTPCDigitsArray; + digarr->Setup(param); + + char cname[100]; + if (!sdigits) + sprintf(cname,"TreeD_75x40_100x60_%d",eventn); + else + sprintf(cname,"TreeS_75x40_100x60_%d",eventn); + +// some "constants" + Int_t markerColorSignal = 5; + Int_t markerColorBgr = 2; + Int_t MASK = 10000000; + + digarr->ConnectTree(cname); + Int_t nrows=Int_t(digarr->GetTree()->GetEntries()); + Int_t all0=0; + for (Int_t n=0; nLoadEntry(n); + Int_t sec,row; + param->AdjustSectorRow(s->GetID(),sec,row); + Int_t npads, sign; + { + const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); + if (sec < kNIS) { + npads = param->GetNPadsLow(row); + sign = (sec < kNIS/2) ? 1 : -1; + } else { + npads = param->GetNPadsUp(row); + sign = ((sec-kNIS) < kNOS/2) ? 1 : -1; + } + } + + AliSimDigits *digrow = (AliSimDigits*)digarr->GetRow(sec,row); + Int_t ncl=0; + if (digrow->First()){ + while(digrow->Next()) ncl++; + ncl++; + } + TPolyMarker3D *pm=new TPolyMarker3D(ncl); + TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal + Int_t imarBgr=0; + Int_t imarSignal=0; + if (digrow->First()) do { + Short_t dig=digrow->CurrentDigit(); + Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec); + Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow()); + Double_t x=param->GetPadRowRadii(sec,row); + if (digGetTrackID(digrow->CurrentRow(),digrow->CurrentColumn(),0); + Float_t cs, sn, tmp; + param->AdjustCosSin(sec,cs,sn); + tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; + if (trackId<0) continue; //if signal from croostalk - we don't have track ID information + if (trackId < MASK-1) { + pmSignal->SetPoint(imarSignal,x,y,z); + imarSignal++; + } else { + pm->SetPoint(imarBgr,x,y,z); + imarBgr++; + } + } while (digrow->Next()); + +// change color for signal + digarr->ClearRow(sec,row); + pm->SetMarkerSize(1); + pm->SetMarkerColor(markerColorBgr); + pm->SetMarkerStyle(1); + pm->Draw(); + + pmSignal->SetMarkerSize(1); + pmSignal->SetMarkerColor(markerColorSignal); + pmSignal->SetMarkerStyle(1); + pmSignal->Draw(); + all0+=imarSignal; + } + printf("%d\n",all0); + + + delete digarr; + cf->Close(); + //draw TPC skeleton + TGeometry *geom=(TGeometry*)file->Get("AliceGeom"); + TNode * main = (TNode*)((geom->GetListOfNodes())->First()); + TIter next(main->GetListOfNodes()); + TNode *module=0; + while((module = (TNode*)next())) { + char ch[100]; + sprintf(ch,"%s\n",module->GetTitle()); + //printf("%s\n",module->GetTitle()); + if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw + module->SetVisibility(3); + else + module->SetVisibility(-1); + } + + + geom->Draw("same"); + //v->Draw(); + c1->Modified(); c1->Update(); + + file->Close(); + return 0; +} + -- 2.43.0