This needs to be factored out into a function and put in a loop.  Consider pseudocode:

array siDetS3Rings[24];
array siDetS3RingsLogs[24];
array siDetS3RingNames[24];

//populate above arrays, then:

for(i=0; i<24; i++){
    buildS3ring(SiDetS3Rings[i], SiDetS3RingsLogs[i], SiDetS3RingsNames[i]);
}

function buildS3ring(rings, logs, names){
    //do the cut and pasted stuff below verbatim
}