source: trunk/Mars/mraw/MRawRunHeader.cc@ 13492

Last change on this file since 13492 was 12945, checked in by tbretz, 13 years ago
Some more improvements to FACT header printing.
File size: 42.5 KB
Line 
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 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2008
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MRawRunHeader
28//
29// Root storage container for the RUN HEADER information
30//
31//
32// RAW DATA FORMAT VERSION
33// =======================
34//
35// Format Version 12:
36// -----------------
37// * fIsSigned
38//
39// Format Version 11:
40// -----------------
41// * all variables got four bytes
42// * header sizes allow to make the format backward compatible
43// + fHeaderSizeRun
44// + fHeaderSizeEvt
45// + fHeaderSizeCrate
46// + fFileNumber
47// + fNumSamplesRemovedHead
48// + fNumSamplesRemovedTail
49//
50// Format Version 10:
51// -----------------
52// ?
53//
54// Format Version 9:
55// -----------------
56// + fNumEventsRead;
57// + fSamplingFrequency
58// - fFreqSampling
59// + fFadcResolution;
60// - fNumSignificantBits
61//
62// Format Version 8:
63// -----------------
64// + fNumBytesPerSample;
65// + fFreqSampling;
66// + fNumSignificantBits
67// * changes in MRawCrateHeader
68//
69// Format Version 7:
70// -----------------
71// - unused
72//
73// Format Version 6:
74// -----------------
75// + added CameraVersion
76// + added TelescopeNumber
77// + added ObservationMode
78// + added dummies for TelescopeRa/Dec
79//
80// Format Version 5:
81// -----------------
82// - now the sub millisecond information of the time is valid and decoded
83// which enhances the precision from 51.2us to 200ns
84//
85// Format Version 4:
86// -----------------
87// - added support for pixels with negative IDs
88//
89// Format Version 3:
90// -----------------
91// - ???
92//
93// Format Version 2:
94// -----------------
95// - removed mjd from data
96// - added start time
97// - added stop time
98//
99//
100// MRawRunHeader CLASS VERSION
101// ===========================
102//
103// Format Version 10:
104// -----------------
105// - added fHeaderSizeRun
106// - added fHeaderSizeEvt
107// - added fHeaderSizeCrate
108// - added fFileNumber
109// - increased fSourceEpochChar
110//
111// Format Version 7:
112// -----------------
113// - added fNumEventsRead;
114// * renamed fFreqSampling to fSamplingFrequency
115// * renamed fNumSignificantBits to fFadcResolution
116//
117// Format Version 6:
118// -----------------
119// - added fNumBytesPerSample;
120// - added fSamplingFrequency;
121// - added fFadcResolution;
122//
123// Class Version 5:
124// -----------------
125// - for compatibility with newer camera versions
126//
127// Class Version 4:
128// -----------------
129// - added fCameraVersion
130// - added fTelescopeNumber
131// - changed length of fProjectName to 101
132// - changed length of fSourceName to 81
133//
134// Class Version 3:
135// ----------------
136// - enhanced SourceName and ProjectName by one character, because
137// without telling us the guranteed trailing \0-character has
138// skipped
139//
140// Class Version 2:
141// ----------------
142// - removed fMJD, fYear, fMonth, fDay
143// - added fRunStart
144// - added fRunStop
145//
146// Class Version 1:
147// ----------------
148// - first implementation
149//
150////////////////////////////////////////////////////////////////////////////
151#include "MRawRunHeader.h"
152
153#include <fstream>
154#include <iomanip>
155
156#include <TArrayC.h>
157
158#include "MLog.h"
159#include "MLogManip.h"
160
161#include "MArrayS.h"
162#include "MString.h"
163
164ClassImp(MRawRunHeader);
165
166using namespace std;
167
168const UShort_t MRawRunHeader::kMagicNumber = 0xc0c0;
169const Byte_t MRawRunHeader::kMaxFormatVersion = 11;
170
171// --------------------------------------------------------------------------
172//
173// Default constructor. Creates array which stores the pixel assignment.
174//
175//
176MRawRunHeader::MRawRunHeader(const char *name, const char *title) : fPixAssignment(NULL)
177{
178 fName = name ? name : "MRawRunHeader";
179 fTitle = title ? title : "Raw Run Header Information";
180
181 fPixAssignment = new MArrayS(0);
182
183 // Remark: If we read old MC data from a root file which do not
184 // yet contain one of these variable, the value given here is
185 // the default. Do not mix files with and without a value if the
186 // files with the value do not match the default!
187 fFormatVersion=11;
188 fSoftVersion=0;
189 fTelescopeNumber=1;
190 fCameraVersion=1;
191 fFadcType=1;
192 fRunType=kRTNone; // use 0xffff for invalidation, 0 means: Data run
193 fRunNumber=0;
194 fFileNumber=0;
195 memset(fProjectName, 0, 101);
196 memset(fSourceName, 0, 81);
197 memset(fObservationMode, 0, 61);
198 fSourceEpochChar[0]=0;
199 fSourceEpochChar[1]=0;
200 fSourceEpochDate=0;
201 fNumCrates=0;
202 fNumPixInCrate=0;
203 fNumSamplesLoGain=0;
204 fNumSamplesHiGain=0;
205 fNumEvents=0;
206 fNumEventsRead=0;
207 fNumBytesPerSample=1;
208 fIsSigned = kFALSE;
209 fSamplingFrequency=300;
210 fFadcResolution=8;
211
212 fHeaderSizeRun=0;
213 fHeaderSizeEvt=0;
214 fHeaderSizeCrate=0;
215}
216
217MRawRunHeader::MRawRunHeader(const MRawRunHeader &h)
218{
219 fMagicNumber=h.fMagicNumber; // File type identifier
220
221 fHeaderSizeRun=h.fHeaderSizeRun; // Size of run header
222 fHeaderSizeEvt=h.fHeaderSizeEvt; // Size of evt header
223 fHeaderSizeCrate=h.fHeaderSizeCrate; // Size of crate header
224
225 fFormatVersion=h.fFormatVersion; // File format version
226 fSoftVersion=h.fSoftVersion; // DAQ software version
227 fFadcType=h.fFadcType; // FADC type (1=Siegen, 2=MUX)
228 fCameraVersion=h.fCameraVersion; // Camera Version (1=MAGIC I)
229 fTelescopeNumber=h.fTelescopeNumber; // Telescope number (1=Magic I)
230 fRunType=h.fRunType; // Run Type
231 fRunNumber=h.fRunNumber; // Run number
232 fFileNumber=h.fFileNumber; // File number
233 memcpy(fProjectName, h.fProjectName, 101); // Project name
234 memcpy(fSourceName, h.fSourceName, 81); // Source name
235 memcpy(fObservationMode, h.fObservationMode, 61); // observation mode
236 memcpy(fSourceEpochChar, h.fSourceEpochChar, 4); // epoch char of the source
237 fSourceEpochDate=h.fSourceEpochDate; // epoch date of the source
238 fNumCrates=h.fNumCrates; // number of electronic boards
239 fNumPixInCrate=h.fNumPixInCrate; // number of pixels in crate
240 fNumSamplesLoGain=h.fNumSamplesLoGain; // number of logain samples stored
241 fNumSamplesHiGain=h.fNumSamplesHiGain; // number of higain samples stored
242 fNumBytesPerSample=h.fNumBytesPerSample; // number of bytes per sample
243 fNumEvents=h.fNumEvents; // number of events stored
244 fNumEventsRead=h.fNumEventsRead; // number of events read by the electronics
245 fSamplingFrequency=h.fSamplingFrequency; // Sampling Frequency [MHz]
246 fFadcResolution=h.fFadcResolution; // number of significant bits
247 fRunStart=h.fRunStart; // time of run start
248 fRunStop=h.fRunStop; // time of run stop
249 fPixAssignment = new MArrayS(*h.fPixAssignment); //-> pixel assignment table
250}
251
252// --------------------------------------------------------------------------
253//
254// Destructor. Deletes the 'pixel-assignment-array'
255//
256MRawRunHeader::~MRawRunHeader()
257{
258 delete fPixAssignment;
259}
260
261// --------------------------------------------------------------------------
262//
263// Checks for consistency between two run headers. Checks:
264// fNumCrates
265// fNumPixInCrate
266// fNumSamplesLoGain
267// fNumSamplesHiGain
268// fNumBytesPerSample
269//
270Bool_t MRawRunHeader::IsConsistent(const MRawRunHeader &h) const
271{
272 return fNumCrates==h.fNumCrates &&
273 fNumPixInCrate==h.fNumPixInCrate &&
274 fNumSamplesLoGain==h.fNumSamplesLoGain &&
275 fNumSamplesHiGain==h.fNumSamplesHiGain &&
276 fNumBytesPerSample==h.fNumBytesPerSample;
277}
278
279// --------------------------------------------------------------------------
280//
281// Swap the assignment of the pixels with hardware id id0 and id1
282//
283Bool_t MRawRunHeader::SwapAssignment(Short_t id0, Short_t id1)
284{
285 const Int_t n = fPixAssignment->GetSize();
286
287 // Look-up-table
288 UShort_t *lut = fPixAssignment->GetArray();
289
290 // Search for one of the hardware indices to get exchanged
291 int i;
292 for (i=0; i<n; i++)
293 if (lut[i]==id0 || lut[i]==id1)
294 break;
295
296 // Check if one of the two pixels were found
297 if (i==n)
298 {
299 *fLog << warn << "WARNING - Assignment of pixels with hardware ID " << id0 << " and " << id1;
300 *fLog << " should be exchanged, but none were found." << endl;
301 return kTRUE;
302 }
303
304 // Store first index
305 const Int_t idx0 = i;
306
307 // Search for the other hardware indices to get exchanged
308 for (i++; i<n; i++)
309 if (lut[i]==id0 || lut[i]==id1)
310 break;
311
312 // Check if the second pixel was found
313 if (i==n)
314 {
315 *fLog << err << "ERROR - Assignment of pixels with hardware ID " << id0 << " and " << id1;
316 *fLog << " should be exchanged, but only one was found." << endl;
317 return kFALSE;
318 }
319
320 const Int_t idx1 = i;
321
322 const Short_t p0 = lut[idx0];
323 const Short_t p1 = lut[idx1];
324
325 lut[idx0] = p1;
326 lut[idx1] = p0;
327
328 *fLog << inf << "Assignment of pixels with hardware ID " << id0 << " and " << id1 << " exchanged." << endl;
329
330 return kTRUE;
331}
332
333// --------------------------------------------------------------------------
334//
335// Return Telescope number, runnumber and filenumber on the form:
336// run
337// as string for runnumber<1000000 and
338// telescope:run/file
339// otherwise.
340//
341TString MRawRunHeader::GetStringID() const
342{
343 return fRunNumber<1000000?MString::Format("%d", fRunNumber):MString::Format("%d:%d/%d", fTelescopeNumber, fRunNumber, fFileNumber);
344}
345
346// --------------------------------------------------------------------------
347//
348// Consistency checks. See code for detils.
349//
350Bool_t MRawRunHeader::IsConsistent() const
351{
352 // FIXME: Match first digits of run-number with telescope number
353
354 if (fFormatVersion>10)
355 {
356 if (GetTypeID()!=fTelescopeNumber &&
357 GetTypeID()!=fTelescopeNumber*10U &&
358 GetTypeID()!=5U)
359 {
360 *fLog << err << "ERROR - Telescope number " << fTelescopeNumber << " doesn't match the first two digits of the run number " << fRunNumber << " and run number doesn't start with 5." << endl;
361 return kFALSE;
362 }
363
364 // Old formats can not contain a run number larger 999999
365 if (fRunNumber<1000000)
366 {
367 *fLog << err << "ERROR - Run number " << fRunNumber << " smaller than 1000000." << endl;
368 return kFALSE;
369 }
370 }
371
372 // Check for correct number of bytes in data stream
373 if (fFormatVersion>7 && fNumBytesPerSample!=2)
374 {
375 *fLog << err << "ERROR - " << fNumBytesPerSample << " bytes per sample are not supported!" << endl;
376 return kFALSE;
377 }
378
379 // If we have a vlid stop time check its consistency with the start time
380 if (fRunStop!=MTime() && fRunStop<fRunStart)
381 {
382 *fLog << err << "ERROR - Stop time smaller than start time." << endl;
383 return kFALSE;
384 }
385
386 // No file numbers larger than 999 allowed in general
387 if (fFileNumber>999)
388 {
389 *fLog << err << "ERROR - File number " << fFileNumber << " larger than 999." << endl;
390 return kFALSE;
391 }
392
393 // Old formats can not contain a run number larger 0
394 if (fFormatVersion<11 && fFileNumber>0)
395 {
396 *fLog << err << "ERROR - File number " << fFileNumber << " larger than 0." << endl;
397 return kFALSE;
398 }
399
400 if (fFormatVersion>1)
401 {
402 // For most of the formats the start time must be valid
403 if (fRunStart==MTime())
404 {
405 *fLog << err << "ERROR - Start time invalid." << endl;
406 return kFALSE;
407 }
408
409 // For most of the formats an invalid stop time cannot happen if file closed
410 if (fMagicNumber==kMagicNumber && fRunStop==MTime())
411 {
412 *fLog << err << "ERROR - File closed but stop time invalid." << endl;
413 return kFALSE;
414 }
415 }
416 return kTRUE;
417}
418
419void MRawRunHeader::FixRunNumbers()
420{
421 if (fFormatVersion<11 || fTelescopeNumber!=1)
422 return;
423
424 // Map 1:1001349 to 47:1001395
425 if (fRunNumber<48 &&
426 fRunStart.GetMjd()>54674.5 && fRunStart.GetMjd()<56476.5)
427 {
428 fRunNumber += 1001348;
429 *fLog << warn << "Format >V10: Wrong run number increased by 1001348 to " << fRunNumber << "." << endl;
430 }
431
432 // Map 1001916:1001922 to 1002349:1002355
433 if (fRunNumber>1001915 && fRunNumber<1001923 &&
434 fRunStart.GetMjd()>54710.5 && fRunStart.GetMjd()<54711.5)
435 {
436 fRunNumber += 433;
437 *fLog << warn << "Format >V10: Wrong run number increased by 434 to " << fRunNumber << "." << endl;
438 }
439
440 // Map 10000342:1000343 to 10000351:1000351
441 if (fRunNumber>10000342 && fRunNumber<10000352 &&
442 fRunStart.GetMjd()>54254.5 && fRunStart.GetMjd()<54255.5)
443 {
444 fRunNumber -= 9000000;
445 *fLog << warn << "Format >V10: Wrong run number decreased by 9000000 to " << fRunNumber << "." << endl;
446 }
447
448 if (fRunNumber==1000382 &&
449 fRunStart.GetMjd()>54256.5 && fRunStart.GetMjd()<54257.5 &&
450 !strcmp(fSourceName, "GRB080605-2347"))
451 {
452 fFileNumber += 99;
453 *fLog << warn << "Format >V10: Ambiguous file number increased by 99 to " << fFileNumber << "." << endl;
454 }
455}
456
457// --------------------------------------------------------------------------
458//
459// This implements a fix of the pixel assignment before 25.9.2005
460//
461// From magic_online (the pixel numbers are hardware indices):
462// --------------------------------------------------------------------------
463// From: Florian Goebel <fgoebel@mppmu.mpg.de>
464// Date: Sun Sep 25 2005 - 05:13:19 CEST
465//
466// [...]
467// - problem 2: pixels were swaped
468// - cause: opical fibers were wrongly connected to receiver board
469// 554 <-> 559
470// 555 <-> 558
471// 556 <-> 557
472// - action: reconnect correctly
473// - result: ok now
474// - comment: I don't know when this error was introduced, so backward
475// correction of the data is difficult.
476// Fortunately the effect is not too large since the affected 6 pixels are
477// on the outermost edge of the camera
478// Since this board has special pixels the optical fibers have been
479// unplugged several times.
480// !!!!! Whenever you unplug and reconnect optical fibers make really !!!!!
481// !!!!! sure you connect them back correctly. !!!!!
482// !!!!! Always contact me before you do so and if you have any doubts !!!!!
483// !!!!! how to reconnect the fibers ask me. !!!!!
484// These swapped pixels have only been found by chance when doing the
485// flatfielding.
486// [...]
487//
488// --------------------------------------------------------------------------
489//
490// MAGIC runbook CC_2006_04_22_22_28_52.rbk
491//
492// [2006-04-22 23:14:13]
493//
494// [...]
495// Found 2 pairs of swapped pixels.
496// We corrected swapped pixels 54<->55 in the receiver boards. We probably
497// swapped today in the camera.
498// We did not correct 92<-<93 which are likely swapped. Will check and correct
499// tomorrow.
500//
501// ---
502//
503// comments:
504// - 54<->55 were corrected but have not been swapped, hence they are swapped
505// since then (run 88560 ok, run 88669 swapped; between them mostly dummy and
506// test runs)
507// - 92<->93 are never swapped, always ok.
508//
509// --------------------------------------------------------------------------
510//
511// MAGIC runbook CC_2006_08_28_19_40_18.rbk
512//
513// [2006-08-28 23:09:07]
514// While doing a flatfielding we have found out that the signals for pixels
515// 119 and 120 were swapped. We have fixed it by exchanging the corresponding
516// fibers at the input of the receivers (not before the splitters!).
517//
518// ---
519//
520// MAGIC runbook CC_2006_08_29_15_19_14.rbk
521//
522// [2006-08-29 16:43:09]
523// In the last hours we have found out and fixed a good number of pixels which
524// were swapped: 119-120, 160-161-162 and 210-263. According to Florian,
525// 160-161-162 and 210-263 were swapped since November 2005.
526//
527// ---
528//
529// mail Florian Goebel (08/30/2006 03:13 PM):
530//
531// As far as I can tell pixels 161 and 162 as well as 263 and 210 were
532// swapped in the trigger. This leads to some inefficiency of the trigger.
533// However, they were not swapped in the readout. So, you don't have to
534// correct anything in the data for these pixels.
535//
536// ---
537//
538// comments:
539// - 119-120 swapped between run 93251 (not swapped) and 93283 (swapped)
540// (only testruns between these runs)
541// corrected since run 99354 (== runbook [2006-08-28 23:09:07])
542// - 160 never swapped
543// - 161-162 were only swapped in the trigger, but nevertheless were
544// "corrected" also in the signal. Hence signal swapped since 99354
545//
546Bool_t MRawRunHeader::FixAssignment()
547{
548 if (!fTelescopeNumber==1)
549 return kTRUE;
550
551 if (fRunNumber>=53300 && fRunNumber<=68754)
552 {
553 if (!SwapAssignment(554, 559))
554 return kFALSE;
555 if (!SwapAssignment(555, 558))
556 return kFALSE;
557 if (!SwapAssignment(556, 557))
558 return kFALSE;
559 }
560
561 if (fRunNumber>=93283 && fRunNumber<99354)
562 {
563 if (!SwapAssignment(119, 120))
564 return kFALSE;
565 }
566
567 if (fRunNumber>=99354 && fRunNumber<=101789)
568 {
569 if (!SwapAssignment(161, 162))
570 return kFALSE;
571 if (!SwapAssignment(210, 263))
572 return kFALSE;
573 }
574
575 if (fRunNumber>=88669)
576 {
577 if (!SwapAssignment(54, 55))
578 return kFALSE;
579 }
580
581 if (fRunNumber>=200000)
582 {
583 if (!SwapAssignment(428, 429))
584 return kFALSE;
585 }
586
587 return kTRUE;
588}
589
590// --------------------------------------------------------------------------
591//
592// Fixes to fix bugs in the run header
593//
594Bool_t MRawRunHeader::Fixes()
595{
596 FixRunNumbers();
597
598 if (fFormatVersion>8 && fRunNumber>326152 && fTelescopeNumber==1)
599 {
600 fNumEvents--;
601 fNumEventsRead--;
602 *fLog << inf << "Format >V8 and Run>M1:326152: Stored number of events decreased by 1." << endl;
603 }
604
605 return FixAssignment();
606}
607
608// --------------------------------------------------------------------------
609//
610// Reading function to read/interpret the file formats 1-10
611//
612Bool_t MRawRunHeader::ReadEvtOld(istream& fin)
613{
614 if (fFormatVersion==7)
615 {
616 *fLog << err << "ERROR - File format V7 was for testing only and is not correctly implemented!" << endl;
617 return kFALSE;
618 }
619
620 // ----- DAQ software format version -----
621 fin.read((char*)&fSoftVersion, 2); // Total=6
622
623
624 fFadcType = 1;
625 if (fFormatVersion>7)
626 fin.read((char*)&fFadcType, 2);
627
628 // ----- Camera geometry and telescope number -----
629 fCameraVersion = 1;
630 fTelescopeNumber = 1;
631 if (fFormatVersion>5)
632 {
633 fin.read((char*)&fCameraVersion, 2); // (+2)
634 fin.read((char*)&fTelescopeNumber, 2); // (+2)
635 }
636
637 // ----- Run information -----
638 fin.read((char*)&fRunType, 2); // Total=8
639
640 fin.read((char*)&fRunNumber, 4); // Total=12
641 fin.read((char*)&fProjectName, fFormatVersion>5?100:22); // Total=34 (+78)
642 fin.read((char*)&fSourceName, fFormatVersion>5? 80:12); // Total=46 (+58)
643
644 if (fFormatVersion>5)
645 fin.read((char*)fObservationMode, 60); // (+60)
646 // Maybe we should set fObservationMode to something
647 // in case of fFormatVersion<6
648
649 // ----- Source position -----
650 fin.seekg(fFormatVersion>5 ? 16 : 8, ios::cur);
651 /*
652 if (fFormatVersion>5)
653 {
654 fin.read((char*)&fSourceRa, 4); // F32 SourceRA; Total=48
655 fin.read((char*)&fSourceDec, 4); // F32 SourceDEC; Total=52
656 }
657 fin.read((char*)&fTelescopeRa, 4); // F32 TelescopeRA; (+4)
658 fin.read((char*)&fTelescopeDec, 4); // F32 TelescopeDEC; (+4)
659 */
660
661 // Maybe we should set these to something
662 // in case of fFormatVersion<6
663 fin.read((char*)&fSourceEpochChar, 2); // Total=56
664 fin.read((char*)&fSourceEpochDate, 2); // Total=58
665
666 // ----- Old Start time -----
667 if (fFormatVersion<2) // Total += 10
668 {
669 UShort_t y, m, d;
670 fin.seekg(4, ios::cur); // Former fMJD[4],
671 fin.read((char*)&y, 2); // Former fDateYear[2]
672 fin.read((char*)&m, 2); // Former fDateMonth[2]
673 fin.read((char*)&d, 2); // Former fDateDay[2]
674 fRunStart.Set(y, m, d, 0, 0, 0, 0);
675 }
676
677 // ----- Data Geometry -----
678
679 fin.read((char*)&fNumCrates, 2); // MUX: number of channels
680 fin.read((char*)&fNumPixInCrate, 2); // MUX: number of pix in channel
681 fin.read((char*)&fNumSamplesLoGain, 2); // MUX: dummy (must be 0 for MUX data)
682 fin.read((char*)&fNumSamplesHiGain, 2); // MUX: Number of samples per pixel
683
684 char dummy[16];
685 if (fFormatVersion>8)
686 fin.read(dummy, 4); // 2xU16 (NumSamplesRemovedHead and NumSamplesRemovedTail)
687
688 // ----- Number of events -----
689 fin.read((char*)&fNumEvents, 4); // Total=70
690
691 if (fFormatVersion>8)
692 fin.read((char*)&fNumEventsRead, 4);
693
694 // New in general features: (should they be included in new MAGIC1 formats, too?)
695 fNumBytesPerSample = 1; // 2 for MUX DATA
696 fSamplingFrequency = 300;
697 fFadcResolution = 8;
698
699 if (fFormatVersion>7)
700 {
701 fin.read((char*)&fNumBytesPerSample, 2);
702 fin.read((char*)&fSamplingFrequency, 2); // [MHz], 2000 for MuxFadc
703 fin.read((char*)&fFadcResolution, 1); // nominal resolution [# Bits], 10 for MuxFadc
704 }
705
706 // ----- Start/Stop time -----
707 if (fFormatVersion>1)
708 {
709 fRunStart.ReadBinary(fin); // Total += 7
710 fRunStop.ReadBinary(fin); // Total += 7
711 }
712
713 //
714 // calculate size of array, create it and fill it
715 //
716 const Int_t nPixel = fNumCrates*fNumPixInCrate;
717 fPixAssignment->Set(nPixel);
718
719 // ----- Pixel Assignement -----
720 fin.read((char*)fPixAssignment->GetArray(), nPixel*2);
721
722 if (fFormatVersion<7)
723 fin.read(dummy, 16);
724
725 // ----- Fixes for broken files or contents -----
726 if (!Fixes())
727 return kFALSE;
728
729 // ----- Consistency checks -----
730 return IsConsistent();
731}
732
733// --------------------------------------------------------------------------
734//
735// Read in one run header from the binary file
736//
737Bool_t MRawRunHeader::ReadEvt(istream& fin)
738{
739 //
740 // read one RUN HEADER from the input stream
741 //
742 fMagicNumber = 0;
743
744 fin.read((char*)&fMagicNumber, 2); // Total=2
745
746 //
747 // check whether the the file has the right file type or not
748 //
749 if (fMagicNumber != kMagicNumber && fMagicNumber != kMagicNumber+1)
750 {
751 *fLog << err << "ERROR - Wrong Magic Number (0x" << hex << fMagicNumber << "): Not a Magic File!" << endl;
752 return kFALSE;
753 }
754
755 if (fMagicNumber == kMagicNumber+1)
756 *fLog << warn << "WARNING - This file maybe broken (0xc0c1) - DAQ didn't close it correctly!" << endl;
757
758 // ----- File format version -----
759 fin.read((char*)&fFormatVersion, 2); // Total=4
760 if (fFormatVersion==10 || fFormatVersion>kMaxFormatVersion)
761 {
762 *fLog << err << "ERROR - File format V" << fFormatVersion << " not implemented!" << endl;
763 return kFALSE;
764 }
765
766 // ----- Process old file formats -----
767 if (fFormatVersion<10)
768 return ReadEvtOld(fin);
769
770 // ----- Overwrite format version for format 11 -----
771 fin.read((char*)&fFormatVersion, 4);
772 if (fFormatVersion<11)
773 {
774 *fLog << err << "ERROR - Format Version <11." << endl;
775 return kFALSE;
776 }
777
778 // ----- Read Header by size as written in the header -----
779 fin.read((char*)&fHeaderSizeRun, 4);
780 if (fHeaderSizeRun<346)
781 {
782 *fLog << err << "ERROR - Event header too small (<388b)." << endl;
783 return kFALSE;
784 }
785
786 TArrayC h(fHeaderSizeRun-12);
787 fin.read(h.GetArray(), h.GetSize());
788 if (!fin)
789 return kFALSE;
790
791 // ----- convert -----
792 const Byte_t *Char = reinterpret_cast<Byte_t* >(h.GetArray());
793 const UInt_t *Int = reinterpret_cast<UInt_t* >(h.GetArray());
794 //const Float_t *Float = reinterpret_cast<Float_t*>(h.GetArray());
795
796 // ----- Start interpretation -----
797
798 fHeaderSizeEvt = Int[0];
799 fHeaderSizeCrate = Int[1];
800 fSoftVersion = Int[2];
801 fFadcType = Int[3];
802 fCameraVersion = Int[4];
803 fTelescopeNumber = Int[5];
804 fRunType = Int[6];
805 fRunNumber = Int[7];
806 fFileNumber = Int[8];
807
808 memcpy(fProjectName, Char+ 36, 100); // 25
809 memcpy(fSourceName, Char+136, 80); // 20
810 memcpy(fObservationMode, Char+216, 60); // 15
811
812 //F32 fSourceRA = Float[69];
813 //F32 fSourceDEC = Float[70];
814 //F32 fTelescopeRA = Float[71];
815 //F32 fTelescopeDEC = Float[72];
816
817 memcpy(fSourceEpochChar, Char+232, 4);
818
819 fSourceEpochDate = Int[74];
820 fNumCrates = Int[75];
821 fNumPixInCrate = Int[76];
822 fNumSamplesHiGain = Int[77];
823 fNumSamplesLoGain = 0;
824
825 //fNumSamplesRemovedHead = Int[78];
826 //fNumSamplesRemovedTail = Int[79];
827
828 fNumEvents = Int[80];
829 fNumEventsRead = Int[81];
830 fNumBytesPerSample = Int[82];
831 fSamplingFrequency = Int[83];
832 fFadcResolution = Int[84];
833
834 fRunStart.SetBinary(Int+85);
835 fRunStop.SetBinary(Int+91);
836
837 // ----- 388 bytes so far -----
838
839 const UInt_t n = fNumCrates*fNumPixInCrate;
840 if (fHeaderSizeRun<388+n*4)
841 {
842 *fLog << err << "ERROR - Event header too small to contain pix assignment." << endl;
843 return kFALSE;
844 }
845
846 // ----- Pixel Assignment -----
847 fPixAssignment->Set(n);
848
849 for (UInt_t i=0; i<n; i++)
850 (*fPixAssignment)[i] = Int[97+i];
851
852 // ----- Fixes for broken files or contents -----
853 if (!Fixes())
854 return kFALSE;
855
856 // ----- Consistency checks -----
857 return IsConsistent();
858}
859/*
860Bool_t MRawRunHeader::WriteEvt(ostream& out) const
861{
862 //
863 // write one RUN HEADER from the input stream
864 //
865 const UInt_t n = fNumCrates*fNumPixInCrate;
866
867 const UShort_t magicnumber = kMagicNumber;
868 const UInt_t formatversion = 11;
869 const UInt_t headersizerun = (97+n)*4; //???
870
871 // FIXME: Write fixed number (c0c0)
872 out.write((char*)&magicnumber, 2); // Total=2
873 out.write((char*)&formatversion, 2); // Total=4
874 out.write((char*)&formatversion, 4);
875 out.write((char*)&headersizerun, 4);
876
877 TArrayC h(headersizerun-12);
878
879 // ----- convert -----
880 Byte_t *Char = reinterpret_cast<Byte_t* >(h.GetArray());
881 UInt_t *Int = reinterpret_cast<UInt_t* >(h.GetArray());
882 //const Float_t *Float = reinterpret_cast<Float_t*>(h.GetArray());
883
884 // ----- Start interpretation -----
885
886 Int[0] = 0; // fHeaderSizeEvt;
887 Int[1] = 0; // fHeaderSizeCrate;
888 Int[2] = 0; // fSoftVersion;
889 Int[3] = fFadcType;
890 Int[4] = fCameraVersion;
891 Int[5] = fTelescopeNumber;
892 Int[5] = fRunType;
893 Int[6] = fRunNumber;
894 Int[7] = fFileNumber;
895
896 memcpy(Char+ 36, fProjectName, 100); // 25
897 memcpy(Char+136, fSourceName, 80); // 20
898 memcpy(Char+216, fObservationMode, 60); // 15
899
900 //F32 fSourceRA = Float[69];
901 //F32 fSourceDEC = Float[70];
902 //F32 fTelescopeRA = Float[71];
903 //F32 fTelescopeDEC = Float[72];
904
905 memcpy(Char+232, fSourceEpochChar, 4);
906
907 Int[74] = fSourceEpochDate;
908 Int[75] = fNumCrates;
909 Int[76] = fNumPixInCrate;
910 Int[77] = fNumSamplesHiGain;
911
912 //fNumSamplesRemovedHead = Int[78];
913 //fNumSamplesRemovedTail = Int[79];
914
915 Int[80] = fNumEvents;
916 Int[81] = fNumEvents; //fNumEventsRead;
917 Int[82] = fNumBytesPerSample;
918 Int[83] = fSamplingFrequency;
919 Int[84] = fFadcResolution;
920
921 fRunStart.GetBinary(Int+85);
922 fRunStop.GetBinary(Int+91);
923
924 // ----- 388 bytes so far -----
925
926 //const UInt_t n = fNumCrates*fNumPixInCrate;
927 //if (fHeaderSizeRun<(97+n)*4)
928 //{
929 // *fLog << err << "ERROR - Event header too small to contain pix assignment." << endl;
930 // return kFALSE;
931 //}
932
933 // ----- Pixel Assignment -----
934 for (UInt_t i=0; i<n; i++)
935 Int[97+i] = (*fPixAssignment)[i];
936
937 out.write(h.GetArray(), h.GetSize());
938
939 return out;
940}
941*/
942// --------------------------------------------------------------------------
943//
944// Return the run type as string ("Data", "Pedestal", ...), for example
945// to print it as readable text.
946//
947const Char_t *MRawRunHeader::GetRunTypeStr() const
948{
949 switch (fRunType)
950 {
951 case kRTData:
952 return "Data";
953 case kRTPedestal:
954 return "Pedestal";
955 case kRTCalibration:
956 return "Calibration";
957 case kRTDominoCal:
958 return "DominoCal";
959 case kRTLinearity:
960 return "Linearity";
961 case kRTPointRun:
962 return "Point-Run";
963 case kRTMonteCarlo:
964 return "Monte Carlo";
965 case kRTNone:
966 return "<none>";
967 default:
968 return "<unknown>";
969 }
970}
971
972const Char_t MRawRunHeader::GetRunTypeChar() const
973{
974 switch (fRunType&0xff)
975 {
976 case kRTData:
977 case kRTPointRun:
978 return 'D';
979 case kRTPedestal:
980 return 'P';
981 case kRTCalibration:
982 return 'C';
983 case kRTDominoCal:
984 return 'L';
985 case kRTLinearity:
986 return 'N';
987 default:
988 return ' ';
989 }
990}
991
992// --------------------------------------------------------------------------
993//
994// print run header information on *fLog. The option 'header' supresses
995// the pixel index translation table.
996//
997void MRawRunHeader::Print(Option_t *t) const
998{
999 *fLog << all << endl;
1000 *fLog << "MagicNumber: 0x" << hex << fMagicNumber << " - ";
1001 switch (fMagicNumber)
1002 {
1003 case kMagicNumber: *fLog << "OK"; break;
1004 case kMagicNumber+1: *fLog << "File not closed!"; break;
1005 default: *fLog << "Wrong!"; break;
1006 }
1007 *fLog << endl;
1008 *fLog << "Versions: " << dec << "Format=";
1009 if (fFormatVersion==0xf172)
1010 *fLog << "FITS[f172]";
1011 else
1012 *fLog << fFormatVersion;
1013 *fLog << " Software=" << fSoftVersion << " ";
1014 if (fFormatVersion>5)
1015 {
1016 *fLog << "Camera=";
1017 if (fCameraVersion==0xfac7)
1018 *fLog << "FACT[fac7]";
1019 else
1020 *fLog << fCameraVersion;
1021 }
1022 *fLog << endl;
1023 if (fFormatVersion>10 && fHeaderSizeRun>0 && fHeaderSizeEvt>0 && fHeaderSizeCrate>0)
1024 *fLog << "Header sizes: " << fHeaderSizeRun << "b (run), " << fHeaderSizeEvt << "b (evt), " << fHeaderSizeCrate << "b (crate)" << endl;
1025 if (fRunNumber>0)
1026 {
1027 if (fFormatVersion>5 && fTelescopeNumber>0)
1028 *fLog << "Telescope: " << fTelescopeNumber << endl;
1029 *fLog << "RunNumber: " << fRunNumber;
1030 if (fFormatVersion>10)
1031 *fLog << "/" << fFileNumber << " (id=" << GetFileID() << ")";
1032 *fLog << " (Type=" << GetRunTypeStr() << ")" << endl;
1033 }
1034 if (fFormatVersion>7)
1035 {
1036 *fLog << "FadcType: " << fFadcType << " (";
1037 switch (fFadcType)
1038 {
1039 case 1: *fLog << "Siegen"; break;
1040 case 2: *fLog << "MUX"; break;
1041 case 0xfac7: *fLog << "FACT DRS4"; break;
1042 case 0xffff: *fLog << "artificial"; break;
1043 default: *fLog << "unknown";
1044 }
1045 *fLog << ")" << endl;
1046 }
1047 *fLog << "ProjectName: '" << fProjectName << "'" << endl;
1048 if (fFormatVersion>5)
1049 *fLog << "Observation: '" << fObservationMode << "'" << endl;
1050 if (fSourceName[0]!=0 || fSourceEpochChar[0]!=0 || fSourceEpochDate!=0)
1051 {
1052 *fLog << "Source: '" << fSourceName << "' " << " ";
1053 *fLog << fSourceEpochChar << dec << fSourceEpochDate << endl;
1054 }
1055 if (fRunStart)
1056 *fLog << "Run Start: " << fRunStart << endl;
1057 if (fRunStop)
1058 *fLog << "Run Stop: " << fRunStop << endl;
1059 if (fNumCrates>0 || fNumPixInCrate>0)
1060 *fLog << "Crates: " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;
1061 if (GetNumConnectedPixels()>0)
1062 *fLog << "Num Pixels: " << GetNumNormalPixels() << " (normal) + " << GetNumSpecialPixels() << " (special) = " << GetNumConnectedPixels() << " (total)" << endl;
1063 if (fFormatVersion>6)
1064 *fLog << "Sampling: " << fSamplingFrequency << "MHz with " << (int)fFadcResolution << " significant bits" << endl;
1065 *fLog << "Samples: " << fNumSamplesHiGain << "/" << fNumSamplesLoGain << " (hi/lo) * " << fNumBytesPerSample << "B/sample = ";
1066 if (fNumCrates>0)
1067 *fLog << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate * fNumBytesPerSample/1000 << "kB/Evt" << endl;
1068 else
1069 *fLog << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumBytesPerSample << "B/pix" << endl;
1070 if (fNumEvents>0 || fNumEventsRead>0)
1071 {
1072 *fLog << "Evt Counter: " << fNumEvents;
1073 if (fFormatVersion>8)
1074 *fLog << " (read=" << fNumEventsRead << ")";
1075 *fLog << endl;
1076 }
1077
1078 if (TString(t).Contains("header", TString::kIgnoreCase))
1079 return;
1080
1081 *fLog << inf3 << "Assignment:" << hex << endl;
1082 for (int i=0; i<GetNumPixel(); i++)
1083 *fLog << setfill('0') << setw(3) << (*fPixAssignment)[i] << " ";
1084
1085 *fLog << dec << setfill(' ') << endl;
1086}
1087
1088// --------------------------------------------------------------------------
1089//
1090// Return the assigned pixel number for the given FADC channel
1091//
1092Short_t MRawRunHeader::GetPixAssignment(UShort_t i) const
1093{
1094 // FIXME: Do we need a range check here?
1095 return (Short_t)(*fPixAssignment)[i];
1096}
1097
1098// --------------------------------------------------------------------------
1099//
1100// Return the number of pixel which are markes as connected in the
1101// pix assignment (!=0)
1102//
1103UShort_t MRawRunHeader::GetNumConnectedPixels() const
1104{
1105 const Int_t num = fPixAssignment->GetSize();
1106
1107 UShort_t rc = 0;
1108 for (int i=0; i<num; i++)
1109 {
1110 if (GetPixAssignment(i)!=0)
1111 rc++;
1112 }
1113 return rc;
1114}
1115
1116// --------------------------------------------------------------------------
1117//
1118// Return the number of pixel which are markes as connected and so-called
1119// 'normal' pixels in the pix assignment (>0)
1120//
1121UShort_t MRawRunHeader::GetNumNormalPixels() const
1122{
1123 const Int_t num = fPixAssignment->GetSize();
1124
1125 UShort_t rc = 0;
1126 for (int i=0; i<num; i++)
1127 {
1128 if (GetPixAssignment(i)>0)
1129 rc++;
1130 }
1131 return rc;
1132}
1133
1134// --------------------------------------------------------------------------
1135//
1136// Return the number of pixel which are markes as connected and so-called
1137// 'special' pixels in the pix assignment (<0)
1138//
1139UShort_t MRawRunHeader::GetNumSpecialPixels() const
1140{
1141 const Int_t num = fPixAssignment->GetSize();
1142
1143 UShort_t rc = 0;
1144 for (int i=0; i<num; i++)
1145 {
1146 if (GetPixAssignment(i)<0)
1147 rc++;
1148 }
1149 return rc;
1150}
1151
1152// --------------------------------------------------------------------------
1153//
1154// Return the maximum id which exists in the pix assignment
1155//
1156UShort_t MRawRunHeader::GetMaxPixId() const
1157{
1158 const Int_t num = fPixAssignment->GetSize();
1159
1160 Short_t rc = 0;
1161 for (int i=0; i<num; i++)
1162 rc = TMath::Max(GetPixAssignment(i), rc);
1163
1164 return rc;
1165}
1166
1167// --------------------------------------------------------------------------
1168//
1169// Return minus th minimum id which exists in the pix assignment
1170//
1171UShort_t MRawRunHeader::GetMinPixId() const
1172{
1173 const Int_t num = fPixAssignment->GetSize();
1174
1175 Short_t rc = 0;
1176 for (int i=0; i<num; i++)
1177 rc = TMath::Min(GetPixAssignment(i), rc);
1178
1179 return (UShort_t)-rc;
1180}
1181
1182// --------------------------------------------------------------------------
1183//
1184// Return the number of pixel in this event.
1185//
1186// WARNING: This is the number of pixels stored in this file which is
1187// a multiple of the number of pixels per crate and in general
1188// a number which is larger than the camera size!
1189//
1190// To know the range of the pixel indices please use the geometry
1191// container!
1192//
1193UShort_t MRawRunHeader::GetNumPixel() const
1194{
1195 return fPixAssignment->GetSize();
1196}
1197
1198// --------------------------------------------------------------------------
1199//
1200// Returns absolute size in bytes of the run header as read from a raw file.
1201// This must be done _after_ the header is read, because the header doesn't
1202// have a fixed size (used in MRawSocketRead)
1203//
1204Int_t MRawRunHeader::GetNumTotalBytes() const
1205{
1206 switch (fFormatVersion)
1207 {
1208 case 1:
1209 return 80+fNumCrates*fNumPixInCrate*2+16;
1210 case 2:
1211 case 3:
1212 case 4:
1213 case 5:
1214 return 84+fNumCrates*fNumPixInCrate*2+16;
1215 case 6:
1216 return 84+fNumCrates*fNumPixInCrate*2+16 +4+78+58+60+8;
1217 case 7:
1218 return 84+fNumCrates*fNumPixInCrate*2+16 +4+78+58+60+8 +3-16;
1219 }
1220 return 0;
1221}
1222
1223// --------------------------------------------------------------------------
1224//
1225// Monte Carlo Interface
1226//
1227// This is a (prelimiary) way to setup an existing FADC system.
1228//
1229// 1: Siegen FADCs
1230// 2: MUX FADCs
1231//
1232void MRawRunHeader::InitFadcType(UShort_t type)
1233{
1234 switch (type)
1235 {
1236 case 1:
1237 fNumSamplesHiGain = 15;
1238 fNumSamplesLoGain = 15;
1239 fNumBytesPerSample = 1; // number of bytes per sample
1240 fSamplingFrequency = 300; // Sampling Frequency [MHz]
1241 fFadcResolution = 8; // number of significant bits
1242 break;
1243 case 2:
1244 fNumSamplesHiGain = 50;
1245 fNumSamplesLoGain = 0;
1246 fNumBytesPerSample = 2; // number of bytes per sample
1247 fSamplingFrequency = 2000; // Sampling Frequency [MHz]
1248 fFadcResolution = 12; // number of significant bits
1249 break;
1250 case 3:
1251 fNumSamplesHiGain = 150;
1252 fNumSamplesLoGain = 0;
1253 fNumBytesPerSample = 2; // number of bytes per sample
1254 fSamplingFrequency = 1000; // Sampling Frequency [MHz]
1255 fFadcResolution = 12; // number of significant bits
1256 break;
1257 }
1258
1259 fFadcType = type;
1260}
1261
1262// --------------------------------------------------------------------------
1263//
1264// Monte Carlo Interface
1265//
1266// Init a camera
1267//
1268void MRawRunHeader::InitCamera(UShort_t type, UShort_t pix)
1269{
1270 switch (type)
1271 {
1272 case 1:
1273 fNumCrates = 1;
1274 fNumPixInCrate = 577;
1275 break;
1276 case 2:
1277 fNumCrates = 1;
1278 fNumPixInCrate = 703;
1279 break;
1280 case (UShort_t)-1:
1281 fNumCrates = 1;
1282 fNumPixInCrate = pix;
1283 break;
1284 }
1285
1286 fCameraVersion = type;
1287
1288 const Int_t n = fNumCrates*fNumPixInCrate;
1289
1290 fPixAssignment->Set(n);
1291
1292 for (int i=0; i<n; i++)
1293 (*fPixAssignment)[i] = i+1;
1294}
1295
1296void MRawRunHeader::InitFact(UShort_t num, UShort_t pix, UShort_t samples, UShort_t *map)
1297{
1298 fNumCrates = num;
1299 fNumPixInCrate = pix;
1300 fCameraVersion = 0xfac7;
1301 fFadcType = 0xfac7;
1302
1303 fPixAssignment->Set(num*pix);
1304
1305 if (map)
1306 for (int i=0; i<num*pix; i++)
1307 (*fPixAssignment)[i] = map[i]+1;
1308 else
1309 {
1310 for (int i=0; i<num*pix; i++)
1311 (*fPixAssignment)[i] = i+1;
1312 }
1313
1314 fNumSamplesHiGain = samples;
1315 fNumSamplesLoGain = 0;
1316 fNumBytesPerSample = 2; // number of bytes per sample
1317 fIsSigned = kTRUE;
1318 fSamplingFrequency = 2000; // Sampling Frequency [MHz]
1319 fFadcResolution = 12; // number of significant bits
1320}
1321
1322// --------------------------------------------------------------------------
1323//
1324// Monte Carlo Interface
1325//
1326// Set telescope number, run-number and file-number
1327//
1328void MRawRunHeader::SetRunInfo(UShort_t tel, UInt_t run, UInt_t file)
1329{
1330 fTelescopeNumber = tel;
1331 fRunNumber = run;
1332 fFileNumber = file;
1333}
1334
1335// --------------------------------------------------------------------------
1336//
1337// Monte Carlo Interface
1338//
1339// Set source-name, epoch (default J) and date (default 2000)
1340//
1341void MRawRunHeader::SetSourceInfo(const TString src, char epoch, UShort_t date)
1342{
1343 strncpy(fSourceName, src.Data(), 80);
1344
1345 fSourceEpochChar[0] = epoch; // epoch char of the source
1346 fSourceEpochDate = date; // epoch date of the source
1347}
1348
1349// --------------------------------------------------------------------------
1350//
1351// Monte Carlo Interface
1352//
1353// Set run-start and -stop time
1354//
1355void MRawRunHeader::SetRunTime(const MTime &start, const MTime &end)
1356{
1357 fRunStart = start;
1358 fRunStop = end;
1359}
1360
1361// --------------------------------------------------------------------------
1362//
1363// Monte Carlo Interface
1364//
1365// Set project name and observation mode
1366//
1367void MRawRunHeader::SetObservation(const TString mode, const TString proj)
1368{
1369 strncpy(fProjectName, proj.Data(), 100);
1370 strncpy(fObservationMode, mode.Data(), 60);
1371}
1372
1373// --------------------------------------------------------------------------
1374//
1375// Monte Carlo Interface
1376//
1377// Set number of events in file.
1378//
1379void MRawRunHeader::SetNumEvents(UInt_t num)
1380{
1381 fNumEvents = num;
1382 fNumEventsRead = num;
1383}
1384
1385// --------------------------------------------------------------------------
1386//
1387// NumSamples: 50
1388// NumBytePerSample: 2
1389// SamplingFrequency: 2000
1390// FadcResolution: 12
1391// FadcType: XXXX
1392//
1393Int_t MRawRunHeader::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
1394{
1395 Bool_t rc = kFALSE;
1396
1397 if (IsEnvDefined(env, prefix, "NumSamples", print))
1398 {
1399 rc = kTRUE;
1400 fNumSamplesHiGain = GetEnvValue(env, prefix, "NumSamples", fNumSamplesHiGain);
1401 fNumSamplesLoGain = 0;
1402 }
1403
1404 if (IsEnvDefined(env, prefix, "NumBytesPerSample", print))
1405 {
1406 rc = kTRUE;
1407 fNumBytesPerSample = GetEnvValue(env, prefix, "NumBytesPerSample", fNumBytesPerSample);
1408 }
1409
1410 if (IsEnvDefined(env, prefix, "SamplingFrequency", print))
1411 {
1412 rc = kTRUE;
1413 fSamplingFrequency = GetEnvValue(env, prefix, "SamplingFrequency", fSamplingFrequency);
1414 }
1415
1416 if (IsEnvDefined(env, prefix, "FadcResolution", print))
1417 {
1418 rc = kTRUE;
1419 fFadcResolution = GetEnvValue(env, prefix, "FadcResolution", fFadcResolution);
1420 }
1421 // Saturation behaviour etc.
1422 if (IsEnvDefined(env, prefix, "FadcType", print))
1423 {
1424 //rc = kTRUE;
1425 //TString type = GetEnvValue(env, prefix, "FadcType", "");
1426 // Eval "Siegen", "MUX", Dwarf"
1427 }
1428 else
1429 if (rc)
1430 fFadcType = 0xffff; // "Artificial"
1431
1432 return rc;
1433}
1434
Note: See TracBrowser for help on using the repository browser.