#include <TVector2.h>
#include "AliMpVSegmentation.h"
#include "AliMpSegmentation.h"
-
+#include "AliMpExMapIterator.h"
#include "AliLog.h"
#include "AliAlignObjMatrix.h"
#include "AliAlignObj.h"
{
/// Create DE areas
- fDEAreas = new AliMpExMap(true);
+ fDEAreas = new AliMpExMap;
AliMpDEIterator it;
Double_t dx(seg->Dimensions().X());
Double_t dy(seg->Dimensions().Y());
- if ( stationType == AliMp::kStation1 || stationType == AliMp::kStation2 )
+ if ( stationType == AliMp::kStation12 )
{
Double_t xmin(FLT_MAX);
Double_t xmax(-FLT_MAX);
const AliMpVSegmentation* cathode
= AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(icathode));
- AliMpVPadIterator* it = cathode->CreateIterator();
+ AliMpVPadIterator* itp = cathode->CreateIterator();
- it->First();
+ itp->First();
- while ( !it->IsDone() )
+ while ( !itp->IsDone() )
{
- AliMpPad pad = it->CurrentItem();
+ AliMpPad pad = itp->CurrentItem();
AliMpArea a(pad.Position(),pad.Dimensions());
xmin = TMath::Min(xmin,a.LeftBorder());
xmax = TMath::Max(xmax,a.RightBorder());
ymin = TMath::Min(ymin,a.DownBorder());
ymax = TMath::Max(ymax,a.UpBorder());
- it->Next();
+ itp->Next();
}
- delete it;
+ delete itp;
}
xl = (xmin+xmax)/2.0;
// Loop over detection elements
AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
-
- for (Int_t j=0; j<detElements->GetSize(); j++) {
- AliMUONGeometryDetElement* detElement
- = (AliMUONGeometryDetElement*)detElements->GetObject(j);
-
+ TIter next(detElements->CreateIterator());
+ AliMUONGeometryDetElement* detElement;
+
+ while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
+ {
// Det element symbolic name
- TString symname = GetDESymName(detElement->GetId());
+ TString symnameDE = GetDESymName(detElement->GetId());
// Set global matrix from physical node
- TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symname);
+ TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symnameDE);
if ( ! globalMatrix ) {
AliErrorStream() << "Detection element matrix not found." << endl;
return false;
AliMUONGeometryModuleTransformer* moduleTransformer
= (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
-
- for (Int_t j=0; j<detElements->GetSize(); j++) {
- AliMUONGeometryDetElement* detElement
- = (AliMUONGeometryDetElement*)detElements->GetObject(j);
+ TIter next(detElements->CreateIterator());
+ AliMUONGeometryDetElement* detElement;
+ while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
+ {
const TGeoMatrix* transform
= detElement->GetLocalTransformation();
// Load mapping as its info is used to define modules & DEs
LoadMapping();
- // Loop over geometry module
- for (Int_t moduleId = 0; moduleId < AliMpConstants::NofGeomModules(); ++moduleId ) {
+ if ( fModuleTransformers->GetEntriesFast() == 0 ) {
+ // Create modules only if they do not yet exist
+
+ // Loop over geometry module
+ for (Int_t moduleId = 0; moduleId < AliMpConstants::NofGeomModules(); ++moduleId ) {
- // Create geometry module transformer
- AliMUONGeometryModuleTransformer* moduleTransformer
- = new AliMUONGeometryModuleTransformer(moduleId);
- AddModuleTransformer(moduleTransformer);
- }
+ // Create geometry module transformer
+ AliMUONGeometryModuleTransformer* moduleTransformer
+ = new AliMUONGeometryModuleTransformer(moduleId);
+ AddModuleTransformer(moduleTransformer);
+ }
+ }
// Loop over detection elements
AliMpDEIterator it;
module->GetVolumePath());
if ( ! pnEntry ) {
AliErrorStream()
- << "Volume path for geometry module "
- << module->GetModuleId()
+ << "Volume path " << module->GetVolumePath().Data()
+ << " for geometry module " << module->GetModuleId() << " " << module
<< " not found in geometry." << endl;
}
else {
// Detection elements
AliMpExMap* detElements = module->GetDetElementStore();
-
- for (Int_t j=0; j<detElements->GetSize(); j++) {
- AliMUONGeometryDetElement* detElement
- = (AliMUONGeometryDetElement*)detElements->GetObject(j);
-
+ TIter next(detElements->CreateIterator());
+ AliMUONGeometryDetElement* detElement;
+
+ while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
+ {
// Set detection element symbolic name
- TGeoPNEntry* pnEntry
+ TGeoPNEntry* pnEntryDE
= gGeoManager->SetAlignableEntry(GetDESymName(detElement->GetId()),
detElement->GetVolumePath());
- if ( ! pnEntry ) {
+ if ( ! pnEntryDE ) {
AliErrorStream()
- << "Volume path for detection element "
- << detElement->GetId()
+ << "Volume path "
+ << detElement->GetVolumePath().Data()
+ << " for detection element " << detElement->GetId()
<< " not found in geometry." << endl;
}
else {
// Set detection element matrix
- pnEntry->SetMatrix(new TGeoHMatrix(*detElement->GetGlobalTransformation()));
+ pnEntryDE->SetMatrix(new TGeoHMatrix(*detElement->GetGlobalTransformation()));
// the matrix will be deleted via TGeoManager
}
}
for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
AliMUONGeometryModuleTransformer* moduleTransformer
= (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
- AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
- for (Int_t j=0; j<detElements->GetSize(); j++) {
- AliMUONGeometryDetElement* detElement
- = (AliMUONGeometryDetElement*)detElements->GetObject(j);
-
+ AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
+ TIter next(detElements->CreateIterator());
+ AliMUONGeometryDetElement* detElement;
+
+ while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
+ {
Int_t detElemId = detElement->GetId();
// Align object ID