Commit c1b869bb authored by Guillaume Baulieu's avatar Guillaume Baulieu
Browse files

Reducing variable scope or removing unused variables

parent 438b0f20
......@@ -222,7 +222,6 @@ void ChainOfActors::Dispatch()
int used1=thisLocker->GetDataSize(myIndex);
if(used1 == 0) { // refill only if no rest data in exchange buffer
thisLocker->StoreData(myIndex, (char*)dispatchBuff, dispatchSize);
int used2=thisLocker->GetDataSize(myIndex);
dispatchSize = 0; // StoreData guaranteed to take all data
dispatchFlag = false;
thisLocker->Unlock(myIndex);
......@@ -257,9 +256,7 @@ void ChainOfActors::DispatchEOD()
UInt_t i4dat[kEodKeySize] = {sizeof(i4dat), 0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
i4dat[1] = ptrBuilder->uKeyIn[indQueue];
int used1=thisLocker->GetDataSize(myIndex);
thisLocker->AddData(myIndex, (char*)i4dat, sizeof(i4dat)); // bytes
int used2=thisLocker->GetDataSize(myIndex);
dispatchSize = 0;
isClosed = true;
thisLocker->Unlock(myIndex);
......
......@@ -1584,7 +1584,7 @@ bool topologyInit()
bool topologyStart()
{
UInt_t error_code; uint32_t e_code;
UInt_t error_code;
for(size_t nc = 0; nc < theChains.size(); nc++) {
ChainOfActors * pChain = theChains[nc];
......@@ -1592,7 +1592,7 @@ bool topologyStart()
pChain->runThreaded = runThreaded;
bool printmsg = true;
for(int na = 0; na < pChain->numActors; na++) {
error_code = 0; e_code = 0;
error_code = 0;
actor *pActor = &pChain->theActors[na];
if(!pActor->nrvPointer && !pActor->evbPointer)
continue;
......@@ -1640,14 +1640,14 @@ bool topologyStart()
bool topologyStop()
{
UInt_t error_code; uint32_t e_code;
UInt_t error_code;
for(size_t nc = 0; nc < theChains.size(); nc++) {
ChainOfActors * pChain = theChains[nc];
cout << "\n FINISHING CHAIN " << nc << endl;
bool printmsg = true;
for(int na = 0; na < pChain->numActors; na++) {
error_code = 0; e_code = 0;
error_code = 0;
actor *pActor = &pChain->theActors[na];
if(!pActor->nrvPointer && !pActor->evbPointer)
continue;
......
......@@ -131,7 +131,7 @@ const double c8 = 1./sqrt(2.);
void MixFFT::factorize(int n, int *nFact, int fact[])
{
int i,j,k;
int i,j;
int nRadix;
int radices[7];
int factors[maxFactorCount];
......@@ -173,7 +173,7 @@ void MixFFT::factorize(int n, int *nFact, int fact[])
}
if (n>1)
{
for (k=2; (k-1)*(k-1) < n; k++) // D.B.2013 (k=2; k < sqrt(n)+1; k++) compiler complains on sqrt(n)
for (int k=2; (k-1)*(k-1) < n; k++) // D.B.2013 (k=2; k < sqrt(n)+1; k++) compiler complains on sqrt(n)
while ((n % k) == 0)
{
n=n / k;
......@@ -235,7 +235,7 @@ void MixFFT::permute(int nPoint, int nFact,
double xRe[], double xIm[],
double yRe[], double yIm[])
{
int i,j,k;
int i,k;
int count[maxFactorCount];
for (i=1; i<=nFact; i++) count[i]=0;
......@@ -244,7 +244,7 @@ void MixFFT::permute(int nPoint, int nFact,
{
yRe[i] = xRe[k];
yIm[i] = xIm[k];
j=1;
int j=1;
k=k+remain[j];
count[1] = count[1]+1;
while (count[j] >= fact[j])
......@@ -407,7 +407,7 @@ void MixFFT::fft_10()
void MixFFT::fft_odd(int radix)
{
double rere, reim, imre, imim;
int i,j,k,n,max;
int i,j,n,max;
n = radix;
max = (n + 1)/2;
......@@ -425,7 +425,7 @@ void MixFFT::fft_odd(int radix)
zIm[j]=zIm[0];
zRe[n-j]=zRe[0];
zIm[n-j]=zIm[0];
k=j;
int k=j;
for (i=1; i < max; i++)
{
rere = trigRe[k] * vRe[i];
......
......@@ -77,13 +77,11 @@ void MWD::MWDreset(unsigned int nn)
// calcola la linea di base iniziale su nDcwin campioni
float MWD::MWstart(float *ps)
{
unsigned int ii;
float *ps1;
float vstart = 0.;
if(nDcwin > 0) {
ps1 = ps;
for(ii = 0; ii < nDcwin; ii++)
float *ps1 = ps;
for(unsigned int ii = 0; ii < nDcwin; ii++)
vstart += *ps1++;
vstart /= (float)(nDcwin);
}
......@@ -93,13 +91,11 @@ float MWD::MWstart(float *ps)
// calcola l' ampiezza finale su nDcwin campioni
float MWD::MWampli(float *ps)
{
unsigned int ii;
float *ps1;
float vstart = 0;
if(nDcwin > 0) {
ps1 = ps+nNsamp-nDcwin;
for(ii = 0; ii < nDcwin; ii++)
float *ps1 = ps+nNsamp-nDcwin;
for(unsigned int ii = 0; ii < nDcwin; ii++)
vstart += *ps1++;
vstart /= (float)(nDcwin);
}
......@@ -363,11 +359,11 @@ int MWD::MWtrigZC(float *tfa, float *cfa, float *subStep)
{
int state = 0; // begin in an indefinite state
unsigned int nn, widthP = 0, widthN = 0;
float cfaOld(0), cfaInp, tfaInp;
float cfaOld(0);
for(nn = 0; nn < nNsamp; nn++) {
cfaInp = cfa[nn];
tfaInp = tfa[nn];
float cfaInp = cfa[nn];
float tfaInp = tfa[nn];
switch (state) {
case 0: // was below CF threshold in an indefinite state
if(cfaInp > fThreshCFA) { // and goes above
......@@ -418,11 +414,11 @@ int MWD::MWtrigZCp(float *cfa, float *tfa, float *subStep)
{
int state = 0; // begin in an indefinite state
unsigned int nn, widthP = 0, widthN = 0;
float cfaOld(0), cfaInp, tfaInp;
float cfaOld(0);
for(nn = 0; nn < nNsamp; nn++) {
cfaInp = cfa[nn];
tfaInp = tfa[nn];
float cfaInp = cfa[nn];
float tfaInp = tfa[nn];
switch (state) {
case 0: // was below CF threshold in an indefinite state
if(cfaInp > fThreshCFA) { // and goes above
......@@ -472,11 +468,11 @@ int MWD::MWtrigZCn(float *cfa, float *tfa, float *subStep)
{
int state = 0; // begin in an indefinite state
unsigned int nn, widthP = 0, widthN = 0;
float cfaOld(0), cfaInp, tfaInp;
float cfaOld(0);
for(nn = 0; nn < nNsamp; nn++) {
cfaInp = cfa[nn];
tfaInp = tfa[nn];
float cfaInp = cfa[nn];
float tfaInp = tfa[nn];
switch (state) {
case 0: // was below CF threshold in an indefinite state
if(cfaInp <= fThreshCFA) { // and goes above
......@@ -577,7 +573,7 @@ float MWD::MWvalues(float *pdat)
const double SIG2FW = sqrt(8.*log(2.));
unsigned int ii, izm;
float *pd, val, bval, tval;
float *pd, bval, tval;
pd = pdat+nZ1;
fZ = fZ1 = fZ2 = 0.;
......@@ -595,7 +591,7 @@ float MWD::MWvalues(float *pdat)
bval = fZ;
tval = 0;
for(ii = nZ1; ii <= nZ2; ii++) {
val = *pd++ - bval;
float val = *pd++ - bval;
tval += val*val;
}
fBFWHM = float(SIG2FW*sqrt(tval/(nZ2-nZ1+1)));
......@@ -632,12 +628,12 @@ float MWD::MWvalues(float *pdat)
float MWD::MWtransampl(float *pdat, unsigned int ch1)
{
unsigned int ch, tpos, tneg;
float vv, vpos, vneg;
float vpos, vneg;
vpos = vneg = pdat[ch1];
tpos = tneg = ch1;
for(ch = ch1+1; ch < nNsamp; ch++) {
vv = pdat[ch];
float vv = pdat[ch];
if(vv > vpos) {
vpos = vv;
tpos = ch;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment