Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

NoRadiativeTransfer - source file

// $Id: NoRadiativeTransfer.cc,v 1.1 2005/11/14 11:24:52 moreggia Exp $
// Author: Sylvain Moreggia   2005/11/10

/*****************************************************************************
 * ESAF: Euso Simulation and Analysis Framework                              *
 *                                                                           *
 *  Id: NoRadiativeTransfer                                                           *
 *  Package: <packagename>                                                   *
 *  Coordinator: <coordinator>                                               *
 *                                                                           *
 *****************************************************************************/

//_____________________________________________________________________________
//
// NoRadiativeTransfer
//
// <extensive class description>
//
//   Config file parameters
//   ======================
//
//   <parameter name>: <parameter description>
//   -Valid options: <available options>
//

#include "NoRadiativeTransfer.hh"
#include "ListPhotonsInAtmosphere.hh"
#include "EmptyPhotonsOnPupil.hh"
#include "SinglePhoton.hh" 
#include "Config.hh"
#include "EConst.hh"
#include "BunchOfPhotons.hh"
#include "Ground.hh"

#include "EEvent.hh"
#include "EAtmosphere.hh"
#include "EAtmosphereBunchAdder.hh"
#include "EAtmosphereSingleAdder.hh"

ClassImp(NoRadiativeTransfer)

using namespace TMath;
using namespace sou;
using namespace EConst;

//_____________________________________________________________________________
 NoRadiativeTransfer::NoRadiativeTransfer() : RadiativeTransfer(), fTotalList(0) {
    //
    // Constructor
    //
    
    fEmpty = new EmptyPhotonsOnPupil();
}

//_____________________________________________________________________________
 NoRadiativeTransfer::~NoRadiativeTransfer() {
    //
    // Destructor
    //
    SafeDelete(fEmpty);
}

//_______________________________________________________________________________________________________________________
 PhotonsOnPupil* NoRadiativeTransfer::Get(PhotonsInAtmosphere* photons, const DetectorGeometry* dg) {
    //
    // Transport photons from source to Euso pupil
    //

    // if given list of photons is empty  
    if(!photons) return NULL;
    
    if(photons->GetType() == "empty") return fEmpty;
    if(photons->GetType() != "list") Msg(EsafMsg::Panic) <<"Wrong PhotonsInAtmosphere format. ListPhotonsInAtmosphere expected."<< MsgDispatch;
    fTotalList = (ListPhotonsInAtmosphere*) photons;

    // number of bunches
    size_t NbBunch = fTotalList->GetListOfBunch().size();
    Double_t NbTot = 0;
    Double_t nf = 0;
    Double_t nc = 0;
    for(size_t i=0; i<NbBunch; i++) {
        NbTot += (fTotalList->GetListOfBunch()[i])->GetWeight();
        if(fTotalList->GetListOfBunch()[i]->GetType() == Fluo) nf += fTotalList->GetListOfBunch()[i]->GetWeight();
        else nc += fTotalList->GetListOfBunch()[i]->GetWeight();
    }
#ifdef DEBUG
    Msg(EsafMsg::Debug) << "SIZE OF LIST OF BUNCHES = "<<NbBunch << MsgDispatch;
    Msg(EsafMsg::Debug) << "Nb fluo = " <<nf << MsgDispatch;
    Msg(EsafMsg::Debug) << "Nb ckov = " <<nc << MsgDispatch;
#endif
    Msg(EsafMsg::Info) << "TOTAL number of photons ="<<NbTot << MsgDispatch;

    if ( NbBunch >=1 ) {
        EarthVector track = fTotalList->GetListOfBunch()[NbBunch - 1]->GetPos() 
            - fTotalList->GetListOfBunch()[0]->GetPos();
#ifdef DEBUG
        Msg(EsafMsg::Debug) << "size of the photon track = "<<track.Mag()/km <<" km"<< MsgDispatch;
#endif
    }


    EEvent* ev = EEvent::GetCurrent();
    ev->GetAtmosphere()->SetMaxScatOrder(0);

    // if some SinglePhotons created directly by LightSource module, they are saved into root
    if ( ev ) {
        const vector<SinglePhoton*>& list_single_2 = fTotalList->GetListOfSingle();
        size_t nbnotsaved = fTotalList->GetNbNotSaved();
        for (size_t i = list_single_2.size() - nbnotsaved; i<list_single_2.size(); i++ ) {
            EAtmosphereSingleAdder sa( list_single_2[i],true,false,0 );
            ev->Fill(sa);
            fTotalList->OneSingleSaved();
        }
    }


    // loop to store bunches into root files
    BunchOfPhotons* bunch = 0;
    while(true) {
        bunch = fTotalList->GetBunch();
        if(!bunch) break;
        // saves bunch parameters at creation
        if ( ev ) {
            EAtmosphereBunchAdder ba( bunch, true );
            ev->Fill(ba);
        }
    }
    
    return fEmpty;
}

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