]>
Commit | Line | Data |
---|---|---|
dc00617c | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | ||
17 | // | |
18 | // | |
19 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
20 | ||
21 | #include <stdio.h> | |
22 | #include "TString.h" | |
23 | #include "AliMpDDLStore.h" | |
24 | #include "AliMpDDL.h" | |
25 | #include "AliMpTriggerCrate.h" | |
26 | #include "AliMpLocalBoard.h" | |
27 | #include "AliMpCDB.h" | |
28 | ||
29 | #endif | |
30 | ||
31 | ||
32 | // Macro to generate regionnal file for Mtg package (online) from AliRoot trigger mapping | |
33 | // Ch. Finck (20.08.07) | |
34 | ||
35 | void MUONGenerateMtgRegFile(Int_t mode = 2, Int_t coinc = 0, UInt_t defaultMask = 0xFFFF, | |
29f29934 | 36 | Int_t version = 20, TString name = "MtgRegionalCrate" ) |
dc00617c | 37 | { |
38 | // mode = 0,1; 2; 3 -> writing mode no filter; mask; overwrite | |
39 | // coinc = 0,1 -> coincidence 3/4, 4/4 | |
40 | ||
41 | UInt_t mask; | |
42 | ||
43 | TString fileName = name + Form("-%d", version) + ".dat"; | |
44 | // Load DDL store | |
45 | if ( !AliMpCDB::LoadDDLStore() ) { | |
46 | printf("Could not access DDL Store from OCDB !\n"); | |
47 | } | |
48 | ||
49 | FILE* fp = fopen(fileName.Data(), "w"); | |
50 | // instanciate the elec. mapping class | |
51 | AliMpDDLStore* ddlStore = AliMpDDLStore::Instance(); | |
52 | ||
53 | // loop over the trigger DDL (Right: 20, Left: 21) | |
54 | for (Int_t iDDL = 20; iDDL <= 21; ++iDDL) { | |
55 | ||
56 | // get ddl object | |
57 | AliMpDDL* ddl = ddlStore->GetDDL(iDDL); | |
58 | ||
59 | Int_t nCrate = ddl->GetNofTriggerCrates(); | |
60 | ||
61 | // loop over the number of crate in DDL | |
62 | for (Int_t index = 0; index < nCrate; ++index) { | |
63 | ||
64 | // get crate object | |
65 | AliMpTriggerCrate* crate = ddlStore->GetTriggerCrate(iDDL, index); | |
66 | fprintf(fp, "%s\n", crate->GetName()); | |
67 | fprintf(fp, "%02x\n", index + (iDDL-20)*8); | |
68 | fprintf(fp, "%d\n", mode); | |
69 | fprintf(fp, "%d\n", coinc); | |
70 | ||
71 | if (index == 7) | |
72 | mask = 0x1ff; | |
73 | else | |
74 | mask = defaultMask; | |
75 | fprintf(fp, "%04x\n", mask); | |
76 | ||
77 | Int_t nLocal = crate->GetNofLocalBoards(); | |
78 | ||
79 | for (Int_t iLocal = 0; iLocal < nLocal; ++iLocal) { | |
80 | ||
81 | // get local board Id from crate object | |
82 | Int_t localId = crate->GetLocalBoardId(iLocal); | |
83 | ||
84 | // get local board object | |
85 | AliMpLocalBoard* localBoard = ddlStore->GetLocalBoard(localId); | |
86 | ||
dc00617c | 87 | // print out some info from local board |
29f29934 | 88 | fprintf(fp, "%02d %s %03d %03x\n", localBoard->GetSlot(), localBoard->GetName(), |
89 | localId, localBoard->GetSwitch()); | |
90 | ||
91 | // print DE id | |
92 | fprintf(fp, " "); | |
93 | for (Int_t i = 0; i < localBoard->GetNofDEs(); ++i) | |
94 | fprintf(fp, "%4d ", localBoard->GetDEId(i)); | |
95 | fprintf(fp, "\n"); | |
96 | ||
97 | // print copy card numbers | |
98 | fprintf(fp, " %4d %4d", localBoard->GetInputXfrom(), localBoard->GetInputXto()); | |
99 | fprintf(fp, " %4d %4d", localBoard->GetInputYfrom(), localBoard->GetInputYto()); | |
100 | fprintf(fp, " %4d\n", localBoard->GetTC()); | |
dc00617c | 101 | } |
102 | } | |
103 | } | |
104 | fclose(fp); | |
105 | } | |
106 |