source: JEM-EUSO/esaf_cc_at_lal/packages/simulation/detector/electronics/include/EusoElectronics.hh @ 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: 6.9 KB
Line 
1// ESAF : Euso Simulation and Analysis Framework
2// $Id: EusoElectronics.hh 2804 2008-10-09 12:10:06Z biktem $
3//
4
5/*****************************************************************************
6 * ESAF: Euso Simulation and Analysis Framework                              *
7 *                                                                           *
8 *  Id: EusoElectronics                                                      *
9 *  Package: Electronics                                                     *
10 *  Coordinator: Marco.Pallavicini                                           *
11 *                                                                           *
12 *****************************************************************************/
13
14#ifndef __EUSOELECTRONICS_HH__
15#define __EUSOELECTRONICS_HH__
16
17#include <vector>
18#include <map>
19#include <iostream>
20#include <TVector3.h>
21#include "EEvent.hh"
22#include "EsafConfigurable.hh"
23#include "EsafMsgSource.hh"
24
25class ElementaryCell;
26class FrontEndChip;
27class Interpolate;
28class MacroCell;
29class Photomultiplier;
30class Telemetry;
31
32typedef Int_t ChannelUniqueId;
33
34////////////////////////////////////////////////////////////////////////////////
35//                                                                            //
36// EusoElectronics                                                            //
37//                                                                            //
38// Main Object of the Electronics System                                      //
39// You must inherit from this if you want to make another version of the      //
40// system. It has three methods:                                              //
41//    Build : Create all internal objects. To be called once.                 //
42//    Destroy : Destroy all electronics objects.                              //
43//    Simulate : Simulate one event. PMTs must be fed through the             //
44//               FocalSurface. It returns the RawData object                  //
45//    ResetEvent : Get Ready for next Event                                   //
46//                                                                            //
47////////////////////////////////////////////////////////////////////////////////
48
49class EusoElectronics : public EsafConfigurable, public EsafMsgSource {
50public:
51    EusoElectronics();
52    virtual ~EusoElectronics();
53
54
55    // build every object of this version of the electronics
56    // returns false on error
57    virtual bool Build();
58
59    virtual void BuildBackgroundChipDist();
60
61    virtual bool Destroy();
62    // destroy the object tree. Returns false on error.
63
64    virtual bool Simulate( Double_t, Double_t );
65    // simulate one event. PMTs must have been filled with Photons
66    // return false on error
67    // start and stop time are given also
68
69    virtual inline Telemetry* Data() {return fTelemetry;}
70    // return simulation result
71
72    virtual void Reset();
73    // reset. You must call Reset() between two events.
74
75    virtual void Dump(ostream& = cout);
76    // dump (for debugging purposes)
77
78    // mapping
79
80    inline Int_t NumOfCh() const { return fNumOfChannelUniqueId; }
81    // returns the number of channels
82
83    inline Int_t NumPmt() const { return fPmts.size(); }
84    // returnd the number of pmts
85
86    inline Int_t NumElemCell() const { return fElementaryCells.size(); }
87    // return number of macrocells
88
89    inline Int_t NumCell() const { return fMacrocells.size(); }
90    // return number of macrocells
91
92    // returns macrocell from index
93    MacroCell* Cell(UInt_t);
94
95    MacroCell* CellId(const ChannelUniqueId& chid);
96    // returns macrocell from channel unique id
97
98    ElementaryCell* ElemCell(UInt_t);
99    // return elementarycell from index
100
101    Photomultiplier* Pmt(UInt_t);
102    // returns photomultiplier from id
103
104    Photomultiplier* PmtId(ChannelUniqueId chid);
105    // returns photomultiplier from channel_unique_id
106
107    void ElectronicsMap(MacroCell**,Photomultiplier**,Int_t& pmtchan, ChannelUniqueId chid);
108    // returns all mapping from ChannelUniqueId
109
110    inline void EnableSimulation( Bool_t enable=kTRUE) { fSimulateElectronics = enable; }
111    // disable/enable simulation of Pmts signals
112
113    inline Bool_t GetSimulationStatus() const { return fSimulateElectronics; }
114    // return simulation status
115
116    inline Int_t GetNumPmtSignals() const { return fNumPmtSignals; }
117    // return total number of pmt signals detected
118
119    inline Int_t GetLowSignalCellThreshold() const { return fLowSignalCellThreshold; }
120    // return minimum number of pmt signals needed for simulating the macrocells
121
122    Double_t GetDetectorScaleFactor() const { return fDetectorScaleFactor; }
123    // returns the detector size scale factor
124
125    void SetDetectorScaleFactor( Double_t scale ) { fDetectorScaleFactor = scale; }
126    // sets the detector size scale factor
127
128    virtual Bool_t ClearMemory();
129    // physically release the memory allocated by the arrays of this object
130private:
131    Double_t NightGlowRate( const TVector3& pos, const TVector3& norm,
132                            Double_t pxsize, Double_t pde ) const;
133
134    Double_t NightGlowRate( const Photomultiplier* ) const;
135    // nightglow rate as function of the location on the FS
136
137    Double_t NightGlowRate( const FrontEndChip* ) const;
138    // nightglow rate as function of the location on the FS
139
140
141    Telemetry* fTelemetry;            // object for ground data format
142
143    vector<MacroCell*> fMacrocells;   // list of macro cells
144    vector<Photomultiplier*> fPmts;   // list of pmts
145
146    vector<ElementaryCell*> fElementaryCells; // list of elementary cells
147    map<Int_t,Photomultiplier*> fMap; // associate unique id to photomultiplier
148    Int_t fNumOfChannelUniqueId;
149    Bool_t fSimulateElectronics;      // disable simulation of the PmtSignal when
150
151    Int_t fNumPmtSignals;             // total number of pmt signals detected
152                                      // in all focal surface
153    Int_t fLowSignalCellThreshold;    // minimum number of signals per MC to run
154                                      // macrocell simulation
155
156    Bool_t fAddRandomGtuPhase;        // if true add a random phase to the gtu counter
157
158    // in special modes
159    Double_t fDetectorScaleFactor;    // detector size scale factor
160    string   fNightGlow;              // nightglow is added if not none
161    string   fNightGlowShape;         // profile of the nightglow.
162    Double_t fNightGlowRateOnAxis;    // p.e. per pixel per microsec on the optical axis
163    Double_t fNightGlowRadiance;      // photon radiance [ph/m^2/sr/ns]
164    Int_t    fNightGlowCode;          // its value defines in which conditions
165                                      // the ng is added
166
167    Interpolate *fNightGlowDist;      // distribution of nightglow over the focal surface
168
169    EsafConfigClass(Electronics,EusoElectronics)
170
171    ClassDef(EusoElectronics,0)
172};
173
174extern EusoElectronics* gEusoElectronics;
175#define GetEusoElectronics() gEusoElectronics
176#endif /* __EUSOELECTRONICS_HH__ */
Note: See TracBrowser for help on using the repository browser.