detectedflux = float(flux) * float(area) * float(solidangle) * float(selectionefficiency)
rateperhour = detectedflux * 60 * 60
n = int(rateperhour * float(numberofhours))
print time.asctime(
    time.localtime()
), "Cosmic Ray Iron Flux is", flux, "Simulated Area is", area, "Field of View is", solidangle, "Detected Flux is", detectedflux
print time.asctime(
    time.localtime()
), "Rate per hour", rateperhour, "Simulated Hours", numberofhours, "Simulated Events", n

with open(
    "/afs/desy.de/user/s/steinrob/Documents/DESY/positioning/orientations/" + orientation + ".csv", "rb"
) as csvfile:
    reader = csv.reader(csvfile, delimiter=",", quotechar="|")
    rowcount = 0
    for row in reader:
        rowcount += 1

s.run(eff, rowcount, mincount=mincount, text=False, graph=False, output=sourcedata, layout=orientation, number=n)
bp.run(sourcedata, processdata, int(mincount), rowcount, text=False)
br.run(processdata, reconstructdata, rowcount, reconstructiongridwidth, eff)

message = str(time.asctime(time.localtime())) + " Completed simulation of " + str(n) + " events!"
import os, sys
import sendemail as se

name = os.path.basename(__file__)
se.send(name, message, False)
else:
	sourcedata= str(cfg.data) + "simulated" + str(cfg.mincount)
	processdata = str(cfg.data) + "processed"+ str(cfg.mincount)
	reconstructdata = str(cfg.data) + "reconstructed"+ str(cfg.mincount)

with open("orientations/"+ cfg.orientation +".csv", 'rb') as csvfile:
	reader = csv.reader(csvfile, delimiter=',', quotechar='|')
	rowcount = 0
	for row in reader:
		rowcount +=1
		
if cfg.simulate:
	print time.asctime(time.localtime()),"Cosmic Ray Iron Flux is", flux, "Simulated Area is", area, "Field of View is", solidangle, "Detected Flux is", detectedflux
	print time.asctime(time.localtime()),"Rate per hour", rateperhour, "Simulated Hours", cfg.numberofhours, "Simulated Events", n 
	s.run(eff, rowcount, mincount=cfg.mincount, text=cfg.text, graph=cfg.graph, output=sourcedata, layout=cfg.orientation, number = n)
	bp.run(sourcedata, processdata, int(cfg.mincount), rowcount, text=cfg.text)
	br.run(processdata, reconstructdata, rowcount, cfg.reconstructiongridwidth, eff)
	message = str(time.asctime(time.localtime())) + " Completed simulation of " + str(n) + " events!"
	print message
	import os, sys
	import sendemail as se
	name = os.path.basename(__file__)
	se.send(name, message)
	
if cfg.plotcut:
	allcounts = cc.run(reconstructdata, rowcount, int(cfg.mincount))
	
	sys.path.append('/d6/rstein/Hamburg-Cosmic-Rays/BDT')
	import BDT
	BDT.run(reconstructdata, rowcount, int(cfg.mincount), allcounts)
	
print time.asctime(
    time.localtime()
), "Rate per hour", rateperhour, "Simulated Hours", numberofhours, "Simulated Events", n

with open(
        "/afs/desy.de/user/s/steinrob/Documents/DESY/positioning/orientations/"
        + orientation + ".csv", 'rb') as csvfile:
    reader = csv.reader(csvfile, delimiter=',', quotechar='|')
    rowcount = 0
    for row in reader:
        rowcount += 1

s.run(eff,
      rowcount,
      mincount=mincount,
      text=False,
      graph=False,
      output=sourcedata,
      layout=orientation,
      number=n)
bp.run(sourcedata, processdata, int(mincount), rowcount, text=False)
br.run(processdata, reconstructdata, rowcount, reconstructiongridwidth, eff)

message = str(time.asctime(
    time.localtime())) + " Completed simulation of " + str(n) + " events!"
import os, sys
import sendemail as se

name = os.path.basename(__file__)
se.send(name, message, False)
Example #4
0
if cfg.simulate:
    print time.asctime(
        time.localtime()
    ), "Cosmic Ray Iron Flux is", flux, "Simulated Area is", area, "Field of View is", solidangle, "Detected Flux is", detectedflux
    print time.asctime(
        time.localtime()
    ), "Rate per hour", rateperhour, "Simulated Hours", cfg.numberofhours, "Simulated Events", n
    s.run(eff,
          rowcount,
          mincount=cfg.mincount,
          text=cfg.text,
          graph=cfg.graph,
          output=sourcedata,
          layout=cfg.orientation,
          number=n)
    bp.run(sourcedata, processdata, int(cfg.mincount), rowcount, text=cfg.text)
    br.run(processdata, reconstructdata, rowcount, cfg.reconstructiongridwidth,
           eff)
    message = str(time.asctime(
        time.localtime())) + " Completed simulation of " + str(n) + " events!"
    print message
    import os, sys
    import sendemail as se
    name = os.path.basename(__file__)
    se.send(name, message)

if cfg.plotcut:
    allcounts = cc.run(reconstructdata, rowcount, int(cfg.mincount))

    sys.path.append('/d6/rstein/Hamburg-Cosmic-Rays/BDT')
    import BDT