Changeset 1583


Ignore:
Timestamp:
11/06/02 16:50:54 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1577 r1583  
    11                                                                  -*-*- END -*-*-
     2 2002/11/06: Thomas Bretz
     3
     4   * Makfile.conf.osf5.1:
     5     - added
     6
     7   * mhist/MHMatrix.cc:
     8     - changed all math.h functions or similar to TMath
     9     - added 2*pow(rows, 1/(4+cols))^2 as the standard kernel window
     10
     11   * mfileio/MCT1ReadPreProc.cc:
     12     - corrected the reading routines
     13
     14   * mfileio/*.cc:
     15     - changed my eMail address
     16
     17   * mfileio/structures.h:
     18     - small changes to make it architecture independant
     19
     20
     21
    222 2002/11/04: Thomas Bretz
    323
     
    107127     - removed an unused variable to get rid of a compiler warning on Alpha
    108128
     129
     130
    109131 2002/10/31: Wolfgang Wittek
    110132
    111133   * mhist/MHFlux.[h,cc]:
    112134     - type of fVarname and fUnit changed from char* to TString
     135
    113136
    114137
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.cc

    r1574 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!   Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2001
     21!   Copyright: MAGIC Software Development, 2000-2002
    2222!
    2323!
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc

    r1575 r1583  
    211211
    212212    *fLog << "Exclude: ";
     213
    213214    // Boolean bexcludepix[iMAXNUMPIX];
    214215    for (int i=0; i<iMAXNUMPIX; i++)
    215         if (outpars.bdontusepix[i])
     216        if (outpars.bexcludepix[i])
     217        {
    216218            *fLog << i << " ";
     219            fBlinds->SetPixelBlind(i);
     220        }
    217221    *fLog << endl;
     222
    218223    /* bexcludepix[] is set TRUE (== exclude from pedestal, Laser
    219224     * calibration and the further analysis) when the Mean value
     
    254259    // float fypointcorr_deg; // pointing correction (to be added along the camera y axis) e.g. from point run */
    255260    *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      */
     261    *fLog << "dy=" << outpars.fypointcorr_deg << "deg" << endl;
     262
     263    // FIXME? Is x-y echanged between Mars CT1 geometry and CT1 definition?
     264    fSrcPos->SetXY(outpars.fypointcorr_deg/fGeom->GetConvMm2Deg(),
     265                   outpars.fxpointcorr_deg/fGeom->GetConvMm2Deg());
    262266
    263267    /*
     
    333337     *         be treated further. */
    334338
    335     if (outpars.bmontecarlo)
    336         *fLog << "File is a Monte Carlo file." << endl;
     339    *fLog << "File is a ";
     340    *fLog << (outpars.bmontecarlo ? "Monte Carlo" : "Real Data");
     341    *fLog << " file." << endl;
    337342
    338343    fIsMcFile = outpars.bmontecarlo==TRUE;
     
    343348// Read CT1 PreProc File Header:
    344349//
    345 void MCT1ReadPreProc::ReadHeader()
     350Bool_t MCT1ReadPreProc::ReadHeader()
    346351{
    347352    char cheadertitle[iHEADERTITLELENGTH];
    348353    fIn->read(cheadertitle, iHEADERTITLELENGTH);
    349354
     355    TString s = cheadertitle;
     356    TString m = cTITLE_TEMPLATE;
     357
     358    if (!s.BeginsWith(m(0, m.First('%'))))
     359        return kFALSE;
     360
    350361    *fLog << cheadertitle << flush;
    351362
    352363    // cTITLE_TEMPLATE "PREPROC V%f/S%f CT %d RUN %d %d PROCMJD %d\n"
    353364    struct outputpars outpars;
     365
     366    int dummy;
    354367
    355368    Float_t fpreprocversion, structversion;
     
    357370           &fpreprocversion,    &structversion,
    358371           &outpars.itelescope, &outpars.irunnum,
    359            &outpars.eruntype,   &outpars.iproc_mjdate);
     372           &dummy/*&outpars.eruntype*/,   &outpars.iproc_mjdate);
    360373
    361374    if (STRUCT_VERSION != structversion)
     
    369382
    370383    ProcessHeader(outpars);
    371 }
    372 
    373 void MCT1ReadPreProc::ReadFooter()
     384
     385    return kTRUE;
     386}
     387
     388Bool_t MCT1ReadPreProc::ReadFooter()
    374389{
    375390    char cheadertitle[iHEADERTITLELENGTH];
    376391    fIn->read(cheadertitle, iHEADERTITLELENGTH);
    377392    /*
    378      ssscanf(cheadertitle, cEND_EVENTS_TEMPLATE,
    379              &filterres.ifilter_passed_evts);
     393     sscanf(cheadertitle, cEND_EVENTS_TEMPLATE,
     394     &filterres.ifilter_passed_evts);
    380395     */
    381396
     397    TString s = cheadertitle;
     398    TString m = cEND_EVENTS_TEMPLATE;
     399    Int_t p = m.First('%');
     400
     401    if (!s.BeginsWith(m(0,p)))
     402        return kFALSE;
     403
     404    *fLog << inf << cheadertitle << flush;
     405
    382406    struct filterresults filterres;
     407<<<<<<< MCT1ReadPreProc.cc
     408    fIn->read(&filterres, sizeof(struct filterresults));
     409
     410=======
    383411    fIn->read((Byte_t*)&filterres, sizeof(struct filterresults));
     412>>>>>>> 1.2
    384413    /*
    385414     int   imax_alt_arcs;            // maximum altitude reached during the run
     
    398427     float fstddev_event_rate_hz;    // standard deviation of the rate before filtering
    399428     */
     429
     430    return kTRUE;
    400431}
    401432
     
    441472
    442473    *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;
     474
     475    //*fLog << "File contains " << GetNumEvents() << " events." << endl;
     476
     477    Bool_t rc = ReadHeader();
     478
     479    if (!rc)
     480        *fLog << warn << "Unable to read header... skipping file." << endl;
     481
     482    return rc;
     483}
     484
     485Int_t MCT1ReadPreProc::GetNumEvents()
     486{
     487    Int_t n = 0;
     488
     489    while (!fIn->eof())
     490    {
     491        if (fIn->get()!=cEND_EVENTS_TEMPLATE[0])
     492            continue;
     493
     494        char cheadertitle[iHEADERTITLELENGTH];
     495        fIn->read(cheadertitle, iHEADERTITLELENGTH-1);
     496
     497        TString s = cheadertitle;
     498        TString m = cEND_EVENTS_TEMPLATE;
     499        Int_t p = m.First('%');
     500
     501        if (!s.BeginsWith(m(1,p-1)))
     502            continue;
     503
     504        int num;
     505
     506        sscanf(cheadertitle, &cEND_EVENTS_TEMPLATE[1], &num);
     507
     508        n += num;
     509    }
     510
     511    fIn->seekg(0);
     512
     513    return n;
    470514}
    471515
     
    526570    fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig");
    527571    if (!fMcTrig)
    528         return kFALSE;
    529 
    530     //
    531     // Try to open at least one (the first) file
    532     //
    533     if (!OpenNextFile())
    534572        return kFALSE;
    535573
     
    549587     int   isecfrac_200ns;     // fractional part of isecs_since_midday
    550588     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)
    553589     int   ipreproc_alt_arcs;  // "should be" alt according to preproc (arcseconds)
    554590     int   ipreproc_az_arcs;   // "should be" az according to preproc (arcseconds)
     
    573609    /*
    574610     *fLog << event.isecs_since_midday << "s ";
    575      *fLog << event.ialt_arcs << "s ";
    576      *fLog << event.iaz_arcs << "s ";
    577611     *fLog << event.ipreproc_alt_arcs << "s ";
    578612     *fLog << event.ipreproc_az_arcs << "s ";
     
    597631    }
    598632
     633    fMcEvt->SetTheta(TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600));   // altitude (arcseconds)
     634    fMcEvt->SetPhi(TMath::Pi()/180*event.iaz_arcs/3600);               // azimuth (arcseconds)
     635
    599636    if (!fIsMcFile)
    600637        return;
     
    611648// --------------------------------------------------------------------------
    612649//
     650// Because of the file format of the preproc output we have to check at any
     651// event where in the file stream we are...
     652//
     653Bool_t MCT1ReadPreProc::CheckFilePosition()
     654{
     655    //
     656    // Means: If no file is open (first call) try to open the first file
     657    //
     658    if (!fIn)
     659        return kFALSE;
     660
     661    //
     662    // If the first character isn't the first of the footer it must be
     663    // an event
     664    //
     665    if (fIn->peek()!=cEND_EVENTS_TEMPLATE[0])
     666        return kTRUE;
     667
     668    //
     669    // Remember the current position if the first character faked a
     670    // footer
     671    //
     672    const Int_t pos = fIn->tellg();
     673
     674    //
     675    // Try reading the footer. If it isn't succefull jump back...
     676    // must be an event
     677    //
     678    if (!ReadFooter())
     679    {
     680        fIn->seekg(pos, ios::beg);
     681        return kTRUE;
     682    }
     683
     684    *fLog << inf << "Footer found." << endl;
     685
     686    //
     687    // No after reading the footer check if we reached the end of the file
     688    //
     689    if (fIn->eof())
     690    {
     691        *fLog << "End of file." << endl;
     692        return kFALSE;
     693    }
     694
     695    //
     696    // If the eof isn't reached a new header must follow. Check for it.
     697    //
     698    if (fIn->peek()!=cTITLE_TEMPLATE[0])
     699    {
     700        *fLog << inf << "Error finding new run header in file (possible EOF)... skipping rest of file." << endl;
     701        return kFALSE;
     702    }
     703
     704    *fLog << "-----------------------------------------------------------------------" << endl;
     705    if (ReadHeader())
     706        return kTRUE;
     707
     708    *fLog << inf << "Error reading run header in file... skipping rest of file." << endl;
     709    return kFALSE;
     710}
     711
     712// --------------------------------------------------------------------------
     713//
    613714// Check for the event number and depending on this number decide if
    614715// pedestals or event data has to be read.
     
    620721{
    621722    //
    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;
     723    // Check where in the file we are. If neither a new event, nor a
     724    // footer/header combination is detected go to the next file.
     725    //
     726    if (!CheckFilePosition())
     727        if (!OpenNextFile())
     728            return kFALSE;
    627729
    628730    // event data to be read from the file
     
    637739    ProcessEvent(event);
    638740
     741    fNumEvent++;
     742
    639743    return kTRUE;
    640744}
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h

    r1574 r1583  
    3939    Bool_t OpenNextFile();
    4040
    41     void ReadPedestals();
    42     void ReadHeader();
    43     void ReadFooter();
    44     void ProcessHeader(const struct outputpars &outpars);
    45     void ProcessEvent(const struct eventrecord &event);
     41    Int_t  GetNumEvents();
     42
     43    void   ReadPedestals();
     44    Bool_t ReadHeader();
     45    Bool_t ReadFooter();
     46    Bool_t CheckFilePosition();
     47    void   ProcessHeader(const struct outputpars &outpars);
     48    void   ProcessEvent(const struct eventrecord &event);
    4649
    4750public:
  • trunk/MagicSoft/Mars/mfileio/MChain.cc

    r1472 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
  • trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc

    r1569 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r1572 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
  • trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc

    r1408 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  06/2001 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  06/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
  • trunk/MagicSoft/Mars/mfileio/MWriteFile.cc

    r1381 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  06/2001 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  06/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2002
    2121!
    2222!
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r1549 r1583  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  06/2001 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz  06/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2002
    2121!
    2222!
  • trunk/MagicSoft/Mars/mfileio/structures.h

    r1574 r1583  
    102102  /* file name) */
    103103  enum onoroff eruntype;
     104#ifdef LINUX
     105  int dummy;
     106#endif
    104107  /* indicates if the */
    105108  /* run is on- or off source (from runfile cross checked with */
     
    122125  float   fpixdiameter_deg;
    123126  /* smallest pixel diameter (degrees) (from parameters file) */
    124   axes ese1_is;
     127  enum axes ese1_is;
    125128  /* name of the axis to which shaft encoder 1 is attached */
    126129  /* (implies the type of mount) */
     
    218221  /* tracking mode (for ALT/AZ CTs) */
    219222  int     iproc_evts;
     223#ifdef LINUX
     224  int dummy2;
     225#endif
    220226  /* number of events processed */
    221227  double  dactual_sourcera_hours;
     
    867873  /* y position relative to the central CT for each CT */
    868874};
    869 
    870 
    871875#endif
    872876
Note: See TracChangeset for help on using the changeset viewer.