Commit fe134669 authored by Yoann Sallaz Damaz's avatar Yoann Sallaz Damaz
Browse files

simu and draw for the bend of M2

parent 5692e2ec
......@@ -23,7 +23,7 @@ bm07.SHIFT_ANG_SOURCE = args.beam_ang
bm07.SHIFT_ALT_SL0 = args.SL0
bm07.SHIFT_ALT_M1 = args.M1
bm07.SHIFT_ALT_MOVEH = args.MOVEH
bm07.NB_BEAM = 10
bm07.NB_BEAM = 100
dataX = [-4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4]
P_Source, photon_distribution, angles_distribution = bm07.creation_source()
......@@ -31,7 +31,7 @@ P_Source, photon_distribution, angles_distribution = bm07.creation_source()
diodeList = []
for shift in dataX:
AllObject = bm07.create_geometry()
nbHit, nbHitWeighted, rayons, rayons_w = bm07.propagation(AllObject, P_Source, photon_distribution, angles_distribution)
nbHit, nbHitWeighted, rayons, rayons_w, hauteurFluo3 = bm07.propagation(AllObject, P_Source, photon_distribution, angles_distribution)
print("SHIFT, NB HIT IN DIODE = ", shift, nbHit)
diodeList.append(nbHitWeighted)
......
......@@ -46,9 +46,14 @@ class BM07Raytracing:
self.SHIFT_ALT_SL0=0
self.SHIFT_ALT_M1=0
self.SHIFT_ALT_MOVEH=0
self.SHIFT_UTZ=0
self.APERTURE_SL0=6
self.NB_BEAM=1000
self.NRJ = 12.6 #keV
self.COURBURE_M1 = 14.31E6 #mm -> 14km
self.COURBURE_M2 = 10.77E6 #mm -> 10km
self.COURBURE_C2 = -1
self.ALPHA2 = 0.235 #deg
def divVertFWHM(self, E): #nfrom ils
a1=164 #µrad
......@@ -88,7 +93,7 @@ class BM07Raytracing:
# M1
#############################
courbeM1 = 14.31E6 #mm
courbeM1 = self.COURBURE_M1
lengthM1 = 1280 #mm
heightM1 = 90 #mm
P_M1 = Point(29601, shiftOptics+self.SHIFT_ALT_M1) #mm
......@@ -97,7 +102,7 @@ class BM07Raytracing:
demiAngleArc = atan(0.5*lengthM1/courbeM1)
listePoint=[]
altituderef = cos(demiAngleArc)*courbeM1
for angle in np.arange(-demiAngleArc, demiAngleArc+demiAngleArc*2/100, demiAngleArc*2/100):
for angle in np.linspace(-demiAngleArc, demiAngleArc, 1000):
listePoint.append(Point(P_M1.x+sin(angle)*courbeM1, P_M1.y+altituderef-cos(angle)*courbeM1))
AllObject.append(objet_optique("M1_refl", listePoint, P_M1, 0.237,reflect=True))
......@@ -153,13 +158,23 @@ class BM07Raytracing:
# C2
#############################
P_C2 = Point(P_C1.x+208.70, P_C1.y-33.01) #mm
P_C2 = Point(P_C1.x+208.70, P_C1.y-33.01+self.SHIFT_UTZ) #mm
lengthC2 = 95 #mm
heightC2 = 50 #mm
#C2 partie reflechissante
listePoint = [Point(P_C2.x-0.5*lengthC2, P_C2.y), Point(P_C2.x+0.5*lengthC2, P_C2.y)]
AllObject.append(objet_optique("C2_refl", listePoint, P_C1, -8.514, reflect=True))
if self.COURBURE_C2 != -1:
#C2 partie reflechissante version courbé (comme julien)
courbeC2 = self.COURBURE_C2
demiAngleArc = atan(0.5*lengthC2/courbeC2)
listePoint=[]
altituderef = cos(demiAngleArc)*courbeC2
for angle in np.linspace(-demiAngleArc, demiAngleArc, 1000):
listePoint.append(Point(P_C2.x+sin(angle)*courbeC2, P_C2.y+altituderef-cos(angle)*courbeC2))
AllObject.append(objet_optique("C2_refl", listePoint, P_C1, -8.514,reflect=True))
else:
#C2 partie reflechissante
listePoint = [Point(P_C2.x-0.5*lengthC2, P_C2.y), Point(P_C2.x+0.5*lengthC2, P_C2.y)]
AllObject.append(objet_optique("C2_refl", listePoint, P_C1, -8.514, reflect=True))
#C2 corp non reflechissant
listePoint = [Point(P_C2.x-0.5*lengthC2, P_C2.y), Point(P_C2.x-0.5*lengthC2, P_C2.y-heightC2),
......@@ -208,6 +223,59 @@ class BM07Raytracing:
AllObject.append(objet_optique("SL0_bas", listePoint, P_SL0, 0, reflect=False))
return AllObject
def create_geometry_add_M2(self, AllObject, shiftOptics=0.0, fluo2Up=False):
#############################
# M2
#############################
courbeM2 = self.COURBURE_M2#-1E6
courbeM2b = self.COURBURE_M2
lengthM2 = 1280 #mm
heightM2 = 90 #mm
P_M2 = Point(35067, shiftOptics-20) #mm
#M2 partie reflechissante
demiAngleArc1 = atan(0.5*lengthM2/courbeM2)
demiAngleArc2 = atan(0.5*lengthM2/courbeM2b)
listePoint=[]
altituderef1 = cos(demiAngleArc1)*courbeM2
altituderef2 = cos(demiAngleArc2)*courbeM2b
for angle in np.linspace(-demiAngleArc1, 0, 500):
listePoint.append(Point(P_M2.x+sin(angle)*courbeM2, P_M2.y-altituderef1+cos(angle)*courbeM2))
for angle in np.linspace(0, demiAngleArc2, 500):
listePoint.append(Point(P_M2.x+sin(angle)*courbeM2b, P_M2.y-altituderef2+cos(angle)*courbeM2b-altituderef1+courbeM2+altituderef2-courbeM2b))
AllObject.append(objet_optique("M2_refl", listePoint, P_M2, self.ALPHA2,reflect=True))
#M2 corp non reflechissant
first=listePoint[0]
end = listePoint[-1]
listePoint=[first, Point(first.x, first.y+heightM2),
Point(end.x,end.y+heightM2), end]
AllObject.append(objet_optique("M2_corps", listePoint, P_M2, self.ALPHA2,reflect=False))
#############################
# FLUO 2
#############################
if fluo2Up:
P_FLUO2 = Point(36418, -20)
listePoint = [Point(P_FLUO2.x, -90), Point(P_FLUO2.x, 90)]
AllObject.append(objet_optique("FLUO2", listePoint, P_FLUO2, -57.1, reflect=False))
#############################
# FLUO 3
#############################
P_FLUO3 = Point(55088, -20)
listePoint = [Point(P_FLUO3.x, -90), Point(P_FLUO3.x, 90)]
AllObject.append(objet_optique("FLUO3", listePoint, P_FLUO3, -57.1, reflect=False))
return AllObject
def creation_source(self):
# SOURCE
P_Source = Point(0, self.SHIFT_ALT_SOURCE)
......@@ -222,6 +290,7 @@ class BM07Raytracing:
nbHitWeighted=0
rayons = []
rayons_w = []
hauteurFluo = []
for idxPhoton in range(0, len(angles_distribution)):
angle = angles_distribution[idxPhoton]
poids = photon_distribution[idxPhoton]
......@@ -253,11 +322,15 @@ class BM07Raytracing:
if obj.name=="C2_refl": #SI C2 touché on compte comme si diode
nbHit+=1
nbHitWeighted+=poids
elif obj.name=="FLUO2" : #SI FLUO3 touché on recup la hauteur
hauteurFluo.append(intersection.x-36418)
elif obj.name=="FLUO3" : #SI FLUO3 touché on recup la hauteur
hauteurFluo.append(intersection.x-55088)
rayon.append(intersection)
del(geometryCopy[idx])
rayons.append(rayon)
rayons_w.append(poids)
return nbHit, nbHitWeighted, rayons, rayons_w
return nbHit, nbHitWeighted, rayons, rayons_w, hauteurFluo
......
......@@ -23,12 +23,15 @@ bm07.SHIFT_ANG_SOURCE = args.beam_ang
bm07.SHIFT_ALT_SL0 = args.SL0
bm07.SHIFT_ALT_M1 = args.M1
bm07.SHIFT_ALT_MOVEH = args.MOVEH
bm07.COURBURE_C2 = -1
bm07.NB_BEAM = 10
AllObject = bm07.create_geometry()
AllObject = bm07.create_geometry_add_M2(AllObject, fluo2Up=False)
P_Source, photon_distribution, angles_distribution = bm07.creation_source()
nbHit, nbHitWeighted, rayons, rayons_w = bm07.propagation(AllObject, P_Source, photon_distribution, angles_distribution)
nbHit, nbHitWeighted, rayons, rayons_w, hauteurFluo3 = bm07.propagation(AllObject, P_Source, photon_distribution, angles_distribution)
print(hauteurFluo3)
rayons_w = rayons_w/max(rayons_w)
cmap=plt.get_cmap("rainbow")
......
......@@ -36,7 +36,7 @@ def scan(ERROR_ALT_SOURCE, ERROR_ANG_SOURCE, ERROR_ALT_SL0, ERROR_ALT_M1, ERROR_
TotalPhoton = sum(photon_distribution)
for shift in dataX:
geometry = bm07.create_geometry()
nbHit, nbHitWeighted, rayons, rayons_w = bm07.propagation(geometry, P_Source, photon_distribution, angles_distribution)
nbHit, nbHitWeighted, rayons, rayons_w, hauteurFluo3 = bm07.propagation(geometry, P_Source, photon_distribution, angles_distribution)
diodeList.append(nbHit)
diodeListWeighted.append(nbHitWeighted)
return diodeList, diodeListWeighted, TotalPhoton
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment