Changeset 18447


Ignore:
Timestamp:
03/08/16 13:11:42 (9 years ago)
Author:
ftemme
Message:
Implemented the method AsciiWrite for MPhotonEvent
Location:
trunk/Mars/msim
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/msim/MPhotonEvent.cc

    r10167 r18447  
    307307}
    308308
     309// Overload the AsciiWrite method to store the informations of the photons onto disc.
     310// For each corsika/pedestal... event there is a simple header written. After this
     311// the informations for each photon are written in one line.
     312Bool_t MPhotonEvent::AsciiWrite(ostream &out) const
     313{
     314    // Write a simple header. Be aware there will be written one header for each
     315    // corsika/pedestal... event. Each photon of the event will be written in one
     316    // line.
     317    out << "#";
     318    out << "photonID" << ",";
     319    out << "tag" << ",";
     320    out << "mirrorTag" << ",";
     321    out << "posX" << ",";
     322    out << "posY" << ",";
     323    out << "cosU" << ",";
     324    out << "cosV" << ",";
     325    out << "time" << ",";
     326    out << "weight" << ",";
     327    out << "wavelength" << ",";
     328    out << "productionHeight" << ",";
     329    out << "primaryID" << endl;
     330
     331    // Get number of photons
     332    const Int_t num = GetNumPhotons();
     333
     334    // Loop over all photons
     335    for (Int_t i=0; i<num; i++)
     336    {
     337        // Get i-th photon
     338        const MPhotonData &ph = operator[](i);
     339
     340        out << i << "," ;
     341        out << ph.GetTag() << "," ;
     342        out << ph.GetMirrorTag() << "," ;
     343        out << ph.GetPosX() << "," ;
     344        out << ph.GetPosY() << "," ;
     345        out << ph.GetCosU() << "," ;
     346        out << ph.GetCosV() << "," ;
     347        out << ph.GetTime() << "," ;
     348        out << ph.GetWeight() << "," ;
     349        out << ph.GetWavelength() << "," ;
     350        out << ph.GetProductionHeight() << "," ;
     351        out << ph.GetPrimary() << endl ;
     352    }
     353    return kTRUE;
     354}
     355
    309356// --------------------------------------------------------------------------
    310357//
  • trunk/Mars/msim/MPhotonEvent.h

    r10060 r18447  
    4343    TClonesArray &GetArray() { return fData; }
    4444    const TClonesArray &GetArray() const { return fData; }
     45
     46    Bool_t AsciiWrite(ostream &out) const;
    4547
    4648    MPhotonData &Add(Int_t n);
Note: See TracChangeset for help on using the changeset viewer.