+
+//_____________________________________________________________________________
+AliMpArea*
+AliMUONGeometryTransformer::GetDEArea(Int_t detElemId) const
+{
+ /// Get area (in global coordinates) covered by a given detection element
+ if (!fDEAreas)
+ {
+ CreateDEAreas();
+ }
+ return static_cast<AliMpArea*>(fDEAreas->GetValue(detElemId));
+}
+
+//_____________________________________________________________________________
+void
+AliMUONGeometryTransformer::CreateDEAreas() const
+{
+ /// Create DE areas
+
+ fDEAreas = new AliMpExMap;
+
+ AliMpDEIterator it;
+
+ it.First();
+
+ /// Generate the DE areas in global coordinates
+
+ while ( !it.IsDone() )
+ {
+ Int_t detElemId = it.CurrentDEId();
+
+ if ( !HasDE(detElemId) ) continue;
+
+ const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0);
+
+ Double_t xg,yg,zg;
+
+ AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
+
+ Double_t xl(0.0), yl(0.0), zl(0.0);
+ Double_t dx(seg->GetDimensionX());
+ Double_t dy(seg->GetDimensionY());
+
+ if ( stationType == AliMp::kStation12 )
+ {
+ Double_t xmin(FLT_MAX);
+ Double_t xmax(-FLT_MAX);
+ Double_t ymin(FLT_MAX);
+ Double_t ymax(-FLT_MAX);
+
+ for ( Int_t icathode = 0; icathode < 2; ++icathode )
+ {
+ const AliMpVSegmentation* cathode
+ = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(icathode));
+
+ AliMpVPadIterator* itp = cathode->CreateIterator();
+
+ itp->First();
+
+ while ( !itp->IsDone() )
+ {
+ AliMpPad pad = itp->CurrentItem();
+ AliMpArea a(pad.GetPositionX(),pad.GetPositionY(),
+ pad.GetDimensionX(), pad.GetDimensionY());
+ xmin = TMath::Min(xmin,a.LeftBorder());
+ xmax = TMath::Max(xmax,a.RightBorder());
+ ymin = TMath::Min(ymin,a.DownBorder());
+ ymax = TMath::Max(ymax,a.UpBorder());
+ itp->Next();
+ }
+
+ delete itp;
+ }
+
+ xl = (xmin+xmax)/2.0;
+ yl = (ymin+ymax)/2.0;
+ dx = (xmax-xmin)/2.0;
+ dy = (ymax-ymin)/2.0;
+
+ Local2Global(detElemId,xl,yl,zl,xg,yg,zg);
+ }
+ else
+ {
+ Local2Global(detElemId,xl,yl,zl,xg,yg,zg);
+ }
+
+ fDEAreas->Add(detElemId,new AliMpArea(xg,yg,dx,dy));
+
+ it.Next();
+ }
+}
+
+//_____________________________________________________________________________
+Bool_t AliMUONGeometryTransformer::LoadMapping() const
+{
+/// Load mapping from CDB
+
+ if ( ! AliMpCDB::LoadMpSegmentation() )
+ {
+ AliFatal("Could not access mapping from OCDB !");
+ return false;
+ }
+
+ return true;
+}
+