+ gAL->GetEvent(evt);
+ AliStack *pStack=gAL->Stack();
+ TParticle *pTrack=pStack->Particle(tid);
+// Int_t mtid=pTrack->GetFirstMother();
+ TString str;
+ str.Append(Form("with P = %7.4f (%7.4f,%7.4f,%7.4f) GeV/c ",pTrack->P(),pTrack->Px(),pTrack->Py(),pTrack->Pz()));
+ gAL->UnloadHeader(); gAL->UnloadKinematics();
+ return str;
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void DispTB(TString t0,TString t1,TString t2,TString t3)
+{
+ fCanvasImp->SetStatusText(t0,0);
+ fCanvasImp->SetStatusText(t1,1);
+ fCanvasImp->SetStatusText(t2,2);
+ fCanvasImp->SetStatusText(t3,3);
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t FindPos(TVector3 xyz,Int_t &cham,Int_t §,Int_t &gap,Int_t &padX,Int_t &padY)
+{
+// It finds the chamber parameters for a given point
+// Arguments: xyz coordinates of a given point in MARS
+// Returns: cham chamber ID ( 0-6 )
+// sect sector ID ( 0-5 )
+// padX X (integer) of the pad in X in the given sector (1-80)
+// padY Y (integer) of the pad in Y in the given sector (1-48)
+ cham = -1;
+ TGeoNode *node = gGeoManager->FindNode(xyz.X(),xyz.Y(),xyz.Z());
+ if(!node) return kFALSE;
+ TGeoVolume *vol = node->GetVolume();
+ if(!vol) return kFALSE;
+ TGeoManager *geo = vol->GetGeoManager();
+ if(!geo) return kFALSE;
+ Int_t i=0;
+ while(geo->GetMother(i)) {
+ TString s = geo->GetMother(i)->GetName();
+// if(s.Contains("Hcel_")) padX=(Int_t)(s.Remove(0,5)).Atof();
+// if(s.Contains("Hrow_")) padY=(Int_t)(s.Remove(0,5)).Atof();
+// if(s.Contains("Hsec_")) sect=(Int_t)(s.Remove(0,5)).Atof();
+// if(s.Contains("Hmp_")) cham=(Int_t)(s.Remove(0,4)).Atof();
+ if(s.Contains("Hcel_")) padX=geo->GetMother(i)->GetNumber();
+ if(s.Contains("Hrow_")) padY=geo->GetMother(i)->GetNumber();
+ if(s.Contains("Hsec_")) sect=geo->GetMother(i)->GetNumber();
+ if(s.Contains("Hmp_")) cham=geo->GetMother(i)->GetNumber();
+ i++;
+ }
+ return (cham==-1) ? kFALSE : kTRUE;
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void DisplayInfo(Int_t evt,Int_t px, Int_t py)
+{
+ if(!gPad) return;
+ TVirtualPad *pPad=gPad->GetSelectedPad();
+ Int_t padN = pPad->GetNumber()-1;
+ if(padN<0 || padN>8) return;
+ Int_t ch,pc,padX,padY;
+ ch = fChamN[padN];
+ if(ch<0) return;
+ TString text0,text1,text2,text3;
+
+ Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py);
+ fParam->Lors2Pad(x,y,pc,padX,padY);
+ TVector3 xyz=fParam->Lors2Mars(ch,x,y);
+
+ if(padX>=0&&padY>=0) {
+ text0.Append(Form("Pad(%i,%i)-LORS(%6.2f,%6.2f)-MARS(%7.2f,%7.2f,%7.2f) A(%6.2f,%6.2f)",padX,padY,x,y,xyz.X(),xyz.Y(),xyz.Z(),
+ xyz.Theta()*TMath::RadToDeg(),xyz.Phi()*TMath::RadToDeg()));
+ text1.Append(Form("Module %i Sector %i",ch,pc));
+ text2="";
+ text3.Append(Form("Pads = %i - Clusters = %i - Occupancy %5.2f%%",fTotPads[ch],fTotClus[ch],100.*fTotPads[ch]/(144.*160.)));
+ }
+
+ TObject *obj = fCanvas->GetSelected();
+ TString name = obj->GetName();
+
+// Find object DIGIT
+
+ if(name=="") {DispTB(text0,text1,text2,text3);return;} // TLatex not interesting
+
+ if(name.Contains("TBox")) {
+ TBox *box = (TBox*)obj;
+ if(box->GetUniqueID()==0) return; // just black frame hit!
+ text2.Append(Form("charge = %i ADC",box->GetUniqueID()));
+ DispTB(text0,text1,text2,text3);
+ return;
+ }
+//
+// Find object HITs CLUSTER TRACK and RING (based on TPolyMarker and symbol)
+//
+ TPolyMarker *b = (TPolyMarker*)obj;
+
+ const Int_t big = 9999;
+
+ // check if point is near one of the points
+ Int_t distance = big;
+ Int_t index=0;
+
+ Double_t *xPol = b->GetX();
+ Double_t *yPol = b->GetY();
+
+ for(Int_t i=0;i<b->Size();i++) {
+ Int_t pxp = pPad->XtoAbsPixel(pPad->XtoPad(xPol[i]));
+ Int_t pyp = pPad->YtoAbsPixel(pPad->YtoPad(yPol[i]));
+ Int_t d = TMath::Abs(pxp-px) + TMath::Abs(pyp-py);
+ if (d < distance) {distance = d; index=i;}
+ }
+
+ Int_t symbol = b->GetMarkerStyle();
+
+ // kOpenTriangleUp Hit Mip
+ // kOpenCircle Hit Ckov
+ // kOpenDiamond Hit Feedback
+ // kStar Cluster
+ // kPlus Track
+ // kFullDotSmall Ring
+
+ // Case Hit Mip of Hit Ckov or Hit Feedback
+ if(symbol==kHitMip || symbol==kHitCko || symbol==kHitFee) {
+ if(evt!=kButton1Down) return;
+ TString nameHit;
+ Int_t iCko[7]={0,0,0,0,0,0,0};
+ Int_t iFee[7]={0,0,0,0,0,0,0};
+ Int_t iMip[7]={0,0,0,0,0,0,0};
+ Int_t iHit;
+ Int_t chHit;
+ Int_t indHit=0;
+
+ Int_t indTrk = b->GetUniqueID(); // track index
+ for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){//entries loop
+ fHitTree->GetEntry(iEnt);
+ for(iHit=0;iHit<fHitLst->GetEntries();iHit++) { //hits loop
+ AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(iHit);
+ chHit = pHit->Ch();
+ Int_t pid = pHit->Pid();
+ if(pid==50000050) iCko[chHit]++;
+ else if(pid==50000051) iFee[chHit]++;
+ else iMip[chHit]++;
+
+ if(symbol==kHitMip && ch==chHit && index==iMip[chHit]-1) {indTrk=iEnt;indHit = iHit;break;}
+ if(symbol==kHitCko && ch==chHit && index==iCko[chHit]-1) {indTrk=iEnt;indHit = iHit;break;}
+ if(symbol==kHitFee && ch==chHit && index==iFee[chHit]-1) {indTrk=iEnt;indHit = iHit;break;}
+ }
+ }
+ fHitTree->GetEntry(indTrk);
+ AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(indHit);
+
+ Int_t tid = pHit->Tid();
+
+ TString str = Stack(fEvt,tid);
+
+ Float_t x=pHit->LorsX();
+ Float_t y=pHit->LorsY();
+ Float_t charge = pHit->Q();
+
+ TVector3 v = fParam->Lors2Mars(pHit->Ch(),pHit->LorsX(),pHit->LorsY());
+ Int_t cham,sect,gap,padX,padY;
+ FindPos(v,cham,sect,gap,padX,padY);