source: trunk/MagicSoft/Mars/mraw/MRawCrateData.cc@ 8785

Last change on this file since 8785 was 8344, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.0 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-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MRawCrateData
28//
29// This container stores the information about one crate. A list of this
30// informations can be find at MRawCrateArray
31//
32/////////////////////////////////////////////////////////////////////////////
33#include "MRawCrateData.h"
34
35#include <iostream>
36#include <iomanip>
37
38#include <fstream>
39
40#include "MLog.h"
41#include "MLogManip.h"
42
43ClassImp(MRawCrateData);
44
45using namespace std;
46
47MRawCrateData::MRawCrateData() : fDAQCrateNumber(0), fFADCEvtNumber(0), fFADCClockTick(0), fABFlags(0)
48{
49}
50
51// --------------------------------------------------------------------------
52//
53// read the information from a binary input stream about the CRATE DATA,
54// like specified in a TDAS note
55//
56void MRawCrateData::ReadEvt(istream& fin, UShort_t ver)
57{
58 if (ver<7)
59 {
60 fin.read((char*)&fDAQCrateNumber, 2);
61 fin.read((char*)&fFADCEvtNumber, 4);
62 fin.read((char*)&fFADCClockTick, 4);
63 if (ver>1)
64 fin.read((char*)&fABFlags, 1);
65 }
66 else
67 {
68 // U8 CrateNumber; // 0-4
69 // U8 BoardNumber; // 0-1
70 // U8 ChannelNumber; // 0-3
71 fDAQCrateNumber = 0;
72 fin.read((char*)&fDAQCrateNumber, 1); // U8: CrateNumber 0-4
73
74 Byte_t dummyb;
75 fin.read((char*)&dummyb, 1); // U8 Board number 0-1
76 fin.read((char*)&dummyb, 1); // U8 Channel number 0-3
77
78 fin.read((char*)&fFADCEvtNumber, 4); // U32 CrateEvtNumber
79
80 // Clock count. The Clock is synchronized with the 10 MHz external clock,
81 // which is feed to for all FADC channels.
82 // The units are [psec], which is obviously much smaller than the real accuracy.
83 // The ClockTick should be identical for all channels of the same board.
84 // Still keep it for debugging purposes.
85 // Like in the 300MHz system this number is extremely useful to check the
86 // integrity of the data.
87 UInt_t dummyi;
88 fin.read((char*)&dummyi, 4); // U32 FadcClockTickHi; // high significant bits
89 fin.read((char*)&dummyi, 4); // U32 FadcClockTickLo; // low significant bits
90
91 // Trigger Time Interpolation in [psec] (originally it is a double
92 // in Acqiris software). Again this number should be identical for
93 // all channels in the same board. It is not clear at the moment
94 // if this number will be useful in the end, but I propose to keep
95 // it. The data volume is increase by <0.1%
96 UInt_t dummys;
97 fin.read((char*)&dummys, 2); // U16 TrigTimeInterpol;
98 }
99}
100
101void MRawCrateData::SkipEvt(istream &fin, UShort_t ver)
102{
103 fin.seekg(ver>1?11:10);
104}
105
106// --------------------------------------------------------------------------
107//
108// print all stored information to gLog
109//
110void MRawCrateData::Print(Option_t *t) const
111{
112 *fLog << all;
113 *fLog << "Crate #" << dec << fDAQCrateNumber << ": ";
114 *fLog << "FADCEventNr = " << fFADCEvtNumber << " ";
115 *fLog << "FADCClockTick = " << fFADCClockTick << " (20MHz) ";
116 *fLog << "ABFlags = 0x" << Form("%02x", fABFlags) << endl;
117}
Note: See TracBrowser for help on using the repository browser.