]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/macros/CreateBusToDetElemFile.C
Applying modification so that LUTs are generated from CDB, which also solves LUT...
[u/mrichter/AliRoot.git] / HLT / MUON / macros / CreateBusToDetElemFile.C
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 Purpose:  A macro to generate buspatch to ddl mapping file 
19
20 Created:  7/10/2005
21 Modified: 22/12/2005
22 Modified: 09/02/2006
23 Modified: 09/04/2007
24 Modified: 24/08/2007 (To adopt to AliRoot v4-06-Release)
25
26 Author:   Indranil Das, HEP, SINP, Kolkata
27 Email:    indra.das@saha.ac.in
28 ***********************************************/
29
30 #include <iostream>
31
32 #include <TString.h>
33
34 #include <AliCDBManager.h>
35
36 #include <AliMpCDB.h>
37 #include <AliMpDDLStore.h>
38 #include <AliMpDetElement.h>
39
40 int CreateBusToDetElemFile(TString CDBPath = "local://$ALICE_ROOT", Int_t run = 0)
41 {
42   FILE *fp = fopen("BusToDetElem.dat","w");
43
44   AliMpDetElement* fDetElement;
45   
46   AliCDBManager* cdbManager = AliCDBManager::Instance();
47   cdbManager->SetDefaultStorage(CDBPath.Data());
48   cdbManager->SetRun(run);
49
50   if (! AliMpCDB::LoadDDLStore(true)){
51     cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath "<<CDBPath<<", and Run : "<<run<<endl;
52     return kFALSE;
53   }
54
55   fprintf(fp,"#DE\tBusPatch\tDDL\n");
56   for(int ch=7;ch<=10;ch++){
57     fprintf(fp,"# Chamber %d\n",ch);
58     for(int i=0; i<26 ; i++){
59       fDetElement = AliMpDDLStore::Instance()->GetDetElement(ch*100 + i);
60       fprintf(fp,"%d\t%d - %d\t%d\n",ch*100 + i,fDetElement->GetBusPatchId(0),
61               fDetElement->GetBusPatchId(fDetElement->GetNofBusPatches()-1),fDetElement->GetDdlId());
62     }
63   }
64
65
66   delete fDetElement;
67   fclose(fp);
68
69   return 0;
70 }