]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDCalibStripRange.cxx
A lot of changes after detector review:
[u/mrichter/AliRoot.git] / FMD / AliFMDCalibStripRange.cxx
CommitLineData
c2fc1258 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/* $Id$ */
16/** @file AliFMDCalibStripRange.cxx
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Sun Mar 26 18:31:09 2006
19 @brief Per digitizer card pulser calibration
20*/
21//____________________________________________________________________
22//
02a27b50 23// This class stores which strips are read-out.
24// In principle this can be set for each half-ring.
25// However, in real life, all the detectors will probably read out all
26// strips, and dead areas can be handled off-line.
27// This information comes from DCS or the like.
c2fc1258 28//
43a19191 29#include "iostream"
c2fc1258 30#include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H
433a88bd 31#include "TString.h"
6169f936 32// #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
c2fc1258 33
34//____________________________________________________________________
35ClassImp(AliFMDCalibStripRange)
36#if 0
37 ; // This is here to keep Emacs for indenting the next line
38#endif
39
40//____________________________________________________________________
41AliFMDCalibStripRange::AliFMDCalibStripRange()
02a27b50 42 : fRanges(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1)
43 // fRanges(3)
c2fc1258 44{
02a27b50 45 // CTOR
46 fRanges.Reset(1);
c2fc1258 47}
48
49//____________________________________________________________________
50AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o)
02a27b50 51 : TObject(o), fRanges(o.fRanges)
52{
53 // Copy CTOR
54}
c2fc1258 55
56//____________________________________________________________________
57AliFMDCalibStripRange&
58AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o)
59{
02a27b50 60 // Assignement operator
61 fRanges = o.fRanges;
c2fc1258 62 return (*this);
63}
64
65//____________________________________________________________________
66void
67AliFMDCalibStripRange::Set(UShort_t det, Char_t ring,
68 UShort_t sector, UShort_t, UShort_t min,
69 UShort_t max)
70{
02a27b50 71 // Set the min and max for a half-ring
43a19191 72 UInt_t nSec = (ring == 'I' ? 10 : 20);
c2fc1258 73 UInt_t board = sector / nSec;
02a27b50 74 fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
c2fc1258 75}
76
77//____________________________________________________________________
78UShort_t
79AliFMDCalibStripRange::Min(UShort_t det, Char_t ring,
80 UShort_t sec, UShort_t) const
81{
02a27b50 82 // Get the min for a half-ring
43a19191 83 UInt_t nSec = (ring == 'I' ? 10 : 20);
c2fc1258 84 UInt_t board = sec / nSec;
43a19191 85
02a27b50 86 return (fRanges(det, ring, board, 0) & 0x7f);
c2fc1258 87}
88
89//____________________________________________________________________
90UShort_t
91AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
92 UShort_t sec, UShort_t) const
93{
02a27b50 94 // Get the max for a half-ring
43a19191 95 UInt_t nSec = (ring == 'I' ? 10 : 20);
c2fc1258 96 UInt_t board = sec / nSec;
02a27b50 97 return ((fRanges(det, ring, board, 0) >> 8) & 0x7f);
c2fc1258 98}
433a88bd 99//____________________________________________________________________
100void
101AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
102{
103 outFile.write("# StripRange \n",14);
104 for(Int_t det=1;det<=3;det++) {
105 UShort_t FirstRing = (det == 1 ? 1 : 0);
106 for (UShort_t ir = FirstRing; ir < 2; ir++) {
107 Char_t ring = (ir == 0 ? 'O' : 'I');
8f3f0bec 108 for(UShort_t board =0; board < 2; board++) {
109 outFile << det << ','
110 << ring << ','
111 << board << ','
112 << Min(det,ring,board) << ','
113 << Max(det,ring,board) << "\n";
433a88bd 114
115
116 }
117 }
118 }
119
120
121}
122//____________________________________________________________________
123void
124AliFMDCalibStripRange::ReadFromFile(ifstream &inFile)
125{
126 TString line;
127 Bool_t readData=kFALSE;
128
129 while(line.ReadLine(inFile)) {
130 if(line.Contains("striprange",TString::kIgnoreCase)) {
131 readData = kTRUE;
132 break;
133 }
134
135 }
136
8f3f0bec 137 UShort_t det, board;
433a88bd 138 Char_t ring;
139 UShort_t min, max;
8f3f0bec 140
433a88bd 141 Int_t thisline = inFile.tellg();
142 Char_t c[4];
143
43a19191 144 while( readData ) {
433a88bd 145 thisline = inFile.tellg();
43a19191 146 line.ReadLine(inFile);
147
148 if(line.Contains("# ",TString::kIgnoreCase)) {
149 readData = kFALSE;
150 continue;
151 }
433a88bd 152
153 inFile.seekg(thisline);
154 inFile >> det >> c[0]
155 >> ring >> c[1]
8f3f0bec 156 >> board >> c[2]
433a88bd 157 >> min >> c[3]
158 >> max;
159
8f3f0bec 160 UInt_t nSec = (ring == 'I' ? 10 : 20);
161 UShort_t sector = board*nSec;
162 Set(det,ring,sector,0,min,max);
abdc44c9 163
433a88bd 164 }
165
166 inFile.seekg(0);
167
168
169}
c2fc1258 170
171//____________________________________________________________________
172//
173// EOF
174//