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 **************************************************************************/
19 // Macro to generate manu list per buspatch for station 3, 4 and 5
20 // Christian Finck, Subatech
23 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include "AliMpSegmentation.h"
26 #include "AliMpVSegmentation.h"
27 #include "AliMpDEManager.h"
28 #include "AliMpBusPatch.h"
29 #include "AliMpIntPair.h"
36 void testManuListSt345(Char_t* fileNamePre = "BusPatchToManu")
39 Int_t planeOffset = 1024;
44 AliMpBusPatch* busPatchManager = new AliMpBusPatch();
45 busPatchManager->ReadBusPatchFile();
47 // loop over DDL station 345
48 for (Int_t iDDL = 8; iDDL < 20; ++iDDL) {
50 sprintf(fileName,"%s%d%s", fileNamePre, iDDL, ".dat");
52 FILE* fp = fopen(fileName,"w");
53 printf("DDL # %d\n", iDDL);
54 fprintf(fp, "DDL # %d\n", iDDL);
55 TArrayI deArray = busPatchManager->GetDeInDDL(iDDL);
57 // list of DE in the given DDL
58 for (Int_t detElemId = 0; detElemId < deArray.GetSize(); ++detElemId) {
60 // list of bus patch for a given DE
61 TArrayI* busArray = busPatchManager->GetBusfromDE(deArray[detElemId]);
63 // list of manu per DE
65 for ( Int_t cath = 0; cath <=1 ; ++cath ) {
66 const AliMpVSegmentation* seg
67 = AliMpSegmentation::Instance()->GetMpSegmentation(deArray[detElemId],cath);
71 seg->GetAllElectronicCardIDs(manus);
74 for ( Int_t im = 0; im < manus.GetSize(); ++im ) {
76 AliMpIntPair* manu = new AliMpIntPair((manus[im] & 0x3FF), cath, kTRUE);// remove the offfset
81 // printf("Number of manu %d\n", manuList.GetEntries());
83 // writing into files/stdout
86 for (Int_t iEntry = 0; iEntry < manuList.GetEntries(); iEntry++) {
88 AliMpIntPair* manuPtr = (AliMpIntPair*)manuList.At(iEntry);
89 Int_t pos = manuPtr->GetFirst()/100;
93 if (manuPtr->GetSecond())
94 manuId = manuPtr->GetFirst() + planeOffset;
96 manuId = manuPtr->GetFirst();
100 printf("%d;\n", manuIdPrev);
101 fprintf(fp,"%d;\n", manuIdPrev);
104 printf("%d %d %d-", deArray[detElemId],
105 AliMpBusPatch::GetLocalBusID(busArray->At(pos),iDDL), manuId);
106 fprintf(fp,"%d %d-", AliMpBusPatch::GetLocalBusID(busArray->At(pos),iDDL), manuId);
109 } else if ( manuId != manuIdPrev+1) {
110 printf("%d; ", manuIdPrev);
111 printf("%d-", manuId);
112 fprintf(fp,"%d; ", manuIdPrev);
113 fprintf(fp,"%d-", manuId);
119 if (iEntry == manuList.GetEntries()-1) {
120 printf("%d;\n", manuId);
121 fprintf(fp,"%d;\n", manuId);
128 printf("Number of buspatches %d and manus %d\n", nBusPatch, nManu);
130 delete busPatchManager;