]>
Commit | Line | Data |
---|---|---|
5802cf2d | 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 | // This class handles the mapping of the Altro channels | |
17 | // The mapping is read from an external mapping files | |
16e29964 | 18 | // The class is used as a base class by TPC,PHOS and FMD |
5802cf2d | 19 | // Author: C.Cheshkov |
20 | ||
21 | #include "AliAltroMapping.h" | |
22 | #include "AliLog.h" | |
23 | #include <Riostream.h> | |
24 | //#include <stdlib.h> | |
25 | ||
26 | ||
27 | ClassImp(AliAltroMapping) | |
28 | ||
29 | //_____________________________________________________________________________ | |
30 | AliAltroMapping::AliAltroMapping(const char *mappingFile): | |
16e29964 | 31 | fIn(NULL), |
5802cf2d | 32 | fNumberOfChannels(0), |
16e29964 | 33 | fMaxHWAdress(0) |
5802cf2d | 34 | { |
35 | // Constructor | |
36 | // Reads the mapping from an external file | |
37 | if (mappingFile) | |
16e29964 | 38 | OpenMappingFile(mappingFile); |
5802cf2d | 39 | else |
40 | AliFatal("Mapping file not specified !"); | |
41 | } | |
42 | ||
43 | //_____________________________________________________________________________ | |
44 | AliAltroMapping::~AliAltroMapping() | |
45 | { | |
46 | // destructor | |
5802cf2d | 47 | } |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliAltroMapping::AliAltroMapping(const AliAltroMapping& mapping): | |
51 | TObject(mapping), | |
16e29964 | 52 | fIn(mapping.fIn), |
5802cf2d | 53 | fNumberOfChannels(mapping.fNumberOfChannels), |
16e29964 | 54 | fMaxHWAdress(mapping.fMaxHWAdress) |
5802cf2d | 55 | { |
56 | // Copy Constructor | |
57 | ||
58 | Fatal("AliAltroMapping", "copy constructor not implemented"); | |
59 | } | |
60 | ||
61 | //_____________________________________________________________________________ | |
62 | AliAltroMapping& AliAltroMapping::operator = (const AliAltroMapping& /*mapping*/) | |
63 | { | |
64 | //Assigment operator | |
65 | ||
66 | Fatal("operator =", "assignment operator not implemented"); | |
67 | return *this; | |
68 | } | |
69 | ||
70 | //_____________________________________________________________________________ | |
16e29964 | 71 | Bool_t AliAltroMapping::OpenMappingFile(const char *mappingFile) |
5802cf2d | 72 | { |
73 | // Initalizes the ALTRO mapping from a file | |
74 | // Look at the TPC module for the format of | |
75 | // the mapping file | |
16e29964 | 76 | fIn = new ifstream(mappingFile); |
77 | if (!*fIn) { | |
5802cf2d | 78 | AliFatal(Form("Missing mapping file (%s) !",mappingFile)); |
79 | return kFALSE; | |
80 | } | |
16e29964 | 81 | if (!(*fIn >> fNumberOfChannels)) { |
5802cf2d | 82 | AliFatal(Form("Syntax of the mapping file is wrong (%s) !",mappingFile)); |
83 | return kFALSE; | |
84 | } | |
16e29964 | 85 | if (!(*fIn >> fMaxHWAdress)) { |
5802cf2d | 86 | AliFatal(Form("Syntax of the mapping file is wrong (%s) !",mappingFile)); |
87 | return kFALSE; | |
88 | } | |
5802cf2d | 89 | |
5802cf2d | 90 | return kTRUE; |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
16e29964 | 94 | Bool_t AliAltroMapping::CloseMappingFile() |
5802cf2d | 95 | { |
16e29964 | 96 | // Closes the external mapping |
97 | // file | |
98 | if (fIn) { | |
99 | fIn->close(); | |
100 | fIn = NULL; | |
5802cf2d | 101 | } |
5802cf2d | 102 | |
16e29964 | 103 | return kTRUE; |
5802cf2d | 104 | } |