Special particles added in AddParticlesToPdgDataBase()
[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
29//_____________________________________________________________________________
cc934096 30AliAltroMapping::AliAltroMapping():
31 fIn(NULL),
32 fNumberOfChannels(0),
33 fMaxHWAddress(0)
34{
35 // Default constructor
36}
37
38//_____________________________________________________________________________
5802cf2d 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{
69776907 55 CloseMappingFile();
5802cf2d 56 // destructor
5802cf2d 57}
58
59//_____________________________________________________________________________
60AliAltroMapping::AliAltroMapping(const AliAltroMapping& mapping):
61 TObject(mapping),
16e29964 62 fIn(mapping.fIn),
5802cf2d 63 fNumberOfChannels(mapping.fNumberOfChannels),
cc934096 64 fMaxHWAddress(mapping.fMaxHWAddress)
5802cf2d 65{
66// Copy Constructor
67
68 Fatal("AliAltroMapping", "copy constructor not implemented");
69}
70
71//_____________________________________________________________________________
72AliAltroMapping& AliAltroMapping::operator = (const AliAltroMapping& /*mapping*/)
73{
74//Assigment operator
75
76 Fatal("operator =", "assignment operator not implemented");
77 return *this;
78}
79
80//_____________________________________________________________________________
16e29964 81Bool_t AliAltroMapping::OpenMappingFile(const char *mappingFile)
5802cf2d 82{
83 // Initalizes the ALTRO mapping from a file
84 // Look at the TPC module for the format of
85 // the mapping file
16e29964 86 fIn = new ifstream(mappingFile);
87 if (!*fIn) {
5802cf2d 88 AliFatal(Form("Missing mapping file (%s) !",mappingFile));
89 return kFALSE;
90 }
16e29964 91 if (!(*fIn >> fNumberOfChannels)) {
5802cf2d 92 AliFatal(Form("Syntax of the mapping file is wrong (%s) !",mappingFile));
93 return kFALSE;
94 }
cc934096 95 if (!(*fIn >> fMaxHWAddress)) {
5802cf2d 96 AliFatal(Form("Syntax of the mapping file is wrong (%s) !",mappingFile));
97 return kFALSE;
98 }
5802cf2d 99
5802cf2d 100 return kTRUE;
101}
102
103//_____________________________________________________________________________
16e29964 104Bool_t AliAltroMapping::CloseMappingFile()
5802cf2d 105{
16e29964 106 // Closes the external mapping
107 // file
108 if (fIn) {
109 fIn->close();
69776907 110 delete fIn;
16e29964 111 fIn = NULL;
5802cf2d 112 }
5802cf2d 113
16e29964 114 return kTRUE;
5802cf2d 115}