Changeset 12605


Ignore:
Timestamp:
11/21/11 17:55:18 (13 years ago)
Author:
tbretz
Message:
Implemented counters for the different trigger types and time of first and last event.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DataWriteFits.cc

    r12494 r12605  
    44#include "FAD.h"
    55#include "Converter.h"
     6
    67
    78using namespace std;
     
    177178    }
    178179
     180    // This is a workaround for the missing information in the event builder
     181    fTstart[0] = 0;
     182    fTstop[0]  = 0;
     183
    179184    //Last but not least, add header keys that will be updated when closing the file
    180185    return WriteFooter(NULL);
     
    190195    if (!fFile.AddRow())
    191196        return false;
    192     int realRoiTM = (e->RoiTM > e->Roi) ? e->Roi : 0;
     197
     198    if (!(e->TriggerType & FAD::EventHeader::kAll))
     199        fTriggerCounter[0]++;
     200    else  if ((e->TriggerType&FAD::EventHeader::kPedestal) && !(e->TriggerType&FAD::EventHeader::kTIM))
     201        fTriggerCounter[1]++;
     202    else if (e->TriggerType & FAD::EventHeader::kLPext)
     203        fTriggerCounter[2]++;
     204    else if (e->TriggerType & (FAD::EventHeader::kTIM|FAD::EventHeader::kPedestal))
     205        fTriggerCounter[3]++;
     206    else if (e->TriggerType & FAD::EventHeader::kLPint)
     207        fTriggerCounter[4]++;
     208    else if (e->TriggerType & FAD::EventHeader::kExt1)
     209        fTriggerCounter[5]++;
     210    else if (e->TriggerType & FAD::EventHeader::kExt2)
     211        fTriggerCounter[6]++;
     212    else
     213        fTriggerCounter[7]++;
     214
     215    memcpy(fTstop, &e->PCTime, 2*sizeof(uint32_t));
     216    if (fTstart[0]==0)
     217        memcpy(fTstart, fTstop, 2*sizeof(uint32_t));
     218
     219    const int realRoiTM = (e->RoiTM > e->Roi) ? e->Roi : 0;
    193220    const size_t sz = sizeof(EVENT) + sizeof(e->StartPix)*e->Roi+sizeof(e->StartTM)*realRoiTM; //ETIENNE from RoiTm to Roi
    194221
     
    216243        //FIXME shouldn't we also add an MjD reference ?
    217244
    218         fFile.WriteKey("TSTART",   rt ? rt->PCtime0    : uint32_t(0),
     245        const Time start(fTstart[0], fTstart[1]);
     246        const Time stop (fTstop[0],  fTstop[1]);
     247
     248        fFile.WriteKey("TSTART",   start.Iso(),
    219249                       "Time when first event received");
    220250
    221         fFile.WriteKey("TSTOP",    rt ? rt->PCtimeX    : uint32_t(0),
     251        fFile.WriteKey("TSTOP",    stop.Iso(),
    222252                       "Time when last event received");
     253
     254        fFile.WriteKey("NTRG",     fTriggerCounter[0], "Number of physics triggers written");
     255        fFile.WriteKey("NTRGPED",  fTriggerCounter[1], "Number of pure pedestal triggers written");
     256        fFile.WriteKey("NTRGLPE",  fTriggerCounter[2], "Number of external light pulser triggers written");
     257        fFile.WriteKey("NTRGTIM",  fTriggerCounter[3], "Number of time calibration triggers written");
     258        fFile.WriteKey("NTRGLPI",  fTriggerCounter[4], "Number of internal light pulser triggers written");
     259        fFile.WriteKey("NTRGEXT1", fTriggerCounter[5], "Number of triggers from ext1 written");
     260        fFile.WriteKey("NTRGEXT2", fTriggerCounter[6], "Number of triggers from ext2 written");
     261        fFile.WriteKey("NTRGMISC", fTriggerCounter[7], "Number of triggers belonging to no other category written");
    223262    }
    224263    catch (const CCfits::FitsException &e)
  • trunk/FACT++/src/DataWriteFits.h

    r12478 r12605  
    44#include "DataProcessorImp.h"
    55#include "FitsFile.h"
     6
     7#include <array>
    68
    79class Converter;
     
    1214
    1315    FitsFile fFile;
     16
     17    std::array<uint32_t, 8> fTriggerCounter;
     18
     19    uint32_t fTstart[2];
     20    uint32_t fTstop[2];
    1421
    1522    template <typename T>
Note: See TracChangeset for help on using the changeset viewer.