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"
21 * @param runNo Run number
22 * @param which Which one to do
25 ExtractForRun(Int_t runNo)
27 // --- Figure out the year --------------------------------------
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;
35 Error("", "Couldn't deduce the year from the run number");
39 // --- Connect to OCDB ---------------------------------------------
40 AliCDBManager* cdb = AliCDBManager::Instance();
42 cdb->SetDefaultStorageFromRun(runNo);
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);
50 Warning("ExtractForRun", "No GRP entry found for run %d", runNo);
53 AliGRPObject* grp = static_cast<AliGRPObject*>(grpE->GetObject());
55 Warning("ExtractForRun", "No GRP object found for run %d", runNo);
58 Float_t beamE = grp->GetBeamEnergy();
59 TString beamT = grp->GetBeamType();
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();
68 AliMagF::CreateFieldMap(TMath::Abs(l3cur) * (l3pol ? -1:1), 0,
69 (l3lhc ? 0 : 1), l3uni, beamE, beamT.Data());
70 Float_t l3fld = fldM->SolenoidField();
72 Printf("=== From GRP: Beam: E=%f T=%s", beamE, beamT.Data());
73 if (beamE > 14000) beamE = 450;
74 if (beamT.IsNull()) beamT = "pp";
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);
86 // --- Get our parameters ------------------------------------------
87 AliFMDParameters* param = AliFMDParameters::Instance();
88 param->Init(true, AliFMDParameters::kPulseGain|AliFMDParameters::kPedestal);
90 // --- Get the object to store -------------------------------------
91 AliFMDCorrNoiseGain* ret = new AliFMDCorrNoiseGain();
92 Float_t konst = param->GetDACPerMIP();
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);
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);
112 ret->Set(d,r,s,t,corr);
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");
130 // We need to get a list of runs. We should make an entry for every
131 // pedestal and gain run.
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/_.*//' ; \
137 // done | sort -u -n | grep -v ^0 | sed 's/\([0-9]*\)/ \1,/'
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,
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,
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,
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,
208 194507, 194522, 194523, 194526, 194589, 194590, 195027, 195030,
216 Int_t next = *(pRun+1);
217 Int_t dist = next - *pRun;
219 if (next > 0 && dist <= 20) {
227 Printf("%-6d %s%d,%d,",dist, url,last,*pRun);
234 Info("", "Skipped %d of %d", skipped, total);