- Timestamp:
- 12/15/03 16:27:25 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2674 r2675 4 4 5 5 -*-*- END OF LINE -*-*- 6 7 2003/12/15: Thomas Bretz 8 9 * mraw/MRawRead.[h,cc]: 10 - added 11 12 * mraw/Makefile, mraw/RawLinkDef.h: 13 - added MRawRead 14 15 * mraw/MRawSocketRead.[h,cc], mraw/MRawFileRead.[h,cc]: 16 - changed such, that it derives from MRawRead now 17 18 6 19 7 20 2003/12/15: Abelardo Moralejo … … 16 29 initialized. 17 30 31 32 18 33 2003/12/12: Markus Gaug / Michele Doro 19 34 … … 21 36 - did not compile because of a wrong command to MCalibrationPix, 22 37 now corrected 38 23 39 24 40 -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r2645 r2675 142 142 } 143 143 144 // 145 // check if all necessary containers exist in the Parameter list. 146 // if not create one and add them to the list 147 // 148 fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader"); 149 if (!fRawRunHeader) 144 if (!MRawRead::PreProcess(pList)) 150 145 return kFALSE; 151 152 fRawEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader");153 if (!fRawEvtHeader)154 return kFALSE;155 156 fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");157 if (!fRawEvtData)158 return kFALSE;159 160 fRawCrateArray = (MRawCrateArray*)pList->FindCreateObj("MRawCrateArray");161 if (!fRawCrateArray)162 return kFALSE;163 164 fRawEvtTime = (MTime*)pList->FindCreateObj("MTime");165 if (!fRawEvtTime)166 return kTRUE;167 146 168 147 // … … 172 151 fRawRunHeader->Print(); 173 152 174 if (fRawRunHeader->GetMagicNumber()!=kMagicNumber) 175 return kFALSE; 176 177 // 178 // Give the run header information to the 'sub-classes' 179 // 180 fRawEvtHeader->Init(fRawRunHeader, fRawEvtTime); 181 fRawEvtData ->Init(fRawRunHeader, fRawCrateArray); 182 183 return kTRUE; 153 return fRawRunHeader->GetMagicNumber()==kMagicNumber; 184 154 } 185 155 … … 194 164 Int_t MRawFileRead::Process() 195 165 { 196 // 197 // Read in the next EVENT HEADER (see specification), 198 // if there is no next event anymore stop eventloop 199 // 200 if (!fRawEvtHeader->ReadEvt(*fIn)) 201 return kFALSE; 202 203 // 204 // Get number of crates from the run header 205 // 206 const UShort_t nc = fRawRunHeader->GetNumCrates(); 207 208 // 209 // Delete arrays which stores the pixel information (time slices) 210 // 211 fRawEvtData->ResetPixels(); 212 213 // 214 // clear the TClonesArray which stores the Crate Information 215 // and create a new array of the correct size 216 // 217 fRawCrateArray->SetSize(nc); 218 219 // 220 // Get file format version 221 // 222 const UShort_t ver = fRawRunHeader->GetFormatVersion(); 223 224 // 225 // read the CRATE DATA (see specification) from file 226 // 227 for (int i=0; i<nc; i++) 228 { 229 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn, ver); 230 if (!*fIn) 231 return kFALSE; 232 233 fRawEvtData->ReadEvt(*fIn); 234 if (!*fIn) 235 return kFALSE; 236 } 237 238 { 239 // FIXME This is a stupid workaround for the missing time stamp! 240 // Might be used depending on the run number in the future 241 static Double_t tm = 0; // Range of roughly 8min 242 const UInt_t ct = (*fRawCrateArray)[0]->GetFADCClockTick(); 243 244 tm = ct<tm ? fmod(tm, (UInt_t)(-1))+(UInt_t)(-1)+ct : ct; 245 246 const Double_t mhz = 9.375; // [1e6 ticks/s] 247 const Double_t t = tm/mhz; // [us] 248 const UInt_t ns = (UInt_t)fmod(t*1e3, 1e6); 249 const UShort_t ms = (UShort_t)fmod(t/1e3, 1e3); 250 const Byte_t s = (Byte_t)fmod(t/1e6, 60); 251 252 // Create an artificial time stamp! 253 UInt_t m = (Byte_t)fmod(t/60e6, 60); 254 //const Byte_t h = (Byte_t)(t/3600e6); 255 m += fRawRunHeader->GetRunNumber()*10; 256 m %= 360; // 6h 257 258 fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(), 259 fRawRunHeader->GetRunStart().Month(), 260 fRawRunHeader->GetRunStart().Day(), 261 m/60, m%60, s, ms, ns); 262 } 263 264 return kTRUE; 166 return ReadEvent(*fIn); 265 167 } 266 168 -
trunk/MagicSoft/Mars/mraw/MRawFileRead.h
r2636 r2675 2 2 #define MARS_MRawFileRead 3 3 4 #ifndef MARS_M Task5 #include "M Task.h"4 #ifndef MARS_MRawRead 5 #include "MRawRead.h" 6 6 #endif 7 7 8 // gcc 3.2 9 //class ifstream; 10 #include <iosfwd> 11 12 class MTime; 13 class MParList; 14 class MRawRunHeader; 15 class MRawEvtHeader; 16 class MRawEvtData; 17 class MRawCrateArray; 18 19 class MRawFileRead : public MTask 8 class MRawFileRead : public MRawRead 20 9 { 21 10 private: 22 MRawRunHeader *fRawRunHeader; // run header information container to fill from file 23 MRawEvtHeader *fRawEvtHeader; // event header information container to fill from file 24 MRawEvtData *fRawEvtData; // raw evt header infomation container to fill from file 25 MRawCrateArray *fRawCrateArray; // crate information array container to fill from file 26 MTime *fRawEvtTime; // raw evt time information container to fill from file 27 28 TString fFileName; 29 ifstream *fIn; //! buffered input stream (file to read from) 11 TString fFileName; 12 ifstream *fIn; //! buffered input stream (file to read from) 30 13 31 14 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc
r2645 r2675 160 160 return kFALSE; 161 161 162 // 163 // check if all necessary containers exist in the Parameter list. 164 // if not create one and add them to the list 165 // 166 fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader"); 167 if (!fRawRunHeader) 168 return kFALSE; 169 170 fRawEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader"); 171 if (!fRawEvtHeader) 172 return kFALSE; 173 174 fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData"); 175 if (!fRawEvtData) 176 return kFALSE; 177 178 fRawCrateArray = (MRawCrateArray*)pList->FindCreateObj("MRawCrateArray"); 179 if (!fRawCrateArray) 180 return kFALSE; 181 182 fTime = (MTime*)pList->FindCreateObj("MTime"); 183 if (!fTime) 184 return kTRUE; 162 if (!MRawRead::PreProcess(pList)) 163 return kFALSE; 185 164 186 165 fParList = pList; … … 273 252 } 274 253 275 // 276 // Give the run header information to the 'sub-classes' 277 // 278 fRawEvtHeader->Init(fRawRunHeader, fTime); 279 fRawEvtData ->Init(fRawRunHeader, fRawCrateArray); 280 281 // 282 // Read in the next EVENT HEADER (see specification), 283 // if there is no next event anymore stop eventloop 284 // 285 if (!fRawEvtHeader->ReadEvt(*fIn)) 286 return kFALSE; 287 288 // 289 // Get number of crates from the run header 290 // 291 const UShort_t nc = fRawRunHeader->GetNumCrates(); 292 293 // 294 // Delete arrays which stores the pixel information (time slices) 295 // 296 fRawEvtData->ResetPixels(); 297 298 // 299 // clear the TClonesArray which stores the Crate Information 300 // and create a new array of the correct size 301 // 302 fRawCrateArray->SetSize(nc); 303 304 // 305 // Get file format version 306 // 307 const UShort_t ver = fRawRunHeader->GetFormatVersion(); 308 309 // 310 // read the CRATE DATA (see specification) from file 311 // 312 for (int i=0; i<nc; i++) 313 { 314 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn, ver); 315 if (!*fIn) 316 return kFALSE; 317 318 fRawEvtData->ReadEvt(*fIn); 319 if (!*fIn) 320 return kFALSE; 321 } 254 if (!ReadEvent(*fIn)) 255 return kFALSE; 322 256 323 257 // -
trunk/MagicSoft/Mars/mraw/MRawSocketRead.h
r2563 r2675 2 2 #define MARS_MRawSocketRead 3 3 4 #ifndef MARS_M Task5 #include "M Task.h"4 #ifndef MARS_MRawRead 5 #include "MRawRead.h" 6 6 #endif 7 7 8 class MTime;9 class MParList;10 8 class MReadSocket; 11 class MRawEvtData;12 class MRawEvtHeader;13 class MRawRunHeader;14 class MRawCrateArray;15 9 16 class MRawSocketRead : public M Task10 class MRawSocketRead : public MRawRead 17 11 { 18 12 private: 19 MRawRunHeader *fRawRunHeader; // run header information container to fill from file 20 MRawEvtHeader *fRawEvtHeader; // event header information container to fill from file 21 MRawEvtData *fRawEvtData; // raw evt header infomation container to fill from file 22 MRawCrateArray *fRawCrateArray; // crate information array container to fill from file 23 MTime *fTime; // raw evt time information container to fill from file 13 MReadSocket *fIn; //! buffered input stream (file to read from) 14 MParList *fParList; //! 24 15 25 MReadSocket *fIn; //! buffered input stream (file to read from)26 MParList *fParList;//!16 UInt_t fRunNumber; //! 17 UInt_t fEvtNumber; //! 27 18 28 UInt_t fRunNumber; //! 29 UInt_t fEvtNumber; //! 30 31 Int_t fPort; // Port on which we wait for the connection 19 Int_t fPort; // Port on which we wait for the connection 32 20 33 21 Bool_t OpenSocket(); 34 22 35 Int_t 36 Int_t 37 Int_t 23 Int_t PreProcess(MParList *pList); 24 Int_t Process(); 25 Int_t PostProcess(); 38 26 39 27 public: -
trunk/MagicSoft/Mars/mraw/Makefile
r2636 r2675 35 35 MRawCrateArray.cc \ 36 36 MRawCrateData.cc \ 37 MRawRead.cc \ 37 38 MRawFileWrite.cc \ 38 39 MRawFileRead.cc \ -
trunk/MagicSoft/Mars/mraw/RawLinkDef.h
r2386 r2675 14 14 #pragma link C++ class MRawCrateData+; 15 15 16 #pragma link C++ class MRawRead+; 16 17 #pragma link C++ class MRawSocketRead+; 17 18 #pragma link C++ class MRawFileRead+;
Note:
See TracChangeset
for help on using the changeset viewer.