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

Last change on this file since 19648 was 19636, checked in by tbretz, 5 years ago
Added some absorption and some comments:
File size: 4.5 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 = 85; // [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 //simrays.SetNumPhotons(100000);
52
53 MPointingPos srcpos("Source");
54 srcpos.SetLocalPosition(dzd, daz);
55
56 MPointingPos pointpos;
57 pointpos.SetLocalPosition(telzd, telaz);
58
59 // ----------------------------------------------
60
61 MParList plist;
62 MTaskList tlist;
63 plist.AddToList(&tlist);
64
65 plist.AddToList(&lens);
66 plist.AddToList(&pointpos);
67 plist.AddToList(&srcpos);
68 plist.AddToList(&geom);
69 plist.AddToList(&pde);
70 plist.AddToList(&acc);
71
72 tlist.AddToList(&simrays);
73
74 MHPhotonEvent planeG(1, "HPhotonEventGround");
75 MHPhotonEvent plane0(2, "HMirrorPlane0");
76 MHPhotonEvent plane2(2, "HMirrorPlane2");
77 MHPhotonEvent plane3(2, "HMirrorPlane3");
78 MHPhotonEvent plane4(2, "HMirrorPlane4");
79 MHPhotonEvent planeC(9, "HPhotonEventCamera");
80 MHPhotonEvent planeS(9, "HPhotonEventCamera");
81
82 planeG.SetMaxImpact(60);
83
84 MFillH fillG(&planeG, "MPhotonEvent", "FillGround");
85 MFillH fill0(&plane0, "MirrorPlane0", "FillReflector");
86 MFillH fill2(&plane2, "MirrorPlane2", "FillCandidates");
87 MFillH fill3(&plane3, "MirrorPlane3", "FillReflected");
88 MFillH fill4(&plane4, "MirrorPlane4", "FillCameraPlane");
89 MFillH fillC(&planeC, "MPhotonEvent", "FillCamera");
90 MFillH fillS(&planeS, "MPhotonEvent", "FillCamera");
91
92 fillG.SetNameTab("Ground", "Photon distribution at ground");
93 fill0.SetNameTab("LensIn", "Photon distribution at plane of lens hit surface");
94 fill2.SetNameTab("Candidates", "*Can hit* photon distribution at reflector plane w/ camera shadow");
95 fill3.SetNameTab("LensOut", "Photon distribution at plane output surface");
96 fill4.SetNameTab("CameraPlane", "Photon distribution at camera plane");
97 fillC.SetNameTab("Camera", "Photon distribution which hit a cone in the focal plane");
98 fillS.SetNameTab("Sensor", "Photon distribution which hit a sensor in the focal plane");
99
100 MSimAbsorption absapd("SimPhotonDetectionEfficiency");
101 MSimAbsorption cones("SimConesAngularAcceptance");
102 absapd.SetParName("PhotonDetectionEfficiency");
103 cones.SetParName("ConesAngularAcceptance");
104 cones.SetUseTheta();
105 cones.SetForce();
106 absapd.SetForce();
107 // We loose another 4% at the cone surface!
108
109 tlist.AddToList(&fillG);
110 tlist.AddToList(&absapd);
111
112 MSimReflector simref;
113 simref.SetNameReflector("Reflector");
114 simref.SetDetectorMargin(-1);
115 tlist.AddToList(&simref);
116
117 tlist.AddToList(&fill0);
118 tlist.AddToList(&fill2);
119 tlist.AddToList(&fill3);
120 tlist.AddToList(&fill4);
121 tlist.AddToList(&fillC);
122 tlist.AddToList(&cones);
123 tlist.AddToList(&fillS);
124
125 //tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
126
127 MStatusDisplay *disp = new MStatusDisplay;
128
129 MEvtLoop loop;
130 loop.SetDisplay(disp);
131 loop.SetParList(&plist);
132
133 if (!loop.Eventloop(510))
134 return;
135}
136
Note: See TracBrowser for help on using the repository browser.