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 45490:
|
---|
303 | case 45493:
|
---|
304 | case 45502:
|
---|
305 | case 45525:
|
---|
306 | case 45537:
|
---|
307 | case 45548:
|
---|
308 | case 45556:
|
---|
309 | case 45561:
|
---|
310 | case 45570:
|
---|
311 | case 45578:
|
---|
312 | case 45614:
|
---|
313 | case 45618:
|
---|
314 | fColor = MCalibrationCam::kUV;
|
---|
315 | fStrength = 10.;
|
---|
316 | break;
|
---|
317 |
|
---|
318 | case 43914:
|
---|
319 | case 43916:
|
---|
320 | case 43918:
|
---|
321 | case 43920:
|
---|
322 | case 43922:
|
---|
323 | fColor = MCalibrationCam::kCT1;
|
---|
324 | fStrength = 20.;
|
---|
325 | break;
|
---|
326 |
|
---|
327 | case 27474:
|
---|
328 | *fLog << err << "Sorry, run 27474 was taken with CLOSED LIDS. It should not be used! " << endl;
|
---|
329 | return kFALSE;
|
---|
330 | break;
|
---|
331 |
|
---|
332 | case 40493:
|
---|
333 | case 45116:
|
---|
334 | case 45609:
|
---|
335 | case 45219:
|
---|
336 | *fLog << err << dec << "Sorry, run " << num
|
---|
337 | << " was taken with a combination of colours used to flat-field ";
|
---|
338 | *fLog << err << "the camera. It cannot be used for the standard calibration " << endl;
|
---|
339 | return kFALSE;
|
---|
340 | break;
|
---|
341 |
|
---|
342 | case 45605:
|
---|
343 | *fLog << err << "Sorry, run 45605 was taken with the continuous light source." << endl;
|
---|
344 | *fLog << err << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl;
|
---|
345 | return kFALSE;
|
---|
346 | break;
|
---|
347 |
|
---|
348 | case 45606:
|
---|
349 | *fLog << err << "Sorry, run 45606 was taken with mal-functionning pulser." << endl;
|
---|
350 | *fLog << err << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl;
|
---|
351 | return kFALSE;
|
---|
352 | break;
|
---|
353 |
|
---|
354 | }
|
---|
355 |
|
---|
356 | if (fColor != MCalibrationCam::kNONE)
|
---|
357 | {
|
---|
358 | *fLog << inf << "Color determined from the run-number... ";
|
---|
359 | switch (fColor)
|
---|
360 | {
|
---|
361 | case MCalibrationCam::kGREEN: *fLog << "Green."; break;
|
---|
362 | case MCalibrationCam::kBLUE: *fLog << "Blue."; break;
|
---|
363 | case MCalibrationCam::kUV: *fLog << "UV."; break;
|
---|
364 | case MCalibrationCam::kCT1: *fLog << "CT1."; break;
|
---|
365 | default: break;
|
---|
366 | }
|
---|
367 | *fLog << endl;
|
---|
368 | fIsValid = kTRUE;
|
---|
369 | return kTRUE;
|
---|
370 | }
|
---|
371 |
|
---|
372 | TString proj = header->GetProjectName();
|
---|
373 | proj.ToLower();
|
---|
374 |
|
---|
375 | // Possible green combinations
|
---|
376 | CheckAndSet(proj, "0.1led[s]?gree", MCalibrationCam::kGREEN, 0.1);
|
---|
377 | CheckAndSet(proj, "1led[s]?gree", MCalibrationCam::kGREEN, 1. );
|
---|
378 | CheckAndSet(proj, "2led[s]?gree", MCalibrationCam::kGREEN, 2. );
|
---|
379 | CheckAndSet(proj, "3led[s]?gree", MCalibrationCam::kGREEN, 3. );
|
---|
380 | CheckAndSet(proj, "5led[s]?gree", MCalibrationCam::kGREEN, 5. );
|
---|
381 | CheckAndSet(proj, "6led[s]?gree", MCalibrationCam::kGREEN, 6. );
|
---|
382 | CheckAndSet(proj, "7led[s]?gree", MCalibrationCam::kGREEN, 7. );
|
---|
383 | CheckAndSet(proj, "8led[s]?gree", MCalibrationCam::kGREEN, 8. );
|
---|
384 |
|
---|
385 | // Possible blue combinations
|
---|
386 | CheckAndSet(proj, "0.1led[s]?blue", MCalibrationCam::kBLUE, 0.1);
|
---|
387 | CheckAndSet(proj, "1led[s]?blue", MCalibrationCam::kBLUE, 1.);
|
---|
388 | CheckAndSet(proj, "2led[s]?blue", MCalibrationCam::kBLUE, 2.);
|
---|
389 | CheckAndSet(proj, "3led[s]?blue", MCalibrationCam::kBLUE, 3.);
|
---|
390 | CheckAndSet(proj, "5led[s]?blue", MCalibrationCam::kBLUE, 5.);
|
---|
391 | CheckAndSet(proj, "6led[s]?blue", MCalibrationCam::kBLUE, 6.);
|
---|
392 | CheckAndSet(proj, "7led[s]?blue", MCalibrationCam::kBLUE, 7.);
|
---|
393 | CheckAndSet(proj, "8led[s]?blue", MCalibrationCam::kBLUE, 8.);
|
---|
394 | CheckAndSet(proj, "10led[s]?blue", MCalibrationCam::kBLUE, 10.);
|
---|
395 | CheckAndSet(proj, "15led[s]?blue", MCalibrationCam::kBLUE, 15.);
|
---|
396 | CheckAndSet(proj, "20led[s]?blue", MCalibrationCam::kBLUE, 20.);
|
---|
397 | CheckAndSet(proj, "21led[s]?blue", MCalibrationCam::kBLUE, 21.);
|
---|
398 | CheckAndSet(proj, "22led[s]?blue", MCalibrationCam::kBLUE, 22.);
|
---|
399 | CheckAndSet(proj, "23led[s]?blue", MCalibrationCam::kBLUE, 23.);
|
---|
400 |
|
---|
401 | // Possible UV combinations
|
---|
402 | CheckAndSet(proj, "1led[s]?uv", MCalibrationCam::kUV, 1.);
|
---|
403 | CheckAndSet(proj, "2led[s]?uv", MCalibrationCam::kUV, 2.);
|
---|
404 | CheckAndSet(proj, "3led[s]?uv", MCalibrationCam::kUV, 3.);
|
---|
405 | CheckAndSet(proj, "5led[s]?uv", MCalibrationCam::kUV, 5.);
|
---|
406 | CheckAndSet(proj, "6led[s]?uv", MCalibrationCam::kUV, 6.);
|
---|
407 | CheckAndSet(proj, "7led[s]?uv", MCalibrationCam::kUV, 7.);
|
---|
408 | CheckAndSet(proj, "8led[s]?uv", MCalibrationCam::kUV, 8.);
|
---|
409 | CheckAndSet(proj, "10led[s]?uv", MCalibrationCam::kUV, 10.);
|
---|
410 | CheckAndSet(proj, "11led[s]?uv", MCalibrationCam::kUV, 11.);
|
---|
411 | CheckAndSet(proj, "12led[s]?uv", MCalibrationCam::kUV, 12.);
|
---|
412 | CheckAndSet(proj, "13led[s]?uv", MCalibrationCam::kUV, 13.);
|
---|
413 |
|
---|
414 | // Possible slot combinations
|
---|
415 | TRegexp slot("slot");
|
---|
416 | if (proj.Contains(slot))
|
---|
417 | {
|
---|
418 | proj.ReplaceAll("slot","");
|
---|
419 | UInt_t nr = 0;
|
---|
420 | TRegexp slotnr("^[0-9]");
|
---|
421 |
|
---|
422 | if (proj.Contains(slotnr))
|
---|
423 | {
|
---|
424 | proj.Replace(2,99,"");
|
---|
425 | proj.ReplaceAll("u","");
|
---|
426 | proj.ReplaceAll("v","");
|
---|
427 | proj.ReplaceAll("g","");
|
---|
428 | nr = atoi(proj.Data())-1;
|
---|
429 |
|
---|
430 | fColor = nr < 2 ? MCalibrationCam::kGREEN :
|
---|
431 | ( nr < 3 ) ? MCalibrationCam::kBLUE :
|
---|
432 | ( nr < 5 ) ? MCalibrationCam::kUV :
|
---|
433 | ( nr < 11 ) ? MCalibrationCam::kBLUE :
|
---|
434 | ( nr < 13 ) ? MCalibrationCam::kUV :
|
---|
435 | ( nr < 14 ) ? MCalibrationCam::kBLUE :
|
---|
436 | ( nr < 16 ) ? MCalibrationCam::kGREEN :
|
---|
437 | MCalibrationCam::kCT1;
|
---|
438 |
|
---|
439 | switch (nr)
|
---|
440 | {
|
---|
441 | case 0:
|
---|
442 | fStrength = 5;
|
---|
443 | break;
|
---|
444 | case 1:
|
---|
445 | fStrength = 2.;
|
---|
446 | break;
|
---|
447 | case 2:
|
---|
448 | fStrength = 5.;
|
---|
449 | break;
|
---|
450 | case 3:
|
---|
451 | fStrength = 1.;
|
---|
452 | break;
|
---|
453 | case 4:
|
---|
454 | fStrength = 2.;
|
---|
455 | break;
|
---|
456 | case 5:
|
---|
457 | fStrength = 5.;
|
---|
458 | break;
|
---|
459 | case 6:
|
---|
460 | fStrength = 5.;
|
---|
461 | break;
|
---|
462 | case 7:
|
---|
463 | fStrength = 2.;
|
---|
464 | break;
|
---|
465 | case 8:
|
---|
466 | fStrength = 0.2;
|
---|
467 | break;
|
---|
468 | case 9:
|
---|
469 | fStrength = 0.;
|
---|
470 | break;
|
---|
471 | case 10:
|
---|
472 | fStrength = 1.;
|
---|
473 | break;
|
---|
474 | case 11:
|
---|
475 | fStrength = 5.;
|
---|
476 | break;
|
---|
477 | case 12:
|
---|
478 | fStrength = 5.;
|
---|
479 | break;
|
---|
480 | case 13:
|
---|
481 | fStrength = 5.;
|
---|
482 | break;
|
---|
483 | case 14:
|
---|
484 | fStrength = 1;
|
---|
485 | break;
|
---|
486 | case 15:
|
---|
487 | fStrength = 0.2;
|
---|
488 | break;
|
---|
489 | }
|
---|
490 | }
|
---|
491 | }
|
---|
492 |
|
---|
493 | if (fColor == MCalibrationCam::kNONE)
|
---|
494 | {
|
---|
495 | CheckAndSet(proj, "gree", MCalibrationCam::kGREEN, 1.);
|
---|
496 | CheckAndSet(proj, "blue", MCalibrationCam::kBLUE, 1.);
|
---|
497 | CheckAndSet(proj, "uv", MCalibrationCam::kUV, 1.);
|
---|
498 | CheckAndSet(proj, "ct1", MCalibrationCam::kCT1, 1.);
|
---|
499 |
|
---|
500 | if (fColor != MCalibrationCam::kNONE)
|
---|
501 | *fLog << inf << "Color determined from project-name (" << proj << ")... ";
|
---|
502 | else
|
---|
503 | if (proj.Contains("cl",TString::kIgnoreCase))
|
---|
504 | {
|
---|
505 | *fLog << err;
|
---|
506 | *fLog << "This run has been taken with the continuous light source." << endl;
|
---|
507 | *fLog << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl;
|
---|
508 | return kFALSE;
|
---|
509 | }
|
---|
510 | }
|
---|
511 | else
|
---|
512 | *fLog << inf << "Color and Intensity determined from project-name (" << proj << ")... ";
|
---|
513 |
|
---|
514 | if (fColor == MCalibrationCam::kNONE)
|
---|
515 | {
|
---|
516 | *fLog << err;
|
---|
517 | *fLog << "Sorry, calibration run " << num << " was taken before the events could be" << endl;
|
---|
518 | *fLog << "flagged with a color by the digital modul and no color" << endl;
|
---|
519 | *fLog << "could be determined... abort." << endl;
|
---|
520 | return kFALSE;
|
---|
521 | }
|
---|
522 |
|
---|
523 | switch (fColor)
|
---|
524 | {
|
---|
525 | case MCalibrationCam::kGREEN: *fLog << "Green."; break;
|
---|
526 | case MCalibrationCam::kBLUE: *fLog << "Blue."; break;
|
---|
527 | case MCalibrationCam::kUV: *fLog << "UV."; break;
|
---|
528 | case MCalibrationCam::kCT1: *fLog << "CT1."; break;
|
---|
529 | default: break;
|
---|
530 | }
|
---|
531 | *fLog << endl;
|
---|
532 |
|
---|
533 | fIsValid = kTRUE;
|
---|
534 |
|
---|
535 | return kTRUE;
|
---|
536 | }
|
---|
537 |
|
---|
538 | // --------------------------------------------------------------------------
|
---|
539 | //
|
---|
540 | // Sets the pattern to MCalibrationPattern from outside, if fIsValid is set.
|
---|
541 | //
|
---|
542 | Int_t MCalibColorSet::Process()
|
---|
543 | {
|
---|
544 |
|
---|
545 | if (fIsValid)
|
---|
546 | {
|
---|
547 | if (fColor == MCalibrationCam::kNONE)
|
---|
548 | return kCONTINUE;
|
---|
549 |
|
---|
550 | fPattern->SetPulserColor(fColor);
|
---|
551 | fPattern->SetPulserStrength(fStrength);
|
---|
552 | }
|
---|
553 |
|
---|
554 | return kTRUE;
|
---|
555 | }
|
---|
556 |
|
---|
557 | Int_t MCalibColorSet::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
---|
558 | {
|
---|
559 |
|
---|
560 | Bool_t rc = kFALSE;
|
---|
561 |
|
---|
562 | if (IsEnvDefined(env, prefix, "ExplicitColor", print))
|
---|
563 | {
|
---|
564 | TString dat = GetEnvValue(env, prefix, "ExplicitColor", "");
|
---|
565 | if (dat.BeginsWith("green", TString::kIgnoreCase))
|
---|
566 | SetExplicitColor(MCalibrationCam::kGREEN);
|
---|
567 | if (dat.BeginsWith("blue", TString::kIgnoreCase))
|
---|
568 | SetExplicitColor(MCalibrationCam::kBLUE);
|
---|
569 | if (dat.BeginsWith("uv", TString::kIgnoreCase))
|
---|
570 | SetExplicitColor(MCalibrationCam::kUV);
|
---|
571 | if (dat.BeginsWith("ct1", TString::kIgnoreCase))
|
---|
572 | SetExplicitColor(MCalibrationCam::kCT1);
|
---|
573 | rc = kTRUE;
|
---|
574 | }
|
---|
575 |
|
---|
576 | return rc;
|
---|
577 | }
|
---|
578 |
|
---|