Bug Summary

File:libraries/PID/DNeutralShower_factory.cc
Location:line 105, column 25
Description:Dereference of null pointer

Annotated Source Code

1// $Id$
2//
3// File: DNeutralShower_factory.cc
4// Created: Tue Aug 9 14:29:24 EST 2011
5// Creator: pmatt (on Linux ifarml6 2.6.18-128.el5 x86_64)
6//
7
8#include <iostream>
9#include <iomanip>
10using namespace std;
11
12#include "DNeutralShower_factory.h"
13using namespace jana;
14
15//------------------
16// init
17//------------------
18jerror_t DNeutralShower_factory::init(void)
19{
20 //this parameter controls what BCAL reconstruction algorithm to use
21 USE_KLOE = 1;
22 gPARMS->SetDefaultParameter("BCALRECON:USE_KLOE", USE_KLOE);
23
24
25 if(USE_KLOE){
26 cout << "Using KLOE BCAL clustering." << endl;
27 }
28 else{
29 cout << "Using alternative (experimental) BCAL clustering." << endl;
30 }
31
32 return NOERROR;
33}
34
35//------------------
36// brun
37//------------------
38jerror_t DNeutralShower_factory::brun(jana::JEventLoop *locEventLoop, int runnumber)
39{
40 return NOERROR;
41}
42
43//------------------
44// evnt
45//------------------
46jerror_t DNeutralShower_factory::evnt(jana::JEventLoop *locEventLoop, int eventnumber)
47{
48 const DChargedTrackHypothesis* locChargedTrackHypothesis;
49 const DBCALShower *locBCALShower;
50 const DFCALShower *locFCALShower;
51 DNeutralShower *locNeutralShower;
52 vector<const DBCALShower*> locAssociatedBCALShowers;
53 vector<const DFCALShower*> locAssociatedFCALShowers;
54 vector<const DChargedTrackHypothesis*> locAssociatedChargedTrackHypotheses;
55 bool locShowerMatchedToTrackFlag;
56
57 vector<const DChargedTrackHypothesis*> locChargedTrackHypotheses;
58 vector<const DBCALShower*> locBCALShowers;
59 vector<const DFCALShower*> locFCALShowers;
60 locEventLoop->Get(locChargedTrackHypotheses);
61 if (USE_KLOE) {
1
Taking false branch
62 locEventLoop->Get(locBCALShowers, "KLOE");
63 } else {
64 locEventLoop->Get(locBCALShowers);
65 }
66 locEventLoop->Get(locFCALShowers);
67
68 // Loop over all DBCALShowers, see if they match to DChargedTrackHypotheses.
69 // Create DNeutralShower for each shower that is not matched to any DChargedTrackHypothesis
70 // The chance of an actual neutral shower matching to a bogus DChargedTrackHypothesis is very small
71 for(unsigned int loc_i = 0; loc_i < locBCALShowers.size(); ++loc_i){
2
Loop condition is false. Execution continues on line 98
72 locBCALShower = locBCALShowers[loc_i];
73 locShowerMatchedToTrackFlag = false;
74 for(unsigned int loc_j = 0; loc_j < locChargedTrackHypotheses.size(); ++loc_j){
75 locChargedTrackHypothesis = locChargedTrackHypotheses[loc_j];
76 locChargedTrackHypothesis->GetT(locAssociatedBCALShowers);
77 for(unsigned int loc_k = 0; loc_k < locAssociatedBCALShowers.size(); ++loc_k){
78 if(locBCALShower == locAssociatedBCALShowers[loc_k]){
79 locShowerMatchedToTrackFlag = true;
80 break;
81 }
82 }
83 if(locShowerMatchedToTrackFlag)
84 break;
85 }
86 if(locShowerMatchedToTrackFlag)
87 continue;
88
89 // create DNeutralShower
90 locNeutralShower = new DNeutralShower(locBCALShower);
91 locNeutralShower->AddAssociatedObject(locBCALShower);
92 _data.push_back(locNeutralShower);
93 }
94
95 // Loop over all DFCALShowers, see if they match to DChargedTrackHypotheses.
96 // Create DNeutralShower for each shower that is not matched to any DChargedTrackHypothesis
97 // The chance of an actual neutral shower matching to a bogus DChargedTrackHypothesis is very small
98 for(unsigned int loc_i = 0; loc_i < locFCALShowers.size(); ++loc_i){
3
Loop condition is true. Entering loop body
6
Loop condition is true. Entering loop body
9
Loop condition is true. Entering loop body
12
Loop condition is true. Entering loop body
99 locFCALShower = locFCALShowers[loc_i];
100 locShowerMatchedToTrackFlag = false;
101 for(unsigned int loc_j = 0; loc_j < locChargedTrackHypotheses.size(); ++loc_j){
4
Loop condition is false. Execution continues on line 113
7
Loop condition is false. Execution continues on line 113
10
Loop condition is false. Execution continues on line 113
13
Loop condition is true. Entering loop body
102 locChargedTrackHypothesis = locChargedTrackHypotheses[loc_j];
103 locChargedTrackHypothesis->GetT(locAssociatedFCALShowers);
104 for(unsigned int loc_k = 0; loc_k < locAssociatedFCALShowers.size(); ++loc_k){
14
Loop condition is true. Entering loop body
105 if(locFCALShower == locAssociatedFCALShowers[loc_k]){
15
Dereference of null pointer
106 locShowerMatchedToTrackFlag = true;
107 break;
108 }
109 }
110 if(locShowerMatchedToTrackFlag)
111 break;
112 }
113 if(locShowerMatchedToTrackFlag)
5
Taking false branch
8
Taking false branch
11
Taking false branch
114 continue;
115
116 // create DNeutralShower
117 locNeutralShower = new DNeutralShower(locFCALShower);
118 locNeutralShower->AddAssociatedObject(locFCALShower);
119 _data.push_back(locNeutralShower);
120 }
121
122 return NOERROR;
123}
124
125//------------------
126// erun
127//------------------
128jerror_t DNeutralShower_factory::erun(void)
129{
130 return NOERROR;
131}
132
133//------------------
134// fini
135//------------------
136jerror_t DNeutralShower_factory::fini(void)
137{
138 return NOERROR;
139}
140
141