]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliAltroMapping.cxx
START becomes T0
[u/mrichter/AliRoot.git] / RAW / AliAltroMapping.cxx
CommitLineData
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
27ClassImp(AliAltroMapping)
28
cc934096 29//_____________________________________________________________________________
30AliAltroMapping::AliAltroMapping():
31 fIn(NULL),
32 fNumberOfChannels(0),
33 fMaxHWAddress(0)
34{
35 // Default constructor
36}
37
5802cf2d 38//_____________________________________________________________________________
39AliAltroMapping::AliAltroMapping(const char *mappingFile):
16e29964 40 fIn(NULL),
5802cf2d 41 fNumberOfChannels(0),
cc934096 42 fMaxHWAddress(0)
5802cf2d 43{
44 // Constructor
45 // Reads the mapping from an external file
46 if (mappingFile)
16e29964 47 OpenMappingFile(mappingFile);
5802cf2d 48 else
49 AliFatal("Mapping file not specified !");
50}
51
52//_____________________________________________________________________________
53AliAltroMapping::~AliAltroMapping()
54{
55 // destructor
5802cf2d 56}
57
58//_____________________________________________________________________________
59AliAltroMapping::AliAltroMapping(const AliAltroMapping& mapping):
60 TObject(mapping),
16e29964 61 fIn(mapping.fIn),
5802cf2d 62 fNumberOfChannels(mapping.fNumberOfChannels),
cc934096 63 fMaxHWAddress(mapping.fMaxHWAddress)
5802cf2d 64{
65// Copy Constructor
66
67 Fatal("AliAltroMapping", "copy constructor not implemented");
68}
69
70//_____________________________________________________________________________
71AliAltroMapping& AliAltroMapping::operator = (const AliAltroMapping& /*mapping*/)
72{
73//Assigment operator
74
75 Fatal("operator =", "assignment operator not implemented");
76 return *this;
77}
78
79//_____________________________________________________________________________
16e29964 80Bool_t AliAltroMapping::OpenMappingFile(const char *mappingFile)
5802cf2d 81{
82 // Initalizes the ALTRO mapping from a file
83 // Look at the TPC module for the format of
84 // the mapping file
16e29964 85 fIn = new ifstream(mappingFile);
86 if (!*fIn) {
5802cf2d 87 AliFatal(Form("Missing mapping file (%s) !",mappingFile));
88 return kFALSE;
89 }
16e29964 90 if (!(*fIn >> fNumberOfChannels)) {
5802cf2d 91 AliFatal(Form("Syntax of the mapping file is wrong (%s) !",mappingFile));
92 return kFALSE;
93 }
cc934096 94 if (!(*fIn >> fMaxHWAddress)) {
5802cf2d 95 AliFatal(Form("Syntax of the mapping file is wrong (%s) !",mappingFile));
96 return kFALSE;
97 }
5802cf2d 98
5802cf2d 99 return kTRUE;
100}
101
102//_____________________________________________________________________________
16e29964 103Bool_t AliAltroMapping::CloseMappingFile()
5802cf2d 104{
16e29964 105 // Closes the external mapping
106 // file
107 if (fIn) {
108 fIn->close();
109 fIn = NULL;
5802cf2d 110 }
5802cf2d 111
16e29964 112 return kTRUE;
5802cf2d 113}