Commit 07e74229 authored by Jochen Meyer's avatar Jochen Meyer Committed by Graeme Stewart
Browse files

addressing coverity defects (MuonCalibEventBase-02-00-03)

	* tagging  MuonCalibEventBase-02-00-03
	* addressing coverity defects 12260-3, 12432

2015-04-14 Jochen Meyer
	* tagging  MuonCalibEventBase-02-00-02
	* addressing coverity defects 14609-12
parent d98658b8
......@@ -41,6 +41,7 @@ MoMu : Modular muon reconstruction is applied. A pattern may contain multiple se
MuonCalibEventInfo( unsigned int run_number, unsigned int event_number, unsigned int time_stamp, std::string tag ); //!< constructor from older times
MuonCalibEventInfo( unsigned int run_number, unsigned int event_number, unsigned int time_stamp, unsigned int lumi_block, unsigned int bc_id, std::string tag ); //!< constructor initializing all members
MuonCalibEventInfo( const MuonCalibEventInfo& eventInfo ); //!< copyconstructor
MuonCalibEventInfo& operator=(const MuonCalibEventInfo& eventInfo ); // !< assignment operator
~MuonCalibEventInfo(); //!< destructor
std::ostream& dump( std::ostream& stream ) const ;
......
......@@ -47,6 +47,7 @@ The pattern recognition provides the MuonCalibPattern, optionally one can provid
double invP, double phi, double theta,
unsigned int nmdt, unsigned int nrpc, unsigned int ntgc, unsigned int ncsc); //!< constructor initializing the pattern with trackparameters, chi2 and number of hits in the different technologies.
MuonCalibPattern(const MuonCalibPattern& pat);//!< Copy constructor. Not sure wether we need it...
MuonCalibPattern& operator=(const MuonCalibPattern& pat ); //!< assignment operator. Not sure wether we need it...
~MuonCalibPattern(); //!< destructor
//accessors
......
......@@ -29,7 +29,9 @@ namespace MuonCalib {
class MuonCalibRawCscHit {
public:
MuonCalibRawCscHit() {};//!< default constructor
MuonCalibRawCscHit()
: m_Gpos(0.,0.,0.), m_occupancy(0), m_t(0.), m_width(0.), m_charge(0.)
{};//!< default constructor
MuonCalibRawCscHit( const MuonFixedId& id, const Amg::Vector3D& glob, int occ, float t, float width, float charge );//!< constructor setting all attributes
......
......@@ -26,7 +26,9 @@ namespace MuonCalib {
*/
class MuonCalibRawMdtHit {
public:
MuonCalibRawMdtHit() {}; //!< default constructor
MuonCalibRawMdtHit()
: m_Lpos(0.,0.,0.), m_Gpos(0.,0.,0.), m_adc(0), m_tdc(0), m_occupancy(0), m_t(0.), m_r(0.), m_dr(0.)
{}; //!< default constructor
MuonCalibRawMdtHit(const MuonFixedId& id, const Amg::Vector3D& loc, const Amg::Vector3D& glob, int occ ); //!<constructor initializing the identifier, the position(s) and occupancy.
MuonCalibRawMdtHit( const MuonCalibRawMdtHit& hit ); //!< copyconstructor
~MuonCalibRawMdtHit( ) {}; //!< destructor
......
......@@ -26,7 +26,11 @@ namespace MuonCalib {
class MuonCalibRawTgcCoin {
public:
MuonCalibRawTgcCoin() {};//!< default constructor
MuonCalibRawTgcCoin()
: m_gPosIn(0.,0.,0.), m_gPosOut(0.,0.,0.), m_type(0), m_eta(0), m_phi(0), m_sector(0), m_isForward(0), m_isStrip(0), m_trackletId(0),
m_trackletIdStrip(0), m_bcTag(0), m_widthIn(0.), m_widthOut(0.), m_widthR(0.), m_widthPhi(0.), m_delta(0), m_roi(0), m_pt(0), m_sub(0),
m_isPositiveDeltaR(0)
{}; //!< default constructor
MuonCalibRawTgcCoin( const MuonFixedId& id, const Amg::Vector3D& gPosIn, const Amg::Vector3D& gPosOut, const int type, const int eta, const int phi,
const int sector, const int isForward, const int isStrip, const int trackletId, const int trackletIdStrip, const int bcTag,
......
......@@ -26,7 +26,10 @@ namespace MuonCalib {
class MuonCalibRawTgcHit {
public:
MuonCalibRawTgcHit() {};//!< default constructor
MuonCalibRawTgcHit()
: m_Gpos(0.,0.,0.), m_occupancy(0), m_station(0), m_eta(0), m_phi(0), m_gasGap(0), m_isStrip(0),
m_channel(0), m_bcTag(0), m_width(0.), m_shortWidth(0.), m_longWidth(0.), m_length(0.)
{};//!< default constructor
MuonCalibRawTgcHit( const MuonFixedId& id, const Amg::Vector3D& glob, int occ, int station, int eta, int phi,
int gasGap, int isStrip, int channel, int bcTag, float width, float shortWidth, float longWidth ); //!< constructor setting almost all attributes
MuonCalibRawTgcHit( const MuonFixedId& id, const Amg::Vector3D& glob, int occ, int station, int eta, int phi,
......
......@@ -65,6 +65,7 @@ Functionality is forseen to store nearby hits, which are not assigned to the seg
MuonCalibSegment(double chi2, const Amg::Vector3D& pos, const Amg::Vector3D& dir, const Amg::Transform3D& locToGlo,
unsigned int qualityFlag = 0); //!< constructor fully initializing the segment-parameters, do we need default constructor?
MuonCalibSegment& operator=(const MuonCalibSegment& seg ); //!< assignment operator
MuonCalibSegment(const MuonCalibSegment& seg); //!< copy constructor
virtual ~MuonCalibSegment(); //!< destructor
......
......@@ -14,8 +14,9 @@ namespace MuonCalib {
class MuonCalibTriggerTimeInfo{
public:
MuonCalibTriggerTimeInfo(); //!< Default constructor
MuonCalibTriggerTimeInfo( float dMbtsTime, float dLarTime ); //!< constructor with Mbts Time and LAr time
MuonCalibTriggerTimeInfo( float dMbtsTime, float dLarTime ); //!< constructor with Mbts Time and LAr time
MuonCalibTriggerTimeInfo( const MuonCalibTriggerTimeInfo& dTimeInfo ); //!< copyconstructor
MuonCalibTriggerTimeInfo& operator=(const MuonCalibTriggerTimeInfo& dTimeInfo ); //!< assignment operator
~MuonCalibTriggerTimeInfo(); //!< destructor
std::ostream& dump( std::ostream& stream ) const ;
......
......@@ -51,7 +51,6 @@ namespace MuonCalib {
{
m_eventInfo = event.eventInfo() ;
MCPVecCit it = event.patternBegin() ;
MCPVecCit it_end = event.patternEnd() ;
for( ; it!=it_end;++it){
......@@ -69,16 +68,23 @@ namespace MuonCalib {
if(this!=&rhs){
m_eventInfo = rhs.eventInfo() ;
std::for_each( patternBegin(), patternEnd(), DeleteObject() ) ;
m_patternVec.clear();
MCPVec temp_patternVec;
MCPVecCit it = rhs.patternBegin() ;
MCPVecCit it_end = rhs.patternEnd() ;
for( ; it!=it_end;++it){
temp_patternVec.push_back( new MuonCalibPattern(**it) ) ;
}
m_patternVec = temp_patternVec ;
m_patternVec = temp_patternVec ;
if(m_truthColl) { delete m_truthColl; m_truthColl=NULL;}
m_truthColl = new MuonCalibTruthCollection(*rhs.calibTruthCollection());
if(m_rawColl) { delete m_rawColl; m_rawColl=NULL;}
m_rawColl = new MuonCalibRawHitCollection(*rhs.rawHitCollection());
if(m_rawTriggerColl) { delete m_rawTriggerColl; m_rawTriggerColl=NULL;}
m_rawTriggerColl = new MuonCalibRawTriggerHitCollection(*rhs.rawTriggerHitCollection());
if(m_triggerTimeInfo) { delete m_triggerTimeInfo; m_triggerTimeInfo=NULL;}
m_triggerTimeInfo = new MuonCalibTriggerTimeInfo(*rhs.triggerTimeInfo());
m_rpcSlLogicContainer = rhs.rpcSectorLogicContainer();
......
......@@ -50,6 +50,20 @@ namespace MuonCalib {
m_trigger_bits = eventInfo.m_trigger_bits;
}
MuonCalibEventInfo& MuonCalibEventInfo::operator=( const MuonCalibEventInfo& eventInfo)
{
if (this!=&eventInfo) {
m_runNumber = eventInfo.runNumber();
m_eventNumber = eventInfo.eventNumber();
m_timeStamp = eventInfo.timeStamp();
m_lumiBlock = eventInfo.lumiBlock();
m_bcId = eventInfo.bcId();
m_tag = eventInfo.tag();
m_trigger_bits = eventInfo.m_trigger_bits;
}
return *this;
}
MuonCalibEventInfo::~MuonCalibEventInfo()
{
}
......
......@@ -70,13 +70,39 @@ namespace MuonCalib {
MuonCalibSegment* seg = new MuonCalibSegment( **pat_it );
addMuonSegment( seg );
}
}
MuonCalibPattern& MuonCalibPattern::operator=( const MuonCalibPattern& pat)
{
if (this!=&pat) {
m_chi2 = pat.chi2();
m_z0 = pat.z0();
m_dist0 = pat.r0();
m_invP = pat.invP();
m_phi = pat.phi();
m_theta = pat.theta();
m_nmdt = pat.nmdtHits();
m_nrpc = pat.nrpcHits();
m_ntgc = pat.ntgcHits();
m_ncsc = pat.ncscHits();
std::for_each( muonSegBegin(), muonSegEnd(), DeleteObject() );
m_muonSegments.clear();
MuonSegCit pat_it = pat.muonSegBegin();
MuonSegCit pat_it_end = pat.muonSegEnd();
for( ; pat_it!= pat_it_end; ++pat_it){
MuonCalibSegment* seg = new MuonCalibSegment( **pat_it );
addMuonSegment( seg );
}
}
return *this;
}
MuonCalibPattern::~MuonCalibPattern()
{
// MuonCalibPattern owns the segments
std::for_each( muonSegBegin(), muonSegEnd(), DeleteObject() );
m_muonSegments.clear();
}
std::ostream& MuonCalibPattern::dump( std::ostream& os) const
......
......@@ -100,6 +100,86 @@ namespace MuonCalib {
addCloseHit( new TgcCalibHitBase(**tgc_it));
}
}
MuonCalibSegment& MuonCalibSegment::operator=( const MuonCalibSegment& seg)
{
if (this!=&seg) {
m_chi2 = seg.chi2();
m_dy0 = seg.error_dy0();
m_dtheta = seg.error_dtheta();
m_localPosition = seg.position();
m_localDirection = seg.direction();
m_localToGlobal = seg.localToGlobal();
m_qualityFlag = seg.qualityFlag();
m_author = seg.author();
m_fittedT0 = seg.m_fittedT0; // don't use function as it would return 0 if m_fittedT0 == -99999.
std::for_each( mdtHOTBegin(), mdtHOTEnd(), DeleteObject() );
m_mdtHitsOnTrack.clear();
MdtHitCit mdt_it = seg.mdtHOTBegin();
MdtHitCit mdt_it_end = seg.mdtHOTEnd();
for( ; mdt_it!=mdt_it_end;++mdt_it){
addHitOnTrack( new MdtCalibHitBase(**mdt_it));
}
std::for_each( mdtCloseHitsBegin(), mdtCloseHitsEnd(), DeleteObject() );
m_mdtCloseHits.clear();
mdt_it = seg.mdtCloseHitsBegin();
mdt_it_end = seg.mdtCloseHitsEnd();
for( ; mdt_it!=mdt_it_end;++mdt_it){
addCloseHit( new MdtCalibHitBase(**mdt_it));
}
std::for_each( cscHOTBegin(), cscHOTEnd(), DeleteObject() );
m_cscHitsOnTrack.clear();
CscHitCit csc_it = seg.cscHOTBegin();
CscHitCit csc_it_end = seg.cscHOTEnd();
for( ; csc_it!=csc_it_end;++csc_it){
addHitOnTrack( new CscCalibHitBase(**csc_it));
}
std::for_each( cscCloseHitsBegin(), cscCloseHitsEnd(), DeleteObject() );
m_cscCloseHits.clear();
csc_it = seg.cscCloseHitsBegin();
csc_it_end = seg.cscCloseHitsEnd();
for( ; csc_it!=csc_it_end;++csc_it){
addCloseHit( new CscCalibHitBase(**csc_it));
}
std::for_each( rpcHOTBegin(), rpcHOTEnd(), DeleteObject() );
m_rpcHitsOnTrack.clear();
RpcHitCit rpc_it = seg.rpcHOTBegin();
RpcHitCit rpc_it_end = seg.rpcHOTEnd();
for( ; rpc_it!=rpc_it_end;++rpc_it){
addHitOnTrack( new RpcCalibHitBase(**rpc_it));
}
std::for_each( rpcCloseHitsBegin(), rpcCloseHitsEnd(), DeleteObject() );
m_rpcCloseHits.clear();
rpc_it = seg.rpcCloseHitsBegin();
rpc_it_end = seg.rpcCloseHitsEnd();
for( ; rpc_it!=rpc_it_end;++rpc_it){
addCloseHit( new RpcCalibHitBase(**rpc_it));
}
std::for_each( tgcHOTBegin(), tgcHOTEnd(), DeleteObject() );
m_tgcHitsOnTrack.clear();
TgcHitCit tgc_it = seg.tgcHOTBegin();
TgcHitCit tgc_it_end = seg.tgcHOTEnd();
for( ; tgc_it!=tgc_it_end;++tgc_it){
addHitOnTrack( new TgcCalibHitBase(**tgc_it));
}
std::for_each( tgcCloseHitsBegin(), tgcCloseHitsEnd(), DeleteObject() );
m_tgcCloseHits.clear();
tgc_it = seg.tgcCloseHitsBegin();
tgc_it_end = seg.tgcCloseHitsEnd();
for( ; tgc_it!=tgc_it_end;++tgc_it){
addCloseHit( new TgcCalibHitBase(**tgc_it));
}
}
return *this;
}
unsigned int MuonCalibSegment::hitsPerML(int ML)const
{
......
......@@ -22,6 +22,15 @@ namespace MuonCalib {
m_dLarTime = eventInfo.dLarTime();
}
MuonCalibTriggerTimeInfo& MuonCalibTriggerTimeInfo::operator=( const MuonCalibTriggerTimeInfo& eventInfo )
{
if (this!=&eventInfo) {
m_dMbtsTime = eventInfo.dMbtsTime();
m_dLarTime = eventInfo.dLarTime();
}
return *this;
}
MuonCalibTriggerTimeInfo::~MuonCalibTriggerTimeInfo()
{
}
......
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