if i % 1 == 0: print("Processing loop " + (str)(i) + " of " + (str)(NLoops)) #get nProtons according to possion distribution if args.poisson > 0: nProton = np.random.poisson(nMeanProton) else: nProton = nMeanProton totalProtons += nProton if nProton == 0: continue #get proton starting positions and angular distributions #print "Building proton paths",nProton XY = hf.GetRandomXY(nProton, size, width, posX, posY) mXmY = hf.GetDirections(nProton, beamSpread[0], False) ################### FRONT TRACKERS ####################################################### #reconstruct hits for each tracker module TrackerHits = [] MaxNStrips = [] for module in [0, 1]: #convert simulated protons to strips Strips, meanXY = hf.GetTrackerStripCoOrds(XY, mXmY, pitch, TrackerAngles[module], TrackerZ[module]) #keep track of maximum number of strips in each module
histEntries = [] hitArray = [] counter = 0 supercounter = 0 MyFile = TFile("pixeltiming.root", "RECREATE") myHist = TH1F("myHist", "Time between pixel firings", 75, -0.5, 149.6) while True: if len(histEntries) > 5000: break #generate N=10 random points for x-y XY = hf.GetRandomXY(nProton, size) #convert points into a strip number for each layer coords = hf.GetPixelCoOrds(XY, pitch) for coord in coords: if coord in hitArray: histEntries.append(counter) print "Found duplicate after " + ( str)(counter) + " loops, total found so far is " + (str)( len(histEntries)) counter = 0 hitArray = [] break else: hitArray.append(coord)