1 | // $Id$ |
---|
2 | // Author: Dmitry V.Naumov 2011/04/27 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: PixelEffMapBuilder * |
---|
8 | * Package: <packagename> * |
---|
9 | * Coordinator: <coordinator> * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | #ifndef __PIXELEFFMAPBUILDER_HH__ |
---|
14 | #define __PIXELEFFMAPBUILDER_HH__ |
---|
15 | |
---|
16 | #include "euso.hh" |
---|
17 | #include "EsafConfigurable.hh" |
---|
18 | #include <TString.h> |
---|
19 | #include <TObject.h> |
---|
20 | #include <TSystem.h> |
---|
21 | |
---|
22 | class OpticalSystem; |
---|
23 | class IdealFocalSurface; |
---|
24 | class Detector; |
---|
25 | class VirtualDetectorTransportManager; |
---|
26 | class Photon; |
---|
27 | class EusoElectronics; |
---|
28 | class TFile; |
---|
29 | class TH2F; |
---|
30 | class TCanvas; |
---|
31 | class TTree; |
---|
32 | class TLegend; |
---|
33 | class TLegendEntry; |
---|
34 | class TSeqCollection; |
---|
35 | class TPolyLine; |
---|
36 | class ERunParameters; |
---|
37 | class EsafSpectrum; |
---|
38 | |
---|
39 | //////////////////////////////////////////////////////////////////////////////// |
---|
40 | // // |
---|
41 | // PixelEffMapBuilder // |
---|
42 | // // |
---|
43 | // <brief class description> // |
---|
44 | // // |
---|
45 | //////////////////////////////////////////////////////////////////////////////// |
---|
46 | |
---|
47 | class PixelEffMapBuilder : public EsafConfigurable, public EsafMsgSource { |
---|
48 | public: |
---|
49 | PixelEffMapBuilder(TString s=""); |
---|
50 | virtual ~PixelEffMapBuilder(); |
---|
51 | |
---|
52 | class Header : public TObject { |
---|
53 | public: |
---|
54 | Header() : fBinsThetaFoV(-1), fBinsPhiFoV(-1), fPhPerBunch(-1), fEfficiencyThreshold(0), |
---|
55 | fThetaFoVMin(-1), fThetaFoVMax(-1), fPhiFoVMin(-1), fPhiFoVMax(-1), fNpixels(0), |
---|
56 | fPhotonsTraced(0), fLastProcessedBinTheta(-1), fLastProcessedBinPhi(-1), |
---|
57 | fAllProcessed(kFALSE), fDisplayPixels(0), fHistoLegend(0), |
---|
58 | fLegendEntryPhotons(0), fLegendEntryPixels(0), fLegendEntryTheta(0), fLegendEntryPhi(0), fRunPars(0) {} |
---|
59 | Int_t fBinsThetaFoV; // number of bins per Theta_FoV |
---|
60 | Int_t fBinsPhiFoV; // number of bins per Phi_FoV |
---|
61 | Int_t fPhPerBunch; // number of photons per bunch |
---|
62 | Float_t fEfficiencyThreshold; // minimum allowed efficiency of pixel to be saved |
---|
63 | Float_t fThetaFoVMin; // minimum Theta_FoV |
---|
64 | Float_t fThetaFoVMax; // maximum Theta_FoV |
---|
65 | Float_t fPhiFoVMin; // minimum Phi_FoV |
---|
66 | Float_t fPhiFoVMax; // maximum Phi_FoV |
---|
67 | Int_t fNpixels; // number of pixels hitted by photons |
---|
68 | Int_t fPhotonsTraced; // total number of traced photons |
---|
69 | Int_t fLastProcessedBinTheta; // last bin in Theta traced |
---|
70 | Int_t fLastProcessedBinPhi; // last bin in Phi traced |
---|
71 | Bool_t fAllProcessed; // true if all pixels were processed |
---|
72 | TH2F* fDisplayPixels; // histo to display pixels filling |
---|
73 | TLegend* fHistoLegend; // legend of histo (fDisplayPixels) |
---|
74 | TLegendEntry* fLegendEntryPhotons; // legend about number of photons |
---|
75 | TLegendEntry* fLegendEntryPixels; // legend about number of pixels |
---|
76 | TLegendEntry* fLegendEntryTheta; // legend about Theta_FoV |
---|
77 | TLegendEntry* fLegendEntryPhi; // legend about Phi_FoV |
---|
78 | map<Int_t, TPolyLine* > fPixelLines; // pixel's lines |
---|
79 | ERunParameters *fRunPars; // ERunParameters object |
---|
80 | vector <Int_t> fProcessedPixels; // pixels with efficiency above the threshold |
---|
81 | map <Int_t, vector<Int_t> > fTreeMap; // map <UID, entries in TTree> |
---|
82 | ClassDef(Header,1) |
---|
83 | }; |
---|
84 | |
---|
85 | class PixelsMap: public TObject { |
---|
86 | public: |
---|
87 | PixelsMap() {} |
---|
88 | map <Int_t, TH2F*> fHiredPixels; // map <Pixel UID, TH2F* (Theta,Phi)> at given Theta_FoV,Phi_FoV |
---|
89 | ClassDef(PixelsMap,1) |
---|
90 | }; |
---|
91 | // this class below is used as container for the TTree with UID vs PixelHistos structure: |
---|
92 | // TBrach of UID |
---|
93 | // TBranch of PixelHistos |
---|
94 | class PixelHistos: public TObject { |
---|
95 | public: |
---|
96 | PixelHistos() {} |
---|
97 | vector <TH2F*> fEffThetaPhi; // vector of histos with efficiencies as functions of Theta_FoV,Phi_FoV |
---|
98 | ClassDef(PixelHistos,1); |
---|
99 | }; |
---|
100 | Bool_t ProcessAll(); |
---|
101 | Bool_t MakeUID_Histos_Tree(); |
---|
102 | |
---|
103 | private: |
---|
104 | Bool_t OpenRoot(); |
---|
105 | Bool_t CloseRoot(); |
---|
106 | Bool_t CheckMemory(); |
---|
107 | Bool_t MakeHeader(); |
---|
108 | Bool_t SaveInfo(); |
---|
109 | Bool_t ProcessPortion(Float_t&,Float_t&,Float_t&,Float_t&); |
---|
110 | void RandomPosOnLense(Double_t &, Double_t &, Double_t &); |
---|
111 | void SetupLastBins(Int_t&, Int_t&); |
---|
112 | void DisplayPixelsFilling(Float_t&, Float_t&); |
---|
113 | void DisplayPixelsFillingPolyLine(Float_t&, Float_t&); |
---|
114 | TPolyLine* GetPixelLine( Int_t uid, Bool_t& drawn); |
---|
115 | |
---|
116 | Detector *fDetector; // detector |
---|
117 | VirtualDetectorTransportManager *fTransporter; // photons transporter |
---|
118 | EusoElectronics *fElectronics; // electronics |
---|
119 | |
---|
120 | TFile* fFile; // output file |
---|
121 | Header* fHeader; // Header object to be saved into root output file |
---|
122 | PixelsMap* fPixelsMap; // map of pixels with number of entries for the given Theta,Phi |
---|
123 | OpticalSystem* fOpticalSystem; // Optical System object |
---|
124 | Photon* fPhoton; // photon object used for simulation |
---|
125 | TString fFileName; // output file name |
---|
126 | |
---|
127 | MemInfo_t meminfo; // memory usage object |
---|
128 | TCanvas* fCanvas; // canvas for histo to display pixels filling |
---|
129 | |
---|
130 | Int_t fThetaIndexCurrent; // current value of Theta_FoV index (0,fBinsThetaFoV) |
---|
131 | Int_t fPhiIndexCurrent; // current value of Phi_FoV index (0,fBinsPhiFoV) |
---|
132 | TTree *fTreePrompt; // TTree corresponding to 'prompt' problem: Light to Pixels |
---|
133 | EsafSpectrum* fSpectrum; // Fluo spectrum |
---|
134 | TH2F* fThetaPhiHisto; // histo with theta,phi within (theta,theta+delta theta) and (phi,phi + delta phi) |
---|
135 | ClassDef(PixelEffMapBuilder,0) |
---|
136 | EsafConfigClass(Tools,PixelEffMapBuilder) |
---|
137 | }; |
---|
138 | |
---|
139 | #endif /* __PIXELEFFMAPBUILDER_HH__ */ |
---|
140 | |
---|