1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
21 //____________________________________________________________________
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.
29 // IMPORTANT: The member function WriteToFile writes out the entries
32 // det,ring,id,min,max
34 // Here, id is a number from 0 to 1, which represents the division in
35 // half-rings. The mapping is as follows:
37 // Inner rings: Outer Rings
38 // id Sectors Board id Sectors Board
39 // ----+---------+------- ----+---------+-------
40 // 0 | 0 - 9 | 0x10 0 | 0 - 19 | 0x11
41 // 1 | 10 - 19 | 0x0 1 | 20 - 39 | 0x1
43 // The same mapping is used in the ReadFromFile member function
46 #include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H
48 // #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
50 //____________________________________________________________________
51 ClassImp(AliFMDCalibStripRange)
53 ; // This is here to keep Emacs for indenting the next line
56 //____________________________________________________________________
57 AliFMDCalibStripRange::AliFMDCalibStripRange()
58 : fRanges(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1)
65 //____________________________________________________________________
66 AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o)
67 : TObject(o), fRanges(o.fRanges)
72 //____________________________________________________________________
73 AliFMDCalibStripRange&
74 AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o)
76 // Assignement operator
81 //____________________________________________________________________
83 AliFMDCalibStripRange::Set(UShort_t det, Char_t ring,
84 UShort_t sector, UShort_t, UShort_t min,
87 // Set the min and max for a half-ring
88 UInt_t nSec = (ring == 'I' ? 10 : 20);
89 UInt_t board = sector / nSec;
90 fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
93 //____________________________________________________________________
95 AliFMDCalibStripRange::Min(UShort_t det, Char_t ring,
96 UShort_t sec, UShort_t) const
98 // Get the min for a half-ring
99 UInt_t nSec = (ring == 'I' ? 10 : 20);
100 UInt_t board = sec / nSec;
102 return (fRanges(det, ring, board, 0) & 0x7f);
105 //____________________________________________________________________
107 AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
108 UShort_t sec, UShort_t) const
110 // Get the max for a half-ring
111 UInt_t nSec = (ring == 'I' ? 10 : 20);
112 UInt_t board = sec / nSec;
113 return ((fRanges(det, ring, board, 0) >> 8) & 0x7f);
115 //____________________________________________________________________
117 AliFMDCalibStripRange::WriteToFile(std::ostream &outFile, Bool_t* detectors)
119 outFile.write("# StripRange \n",14);
120 for(Int_t det=1;det<=3;det++) {
121 if (detectors && !detectors[det-1]) {
124 UShort_t FirstRing = (det == 1 ? 1 : 0);
125 for (UShort_t ir = FirstRing; ir < 2; ir++) {
126 Char_t ring = (ir == 0 ? 'O' : 'I');
127 UInt_t nSec = (ring == 'I' ? 10 : 20);
128 for(UShort_t board =0; board < 2; board++) {
129 UShort_t sector = board*nSec;
130 outFile << det << ','
133 << Min(det,ring,sector) << ','
134 << Max(det,ring,sector) << "\n";
143 //____________________________________________________________________
145 AliFMDCalibStripRange::ReadFromFile(std::istream &inFile)
148 Bool_t readData=kFALSE;
150 while(line.ReadLine(inFile)) {
151 if(line.Contains("striprange",TString::kIgnoreCase)) {
162 Int_t thisline = inFile.tellg();
166 thisline = inFile.tellg();
167 line.ReadLine(inFile);
169 if(line.Contains("# ",TString::kIgnoreCase)) {
174 inFile.seekg(thisline);
175 inFile >> det >> c[0]
181 UInt_t nSec = (ring == 'I' ? 10 : 20);
182 UShort_t sector = board*nSec;
183 Set(det,ring,sector,0,min,max);
192 //____________________________________________________________________