src/photongen.cc
// Function for muon propagation and photon generation
Function for muon propagation and photon generation
Function for muon propagation and photon generation
void muonProp(Muon& m) {
    int nP =0;
    Coords temp = m.init_coords;
    bool stopLoop = false;
    while (!stopLoop) {
        int tempP = nPhotons();
        if (tempP) {
            for (int i = 0; i < tempP; i++){
                Photon P (temp, m.identity, nP);
                if (photonProp(P)) nP++;
            }
        }
        if ( temp.x > S_LENGTH/2. - PATH_STEP*sin(temp.theta)*cos(temp.phi) || temp.x < -S_LENGTH/2. - PATH_STEP*sin(temp.theta)*cos(temp.phi) ) {
            stopLoop = true;
            m.final_coords = temp;
        } else if ( temp.y > S_WIDTH/2. - PATH_STEP*sin(temp.theta)*sin(temp.phi) || temp.y < -S_WIDTH/2. - PATH_STEP*sin(temp.theta)*sin(temp.phi)) {
            stopLoop = true;
            m.final_coords = temp;
        } else if (temp.z > S_HEIGHT - PATH_STEP*cos(temp.theta)) {
            stopLoop = true;
            m.final_coords = temp;
        } else {
            temp.x += PATH_STEP*sin(temp.theta)*cos(temp.phi);
            temp.y += PATH_STEP*sin(temp.theta)*sin(temp.phi);
            temp.z += PATH_STEP*cos(temp.theta);
        }
    }
    m.nphotons = nP;
    if(m.identity.event%1000==0){
        cout << "Processed event no. " << m.identity.event << endl;
    }
}
void muonProp ( Muon & m ) { int nP = 0 ; Coords temp = m . init_coords ; bool stopLoop = false ; while ( ! stopLoop ) { int tempP = nPhotons ( ) ; if ( tempP ) { for ( int i = 0 ; i < tempP ; i ++ ) { Photon P ( temp , m . identity , nP ) ; if ( photonProp ( P ) ) nP ++ ; } } if ( temp . x > S_LENGTH / 2. - PATH_STEP * sin ( temp . theta ) * cos ( temp . phi ) || temp . x < - S_LENGTH / 2. - PATH_STEP * sin ( temp . theta ) * cos ( temp . phi ) ) { stopLoop = true ; m . final_coords = temp ; } else if ( temp . y > S_WIDTH / 2. - PATH_STEP * sin ( temp . theta ) * sin ( temp . phi ) || temp . y < - S_WIDTH / 2. - PATH_STEP * sin ( temp . theta ) * sin ( temp . phi ) ) { stopLoop = true ; m . final_coords = temp ; } else if ( temp . z > S_HEIGHT - PATH_STEP * cos ( temp . theta ) ) { stopLoop = true ; m . final_coords = temp ; } else { temp . x += PATH_STEP * sin ( temp . theta ) * cos ( temp . phi ) ; temp . y += PATH_STEP * sin ( temp . theta ) * sin ( temp . phi ) ; temp . z += PATH_STEP * cos ( temp . theta ) ; } } m . nphotons = nP ; if ( m . identity . event % 1000 == 0 ) { cout << " " << m . identity . event << endl ; } }
Function for muon propagation and photon generation
Function for muon propagation and photon generation
// Iteration temp vars // Muon propagation // Photon generation // Create photon instance // Check if muon has left the detector // Update Muon path // Aftermath