//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // FOPI/TPC hit point and track display // // // Environment: // Processing of data from FOPI experiment S339 // // Author List: // Paul Buehler SMI/OEAW // //----------------------------------------------------------- // This Class' Header ------------------ #include "TpcHelDisplayTask.h" // C++ headers // Collaborating Class Headers -------- #include "FairRun.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" #include "TpcAlignmentManager.h" #include "TVectorD.h" #include "TMatrixT.h" #include "TH2.h" #include "TCanvas.h" #include "TGraph.h" #include "TMultiGraph.h" #include "TLatex.h" #include "TLegend.h" #include "RecoHits/GFAbsRecoHit.h" #include "GFTrack.h" #include "GFTrackCand.h" #include "TpcCluster.h" #include "FOPIField.h" #include "FopiEvent.h" #include "CdcHit.h" #include "HeliHit.h" #include "HeliTrack.h" #include "PlawaTrack.h" #include "FopiForwardHit.h" #include "THPTrackFilter.h" #include "GFException.h" #define DEBUG 0 //----------------------------------------------------------- TpcHelDisplayTask::TpcHelDisplayTask() : fFopiEvBranchName("FopiEvent"), fCdcHitBranchName("CdcHit"), fHelHitAllBranchName("HeliHitAll"), fHelTrackBranchName("HeliTrack"), fHelHitBranchName("HeliHit"), fPlaHitAllBranchName("PlawaHitAll"), fPlaTrackBranchName("PlawaTrack"), fTpcClusterBranchName("TpcCluster"), fTpcTrackBranchName("RiemannTrack"), fTpcTrackHitsBranchName("RiemannHit"), fTpcTrackFitBranchName("TpcPostFit"), fTpcHelMatchParsBranchName("TpcHelMatchPars"), fTpcHelTrackFitBranchName("TpcHelPostFit"), fPersistence(kTRUE), fVerbose(kFALSE) { fRad = 3.1415926/180.; // initialisate parameters // fToShow: // 0 : TPC tracks // 1 : Helitron fit functions // 2 : Helitron tracks // 3 : Vertex // 4 : TPC hits // 5 : CDC hits // 6 : Helitron hits // 7 : Plawa hits // 8 : TPC/Helitron tracks fToShow = new Int_t[9]; fToShow[0] = 0; // fToShow[1] = 0; fToShow[2] = 0; fToShow[3] = 1; fToShow[4] = 0; fToShow[5] = 0; fToShow[6] = 1; fToShow[7] = 1; fToShow[8] = 1; fps = new Float_t[9]; fps[0] = 0.10; fps[1] = 0.10; fps[2] = 0.15; fps[3] = 0.25; fps[4] = 0.15; fps[5] = 0.15; fps[6] = 0.15; fps[7] = 0.35; fps[8] = 0.25; fDispType = 1; fMaxChi2 = 10000.; fZshift = 0.; } //----------------------------------------------------------- TpcHelDisplayTask::~TpcHelDisplayTask(){ } //----------------------------------------------------------- InitStatus TpcHelDisplayTask::Init() { //Get ROOT Manager ------------------ FairRootManager* ioman= FairRootManager::Instance(); if(ioman==0) { Error("TpcHelDisplayTask::Init","RootManager not instantiated!"); return kERROR; } // Get input ------------------------ fFopiEventArray=(TClonesArray*) ioman->GetObject(fFopiEvBranchName); if(fFopiEventArray==0) { Error("TpcHelDisplayTask::Init","FOPI event not found!"); return kERROR; } fTpcTrackFitArray=(TClonesArray*) ioman->GetObject(fTpcTrackFitBranchName); if(fToShow[0]>0 && fTpcTrackFitArray==0) { fprintf(stderr,"GFTrack array not found!\n"); Error("TpcHelDisplayTask::Init","GFTrack array not found!"); return kERROR; } fTpcClusterArray=(TClonesArray*) ioman->GetObject(fTpcClusterBranchName); if(fToShow[4]>0 && fTpcClusterArray==0) { Error("TpcHelDisplayTask::Init","TpcCluster array not found!"); return kERROR; } // fTpcTrackArray=(TClonesArray*) ioman->GetObject(fTpcTrackBranchName); // if(fTpcTrackArray==0) { // fprintf(stderr,"RiemannTrack array not found!\n"); // Error("TpcHelDisplayTask::Init","RiemannTrack array not found!"); // return kERROR; // } // fTpcTrackHitsArray=(TClonesArray*) ioman->GetObject(fTpcTrackHitsBranchName); // if(fTpcTrackHitsArray==0) { // fprintf(stderr,"TPC hit array not found!\n"); // Error("TpcHelDisplayTask::Init","TPC hit array not found!"); // return kERROR; // } fCdcHitArray=(TClonesArray*) ioman->GetObject(fCdcHitBranchName); if(fToShow[5]>0 && fCdcHitArray==0) { Error("TpcHelDisplayTask::Init","CDC Hits array not found!"); return kERROR; } fHelHitAllArray=(TClonesArray*) ioman->GetObject(fHelHitAllBranchName); if(fToShow[6]>0 && fHelHitAllArray==0) { Error("TpcHelDisplayTask::Init","Helitron HitsAll array not found!"); return kERROR; } fHelHitArray=(TClonesArray*) ioman->GetObject(fHelHitBranchName); if(fToShow[2]>0 && fHelHitArray==0) { Error("TpcHelDisplayTask::Init","Helitron Hits array not found!"); return kERROR; } fHelTrackArray=(TClonesArray*) ioman->GetObject(fHelTrackBranchName); if(fToShow[2]>0 && fHelTrackArray==0) { Error("TpcHelDisplayTask::Init","Helitron track array not found!"); return kERROR; } fPlaTrackArray=(TClonesArray*) ioman->GetObject(fPlaTrackBranchName); if(fToShow[2]>0 && fPlaTrackArray==0) { Error("TpcHelDisplayTask::Init","Plawa track array not found!"); return kERROR; } fPlaHitAllArray=(TClonesArray*) ioman->GetObject(fPlaHitAllBranchName); if(fToShow[7]>0 && fPlaHitAllArray==0) { Error("TpcHelDisplayTask::Init","Plawa HitsAll array not found!"); return kERROR; } fMatchingPars=(TClonesArray*) ioman->GetObject(fTpcHelMatchParsBranchName); if(fToShow[8]>0 && fMatchingPars==0) { Error("TpcHelTrackFittingTask::Init", "Matching parameters array not found!!"); return kERROR; } fTpcHelTrackFits=(TClonesArray*) ioman->GetObject(fTpcHelTrackFitBranchName); if(fToShow[8]>0 && fTpcHelTrackFits==0) { Error("TpcHelTrackFittingTask::Init","TpcHelTrackFit array not found!!"); return kERROR; } return kSUCCESS; } //----------------------------------------------------------- void TpcHelDisplayTask::SetParContainers() { // std::cout<<"TpcResidualTask::SetParContainers"<GetRuntimeDb(); if ( ! db ) Fatal("SetParContainers", "No runtime database"); } //----------------------------------------------------------- void TpcHelDisplayTask::Exec(Option_t* opt) { if (fVerbose) fprintf(stderr,"TpcHelDisplayTask:Exec\n"); Float_t ps[6] = {0.1,0.25,0.15,0.15,0.15,0.25}; // symbol size Float_t const phmatchmin = 0.0; Int_t const TpcId = 8; Float_t *hfp = new Float_t[4]; char ltxt[200]; TVector3 fitPos; TVector3 tpcMasterPos,tpcMasterMom; TVector3 pos, mom; TMatrixDSym cov; TVectorD *MatchingParsVec = new TVectorD(14); GFDetPlane plane1; // Get TPC/CDC alignment TpcAlignmentManager * align = TpcAlignmentManager::getInstance(); // prepare histograms for plots Double_t const xmin = -150, xmax = 150; Double_t const ymin = -150, ymax = 150; Double_t const zmin = -50, zmax = 500; Double_t const rmin = 0, rmax = 150; TH2F hxy = TH2F("hxy","x versus y",10,xmin,xmax,10,ymin,ymax); hxy.SetStats(kFALSE); TH2F hzx = TH2F("hzx","y versus z",10,zmin,zmax,10,ymin,ymax); hzx.SetStats(kFALSE); TH2F hzy = TH2F("hzy","x versus z",10,zmin,zmax,10,xmin,xmax); hzy.SetStats(kFALSE); TH2F hzr = TH2F("hzr","r versus z",10,zmin,zmax,10,rmin,rmax); hzr.SetStats(kFALSE); // get FOPI event FopiEvent *fopiEv = (FopiEvent*) fFopiEventArray->At(0); if (fopiEv == 0) return; Int_t nrun = fopiEv->GetRunNum(); Int_t nspill = fopiEv->GetSpillNum(); Int_t nevent = fopiEv->GetEvtNum(); // transformation Helitron-to-beam Float_t taroff = fopiEv->GetTaroff(); Float_t phi0 = fopiEv->GetPhi0(); TVector3 hoff = fopiEv->GetHoff(); TVector3 hrot = fopiEv->GetHrot(); // fprintf(stderr,"taroff: %f\n",taroff); // fprintf(stderr,"heloff: %f %f %f\n",hoff.X(), hoff.Y(),hoff.Z()); // define globhit and lochit FopiForwardHit globhit = FopiForwardHit(1,0,taroff,hoff,hrot); FopiForwardHit lochit = FopiForwardHit(0,0,taroff,hoff,hrot); // how many hits/tracks are there Int_t NumTpcClus = 0; if (fToShow[4] != 0) NumTpcClus = fTpcClusterArray->GetEntriesFast(); Int_t NumCdcHits = fopiEv->GetNhit(); Int_t hhmulf = fopiEv->GetHHmulf(); Int_t phmulf = fopiEv->GetPHmulf(); Int_t NumHelTracks = fopiEv->GetHmul(); // get number of TPC/Helitron tracks to be shown std::vector map; Int_t NumTpcHelTracks = THPTrackFilter( fMatchingPars,fTpcHelTrackFits,fMaxChi2,&map); // read all tpc clusters if (fVerbose) fprintf(stderr,"NumTpcClus: %d\n",NumTpcClus); FopiForwardHit *tpchitsall; if (NumTpcClus > 0) { tpchitsall = new FopiForwardHit[NumTpcClus](); for(Int_t kk=0;kkAt(kk); tpcMasterPos = tpcsingleclus->pos(); tpchitsall[kk].SetPos(1, tpcMasterPos.X(),tpcMasterPos.Y(),tpcMasterPos.Z()); } } // read all tpc tracks and associated hits std::vector candIDs; Int_t NumTpcTracks = 0; if (fToShow[0] >0) NumTpcTracks = fTpcTrackFitArray->GetEntriesFast(); Int_t TotNumTpcTrackHits = 0; Int_t thcounter = -1; Int_t *NumTpcTrackHits; FopiForwardHit *tpchitstrack; if (NumTpcTracks > 0) { NumTpcTrackHits = new Int_t[NumTpcTracks]; // first get number of hits per track for (Int_t ii=0; iiAt(ii); NumTpcTrackHits[ii] = tpcsingletrack->getNumHits(); TotNumTpcTrackHits += NumTpcTrackHits[ii]; // fprintf(stderr,"NumTpcTrackHits[%d]: %d\n",ii,NumTpcTrackHits[ii]); } // fprintf(stderr,"TotNumTpcTrackHits: %d\n",TotNumTpcTrackHits); // now read out the hits associated with a track tpchitstrack = new FopiForwardHit[TotNumTpcTrackHits]; for (Int_t ii=0; iiAt(ii); if (NumTpcTrackHits[ii] > 1) { for (Int_t jj=0; jjgetHit(jj); TVectorD raw(3); raw = hit->getRawHitCoord(); pos.SetXYZ(raw[0],raw[1],raw[2]); tpcMasterPos = pos; //fprintf(stderr,"HitPos: %f %f %f\n", // tpcMasterPos.X(),tpcMasterPos.Y(),tpcMasterPos.Z()); tpchitstrack[thcounter].SetPos(1,tpcMasterPos); } } } } // read all CDC hits FopiForwardHit *cdchitsall; if (NumCdcHits > 0) { cdchitsall = new FopiForwardHit[NumCdcHits](); for (Int_t kk=0; kkAt(kk); cdchitsall[kk].SetPos(1, csinglehit->GetHitPos().X(), csinglehit->GetHitPos().Y(), csinglehit->GetHitPos().Z()); } } // read all Helitron hits FopiForwardHit *helihits1all = new FopiForwardHit[hhmulf](); FopiForwardHit *helihits2all = new FopiForwardHit[hhmulf](); Int_t hhmulfsel = 0; if (fToShow[6] != 0) { for (Int_t kk=0; kkAt(kk); // filter out points from the last row of wires if (hsinglehit->GetHhz() < 224.5) { helihits1all[hhmulfsel].SetHrsec(hsinglehit->GetHrsec()); helihits1all[hhmulfsel].SetTaroff(taroff); helihits1all[hhmulfsel].SetHoff(hoff); helihits1all[hhmulfsel].SetHrot(hrot); helihits1all[hhmulfsel].SetPos(0, hsinglehit->GetHhx1(),hsinglehit->GetHhy(), hsinglehit->GetHhz()+fZshift); helihits2all[hhmulfsel].SetHrsec(hsinglehit->GetHrsec()); helihits2all[hhmulfsel].SetTaroff(taroff); helihits2all[hhmulfsel].SetHoff(hoff); helihits2all[hhmulfsel].SetHrot(hrot); helihits2all[hhmulfsel].SetPos(0, hsinglehit->GetHhx2(),hsinglehit->GetHhy(), hsinglehit->GetHhz()+fZshift); hhmulfsel++; } } } // read all Helitron tracks and associated hits Float_t *hrsec,*htanthe,*hfps,*phmatch; Int_t *NumHelTrackHits; FopiForwardHit *helhitstrack; Int_t TotNumHelTrackHits = 0; Int_t hhrc = -1, hhwc = -1; if (NumHelTracks > 0) { hrsec = new Float_t[NumHelTracks]; htanthe = new Float_t[NumHelTracks]; hfps = new Float_t[4*NumHelTracks]; phmatch = new Float_t[NumHelTracks]; NumHelTrackHits = new Int_t[NumHelTracks]; for(Int_t ii=0;iiAt(ii); // reference sector hrsec[ii] = hsingletrack->GetHrsec(); // read fit parameters and compute track htanthe[ii] = tan(fRad*hsingletrack->GetHthe()); hfp = hsingletrack->GetHfitpars(); for (Int_t jj=0; jj<4; jj++) hfps[jj+4*ii] = hfp[jj]; // hit multiplicity NumHelTrackHits[ii] = hsingletrack->GetHhmul(); TotNumHelTrackHits += NumHelTrackHits[ii]; phmatch[ii] = hsingletrack->GetPHmatch(); if (phmatch[ii] > phmatchmin) TotNumHelTrackHits++; } // now read out the hits associated with a track helhitstrack = new FopiForwardHit[TotNumHelTrackHits]; for (Int_t ii=0; iiAt(ii); PlawaTrack *psingletrack = (PlawaTrack*) fPlaTrackArray->At(ii); for (Int_t jj=0; jjAt(hhrc); hhwc++; helhitstrack[hhwc].SetHrsec(hrsec[ii]); helhitstrack[hhwc].SetPos(0, hsinglehit->GetHhx(),hsinglehit->GetHhy(), hsinglehit->GetHhz()+fZshift); } if (phmatch[ii] > phmatchmin) { Float_t phthe = fRad*psingletrack->GetPhthe(); Float_t phphi = fRad*psingletrack->GetPhphi(); Float_t phz = psingletrack->GetPhz()+fZshift; Float_t pr = phz*tan(phthe); hhwc++; helhitstrack[hhwc].SetHrsec(hrsec[ii]); helhitstrack[hhwc].SetPos(1, pr*cos(phphi),pr*sin(phphi),phz); } } } // read all Plawa hits FopiForwardHit *plawahitsall; if (fToShow[7]>0 && phmulf>0) { plawahitsall = new FopiForwardHit[phmulf](); for (Int_t kk=0; kkAt(kk); plawahitsall[kk].SetHrsec(psinglehit->GetPrsec()); plawahitsall[kk].SetTaroff(taroff); plawahitsall[kk].SetHoff(hoff); plawahitsall[kk].SetHrot(hrot); Float_t phthe = fRad*psinglehit->GetPhthe(); Float_t phphi = fRad*psinglehit->GetPhphi(); Float_t phz = psinglehit->GetPhz()+fZshift; Float_t pr = phz*tan(phthe); Float_t phx = pr*cos(phphi); Float_t phy = pr*sin(phphi); plawahitsall[kk].SetPos(1,phx,phy,phz); } } // define general coordinate system Int_t refsec = 0; if (NumHelTracks > 0) globhit.SetHrsec(hrsec[NumHelTracks-1]); // define main vertex globhit.SetPos(1,0.,0.,0.); Float_t vx = globhit.GetPos(fDispType).X(); Float_t vy = globhit.GetPos(fDispType).Y(); Float_t vz = globhit.GetPos(fDispType).Z(); Float_t vr = sqrt(pow(vx,2)+pow(vy,2)); // convert all TPC clusters to hrsec Float_t *txf,*tyf,*tzf,*trf; if (fToShow[4]>0 && NumTpcClus> 0) { txf = new Float_t[NumTpcClus]; tyf = new Float_t[NumTpcClus]; tzf = new Float_t[NumTpcClus]; trf = new Float_t[NumTpcClus]; for (Int_t kk=0; kk 0) { cxf = new Float_t[NumCdcHits]; cyf = new Float_t[NumCdcHits]; czf = new Float_t[NumCdcHits]; crf = new Float_t[NumCdcHits]; for (Int_t kk=0; kkDraw(); pad2->Draw(); pad3->Draw(); pad4->Draw(); // prepare graphs with Helitron tracks Float_t *fx,*fy,*fz,*fr; TGraph *fhgrxy,*fhgrzx,*fhgrzy,*fhgrzr; Float_t *thx,*thy,*thz,*thr; TGraph *thgrxy,*thgrzx,*thgrzy,*thgrzr; if (fToShow[2]>0 && NumHelTracks>0) { Int_t nstep = 350; fx = new Float_t[nstep]; fy = new Float_t[nstep]; fz = new Float_t[nstep]; fr = new Float_t[nstep]; fhgrxy = new TGraph[NumHelTracks]; fhgrzx = new TGraph[NumHelTracks]; fhgrzy = new TGraph[NumHelTracks]; fhgrzr = new TGraph[NumHelTracks]; thx = new Float_t[TotNumHelTrackHits]; thy = new Float_t[TotNumHelTrackHits]; thz = new Float_t[TotNumHelTrackHits]; thr = new Float_t[TotNumHelTrackHits]; thgrxy = new TGraph[NumHelTracks]; thgrzx = new TGraph[NumHelTracks]; thgrzy = new TGraph[NumHelTracks]; thgrzr = new TGraph[NumHelTracks]; hhwc = -1; for (Int_t ii=0; ii phmatchmin) hhwc++; thgrxy[ii] = TGraph(NumHelTrackHits[ii],thx,thy); thgrxy[ii].SetMarkerStyle(20); thgrxy[ii].SetMarkerSize(fps[2]); thgrxy[ii].SetMarkerColor(28); thgrzy[ii] = TGraph(NumHelTrackHits[ii],thz,thy); thgrzy[ii].SetMarkerStyle(20); thgrzy[ii].SetMarkerSize(fps[2]); thgrzy[ii].SetMarkerColor(28); thgrzx[ii] = TGraph(NumHelTrackHits[ii],thz,thx); thgrzx[ii].SetMarkerStyle(20); thgrzx[ii].SetMarkerSize(fps[2]); thgrzx[ii].SetMarkerColor(28); thgrzr[ii] = TGraph(NumHelTrackHits[ii],thz,thr); thgrzr[ii].SetMarkerStyle(20); thgrzr[ii].SetMarkerSize(fps[2]); thgrzr[ii].SetMarkerColor(28); } } // prepare graphs with TPC tracks Float_t *tfx,*tfy,*tfz,*tfr; TGraph *ttgrxy,*ttgrzx,*ttgrzy,*ttgrzr; if (NumTpcTracks > 0) { tfx = new Float_t[TotNumTpcTrackHits]; tfy = new Float_t[TotNumTpcTrackHits]; tfz = new Float_t[TotNumTpcTrackHits]; tfr = new Float_t[TotNumTpcTrackHits]; ttgrxy = new TGraph[NumTpcTracks]; ttgrzx = new TGraph[NumTpcTracks]; ttgrzy = new TGraph[NumTpcTracks]; ttgrzr = new TGraph[NumTpcTracks]; thcounter = -1; for (Int_t ii=0; iiGetEntries(); thcounter = -1; if (fVerbose) { fprintf(stderr,"NumMatchPars: %i\n",NumMatchPars); fprintf(stderr,"NumTpcHelTracks: %i\n",NumTpcHelTracks); } Float_t *fthx, *fthy, *fthz, *fthr; TGraph *fthgrxy, *fthgrzx, *fthgrzy, *fthgrzr; TLegend *leg = new TLegend(0.6,0.5,0.9,0.9); if (fToShow[8]>0 && NumTpcHelTracks > 0) { leg->SetHeader("Matched tracks"); Int_t nstep = 490; fthx = new Float_t[nstep]; fthy = new Float_t[nstep]; fthz = new Float_t[nstep]; fthr = new Float_t[nstep]; fthgrxy = new TGraph[NumTpcHelTracks]; fthgrzx = new TGraph[NumTpcHelTracks]; fthgrzy = new TGraph[NumTpcHelTracks]; fthgrzr = new TGraph[NumTpcHelTracks]; hhwc = -1; for (Int_t ii=0; iiAt(ind1); Double_t *MatchingPars = MatchingParsVec->GetMatrixArray(); Int_t ind2 = (Int_t) map[ii].Y(); GFTrack *trk = (GFTrack*) fTpcHelTrackFits->At(ind2); GFAbsTrackRep *rep = trk->getCardinalRep(); /* // print momentum if (fVerbose) { plane1 = GFDetPlane( TVector3(0.,0.,0.), TVector3(1.,0.,0.), TVector3(0.,1.,0.)); try { trk->getPosMomCov(plane1,pos,mom,cov); } catch (GFException& e) { e.what(); } if (fVerbose) fprintf(stderr,"Fitted Momentum: %f\n",mom.Mag()); } */ // update legend for plot HeliTrack *hsingletrack = (HeliTrack*) fHelTrackArray->At(MatchingPars[2]); sprintf(ltxt, "[%2.0f,%2.0f]: %6.2f/%2i %6.2f (%6.2f)", MatchingPars[1],MatchingPars[2], trk->getRedChiSqu(),rep->getStatusFlag(), trk->getCharge()*trk->getMom().Mag(),hsingletrack->GetHmom()); leg->AddEntry((TObject*)0,ltxt,""); // step through track from vertex to Plawa for (Int_t kk=0; kkgetPosMomCov(plane1,pos,mom,cov); } catch (GFException& e) { e.what(); } globhit.SetPos(1,pos); fthx[kk] = globhit.GetPos(fDispType).X(); fthy[kk] = globhit.GetPos(fDispType).Y(); fthz[kk] = globhit.GetPos(fDispType).Z(); fthr[kk] = sqrt(pow(fthx[kk],2)+pow(fthy[kk],2)); } thcounter ++; fthgrxy[thcounter] = TGraph(nstep,fthx,fthy); fthgrxy[thcounter].SetLineStyle(1); fthgrxy[thcounter].SetLineWidth(1); fthgrxy[thcounter].SetLineColor(8); fthgrzy[thcounter] = TGraph(nstep,fthz,fthy); fthgrzy[thcounter].SetLineStyle(1); fthgrzy[thcounter].SetLineWidth(1); fthgrzy[thcounter].SetLineColor(8); fthgrzx[thcounter] = TGraph(nstep,fthz,fthx); fthgrzx[thcounter].SetLineStyle(1); fthgrzx[thcounter].SetLineWidth(1); fthgrzx[thcounter].SetLineColor(8); fthgrzr[thcounter] = TGraph(nstep,fthz,fthr); fthgrzr[thcounter].SetLineStyle(1); fthgrzr[thcounter].SetLineWidth(1); fthgrzr[thcounter].SetLineColor(8); } } // x - y pad1->cd(); hxy.Draw(); TMultiGraph *mgrxy = new TMultiGraph(); if (fToShow[0]>0) for (Int_t ii=0; iiAdd(&(ttgrxy[ii]),"L"); if (fToShow[1]>0) for (Int_t ii=0; iiAdd(&(fhgrxy[ii]),"L"); if (fToShow[2]>0) for (Int_t ii=0; iiAdd(&(thgrxy[ii]),"P"); if (fToShow[3]>0) { TGraph *vgrxy = new TGraph(1,&vx,&vy); vgrxy->SetMarkerStyle(20); vgrxy->SetMarkerSize(fps[3]); vgrxy->SetMarkerColor(2); mgrxy->Add(vgrxy,"P"); } if (fToShow[4]>0 && NumTpcTracks>0) { TGraph *tgrxy = new TGraph(NumTpcClus,txf,tyf); tgrxy->SetMarkerStyle(20); tgrxy->SetMarkerSize(fps[4]); tgrxy->SetMarkerColor(1); mgrxy->Add(tgrxy,"P"); } if (fToShow[5]>0 && NumCdcHits>0) { TGraph *cgrxy = new TGraph(NumCdcHits,cxf,cyf); cgrxy->SetMarkerStyle(20); cgrxy->SetMarkerSize(fps[5]); cgrxy->SetMarkerColor(9); mgrxy->Add(cgrxy,"P"); } if (fToShow[6]>0 && hhmulfsel>0) { TGraph *h1fgrxy = new TGraph(hhmulfsel,hx1f,hyf); h1fgrxy->SetMarkerStyle(kStar); h1fgrxy->SetMarkerSize(fps[6]); h1fgrxy->SetMarkerColor(42); TGraph *h2fgrxy = new TGraph(hhmulfsel,hx2f,hyf); h2fgrxy->SetMarkerStyle(kStar); h2fgrxy->SetMarkerSize(fps[6]); h2fgrxy->SetMarkerColor(46); mgrxy->Add(h1fgrxy,"P"); mgrxy->Add(h2fgrxy,"P"); } if (fToShow[7]>0 && phmulf>0) { TGraph *pfgrxy = new TGraph(phmulf,pxf,pyf); pfgrxy->SetMarkerStyle(20); pfgrxy->SetMarkerSize(fps[7]); pfgrxy->SetMarkerColor(8); mgrxy->Add(pfgrxy,"P"); } if (fToShow[8]>0) for (Int_t ii=0; iiAdd(&(fthgrxy[ii]),"L"); mgrxy->Draw("P"); TAxis* tx1 = hxy.GetXaxis(); tx1->SetTitle("xdt [cm]"); tx1->SetNoExponent(kTRUE); TAxis* ty1 = hxy.GetYaxis(); ty1->SetTitle("ycd [cm]"); ty1->SetNoExponent(kTRUE); // y - z pad2->cd(); hzy.Draw(); TMultiGraph *mgrzy = new TMultiGraph(); if (fToShow[0]>0) for (Int_t ii=0; iiAdd(&(ttgrzy[ii]),"L"); if (fToShow[1]>0) for (Int_t ii=0; iiAdd(&(fhgrzy[ii]),"L"); if (fToShow[2]>0) for (Int_t ii=0; iiAdd(&(thgrzy[ii]),"P"); if (fToShow[3]>0) { TGraph *vgrzy = new TGraph(1,&vz,&vy); vgrzy->SetMarkerStyle(20); vgrzy->SetMarkerSize(fps[3]); vgrzy->SetMarkerColor(2); mgrzy->Add(vgrzy,"P"); } if (fToShow[4]>0 && NumTpcTracks>0) { TGraph *tgrzy = new TGraph(NumTpcClus,tzf,tyf); tgrzy->SetMarkerStyle(20); tgrzy->SetMarkerSize(fps[4]); tgrzy->SetMarkerColor(1); mgrzy->Add(tgrzy,"P"); } if (fToShow[5]>0 && NumCdcHits>0) { TGraph *cgrzy = new TGraph(NumCdcHits,czf,cyf); cgrzy->SetMarkerStyle(20); cgrzy->SetMarkerSize(fps[5]); cgrzy->SetMarkerColor(9); mgrzy->Add(cgrzy,"P"); } if (fToShow[6]>0 && hhmulfsel>0) { TGraph *hfgrzy = new TGraph(hhmulfsel,hzf,hyf); hfgrzy->SetMarkerStyle(kStar); hfgrzy->SetMarkerSize(fps[6]); hfgrzy->SetMarkerColor(44); mgrzy->Add(hfgrzy,"P"); } if (fToShow[7]>0 && phmulf>0) { TGraph *pfgrzy = new TGraph(phmulf,pzf,pyf); pfgrzy->SetMarkerStyle(20); pfgrzy->SetMarkerSize(fps[7]); pfgrzy->SetMarkerColor(8); mgrzy->Add(pfgrzy,"P"); } if (fToShow[8]>0) for (Int_t ii=0; iiAdd(&(fthgrzy[ii]),"L"); mgrzy->Draw("P"); TAxis* tx3 = hzy.GetXaxis(); tx3->SetTitle("z [cm]"); tx3->SetNoExponent(kTRUE); TAxis* ty3 = hzy.GetYaxis(); ty3->SetTitle("ycd [cm]"); ty3->SetNoExponent(kTRUE); if (fToShow[8]>0) leg->Draw(); // z - x pad4->cd(); hzx.Draw(); TMultiGraph *mgrzx = new TMultiGraph(); if (fToShow[0]>0) for (Int_t ii=0; iiAdd(&(ttgrzx[ii]),"L"); if (fToShow[1]>0) for (Int_t ii=0; iiAdd(&(fhgrzx[ii]),"L"); if (fToShow[2]>0) for (Int_t ii=0; iiAdd(&(thgrzx[ii]),"P"); if (fToShow[3]>0) { TGraph *vgrzx = new TGraph(1,&vz,&vx); vgrzx->SetMarkerStyle(20); vgrzx->SetMarkerSize(fps[3]); vgrzx->SetMarkerColor(2); mgrzx->Add(vgrzx,"P"); } if (fToShow[4]>0 && NumTpcTracks>0) { TGraph *tgrzx = new TGraph(NumTpcClus,tzf,txf); tgrzx->SetMarkerStyle(20); tgrzx->SetMarkerSize(fps[4]); tgrzx->SetMarkerColor(1); mgrzx->Add(tgrzx,"P"); } if (fToShow[5]>0 && NumCdcHits>0) { TGraph *cgrzx = new TGraph(NumCdcHits,czf,cxf); cgrzx->SetMarkerStyle(20); cgrzx->SetMarkerSize(fps[5]); cgrzx->SetMarkerColor(9); mgrzx->Add(cgrzx,"P"); } if (fToShow[6]>0 && hhmulfsel>0) { TGraph *h1fgrzx = new TGraph(hhmulfsel,hzf,hx1f); h1fgrzx->SetMarkerStyle(kStar); h1fgrzx->SetMarkerSize(fps[6]); h1fgrzx->SetMarkerColor(42); TGraph *h2fgrzx = new TGraph(hhmulfsel,hzf,hx2f); h2fgrzx->SetMarkerStyle(kStar); h2fgrzx->SetMarkerSize(fps[6]); h2fgrzx->SetMarkerColor(46); mgrzx->Add(h1fgrzx,"P"); mgrzx->Add(h2fgrzx,"P"); } if (fToShow[7]>0 && phmulf>0) { TGraph *pfgrzx = new TGraph(phmulf,pzf,pxf); pfgrzx->SetMarkerStyle(20); pfgrzx->SetMarkerSize(fps[7]); pfgrzx->SetMarkerColor(8); mgrzx->Add(pfgrzx,"P"); } if (fToShow[8]>0) for (Int_t ii=0; iiAdd(&(fthgrzx[ii]),"L"); mgrzx->Draw(); TAxis* tx2 = hzx.GetXaxis(); tx2->SetTitle("z [cm]"); tx2->SetNoExponent(kTRUE); TAxis* ty2 = hzx.GetYaxis(); ty2->SetTitle("xdt [cm]"); ty2->SetNoExponent(kTRUE); // z - r pad3->cd(); hzr.Draw(); TMultiGraph *mgrzr = new TMultiGraph(); if (fToShow[0]>0) for (Int_t ii=0; iiAdd(&(ttgrzr[ii]),"L"); if (fToShow[1]>0) for (Int_t ii=0; iiAdd(&(fhgrzr[ii]),"L"); if (fToShow[2]>0) for (Int_t ii=0; iiAdd(&(thgrzr[ii]),"P"); if (fToShow[3]>0) { TGraph *vgrzr = new TGraph(1,&vz,&vr); vgrzr->SetMarkerStyle(20); vgrzr->SetMarkerSize(fps[3]); vgrzr->SetMarkerColor(2); mgrzr->Add(vgrzr,"P"); } if (fToShow[4]>0 && NumTpcTracks>0) { TGraph *tgrzr = new TGraph(NumTpcClus,tzf,trf); tgrzr->SetMarkerStyle(20); tgrzr->SetMarkerSize(fps[4]); tgrzr->SetMarkerColor(1); mgrzr->Add(tgrzr,"P"); } if (fToShow[5]>0 && NumCdcHits>0) { TGraph *cgrzr = new TGraph(NumCdcHits,czf,crf); cgrzr->SetMarkerStyle(20); cgrzr->SetMarkerSize(fps[5]); cgrzr->SetMarkerColor(9); mgrzr->Add(cgrzr,"P"); } if (fToShow[6]>0 && hhmulfsel>0) { TGraph *h1fgrzr = new TGraph(hhmulfsel,hzf,hr1f); h1fgrzr->SetMarkerStyle(kStar); h1fgrzr->SetMarkerSize(fps[6]); h1fgrzr->SetMarkerColor(42); TGraph *h2fgrzr = new TGraph(hhmulfsel,hzf,hr2f); h2fgrzr->SetMarkerStyle(kStar); h2fgrzr->SetMarkerSize(fps[6]); h2fgrzr->SetMarkerColor(46); mgrzr->Add(h1fgrzr,"P"); mgrzr->Add(h2fgrzr,"P"); } if (fToShow[7]>0 && phmulf>0) { TGraph *pfgrzr = new TGraph(phmulf,pzf,prf); pfgrzr->SetMarkerStyle(20); pfgrzr->SetMarkerSize(fps[7]); pfgrzr->SetMarkerColor(8); mgrzr->Add(pfgrzr,"P"); } if (fToShow[8]>0) for (Int_t ii=0; iiAdd(&(fthgrzr[ii]),"L"); mgrzr->Draw("P"); TAxis* tx4 = hzr.GetXaxis(); tx4->SetTitle("z [cm]"); tx4->SetNoExponent(kTRUE); TAxis* ty4 = hzr.GetYaxis(); ty4->SetTitle("r [cm]"); ty4->SetNoExponent(kTRUE); // write out some track information pad1->cd(); TLatex *txt = new TLatex(); txt->SetTextSize(0.05); txt->SetNDC(); sprintf(ltxt, "run, spill, event, ref.sec.: %i / %i / %i / %i", nrun,nspill,nevent,refsec); txt->DrawLatex(0.15,0.8,ltxt); sprintf(ltxt, "#tracks: TPC, Helitron: %i / %i",NumTpcTracks,NumHelTracks); txt->DrawLatex(0.15,0.75,ltxt); /* // legend TLegend *leg = new TLegend(0.05,0.1,0.95,0.7); leg->SetHeader("Color legend"); if (fToShow[0]>0) leg->AddEntry(&(ttgrxy[0]),"TPC fit","p"); if (fToShow[1]>0) leg->AddEntry(&(fhgrxy[0]),"HELITRON fit","p"); if (fToShow[2]>0) leg->AddEntry(&(thgrxy[0]),"HELITRON track","p"); if (fToShow[3]>0) leg->AddEntry(vgrzy,"Main Vertex","p"); if (fToShow[4]>0) leg->AddEntry(tgrzy,"TPC","p"); if (fToShow[5]>0) leg->AddEntry(cgrzy,"CDC","p"); if (fToShow[6]>0) leg->AddEntry(hfgrzy,"Helitron","p"); if (fToShow[7]>0) leg->AddEntry(pfgrzy,"Plawa","p"); leg->Draw(); */ // save canvas c1->Update(); c1->Print(fOutName); // cleanup /* delete(txt); delete(leg); */ c1->~TCanvas(); /* delete fx; delete fy; delete fz; delete fr; delete(txf); delete(tyf); delete(tzf); delete(trf); delete(cxf); delete(cyf); delete(czf); delete(crf); delete(hx1f); delete(hx2f); delete(hyf); delete(hzf); delete(hr1f); delete(hr2f); delete(pxf); delete(pyf); delete(pzf); delete(prf); if (NumTpcHelTracks > 0) { delete(fthx); delete(fthy); delete(fthz); delete(fthr); } // cleanup delete(tpchitsall); delete(plawahitsall); */ } ClassImp(TpcHelDisplayTask) //-----------------------------------------------------------