]>
Commit | Line | Data |
---|---|---|
33bf7658 | 1 | #ifndef __CINT__ |
2 | # include "AliFMDParameters.h" | |
3 | # include "AliFMDCorrNoiseGain.h" | |
4 | # include "AliForwardCorrectionManager.h" | |
5 | # include "AliForwardUtil.h" | |
6 | # include "AliCDBManager.h" | |
7 | # include "AliCDBEntry.h" | |
8 | # include "AliCDBStorage.h" | |
9 | # include "AliGRPObject.h" | |
10 | # include "AliMagF.h" | |
11 | # include "AliLog.h" | |
12 | # include <TSystem.h> | |
13 | # include <TROOT.h> | |
14 | # include <TError.h> | |
15 | # include <TString.h> | |
16 | #endif | |
17 | ||
18 | /** | |
19 | * Do one one | |
20 | * | |
21 | * @param runNo Run number | |
22 | * @param which Which one to do | |
23 | */ | |
24 | void | |
25 | ExtractForRun(Int_t runNo) | |
26 | { | |
27 | // --- Figure out the year -------------------------------------- | |
28 | UShort_t year = 0; | |
29 | if (runNo <= 99999) year = 2009; | |
30 | else if (runNo <= 139667) year = 2010; | |
31 | else if (runNo <= 170718) year = 2011; | |
32 | else if (runNo <= 194306) year = 2012; | |
33 | else if (runNo <= 197709) year = 2013; | |
34 | if (year <= 0) { | |
35 | Error("", "Couldn't deduce the year from the run number"); | |
36 | return; | |
37 | } | |
38 | ||
39 | // --- Connect to OCDB --------------------------------------------- | |
40 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
41 | cdb->SetRun(runNo); | |
42 | cdb->SetDefaultStorageFromRun(runNo); | |
43 | ||
44 | #if 0 | |
45 | // --- Get the general run parameters ------------------------------ | |
46 | // AliLog::SetModuleDebugLevel("STEER", 3); | |
47 | AliCDBId grpId("GRP/GRP/Data", runNo + 100, runNo - 100); | |
48 | AliCDBEntry* grpE = cdb->GetDefaultStorage()->GetEntry(grpId); | |
49 | if (!grpE) { | |
50 | Warning("ExtractForRun", "No GRP entry found for run %d", runNo); | |
51 | return; | |
52 | } | |
53 | AliGRPObject* grp = static_cast<AliGRPObject*>(grpE->GetObject()); | |
54 | if (!grp) { | |
55 | Warning("ExtractForRun", "No GRP object found for run %d", runNo); | |
56 | return; | |
57 | } | |
58 | Float_t beamE = grp->GetBeamEnergy(); | |
59 | TString beamT = grp->GetBeamType(); | |
60 | #if 0 | |
61 | // This isn't really needed as the acceptance map is indifferent to | |
62 | // the field settings. | |
63 | Float_t l3cur = grp->GetL3Current(AliGRPObject::kMean); | |
64 | Char_t l3pol = grp->GetL3Polarity(); | |
65 | Bool_t l3lhc = grp->IsPolarityConventionLHC(); | |
66 | Bool_t l3uni = grp->IsUniformBMap(); | |
67 | AliMagF* fldM = | |
68 | AliMagF::CreateFieldMap(TMath::Abs(l3cur) * (l3pol ? -1:1), 0, | |
69 | (l3lhc ? 0 : 1), l3uni, beamE, beamT.Data()); | |
70 | Float_t l3fld = fldM->SolenoidField(); | |
71 | #endif | |
72 | Printf("=== From GRP: Beam: E=%f T=%s", beamE, beamT.Data()); | |
73 | if (beamE > 14000) beamE = 450; | |
74 | if (beamT.IsNull()) beamT = "pp"; | |
75 | ||
76 | UShort_t sys = AliForwardUtil::ParseCollisionSystem(beamT); | |
77 | UShort_t sNN = AliForwardUtil::ParseCenterOfMassEnergy(sys, 2 * beamE); | |
78 | Short_t fld = +999; // AliForwardUtil::ParseMagneticField(l3fld); | |
79 | Printf("=== Run=%d, year=%d, sys=%d, sNN=%d, fld=%d", | |
80 | runNo, year, sys, sNN, fld); | |
81 | #endif | |
82 | UShort_t sys = +999; | |
83 | UShort_t sNN = +999; | |
84 | Short_t fld = +999; | |
85 | ||
86 | // --- Get our parameters ------------------------------------------ | |
87 | AliFMDParameters* param = AliFMDParameters::Instance(); | |
88 | param->Init(true, AliFMDParameters::kPulseGain|AliFMDParameters::kPedestal); | |
89 | ||
90 | // --- Get the object to store ------------------------------------- | |
91 | AliFMDCorrNoiseGain* ret = new AliFMDCorrNoiseGain(); | |
92 | Float_t konst = param->GetDACPerMIP(); | |
93 | ||
94 | // --- Loop over all strips ---------------------------------------- | |
95 | for (UShort_t d = 1; d <= 3; d++) { | |
96 | UShort_t nQ = (d == 1 ? 1 : 2); | |
97 | for (UShort_t q = 0; q < nQ; q++) { | |
98 | Char_t r = (q == 0 ? 'I' : 'O'); | |
99 | UShort_t nS = (q == 0 ? 20 : 40); | |
100 | UShort_t nT = (q == 0 ? 512 : 256); | |
101 | for (UShort_t s = 0; s < nS; s++) { | |
102 | for (UShort_t t = 0; t < nT; t++) { | |
103 | Float_t noise = param->GetPedestalWidth(d,r,s,t); | |
104 | Float_t gain = param->GetPulseGain(d,r,s,t); | |
105 | Float_t corr = 0; | |
106 | if (noise > .5 && gain > .5) corr = noise / (gain * konst); | |
107 | if (corr > 1 || corr < 0) { | |
108 | Warning("", "FMD%d%c[%2d,%3d] corr= %f (=%f/(%f*%f))", | |
109 | d, r, s, t, corr, noise, gain, konst); | |
110 | corr = 0; | |
111 | } | |
112 | ret->Set(d,r,s,t,corr); | |
113 | } | |
114 | } | |
115 | } | |
116 | } | |
117 | ||
118 | // --- Write to a file --------------------------------------------- | |
119 | Printf("=== Writing to disk"); | |
120 | AliForwardCorrectionManager& cm = AliForwardCorrectionManager::Instance(); | |
121 | if (!cm.Store(ret, runNo, sys, sNN, fld, false, false, | |
122 | "fmd_corrections.root", "OLDER")) { | |
123 | Error("", "Failed to store acceptance correction in local file"); | |
124 | return; | |
125 | } | |
126 | ||
127 | } | |
128 | ||
129 | void ExtractAll() { | |
130 | // We need to get a list of runs. We should make an entry for every | |
131 | // pedestal and gain run. | |
132 | // | |
133 | // for y in `seq 2009 2013` ; do \ | |
134 | // for c in PulseGain Pedestal ; do \ | |
135 | // alien_ls /alice/data/${y}/OCDB/FMD/Calib/${c}/ | sed -e 's/Run//' -e 's/_.*//' ; \ | |
136 | // done ; \ | |
137 | // done | sort -u -n | grep -v ^0 | sed 's/\([0-9]*\)/ \1,/' | |
138 | // | |
139 | Int_t runs[] = { | |
140 | // 58360, | |
141 | // 61383, | |
142 | // <-- Start of 2009 | |
143 | 75201, 75238, 75311, 75330, 75383, 75384, 75630, 75631, | |
144 | 77901, 80649, 80650, 80738, 82055, 82301, 85947, 85948, | |
145 | 87560, 87561, 91794, 91795, 92436, 92441, 93271, 93273, | |
146 | 93587, 93588, 93595, 94793, 96747, 96945, 96947, 96949, | |
147 | 96956, 96962, 96963, 97226, 97228, 97593, 97996, 98780, | |
148 | 98782, 98974, 98980, 99033, 99084, 99085, 99414, 99726, | |
149 | 100075, 100273, 100594, 100595, 100868, 100967, 101808, 101809, | |
150 | 102034, 102036, 102043, 102238, 102240, 103639, 103641, 103984, | |
151 | 103989, 104108, 104109, 104167, 104169, 104526, 104529, 104901, | |
152 | 104904, 104914, 105111, 105112, | |
153 | // <-- Start of 2010 | |
154 | 105827, 105834, 105963, 107718, 110372, 110373, 113268, 113331, | |
155 | 113650, 113651, 114594, 114596, 115126, 115127, 115136, 115160, | |
156 | 115171, 115244, 115334, 115355, 115360, 115477, 115480, 115528, | |
157 | 115530, 115538, 115545, 115651, 115660, 116294, 116335, 116438, | |
158 | 116439, 116440, 116613, 116614, 116655, 117255, 117257, 117258, | |
159 | 117395, 117396, 117397, 117398, 117399, 117400, 117401, 117402, | |
160 | 117403, 117404, 117405, 117406, 117407, 117408, 117409, 117411, | |
161 | 117413, 117415, 117416, 117417, 117418, 117420, 117421, 117422, | |
162 | 117423, 117424, 117425, 117426, 117427, 117428, 117429, 117431, | |
163 | 117432, 117433, 117434, 117435, 117437, 117438, 117439, 117441, | |
164 | 117442, 117443, 117444, 117445, 117446, 117447, 117448, 117450, | |
165 | 117452, 117453, 117458, 117459, 117461, 117464, 117471, 117476, | |
166 | 117478, 117483, 117492, 117495, 117496, 117498, 117512, 117524, | |
167 | 117561, 117571, 117588, 117606, 117612, 117616, 117624, 117630, | |
168 | 117648, 117650, 117664, 117677, 117678, 117680, 117681, 117682, | |
169 | 117684, 117687, 117688, 117689, 117690, 117693, 117695, 117698, | |
170 | 117699, 117700, 117701, 117702, 117703, 117704, 117706, 117707, | |
171 | 117708, 117709, 117712, 117714, 117717, 117719, 117720, 117722, | |
172 | 117723, 117724, 117725, 117726, 117728, 117730, 117731, 117733, | |
173 | 117735, 117736, 117737, 117738, 117739, 117741, 117742, 117744, | |
174 | 117745, 117746, 117747, 117763, 117772, 117776, 117779, 117784, | |
175 | 119187, 119200, 120542, 120543, 121526, 121527, 121528, 121532, | |
176 | 121550, 121554, 121557, 121621, 121638, 121651, 121656, 121662, | |
177 | 121667, 121677, 121686, 121691, 121697, 121698, 121700, 121702, | |
178 | 121704, 121706, 121708, 121710, 121712, 121713, 121714, 121715, | |
179 | 121717, 121719, 121722, 121724, 121726, 121728, 121730, 121732, | |
180 | 121734, 121736, 121738, 121740, 121742, 121743, 121963, 121965, | |
181 | 121968, 121970, 121980, 121982, 121983, 121985, 121986, 121987, | |
182 | 121988, 121989, 121990, 121991, 121992, 121993, 121994, 121995, | |
183 | 121996, 121997, 121998, 121999, 122000, 122001, 122002, 122003, | |
184 | 122004, 122005, 122006, 122007, 122008, 122009, 122010, 122011, | |
185 | 122012, 122013, 124437, 124438, 125892, 125894, 125896, 125897, | |
186 | 126043, 126046, 126939, 126940, 128138, 128140, 128511, 128512, | |
187 | 129793, 129796, 129804, 130290, 130291, 131336, 131337, 131383, | |
188 | 131386, 131387, 131389, 131392, 131396, 131397, 131398, 131399, | |
189 | 131400, 132637, 132638, 132789, 132799, 135478, 135479, 136733, | |
190 | 136738, 136740, 138243, 138244, 138935, | |
191 | // <-- Start of 2011 | |
192 | 144429, 144751, 144837, 144856, 145167, 145169, 145170, 146647, | |
193 | 146650, 147281, 147285, 147289, 147299, 147301, 147307, 147318, | |
194 | 149252, 149256, 154053, 154054, 154057, 155422, 155424, 155430, | |
195 | 155933, 155934, 156030, 156032, 156037, 156038, 156201, 156202, | |
196 | 156204, 156207, 156217, 156222, 156778, 156780, 157800, 157801, | |
197 | 157802, 157804, 157805, 157808, 158993, 158994, 165623, 165636, | |
198 | 165637, 166817, 166819, 167219, 167221, 169438, 169443, 169446, | |
199 | 169448, 169449, 169450, 169451, 169484, 169486, | |
200 | // <-- Start of 2012 | |
201 | 172968, 172970, 175768, 175769, 176615, 176616, 176617, 177999, | |
202 | 178000, 178562, 178571, 179962, 179963, 182380, 182381, 183249, | |
203 | 183253, 183594, 183596, 184904, 184911, 184912, 185266, 185267, | |
204 | 185269, 185270, 185873, 186408, 186471, 187021, 187022, 187023, | |
205 | 187259, 187263, 187803, 187804, 188300, 188301, 188851, 188856, | |
206 | 189256, 189257, 191769, 191770, | |
207 | // <-- Start of 2013 | |
208 | 194507, 194522, 194523, 194526, 194589, 194590, 195027, 195030, | |
209 | // <-- End marker | |
210 | -1 }; | |
211 | Int_t* pRun = runs; | |
212 | Int_t skipped = 0; | |
213 | Int_t total = 0; | |
214 | Int_t last = 0; | |
215 | while (*pRun > 0) { | |
216 | Int_t next = *(pRun+1); | |
217 | Int_t dist = next - *pRun; | |
218 | total++; | |
219 | if (next > 0 && dist <= 20) { | |
220 | skipped++; | |
221 | pRun++; | |
222 | continue; | |
223 | } | |
224 | #if 0 | |
225 | if (last > 0) { | |
226 | dist = *pRun - last; | |
227 | Printf("%-6d %s%d,%d,",dist, url,last,*pRun); | |
228 | } | |
229 | #endif | |
230 | last = *pRun; | |
231 | ExtractForRun(last); | |
232 | pRun++; | |
233 | } | |
234 | Info("", "Skipped %d of %d", skipped, total); | |
235 | } | |
236 | // | |
237 | // EOF | |
238 | // |