From 59090931dbe3bb3bef8265257bb76e6683b5f6de Mon Sep 17 00:00:00 2001 From: cussonno Date: Fri, 25 Feb 2005 05:32:52 +0000 Subject: [PATCH] Added customised streamer to AliMUONSt12QuadrantSegmentation (to get correct behaviour when object is read from a Root file) (Ivana) --- MUON/AliMUONSt12QuadrantSegmentation.cxx | 59 ++++++++++++++++++------ MUON/AliMUONSt12QuadrantSegmentation.h | 8 ++-- MUON/MUONsimLinkDef.h | 2 +- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/MUON/AliMUONSt12QuadrantSegmentation.cxx b/MUON/AliMUONSt12QuadrantSegmentation.cxx index ecc2ef59908..4a3454d1118 100644 --- a/MUON/AliMUONSt12QuadrantSegmentation.cxx +++ b/MUON/AliMUONSt12QuadrantSegmentation.cxx @@ -52,6 +52,8 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation( AliMpStationType stationType, AliMpPlaneType planeType) : AliMUONVGeometryDESegmentation(), + fStationType(stationType), + fPlaneType(planeType), fSector(0), fSectorSegmentation(0), fSectorIterator(0), @@ -77,18 +79,7 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation( { // Normal constructor - // 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; - } - - AliMpReader r(stationType, planeType); - fSector = r.BuildSector(); - fSectorSegmentation = new AliMpSectorSegmentation(fSector); + ReadMappingData(); fCorrA = new TObjArray(3); fCorrA->AddAt(0,0); @@ -99,6 +90,8 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation( //______________________________________________________________________________ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation() : AliMUONVGeometryDESegmentation(), + fStationType(kStation1), + fPlaneType(kBendingPlane), fSector(0), fSectorSegmentation(0), fSectorIterator(0), @@ -176,6 +169,27 @@ void AliMUONSt12QuadrantSegmentation::UpdateCurrentPadValues(const AliMpPad& pad 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; + } + + AliMpReader r(fStationType, fPlaneType); + fSector = r.BuildSector(); + fSectorSegmentation = new AliMpSectorSegmentation(fSector); +} + // // public methods // @@ -198,11 +212,14 @@ void AliMUONSt12QuadrantSegmentation::SetDAnod(Float_t d) 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); @@ -305,7 +322,7 @@ void AliMUONSt12QuadrantSegmentation::Init(Int_t chamber) // 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"); @@ -614,7 +631,6 @@ Int_t AliMUONSt12QuadrantSegmentation::SigGenCond(Float_t x, Float_t y, Float_t } } - //______________________________________________________________________________ void AliMUONSt12QuadrantSegmentation::SigGenInit(Float_t x, Float_t y, Float_t /*z*/) { @@ -673,3 +689,18 @@ TF1* AliMUONSt12QuadrantSegmentation::CorrFunc(Int_t isec) const 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); + } +} + + diff --git a/MUON/AliMUONSt12QuadrantSegmentation.h b/MUON/AliMUONSt12QuadrantSegmentation.h index 7dd8a77b5d4..cf224bb911a 100644 --- a/MUON/AliMUONSt12QuadrantSegmentation.h +++ b/MUON/AliMUONSt12QuadrantSegmentation.h @@ -157,18 +157,20 @@ class AliMUONSt12QuadrantSegmentation : public AliMUONVGeometryDESegmentation private: // methods void UpdateCurrentPadValues(const AliMpPad& pad); + void ReadMappingData(); // constants static const Float_t fgkWireD; // default wire pitch static const Float_t fgkLengthUnit;// conversion between length units // from mapping (mm) to AliRoot (cm) - // data members // From mapping // - AliMpSector* fSector; // sector (from mapping) - AliMpSectorSegmentation* fSectorSegmentation;// sector segmentation (from mapping) + AliMpStationType fStationType; // station type + AliMpPlaneType fPlaneType; // plane type + AliMpSector* fSector; // ! sector (from mapping) + AliMpSectorSegmentation* fSectorSegmentation;// ! sector segmentation (from mapping) AliMpVPadIterator* fSectorIterator; // ! iterator over pads // Wire pitch diff --git a/MUON/MUONsimLinkDef.h b/MUON/MUONsimLinkDef.h index ffff61fc8fe..eeb19313795 100644 --- a/MUON/MUONsimLinkDef.h +++ b/MUON/MUONsimLinkDef.h @@ -9,7 +9,7 @@ #pragma link C++ class AliMUONFactoryV2+; #pragma link C++ class AliMUONSt1Segmentation+; -#pragma link C++ class AliMUONSt12QuadrantSegmentation+; +#pragma link C++ class AliMUONSt12QuadrantSegmentation-; #pragma link C++ class AliMUONSt1Response+; -- 2.43.0