// the mapping package
//
// Author: Ivana Hrivnacova, IPN Orsay
-
+
#include <TError.h>
#include <TF1.h>
#include <TObjArray.h>
#include "AliMpPad.h"
#include "AliMpArea.h"
-#include "AliMpReader.h"
+#include "AliMpSectorReader.h"
#include "AliMpSector.h"
#include "AliMpVPadIterator.h"
#include "AliMpSectorSegmentation.h"
#include "AliMUON.h"
#include "AliMUONChamber.h"
#include "AliLog.h"
+#include "AliMpFiles.h"
+#include "AliMpNeighboursPadIterator.h"
+#include <TSystem.h>
ClassImp(AliMUONSt12QuadrantSegmentation)
-const Float_t AliMUONSt12QuadrantSegmentation::fgkWireD = 0.20;
+const Float_t AliMUONSt12QuadrantSegmentation::fgkWireD = 0.21;
const Float_t AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1;
//______________________________________________________________________________
AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
AliMpStationType stationType,
AliMpPlaneType planeType)
-: AliSegmentation(),
+: AliMUONVGeometryDESegmentation(),
+ fStationType(stationType),
+ fPlaneType(planeType),
fSector(0),
fSectorSegmentation(0),
fSectorIterator(0),
fCorrA(0)
{
// Normal constructor
-
- AliMpReader r(stationType, planeType);
- fSector = r.BuildSector();
- fSectorSegmentation = new AliMpSectorSegmentation(fSector);
+
+ ReadMappingData();
fCorrA = new TObjArray(3);
fCorrA->AddAt(0,0);
//______________________________________________________________________________
AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation()
-: AliSegmentation(),
+: AliMUONVGeometryDESegmentation(),
+ fStationType(kStation1),
+ fPlaneType(kBendingPlane),
fSector(0),
fSectorSegmentation(0),
fSectorIterator(0),
//______________________________________________________________________________
AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(const AliMUONSt12QuadrantSegmentation& rhs)
- : AliSegmentation(rhs)
+ : AliMUONVGeometryDESegmentation(rhs)
{
// Copy constructor
AliFatal("Copy constructor is not implemented.");
fZone = fSectorSegmentation->Zone(pad);
}
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::ReadMappingData()
+{
+// Reads mapping data
+// ---
+
+ // set path to mapping data files
+ if (!gSystem->Getenv("MINSTALL")) {
+ TString dirPath = gSystem->Getenv("ALICE_ROOT");
+ dirPath += "/MUON/mapping";
+ AliMpFiles::Instance()->SetTopPath(dirPath);
+ gSystem->Setenv("MINSTALL", dirPath.Data());
+ //cout << "AliMpFiles top path set to " << dirPath << endl;
+ }
+
+ AliMpSectorReader r(fStationType, fPlaneType);
+ fSector = r.BuildSector();
+ fSectorSegmentation = new AliMpSectorSegmentation(fSector);
+}
+
//
// 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);
+
+ return pad.IsValid();
+}
+
+
+//______________________________________________________________________________
+Bool_t AliMUONSt12QuadrantSegmentation::HasPad(Int_t ix, Int_t iy)
+{
+// Returns true if a pad with given indices exists
+
+ AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), false);
+
+ return pad.IsValid();
+}
+
+
+//______________________________________________________________________________
+AliMUONGeometryDirection AliMUONSt12QuadrantSegmentation::GetDirection()
+{
+// Returns the direction with a constant pad size
+// (Direction or coordinate where the resolution is the best)
+
+ switch ( fSector->GetDirection() ) {
+ case kX: return kDirX;
+ case kY: return kDirY;
+ default: return kDirUndefined;
+ }
+}
+
+//______________________________________________________________________________
+const AliMpSectorSegmentation*
+AliMUONSt12QuadrantSegmentation::GetMpSegmentation() const
+{
+// Returns the mapping segmentation
+// (provides access to electronics info)
+
+ return fSectorSegmentation;
+}
+
//______________________________________________________________________________
Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const
{
// ---
AliMpPad pad = fSectorSegmentation
- ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+ ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), true);
ix = pad.GetIndices().GetFirst();
iy = pad.GetIndices().GetSecond();
// If there is no pad, x = 0., y = 0. are returned.
// ---
- AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy));
+ AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), true);
x = pad.Position().X() * fgkLengthUnit;
y = pad.Position().Y() * fgkLengthUnit;
// 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");
Int_t AliMUONSt12QuadrantSegmentation::Npx() const
{
// Maximum number of Pads in x
+// hard coded for the time being
// ---
- //Fatal("Npx", "Not yet implemented.");
- return 142; //hard coded for the time being
+ return fSectorSegmentation->MaxPadIndexX();
}
//______________________________________________________________________________
Int_t AliMUONSt12QuadrantSegmentation::Npy() const
{
// Maximum number of Pads in y
+// hard coded for the time being
// ---
- //Fatal("Npy", "Not yet implemented.");
- return 213; //hard coded for the time being
+ return fSectorSegmentation->MaxPadIndexY();
}
//______________________________________________________________________________
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()
{
}
}
-
//______________________________________________________________________________
void AliMUONSt12QuadrantSegmentation::SigGenInit(Float_t x, Float_t y, Float_t /*z*/)
{
return (TF1*) fCorrA->At(isec);
}
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::Streamer(TBuffer &R__b)
+{
+// Stream an object of class AliMUONSt12QuadrantSegmentation.
+
+ if (R__b.IsReading()) {
+ AliMUONSt12QuadrantSegmentation::Class()->ReadBuffer(R__b, this);
+ ReadMappingData();
+ }
+ else {
+ AliMUONSt12QuadrantSegmentation::Class()->WriteBuffer(R__b, this);
+ }
+}
+
+