+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-//===================================================================
-// Segment element indexing in a detection element
-// Gines MARTINEZ, SUBATECH July 04
-// This class is the basic component of
-// AliMUONSegmentationDetectionElement and contains al the
-// info about a segment (pad or strip):
-// Id-indetectionelement, ix ,iy
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//====================================================================
-
-#include <TString.h>
-
-#include "AliMUONSegmentIndex.h"
-#include "AliLog.h"
-
-//___________________________________________
-ClassImp(AliMUONSegmentIndex)
-
-//
-//___________________________________________
-AliMUONSegmentIndex::AliMUONSegmentIndex() : TNamed()
-{
- // Constructor by default
- fChannelId = 0;
- fPadX = 0;
- fPadY = 0;
- fCathode=0;
-}
-//___________________________________________
-AliMUONSegmentIndex::AliMUONSegmentIndex(Int_t channelId, Int_t padX, Int_t padY, Int_t cathode) : TNamed()
-{
- // Constructor to be used
- fName = Name(padX, padY, cathode).Data();
- fTitle = Name(padX, padY, cathode).Data();
- fChannelId = channelId;
- fPadX = padX;
- fPadY = padY;
- fCathode=cathode;
-}
-//_______________________________________________
-AliMUONSegmentIndex::~AliMUONSegmentIndex()
-{
- // Destructor
-}
-//___________________________________________
-Int_t AliMUONSegmentIndex::Compare(const TObject *obj) const
-{
- // Comparison of two AliMUONSegmentIndex objects
- AliMUONSegmentIndex * myobj = ( AliMUONSegmentIndex *) obj;
- return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
-}
-//___________________________________________
-TString AliMUONSegmentIndex::Name(Int_t padx, Int_t pady, Int_t cathode)
-{
- // Definition of the name of the object
- char name[15];
- sprintf(name,"%d-%d-%d",padx,pady,cathode);
- return TString(name);
-}
-
-//___________________________________________
-void AliMUONSegmentIndex::Print(const char* /*opt*/) const
-{
- // Printing information of AliMUONSegmentIndex
- AliInfo(Form("Name=%s Id=%d PadX=%d PadY=%d Cathode=%d\n",fName.Data(),fChannelId,fPadX,fPadY,fCathode));
-}
+++ /dev/null
-#ifndef ALIMUONSEGMENTINDEX_H
-#define ALIMUONSEGMENTINDEX_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-/// \ingroup base
-/// \class AliMUONSegmentIndex
-/// \brief Segment element indexing in a detection element
-
-//===================================================================
-// Segment element indexing in a detection element
-// Gines MARTINEZ, SUBATECH July 04
-// This class is the basic component of
-// AliMUONSegmentationDetectionElement and contains al the
-// info about a segment (pad or strip):
-// Id-indetectionelement, ix ,iy
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//====================================================================
-
-#include <TNamed.h>
-#include <TString.h>
-
-class AliMUONSegmentIndex : public TNamed {
- public:
- AliMUONSegmentIndex();
- AliMUONSegmentIndex(Int_t channelId, Int_t padX, Int_t padY, Int_t cathode);
- virtual ~AliMUONSegmentIndex();
-
-
- Int_t Compare(const TObject *obj) const;
- Int_t GetChannelId() const {return fChannelId;}
- Int_t GetPadX() const {return fPadX;}
- Int_t GetPadY() const {return fPadY;}
- Int_t GetCathode() const {return fCathode;}
-
- static TString Name(Int_t padx, Int_t pady, Int_t cathode) ;
- void Print(const char* opt="") const;
-
- private:
- Int_t fChannelId; // Id of the channel within the detection element
- Int_t fPadX; // pad index in the X direction
- Int_t fPadY; // pad index in the y direction
- Int_t fCathode; // cathode plane 0 bending 1 non bending
-
- ClassDef(AliMUONSegmentIndex,1) // Segmenation for MUON detection elements
-};
-#endif
-
-
-
-
-
-
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-//===================================================================
-// Segment element indexing in a detection element for electronics
-// Gines MARTINEZ, SUBATECH July 04
-// This class is the basic component of
-// AliMUONSegmentationDetectionElement and contains al the
-// info about a segment (pad or strip):
-// Id-indetectionelement, #manu, #manuchannel
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//====================================================================
-
-#include <TString.h>
-
-#include "AliMUONSegmentManuIndex.h"
-#include "AliLog.h"
-
-//___________________________________________
-ClassImp(AliMUONSegmentManuIndex)
-
-//
-//___________________________________________
-AliMUONSegmentManuIndex::AliMUONSegmentManuIndex()
-{
- //Default constructor
- fChannelId= 0;; // Id of the channel within the detection element
- fManuId= 0;; // Manu id in the detection element
- fBusPatchId= 0;; // BusPatchId in the detection element up to 4 for slats
- fManuChannelId= 0;;
-}
-//___________________________________________
-AliMUONSegmentManuIndex::AliMUONSegmentManuIndex(Int_t channelId, Int_t manuId, Int_t busPatchId, Int_t manuChannelId) : TNamed()
-{
- // Constructor to be used
- fName = Name(manuId, manuChannelId).Data();
- fTitle= Name(manuId, manuChannelId).Data();
- fChannelId = channelId;
- fManuId = manuId;
- fBusPatchId = busPatchId;
- fManuChannelId = manuChannelId;
-}
-//_______________________________________________
-AliMUONSegmentManuIndex::~AliMUONSegmentManuIndex()
-{
- // Destructor
-}
-//___________________________________________
-Int_t AliMUONSegmentManuIndex::Compare(const TObject *obj) const
-{
- // Comparison of two AliMUONSegmentManuIndex objects
- AliMUONSegmentManuIndex * myobj = ( AliMUONSegmentManuIndex *) obj;
- return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
-}
-//___________________________________________
-TString AliMUONSegmentManuIndex::Name(Int_t manuid, Int_t manuchannel)
-{
- // Definition of the name for TMap indexing
- char name[15];
- Int_t absid = manuid*64 + manuchannel;
- sprintf(name,"%d",absid);
- return TString(name);
-}
-//___________________________________________
-void AliMUONSegmentManuIndex::Print(const char* /*opt*/) const
-{
- // Printing AliMUONSegmentManuIndex information
- AliInfo(Form("Name=%s Id=%d BusPatch=%d ManuId=%d ManuChannelId=%d\n",fName.Data(),fChannelId,fBusPatchId,fManuId,fManuChannelId));
-}
+++ /dev/null
-#ifndef ALIMUONSEGMENTMANUINDEX_H
-#define ALIMUONSEGMENTMANUINDEX_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-/// \ingroup base
-/// \class AliMUONSegmentManuIndex
-/// \brief Segment element indexing in a detection element for electronics
-
-//===================================================================
-// Segment element indexing in a detection element for electronics
-// Gines MARTINEZ, SUBATECH July 04
-// This class is the basic component of
-// AliMUONSegmentationDetectionElement and contains al the
-// info about a segment (pad or strip):
-// Id-indetectionelement, #manu, #manuchannel
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//====================================================================
-
-#include <TNamed.h>
-
-class TString;
-
-class AliMUONSegmentManuIndex : public TNamed {
- public:
- AliMUONSegmentManuIndex();
- AliMUONSegmentManuIndex(Int_t channelId, Int_t manuId, Int_t busPatchId, Int_t manuChannelId);
-
- virtual ~AliMUONSegmentManuIndex();
-
- Int_t Compare(const TObject *obj) const;
-
- Int_t GetChannelId() const{return fChannelId;}
- Int_t GetManuId() const{return fManuId;}
- Int_t GetBusPatchId() const{return fBusPatchId;}
- Int_t GetManuChannelId() const{return fManuChannelId;}
-
- static TString Name(Int_t manuId, Int_t manuchannel);
-
- void SetBusPatchId(Int_t b) {fBusPatchId = b;}
- void Print(const char* opt="") const;
-
- private:
- Int_t fChannelId; // Id of the channel within the detection element
- Int_t fManuId; // Manu id in the detection element
- Int_t fBusPatchId; // BusPatchId in the detection element up to 4 for slats
- Int_t fManuChannelId; // ChannelId in the manu card 1-64
-
- ClassDef(AliMUONSegmentManuIndex,1) // Segmenation for MUON detection elements
-
-};
-
-#endif
-
-
-
-
-
-
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-//===================================================================
-// Segment element position in local coordinates of the detection element
-// Gines MARTINEZ, SUBATECH July 04
-// This class is one of the basic component of
-// AliMUONSegmentationDetectionElement and contains al the
-// info about a segment (pad or strip):
-// Id-indetectionelement, x_local, y_local
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//====================================================================
-
-#include <TMath.h>
-
-#include "AliMUONSegmentPosition.h"
-#include "AliLog.h"
-
-//___________________________________________
-ClassImp(AliMUONSegmentPosition)
-
-Float_t AliMUONSegmentPosition::fUnit = 0.3 ; // 3mm unit for generation of segmenposition name
-
-//
-//___________________________________________
-AliMUONSegmentPosition::AliMUONSegmentPosition() : TNamed()
-{
-//Default constructor
- fChannelId = 0;
- fX = 0.;
- fY = 0.;
-}
-//___________________________________________
-AliMUONSegmentPosition::AliMUONSegmentPosition(Int_t channelId, Float_t x, Float_t y, Int_t cathode) : TNamed()
-{
- // Constructor to be used
- fName = Name(x,y,cathode);
- fTitle= Name(x,y,cathode);
- fChannelId = channelId;
- fX = x;
- fY = y;
- fCathode=cathode;
- fPadSizeX=0.;
- fPadSizeY=0.;
-}
-//_______________________________________________
-AliMUONSegmentPosition::~AliMUONSegmentPosition()
-{
- // Destructor
-}
-//___________________________________________
-Int_t AliMUONSegmentPosition::Compare(const TObject *obj) const
-{
- // Comparison of two AliMUONSegmentPosition objects
- AliMUONSegmentPosition * myobj = ( AliMUONSegmentPosition *) obj;
- return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
-}
-
-//___________________________________________
-Float_t AliMUONSegmentPosition::Distance(Float_t x, Float_t y)
-{
- return TMath::Sqrt( (fX-x)*(fX-x) + (fY-y)*(fY-y) ) ;
-}
-//___________________________________________
-TString AliMUONSegmentPosition::Name(Float_t x, Float_t y, Int_t cathode)
-{
- // Definition of the name of AliMUONSegmentPosition
- // Our convention since the smaller pad pich is 5 mm is to choice a 3mm unit:
- // So for a position pair x,y and cathode plane icathode the name will be:
- // xp = TMath::Nint(x*10./3.);
- // yp = TMath::Nint(y+10./3.);
- // sprintf(name,"%d-%d-%d",xp,yp,cathode);
- Int_t xp = TMath::Nint(x/fUnit);
- Int_t yp = TMath::Nint(y/fUnit);
- char name[15];
- sprintf(name,"%d-%d-%d",xp,yp,cathode);
- return TString(name);
-}
-//___________________________________________
-void AliMUONSegmentPosition::Print(const char* /*opt*/) const
-{
- // Printing AliMUONSegmentManuIndex information
- AliInfo(Form("Name=%s Id=%d X=%f Y=%f Cathode=%d\n",fName.Data(),fChannelId, fX, fY,fCathode));
-}
+++ /dev/null
-#ifndef ALIMUONSEGMENTPOSITION_H
-#define ALIMUONSEGMENTPOSITION_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-/// \ingroup base
-/// \class AliMUONSegmentPosition
-/// \brief Local positions of segments
-
-//===================================================================
-// Segment element position in local coordinates of the detection element
-// Gines MARTINEZ, SUBATECH July 04
-// This class is one of the basic component of
-// AliMUONSegmentationDetectionElement and contains al the
-// info about a segment (pad or strip):
-// Id-indetectionelement, x_local, y_local
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//====================================================================
-
-
-#include <TNamed.h>
-#include <TString.h>
-
-class AliMUONSegmentPosition : public TNamed
-{
- public:
- AliMUONSegmentPosition();
- AliMUONSegmentPosition(Int_t channelId, Float_t x, Float_t y, Int_t cathode);
- virtual ~AliMUONSegmentPosition();
-
- Int_t Compare(const TObject *obj) const;
- Float_t Distance(Float_t x, Float_t y);
- Int_t GetChannelId()const {return fChannelId;}
- Float_t GetXlocal() const {return fX;}
- Float_t GetYlocal() const {return fY;}
- Int_t GetCathode() const {return fCathode;}
-
- static Float_t GetUnit() {return fUnit;}
- static TString Name(Float_t x, Float_t y, Int_t cathode) ;
-
- void Print(const char* opt="") const;
-
- private:
- Int_t fChannelId; // Id of the channel within the detection element
- Float_t fX; // Position X of the center of the segment (pad, strip, etc...)
- Float_t fY; // Position Y of the center of the segment (pad, strip, etc...)
- Int_t fCathode; // Cathode Side Bending 1 or non bending 0
- Float_t fPadSizeX;
- Float_t fPadSizeY;
-
- static Float_t fUnit; // Unit for generation of the name 3mm has been choses
-
- ClassDef(AliMUONSegmentPosition,1) // Local positions of segments
-
-};
-#endif
-
-
-
-
-
-
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-//===========================================================
-// Segmentation classes for MUON Detection Elements
-// Gines MARTINEZ, SUBATECH July 04
-// This class interfaces with the mapping and segmentation
-// files MUON.
-// This files are placed by default in
-// $ALICE_ROOT/MUON/mapping/data/Stationxxx/yyy_plane/
-// There are in tracking 23 types of detection elements
-// 8 SectorSt1, 8 SectorSt2, 2 122000SR1, 2 122000NR1, 4 112200SR2, 4 112200NR2
-// 4 122200S, 4 122200N, 8 222000N,8 220000N, 8 330000N, 4 122300N, 8 112230NR3
-// 8 112230N, 8 222330N, 8 223300N, 16 333000N, 4 122330N, 8 112233NR3, 8 112233N
-// 8 222333N, 8 223330N, 8 333300N
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//===========================================================
-
-#include <stdlib.h>
-#include <Riostream.h>
-#include <stdlib.h>
-
-#include "TClonesArray.h"
-#include "TMap.h"
-#include "TMath.h"
-
-#include "AliMUONSegmentationDetectionElement.h"
-#include "AliMUONSegmentManuIndex.h"
-#include "AliMUONSegmentPosition.h"
-#include "AliMUONSegmentIndex.h"
-#include "AliLog.h"
-
-//___________________________________________
-ClassImp(AliMUONSegmentationDetectionElement)
-
-//static data member
-const TString AliMUONSegmentationDetectionElement::fgkDefaultTop =getenv("ALICE_ROOT") ;
-const TString AliMUONSegmentationDetectionElement::fgkStationDir = "/MUON/mapping/data/station";
-const TString AliMUONSegmentationDetectionElement::fgkBendingDir= "/bending_plane";
-const TString AliMUONSegmentationDetectionElement::fgkNonBendingDir= "/non-bending_plane";
-const TString AliMUONSegmentationDetectionElement::fgkFileExt = ".map";
-const TString AliMUONSegmentationDetectionElement::fgkBendingExt = ".Bending";
-const TString AliMUONSegmentationDetectionElement::fgkNonBendingExt = ".NonBending";
-
-//___________________________________________
-
-AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement() : TObject()
-{
- //Default constructor
- fWireD = 0.25; // wire pitch in cm
- fWireX0 = 0.; // X0 position of the 1st wire
- fMapManuIndexIndex= 0x0;
- fMapIndexManuIndex= 0x0;
- fMapIndexPosition= 0x0;
- fMapPositionIndex=0X0;
-}
-
-
-// AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement(const char* ElementType)
-// {
-
-// fMapManuIndexIndex= 0x0;
-// fMapIndexManuIndex= 0x0;
-// fMapIndexPosition= 0x0;
-// }
-
-//________________________________________________
-AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement(const AliMUONSegmentationDetectionElement& rhs): TObject(rhs)
-{
-// Protected copy constructor
-
- AliFatal("Not implemented.");
-}
-//_________________________________________________
-AliMUONSegmentationDetectionElement::~AliMUONSegmentationDetectionElement(){
- //Class destructor
- fListOfIndexes->Delete();
- fListOfManuIndexes->Delete();
- fListOfPositions->Delete();
- fMapManuIndexIndex->Clear();
- fMapIndexManuIndex->Clear();
- fMapIndexPosition->Clear();
- fMapPositionIndex->Clear();
-}
-
-//__________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::FindIndexFromPosition(Float_t x, Float_t y, Int_t cathode)
-{
- // Finding x_wire corresponding to x
- Float_t x_wire = GetAnod(x);
-
- //Finding pad corresponding to the position (x_wire, y) in a zone of size 3cm x 10cm or 10cm x 3cm depending on cathode plane
- //
- Int_t ix_max = (cathode==0) ? TMath::Nint(5./AliMUONSegmentPosition::GetUnit()) : TMath::Nint(1.5/AliMUONSegmentPosition::GetUnit());
- Int_t iy_max = (cathode==0) ? TMath::Nint(1.5/AliMUONSegmentPosition::GetUnit()) : TMath::Nint(5./AliMUONSegmentPosition::GetUnit());
-
- AliMUONSegmentIndex * segmentindex =0x0;
- AliMUONSegmentIndex * foundsegmentindex =0x0;
- AliMUONSegmentPosition * segmentposition=0x0;
- Int_t ix, iy;
- Float_t xt,yt;
- Float_t distance = 99999999.;
- //printf("%d %d \n",ix_max, iy_max);
-
- for(ix=-ix_max; ix<ix_max; ix++) {
- xt = x_wire + ((Float_t)ix)*AliMUONSegmentPosition::GetUnit();
- for(iy=-iy_max; iy<iy_max; iy++) {
- yt = y + ((Float_t)iy)*AliMUONSegmentPosition::GetUnit();
- segmentindex = GetIndexFromPosition( xt, yt, cathode);
- if ( segmentindex ) {
- // segmentindex->Print();
- segmentposition = GetPosition(segmentindex->GetName());
- if ( segmentposition->Distance(x_wire, y) < distance ) {
- //printf("adfafa xt %f yt %f distance %f \n", xt, yt, segmentposition->Distance(xt,yt) );
- distance = segmentposition->Distance(x_wire,y);
- foundsegmentindex = segmentindex;
- }
- }
- }
- }
- if (!foundsegmentindex) {
- AliWarning(Form("Not found Index for position x=%5.2f y=%5.2f \n",x,y));
- }
- return foundsegmentindex;
-}
-
-//____________________________________________________-
-Float_t AliMUONSegmentationDetectionElement::GetAnod(Float_t xhit) const
-{
- // Returns for a hit position xhit the position of the nearest anode wire
- Float_t wire= ( (xhit- fWireX0)>0 ) ?
- Int_t( (xhit- fWireX0)/fWireD )+0.5 :
- Int_t( (xhit- fWireX0)/fWireD )-0.5;
- return fWireD*wire+fWireX0;
-}
-//_________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex(Int_t manu, Int_t channel) const
-{
- // Getting AliMUONSegmentIndex from ManuIndex
- return GetIndex( AliMUONSegmentManuIndex::Name(manu, channel).Data() ) ;
-}
-//_________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex( const char * SegmentManuIndexName) const
-{
- // Getting AliMUONSegmentIndex from name of AliMUONSegmentManuIndex
- if (fMapManuIndexIndex) return (AliMUONSegmentIndex*) fMapManuIndexIndex->GetValue(SegmentManuIndexName);
- else {
- AliWarning(Form("SegmentManuIndex %s out of DetectionElement Mapping %s",
- SegmentManuIndexName,fDetectionElementType.Data()));
- return 0x0;
- }
-}
-//_________________________________________________
-AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex(Int_t padx, Int_t pady, Int_t cathode ) const
-{
- // Getting ManuIndex from Index
- return GetManuIndex( AliMUONSegmentIndex::Name(padx, pady, cathode).Data() );
-}
-//_________________________________________________
-AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex( const char * SegmentIndexName) const
-{
- // Getting ManuIndex from manuname
- if (fMapIndexManuIndex) return (AliMUONSegmentManuIndex*) fMapIndexManuIndex->GetValue(SegmentIndexName);
- else {
- AliWarning(Form("SegmentIndex %s out of Detection Element mapping %s",
- SegmentIndexName,fDetectionElementType.Data()));
- return 0x0;
- }
-}
-//__________________________________________________
-void AliMUONSegmentationDetectionElement::GetPadC(Int_t ix, Int_t iy, Int_t cathode, Float_t &x, Float_t &y )
-{
- x = GetPosition(ix,iy,cathode)->GetXlocal();
- y = GetPosition(ix,iy,cathode)->GetYlocal();
-}
-//__________________________________________________
-void AliMUONSegmentationDetectionElement::GetPadI(Float_t x, Float_t y, Int_t cathode, Int_t &padx, Int_t &pady)
-{
-
- AliMUONSegmentIndex * segmentindex = FindIndexFromPosition(x,y,cathode);
-
- if (segmentindex) {
- padx = segmentindex->GetPadX();
- pady = segmentindex->GetPadY();
- }
- else {
- AliWarning(Form("Not found Index for position x=%5.2f y=%5.2f \n",x,y));
- }
-}
-//_________________________________________________
-AliMUONSegmentPosition * AliMUONSegmentationDetectionElement::GetPosition(Int_t padx, Int_t pady, Int_t cathode ) const
-{
- //Getting position from index
- return GetPosition( AliMUONSegmentIndex::Name(padx, pady, cathode).Data() );
-}
-//_________________________________________________
-AliMUONSegmentPosition * AliMUONSegmentationDetectionElement::GetPosition( const char * SegmentIndexName) const
-{
- // Getting position from indexname
- if (fMapIndexPosition) return (AliMUONSegmentPosition*) fMapIndexPosition->GetValue(SegmentIndexName);
- else {
- AliWarning(Form("SegmentIndex %s out of DetectionElement mapping %s",
- SegmentIndexName, fDetectionElementType.Data()));
- return 0x0;
- }
-}
-//_________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndexFromPosition(Float_t x, Float_t y, Int_t cathode) const
-{
- // Getting Index from position if position is a center pad position
- return GetIndexFromPosition( AliMUONSegmentPosition::Name(x, y, cathode).Data() );
-}
-//_________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndexFromPosition( const char * PositionName) const
-{
- // Getting index form positionname
- if (fMapPositionIndex) return (AliMUONSegmentIndex*) fMapPositionIndex->GetValue(PositionName);
- else {
- AliWarning(Form("SegmentPosition %s out of DetectionElement Mapping %s",
- PositionName,fDetectionElementType.Data()));
- return 0x0;
- }
-}
-
-//_________________________________________________
-AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindManuIndex( const char* ManuIndexName)const
-{
- // Getting AliMUONSegmentManuIndex objecto from manu index
- if (fMapManuIndexIndex) return (AliMUONSegmentManuIndex*) fMapManuIndexIndex->FindObject(ManuIndexName);
- else {
- AliWarning(Form("SegmentManuIndex %s out of DetectionElement mapping %s",
- ManuIndexName,fDetectionElementType.Data()));
- return 0x0;
- }
-}
-
-//_________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::FindIndex(const char* IndexName) const
-{
- // Getting
- if (fMapIndexPosition) return (AliMUONSegmentIndex *) fMapIndexPosition->FindObject(IndexName);
- else {
- AliWarning(Form("SegmentIndex %s out of DetectionElement mapping %s",
- IndexName,fDetectionElementType.Data()));
- return 0x0;
- }
-}
-//_________________________________________________
-void AliMUONSegmentationDetectionElement::Init(const char * DetectionElementType)
-{
- TString elementType(DetectionElementType);
- fSegmentationMappingFileBending = fgkDefaultTop+fgkStationDir+"345"
- +fgkBendingDir+"/"+elementType+fgkBendingExt+fgkFileExt;
- fSegmentationMappingFileNonBending = fgkDefaultTop+fgkStationDir+"345"
- +fgkNonBendingDir+"/"+elementType+fgkNonBendingExt+fgkFileExt;
-
- if (fMapManuIndexIndex==0x0) {
- fListOfIndexes = new TObjArray(15000);
- fListOfManuIndexes =new TObjArray(15000);
- fListOfPositions =new TObjArray(15000);
- fMapManuIndexIndex= new TMap();
- fMapIndexManuIndex = new TMap();
- fMapIndexPosition = new TMap();
- fMapPositionIndex = new TMap();
- }
- else {
- fListOfIndexes->Delete();
- fListOfManuIndexes->Delete();
- fListOfPositions->Delete();
- fMapManuIndexIndex->Clear();
- fMapIndexManuIndex->Clear();
- fMapIndexPosition->Clear();
- fMapPositionIndex->Clear();
- }
- Int_t icathode;
- //Bendingplane
- icathode=0;
- AliInfo(Form("%s", fSegmentationMappingFileBending.Data()));
- ReadingSegmentationMappingFile(fSegmentationMappingFileBending ,icathode);
- //NonBendingplane
- icathode=1;
- AliInfo(Form("Reading mapping file is %s\n", fSegmentationMappingFileNonBending.Data()));
- ReadingSegmentationMappingFile(fSegmentationMappingFileNonBending,icathode);
-
-}
-//_______________________________________________________________
-void AliMUONSegmentationDetectionElement::ReadingSegmentationMappingFile(TString infile, Int_t cathode)
-{
- ifstream in( infile, ios::in);
- if (!in) {
- AliError("File not found.");
- }
- else {
- Int_t id, ix, iy, idmanu, idchannel;
- Float_t x, y;
- do {
- in >> id >> ix >> iy >> x >> y >> idmanu >> idchannel;
- // printf("id=%d ix=%d iy=%d x=%f y=%f idmanu=%d and idchannel=%d\n",id, ix, iy, x, y,idmanu, idchannel);
-
- fListOfIndexes->AddAt( new AliMUONSegmentIndex(id,ix,iy,cathode), id);
- fListOfManuIndexes->AddAt( new AliMUONSegmentManuIndex(id,idmanu,0,idchannel), id);;
- fListOfPositions->AddAt( new AliMUONSegmentPosition(id, x, y,cathode), id);;
-
- //( (AliMUONSegmentIndex* )fListOfIndexes->At(id))->Print();
- //( (AliMUONSegmentManuIndex*)fListOfManuIndexes->At(id))->Print();
- //( (AliMUONSegmentPosition*)fListOfPositions->At(id))->Print();
-
- fMapManuIndexIndex->Add( fListOfManuIndexes->At(id), fListOfIndexes->At(id));
- fMapIndexManuIndex->Add( fListOfIndexes->At(id), fListOfManuIndexes->At(id));
- fMapIndexPosition->Add( fListOfIndexes->At(id), fListOfPositions->At(id));
- fMapPositionIndex->Add( fListOfPositions->At(id), fListOfIndexes->At(id) );
- }
- while ( !in.eof());
- }
- in.close();
-}
+++ /dev/null
-#ifndef ALIMUONSEGMENTATIONDETECTIONELEMENT_H
-#define ALIMUONSEGMENTATIONDETECTIONELEMENT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-/// \ingroup base
-/// \class AliMUONSegmentationDetectionElement
-/// \brief Segmentation class for detection element
-
-//===========================================================
-// Segmentation classes for MUON Detection Elements
-// Gines MARTINEZ, SUBATECH July 04
-// This class interfaces with the mapping and segmentation
-// files MUON.
-// This files are placed by default in
-// $ALICE_ROOT/MUON/mapping/data/Stationxxx/yyy_plane/
-// There are in tracking 23 types of detection elements
-// 8 SectorSt1, 8 SectorSt2, 2 122000SR1, 2 122000NR1, 4 112200SR2, 4 112200NR2
-// 4 122200S, 4 122200N, 8 222000N,8 220000N, 8 330000N, 4 122300N, 8 112230NR3
-// 8 112230N, 8 222330N, 8 223300N, 16 333000N, 4 122330N, 8 112233NR3, 8 112233N
-// 8 222333N, 8 223330N, 8 333300N
-// Detailed information in Alice Technical Note xxxxxxxx (2004)
-//===========================================================
-#include <Riostream.h>
-
-#include <TString.h>
-
-#include "AliSegmentation.h"
-
-class TClonesArray;
-class TMap;
-
-class AliMUONSegmentManuIndex;
-class AliMUONSegmentPosition;
-class AliMUONSegmentIndex;
-
-class AliMUONSegmentationDetectionElement : public TObject {
- public:
- AliMUONSegmentationDetectionElement();
- //AliMUONSegmentationDetectionElement(const char* ElementType="");
- virtual ~AliMUONSegmentationDetectionElement();
-
- // User common functions
-
- AliMUONSegmentIndex * FindIndexFromPosition(Float_t x, Float_t y, Int_t cathode);
- AliMUONSegmentIndex * GetIndex(Int_t manu, Int_t channel) const;
- AliMUONSegmentIndex * GetIndexFromPosition(Float_t x, Float_t y, Int_t cathode) const;
- AliMUONSegmentManuIndex * GetManuIndex( Int_t padx, Int_t pady, Int_t cathode) const ;
- AliMUONSegmentPosition * GetPosition(Int_t padx, Int_t pady, Int_t cathode) const ;
- TObjArray * ListOfIndexes() {return fListOfIndexes;}
- TObjArray * ListOfManuIndexes() {return fListOfManuIndexes;}
- TObjArray * ListOfPositions() {return fListOfPositions;}
-
- void Init(const char * DetectionElementType="slat220000N");
- void ReadingSegmentationMappingFile(TString infile, Int_t cathode);
-
- // virtual functions from AliSegmentation. In future this class should derive from AliSegmentation
- Float_t GetAnod(Float_t xhit) const; // Anod wire coordinate closest to xhit
- void SetDAnod(Float_t D) {fWireD = D;}; // Wire Pitch
- void GetPadI(Float_t x, Float_t y , Int_t cathode, Int_t &padx, Int_t &pady); // Transform from Position to closest Index
- void GetPadC(Int_t ix, Int_t iy, Int_t cathode, Float_t &x, Float_t &y ); // Transform from Index to Position
-/* void FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy);// Initialiser */
-/* void NextPad(); // Stepper */
-/* Int_t MorePads(); // Condition */
-/* void Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]); // Get next neighbours */
-
- protected:
- AliMUONSegmentIndex * GetIndex( const char * SegmentManuIndexName)const;
- AliMUONSegmentIndex * GetIndexFromPosition( const char * PositionName)const;
- AliMUONSegmentManuIndex * GetManuIndex( const char * SegmentIndexName) const;
- AliMUONSegmentPosition * GetPosition( const char * SegmentIndexName) const;
- AliMUONSegmentManuIndex * FindManuIndex(const char* ManuIndexName="") const;
- AliMUONSegmentIndex * FindIndex(const char* IndexName="") const;
-
- AliMUONSegmentationDetectionElement(const AliMUONSegmentationDetectionElement& rhs);
-
- private:
- // static data members
- static const TString fgkDefaultTop; // Top directory of $Alice_ROOT/MUON/mapping
- static const TString fgkStationDir; // Directory for station station1, station2, station345
- static const TString fgkBendingDir; //bending plane directory
- static const TString fgkNonBendingDir; //non-bending plane directory
- static const TString fgkFileExt; // File extention
- static const TString fgkBendingExt; // bending file extention
- static const TString fgkNonBendingExt; // bending file extention
-
- // data members
- Float_t fWireD; // Wire pitch in cm
- Float_t fWireX0; // Initial X0 position in local coordinates of the first wire
- Int_t fCurrentSegment;// Index of the current segment
- TString fDetectionElementType; // Type of detection element St1Sector, slat220000N, etc ....
- TString fSegmentationMappingFileBending; // Segmentation & mapping file for bending plane
- TString fSegmentationMappingFileNonBending; // Segmentation & mapping file for non bending plane
- TObjArray * fListOfIndexes; // TObject Array fo AliMUONSegmentIndex
- TObjArray * fListOfManuIndexes; // TObject Array fo AliMUONSegmentManuIndex
- TObjArray * fListOfPositions; // TObject Array fo AliMUONSegmentPositions
- TMap * fMapManuIndexIndex; // Map with key ManuIndex and value = Index
- TMap * fMapIndexManuIndex;// Map with key ManuIndexIndex and value = ManuIndex
- TMap * fMapIndexPosition;// Map with key Index and value = Position
- TMap * fMapPositionIndex;// Map with key Index and value = Position
-
- ClassDef(AliMUONSegmentationDetectionElement,1) // Segmentation for MUON detection elements
-
- };
-#endif
-
-
-
-
-
-