Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

OADBPhotons - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: OADBPhotons.cc,v 1.3 2004/03/23 16:43:09 thea Exp $
// A.Thea, J.Watts created Mar, 16 2004

#include "OADBPhotons.hh"
#include "Photon.hh"

ClassImp(OADBPhotons)
    
// ctor
 OADBPhotons::OADBPhotons(): fLambda(0), fThetaFoV(0), fAngleId(-1), fWlId(-1),
    fNumPhotons(0), fThroughput(NULL), fXOut(NULL), fYOut(NULL), fThetaOut(NULL),
    fPhiOut(NULL) {
}

// dtor
 OADBPhotons::~OADBPhotons() {
}


 Bool_t OADBPhotons::SetSize(Int_t s) {
    if ( s == fNumPhotons ) 
        return kTRUE;
    fNumPhotons = s;
    
    if ( fThroughput ) delete [] fThroughput;
    if ( fXOut ) delete [] fXOut;
    if ( fYOut ) delete [] fYOut;
    if ( fThetaOut ) delete [] fThetaOut;
    if ( fPhiOut ) delete [] fPhiOut;

    fThroughput = new Float_t[fNumPhotons];
    fXOut = new Float_t[fNumPhotons];
    fYOut = new Float_t[fNumPhotons];
    fThetaOut = new Float_t[fNumPhotons];
    fPhiOut = new Float_t[fNumPhotons];

    Clean();

    return kTRUE;
}

// clean all the photons
 void OADBPhotons::Clean() {
    for(Int_t i(0); i<fNumPhotons; i++) {
        fThroughput[i] = -1;
        fXOut[i] = 0;
        fYOut[i] = 0;
        fThetaOut[i] = -1;
        fPhiOut[i] = -1;
    }
}

// save photon's data in the i-th position
 Bool_t OADBPhotons::SavePhoton(Int_t i,Photon *ph, Float_t tr) {
    if ( i< 0 || i >= fNumPhotons ) {
        cout << "OADBPhotons::SavePhoton: index out of range" << i << " vs " << fNumPhotons << endl;
        return kFALSE;
    }
    fThroughput[i] = tr;
    fXOut[i]=ph->pos.X();
    fYOut[i]=ph->pos.Y();
    fThetaOut[i] = ph->dir.Theta();
    fPhiOut[i] = ph->dir.Phi();
    return kTRUE;

}


// create a dead entry in the database
 Bool_t OADBPhotons::SaveGhost(Int_t i) {
    if ( i< 0 || i >= fNumPhotons ) {
        cout << "OADBPhotons::SaveGhost: index out of range " << i << " vs " << fNumPhotons<< endl;
        return kFALSE;
    }
    fThroughput[i] = -1;
    fXOut[i] = 0;
    fYOut[i] = 0;
    fThetaOut[i] = -1;
    fPhiOut[i] = -1;
    return kTRUE;

}

About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005