]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDCalibStripRange.cxx
Changes in SPD and SSD geometry to remove some (~50) overlaps-extrusions (M. Sitta)
[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//
29#include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H
433a88bd 30#include "TString.h"
6169f936 31// #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
c2fc1258 32
33//____________________________________________________________________
34ClassImp(AliFMDCalibStripRange)
35#if 0
36 ; // This is here to keep Emacs for indenting the next line
37#endif
38
39//____________________________________________________________________
40AliFMDCalibStripRange::AliFMDCalibStripRange()
02a27b50 41 : fRanges(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1)
42 // fRanges(3)
c2fc1258 43{
02a27b50 44 // CTOR
45 fRanges.Reset(1);
c2fc1258 46}
47
48//____________________________________________________________________
49AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o)
02a27b50 50 : TObject(o), fRanges(o.fRanges)
51{
52 // Copy CTOR
53}
c2fc1258 54
55//____________________________________________________________________
56AliFMDCalibStripRange&
57AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o)
58{
02a27b50 59 // Assignement operator
60 fRanges = o.fRanges;
c2fc1258 61 return (*this);
62}
63
64//____________________________________________________________________
65void
66AliFMDCalibStripRange::Set(UShort_t det, Char_t ring,
67 UShort_t sector, UShort_t, UShort_t min,
68 UShort_t max)
69{
02a27b50 70 // Set the min and max for a half-ring
c2fc1258 71 UInt_t nSec = (ring == 'I' ? 20 : 40);
72 UInt_t board = sector / nSec;
02a27b50 73 fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
c2fc1258 74}
75
76//____________________________________________________________________
77UShort_t
78AliFMDCalibStripRange::Min(UShort_t det, Char_t ring,
79 UShort_t sec, UShort_t) const
80{
02a27b50 81 // Get the min for a half-ring
c2fc1258 82 UInt_t nSec = (ring == 'I' ? 20 : 40);
83 UInt_t board = sec / nSec;
02a27b50 84 return (fRanges(det, ring, board, 0) & 0x7f);
c2fc1258 85}
86
87//____________________________________________________________________
88UShort_t
89AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
90 UShort_t sec, UShort_t) const
91{
02a27b50 92 // Get the max for a half-ring
c2fc1258 93 UInt_t nSec = (ring == 'I' ? 20 : 40);
94 UInt_t board = sec / nSec;
02a27b50 95 return ((fRanges(det, ring, board, 0) >> 8) & 0x7f);
c2fc1258 96}
433a88bd 97//____________________________________________________________________
98void
99AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
100{
101 outFile.write("# StripRange \n",14);
102 for(Int_t det=1;det<=3;det++) {
103 UShort_t FirstRing = (det == 1 ? 1 : 0);
104 for (UShort_t ir = FirstRing; ir < 2; ir++) {
105 Char_t ring = (ir == 0 ? 'O' : 'I');
106 UShort_t nsec = (ir == 0 ? 40 : 20);
107 UShort_t nstr = (ir == 0 ? 256 : 512);
108 for(UShort_t sec =0; sec < nsec; sec++) {
109 outFile << det << ','
110 << ring << ','
111 << sec << ','
112 << Min(det,ring,sec) << ','
113 << Max(det,ring,sec) << "\n";
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
137 UShort_t det, sec;
138 Char_t ring;
139 UShort_t min, max;
140 Int_t thisline = inFile.tellg();
141 Char_t c[4];
142
143 while(line.ReadLine(inFile) && readData ) {
144 thisline = inFile.tellg();
145 thisline = thisline--;
146 if(line.Contains("# ",TString::kIgnoreCase)) {
147 readData = kFALSE;
148 continue;
149 }
150
151 inFile.seekg(thisline);
152 inFile >> det >> c[0]
153 >> ring >> c[1]
154 >> sec >> c[2]
155 >> min >> c[3]
156 >> max;
157
158 Set(det,ring,sec,0,min,max);
159
160 }
161
162 inFile.seekg(0);
163
164
165}
c2fc1258 166
167//____________________________________________________________________
168//
169// EOF
170//