]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/macros/CreateRegionalToLocalCardMapping.C
Updates (B. Vulpescu)
[u/mrichter/AliRoot.git] / HLT / MUON / macros / CreateRegionalToLocalCardMapping.C
CommitLineData
86665942 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
4 * *
5 * Primary Authors: *
6 * Indranil Das <indra.das@saha.ac.in> *
7 * *
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 **************************************************************************/
16
17/**********************************************************************
18 Created on : 08/09/2007
19 Purpose : TriggerDDL Regional to LocalBoard Mapping.
20 Author : Indranil Das, HEP Division, SINP
21 Email : indra.das@saha.ac.in | indra.ehep@gmail.com
22**********************************************************************/
23
24#include <iostream>
25
26#include "AliMpDDLStore.h"
27#include "AliMpSegmentation.h"
28#include "AliMpTriggerCrate.h"
29#include "AliMpLocalBoard.h"
30
31using namespace std;
32
33bool CreateRegionalToLocalCardMapping()
34{
35 AliMpSegmentation::ReadData();
36 AliMpDDLStore::ReadData();
37
38 FILE *fout = fopen("RegionalToLocalCard.dat","w");
39
40 for(int iTrigDDL = 0; iTrigDDL<2 ; iTrigDDL++){
41
42 for(int iReg = 0; iReg < 8 ; iReg++){
43
44 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(iTrigDDL,iReg);
45 cout<<"Nof Local Board : "<<crate->GetNofLocalBoards()<<endl;
46 AliMpLocalBoard* locBoard ;
47
48 for(int i = 0 ; i < crate->GetNofLocalBoards() ; i++){
49 locBoard = AliMpDDLStore::Instance()->GetLocalBoard(crate->GetLocalBoardId(i));
50
51 cout<<"iTrigDDL : "<<iTrigDDL<<", iReg : "<<iReg<<", iLoc : "<<i
52 <<", locID : "<<locBoard->GetId()<<", Switch : (" ;
53 fprintf(fout,"%1d\t%1d\t%-2d\t%-3d\t",iTrigDDL,iReg,i,locBoard->GetId());
54
55 int switch_packed ;
56 switch_packed &= 0x0 ;
57 for(int j = 0 ; j < locBoard->GetNofSwitches() ; j++){
58 cout<<locBoard->GetSwitch(j);
59
60 if(j<(locBoard->GetNofSwitches()-1))
61 switch_packed = (switch_packed | locBoard->GetSwitch(j))<<1 ;
62 else
63 switch_packed |= locBoard->GetSwitch(j) ;
64 }
65
66 cout<<"), packed switched : "<<switch_packed<<", DDL : ";
67 fprintf(fout,"%-4d\t",switch_packed);
68
69 for(int j = 0 ; j < 4 ; j++){
70 // intensionally made 4 instead of locBoard->GetNofDEs() to give identical structure for the fake local IDs
71 if(locBoard->GetNofDEs()<4){
72 cout<<locBoard->GetDEId(0)<<", ";
73 fprintf(fout,"%-4d\t",locBoard->GetDEId(0));
74 }else{
75 cout<<locBoard->GetDEId(j)<<", ";
76 fprintf(fout,"%-4d\t",locBoard->GetDEId(j));
77 }//if detelem condn
78 }// detelem loop
79
80 cout<<endl;
81 fprintf(fout,"\n");
82
83 }// loc board loop
84 delete crate;
85 //delete locBoard;
86
87 }//iReg loop
88 }//iTrigDDL loop
89
90 fclose(fout);
91 return true;
92}