-#else
- if (fSimulator) fSimulator->EndEvent();
-#endif
-}
-
-
-//====================================================================
-//
-// Graphics and event display
-//
-//____________________________________________________________________
-void
-AliFMD::BuildGeometry()
-{
- //
- // Build simple ROOT TNode geometry for event display
- //
- // Build a simplified geometry of the FMD used for event display
- //
- // The actual building of the TNodes is done by
- // AliFMDSubDetector::SimpleGeometry.
- AliDebug(10, "\tCreating a simplified geometry");
-
- AliFMDGeometry* fmd = AliFMDGeometry::Instance();
-
- static TXTRU* innerShape = 0;
- static TXTRU* outerShape = 0;
- static TObjArray* innerRot = 0;
- static TObjArray* outerRot = 0;
-
- if (!innerShape || !outerShape) {
- // Make the shapes for the modules
- for (Int_t i = 0; i < 2; i++) {
- AliFMDRing* r = 0;
- switch (i) {
- case 0: r = fmd->GetRing('I'); break;
- case 1: r = fmd->GetRing('O'); break;
- }
- if (!r) {
- AliError(Form("no ring found for i=%d", i));
- return;
- }
- Double_t siThick = r->GetSiThickness();
- const Int_t nv = r->GetNVerticies();
- Double_t theta = r->GetTheta();
- Int_t nmod = r->GetNModules();
-
- TXTRU* shape = new TXTRU(r->GetName(), r->GetTitle(), "void", nv, 2);
- for (Int_t j = 0; j < nv; j++) {
- TVector2* vv = r->GetVertex(nv - 1 - j);
- shape->DefineVertex(j, vv->X(), vv->Y());
- }
- shape->DefineSection(0, -siThick / 2, 1, 0, 0);
- shape->DefineSection(1, +siThick / 2, 1, 0, 0);
- shape->SetLineColor(GetLineColor());
-
- TObjArray* rots = new TObjArray(nmod);
- for (Int_t j = 0; j < nmod; j++) {
- Double_t th = (j + .5) * theta * 2;
- TString name(Form("FMD_ring_%c_rot_%02d", r->GetId(), j));
- TString title(Form("FMD Ring %c Rotation # %d", r->GetId(), j));
- TRotMatrix* rot = new TRotMatrix(name.Data(), title.Data(),
- 90, th, 90, fmod(90+th,360), 0, 0);
- rots->AddAt(rot, j);
- }
-
- switch (r->GetId()) {
- case 'i':
- case 'I': innerShape = shape; innerRot = rots; break;
- case 'o':
- case 'O': outerShape = shape; outerRot = rots; break;
- }
- }
- }
-
- TNode* top = gAlice->GetGeometry()->GetNode("alice");
-
- for (Int_t i = 1; i <= 3; i++) {
- AliFMDDetector* det = fmd->GetDetector(i);
- if (!det) {
- Warning("BuildGeometry", "FMD%d seems to be disabled", i);
- continue;
- }
- Double_t w = 0;
- Double_t rh = det->GetRing('I')->GetHighR();
- Char_t id = 'I';
- if (det->GetRing('O')) {
- w = TMath::Abs(det->GetRingZ('O') - det->GetRingZ('I'));
- id = (TMath::Abs(det->GetRingZ('O'))
- > TMath::Abs(det->GetRingZ('I')) ? 'O' : 'I');
- rh = det->GetRing('O')->GetHighR();
- }
- w += (det->GetRing(id)->GetModuleSpacing() +
- det->GetRing(id)->GetSiThickness());
- TShape* shape = new TTUBE(det->GetName(), det->GetTitle(), "void",
- det->GetRing('I')->GetLowR(), rh, w / 2);
- Double_t z = (det->GetRingZ('I') - w / 2);
- if (z > 0) z += det->GetRing(id)->GetModuleSpacing();
- top->cd();
- TNode* node = new TNode(det->GetName(), det->GetTitle(), shape,
- 0, 0, z, 0);
- fNodes->Add(node);
-
- for (Int_t j = 0; j < 2; j++) {
- AliFMDRing* r = 0;
- TShape* rshape = 0;
- TObjArray* rots = 0;
- switch (j) {
- case 0:
- r = det->GetRing('I'); rshape = innerShape; rots = innerRot; break;
- case 1:
- r = det->GetRing('O'); rshape = outerShape; rots = outerRot; break;
- }
- if (!r) continue;
-
- Double_t siThick = r->GetSiThickness();
- Int_t nmod = r->GetNModules();
- Double_t modspace = r->GetModuleSpacing();
- Double_t rz = - (z - det->GetRingZ(r->GetId()));
-
- for (Int_t k = 0; k < nmod; k++) {
- node->cd();
- Double_t offz = (k % 2 == 1 ? modspace : 0);
- TRotMatrix* rot = static_cast<TRotMatrix*>(rots->At(k));
- TString name(Form("%s%c_module_%02d", det->GetName(), r->GetId(),k));
- TString title(Form("%s%c Module %d", det->GetName(), r->GetId(),k));
- TNode* mnod = new TNode(name.Data(), title.Data(), rshape,
- 0, 0, rz - siThick / 2
- + TMath::Sign(offz,z), rot);
- mnod->SetLineColor(GetLineColor());
- fNodes->Add(mnod);
- } // for (Int_t k = 0 ; ...)
- } // for (Int_t j = 0 ; ...)
- } // for (Int_t i = 1 ; ...)