]>
Commit | Line | Data |
---|---|---|
8f6ee336 | 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 | **************************************************************************/ | |
8f6ee336 | 15 | /* $Id$ */ |
c2fc1258 | 16 | /** @file AliFMDCalibSampleRate.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 | */ | |
8f6ee336 | 21 | //____________________________________________________________________ |
22 | // | |
02a27b50 | 23 | // This class stores the sample rate (that is, how many times the |
24 | // ATLRO's sample each VA1 channel). In principle these can be | |
25 | // controlled per half ring, but in real life it's most likely that | |
26 | // this value will be the same for all detectors. This value must be | |
27 | // retrived from DCS or the like. | |
8f6ee336 | 28 | // |
29 | #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBGAIN_H | |
6169f936 | 30 | // #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H |
f95a63c4 | 31 | // #include <AliLog.h> |
bd727bee | 32 | #include "TString.h" |
f95a63c4 | 33 | #include "AliFMDDebug.h" // Better debug macros |
8f6ee336 | 34 | |
35 | //____________________________________________________________________ | |
36 | ClassImp(AliFMDCalibSampleRate) | |
37 | #if 0 | |
38 | ; // This is here to keep Emacs for indenting the next line | |
39 | #endif | |
40 | ||
41 | //____________________________________________________________________ | |
42 | AliFMDCalibSampleRate::AliFMDCalibSampleRate() | |
c2fc1258 | 43 | : fRates(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1) |
44 | // fRates(3) | |
8f6ee336 | 45 | { |
02a27b50 | 46 | // CTOR |
c2fc1258 | 47 | fRates.Reset(1); |
8f6ee336 | 48 | } |
49 | ||
50 | //____________________________________________________________________ | |
51 | AliFMDCalibSampleRate::AliFMDCalibSampleRate(const AliFMDCalibSampleRate& o) | |
52 | : TObject(o), fRates(o.fRates) | |
02a27b50 | 53 | { |
54 | // Copy ctor | |
55 | } | |
8f6ee336 | 56 | |
57 | //____________________________________________________________________ | |
58 | AliFMDCalibSampleRate& | |
59 | AliFMDCalibSampleRate::operator=(const AliFMDCalibSampleRate& o) | |
60 | { | |
02a27b50 | 61 | // Assignment operator |
8f6ee336 | 62 | fRates = o.fRates; |
63 | return (*this); | |
64 | } | |
65 | ||
66 | //____________________________________________________________________ | |
67 | void | |
c2fc1258 | 68 | AliFMDCalibSampleRate::Set(UShort_t det, Char_t ring, |
69 | UShort_t sector, UShort_t, UShort_t rate) | |
8f6ee336 | 70 | { |
02a27b50 | 71 | // Set values. Strip argument is ignored |
c2fc1258 | 72 | UInt_t nSec = (ring == 'I' ? 20 : 40); |
73 | UInt_t board = sector / nSec; | |
74 | fRates(det, ring, board, 0) = rate; | |
8f6ee336 | 75 | } |
76 | ||
77 | //____________________________________________________________________ | |
78 | UShort_t | |
c2fc1258 | 79 | AliFMDCalibSampleRate::Rate(UShort_t det, Char_t ring, |
80 | UShort_t sec, UShort_t) const | |
8f6ee336 | 81 | { |
02a27b50 | 82 | // Get the sample rate |
c2fc1258 | 83 | UInt_t nSec = (ring == 'I' ? 20 : 40); |
84 | UInt_t board = sec / nSec; | |
f95a63c4 | 85 | AliFMDDebug(10, ("Getting sample rate for FMD%d%c[%2d,0] (board %d)", |
c2fc1258 | 86 | det, ring, sec, board)); |
87 | return fRates(det, ring, board, 0); | |
8f6ee336 | 88 | } |
bd727bee | 89 | //____________________________________________________________________ |
90 | void | |
91 | AliFMDCalibSampleRate::WriteToFile(ofstream &outFile) | |
92 | { | |
93 | outFile.write("# SampleRate \n",14); | |
94 | for(Int_t det=1;det<=3;det++) { | |
95 | UShort_t FirstRing = (det == 1 ? 1 : 0); | |
96 | for (UShort_t ir = FirstRing; ir < 2; ir++) { | |
97 | Char_t ring = (ir == 0 ? 'O' : 'I'); | |
98 | UShort_t nsec = (ir == 0 ? 40 : 20); | |
99 | UShort_t nstr = (ir == 0 ? 256 : 512); | |
100 | for(UShort_t sec =0; sec < nsec; sec++) { | |
101 | outFile << det << ',' | |
102 | << ring << ',' | |
103 | << sec << ',' | |
104 | << Rate(det,ring,sec) << "\n"; | |
105 | ||
106 | ||
107 | } | |
108 | } | |
109 | } | |
110 | ||
111 | ||
112 | } | |
113 | //____________________________________________________________________ | |
114 | void | |
115 | AliFMDCalibSampleRate::ReadFromFile(ifstream &inFile) | |
116 | { | |
117 | TString line; | |
118 | Bool_t readData=kFALSE; | |
119 | ||
120 | while(line.ReadLine(inFile)) { | |
121 | if(line.Contains("samplerate",TString::kIgnoreCase)) { | |
122 | readData = kTRUE; | |
123 | break; | |
124 | } | |
125 | ||
126 | } | |
127 | ||
128 | UShort_t det, sec; | |
129 | Char_t ring; | |
130 | UShort_t sampleRate; | |
131 | Int_t thisline = inFile.tellg(); | |
132 | Char_t c[3]; | |
133 | ||
134 | while(line.ReadLine(inFile) && readData ) { | |
135 | thisline = inFile.tellg(); | |
136 | thisline = thisline--; | |
137 | if(line.Contains("# ",TString::kIgnoreCase)) { | |
138 | readData = kFALSE; | |
139 | continue; | |
140 | } | |
141 | ||
142 | inFile.seekg(thisline); | |
143 | inFile >> det >> c[0] | |
144 | >> ring >> c[1] | |
145 | >> sec >> c[2] | |
146 | >> sampleRate; | |
147 | ||
148 | Set(det,ring,sec,0,sampleRate); | |
149 | ||
150 | } | |
151 | ||
152 | inFile.seekg(0); | |
153 | ||
154 | ||
155 | } | |
8f6ee336 | 156 | |
157 | //____________________________________________________________________ | |
158 | // | |
159 | // EOF | |
160 | // |