1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz, 08/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 | //////////////////////////////////////////////////////////////////////////////
|
---|
25 | //
|
---|
26 | // MCalibColorSet
|
---|
27 | //
|
---|
28 | // Sets the color for events depending on the color which was used for
|
---|
29 | // the run. This is a workaround for runs which were taken before the
|
---|
30 | // digital module could deliver the color 'per event'
|
---|
31 | //
|
---|
32 | // Input Containers:
|
---|
33 | // MRawRunHeader
|
---|
34 | //
|
---|
35 | // Output Containers:
|
---|
36 | // MCalibrationPattern
|
---|
37 | //
|
---|
38 | //////////////////////////////////////////////////////////////////////////////
|
---|
39 | #include "MCalibColorSet.h"
|
---|
40 |
|
---|
41 | #include <stdlib.h> // needed for atoi on some platforms
|
---|
42 |
|
---|
43 | #include <TRegexp.h>
|
---|
44 |
|
---|
45 | #include "MLog.h"
|
---|
46 | #include "MLogManip.h"
|
---|
47 |
|
---|
48 | #include "MParList.h"
|
---|
49 |
|
---|
50 | #include "MCalibrationCam.h"
|
---|
51 | #include "MCalibrationPattern.h"
|
---|
52 | #include "MRawRunHeader.h"
|
---|
53 |
|
---|
54 | ClassImp(MCalibColorSet);
|
---|
55 |
|
---|
56 | using namespace std;
|
---|
57 |
|
---|
58 | const Int_t MCalibColorSet::gkIFAEBoxInaugurationRun = 20113;
|
---|
59 | const Int_t MCalibColorSet::gkMCRunLimit = 1000;
|
---|
60 | const UInt_t MCalibColorSet::gkFirstRunWithFinalBits = 45626;
|
---|
61 |
|
---|
62 | // --------------------------------------------------------------------------
|
---|
63 | //
|
---|
64 | // Default constructor. MGeomCamMagic is the default geometry.
|
---|
65 | //
|
---|
66 | MCalibColorSet::MCalibColorSet(const char *name, const char *title)
|
---|
67 | : fPattern(0), fHeader(0), fIsExplicitColor(kFALSE)
|
---|
68 | {
|
---|
69 | fName = name ? name : "MCalibColorSet";
|
---|
70 | fTitle = title ? title : "Task to set workaround missing colors calibration events";
|
---|
71 |
|
---|
72 | Clear();
|
---|
73 | }
|
---|
74 |
|
---|
75 | void MCalibColorSet::Clear(const Option_t *o)
|
---|
76 | {
|
---|
77 |
|
---|
78 | fIsValid = kFALSE;
|
---|
79 |
|
---|
80 | if (fIsExplicitColor)
|
---|
81 | return;
|
---|
82 |
|
---|
83 | fColor = MCalibrationCam::kNONE;
|
---|
84 | fStrength = -1.;
|
---|
85 | }
|
---|
86 |
|
---|
87 |
|
---|
88 | // -----------------------------------------------------------------------------------
|
---|
89 | //
|
---|
90 | // The following container are searched for and execution aborted if not in MParList:
|
---|
91 | // - MCalibrationPattern
|
---|
92 | //
|
---|
93 | Int_t MCalibColorSet::PreProcess(MParList *pList)
|
---|
94 | {
|
---|
95 |
|
---|
96 | fPattern = (MCalibrationPattern*)pList->FindObject("MCalibrationPattern");
|
---|
97 | if (!fPattern)
|
---|
98 | {
|
---|
99 | *fLog << err << "MCalibrationPattern not found... abort." << endl;
|
---|
100 | return kFALSE;
|
---|
101 | }
|
---|
102 |
|
---|
103 | fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
|
---|
104 | if (!fHeader)
|
---|
105 | {
|
---|
106 | *fLog << err << "MRawEvtHeader not found... abort." << endl;
|
---|
107 | return kFALSE;
|
---|
108 | }
|
---|
109 |
|
---|
110 | return kTRUE;
|
---|
111 | }
|
---|
112 |
|
---|
113 | // --------------------------------------------------------------------------
|
---|
114 | //
|
---|
115 | // Check if str contains regexp.
|
---|
116 | // If so or pat to pattern and set color to col.
|
---|
117 | // Otherwise do nothing.
|
---|
118 | //
|
---|
119 | // Normally this function is much to simple (more arguments than lines!)
|
---|
120 | // but in this particular case it is worth to have it to avois chaotic
|
---|
121 | // repitions of the same piece of code for many many times.
|
---|
122 | //
|
---|
123 | void MCalibColorSet::CheckAndSet(const TString &str, const char *regexp, MCalibrationCam::PulserColor_t col, Float_t strength)
|
---|
124 | {
|
---|
125 | if (!str.Contains(TRegexp(regexp)))
|
---|
126 | return;
|
---|
127 |
|
---|
128 | fStrength = strength;
|
---|
129 | fColor = col;
|
---|
130 | }
|
---|
131 |
|
---|
132 | // --------------------------------------------------------------------------
|
---|
133 | //
|
---|
134 | // Search for the following input containers and abort if not existing:
|
---|
135 | // - MRawRunHeader
|
---|
136 | //
|
---|
137 | // If Runnumber < gkIFAEBoxInaugurationRun, set colour pattern: 0
|
---|
138 | //
|
---|
139 | // If Runnumber > gkIFAEBoxInaugurationRun, search for colour in
|
---|
140 | // the project name: Set colour pattern according to the following
|
---|
141 | // convention:
|
---|
142 | // Green: assume slot 1 ( 5 Leds Green)
|
---|
143 | // Blue: assume slot 14 ( 5 Leds Blue )
|
---|
144 | // UV: assume slot 12 ( 5 Leds UV )
|
---|
145 | // CT1: take 'slot 17'
|
---|
146 | //
|
---|
147 | Bool_t MCalibColorSet::ReInit(MParList *pList)
|
---|
148 | {
|
---|
149 |
|
---|
150 | Clear();
|
---|
151 |
|
---|
152 | MRawRunHeader *header = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
---|
153 | if (!header)
|
---|
154 | {
|
---|
155 | *fLog << err << "MRawRunHeader not found... abort." << endl;
|
---|
156 | return kFALSE;
|
---|
157 | }
|
---|
158 |
|
---|
159 | if (header->IsMonteCarloRun())
|
---|
160 | return kTRUE;
|
---|
161 |
|
---|
162 | if (header->GetRunNumber() > gkFirstRunWithFinalBits)
|
---|
163 | return kTRUE;
|
---|
164 |
|
---|
165 | //
|
---|
166 | // Consider the case that a pedestal run is interleaved in the calibration run sequence ... prepare
|
---|
167 | // to skip this run.
|
---|
168 | //
|
---|
169 | if (header->GetRunType() == MRawRunHeader::kRTPedestal)
|
---|
170 | {
|
---|
171 | *fLog << warn << "New run is a pedestal run... need intensity calibration to treat this case!" << endl;
|
---|
172 | fColor = MCalibrationCam::kNONE;
|
---|
173 | fIsValid = kTRUE;
|
---|
174 | return kTRUE;
|
---|
175 | }
|
---|
176 |
|
---|
177 | if (fIsExplicitColor)
|
---|
178 | {
|
---|
179 | fIsValid = kTRUE;
|
---|
180 | return kTRUE;
|
---|
181 | }
|
---|
182 |
|
---|
183 | const Int_t num = header->GetRunNumber();
|
---|
184 |
|
---|
185 | if (num<gkIFAEBoxInaugurationRun)
|
---|
186 | {
|
---|
187 | *fLog << inf << "Run taken before inauguration of IFAE-box... using CT1 pulser." << endl;
|
---|
188 | fColor = MCalibrationCam::kCT1;
|
---|
189 | fStrength = 10.;
|
---|
190 | fIsValid = kTRUE;
|
---|
191 | return kTRUE;
|
---|
192 | }
|
---|
193 |
|
---|
194 | fColor = MCalibrationCam::kNONE;
|
---|
195 | fStrength = 0.;
|
---|
196 |
|
---|
197 | switch (num)
|
---|
198 | {
|
---|
199 | case 22246:
|
---|
200 | case 22253:
|
---|
201 | case 25792:
|
---|
202 | case 26402:
|
---|
203 | case 34814:
|
---|
204 | case 35415:
|
---|
205 | case 44768:
|
---|
206 | case 44976:
|
---|
207 | case 45082:
|
---|
208 | case 45083:
|
---|
209 | case 45089:
|
---|
210 | case 45090:
|
---|
211 | case 45091:
|
---|
212 | case 45094:
|
---|
213 | case 45119:
|
---|
214 | case 45249:
|
---|
215 | case 45253:
|
---|
216 | case 45262:
|
---|
217 | case 45274:
|
---|
218 | case 45275:
|
---|
219 | case 45276:
|
---|
220 | case 45365:
|
---|
221 | case 45366:
|
---|
222 | case 45367:
|
---|
223 | case 45368:
|
---|
224 | case 45369:
|
---|
225 | case 45370:
|
---|
226 | case 45371:
|
---|
227 | case 45382:
|
---|
228 | case 45401:
|
---|
229 | case 45419:
|
---|
230 | case 45432:
|
---|
231 | case 45471:
|
---|
232 | case 45485:
|
---|
233 | case 45489:
|
---|
234 | case 45490:
|
---|
235 | case 45494:
|
---|
236 | case 45503:
|
---|
237 | case 45526:
|
---|
238 | case 45538:
|
---|
239 | case 45549:
|
---|
240 | case 45557:
|
---|
241 | case 45562:
|
---|
242 | case 45571:
|
---|
243 | case 45579:
|
---|
244 | case 45607:
|
---|
245 | // case 31756:
|
---|
246 | fColor = MCalibrationCam::kBLUE;
|
---|
247 | fStrength = 1.;
|
---|
248 | break;
|
---|
249 |
|
---|
250 | case 30090:
|
---|
251 | case 31745:
|
---|
252 | case 31746:
|
---|
253 | case 31747:
|
---|
254 | case 31748:
|
---|
255 | case 34815:
|
---|
256 | case 20660:
|
---|
257 | case 20661:
|
---|
258 | case 26408:
|
---|
259 | case 26409:
|
---|
260 | case 26412:
|
---|
261 | case 26568:
|
---|
262 | case 26924:
|
---|
263 | case 45051:
|
---|
264 | case 45084:
|
---|
265 | case 45085:
|
---|
266 | case 45092:
|
---|
267 | case 45227:
|
---|
268 | case 45241:
|
---|
269 | case 45250:
|
---|
270 | case 45254:
|
---|
271 | case 45263:
|
---|
272 | case 45372:
|
---|
273 | case 45373:
|
---|
274 | case 45608:
|
---|
275 | fColor = MCalibrationCam::kGREEN;
|
---|
276 | fStrength = 5.;
|
---|
277 | break;
|
---|
278 |
|
---|
279 | case 45086:
|
---|
280 | case 45088:
|
---|
281 | case 45111:
|
---|
282 | case 45115:
|
---|
283 | case 45216:
|
---|
284 | case 45218:
|
---|
285 | case 45226:
|
---|
286 | case 45240:
|
---|
287 | case 45251:
|
---|
288 | case 45278:
|
---|
289 | case 45336:
|
---|
290 | case 45341:
|
---|
291 | case 45358:
|
---|
292 | case 45374:
|
---|
293 | case 45375:
|
---|
294 | case 45376:
|
---|
295 | case 45377:
|
---|
296 | case 45381:
|
---|
297 | case 45400:
|
---|
298 | case 45418:
|
---|
299 | case 45431:
|
---|
300 | case 45470:
|
---|
301 | case 45484:
|
---|
302 | case 45493:
|
---|
303 | case 45502:
|
---|
304 | case 45525:
|
---|
305 | case 45537:
|
---|
306 | case 45548:
|
---|
307 | case 45556:
|
---|
308 | case 45561:
|
---|
309 | case 45570:
|
---|
310 | case 45578:
|
---|
311 | case 45614:
|
---|
312 | case 45618:
|
---|
313 | fColor = MCalibrationCam::kUV;
|
---|
314 | fStrength = 10.;
|
---|
315 | break;
|
---|
316 |
|
---|
317 | case 43914:
|
---|
318 | case 43916:
|
---|
319 | case 43918:
|
---|
320 | case 43920:
|
---|
321 | case 43922:
|
---|
322 | fColor = MCalibrationCam::kCT1;
|
---|
323 | fStrength = 20.;
|
---|
324 | break;
|
---|
325 |
|
---|
326 | case 27474:
|
---|
327 | *fLog << err << "Sorry, run 27474 was taken with CLOSED LIDS. It should not be used! " << endl;
|
---|
328 | return kFALSE;
|
---|
329 | break;
|
---|
330 |
|
---|
331 | case 40493:
|
---|
332 | case 45116:
|
---|
333 | case 45609:
|
---|
334 | case 45219:
|
---|
335 | *fLog << err << dec << "Sorry, run " << num
|
---|
336 | << " was taken with a combination of colours used to flat-field ";
|
---|
337 | *fLog << err << "the camera. It cannot be used for the standard calibration " << endl;
|
---|
338 | return kFALSE;
|
---|
339 | break;
|
---|
340 |
|
---|
341 | case 45605:
|
---|
342 | *fLog << err << "Sorry, run 45605 was taken with the continuous light source." << endl;
|
---|
343 | *fLog << err << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl;
|
---|
344 | return kFALSE;
|
---|
345 | break;
|
---|
346 |
|
---|
347 | case 45606:
|
---|
348 | *fLog << err << "Sorry, run 45606 was taken with mal-functionning pulser." << endl;
|
---|
349 | *fLog << err << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl;
|
---|
350 | return kFALSE;
|
---|
351 | break;
|
---|
352 |
|
---|
353 | }
|
---|
354 |
|
---|
355 | if (fColor != MCalibrationCam::kNONE)
|
---|
356 | {
|
---|
357 | *fLog << inf << "Color determined from the run-number... ";
|
---|
358 | switch (fColor)
|
---|
359 | {
|
---|
360 | case MCalibrationCam::kGREEN: *fLog << "Green."; break;
|
---|
361 | case MCalibrationCam::kBLUE: *fLog << "Blue."; break;
|
---|
362 | case MCalibrationCam::kUV: *fLog << "UV."; break;
|
---|
363 | case MCalibrationCam::kCT1: *fLog << "CT1."; break;
|
---|
364 | default: break;
|
---|
365 | }
|
---|
366 | *fLog << endl;
|
---|
367 | fIsValid = kTRUE;
|
---|
368 | return kTRUE;
|
---|
369 | }
|
---|
370 |
|
---|
371 | TString proj = header->GetProjectName();
|
---|
372 | proj.ToLower();
|
---|
373 |
|
---|
374 | // Possible green combinations
|
---|
375 | CheckAndSet(proj, "0.1led[s]?gree", MCalibrationCam::kGREEN, 0.1);
|
---|
376 | CheckAndSet(proj, "1led[s]?gree", MCalibrationCam::kGREEN, 1. );
|
---|
377 | CheckAndSet(proj, "2led[s]?gree", MCalibrationCam::kGREEN, 2. );
|
---|
378 | CheckAndSet(proj, "3led[s]?gree", MCalibrationCam::kGREEN, 3. );
|
---|
379 | CheckAndSet(proj, "5led[s]?gree", MCalibrationCam::kGREEN, 5. );
|
---|
380 | CheckAndSet(proj, "6led[s]?gree", MCalibrationCam::kGREEN, 6. );
|
---|
381 | CheckAndSet(proj, "7led[s]?gree", MCalibrationCam::kGREEN, 7. );
|
---|
382 | CheckAndSet(proj, "8led[s]?gree", MCalibrationCam::kGREEN, 8. );
|
---|
383 |
|
---|
384 | // Possible blue combinations
|
---|
385 | CheckAndSet(proj, "0.1led[s]?blue", MCalibrationCam::kBLUE, 0.1);
|
---|
386 | CheckAndSet(proj, "1led[s]?blue", MCalibrationCam::kBLUE, 1.);
|
---|
387 | CheckAndSet(proj, "2led[s]?blue", MCalibrationCam::kBLUE, 2.);
|
---|
388 | CheckAndSet(proj, "3led[s]?blue", MCalibrationCam::kBLUE, 3.);
|
---|
389 | CheckAndSet(proj, "5led[s]?blue", MCalibrationCam::kBLUE, 5.);
|
---|
390 | CheckAndSet(proj, "6led[s]?blue", MCalibrationCam::kBLUE, 6.);
|
---|
391 | CheckAndSet(proj, "7led[s]?blue", MCalibrationCam::kBLUE, 7.);
|
---|
392 | CheckAndSet(proj, "8led[s]?blue", MCalibrationCam::kBLUE, 8.);
|
---|
393 | CheckAndSet(proj, "10led[s]?blue", MCalibrationCam::kBLUE, 10.);
|
---|
394 | CheckAndSet(proj, "15led[s]?blue", MCalibrationCam::kBLUE, 15.);
|
---|
395 | CheckAndSet(proj, "20led[s]?blue", MCalibrationCam::kBLUE, 20.);
|
---|
396 | CheckAndSet(proj, "21led[s]?blue", MCalibrationCam::kBLUE, 21.);
|
---|
397 | CheckAndSet(proj, "22led[s]?blue", MCalibrationCam::kBLUE, 22.);
|
---|
398 | CheckAndSet(proj, "23led[s]?blue", MCalibrationCam::kBLUE, 23.);
|
---|
399 |
|
---|
400 | // Possible UV combinations
|
---|
401 | CheckAndSet(proj, "1led[s]?uv", MCalibrationCam::kUV, 1.);
|
---|
402 | CheckAndSet(proj, "2led[s]?uv", MCalibrationCam::kUV, 2.);
|
---|
403 | CheckAndSet(proj, "3led[s]?uv", MCalibrationCam::kUV, 3.);
|
---|
404 | CheckAndSet(proj, "5led[s]?uv", MCalibrationCam::kUV, 5.);
|
---|
405 | CheckAndSet(proj, "6led[s]?uv", MCalibrationCam::kUV, 6.);
|
---|
406 | CheckAndSet(proj, "7led[s]?uv", MCalibrationCam::kUV, 7.);
|
---|
407 | CheckAndSet(proj, "8led[s]?uv", MCalibrationCam::kUV, 8.);
|
---|
408 | CheckAndSet(proj, "10led[s]?uv", MCalibrationCam::kUV, 10.);
|
---|
409 | CheckAndSet(proj, "11led[s]?uv", MCalibrationCam::kUV, 11.);
|
---|
410 | CheckAndSet(proj, "12led[s]?uv", MCalibrationCam::kUV, 12.);
|
---|
411 | CheckAndSet(proj, "13led[s]?uv", MCalibrationCam::kUV, 13.);
|
---|
412 |
|
---|
413 | // Possible slot combinations
|
---|
414 | TRegexp slot("slot");
|
---|
415 | if (proj.Contains(slot))
|
---|
416 | {
|
---|
417 | proj.ReplaceAll("slot","");
|
---|
418 | UInt_t nr = 0;
|
---|
419 | TRegexp slotnr("^[0-9]");
|
---|
420 |
|
---|
421 | if (proj.Contains(slotnr))
|
---|
422 | {
|
---|
423 | proj.Replace(2,99,"");
|
---|
424 | proj.ReplaceAll("u","");
|
---|
425 | proj.ReplaceAll("v","");
|
---|
426 | proj.ReplaceAll("g","");
|
---|
427 | nr = atoi(proj.Data())-1;
|
---|
428 |
|
---|
429 | fColor = nr < 2 ? MCalibrationCam::kGREEN :
|
---|
430 | ( nr < 3 ) ? MCalibrationCam::kBLUE :
|
---|
431 | ( nr < 5 ) ? MCalibrationCam::kUV :
|
---|
432 | ( nr < 11 ) ? MCalibrationCam::kBLUE :
|
---|
433 | ( nr < 13 ) ? MCalibrationCam::kUV :
|
---|
434 | ( nr < 14 ) ? MCalibrationCam::kBLUE :
|
---|
435 | ( nr < 16 ) ? MCalibrationCam::kGREEN :
|
---|
436 | MCalibrationCam::kCT1;
|
---|
437 |
|
---|
438 | switch (nr)
|
---|
439 | {
|
---|
440 | case 0:
|
---|
441 | fStrength = 5;
|
---|
442 | break;
|
---|
443 | case 1:
|
---|
444 | fStrength = 2.;
|
---|
445 | break;
|
---|
446 | case 2:
|
---|
447 | fStrength = 5.1;
|
---|
448 | break;
|
---|
449 | case 3:
|
---|
450 | fStrength = 1.;
|
---|
451 | break;
|
---|
452 | case 4:
|
---|
453 | fStrength = 2.;
|
---|
454 | break;
|
---|
455 | case 5:
|
---|
456 | fStrength = 5.2;
|
---|
457 | break;
|
---|
458 | case 6:
|
---|
459 | fStrength = 5.4;
|
---|
460 | break;
|
---|
461 | case 7:
|
---|
462 | fStrength = 2.;
|
---|
463 | break;
|
---|
464 | case 8:
|
---|
465 | fStrength = 0.2;
|
---|
466 | break;
|
---|
467 | case 9:
|
---|
468 | fStrength = 0.;
|
---|
469 | break;
|
---|
470 | case 10:
|
---|
471 | fStrength = 1.;
|
---|
472 | break;
|
---|
473 | case 11:
|
---|
474 | fStrength = 5.8;
|
---|
475 | break;
|
---|
476 | case 12:
|
---|
477 | fStrength = 5.1;
|
---|
478 | break;
|
---|
479 | case 13:
|
---|
480 | fStrength = 5.2;
|
---|
481 | break;
|
---|
482 | case 14:
|
---|
483 | fStrength = 1;
|
---|
484 | break;
|
---|
485 | case 15:
|
---|
486 | fStrength = 0.2;
|
---|
487 | break;
|
---|
488 | }
|
---|
489 | }
|
---|
490 | }
|
---|
491 |
|
---|
492 | if (fColor == MCalibrationCam::kNONE)
|
---|
493 | {
|
---|
494 | CheckAndSet(proj, "gree", MCalibrationCam::kGREEN, 1.);
|
---|
495 | CheckAndSet(proj, "blue", MCalibrationCam::kBLUE, 1.);
|
---|
496 | CheckAndSet(proj, "uv", MCalibrationCam::kUV, 1.);
|
---|
497 | CheckAndSet(proj, "ct1", MCalibrationCam::kCT1, 1.);
|
---|
498 |
|
---|
499 | if (fColor != MCalibrationCam::kNONE)
|
---|
500 | *fLog << inf << "Color determined from project-name (" << proj << ")... ";
|
---|
501 | else
|
---|
502 | if (proj.Contains("cl",TString::kIgnoreCase))
|
---|
503 | {
|
---|
504 | *fLog << err;
|
---|
505 | *fLog << "This run has been taken with the continuous light source." << endl;
|
---|
506 | *fLog << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl;
|
---|
507 | return kFALSE;
|
---|
508 | }
|
---|
509 | }
|
---|
510 | else
|
---|
511 | *fLog << inf << "Color and Intensity determined from project-name (" << proj << ")... ";
|
---|
512 |
|
---|
513 | if (fColor == MCalibrationCam::kNONE)
|
---|
514 | {
|
---|
515 | *fLog << err;
|
---|
516 | *fLog << "Sorry, calibration run " << num << " was taken before the events could be" << endl;
|
---|
517 | *fLog << "flagged with a color by the digital modul and no color" << endl;
|
---|
518 | *fLog << "could be determined... abort." << endl;
|
---|
519 | return kFALSE;
|
---|
520 | }
|
---|
521 |
|
---|
522 | switch (fColor)
|
---|
523 | {
|
---|
524 | case MCalibrationCam::kGREEN: *fLog << "Green."; break;
|
---|
525 | case MCalibrationCam::kBLUE: *fLog << "Blue."; break;
|
---|
526 | case MCalibrationCam::kUV: *fLog << "UV."; break;
|
---|
527 | case MCalibrationCam::kCT1: *fLog << "CT1."; break;
|
---|
528 | default: break;
|
---|
529 | }
|
---|
530 | *fLog << endl;
|
---|
531 |
|
---|
532 | fIsValid = kTRUE;
|
---|
533 |
|
---|
534 | return kTRUE;
|
---|
535 | }
|
---|
536 |
|
---|
537 | // --------------------------------------------------------------------------
|
---|
538 | //
|
---|
539 | // Sets the pattern to MCalibrationPattern from outside, if fIsValid is set.
|
---|
540 | //
|
---|
541 | Int_t MCalibColorSet::Process()
|
---|
542 | {
|
---|
543 |
|
---|
544 | if (fIsValid)
|
---|
545 | {
|
---|
546 | if (fColor == MCalibrationCam::kNONE)
|
---|
547 | return kCONTINUE;
|
---|
548 |
|
---|
549 | fPattern->SetPulserColor(fColor);
|
---|
550 | fPattern->SetPulserStrength(fStrength);
|
---|
551 | }
|
---|
552 |
|
---|
553 | return kTRUE;
|
---|
554 | }
|
---|
555 |
|
---|
556 | Int_t MCalibColorSet::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
---|
557 | {
|
---|
558 |
|
---|
559 | Bool_t rc = kFALSE;
|
---|
560 |
|
---|
561 | if (IsEnvDefined(env, prefix, "ExplicitColor", print))
|
---|
562 | {
|
---|
563 | TString dat = GetEnvValue(env, prefix, "ExplicitColor", "");
|
---|
564 | if (dat.BeginsWith("green", TString::kIgnoreCase))
|
---|
565 | SetExplicitColor(MCalibrationCam::kGREEN);
|
---|
566 | if (dat.BeginsWith("blue", TString::kIgnoreCase))
|
---|
567 | SetExplicitColor(MCalibrationCam::kBLUE);
|
---|
568 | if (dat.BeginsWith("uv", TString::kIgnoreCase))
|
---|
569 | SetExplicitColor(MCalibrationCam::kUV);
|
---|
570 | if (dat.BeginsWith("ct1", TString::kIgnoreCase))
|
---|
571 | SetExplicitColor(MCalibrationCam::kCT1);
|
---|
572 | rc = kTRUE;
|
---|
573 | }
|
---|
574 |
|
---|
575 | return rc;
|
---|
576 | }
|
---|
577 |
|
---|