source: JEM-EUSO/esaf_cc_at_lal/packages/simulation/detector/electronics/src/Detector.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: 3.2 KB
Line 
1// $Id: Detector.cc 2922 2011-06-12 14:21:23Z mabl $
2// Author: A.Thea   2004/12/07
3
4/*****************************************************************************
5 * ESAF: Euso Simulation and Analysis Framework                              *
6 *                                                                           *
7 *  Id: Detector                                                           *
8 *  Package: <packagename>                                                   *
9 *  Coordinator: <coordinator>                                               *
10 *                                                                           *
11 *****************************************************************************/
12
13//_____________________________________________________________________________
14//
15// Detector
16//
17// <extensive class description>
18//
19//   Config file parameters
20//   ======================
21//
22//   <parameter name>: <parameter description>
23//   -Valid options: <available options>
24//
25
26#include "Detector.hh"
27
28#include "DetectorGeometry.hh"
29#include "EDetectorPhotonAdder.hh"
30#include "EEvent.hh"
31#include "Photon.hh"
32#include "PhotonsOnPupil.hh"
33
34ClassImp(Detector)
35ClassImp(TestDetector)
36using namespace sou;
37
38//_____________________________________________________________________________
39Detector::Detector() : fGeometry(0), fDetectorTransporter(0) {
40    //
41    // Constructor
42    //
43
44}
45
46//_____________________________________________________________________________
47Detector::~Detector() {
48    //
49    // Destructor
50    //
51}
52
53//_____________________________________________________________________________
54TestDetector::TestDetector() {
55    //
56    // Constructor
57    //
58    // NB : position is set in SimuApplication.cc by reading General/Euso.cfg file
59    //
60
61    fGeometry = new DetectorGeometry;
62    fGeometry->SetRadius(Conf()->GetNum("TestDetector.fRadius")*sou::m);
63    fGeometry->SetFoV(Conf()->GetNum("TestDetector.fFoV")*sou::deg);
64}
65
66//_____________________________________________________________________________
67TestDetector::~TestDetector() {
68    //
69    // Destructor
70    //
71    SafeDelete(fGeometry);
72}
73
74//______________________________________________________________________________
75Telemetry* TestDetector::Get( PhotonsOnPupil* pupil ) {
76    //
77    // Simulate one event and return a pointer to a Telemetry object
78    //
79
80    if ( !pupil ) {
81        MsgForm(EsafMsg::Warning,"PhotonsOnPupil is NULL. Photon tracing disabled.");
82        return NULL;
83    }
84
85    Photon* p = 0;
86    EEvent *ev = EEvent::GetCurrent();
87
88    Int_t nTracked=0, nTotal(pupil->GetNphotons());
89
90    Msg(EsafMsg::Info) << "Tracking Photons: " << MsgFlush;
91
92    while( (p = pupil->GetPhoton()) ) {
93
94        if (ev) {
95            EDetectorPhotonAdder a(p,0,kTRUE);
96            ev->Fill(a);
97        }
98
99        // update display
100        if ( nTracked*50 % nTotal == 0  || (nTracked-1)*50 % nTotal > nTracked*50 % nTotal ){
101            if ( nTracked*10 % nTotal == 0 || (nTracked-1)*10 % nTotal > nTracked*10 % nTotal ){
102                Msg(EsafMsg::Info) << Form("%d",nTracked*100/nTotal) << '%'<< MsgFlush;
103            }
104            else
105                Msg(EsafMsg::Info) << "." << MsgFlush;
106        }
107
108        nTracked++;
109    }
110
111    Msg(EsafMsg::Info) << " -done" << MsgDispatch;
112
113    return NULL;
114}
Note: See TracBrowser for help on using the repository browser.