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 void MUONGenerateBusPatch()
19 // Generates buspatch id and DDL id for given detection element id
20 // station 1 & 2 assuming 25 bus patch per quadrant ???
21 // station345, reading from DetElemIdToSlatType.dat file and calculates
22 // the number of bus patches per slat (and also number of Translator and Bridge Boards).
23 // Generates an output file DetElemIdToBusPatch.dat.out, preserve from overwriting
24 // (Ch. Finck, July 05)
25 // (Nov. 05: added DDL)
27 TString dirPath2 = gSystem->Getenv("ALICE_ROOT");
28 dirPath2 += "/MUON/mapping/data/";
30 TString dirPath1 = dirPath2 + "station345/";
32 TString infile = dirPath1 + "DetElemIdToSlatType.dat";
33 TString outfile = dirPath2 + "DetElemIdToBusPatch.dat.out";
35 ifstream in(infile, ios::in);
36 ofstream out(outfile, ios::out);
48 Int_t idSt12[] = {100, 101, 102, 103,
53 Int_t idSt3swp = 9; // half chamber for DDL on horizontal
54 Int_t idSt45swp1 = 7; // half chamber for DDL in vertical cutting twice the official numbering
55 Int_t idSt45swp2 = 20;
60 cout << "#DE BusPatch DDL SlatName" << endl;
61 out << "#DE BusPatch DDL " << endl;
63 for (Int_t j = 0; j < 16; j++) {
66 if (idDE % 100 == 0) {
68 cout << "# Chamber " << idDE/100 << endl;
69 out << "# Chamber " << idDE/100 << endl;
71 if (idDE % 2 == 0) iDDL++;
72 end[cursor] = begin[cursor] + nbBusPatch - 1;
73 begin[++cursor] = end[cursor] + 1;
75 cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL << endl;
76 out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL <<endl;
81 while ( in.getline(line,80) ) {
83 if ( line[0] == '#' || line[0] == '\0' ) continue;
85 sscanf(line, "%d %s", &idDE, nameSlat);
88 while(nameSlat[i] < '4' && nameSlat[i] !='0') i++;
89 Int_t len = strlen(nameSlat);
97 // calculate the number of TB & BB
98 // R1: 2 bridges more per PCB
99 // R2 & R3: 1 translator more per PCB
100 if (i == 2) nbBB += 2;
101 if (i == 3) nbBB += 4;
102 if (i == 4) nbBB += 4;
103 if (i == 5) nbBB += 6;
104 if (i == 6) nbBB += 8;
107 if (nameSlat[len-1] == '1')
109 if (nameSlat[len-1] == '2' || nameSlat[len-1] == '3')
112 listDE[cursor] = idDE;
113 if (idDE % 100 == 0) {
117 begin[cursor] = idDE;
118 cout << "# Chamber " << idDE/100 << endl;
119 out << "# Chamber " << idDE/100 << endl;
121 if (idDE == 500+idSt3swp || idDE == 600+idSt3swp )
124 if (idDE == 700+idSt45swp1 || idDE == 800+idSt45swp1 || idDE == 900+idSt45swp1 || idDE == 1000+idSt45swp1 )
127 if (idDE == 700+idSt45swp2 || idDE == 800+idSt45swp2 || idDE == 900+idSt45swp2 || idDE == 1000+idSt45swp2 )
130 end[cursor] = begin[cursor] + nbBusPatch - 1;
131 begin[++cursor] = end[cursor] + 1;
133 cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] << " " << iDDL << " " <<nameSlat <<endl;
134 out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL <<endl;
136 printf(" Slat: number of TB %d and BB %d\n", nbTB, nbBB);