1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
6 * Indranil Das <indra.das@saha.ac.in> *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /*********************************************
18 Purpose: A macro to generate LookupTable
20 detElemId+manuid+channelId buspatchId Ix IY X Y B/NB
26 Modified: 24/08/2007 (To adopt to AliRoot v4-06-Release)
28 Run Info: To run this code copy "rootlogon.C"
29 in the current directory from $ALICE_ROOT/MUON
31 transformFileName as "geometry.root" of the
32 simulation directory.Then compile and run using
33 .L generateLookupTable.C++
35 Author: Indranil Das, HEP, SINP, Kolkata
36 Email: indra.das@saha.ac.in
37 ***********************************************/
42 #include "AliCDBManager.h"
43 #include "AliGeomManager.h"
45 #include "AliMUONGeometryTransformer.h"
50 #include "AliMpSegmentation.h"
51 #include "AliMpDDLStore.h"
52 #include "AliMpDEIterator.h"
53 #include "AliMpVSegmentation.h"
54 #include "AliMpDEManager.h"
60 Bool_t CreateHitRecoLookupTables(TString CDBPath = "local://$ALICE_ROOT", Int_t run = 0, Bool_t warn = kTRUE)
62 Char_t filename1[20], filename2[20];
65 AliCDBManager* cdbManager = AliCDBManager::Instance();
66 cdbManager->SetDefaultStorage(CDBPath.Data());
67 cdbManager->SetRun(run);
69 if (! AliMpCDB::LoadDDLStore(warn)){
70 cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath "<<CDBPath<<", and Run : "<<run<<endl;
74 AliMpSegmentation *mpSegFactory = AliMpSegmentation::Instance();
75 AliGeomManager::LoadGeometry();
76 AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer();
77 if(! chamberGeometryTransformer->LoadGeometryData()){
78 cerr<<__FILE__<<": Failed to Load Geomerty Data "<<endl;
82 // AliMpSegmentation *mpSegFactory = AliMpSegmentation::ReadData();
84 // AliMpDDLStore* fDDLStore = AliMpDDLStore::ReadData();
86 // AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer();
87 // chamberGeometryTransformer->LoadGeometryData(transformFileName);
89 for(Int_t iCh = 0; iCh < 4; iCh++){ // max 4
91 sprintf(filename1,"Lut%d.dat",2*(6+iCh)+1);
92 FILE *fout1 = fopen(filename1,"w");
94 sprintf(filename2,"Lut%d.dat",2*(6+iCh)+2);
95 FILE *fout2 = fopen(filename2,"w");
100 for ( it.First(chamberId); ! it.IsDone(); it.Next() ) {
102 Int_t detElemId = it.CurrentDEId();
104 cout<<"Running for detElemId :"<<detElemId<<endl;
106 for(Int_t iCath = 0 ; iCath <= 1 ; iCath++){
108 AliMp::CathodType cath;
111 cath = AliMp::kCath0 ;
113 cath = AliMp::kCath1 ;
115 const AliMpVSegmentation* seg = mpSegFactory->CreateMpSegmentation(detElemId, cath);
116 AliMp::PlaneType plane = seg->PlaneType();
117 Int_t maxIX = seg->MaxPadIndexX();
118 Int_t maxIY = seg->MaxPadIndexY();
119 Int_t idManuChannel, manuId, channelId,idetElemId;
120 Double_t realX, realY, realZ;
121 Double_t localX, localY, localZ;
122 Double_t padSizeX, padSizeY;
125 //Pad Info of a segment
126 for(Int_t iX = 0; iX<= maxIX ; iX++){
127 for(Int_t iY = 0; iY<= maxIY ; iY++){
128 if(seg->HasPad(AliMpIntPair(iX,iY))){
129 AliMpPad pad = seg->PadByIndices(AliMpIntPair(iX,iY),kFALSE);
132 manuId = pad.GetLocation().GetFirst();
133 manuId &= 0x7FF; // 11 bits
135 // Getting channel id
136 channelId = pad.GetLocation().GetSecond();
137 channelId &= 0x3F; // 6 bits
139 idetElemId = detElemId%100;
141 idManuChannel &= 0x0;
142 idManuChannel = (idManuChannel|idetElemId)<<11;
143 idManuChannel = (idManuChannel|manuId)<<6 ;
144 idManuChannel |= channelId ;
146 localX = pad.Position().X();
147 localY = pad.Position().Y();
150 chamberGeometryTransformer->Local2Global(detElemId,localX,localY,localZ,
153 padSizeX = 2.0*pad.Dimensions().X();
154 padSizeY = 2.0*pad.Dimensions().Y();
159 else if(padSizeX==5.0)
167 else if(padSizeY==5.0)
173 if(idetElemId<7 || idetElemId > 19){
174 fprintf(fout2,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,plane);
177 fprintf(fout1,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,plane);