Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
KM3NETDAQ::JRandomTimeslice::random_indices_t Struct Reference

Auxiliary data structure for randomisation of indices. More...

#include <JRandomTimeslice.hh>

Inheritance diagram for KM3NETDAQ::JRandomTimeslice::random_indices_t:
std::vector< size_t >

Public Member Functions

 random_indices_t (const size_t N)
 Constructor.
 
void random_shuffle (const std::set< size_t > &keep)
 Randomly shuffle values between fixed indices.
 

Private Member Functions

void random_shuffle (const int i1, const int i2)
 Randomly shuffle values between given indices.
 

Detailed Description

Auxiliary data structure for randomisation of indices.

Definition at line 167 of file JRandomTimeslice.hh.

Constructor & Destructor Documentation

◆ random_indices_t()

KM3NETDAQ::JRandomTimeslice::random_indices_t::random_indices_t ( const size_t N)
inline

Constructor.

Parameters
Nnumber of indices

Definition at line 175 of file JRandomTimeslice.hh.

175 :
177 {}

Member Function Documentation

◆ random_shuffle() [1/2]

void KM3NETDAQ::JRandomTimeslice::random_indices_t::random_shuffle ( const std::set< size_t > & keep)
inline

Randomly shuffle values between fixed indices.

Parameters
keepfixed indices

Definition at line 184 of file JRandomTimeslice.hh.

185 {
186 for (size_t i = 0; i != this->size(); ++i) {
187 (*this)[i] = i;
188 }
189
190 size_t i1 = 0;
191
192 for (const size_t i2 : keep) {
193
195
196 i1 = i2 + 1;
197 }
198
199 random_shuffle(i1, this->size());
200 }
Template definition of a multi-dimensional oscillation probability interpolation table.
void random_shuffle(const std::set< size_t > &keep)
Randomly shuffle values between fixed indices.

◆ random_shuffle() [2/2]

void KM3NETDAQ::JRandomTimeslice::random_indices_t::random_shuffle ( const int i1,
const int i2 )
inlineprivate

Randomly shuffle values between given indices.

Parameters
i1first index (included)
i2last index (excluded)

Definition at line 209 of file JRandomTimeslice.hh.

210 {
211 for (int i = i2 - 1; i > i1; --i) {
212
213 const int l = i1 + gRandom->Integer(i - i1);
214
215 std::swap((*this)[i], (*this)[l]);
216 }
217 }

The documentation for this struct was generated from the following file: