]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDCalibStripRange.cxx
small corrections
[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//
408bf2b4 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
408bf2b4 101AliFMDCalibStripRange::WriteToFile(std::ostream &outFile, Bool_t* detectors)
433a88bd 102{
103 outFile.write("# StripRange \n",14);
104 for(Int_t det=1;det<=3;det++) {
408bf2b4 105 if (detectors && !detectors[det-1]) {
106 continue;
107 }
433a88bd 108 UShort_t FirstRing = (det == 1 ? 1 : 0);
109 for (UShort_t ir = FirstRing; ir < 2; ir++) {
110 Char_t ring = (ir == 0 ? 'O' : 'I');
8f3f0bec 111 for(UShort_t board =0; board < 2; board++) {
112 outFile << det << ','
113 << ring << ','
114 << board << ','
115 << Min(det,ring,board) << ','
116 << Max(det,ring,board) << "\n";
433a88bd 117
118
119 }
120 }
121 }
122
123
124}
125//____________________________________________________________________
126void
408bf2b4 127AliFMDCalibStripRange::ReadFromFile(std::istream &inFile)
433a88bd 128{
129 TString line;
130 Bool_t readData=kFALSE;
131
132 while(line.ReadLine(inFile)) {
133 if(line.Contains("striprange",TString::kIgnoreCase)) {
134 readData = kTRUE;
135 break;
136 }
137
138 }
139
8f3f0bec 140 UShort_t det, board;
433a88bd 141 Char_t ring;
142 UShort_t min, max;
8f3f0bec 143
433a88bd 144 Int_t thisline = inFile.tellg();
145 Char_t c[4];
146
43a19191 147 while( readData ) {
433a88bd 148 thisline = inFile.tellg();
43a19191 149 line.ReadLine(inFile);
150
151 if(line.Contains("# ",TString::kIgnoreCase)) {
152 readData = kFALSE;
153 continue;
154 }
433a88bd 155
156 inFile.seekg(thisline);
157 inFile >> det >> c[0]
158 >> ring >> c[1]
8f3f0bec 159 >> board >> c[2]
433a88bd 160 >> min >> c[3]
161 >> max;
162
8f3f0bec 163 UInt_t nSec = (ring == 'I' ? 10 : 20);
164 UShort_t sector = board*nSec;
165 Set(det,ring,sector,0,min,max);
abdc44c9 166
433a88bd 167 }
168
169 inFile.seekg(0);
170
171
172}
c2fc1258 173
174//____________________________________________________________________
175//
176// EOF
177//