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