Bug Summary

File:libraries/CCAL/DCCALGeometry.cc
Location:line 24, column 2
Description:Value stored to 'innerRadius' is never read

Annotated Source Code

1// $Id$
2//
3// File: DCCALGeometry.cc
4// Created: Tue Nov 30 15:42:41 EST 2010
5// Creator: davidl (on Linux ifarml6 2.6.18-128.el5 x86_64)
6//
7
8#include <cassert>
9#include <math.h>
10using namespace std;
11
12#include "DCCALGeometry.h"
13#include "DVector2.h"
14
15//---------------------------------
16// DCCALGeometry (Constructor)
17//---------------------------------
18DCCALGeometry::DCCALGeometry() :
19m_numActiveBlocks( 0 )
20{
21 double innerRadius = ( kCCALBeamHoleSize2 - 1 ) / 2. * blockSize() * sqrt(2.);
22
23 // inflate the innner radius by 1% to for "safe" comparison
24 innerRadius *= 1.01;
Value stored to 'innerRadius' is never read
25
26 for( int row = 0; row < kCCALBlocksTall16; row++ ){
27 for( int col = 0; col < kCCALBlocksWide16; col++ ){
28
29 // transform to beam axis
30 m_positionOnFace[row][col] =
31 DVector2( ( (double)col - kCCALMidBlock(16)/2 +0.5 ) * blockSize(),
32 ( (double)row - kCCALMidBlock(16)/2 +0.5 ) * blockSize() );
33
34 m_activeBlock[row][col] = true;
35
36 // build the "channel map"
37 m_channelNumber[row][col] = m_numActiveBlocks;
38 m_row[m_numActiveBlocks] = row;
39 m_column[m_numActiveBlocks] = col;
40
41 m_numActiveBlocks++;
42 }
43 }
44}
45
46bool
47DCCALGeometry::isBlockActive( int row, int column ) const
48{
49 // I'm inserting these lines to effectively disable the
50 // two assert calls below. They are causing all programs
51 // (hd_dump, hdview) to exit, even when I'm not interested
52 // in the FCAL. This does not fix the underlying problem
53 // of why we're getting invalid row/column values.
54 // 12/13/05 DL
55 if( row < 0 || row >= kCCALBlocksTall16 )return false;
56 if( column < 0 || column >= kCCALBlocksWide16 )return false;
57
58 assert( row >= 0 && row < kCCALBlocksTall )((row >= 0 && row < 16) ? static_cast<void>
(0) : __assert_fail ("row >= 0 && row < 16", "DCCALGeometry.cc"
, 58, __PRETTY_FUNCTION__))
;
59 assert( column >= 0 && column < kCCALBlocksWide )((column >= 0 && column < 16) ? static_cast<
void> (0) : __assert_fail ("column >= 0 && column < 16"
, "DCCALGeometry.cc", 59, __PRETTY_FUNCTION__))
;
60
61 return m_activeBlock[row][column];
62}
63
64int
65DCCALGeometry::row( float y ) const
66{
67 return static_cast<int>( y / blockSize() + kCCALMidBlock(16)/2 );
68}
69
70int
71DCCALGeometry::column( float x ) const
72{
73 return static_cast<int>( x / blockSize() + kCCALMidBlock(16)/2 );
74}
75
76DVector2
77DCCALGeometry::positionOnFace( int row, int column ) const
78{
79 assert( row >= 0 && row < kCCALBlocksTall )((row >= 0 && row < 16) ? static_cast<void>
(0) : __assert_fail ("row >= 0 && row < 16", "DCCALGeometry.cc"
, 79, __PRETTY_FUNCTION__))
;
80 assert( column >= 0 && column < kCCALBlocksWide )((column >= 0 && column < 16) ? static_cast<
void> (0) : __assert_fail ("column >= 0 && column < 16"
, "DCCALGeometry.cc", 80, __PRETTY_FUNCTION__))
;
81
82 return m_positionOnFace[row][column];
83}
84
85DVector2
86DCCALGeometry::positionOnFace( int channel ) const
87{
88 assert( channel >= 0 && channel < m_numActiveBlocks )((channel >= 0 && channel < m_numActiveBlocks) ?
static_cast<void> (0) : __assert_fail ("channel >= 0 && channel < m_numActiveBlocks"
, "DCCALGeometry.cc", 88, __PRETTY_FUNCTION__))
;
89
90 return positionOnFace( m_row[channel], m_column[channel] );
91}
92
93int
94DCCALGeometry::channel( int row, int column ) const
95{
96 if( isBlockActive( row, column ) ){
97
98 return m_channelNumber[row][column];
99 }
100 else{
101
102 cerr << "ERROR: request for channel number of inactive block!" << endl;
103 return -1;
104 }
105}