diff --git a/NPSimulation/EventGenerator/EventGeneratorCosmic.cc b/NPSimulation/EventGenerator/EventGeneratorCosmic.cc index 8f12946b4148cd083f1563d6f3a6bd319a499217..298f9239b08bdbd358410900278b5ad881b23a85 100644 --- a/NPSimulation/EventGenerator/EventGeneratorCosmic.cc +++ b/NPSimulation/EventGenerator/EventGeneratorCosmic.cc @@ -172,15 +172,15 @@ void EventGeneratorCosmic::GenerateEvent(G4Event*){ G4double randomize = .5-RandFlat::shoot(); - - if(randomize>0){ + /* //Putting a cylinder + if(randomize>0){ //top momentum_x = cos(angle)*dis; momentum_z = sin(angle)*dis; x0 = cos(shift*2)*R*(randomize*2); z0 = sin(shift*2)*R*(randomize*2); par.m_y0 = H/2; - } else { + } else { //lateral surface x0 = cos(angle)*R; z0 = sin(angle)*R; @@ -189,7 +189,15 @@ void EventGeneratorCosmic::GenerateEvent(G4Event*){ momentum_x = -cos(angle+shift)*dis; momentum_z = -sin(angle+shift)*dis; } + */ + // Constrain to pass in a circle with radius 2R + momentum_x = cos(angle)*dis; + momentum_z = sin(angle)*dis; + x0 = cos(shift*2)*R*2*(randomize*2)-momentum_x*( H/2 / momentum_y); + z0 = sin(shift*2)*R*2*(randomize*2)-momentum_z*( H/2 / momentum_y); + par.m_y0 = H/2; + momentum_y = -momentum_y;