source: trunk/Mars/hawc/fresnellens_image.C@ 19856

Last change on this file since 19856 was 19789, checked in by tbretz, 5 years ago
Improved comment.
File size: 4.7 KB
Line 
1/*****************************************************************
2
3 fresnellens_image.C - Example how to simulate a fresnel lens
4
5 To run the macro from the command line (assuming you are in a directory
6 Mars/build where you have built your Mars environment) you have to do
7
8 root ../hawc/fresnellens_image.C
9
10 or from within root
11
12 [0] .x ../hawc/fresnellens_image.C
13
14******************************************************************/
15void fresnellens_image()
16{
17 Double_t telzd = 0; // [deg] Telescope orientation Zenith Distance
18 Double_t telaz = 0; // [deg] Telescope orientation Azimuth
19
20 Double_t dzd = 6; // [deg] Relative angle of light ray Zd
21 Double_t daz = 0; // [deg] Relative angle of light ray Az
22
23 Double_t F = 0.5021; // [m] Distance of camera to lens (w.r.t. to lens exit)
24 // // This is different from F in MFresnelLens!
25
26 // ----------------------------------------------
27
28 MFresnelLens lens("Reflector");
29 //lens.DefineLens(F, D, w, H, lambda);
30 //lens.EnableSlopeAbsorption();
31 //lens.EnableDraftAbsorption();
32 //lens.DisableBottomReflection();
33 //lens.DisableMultiEntry();
34 //lens.DisableFresnelReflection();
35 //lens.SetMinHits(5);
36 //lens.SetMaxHits(0);
37 lens.ReadTransmission("resmc/hawcseye/transmission-pmma-3mm.txt", 0.3, true);
38
39
40 MParSpline pde("PhotonDetectionEfficiency");
41 MParSpline acc("ConesAngularAcceptance");
42
43 pde.ReadFile("resmc/hawcseye/pde.txt");
44 acc.ReadFile("resmc/hawcseye/cones-angular-acceptance.txt");
45
46 MGeomCamFAMOUS geom(F);
47
48 MSimRays simrays;
49 simrays.SetNameReflector("Reflector");
50 simrays.SetWavelengthRange(300, 890);
51 // Use this to simulate a diffent number of photons per bunch
52 //simrays.SetNumPhotons(100000);
53 // Use this to simulate a point source at distance F form the lens center
54 //simrays.SetHeight(F/1000);
55
56 MPointingPos srcpos("Source");
57 srcpos.SetLocalPosition(dzd, daz);
58
59 MPointingPos pointpos;
60 pointpos.SetLocalPosition(telzd, telaz);
61
62 // ----------------------------------------------
63
64 MParList plist;
65 MTaskList tlist;
66 plist.AddToList(&tlist);
67
68 plist.AddToList(&lens);
69 plist.AddToList(&pointpos);
70 plist.AddToList(&srcpos);
71 plist.AddToList(&geom);
72 plist.AddToList(&pde);
73 plist.AddToList(&acc);
74
75 tlist.AddToList(&simrays);
76
77 MHPhotonEvent planeG(1, "HPhotonEventGround");
78 MHPhotonEvent plane0(2, "HMirrorPlane0");
79 MHPhotonEvent plane2(2, "HMirrorPlane2");
80 MHPhotonEvent plane3(2, "HMirrorPlane3");
81 MHPhotonEvent plane4(2, "HMirrorPlane4");
82 MHPhotonEvent planeC(9, "HPhotonEventCamera");
83 MHPhotonEvent planeS(9, "HPhotonEventCamera");
84
85 planeG.SetMaxImpact(60);
86
87 MFillH fillG(&planeG, "MPhotonEvent", "FillGround");
88 MFillH fill0(&plane0, "MirrorPlane0", "FillReflector");
89 MFillH fill2(&plane2, "MirrorPlane2", "FillCandidates");
90 MFillH fill3(&plane3, "MirrorPlane3", "FillReflected");
91 MFillH fill4(&plane4, "MirrorPlane4", "FillCameraPlane");
92 MFillH fillC(&planeC, "MPhotonEvent", "FillCamera");
93 MFillH fillS(&planeS, "MPhotonEvent", "FillCamera");
94
95 fillG.SetNameTab("Ground", "Photon distribution at ground");
96 fill0.SetNameTab("LensIn", "Photon distribution at plane of lens hit surface");
97 fill2.SetNameTab("Candidates", "*Can hit* photon distribution at reflector plane w/ camera shadow");
98 fill3.SetNameTab("LensOut", "Photon distribution at plane output surface");
99 fill4.SetNameTab("CameraPlane", "Photon distribution at camera plane");
100 fillC.SetNameTab("Camera", "Photon distribution which hit a cone in the focal plane");
101 fillS.SetNameTab("Sensor", "Photon distribution which hit a sensor in the focal plane");
102
103 MSimAbsorption absapd("SimPhotonDetectionEfficiency");
104 MSimAbsorption cones("SimConesAngularAcceptance");
105 absapd.SetParName("PhotonDetectionEfficiency");
106 cones.SetParName("ConesAngularAcceptance");
107 cones.SetUseTheta();
108 cones.SetForce();
109 absapd.SetForce();
110 // We loose another 4% at the cone surface!
111
112 tlist.AddToList(&fillG);
113 tlist.AddToList(&absapd);
114
115 MSimReflector simref;
116 simref.SetNameReflector("Reflector");
117 simref.SetDetectorMargin(-1);
118 tlist.AddToList(&simref);
119
120 tlist.AddToList(&fill0);
121 tlist.AddToList(&fill2);
122 tlist.AddToList(&fill3);
123 tlist.AddToList(&fill4);
124 tlist.AddToList(&fillC);
125 tlist.AddToList(&cones);
126 tlist.AddToList(&fillS);
127
128 //tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
129
130 MStatusDisplay *disp = new MStatusDisplay;
131
132 MEvtLoop loop;
133 loop.SetDisplay(disp);
134 loop.SetParList(&plist);
135
136 if (!loop.Eventloop(510))
137 return;
138}
139
Note: See TracBrowser for help on using the repository browser.