+/// Draw a view of MUON clusters
+
+ AliInfo(" Draw View");
+
+ gPad->SetCursor(kWatch);
+ // gPad->SetFillColor(39);
+ gPad->SetFillColor(1);
+ gPad->Clear();
+ // gPad->SetFillColor(39);
+ gPad->SetFillColor(1);
+
+ Int_t iret=0;
+ TView *view = new TView(1);
+
+ Float_t range = fRrange*fRangeSlider->GetMaximum();
+ view->SetRange(-range,-range,-range,range, range, range);
+ // zoom back to full scale only if DrawView not called from NextCathode
+ if (!fNextCathode) {
+ fZoomX0[0] = -1;
+ fZoomY0[0] = -1;
+ fZoomX1[0] = 1;
+ fZoomY1[0] = 1;
+ fZooms = 0;
+ }
+
+ Float_t xg1, xg2, yg1, yg2, zg1, zg2;
+
+ // Recovering the chamber
+ AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
+
+ const AliMUONGeometryTransformer* kGeomTransformer
+ = pMUON->GetGeometryTransformer();
+
+ AliMUONSegmentation* segmentation = pMUON->GetSegmentation();
+ AliMpSegFactory segFactory;
+ // Mapping segmentation factory will be used only to create mapping
+ // segmentations if not present in the DE segmentations
+
+ // Display MUON Chamber Geometry
+ char nodeName[7];
+ sprintf(nodeName,"MUON%d",100+fChamber);
+ printf(">>>> chamber is %d\n",fChamber);
+
+ if(fChamber < 5) {
+ AliMpDEIterator it;
+ for ( it.First(fChamber-1); ! it.IsDone(); it.Next() ) {
+
+ Int_t detElemId = it.CurrentDE();
+ AliMpSectorSegmentation * seg =
+ (AliMpSectorSegmentation *) segmentation->GetMpSegmentation(detElemId, 0);
+ const AliMpSector * sector = seg->GetSector();
+
+ // get sector measurements
+ TVector2 position = sector->Position();
+ TVector2 dimension = sector->Dimensions(); // half length
+
+ Float_t xlocal1 = position.Px(); // FIXME: not really needed as it's 0 ?
+ Float_t ylocal1 = position.Py(); // FIXME: not really needed as it's 0 ?
+ Float_t xlocal2 = dimension.Px() * 2.;
+ Float_t ylocal2 = dimension.Px() * 2.;
+
+ kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
+ kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2);
+
+ // drawing
+ TPolyLine3D* poly = new TPolyLine3D();
+ Int_t nPoint = 0;
+
+ poly->SetPoint(nPoint++, xg1, yg1, 0.);
+ for (Float_t d = 0; d < TMath::Pi()/2.; d+= 0.01) {
+ Float_t x = xg1 + xg2 * TMath::Cos(d);
+ Float_t y = yg1 + yg2 * TMath::Sin(d);
+ poly->SetPoint(nPoint++, x, y, 0.);
+ }
+ poly->SetPoint(nPoint++, xg1, yg1, 0.);
+
+ poly->SetLineColor(2);
+ poly->Draw("s");
+ }
+
+ }
+
+ if (fChamber>4)
+ {
+ AliMpDEIterator it;
+ for ( it.First(fChamber-1); ! it.IsDone(); it.Next() )
+ {
+ Int_t detElemId = it.CurrentDE();
+ AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId);
+
+ if ( segmentation->HasDE(detElemId) )
+ {
+ const AliMpVSegmentation* seg = segmentation->GetMpSegmentation(detElemId, 0);
+ if (!seg) {
+ // Create mapping segmentation if old trigger segmentation
+ // (not using mapping)
+ seg = segFactory.CreateMpSegmentation(detElemId, 0);
+ }
+ if (seg)
+ {
+ Float_t deltax = seg->Dimensions().X();
+ Float_t deltay = seg->Dimensions().Y();
+ Float_t xlocal1 = -deltax;
+ Float_t ylocal1 = -deltay;
+ Float_t xlocal2 = +deltax;
+ Float_t ylocal2 = +deltay;
+ kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
+ kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2);
+
+ // drawing slat active volumes
+ Float_t xCenter = (xg1 + xg2)/2.;
+ Float_t yCenter = (yg1 + yg2)/2.;
+
+ TMarker3DBox* box = new TMarker3DBox(xCenter,yCenter,0,xlocal1,ylocal2,0,0,0);
+
+ box->SetFillStyle(0);
+ box->SetLineColor( stationType == kStationTrigger ? 4 : 2);
+ box->Draw("s");
+
+ if ( stationType == kStation345 )
+ {
+ // drawing inner circle + disc
+ TPolyLine3D* poly = new TPolyLine3D();
+ TPolyLine3D* poly1 = new TPolyLine3D();
+
+ Int_t nPoint = 0;
+ Int_t nPoint1 = 0;
+ for (Float_t d = 0; d < 6.24; d+= 0.005)
+ {
+ Double_t x = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Cos(d)/2.;
+ Double_t y = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Sin(d)/2.;
+ if (nPoint % 2 == 0) poly->SetPoint(nPoint++, 0., 0., 0.);
+ poly->SetPoint(nPoint++, x, y, 0.);
+ poly1->SetPoint(nPoint1++, x, y, 0.);
+ }
+ poly->SetLineColor(1);
+ poly->Draw("s");
+ poly1->SetLineColor(2);
+ poly1->Draw("s");
+ }
+ }
+ }
+ }
+ }
+
+// // Delete mapping segmentations created with factory
+// segFactory.DeleteSegmentations();
+
+ //add clusters to the pad
+ DrawClusters();
+ DrawHits();
+ DrawCoG();
+ // DrawSegmentation();
+ // add itself to the list (must be last)
+ AppendPad();
+ view->SetView(phi, theta, psi, iret);
+}
+
+//_____________________________________________________________________________
+void AliMUONDisplay::DrawGlobalView(Float_t theta, Float_t phi, Float_t psi)
+{
+/// Draw a view of muons chambers with tracks