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.
30 #include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H
32 // #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
34 //____________________________________________________________________
35 ClassImp(AliFMDCalibStripRange)
37 ; // This is here to keep Emacs for indenting the next line
40 //____________________________________________________________________
41 AliFMDCalibStripRange::AliFMDCalibStripRange()
42 : fRanges(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1)
49 //____________________________________________________________________
50 AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o)
51 : TObject(o), fRanges(o.fRanges)
56 //____________________________________________________________________
57 AliFMDCalibStripRange&
58 AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o)
60 // Assignement operator
65 //____________________________________________________________________
67 AliFMDCalibStripRange::Set(UShort_t det, Char_t ring,
68 UShort_t sector, UShort_t, UShort_t min,
71 // Set the min and max for a half-ring
72 UInt_t nSec = (ring == 'I' ? 10 : 20);
73 UInt_t board = sector / nSec;
74 fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f);
77 //____________________________________________________________________
79 AliFMDCalibStripRange::Min(UShort_t det, Char_t ring,
80 UShort_t sec, UShort_t) const
82 // Get the min for a half-ring
83 UInt_t nSec = (ring == 'I' ? 10 : 20);
84 UInt_t board = sec / nSec;
86 return (fRanges(det, ring, board, 0) & 0x7f);
89 //____________________________________________________________________
91 AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
92 UShort_t sec, UShort_t) const
94 // Get the max for a half-ring
95 UInt_t nSec = (ring == 'I' ? 10 : 20);
96 UInt_t board = sec / nSec;
97 return ((fRanges(det, ring, board, 0) >> 8) & 0x7f);
99 //____________________________________________________________________
101 AliFMDCalibStripRange::WriteToFile(std::ostream &outFile, Bool_t* detectors)
103 outFile.write("# StripRange \n",14);
104 for(Int_t det=1;det<=3;det++) {
105 if (detectors && !detectors[det-1]) {
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');
111 for(UShort_t board =0; board < 2; board++) {
112 outFile << det << ','
115 << Min(det,ring,board) << ','
116 << Max(det,ring,board) << "\n";
125 //____________________________________________________________________
127 AliFMDCalibStripRange::ReadFromFile(std::istream &inFile)
130 Bool_t readData=kFALSE;
132 while(line.ReadLine(inFile)) {
133 if(line.Contains("striprange",TString::kIgnoreCase)) {
144 Int_t thisline = inFile.tellg();
148 thisline = inFile.tellg();
149 line.ReadLine(inFile);
151 if(line.Contains("# ",TString::kIgnoreCase)) {
156 inFile.seekg(thisline);
157 inFile >> det >> c[0]
163 UInt_t nSec = (ring == 'I' ? 10 : 20);
164 UShort_t sector = board*nSec;
165 Set(det,ring,sector,0,min,max);
174 //____________________________________________________________________