Changeset 9941 for trunk/Mars/msim


Ignore:
Timestamp:
09/24/10 15:35:55 (14 years ago)
Author:
tbretz
Message:
Implemented reading of a single telescope from an eventio file.
Location:
trunk/Mars/msim
Files:
3 edited

Legend:

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

    r9937 r9941  
    4747
    4848#include <TMath.h>
     49#include <TRandom.h>
    4950
    5051#include "MLog.h"
     
    171172// --------------------------------------------------------------------------
    172173//
     174// Set the wavelength to a random lambda^-2 distributed value
     175// between wmin and wmax.
     176//
     177void MPhotonData::SimWavelength(Float_t wmin, Float_t wmax)
     178{
     179    const Double_t w = gRandom->Uniform(wmin, wmax);
     180
     181    fWavelength = TMath::Nint(wmin*wmax / w);
     182}
     183
     184
     185// --------------------------------------------------------------------------
     186//
    173187// Set the data member according to the 8 floats read from a reflector-file.
    174188// This function MUST reset all data-members, no matter whether these are
     
    255269Int_t MPhotonData::FillEventIO(Float_t f[8])
    256270{
    257     if (TMath::Nint(f[6])!=1)
    258     {
    259         gLog << err << "ERROR - Bunch sizes != 1 are not supported." << endl;
    260         return kFALSE;
    261     }
     271    // photons in this bunch
     272    const UInt_t n = TMath::Nint(f[6]);
     273    if (n==0)
     274        return 0;
     275
     276    f[6] = n-1;
    262277
    263278    fPosX             =  f[1];              // xpos relative to telescope [cm]
     
    267282    fTime             =  f[4];              // a relative arival time [ns]
    268283    fProductionHeight =  f[5];              // altitude of emission [cm]
    269 //    fNumPhotons       =  TMath::Nint(f[6]); // photons in this bunch
    270284    fWavelength       =  TMath::Nint(f[7]); // so far always zeor = unspec. [nm]
    271285
     
    275289    fWeight     =  1;
    276290
    277     return kTRUE;
    278 }
     291    return n;
     292}
     293
    279294/*
    280295// --------------------------------------------------------------------------
  • trunk/Mars/msim/MPhotonData.h

    r9937 r9941  
    101101    void SetTime(Double_t t)  { fTime  = t; }
    102102
     103    void SimWavelength(Float_t wmin, Float_t wmax);
     104
    103105    void Copy(TObject &obj) const;
    104106
  • trunk/Mars/msim/MPhotonEvent.h

    r9937 r9941  
    3939    Double_t GetMeanX() const;
    4040    Double_t GetMeanY() const;
     41    Double_t GetMeanT() const;
    4142
    4243    TClonesArray &GetArray() { return fData; }
     
    5455    Int_t Shrink(Int_t n);
    5556    void Resize(Int_t n);
     57
     58    void AddXY(Double_t x, Double_t y);
     59    void SimWavelength(Float_t wmin, Float_t wmax);
    5660
    5761    // I/O
Note: See TracChangeset for help on using the changeset viewer.