// the mapping package
//
// Author: Ivana Hrivnacova, IPN Orsay
-
+
#include <TError.h>
#include <TF1.h>
#include <TObjArray.h>
#include <TVector2.h>
+#include <TSystem.h>
+
+#include "AliLog.h"
#include "AliMpPad.h"
#include "AliMpArea.h"
-#include "AliMpReader.h"
+#include "AliMpSectorReader.h"
#include "AliMpSector.h"
#include "AliMpVPadIterator.h"
#include "AliMpSectorSegmentation.h"
+#include "AliMpFiles.h"
+#include "AliMpNeighboursPadIterator.h"
#include "AliMUONSt12QuadrantSegmentation.h"
-#include "AliRun.h"
-#include "AliMUON.h"
-#include "AliMUONChamber.h"
-#include "AliLog.h"
+#include "AliMUONConstants.h"
ClassImp(AliMUONSt12QuadrantSegmentation)
-const Float_t AliMUONSt12QuadrantSegmentation::fgkWireD = 0.20;
-const Float_t AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1;
-
//______________________________________________________________________________
AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
+ AliMpVSegmentation* segmentation,
AliMpStationType stationType,
AliMpPlaneType planeType)
: AliMUONVGeometryDESegmentation(),
+ fStationType(stationType),
+ fPlaneType(planeType),
fSector(0),
fSectorSegmentation(0),
fSectorIterator(0),
- fWireD(fgkWireD),
+ fWireD(0),
fChamber(0),
fId(0),
fRmin(0.),
fCorrA(0)
{
// Normal constructor
-
- AliMpReader r(stationType, planeType);
- fSector = r.BuildSector();
- fSectorSegmentation = new AliMpSectorSegmentation(fSector);
+
+ fSectorSegmentation = dynamic_cast<AliMpSectorSegmentation*>(segmentation);
+ if (fSectorSegmentation)
+ fSector = fSectorSegmentation->GetSector();
+ else
+ AliFatal("Wrong mapping segmentation type");
+
+ // Anod pitch
+ if ( stationType == kStation1 )
+ fWireD = AliMUONConstants::PitchSt1();
+ else if ( stationType == kStation2 )
+ fWireD = AliMUONConstants::Pitch();
+ else
+ AliFatal("Wrong station type");
fCorrA = new TObjArray(3);
fCorrA->AddAt(0,0);
fCorrA->AddAt(0,1);
fCorrA->AddAt(0,2);
+
+ AliDebug(1, Form("ctor this = %p", this) );
}
//______________________________________________________________________________
AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation()
: AliMUONVGeometryDESegmentation(),
+ fStationType(kStation1),
+ fPlaneType(kBendingPlane),
fSector(0),
fSectorSegmentation(0),
fSectorIterator(0),
- fWireD(fgkWireD),
+ fWireD(0),
fChamber(0),
fId(0),
fRmin(0.),
fYt(0.),
fCorrA(0) {
// Default Constructor
+
+ AliDebug(1, Form("default (empty) ctor this = %p", this));
}
//______________________________________________________________________________
AliMUONSt12QuadrantSegmentation::~AliMUONSt12QuadrantSegmentation() {
// Destructor
+ AliDebug(1, Form("dtor this = %p", this));
+
delete fSector;
delete fSectorSegmentation;
delete fSectorIterator;
fIx = pad.GetIndices().GetFirst();
fIy = pad.GetIndices().GetSecond();
- fX = pad.Position().X() * fgkLengthUnit;
- fY = pad.Position().Y() * fgkLengthUnit;
+ fX = pad.Position().X();
+ fY = pad.Position().Y();
fZone = fSectorSegmentation->Zone(pad);
}
+
//
// public methods
//
fWireD = d;
}
+#include "AliMpMotifMap.h"
//______________________________________________________________________________
Bool_t AliMUONSt12QuadrantSegmentation::HasPad(Float_t x, Float_t y, Float_t /*z*/)
{
// Returns true if a pad exists in the given position
+ // fSector->GetMotifMap()->Print();
+
AliMpPad pad = fSectorSegmentation
- ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+ ->PadByPosition(TVector2(x,y), false);
return pad.IsValid();
}
}
}
+//______________________________________________________________________________
+const AliMpVSegmentation*
+AliMUONSt12QuadrantSegmentation::GetMpSegmentation() const
+{
+// Returns the mapping segmentation
+// (provides access to electronics info)
+
+ return fSectorSegmentation;
+}
+
//______________________________________________________________________________
Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const
{
// If there is no pad, ix = 0, iy = 0 are returned.
// ---
- AliMpPad pad = fSectorSegmentation
- ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), true);
+ AliMpPad pad = fSectorSegmentation->PadByPosition(TVector2(x,y), true);
ix = pad.GetIndices().GetFirst();
iy = pad.GetIndices().GetSecond();
AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), true);
- x = pad.Position().X() * fgkLengthUnit;
- y = pad.Position().Y() * fgkLengthUnit;
+ x = pad.Position().X();
+ y = pad.Position().Y();
}
// Initialize segmentation
// ---
- // find Npx, Npy and save this info
+ // find Npx, Npy and save this info
// reference to chamber
- AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
- fChamber = &(pMUON->Chamber(chamber));
- fRmin=fChamber->RInner();
- fRmax=fChamber->ROuter();
+ fRmin=AliMUONConstants::Rmin(0);
+ fRmax=AliMUONConstants::Rmax(0);
fZ = 0;
fId=chamber;
}
// Pad size in x by sector
// ---
- return fSectorSegmentation->PadDimensions(isector).X()*2.*fgkLengthUnit;
+ return fSectorSegmentation->PadDimensions(isector).X()*2.0;
}
//______________________________________________________________________________
// Pad size in x, y by Sector
// ---
- return fSectorSegmentation->PadDimensions(isector).Y()*2.*fgkLengthUnit;
+ return fSectorSegmentation->PadDimensions(isector).Y()*2.0;
}
//______________________________________________________________________________
// hard coded for the time being
// ---
- //Fatal("Npx", "Not yet implemented.");
- switch (fSector->GetDirection()) {
- case kX:
- return 142;
- case kY:
- return 108;
- default:
- AliError("Unknown sector direction");
- return 0;
- }
+ return fSectorSegmentation->MaxPadIndexX();
}
//______________________________________________________________________________
// hard coded for the time being
// ---
- //Fatal("Npy", "Not yet implemented.");
- switch (fSector->GetDirection()) {
- case kX:
- return 160;
- case kY:
- return 213;
- default:
- AliError("Unknown sector direction");
- return 0;
- }
+ return fSectorSegmentation->MaxPadIndexY();
}
//______________________________________________________________________________
if (dx == 0.) dx = 0.01;
if (dy == 0.) dy = 0.01;
+ // Delete previous iterator
+ delete fSectorIterator;
+
fSectorIterator
= fSectorSegmentation
- ->CreateIterator(AliMpArea(TVector2(fXhit/fgkLengthUnit, fYhit/fgkLengthUnit),
- TVector2(dx/fgkLengthUnit, dy/fgkLengthUnit)));
+ ->CreateIterator(AliMpArea(TVector2(fXhit,fYhit),TVector2(dx,dy)));
+ AliDebug(1,Form("CreateIterator area=%e,%e +- %e,%e %s",
+ fXhit,fYhit,dx,dy,PlaneTypeName(fPlaneType).Data()));
+
fSectorIterator->First();
if (! fSectorIterator->IsDone())
if (!pad.IsValid())
AliFatal("Cannot locate pad.");
- return (pad.Position()*fgkLengthUnit - TVector2(x, y)).Mod2();
+ return (pad.Position() - TVector2(x, y)).Mod2();
}
//______________________________________________________________________________
AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(iX,iY));
Int_t &i = *Nlist;
i=0;
- AliMpVPadIterator* iter
- = fSectorSegmentation
- ->CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1));
+ AliMpNeighboursPadIterator iter
+ = AliMpNeighboursPadIterator(fSectorSegmentation, pad, kFALSE);
- for( iter->First(); !iter->IsDone() && i<10; iter->Next()) {
- Xlist[i] = iter->CurrentItem().GetIndices().GetFirst();
- Ylist[i] = iter->CurrentItem().GetIndices().GetSecond();
+ for( iter.First(); !iter.IsDone() && i<10; iter.Next()) {
+ Xlist[i] = iter.CurrentItem().GetIndices().GetFirst();
+ Ylist[i] = iter.CurrentItem().GetIndices().GetSecond();
i++;
}
-
- delete iter;
}
-
+
//______________________________________________________________________________
Int_t AliMUONSt12QuadrantSegmentation::Ix()
{
return fSectorSegmentation
->Zone(fSectorSegmentation
- ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit)));
+ ->PadByPosition(TVector2(x,y)));
}
//______________________________________________________________________________
}
}
-
//______________________________________________________________________________
void AliMUONSt12QuadrantSegmentation::SigGenInit(Float_t x, Float_t y, Float_t /*z*/)
{
return (TF1*) fCorrA->At(isec);
}
-