1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //===========================================================
18 // Segmentation classes for MUON Detection Elements
19 // Gines MARTINEZ, SUBATECH July 04
20 // This class interfaces with the mapping and segmentation
22 // This files are placed by default in
23 // $ALICE_ROOT/MUON/mapping/data/Stationxxx/yyy_plane/
24 // There are in tracking 23 types of detection elements
25 // 8 SectorSt1, 8 SectorSt2, 2 122000SR1, 2 122000NR1, 4 112200SR2, 4 112200NR2
26 // 4 122200S, 4 122200N, 8 222000N,8 220000N, 8 330000N, 4 122300N, 8 112230NR3
27 // 8 112230N, 8 222330N, 8 223300N, 16 333000N, 4 122330N, 8 112233NR3, 8 112233N
28 // 8 222333N, 8 223330N, 8 333300N
29 // Detailed information in Alice Technical Note xxxxxxxx (2004)
30 //===========================================================
32 #include <Riostream.h>
34 #include "TClonesArray.h"
37 #include "AliMUONSegmentationDetectionElement.h"
38 #include "AliMUONSegmentManuIndex.h"
39 #include "AliMUONSegmentPosition.h"
40 #include "AliMUONSegmentIndex.h"
43 //___________________________________________
44 ClassImp(AliMUONSegmentationDetectionElement)
47 const TString AliMUONSegmentationDetectionElement::fgkDefaultTop =getenv("ALICE_ROOT") ;
48 const TString AliMUONSegmentationDetectionElement::fgkStationDir = "/MUON/mapping/data/station";
49 const TString AliMUONSegmentationDetectionElement::fgkBendingDir= "/bending_plane";
50 const TString AliMUONSegmentationDetectionElement::fgkNonBendingDir= "/non-bending_plane";
51 const TString AliMUONSegmentationDetectionElement::fgkFileExt = ".map";
52 const TString AliMUONSegmentationDetectionElement::fgkBendingExt = ".Bending";
53 const TString AliMUONSegmentationDetectionElement::fgkNonBendingExt = ".NonBending";
55 //___________________________________________
57 AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement() : TObject()
59 fMapManuIndexIndex= 0x0;
60 fMapIndexManuIndex= 0x0;
61 fMapIndexPosition= 0x0;
62 fXlocalSegmentPositions= 0x0;
63 fYlocalSegmentPositions= 0x0;
67 // AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement(const char* ElementType)
70 // fMapManuIndexIndex= 0x0;
71 // fMapIndexManuIndex= 0x0;
72 // fMapIndexPosition= 0x0;
73 // fXlocalSegmentPositions= 0x0;
74 // fYlocalSegmentPositions= 0x0;
77 //________________________________________________
78 AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement(const AliMUONSegmentationDetectionElement& rhs): TObject(rhs)
80 // Protected copy constructor
82 Fatal("AliMUONSegmentationDetectionElementModule", "Not implemented.");
84 //_________________________________________________
85 AliMUONSegmentationDetectionElement::~AliMUONSegmentationDetectionElement(){
86 fListOfIndexes->Delete();
87 fListOfManuIndexes->Delete();
88 fListOfPositions->Delete();
89 fMapManuIndexIndex->Clear();
90 fMapIndexManuIndex->Clear();
91 fMapIndexPosition->Clear();
93 //_________________________________________________
94 AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex( const char * SegmentManuIndexName)
96 if (fMapManuIndexIndex) return (AliMUONSegmentIndex*) fMapManuIndexIndex->GetValue(SegmentManuIndexName);
98 Warning("GetIndex","SegmentManuIndex %s out of DetectionElement Mapping %s",
99 SegmentManuIndexName,fDetectionElementType.Data());
104 //_________________________________________________
105 AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex( const char * SegmentIndexName)
107 if (fMapIndexManuIndex) return (AliMUONSegmentManuIndex*) fMapIndexManuIndex->GetValue(SegmentIndexName);
109 Warning("GetManuIndex","SegmentIndex %s out of Detection Element mapping %s",
110 SegmentIndexName,fDetectionElementType.Data());
115 //_________________________________________________
116 AliMUONSegmentPosition * AliMUONSegmentationDetectionElement::GetPosition( const char * SegmentIndexName)
118 if (fMapIndexPosition) return (AliMUONSegmentPosition*) fMapIndexPosition->GetValue(SegmentIndexName);
120 Warning("GetPosition","SegmentIndex %s out of DetectionElement mapping %s",
121 SegmentIndexName, fDetectionElementType.Data());
126 //_________________________________________________
127 AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindManuIndex(const char* ManuIndexName)
129 if (fMapManuIndexIndex) return (AliMUONSegmentManuIndex*) fMapManuIndexIndex->FindObject(ManuIndexName);
131 Warning("FindManuIndex","SegmentManuIndex %s out of DetectionElement mapping %s",
132 ManuIndexName,fDetectionElementType.Data());
137 //_________________________________________________
138 AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindIndex(const char* IndexName)
140 if (fMapIndexPosition) return (AliMUONSegmentManuIndex *) fMapIndexPosition->FindObject(IndexName);
142 Warning("FindIndex","SegmentIndex %s out of DetectionElement mapping %s",
143 IndexName,fDetectionElementType.Data());
148 //_________________________________________________
149 void AliMUONSegmentationDetectionElement::Init(const char * DetectionElementType)
151 TString ElementType(DetectionElementType);
152 fSegmentationMappingFile_Bending = fgkDefaultTop+fgkStationDir+"345"
153 +fgkBendingDir+"/"+ElementType+fgkBendingExt+fgkFileExt;
154 printf("file is %s\n", fSegmentationMappingFile_Bending.Data());
155 fSegmentationMappingFile_NonBending = fgkDefaultTop+fgkStationDir+"345"
156 +fgkNonBendingDir+"/"+ElementType+fgkNonBendingExt+fgkFileExt;
158 if (fMapManuIndexIndex==0x0) {
159 fListOfIndexes = new TObjArray(10000);
160 fListOfManuIndexes =new TObjArray(10000);
161 fListOfPositions =new TObjArray(10000);
162 fMapManuIndexIndex= new TMap();
163 fMapIndexManuIndex = new TMap();
164 fMapIndexPosition = new TMap();
167 fListOfIndexes->Delete();
168 fListOfManuIndexes->Delete();
169 fListOfPositions->Delete();
170 fMapManuIndexIndex->Clear();
171 fMapIndexManuIndex->Clear();
172 fMapIndexPosition->Clear();
180 ReadingSegmentationMappingFile(fSegmentationMappingFile_Bending ,icathode);
183 ReadingSegmentationMappingFile(fSegmentationMappingFile_NonBending,icathode);
186 //_______________________________________________________________
187 void AliMUONSegmentationDetectionElement::ReadingSegmentationMappingFile(TString infile, Int_t cathode)
189 ifstream in( infile, ios::in);
191 // Error("ReadingSegmentationMappingFile", "File not found.");
194 Int_t id, ix, iy, idmanu, idchannel;
197 in >> id >> ix >> iy >> x >> y >> idmanu >> idchannel;
199 sprintf(name,"%d%d",ix,iy);
200 printf("%s id=%d ix=%d iy=%d x=%f y=%f idmanu=%d and idchannel=%d\n",name,id, ix, iy, x, y,idmanu, idchannel);
202 fListOfIndexes->AddAt( new AliMUONSegmentIndex(id,ix,iy,cathode), id);
203 fListOfManuIndexes->AddAt( new AliMUONSegmentManuIndex(id,idmanu,0,idchannel), id);;
204 fListOfPositions->AddAt( new AliMUONSegmentPosition(id, x, y,cathode), id);;
206 ( (AliMUONSegmentIndex* )fListOfIndexes->At(id))->Print();
207 ( (AliMUONSegmentManuIndex*)fListOfManuIndexes->At(id))->Print();
208 ( (AliMUONSegmentPosition*)fListOfPositions->At(id))->Print();
210 fMapManuIndexIndex->Add( fListOfManuIndexes->At(id), fListOfIndexes->At(id));
211 fMapIndexManuIndex->Add( fListOfIndexes->At(id), fListOfManuIndexes->At(id));
212 fMapIndexPosition->Add( fListOfIndexes->At(id), fListOfPositions->At(id));