source: trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc@ 1580

Last change on this file since 1580 was 1575, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 23.4 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@uni-sw.gwdg.de>
19! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
20!
21! Copyright: MAGIC Software Development, 2000-2001
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MCT1ReadPreProc
29//
30// Reads a output file of the CT1 preproc.
31//
32// Input Containers:
33// -/-
34//
35// Output Containers:
36// MCerPhotEvt the data container for all data.
37// MPedestalCam ct1 pedestals
38// MMcEvt monte carlo data container for MC files
39// MMcTrig mc data container for trigger information
40// MSrcPosCam source position in the camera
41// MBlindPixels Array holding blind pixels
42//
43/////////////////////////////////////////////////////////////////////////////
44
45#include "MCT1ReadPreProc.h"
46
47#include <fstream.h>
48
49#include <TList.h>
50#include <TSystem.h>
51
52#define LINUX
53#define HISTO void
54#define HBOOK_FILE int
55#include "defines.h"
56#include "structures.h"
57
58#include "MLog.h"
59#include "MLogManip.h"
60
61#include "MParList.h"
62#include "MCerPhotEvt.h"
63
64#include "MPedestalPix.h"
65#include "MPedestalCam.h"
66
67#include "MGeomCam.h"
68#include "MSrcPosCam.h"
69#include "MBlindPixels.h"
70
71#include "MMcEvt.hxx"
72#include "MMcTrig.hxx"
73
74ClassImp(MCT1ReadPreProc);
75
76// --------------------------------------------------------------------------
77//
78// Default constructor. Creates an array which stores the file names of
79// the files which should be read. If a filename is given it is added
80// to the list.
81//
82MCT1ReadPreProc::MCT1ReadPreProc(const char *fname, const char *name,
83 const char *title) : fIn(NULL)
84{
85 fName = name ? name : "MCT1ReadPreProc";
86 fTitle = title ? title : "Task to loop over events in CT1 ascii file";
87
88 //
89 // remember file name for opening the file in the preprocessor
90 //
91 fFileNames = new TList;
92 fFileNames->SetOwner();
93
94 if (fname)
95 AddFile(fname);
96}
97
98// --------------------------------------------------------------------------
99//
100// Delete the filename list and the input stream if one exists.
101//
102MCT1ReadPreProc::~MCT1ReadPreProc()
103{
104 delete fFileNames;
105 if (fIn)
106 delete fIn;
107}
108
109// --------------------------------------------------------------------------
110//
111// Add this file as the last entry in the chain
112//
113void MCT1ReadPreProc::AddFile(const char *txt)
114{
115 TNamed *name = new TNamed(txt, "");
116 fFileNames->AddLast(name);
117}
118
119// --------------------------------------------------------------------------
120//
121// Print data from the header to the screen and analyse the header data,
122// means store and copy the needed data into Mars structures and
123// data members
124//
125void MCT1ReadPreProc::ProcessHeader(const struct outputpars &outpars)
126{
127 fNumPixels = outpars.inumpixels; // number of pixels in the camera
128
129 if (fNumPixels>iMAXNUMPIX || fNumPixels==0)
130 fNumPixels=iMAXNUMPIX;
131
132 //
133 // ------------------- Output some stuff -----------------------
134 //
135
136 // int itelescope; // number of the CT which took the data
137 *fLog << inf << "Telescope: CT" << outpars.itelescope;
138
139 // float flongitude_deg; // longitude (counted positive towards West) of CT position */
140 // float flatitude_deg; // latitude (counted positive towards North) of CT position */
141 *fLog << " located @ Longitude=" << outpars.flongitude_deg;
142 *fLog << "deg Latitude=" << outpars.flatitude_deg << "deg" << endl;
143
144 // int irunnum; // run number (from parameters file)
145 // enum onoroff {NEITHER_ON_NOR_OFF, OFF_SOURCE, ON_SOURCE} eruntype; // runtype
146 *fLog << "Run: #" << outpars.irunnum << " (";
147 switch (outpars.eruntype)
148 {
149 case NEITHER_ON_NOR_OFF: *fLog << "unknown"; break;
150 case OFF_SOURCE: *fLog << "off-source"; break;
151 case ON_SOURCE: *fLog << "on-source"; break;
152 default: *fLog << (int)outpars.eruntype; break;
153 }
154 *fLog << ", ";
155 switch (outpars.etrackmode)
156 {
157 case NORMAL: *fLog << "normal tracking"; break;
158 case REVERSE: *fLog << "reverse tracking"; break;
159 case DUNNO: *fLog << "unknown tracking"; break;
160 default: *fLog << (int)outpars.etrackmode; break;
161 }
162 *fLog << ")" << endl;
163
164 //double dsourcera_hours; // right ascension of observed source in hours
165 //double dsourcedec_deg; // declination of observed source in degrees
166 *fLog << "Source: RA=" << outpars.dsourcera_hours << "h DEC=";
167 *fLog << outpars.dsourcedec_deg << "deg" << endl;
168
169 *fLog << "Pixels: " << fNumPixels << endl;
170
171 //int inummuonpixels; // number of pixels in the muon shield
172 //int inumcointdcs; // number of coincidence tdcs recorded in the runfile
173 //float fpixdiameter_deg; // smallest pixel diameter (degrees) (from parameters file) */
174
175 // enum axes {RA, DEC, ALT, AZ} ese1_is; // name of the axis to which shaft encoder 1 is attached (implies the type of mount)
176 *fLog << "Shaftencoder 1 @ ";
177 switch (outpars.ese1_is)
178 {
179 case RA: *fLog << "RA"; break;
180 case DEC: *fLog << "DEC"; break;
181 case ALT: *fLog << "ALT"; break;
182 case AZ: *fLog << "AZ"; break;
183 default: *fLog << (int)outpars.ese1_is; break;
184 }
185 *fLog << endl;
186
187 // int isezeropos[2]; // zero position of shaftencoders 1 and 2 (from parameters file)
188 *fLog << "SE Zero: SE(1)=" << outpars.isezeropos[0] << " ";
189 *fLog << "SE(2)=" << outpars.isezeropos[1] << endl;
190
191 // int iaz_rev_track_corr; // correction for the azimuth shaft encoder (ALT/AZ mount only) in reverse tracking mode
192 // int ialt_rev_track_corr; // correction for the altitude shaft encoder (ALT/AZ mount only) in reverse tracking mode
193 *fLog << "Reverse tracking corrections: SE(az)=" << outpars.iaz_rev_track_corr;
194 *fLog << " SE(alt)=" << outpars.ialt_rev_track_corr << endl;
195
196 // float fbendingcorr; // bending correction factor (ALT/AZ mount only)
197 // float fextinction; // atmospheric extinction (typically taken from the Carlsberg Meridian Circle data)
198 *fLog << "Bending: Correction factor=" << outpars.fbendingcorr << " ";
199 *fLog << "Extinction=" << outpars.fextinction << endl;
200
201 // Boolean bdontusepix[iMAXNUMPIX]; // bdontusepix is set true if the pixel should not be used in image analysis, otherwise it is true;
202 fBlinds->Clear();
203 *fLog << "Don't use pixels: ";
204 for (int i=0; i<iMAXNUMPIX; i++)
205 if (outpars.bdontusepix[i])
206 {
207 *fLog << i << " ";
208 fBlinds->SetPixelBlind(i);
209 }
210 *fLog << endl;
211
212 *fLog << "Exclude: ";
213 // Boolean bexcludepix[iMAXNUMPIX];
214 for (int i=0; i<iMAXNUMPIX; i++)
215 if (outpars.bdontusepix[i])
216 *fLog << i << " ";
217 *fLog << endl;
218 /* bexcludepix[] is set TRUE (== exclude from pedestal, Laser
219 * calibration and the further analysis) when the Mean value
220 * of a pixel inside a pedestal Run is larger than 50 or ( || )
221 * if the pedestal RMS value of this pixel is larger than 5.0
222 * This is reflected in the (new for versions >= 0.4)
223 * variable "pixonoff" in the ntuple written by preproc:
224 * preproc.nt.hbook
225 *
226 * When the pixel is excluded by the user it will get a -2 otherwise
227 * pixonoff = 0.
228 * Additive to this a -1 is added when preproc excludes the pixel
229 * for a given Run. So the actual value tells you whether you caught
230 * it already by hand or not.
231 *
232 * A plot of pixonoff may also be handy to tell you the status of your
233 * ADC equipment. */
234
235 // float fphotoel_per_adccnt[iMAXNUMPIX]; // conversion factors for the pixel signals */
236 /*
237 float padc = outpars.fphotoel_per_adccnt[0];
238 *fLog << "Phe/ADC (pixel 0): " << padc << endl;
239 for (int i=0; i<iMAXNUMPIX; i++)
240 *fLog << outpars.fphotoel_per_adccnt[i] << " ";
241 *fLog << endl;
242 */
243 /*
244 --- USEFULL? NEEDED? ---
245 int irubminusutc_usecs; // difference between rubidium clock and UTC in microseconds
246 int isum_thresh_phot; // threshold for the total sum of photoelectrons filter
247 int i2out_thresh_phot; // threshold for the two-pixels-out-of-all software
248 int imuoncut_thresh_adccnt[iMAXNUMMUONPIX]; // thresholds for the muon cut
249 Boolean bmuon_suppression; // "Dolby" noise reduction flag
250 float ftolerated_pointerror_deg; // maximum tolerated pointing error in the position
251 */
252
253 // float fxpointcorr_deg; // pointing correction (to be added along the camera x axis) e.g. from point run */
254 // float fypointcorr_deg; // pointing correction (to be added along the camera y axis) e.g. from point run */
255 *fLog << "Pointing correction: dx=" << outpars.fxpointcorr_deg << "deg ";
256 *fLog << "dy=" << outpars.fxpointcorr_deg << "deg" << endl;
257
258 /*
259 fSrcPos->SetXY( outpars.fxpointcorr_deg/fGeom->GetConvMm2Deg(),
260 outpars.fypointcorr_deg/fGeom->GetConvMm2Deg());
261 */
262
263 /*
264 --- USEFULL? NEEDED? ---
265 float fcamera_align_angle_deg; // the angle between the camera y-axis and the meridian when a culminating object is observed (defined counter-clockwise looking at the sky)
266 int iratecalc_numevents_odd; // number of events used in the rate calculation (must be odd)
267 int inumpedfile; // number of the pedestal file used
268 int inumpedrun; // number of the pedestal run used in the file (starting at 0)
269 int inumcalfile; // number of the calibration file used
270 int inumlaserrun; // number of the laserrun used in the file (starting at 0)
271 int inumtellogfile; // number of the TelLog file to be used
272 int inumtellogrun; // number of the tellog entry (Runnumber) used from the log file
273 int imcparticle; // CORSIKA-coded Monte Carlo particle type.
274 */
275
276 // ----- preprocessing results -----
277
278 // int istart_mjdate_day; // MJD of run start (first event) */
279 // int iend_mjdate_day; // MJD of run end (last event) */
280 // int irunduration_secs; // difference between start and end time (secs) */
281 *fLog << "Run Time: From " << outpars.istart_mjdate_day << " to ";
282 *fLog << outpars.iend_mjdate_day << " (MJD), Duration=";
283 *fLog << outpars.irunduration_secs/3600 << "h";
284 *fLog << (outpars.irunduration_secs/60)%60 << "m";
285 *fLog << outpars.irunduration_secs%60 << "s" << endl;
286
287 /*
288 --- USEFULL? NEEDED? ---
289 int iproc_mjdate; // MJD of data processing (i.e. creation of this file)
290 */
291
292 // int iproc_evts; // number of events processed */
293 *fLog << "Number of processed events: " << outpars.iproc_evts << endl;
294
295 // --- USEFULL? NEEDED? ---
296 // double dactual_sourcera_hours; // for off runs: the false source (that should have been) observed */
297
298 // float frms_pedsig_phot[iMAXNUMPIX]; // standard deviation of the calibrated signals from the pedestal run */
299 fPedest->InitSize(iMAXNUMPIX);
300 for (Int_t i=0; i<iMAXNUMPIX; i++)
301 (*fPedest)[i].SetMeanRms(outpars.frms_pedsig_phot[i]);
302
303 // Used to communicate the mean over all pixels
304 // pedestal RMS into the Runs NTuple, as it might
305 // be used for e.g. quality cuts.
306 // float fpedrms_mean;
307 *fLog << "Pedestal RMS: " << outpars.fpedrms_mean << endl;
308
309 // The average current over the active pixels
310 // for this run. This is done separately for
311 // ON and OF runs.
312 //float fcurrent_mean;
313
314 // enum eERRORTOLERANCE {CAUTIOUS=0, GOODPHYSICS, TANK} eerrortolerance;
315 /* 0 == "cautious", exits on any reason (but tells in
316 * the .err file,
317 * 1 == "goodphysics", exits when physics could be affected
318 * by the error,
319 * 2 == "tank", never exits except on coredumps and when
320 * all files have been processed. Do not use such files for
321 * physics analysis!
322 *
323 * NOTE: the capital letter words are the enums, the small letter
324 * words must be used inside the parameter file. */
325
326 // enum eMCTRIGGERFLAG {ALL=0, FLAG, NOFLAG} emctriggerflag;
327 /* all: all events which survive the filter are written to the
328 * events NTuple.
329 * flag: When Dorota's triggerflag is set to 1 for a particular
330 * event, it shall be written to the output. All others shall
331 * just be disregarded. (Default)
332 * noflag: Opposite of 'flag': only events with triggerflag = 0 shall
333 * be treated further. */
334
335 if (outpars.bmontecarlo)
336 *fLog << "File is a Monte Carlo file." << endl;
337
338 fIsMcFile = outpars.bmontecarlo==TRUE;
339}
340
341// --------------------------------------------------------------------------
342//
343// Read CT1 PreProc File Header:
344//
345void MCT1ReadPreProc::ReadHeader()
346{
347 char cheadertitle[iHEADERTITLELENGTH];
348 fIn->read(cheadertitle, iHEADERTITLELENGTH);
349
350 *fLog << cheadertitle << flush;
351
352 // cTITLE_TEMPLATE "PREPROC V%f/S%f CT %d RUN %d %d PROCMJD %d\n"
353 struct outputpars outpars;
354
355 Float_t fpreprocversion, structversion;
356 sscanf(cheadertitle, cTITLE_TEMPLATE,
357 &fpreprocversion, &structversion,
358 &outpars.itelescope, &outpars.irunnum,
359 &outpars.eruntype, &outpars.iproc_mjdate);
360
361 if (STRUCT_VERSION != structversion)
362 {
363 *fLog << warn << "WARNING: Version of C-structures of file (V";
364 *fLog << structversion << ") not identical with current structures (V";
365 *fLog << STRUCT_VERSION << ")" << endl;
366 }
367
368 fIn->read((Byte_t*)&outpars, sizeof(struct outputpars));
369
370 ProcessHeader(outpars);
371}
372
373void MCT1ReadPreProc::ReadFooter()
374{
375 char cheadertitle[iHEADERTITLELENGTH];
376 fIn->read(cheadertitle, iHEADERTITLELENGTH);
377 /*
378 ssscanf(cheadertitle, cEND_EVENTS_TEMPLATE,
379 &filterres.ifilter_passed_evts);
380 */
381
382 struct filterresults filterres;
383 fIn->read((Byte_t*)&filterres, sizeof(struct filterresults));
384 /*
385 int imax_alt_arcs; // maximum altitude reached during the run
386 int iaz_at_max_alt_arcs; // azimuth at the time the max. alt. was reached
387 int itimeaverage_alt_arcs; // altitude averaged over the runtime
388 int icoord_inconsist_evts; // number of events with time-coordinate inconsistency in this run
389 int ifilter_passed_evts; // number of events which passed the filter
390 int imuon_fail_evts; // number of events rejected as muons (other filters passed)
391 int i2out_fail_evts; // number of events which failed in the two out of all pixels software trigger
392 int imuon_and_2out_fail_evts; // number of events failing in both muon and 2out filter
393 int isum_fail_evts; // number of events which failed the sum-of-all-calibrated ADC counts filter
394 int isum_and_muon_fail_evts; // number of events which failed in both the sum and the muon filter
395 int isum_and_2out_fail_evts; // number of events which failed in both the sum and the 2out filter
396 int iall_filters_fail_evts; // number of events which failed in all filters
397 float favg_event_rate_hz; // average rate before filtering
398 float fstddev_event_rate_hz; // standard deviation of the rate before filtering
399 */
400}
401
402// --------------------------------------------------------------------------
403//
404// This opens the next file in the list and deletes its name from the list.
405//
406Bool_t MCT1ReadPreProc::OpenNextFile()
407{
408 //
409 // open the input stream and check if it is really open (file exists?)
410 //
411 if (fIn)
412 delete fIn;
413 fIn = NULL;
414
415 //
416 // Check for the existance of a next file to read
417 //
418 TNamed *file = (TNamed*)fFileNames->First();
419 if (!file)
420 return kFALSE;
421
422 //
423 // open the file which is the first one in the chain
424 //
425 const char *name = file->GetName();
426
427 fIn = new ifstream(gSystem->ExpandPathName(name));
428
429 if (!(*fIn))
430 {
431 *fLog << dbginf << "Cannot open file '" << name << "'" << endl;
432 return kFALSE;
433 }
434
435 *fLog << "Open file: '" << name << "'" << endl;
436
437 //
438 // Remove this file from the list of pending files
439 //
440 fFileNames->Remove(file);
441
442 *fLog << inf << "-----------------------------------------------------------------------" << endl;
443 const Int_t sizef = sizeof(struct filterresults)+iHEADERTITLELENGTH;
444 const Int_t sizeh = sizeof(struct outputpars) +iHEADERTITLELENGTH;
445
446 fIn->seekg(0, ios::end);
447 const Int_t filesize = fIn->tellg();
448
449 fIn->seekg(filesize-sizef, ios::beg);
450 ReadFooter();
451 fIn->seekg(0, ios::beg);
452 ReadHeader();
453
454 struct eventrecord event;
455 const int size1 = sizeof(event)-sizeof(event.spixsig_10thphot);
456 const int size2 = sizeof(event.spixsig_10thphot[0])*fNumPixels;
457 const int evtsize = size1+size2;
458
459 *fLog << "Storage for events: " << filesize-sizef-sizeh << "b" << endl;
460 *fLog << "Size of one Event: " << evtsize << "b" << endl;
461
462 fNumEvents = (filesize-sizef-sizeh)/evtsize-1;
463 fNumEvent = 0;
464
465 *fLog << "Calculated Number of Events: " << (float)(filesize-sizef-sizeh)/evtsize << " " << (filesize-sizef-sizeh)%evtsize << endl;
466
467 *fLog << "-----------------------------------------------------------------------" << endl;
468
469 return kTRUE;
470}
471
472// --------------------------------------------------------------------------
473//
474// Open the first file in the list. Check for the output containers or create
475// them if they don't exist.
476//
477// Initialize the size of the MPedestalCam container to 127 pixels (CT1 camera)
478//
479Bool_t MCT1ReadPreProc::PreProcess(MParList *pList)
480{
481 //
482 // look for the MCerPhotEvt class in the plist
483 //
484 fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
485 if (!fNphot)
486 return kFALSE;
487
488 //
489 // look for the pedestal class in the plist
490 //
491 fPedest = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
492 if (!fPedest)
493 return kFALSE;
494
495 //
496 // look for the pedestal class in the plist
497 //
498 fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels");
499 if (!fBlinds)
500 return kFALSE;
501
502 //
503 // look for the source position in the camera
504 //
505 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam");
506 if (!fSrcPos)
507 return kFALSE;
508
509 //
510 // look for the camera geometry
511 //
512 fGeom = (MGeomCam*)pList->FindCreateObj("MGeomCamCT1", "MGeomCam");
513 if (!fGeom)
514 return kFALSE;
515
516 //
517 // look for the mc event class
518 //
519 fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt");
520 if (!fMcEvt)
521 return kFALSE;
522
523 //
524 // look for the mc trigger class
525 //
526 fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig");
527 if (!fMcTrig)
528 return kFALSE;
529
530 //
531 // Try to open at least one (the first) file
532 //
533 if (!OpenNextFile())
534 return kFALSE;
535
536 return kTRUE;
537}
538
539// --------------------------------------------------------------------------
540//
541// Analyse the event data, means store and copy the needed data into
542// Mars structures and data members
543//
544void MCT1ReadPreProc::ProcessEvent(const struct eventrecord &event)
545{
546 /*
547 --- USEFULL? NEEDED? ---
548 int isecs_since_midday; // seconds passed since midday before sunset (JD of run start)
549 int isecfrac_200ns; // fractional part of isecs_since_midday
550 short snot_ok_flags; // the bits in these two bytes are flags for additional information on the event: Everything OK =: all Bits = 0
551 int ialt_arcs; // altitude (arcseconds)
552 int iaz_arcs; // azimuth (arcseconds)
553 int ipreproc_alt_arcs; // "should be" alt according to preproc (arcseconds)
554 int ipreproc_az_arcs; // "should be" az according to preproc (arcseconds)
555
556 // for ALT-AZ mount telescopes: rotation angle of the field of
557 // view; this angle is defined mathematically positive looking
558 // towards the sky as the angle between the hour circle through
559 // the object being tracked and the line through pixel 1 and 2
560 int ifieldrot_arcs;
561
562 // event rate in milli Hertz before filtering calculated by
563 // iratecalc_numevents_odd/(time[i+iratecalc_numevents_odd/2] -
564 // time[i-iratecalc_numevents_odd/2])
565 // For the first and the last iratecalc_numevents_odd/2
566 // events the rate is assumed to be constant
567 unsigned short srate_millihz;
568
569 // This is the angle between the observation of this event and the
570 // culmination point. It is going to be written into the events NTuple.
571 float fhourangle;
572 */
573 /*
574 *fLog << event.isecs_since_midday << "s ";
575 *fLog << event.ialt_arcs << "s ";
576 *fLog << event.iaz_arcs << "s ";
577 *fLog << event.ipreproc_alt_arcs << "s ";
578 *fLog << event.ipreproc_az_arcs << "s ";
579 *fLog << event.ifieldrot_arcs << "s ";
580 *fLog << event.fhourangle << endl;
581 */
582
583 //
584 // read in the number of cerenkov photons and add the 'new' pixel
585 // too the list with it's id, number of photons and error
586 //
587 fNphot->InitSize(fNumPixels);
588
589 // number of photoelectrons measured in each pixel only the
590 // actual number of pixels (outputpars.inumpixels) is written out
591 // short spixsig_10thphot[iMAXNUMPIX];
592 for (Int_t i=0; i<fNumPixels; i++)
593 {
594 if (event.spixsig_10thphot[i]>0)
595 fNphot->AddPixel(i, 0.1*event.spixsig_10thphot[i],
596 (*fPedest)[i].GetMeanRms());
597 }
598
599 if (!fIsMcFile)
600 return;
601
602 fMcEvt->SetPartId(event.imcparticle); // corsika particle type
603 fMcEvt->SetEnergy(event.fmcenergy_tev*1000); // simulated energy
604 fMcEvt->SetImpact(event.imcimpact_m*100); // simulated impact
605
606 fMcTrig->SetFirstLevel(event.imctriggerflag); // MC data from Dorota get a triggerflag: 1 means triggered, 0 not. */
607
608 //float fmcsize_phel; // Simulated SIZE
609}
610
611// --------------------------------------------------------------------------
612//
613// Check for the event number and depending on this number decide if
614// pedestals or event data has to be read.
615//
616// If the end of the file is reached try to open the next in the list. If
617// there is now next file stop the eventloop.
618//
619Bool_t MCT1ReadPreProc::Process()
620{
621 //
622 // check if we are done. Try to open the next file in chain.
623 // If it was possible start reading. If not break the event loop
624 //
625 if (fNumEvent++==fNumEvents-1)
626 return OpenNextFile() ? kCONTINUE : kFALSE;
627
628 // event data to be read from the file
629 struct eventrecord event;
630
631 const int size1 = sizeof(event)-sizeof(event.spixsig_10thphot);
632 const int size2 = sizeof(event.spixsig_10thphot[0])*fNumPixels;
633
634 // read the eventrecord with the recorded number of stored pixels
635 fIn->read((Byte_t*)&event, size1+size2);
636
637 ProcessEvent(event);
638
639 return kTRUE;
640}
641
Note: See TracBrowser for help on using the repository browser.