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 #if !defined(__CINT__) || defined(__MAKECINT__)
23 #include "AliMpDDLStore.h"
25 #include "AliMpTriggerCrate.h"
26 #include "AliMpLocalBoard.h"
32 // Macro to generate regionnal file for Mtg package (online) from AliRoot trigger mapping
33 // Ch. Finck (20.08.07)
35 void MUONGenerateMtgRegFile(Int_t mode = 2, Int_t coinc = 0, UInt_t defaultMask = 0xFFFF,
36 Int_t version = 20, TString name = "MtgRegionalCrate" )
38 // mode = 0,1; 2; 3 -> writing mode no filter; mask; overwrite
39 // coinc = 0,1 -> coincidence 3/4, 4/4
43 TString fileName = name + Form("-%d", version) + ".dat";
45 if ( !AliMpCDB::LoadDDLStore() ) {
46 printf("Could not access DDL Store from OCDB !\n");
49 FILE* fp = fopen(fileName.Data(), "w");
50 // instanciate the elec. mapping class
51 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
53 // loop over the trigger DDL (Right: 20, Left: 21)
54 for (Int_t iDDL = 20; iDDL <= 21; ++iDDL) {
57 AliMpDDL* ddl = ddlStore->GetDDL(iDDL);
59 Int_t nCrate = ddl->GetNofTriggerCrates();
61 // loop over the number of crate in DDL
62 for (Int_t index = 0; index < nCrate; ++index) {
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);
75 fprintf(fp, "%04x\n", mask);
77 Int_t nLocal = crate->GetNofLocalBoards();
79 for (Int_t iLocal = 0; iLocal < nLocal; ++iLocal) {
81 // get local board Id from crate object
82 Int_t localId = crate->GetLocalBoardId(iLocal);
84 // get local board object
85 AliMpLocalBoard* localBoard = ddlStore->GetLocalBoard(localId);
87 // print out some info from local board
88 fprintf(fp, "%02d %s %03d %03x\n", localBoard->GetSlot(), localBoard->GetName(),
89 localId, localBoard->GetSwitch());
93 for (Int_t i = 0; i < localBoard->GetNofDEs(); ++i)
94 fprintf(fp, "%4d ", localBoard->GetDEId(i));
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());