GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReadMezzAFP.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef _ReadMezzAFP
24 #define _ReadMezzAFP
25 
26 #include "NarvalInterface.h"
27 #include "CrystalFrame.h"
28 #include "FrameBlock.h"
29 #include "Trigger.h"
30 
31 #include "AgataFrameFactory.h"
32 #include "AgataKeyFactory.h"
33 
35 
39 class BashColor;
40 
41 //using namespace ADF;
42 
44 {
45 public:
48 
49 private:
51  ADF::FileBlock fSourceOfFrames;
52 private:
54  std::string fPath;
56  std::string fBaseForName;
58  FILE *fCurrentFile;
60  unsigned int fCurrentFileNumber;
62  unsigned int fMaxSize;
63 
65  short fConfMode;
67  std::vector< std::string > fListOfFile;
68 
69  bool NewCrystal;
70 
71 private:
72  ADF::AgataFrameTrigger fEndOfFrame;
73 
74  std::vector<std::string> split(std::string s, char c);
75  bool replace(std::string& str, const std::string& from, const std::string& to);
76  bool contains(std::string s1, std::string s2);
77  unsigned int uncompress_single_trace_AB(unsigned char* compr, unsigned int csize, unsigned short* trace);
78 
79 public:
80  void PrintStats();
81  void ResetStats();
82  bool IsUsingFiler() {return fUseKeyFilter;}
83 
84 protected:
85  unsigned short crystal_id;
86  unsigned short crystal_status;
87  unsigned int evnumber;
88  unsigned long long timestamp;
89  unsigned long long FirstTimeStamp;
90  unsigned long long LastTimeStamp;
91 
92  unsigned int fTraceLengthRaw;
93 
94  unsigned short *SegmentTraces[kNSG];
95  unsigned short *CoreTraces[kNCC];
96 
97  float SegE[kNSG];
98  unsigned short SegStatus[kNSG];
99  unsigned short SegID[kNSG];
100 
101  float CoreE[kNCC];
102  unsigned short CoreStatus[kNSG];
103  unsigned short CoreID[kNSG];
104 
107 
108 protected:
111 
112 protected:
113  static const int mezzanineMezzHeader = 16; // fixed header length (short)
114  static const int mezzanineChanHeader = 8; // fixed header length of the mezzanine channels
115 
116  static const int MIN_1x6 = -32;
117  static const int TOK_BINSIZE = 32; // normalmente 32
118 
119 private:
120  bool fdebug;
121  BashColor *fBashColor;
122 
123 protected:
127 
129 
131 
132  unsigned int fNextEvtNbr;
133  unsigned long long fNextTS;
134  void NextKeyToFind();
135 
136 private:
137  unsigned int fNEvts;
138  unsigned int fNIgnoredEvts;
139  unsigned int fBitFlipMezzLength;
140  unsigned int fBitFlipTraceLength;
141  unsigned int fBitFlipSegId;
142  unsigned int fBitFlipTS;
143 
144  std::string fCrystalName;
145 
146  unsigned long TotalEntryFileSize;
147  unsigned long ReadEntryFileSize;
148  unsigned long LastReadEntryFileSize;
149 
150 private:
151  void ProcessConvToBinary(unsigned long long n, std::ostringstream *str);
152  std::string ConvertToBinary(unsigned long long n);
153 
154 protected:
155  bool NewFile();
156 
157  int ReadEvent();
158 
159 
160 public:
161  ReadMezzAFP();
162  virtual ~ReadMezzAFP();
163 
165  static void process_config (const char *, unsigned int *) ;
166 
168  virtual void process_initialise (unsigned int *error_code);
169 
171  virtual void process_reset (unsigned int *error_code);
172 
174  virtual unsigned int ProcessBlock (ADF::FrameBlock &) ;
175 };
176 
177 #endif
ADF::AgataKey * fKeyToLink
Definition: ReadMezzAFP.h:128
static const int kNCC
Definition: ReadMezzAFP.h:46
bool fUseKeyFilter
Definition: ReadMezzAFP.h:125
unsigned short * CoreTraces[kNCC]
Definition: ReadMezzAFP.h:95
static const int TOK_BINSIZE
Definition: ReadMezzAFP.h:117
header file for FrameBlock.cpp
It defines the interface needed to be a narval actor (producer).
header file for AgataFrameFactory.cpp
bool fLastKeyIsRead
Definition: ReadMezzAFP.h:126
static const int mezzanineChanHeader
Definition: ReadMezzAFP.h:114
static const UShort_t kNbCores
Definition: CrystalFrame.h:110
virtual void process_initialise(unsigned int *error_code)
Constructor implementation.
static const int MIN_1x6
Definition: ReadMezzAFP.h:116
Interface to AgataKey.
float CoreE[kNCC]
Definition: ReadMezzAFP.h:101
unsigned short SegID[kNSG]
Definition: ReadMezzAFP.h:99
A Block of Frames.
Definition: FrameBlock.h:43
ADF::GeCore * coreMezz
Definition: ReadMezzAFP.h:106
unsigned int fTraceLengthRaw
Definition: ReadMezzAFP.h:92
virtual ~ReadMezzAFP()
Definition: ReadMezzAFP.cpp:83
header file for CrystalFrame.cpp
static const int kNSG
Definition: ReadMezzAFP.h:47
unsigned short crystal_status
Definition: ReadMezzAFP.h:86
static void process_config(const char *, unsigned int *)
to init globals (static) from a directory
unsigned short CoreStatus[kNSG]
Definition: ReadMezzAFP.h:102
header file for Trigger.cpp
bool NewFile()
Definition: ReadMezzAFP.cpp:94
Frames are extracted/added directly, one by one from/to a file.
Definition: FrameBlock.h:367
unsigned int fNextEvtNbr
Definition: ReadMezzAFP.h:132
unsigned int evnumber
Definition: ReadMezzAFP.h:87
ADF::SharedFP * fFrameCrystal_Out
Definition: ReadMezzAFP.h:109
FILE * fKeyFilterFile
Definition: ReadMezzAFP.h:124
static const int mezzanineMezzHeader
Trigger for the input frame.
Definition: ReadMezzAFP.h:113
unsigned short crystal_id
Definition: ReadMezzAFP.h:85
header file for AgataKeyFactory.cpp
To be used for Agata Data Flow.
Definition: Trigger.h:462
unsigned short * SegmentTraces[kNSG]
Definition: ReadMezzAFP.h:94
unsigned long long timestamp
Definition: ReadMezzAFP.h:88
void NextKeyToFind()
A Shared Frame Pointer.
Definition: Frame.h:597
float SegE[kNSG]
Definition: ReadMezzAFP.h:97
ADF::BufferIO * fKeyFilterBuffer
Definition: ReadMezzAFP.h:130
void ResetStats()
unsigned short CoreID[kNSG]
Definition: ReadMezzAFP.h:103
virtual void process_reset(unsigned int *error_code)
Destructor implementation.
virtual unsigned int ProcessBlock(ADF::FrameBlock &)
Produce one block of data.
unsigned long long LastTimeStamp
Definition: ReadMezzAFP.h:90
bool IsUsingFiler()
Definition: ReadMezzAFP.h:82
header file for NarvalInterface.cpp
unsigned short SegStatus[kNSG]
Definition: ReadMezzAFP.h:98
ADF::AgataFrameTrigger fTrigger
Definition: ReadMezzAFP.h:110
unsigned long long FirstTimeStamp
Definition: ReadMezzAFP.h:89
unsigned long long fNextTS
Definition: ReadMezzAFP.h:133
void PrintStats()
ADF::GeSegment * segMezz
Definition: ReadMezzAFP.h:105
static const UShort_t kNbSegments
Definition: CrystalFrame.h:110