| 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 | ******************************************************************/
|
|---|
| 15 | void 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 con("ConeTransmission");
|
|---|
| 42 | MParSpline acc("ConeAngularAcceptance");
|
|---|
| 43 |
|
|---|
| 44 | pde.ReadFile("resmc/hawcseye/pde_SensL.txt");
|
|---|
| 45 | con.ReadFile("resmc/hawcseye/transmittance_cone.txt");
|
|---|
| 46 | acc.ReadFile("resmc/hawcseye/angular_acceptance_cone.txt");
|
|---|
| 47 |
|
|---|
| 48 | MGeomCamFAMOUS geom(F);
|
|---|
| 49 |
|
|---|
| 50 | MSimRays simrays;
|
|---|
| 51 | simrays.SetNameReflector("Reflector");
|
|---|
| 52 | simrays.SetWavelengthRange(300, 890);
|
|---|
| 53 | // Use this to simulate a diffent number of photons per bunch
|
|---|
| 54 | //simrays.SetNumPhotons(100000);
|
|---|
| 55 | // Use this to simulate a point source at distance F form the lens center
|
|---|
| 56 | //simrays.SetHeight(F/1000);
|
|---|
| 57 |
|
|---|
| 58 | MPointingPos srcpos("Source");
|
|---|
| 59 | srcpos.SetLocalPosition(dzd, daz);
|
|---|
| 60 |
|
|---|
| 61 | MPointingPos pointpos;
|
|---|
| 62 | pointpos.SetLocalPosition(telzd, telaz);
|
|---|
| 63 |
|
|---|
| 64 | // ----------------------------------------------
|
|---|
| 65 |
|
|---|
| 66 | MParList plist;
|
|---|
| 67 | MTaskList tlist;
|
|---|
| 68 | plist.AddToList(&tlist);
|
|---|
| 69 |
|
|---|
| 70 | plist.AddToList(&lens);
|
|---|
| 71 | plist.AddToList(&pointpos);
|
|---|
| 72 | plist.AddToList(&srcpos);
|
|---|
| 73 | plist.AddToList(&geom);
|
|---|
| 74 | plist.AddToList(&pde);
|
|---|
| 75 | plist.AddToList(&con);
|
|---|
| 76 | plist.AddToList(&acc);
|
|---|
| 77 |
|
|---|
| 78 | tlist.AddToList(&simrays);
|
|---|
| 79 |
|
|---|
| 80 | MHPhotonEvent planeG(1, "HPhotonEventGround");
|
|---|
| 81 | MHPhotonEvent plane0(2, "HMirrorPlane0");
|
|---|
| 82 | MHPhotonEvent plane2(2, "HMirrorPlane2");
|
|---|
| 83 | MHPhotonEvent plane3(2, "HMirrorPlane3");
|
|---|
| 84 | MHPhotonEvent plane4(2, "HMirrorPlane4");
|
|---|
| 85 | MHPhotonEvent planeC(9, "HPhotonEventCamera");
|
|---|
| 86 | MHPhotonEvent planeS(9, "HPhotonEventCamera");
|
|---|
| 87 |
|
|---|
| 88 | planeG.SetMaxImpact(60);
|
|---|
| 89 |
|
|---|
| 90 | MFillH fillG(&planeG, "MPhotonEvent", "FillGround");
|
|---|
| 91 | MFillH fill0(&plane0, "MirrorPlane0", "FillReflector");
|
|---|
| 92 | MFillH fill2(&plane2, "MirrorPlane2", "FillCandidates");
|
|---|
| 93 | MFillH fill3(&plane3, "MirrorPlane3", "FillReflected");
|
|---|
| 94 | MFillH fill4(&plane4, "MirrorPlane4", "FillCameraPlane");
|
|---|
| 95 | MFillH fillC(&planeC, "MPhotonEvent", "FillCamera");
|
|---|
| 96 | MFillH fillS(&planeS, "MPhotonEvent", "FillCamera");
|
|---|
| 97 |
|
|---|
| 98 | fillG.SetNameTab("Ground", "Photon distribution at ground");
|
|---|
| 99 | fill0.SetNameTab("LensIn", "Photon distribution at plane of lens hit surface");
|
|---|
| 100 | fill2.SetNameTab("Candidates", "*Can hit* photon distribution at reflector plane w/ camera shadow");
|
|---|
| 101 | fill3.SetNameTab("LensOut", "Photon distribution at plane output surface");
|
|---|
| 102 | fill4.SetNameTab("CameraPlane", "Photon distribution at camera plane");
|
|---|
| 103 | fillC.SetNameTab("Camera", "Photon distribution which hit a cone in the focal plane");
|
|---|
| 104 | fillS.SetNameTab("Sensor", "Photon distribution which hit a sensor in the focal plane");
|
|---|
| 105 |
|
|---|
| 106 | MSimAbsorption absapd("SimPhotonDetectionEfficiency");
|
|---|
| 107 | MSimAbsorption abscon("SimConeTransmission");
|
|---|
| 108 | MSimAbsorption cones("SimConesAngularAcceptance");
|
|---|
| 109 | absapd.SetParName("PhotonDetectionEfficiency");
|
|---|
| 110 | abscon.SetParName("ConeTransmission");
|
|---|
| 111 | cones.SetParName("ConeAngularAcceptance");
|
|---|
| 112 | cones.SetUseTheta();
|
|---|
| 113 | cones.SetForce();
|
|---|
| 114 | abscon.SetForce();
|
|---|
| 115 | absapd.SetForce();
|
|---|
| 116 | // We loose another 4% at the cone surface!
|
|---|
| 117 |
|
|---|
| 118 | tlist.AddToList(&fillG);
|
|---|
| 119 | tlist.AddToList(&absapd);
|
|---|
| 120 |
|
|---|
| 121 | MSimReflector simref;
|
|---|
| 122 | simref.SetNameReflector("Reflector");
|
|---|
| 123 | simref.SetDetectorMargin(-1);
|
|---|
| 124 | tlist.AddToList(&simref);
|
|---|
| 125 |
|
|---|
| 126 | tlist.AddToList(&fill0);
|
|---|
| 127 | tlist.AddToList(&fill2);
|
|---|
| 128 | tlist.AddToList(&fill3);
|
|---|
| 129 | tlist.AddToList(&fill4);
|
|---|
| 130 | tlist.AddToList(&fillC);
|
|---|
| 131 | tlist.AddToList(&cones);
|
|---|
| 132 | tlist.AddToList(&abscon);
|
|---|
| 133 | tlist.AddToList(&fillS);
|
|---|
| 134 |
|
|---|
| 135 | //tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
|
|---|
| 136 |
|
|---|
| 137 | MStatusDisplay *disp = new MStatusDisplay;
|
|---|
| 138 |
|
|---|
| 139 | MEvtLoop loop;
|
|---|
| 140 | loop.SetDisplay(disp);
|
|---|
| 141 | loop.SetParList(&plist);
|
|---|
| 142 |
|
|---|
| 143 | if (!loop.Eventloop(510))
|
|---|
| 144 | return;
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|