source: JEM-EUSO/esaf_cc_at_lal/packages/simulation/detector/electronics/src/EDetectorPhotonDataAdder.cc @ 114

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

actual version of ESAF at CCin2p3

File size: 2.2 KB
Line 
1// ESAF : Euso Simulation and Analysis Framework
2// $Id: EDetectorPhotonDataAdder.cc 2522 2006-03-01 20:54:01Z thea $
3// A.Thea created Oct, 28 2003
4
5#include "EDetectorPhotonDataAdder.hh"
6#include "EEvent.hh"
7#include "EDetector.hh"
8#include "EDetPhoton.hh"
9
10ClassImp(EDetectorPhotonDataAdder)
11
12//______________________________________________________________________________
13EDetectorPhotonDataAdder::EDetectorPhotonDataAdder(Int_t s_id, Int_t mc, Int_t fe,
14    Int_t gtu, Bool_t madecount, Bool_t madefo, Int_t mx, Int_t my)
15    : EFiller( "EDetector" ) {
16    // ctor
17   
18    fSignalID   = s_id;
19    fMacroCell  = mc;
20    fFrontEnd   = fe;
21    fGtu        = gtu;
22    fMadeCount  = madecount;
23    fMadeFastOR = madefo;
24    fMacroCellX = mx;
25    fMacroCellY = my;
26}
27
28//______________________________________________________________________________
29EDetectorPhotonDataAdder::~EDetectorPhotonDataAdder() {
30    // dtor
31
32}
33
34//______________________________________________________________________________
35void EDetectorPhotonDataAdder::Fill( EFillable* f ) {
36    // filler
37    // associate electronics chain to a pmt signal
38
39    EDetector *det = (EDetector*)f;
40
41    if ( !(det = dynamic_cast<EDetector*>(f)) ) {
42        MsgForm(EsafMsg::Warning,"Fill(): f is not an EDetector* ");
43        return; 
44    }
45
46    // fill photons info in the detector status
47
48
49    // if photons are disabled return
50    if ( det->GetPhotonFillingMode() == EDetector::kNoPhotons ) return;
51   
52    bool go_on = kTRUE;
53    int i=0;
54    EDetPhoton* p;
55    while( go_on ) {
56        p = (EDetPhoton*)(*(det->fPhotons))[i];
57        if ( p && i!= det->fNumPhotons ) {
58            if ( p->fSignalId == fSignalID )
59                go_on = kFALSE;
60            else
61                i++;
62        }
63        else
64            go_on = kFALSE;
65    }
66    if ( i < det->fNumPhotons ) {
67        p->fMacroCell = fMacroCell;
68        p->fFe = fFrontEnd;
69        p->fGtu = fGtu;
70       
71        if ( fMadeCount ) p->SetMadeCount();
72        else p->ClearMadeCount();
73
74        if ( fMadeFastOR ) {
75            p->SetMadeFastOR();
76            p->fXCell = fMacroCellX;
77            p->fYCell = fMacroCellY;
78        }
79        else p->ClearMadeFastOR();
80    }
81}
Note: See TracBrowser for help on using the repository browser.