source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/simulation/lightsources/src/EAtmosphereBunchAdder.cc @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 2.5 KB
Line 
1// ESAF : Euso Simulation and Analysis Framework
2// $Id: EAtmosphereBunchAdder.cc 2765 2006-11-15 14:59:23Z moreggia $
3// Author: Anne Stutz   Jul, 27 2004
4
5#include "EAtmosphereBunchAdder.hh"
6#include "EEvent.hh"
7#include "EAtmosphere.hh"
8#include "BunchOfPhotons.hh"
9#include <stdexcept>
10
11#include "EBunchPhotons.hh"
12
13ClassImp(EAtmosphereBunchAdder)
14
15//_____________________________________________________________________________
16EAtmosphereBunchAdder::EAtmosphereBunchAdder(const BunchOfPhotons* bph, Bool_t newb) : EFiller("EAtmosphere") {
17    //
18    // Constructor
19    //
20    fBunch = bph;
21    fNewBunch = newb;
22}
23
24//_____________________________________________________________________________
25EAtmosphereBunchAdder::~EAtmosphereBunchAdder() {
26    //
27    // Destructor
28    //
29}
30
31//_____________________________________________________________________________
32void EAtmosphereBunchAdder::Fill( EFillable* f) {
33    //
34    // fill the root file, EBunchPhotons part, before and after the bunch propagation
35    //
36    EAtmosphere *atm = (EAtmosphere*)f;
37
38    if ( !fBunch ) return;
39   
40    if ( fNewBunch ) {
41        // bunch parameters at the creation point
42        atm->fNumBunches++;
43        new ( (*(atm->fBunches))[atm->fNumBunches-1] ) EBunchPhotons() ;
44    }
45
46    EBunchPhotons& bp = *(EBunchPhotons*)(*(atm->fBunches))[atm->fNumBunches-1];
47
48    if ( fNewBunch ) {
49        const ParentBunch* parentb = fBunch->GetParent();
50        bp.SetYield( parentb->GetYield() );
51        bp.SetDatei( parentb->GetDatei() );
52        bp.SetDatef( parentb->GetDatef() );
53        bp.SetShowerAge( fBunch->GetShowerAge() );
54        bp.SetShowerPosi( parentb->GetShowerPosi() );
55        bp.SetShowerPosf( parentb->GetShowerPosf() );
56        bp.SetType( fBunch->GetType() );
57        bp.SetId( fBunch->GetId() );
58        bp.SetWeight ( fBunch->GetWeight() );
59        bp.SetFinalPos( fBunch->GetShowerPos() );
60        bp.SetMeanDir( fBunch->GetDir() );
61        bp.SetFate(0);
62
63        Int_t n = fBunch->GetNbins();
64        Float_t wls[n];
65        for (Int_t i(0); i<n; i++) wls[i] = fBunch->GetWlSpectrum().GetLambdaEntry(i); // center of bin (not low edge)
66        bp.SetSpectrum(n,wls,fBunch->GetWlSpectrum().GetIntegral()); // weight array is internally generated from integral array
67        if(bp.GetId() != fBunch->GetId()) Warning("EAtmosphereBunchAdder::Fill()","Wrong bunch identification"); //TOFIX: could happen if bunch splitting..
68    }
69   
70    else {
71        bp.SetFinalPos(fBunch->GetPos());
72        bp.SetFate(fBunch->GetFate()); 
73//DELETE
74        //bp.SetFinalWeight ( fBunch->GetWeight() );
75
76    }
77}
Note: See TracBrowser for help on using the repository browser.