X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2Fmapping%2FAliMpTrigger.cxx;h=3ad1cfe3aa81e7ac82e78b3347d6887110ce5d63;hb=ea9867dad7383d8c0ad139134e029f0f40108510;hp=82bf2da90f9b23b0794cb68ffdc7615ba8de6887;hpb=1657f946aacfcb7b256e1ef2355593e67161036c;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/mapping/AliMpTrigger.cxx b/MUON/mapping/AliMpTrigger.cxx index 82bf2da90f9..3ad1cfe3aa8 100644 --- a/MUON/mapping/AliMpTrigger.cxx +++ b/MUON/mapping/AliMpTrigger.cxx @@ -17,7 +17,8 @@ // $MpId: AliMpTrigger.cxx,v 1.4 2006/05/24 13:58:52 ivana Exp $ #include "AliMpTrigger.h" - +#include "AliMpSlatSegmentation.h" +#include "AliMpConstants.h" #include "AliLog.h" #include "AliMpSlat.h" @@ -25,7 +26,7 @@ #include "TArrayI.h" #include "TObjArray.h" -/// +//----------------------------------------------------------------------------- /// \class AliMpTrigger /// /// A trigger 'slat' object. @@ -36,7 +37,10 @@ /// "locations". /// /// \author Laurent Aphecetche +//----------------------------------------------------------------------------- +using std::cout; +using std::endl; /// \cond CLASSIMP ClassImp(AliMpTrigger) /// \endcond @@ -65,81 +69,88 @@ namespace AliMpTrigger::AliMpTrigger() : TObject(), fId(""), - fPlaneType(kNonBendingPlane), + fPlaneType(AliMp::kNonBendingPlane), fSlats(0), + fSlatSegmentations(0), fMaxNofPadsY(0), fDX(0), fDY(0) { - // default ctor + /// default ctor + + AliDebugStream(1) << "this = " << this << endl; + + fSlats.SetOwner(kFALSE); + fSlatSegmentations.SetOwner(kTRUE); } //_____________________________________________________________________________ -AliMpTrigger::AliMpTrigger(const char* slatType, AliMpPlaneType bendingOrNot) +AliMpTrigger::AliMpTrigger(const char* slatType, AliMp::PlaneType bendingOrNot) : TObject(), fId(slatType), fPlaneType(bendingOrNot), fSlats(0), + fSlatSegmentations(0), fMaxNofPadsY(0), fDX(0), fDY(0) { - // normal ctor + /// normal ctor + + AliDebugStream(1) << "this = " << this << endl; + + fSlats.SetOwner(kFALSE); + fSlatSegmentations.SetOwner(kTRUE); } //_____________________________________________________________________________ AliMpTrigger::~AliMpTrigger() { - // dtor - AliDebug(1,Form("this=%p before fSlats.Delete()",this)); - fSlats.Delete(); - AliDebug(1,Form("this=%p after fSlats.Delete()",this)); + /// dtor + AliDebugStream(1) << "this = " << this << endl; + + fSlatSegmentations.Delete(); } //_____________________________________________________________________________ Bool_t AliMpTrigger::AdoptLayer(AliMpSlat* slat) { - // Adopt (i.e. we become owner of that pointer) a slat, as - // a layer of this trigger slat. + /// Adopt (i.e. we become owner of that pointer) a slat, as + /// a layer of this trigger slat. - AliDebug(1,Form("%s is adopting %s :\n", + AliDebug(2,Form("%s is adopting %s ", GetID(),slat->GetID())); // Check that we keep our size constant. - - const Double_t kPrecision = 1E-3; - + if ( GetSize() > 0 && - ( !::IsEqual(slat->DX(),fDX,kPrecision) || - !::IsEqual(slat->DY(),fDY,kPrecision) ) + ( !::IsEqual(slat->DX(),fDX,AliMpConstants::LengthTolerance()) || + !::IsEqual(slat->DY(),fDY,AliMpConstants::LengthTolerance()) ) ) { - AliError(Form("In %s trying to add a layer (%e,%e) of a different size than " - "mine (%e,%e)\n",GetID(),slat->DX(),slat->DY(), + AliError(Form("In %s trying to add a layer (%e,%e) (layer #%d) " + "of a different size than mine (%e,%e)", + GetID(),slat->DX(),slat->DY(),fSlats.GetEntries(), fDX,fDY)); return kFALSE; } fSlats.Add(slat); - fMaxNofPadsY = std::max(slat->GetMaxNofPadsY(),fMaxNofPadsY); - fDX = std::max(fDX,slat->DX()); - fDY = std::max(fDY,slat->DY()); + Bool_t owner(kTRUE); + // the slat segmentation will be the owner of the slat, and will delete + // it when it'll be deleted itself + fSlatSegmentations.Add(new AliMpSlatSegmentation(slat,owner)); + fMaxNofPadsY = TMath::Max(slat->GetMaxNofPadsY(),fMaxNofPadsY); + fDX = TMath::Max(fDX,slat->DX()); + fDY = TMath::Max(fDY,slat->DY()); return kTRUE; } -//_____________________________________________________________________________ -TVector2 -AliMpTrigger::Dimensions() const -{ - // Returns the dimensions (half-sizes) of that slat (cm) - return TVector2(DX(),DY()); -} - //_____________________________________________________________________________ Double_t AliMpTrigger::DX() const { - // Returns the half-size in X (cm) + /// Returns the half-size in X (cm) return fDX; } @@ -147,7 +158,7 @@ AliMpTrigger::DX() const Double_t AliMpTrigger::DY() const { - // Returns the half-size in Y (cm) + /// Returns the half-size in Y (cm) return fDY; } @@ -155,7 +166,7 @@ AliMpTrigger::DY() const void AliMpTrigger::GetAllLocalBoardNumbers(TArrayI& lbn) const { - // Fills lbn with the local board numbers we're dealing with + /// Fills lbn with the local board numbers we're dealing with Int_t n(0); for ( Int_t i = 0; i < GetSize(); ++i ) { @@ -182,7 +193,7 @@ AliMpTrigger::GetAllLocalBoardNumbers(TArrayI& lbn) const const char* AliMpTrigger::GetID() const { - // returns the id of this slat + /// returns the id of this slat return fId.Data(); } @@ -190,13 +201,13 @@ AliMpTrigger::GetID() const const char* AliMpTrigger::GetName() const { - // returns the name (=id+bending/non-bending) of this slat + /// returns the name (=id+bending/non-bending) of this slat TString name(GetID()); - if ( fPlaneType == kBendingPlane ) + if ( fPlaneType == AliMp::kBendingPlane ) { name += ".Bending"; } - else if ( fPlaneType == kNonBendingPlane ) + else if ( fPlaneType == AliMp::kNonBendingPlane ) { name += ".NonBending"; } @@ -211,7 +222,7 @@ AliMpTrigger::GetName() const AliMpSlat* AliMpTrigger::GetLayer(int layer) const { - // Returns a given layer + /// Returns a given layer if ( IsLayerValid(layer) ) { return (AliMpSlat*)fSlats.At(layer); @@ -219,11 +230,23 @@ AliMpTrigger::GetLayer(int layer) const return 0; } +//_____________________________________________________________________________ +AliMpVSegmentation* +AliMpTrigger::GetLayerSegmentation(int layer) const +{ + /// Returns a given layer + if ( IsLayerValid(layer) ) + { + return (AliMpSlatSegmentation*)fSlatSegmentations.At(layer); + } + return 0; +} + //_____________________________________________________________________________ Int_t AliMpTrigger::GetNofPadsX() const { - // Returns the number of pad in x direction + /// Returns the number of pad in x direction if ( !GetSize() ) return -1; if ( GetLayer(0) ) { @@ -236,7 +259,7 @@ AliMpTrigger::GetNofPadsX() const Int_t AliMpTrigger::GetMaxNofPadsY() const { - // Maximum number of pads in y direction + /// Maximum number of pads in y direction return fMaxNofPadsY; } @@ -244,7 +267,7 @@ AliMpTrigger::GetMaxNofPadsY() const Int_t AliMpTrigger::GetSize() const { - // Number of layers + /// Number of layers return fSlats.GetEntriesFast(); } @@ -252,7 +275,7 @@ AliMpTrigger::GetSize() const Bool_t AliMpTrigger::IsLayerValid(int layer) const { - // Whether a given layer index is valid or not + /// Whether a given layer index is valid or not if ( layer >= 0 && layer < GetSize() ) { return kTRUE; @@ -261,26 +284,18 @@ AliMpTrigger::IsLayerValid(int layer) const } //_____________________________________________________________________________ -AliMpPlaneType +AliMp::PlaneType AliMpTrigger::PlaneType() const { - // Bending or not + /// Bending or not return fPlaneType; } -//_____________________________________________________________________________ -TVector2 -AliMpTrigger::Position() const -{ - // Slat position (cm) - return TVector2(DX(),DY()); -} - //_____________________________________________________________________________ void AliMpTrigger::Print(Option_t* opt) const { - // Dump on screen + /// Dump on screen cout << "AliMpTrigger::" << GetID(); if ( GetSize() == 0 ) {