#include "AliMpMotifPosition.h"
#include "AliMpMotifType.h"
#include "AliMpSector.h"
-#include "AliMpSectorSegmentation.h"
#include "AliMpSegmentation.h"
#include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
#include "AliMpStationType.h"
#include "AliMpVMotif.h"
#include "AliCodeTimer.h"
AliCodeTimerAuto("")
- const AliMpVSegmentation* vseg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
- if (!vseg)
- {
- AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId));
- }
-
AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
if ( stationType == AliMp::kStation345 )
{
- const AliMpSlatSegmentation* seg = static_cast<const AliMpSlatSegmentation*>(vseg);
- const AliMpSlat* slat = seg->Slat();
- return slat->FindMotifPosition(manuId);
+ const AliMpSlat* kSlat
+ = AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId);
+ if ( ! kSlat ) {
+ AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId));
+ }
+ return kSlat->FindMotifPosition(manuId);
}
else
{
- const AliMpSectorSegmentation* seg = static_cast<const AliMpSectorSegmentation*>(vseg);
- const AliMpSector* sector = seg->GetSector();
- return sector->GetMotifMap()->FindMotifPosition(manuId);
+ const AliMpSector* kSector
+ = AliMpSegmentation::Instance()->GetSectorByElectronics(detElemId,manuId);
+ if ( ! kSector ) {
+ AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId));
+ }
+ return kSector->GetMotifMap()->FindMotifPosition(manuId);
}
return 0x0;
}
#include "AliMpPCB.h"
#include "AliMpPad.h"
#include "AliMpSector.h"
-#include "AliMpSectorSegmentation.h"
#include "AliMpSegmentation.h"
#include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
#include "AliMpStationType.h"
#include "AliMpVPadIterator.h"
#include "AliCodeTimer.h"
AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,planeType);
- const AliMpVSegmentation* seg =
- AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathodeType);
-
- const AliMpSectorSegmentation* sectorSeg = static_cast<const AliMpSectorSegmentation*>(seg);
- return sectorSeg->GetSector();
-
+ return AliMpSegmentation::Instance()->GetSector(detElemId,cathodeType);
}
//_____________________________________________________________________________
AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
if ( stationType != AliMp::kStation345 ) return 0x0;
- const AliMpVSegmentation* seg =
- AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathodeType);
-
- const AliMpSlatSegmentation* slatSeg = static_cast<const AliMpSlatSegmentation*>(seg);
- return slatSeg->Slat();
+ return AliMpSegmentation::Instance()->GetSlat(detElemId,cathodeType);
}
//_____________________________________________________________________________
AliMUONPainterHelper::GetSlat(Int_t detElemId, Int_t manuId) const
{
/// Get a given slat
- const AliMpVSegmentation* seg =
- AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
-
- const AliMpSlatSegmentation* slatSeg = static_cast<const AliMpSlatSegmentation*>(seg);
- return slatSeg->Slat();
+ AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
+ if ( stationType != AliMp::kStation345 ) return 0x0;
+
+ return AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId);
}
//_____________________________________________________________________________
#include "AliMpContainers.h"
#include "AliMpConstants.h"
#include "AliMpCDB.h"
-#include "AliMpSectorSegmentation.h"
#include "AliMpSector.h"
#include "AliMpRow.h"
#include "AliMpVRowSegment.h"
AliFatal("Mapping has to be loaded first !");
}
- const AliMpSectorSegmentation* kSegmentation1
- = dynamic_cast<const AliMpSectorSegmentation*>(
- AliMpSegmentation::Instance()
- ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane)));
- if ( ! kSegmentation1 ) {
+ const AliMpSector* kSector1
+ = AliMpSegmentation::Instance()->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane));
+ if ( ! kSector1 ) {
AliFatal("Could not access sector segmentation !");
}
- const AliMpSector* kSector1 = kSegmentation1->GetSector();
-
//Bool_t reflectZ = true;
Bool_t reflectZ = false;
//TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.);
// Fix (7) - overlap of SQ42 with MCHL (after moving the whole sector
// in the true position)
- const AliMpSectorSegmentation* kSegmentation2
- = dynamic_cast<const AliMpSectorSegmentation*>(
- AliMpSegmentation::Instance()
- ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane)));
- if ( ! kSegmentation2 ) {
- AliFatal("Could not access sector segmentation !");
+ const AliMpSector* kSector2
+ = AliMpSegmentation::Instance()
+ ->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane));
+ if ( ! kSector2 ) {
+ AliFatal("Could not access sector !");
}
-
- const AliMpSector* kSector2 = kSegmentation2->GetSector();
//reflectZ = false;
reflectZ = true;
#include "AliMUONTriggerCircuit.h"
#include "AliMUONConstants.h"
-#include "AliMpTriggerSegmentation.h"
#include "AliMpTrigger.h"
#include "AliMpSlat.h"
#include "AliMpPCB.h"
->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
// get iFirstStrip in this module
- const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
- const AliMpTrigger* t = trig->Slat();
+ const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fCurrentSeg);
const AliMpSlat* slat = t->GetLayer(0);
if (iline == 5) icolDo = icol + 1; // special case
if (zeroAllYLSB) iStripCircuit = 8;
// get iFirstStrip in this module
- const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
- const AliMpTrigger* t = trig->Slat();
+ const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fCurrentSeg);
const AliMpSlat* slat = t->GetLayer(0);
const AliMpPCB* pcb = slat->GetPCB(icol-1);
// x-strips
manuIdPrev = 0;
- const AliMpTriggerSegmentation *trigseg0 = static_cast<const AliMpTriggerSegmentation*>(seg0);
for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) {
for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) {
AliMpIntPair indices(ix,iy);
- AliMpPad pad = trigseg0->PadByIndices(indices,kFALSE);
+ AliMpPad pad = seg0->PadByIndices(indices,kFALSE);
if (pad.IsValid()) {
AliMpIntPair loc = pad.GetLocation(0);
Int_t manuId = loc.GetFirst();
// y-strips
manuIdPrev = 0;
- const AliMpTriggerSegmentation *trigseg1 = static_cast<const AliMpTriggerSegmentation*>(seg1);
for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) {
for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) {
AliMpIntPair indices(ix,iy);
- AliMpPad pad = trigseg1->PadByIndices(indices,kFALSE);
+ AliMpPad pad = seg1->PadByIndices(indices,kFALSE);
if (pad.IsValid()) {
Int_t nloc = pad.GetNofLocations();
for (Int_t iloc = 0; iloc < nloc; iloc++) {
#include "AliMpConstants.h"
#include "AliMpDEManager.h"
#include "AliMpSegmentation.h"
-#include "AliMpSlatSegmentation.h"
#include "AliMpSlat.h"
#include "AliMpPCB.h"
#include "AliMpMotifPosition.h"
if ( AliMpDEManager::GetStationType(fDEId) == AliMp::kStation345 ) {
- const AliMpSlatSegmentation* seg0
- = static_cast<const AliMpSlatSegmentation*>(
- AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath0));
-
- const AliMpSlatSegmentation* seg1
- = static_cast<const AliMpSlatSegmentation*>(
- AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath1));
-
- const AliMpSlat* slat0 = seg0->Slat();
- const AliMpSlat* slat1 = seg1->Slat();
+ const AliMpSlat* kSlat0
+ = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath0);
+ const AliMpSlat* kSlat1
+ = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath1);
Int_t iPcb = 0;
Int_t iPcbPrev = -1;
// Loop over manu
for (Int_t iManu = 0; iManu < GetNofManus(); ++iManu) {
Int_t manuId = GetManuId(iManu);
- AliMpMotifPosition* motifPos0 = slat0->FindMotifPosition(manuId);
- AliMpMotifPosition* motifPos1 = slat1->FindMotifPosition(manuId);
+ AliMpMotifPosition* motifPos0 = kSlat0->FindMotifPosition(manuId);
+ AliMpMotifPosition* motifPos1 = kSlat1->FindMotifPosition(manuId);
if ( !motifPos0 && !motifPos1 ) {
// should never happen
// find PCB id
if ( motifPos0 ) {
x = motifPos0->Position().X();
- length = slat0->GetPCB(0)->DX()*2.;
+ length = kSlat0->GetPCB(0)->DX()*2.;
}
if ( motifPos1 ) {
x = motifPos1->Position().X();
- length = slat1->GetPCB(0)->DX()*2.;
+ length = kSlat1->GetPCB(0)->DX()*2.;
}
iPcb = Int_t(x/length + AliMpConstants::LengthTolerance());
#include "AliMpMotifMap.h"
#include "AliMpMotifPosition.h"
#include "AliMpSector.h"
-#include "AliMpSectorSegmentation.h"
#include "AliMpSegmentation.h"
#include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
#include "AliMpConstants.h"
#include <Riostream.h>
#include <TMap.h>
AliCodeTimerAuto("")
- const AliMpSlatSegmentation* seg = static_cast<const AliMpSlatSegmentation*>
- (AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId));
- if (!seg) return -1;
-
- const AliMpSlat* slat = seg->Slat();
+ const AliMpSlat* slat
+ = AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId, manuId);
+ if ( ! slat ) return -1;
return slat->FindPCBIndexByMotifPositionID(manuId);
}
AliCodeTimerAuto("")
- const AliMpSectorSegmentation* seg = static_cast<const AliMpSectorSegmentation*>
- (AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId));
- if (!seg) return -1;
-
- const AliMpSector* sector = seg->GetSector();
+ const AliMpSector* sector
+ = AliMpSegmentation::Instance()->GetSectorByElectronics(detElemId, manuId);
+ if ( ! sector ) return -1;
+
const AliMpMotifMap* motifMap = sector->GetMotifMap();
const AliMpMotifPosition* motifPos = motifMap->FindMotifPosition(manuId);
}
else
{
- const AliMpSlatSegmentation* seg = static_cast<const AliMpSlatSegmentation*>
- (AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0));
- const AliMpSlat* slat = seg->Slat();
+ const AliMpSlat* slat
+ = AliMpSegmentation::Instance()->GetSlat(detElemId, AliMp::kCath0);
return slat->GetSize();
}
}
AliMp::PlaneType PlaneType() const;
+ AliMp::StationType StationType() const;
+
TVector2 Dimensions() const;
private:
inline const AliMpSector* AliMpSectorSegmentation::GetSector() const
{ return fkSector; }
+/// Return station type
+inline AliMp::StationType AliMpSectorSegmentation::StationType() const
+{ return AliMp::kStation12; }
+
+
#endif //ALI_MP_SECTOR_SEGMENTATION_H
return static_cast<AliMpVSegmentation*>(object);
}
+
+//_____________________________________________________________________________
+const AliMpSector*
+AliMpSegmentation::GetSector(const AliMpVSegmentation* kSegmentation,
+ Bool_t warn) const
+{
+/// Return sector for given mapping segmentation.
+/// If segmentation is not of sector type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ if ( ! kSegmentation ) return 0;
+
+ if ( kSegmentation->StationType() != AliMp::kStation12 ) {
+ if ( warn ) {
+ AliErrorStream()
+ << "Segmentation is not of sector type" << endl;
+ }
+ return 0;
+ }
+
+ return
+ static_cast<const AliMpSectorSegmentation*>(kSegmentation)->GetSector();
+}
+
+//_____________________________________________________________________________
+const AliMpSector*
+AliMpSegmentation::GetSector(Int_t detElemId, AliMp::CathodType cath,
+ Bool_t warn) const
+{
+/// Return sector for given detElemId and cath.
+/// If segmentation is not of sector type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ return GetSector(GetMpSegmentation(detElemId, cath, warn), warn);
+}
+
+//_____________________________________________________________________________
+const AliMpSector*
+AliMpSegmentation::GetSectorByElectronics(Int_t detElemId, Int_t elCardID,
+ Bool_t warn) const
+{
+/// Return sector for given detElemId and elCardID.
+/// If segmentation is not of sector type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ return GetSector(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn);
+}
+
+//_____________________________________________________________________________
+const AliMpSlat*
+AliMpSegmentation::GetSlat(const AliMpVSegmentation* kSegmentation,
+ Bool_t warn) const
+{
+/// Return slat for given mapping segmentation.
+/// If segmentation is not of slat type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ if ( ! kSegmentation ) return 0;
+
+ if ( kSegmentation->StationType() != AliMp::kStation345 ) {
+ if ( warn ) {
+ AliErrorStream()
+ << "Segmentation is not of slat type" << endl;
+ }
+ return 0;
+ }
+
+ return
+ static_cast<const AliMpSlatSegmentation*>(kSegmentation)->Slat();
+}
+
+//_____________________________________________________________________________
+const AliMpSlat*
+AliMpSegmentation::GetSlat(Int_t detElemId, AliMp::CathodType cath,
+ Bool_t warn) const
+{
+/// Return slat for given detElemId and cath.
+/// If segmentation is not of slat type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ return GetSlat(GetMpSegmentation(detElemId, cath, warn), warn);
+}
+
+//_____________________________________________________________________________
+const AliMpSlat*
+AliMpSegmentation::GetSlatByElectronics(Int_t detElemId, Int_t elCardID,
+ Bool_t warn) const
+{
+/// Return slat for given detElemId and elCardID.
+/// If segmentation is not of slat type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ return GetSlat(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn);
+}
+
+//_____________________________________________________________________________
+const AliMpTrigger*
+AliMpSegmentation::GetTrigger(const AliMpVSegmentation* kSegmentation,
+ Bool_t warn) const
+{
+/// Return trigger for given mapping segmentation.
+/// If segmentation is not of trigger type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ if ( ! kSegmentation ) return 0;
+
+ if ( kSegmentation->StationType() != AliMp::kStationTrigger ) {
+ if ( warn ) {
+ AliErrorStream()
+ << "Segmentation is not of trigger type" << endl;
+ }
+ return 0;
+ }
+
+ return
+ static_cast<const AliMpTriggerSegmentation*>(kSegmentation)->Slat();
+}
+
+//_____________________________________________________________________________
+const AliMpTrigger*
+AliMpSegmentation::GetTrigger(Int_t detElemId, AliMp::CathodType cath,
+ Bool_t warn) const
+{
+/// Return trigger for given detElemId and cath.
+/// If segmentation is not of trigger type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ return GetTrigger(GetMpSegmentation(detElemId, cath, warn), warn);
+}
+
+//_____________________________________________________________________________
+const AliMpTrigger*
+AliMpSegmentation::GetTriggerByElectronics(Int_t detElemId, Int_t elCardID,
+ Bool_t warn) const
+{
+/// Return trigger for given detElemId and elCardID.
+/// If segmentation is not of trigger type, zero is returned
+/// and an Error is issued if warn is set true (default).
+
+ return GetTrigger(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn);
+}
/// \brief Singleton container class for mapping segmentations
///
/// It provides access to mapping segmentations based on the
-/// AliMpVSegmentation interface. \n
+/// AliMpVSegmentation interface and to segmentations underlying
+/// detectors (sector, slat, trigger). \n
/// Mapping segmentations for all detection elements
/// are created at the first call to AliMpSegmentation::Instance().
/// The class is a singleton, it has all constructors
class AliMpSegmentation;
class AliMpSlatMotifMap;
class AliMpDataStreams;
+class AliMpSector;
+class AliMpSlat;
+class AliMpTrigger;
class TRootIOCtor;
class AliMpSegmentation : public TObject {
Bool_t warn = true);
// methods
+
+ //
+ // Access to segmentations
+ //
+
const AliMpVSegmentation* GetMpSegmentation(
Int_t detElemId, AliMp::CathodType cath,
Bool_t warn = true) const;
const AliMpVSegmentation* GetMpSegmentationByElectronics(
Int_t detElemId, Int_t elCardID,
Bool_t warn = true) const;
-
+ //
+ // Access to sectors, slats, triggers
+ //
+
+ const AliMpSector* GetSector(const AliMpVSegmentation* kSegmentation,
+ Bool_t warn = true) const;
+ const AliMpSector* GetSector(Int_t detElemId, AliMp::CathodType cath,
+ Bool_t warn = true) const;
+ const AliMpSector* GetSectorByElectronics(Int_t detElemId, Int_t elCardID,
+ Bool_t warn = true) const;
+
+ const AliMpSlat* GetSlat(const AliMpVSegmentation* kSegmentation,
+ Bool_t warn = true) const;
+ const AliMpSlat* GetSlat(Int_t detElemId, AliMp::CathodType cath,
+ Bool_t warn = true) const;
+ const AliMpSlat* GetSlatByElectronics(Int_t detElemId, Int_t elCardID,
+ Bool_t warn = true) const;
+
+ const AliMpTrigger* GetTrigger(const AliMpVSegmentation* kSegmentation,
+ Bool_t warn = true) const;
+ const AliMpTrigger* GetTrigger(Int_t detElemId, AliMp::CathodType cath,
+ Bool_t warn = true) const;
+ const AliMpTrigger* GetTriggerByElectronics(Int_t detElemId, Int_t elCardID,
+ Bool_t warn = true) const;
+
private:
AliMpSegmentation(const AliMpDataStreams& dataStreams);
/// Not implemented
AliMpVSegmentation* CreateMpSegmentation(
Int_t detElemId, AliMp::CathodType cath);
+
AliMpExMap* FillElCardsMap(Int_t detElemId);
void GetAllElectronicCardIDs(TArrayI& ecn) const;
- AliMp::PlaneType PlaneType() const;
+ virtual AliMp::PlaneType PlaneType() const;
+
+ virtual AliMp::StationType StationType() const;
TVector2 Dimensions() const;
ClassDef(AliMpSlatSegmentation,2) // A slat for stations 3,4,5
};
+/// Return station type
+inline AliMp::StationType AliMpSlatSegmentation::StationType() const
+{ return AliMp::kStation345; }
+
#endif
switch ( stationType ) {
case kStation1: return "st1"; break;
case kStation2: return "st2"; break;
+ case kStation12: return "st12"; break;
case kStation345: return "slat"; break;
case kStationTrigger: return "trigger"; break;
}
{
kStation1, ///< station 1 (quadrants)
kStation2, ///< station 2 (quadrants)
+ kStation12, ///< station 1,2 (quadrants)
kStation345, ///< station 3,4,5 (slats)
kStationTrigger ///< trigger stations (slats)
};
virtual void GetAllElectronicCardIDs(TArrayI& ecn) const;
- AliMp::PlaneType PlaneType() const;
-
+ virtual AliMp::PlaneType PlaneType() const;
+
+ virtual AliMp::StationType StationType() const;
+
TVector2 Dimensions() const;
private:
AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right);
/// Not implemented
AliMpTriggerSegmentation& operator = (const AliMpTriggerSegmentation& right);
-
+
const AliMpTrigger* fkSlat; ///< Slat
Bool_t fIsOwner;///< Trigger slat ownership
Int_t fNofStrips; ///< Number of strips in this slat
ClassDef(AliMpTriggerSegmentation,3) // Segmentation for slat trigger stations
};
+/// Return station type
+inline AliMp::StationType AliMpTriggerSegmentation::StationType() const
+{ return AliMp::kStationTrigger; }
+
+
#endif
#include "AliMpSlatPainter.h"
#include "AliMpIteratorPainter.h"
#include "AliMpVPadIterator.h"
-#include "AliMpSlatSegmentation.h"
+#include "AliMpSegmentation.h"
//#include "AliMpSectorSegmentation.h"
#include <TList.h>
// return new AliMpSectorPainter(sectorSegmentation->GetSector());
// }
+ /*
const AliMpSlatSegmentation* slatSegmentation = dynamic_cast<const AliMpSlatSegmentation*>(object);
if (slatSegmentation)
{
return new AliMpSlatPainter(slatSegmentation->Slat());
}
+ */
+ const AliMpSlat* kSlat
+ = AliMpSegmentation::Instance()->GetSlat((AliMpVSegmentation*)object);
+ if ( kSlat )
+ {
+ return new AliMpSlatPainter(kSlat);
+ }
+
}
return painter;
}
#include "AliMpPadPair.h"
#include "AliMpPad.h"
#include "AliMpPlaneType.h"
+#include "AliMpStationType.h"
class AliMpVPadIterator;
class AliMpIntPair;
/// Return the plane type
virtual AliMp::PlaneType PlaneType() const = 0;
+ /// Return the station type
+ virtual AliMp::StationType StationType() const = 0;
+
/// Return the half-sizes of the detection element
virtual TVector2 Dimensions() const = 0;