From dab4328ce486389ee7b1fc1635032fbd6bb6fe8c Mon Sep 17 00:00:00 2001 From: dsilverm Date: Thu, 1 Dec 2011 14:04:18 +0000 Subject: [PATCH] coverity and RuleChecker viol fixes --- EMCAL/AliCaloFitSubarray.cxx | 9 +++++++++ EMCAL/AliCaloFitSubarray.h | 1 + EMCAL/AliEMCALQAChecker.cxx | 17 +++++------------ EMCAL/AliEMCALQADataMakerRec.cxx | 20 ++++++++++---------- EMCAL/AliEMCALQADataMakerRec.h | 2 +- EMCAL/AliEMCALRawUtils.cxx | 6 +++--- EMCAL/AliEMCALRawUtils.h | 2 +- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/EMCAL/AliCaloFitSubarray.cxx b/EMCAL/AliCaloFitSubarray.cxx index ddbc845d259..0b6da95ea17 100644 --- a/EMCAL/AliCaloFitSubarray.cxx +++ b/EMCAL/AliCaloFitSubarray.cxx @@ -53,6 +53,15 @@ AliCaloFitSubarray::AliCaloFitSubarray(const AliCaloFitSubarray & fitS) : { } +//_____________________________________________________________________ +AliCaloFitSubarray& AliCaloFitSubarray::operator = (const AliCaloFitSubarray &source) +{ // assignment operator; use copy ctor + if (&source == this) return *this; + + new (this) AliCaloFitSubarray(source); + return *this; +} + AliCaloFitSubarray::~AliCaloFitSubarray() { } diff --git a/EMCAL/AliCaloFitSubarray.h b/EMCAL/AliCaloFitSubarray.h index ccf6a606ddf..b0f6be4cb11 100644 --- a/EMCAL/AliCaloFitSubarray.h +++ b/EMCAL/AliCaloFitSubarray.h @@ -27,6 +27,7 @@ class AliCaloFitSubarray explicit AliCaloFitSubarray(const Int_t init); AliCaloFitSubarray(const AliCaloFitSubarray &fitSubarray); + AliCaloFitSubarray& operator = (const AliCaloFitSubarray& source) ; virtual ~AliCaloFitSubarray(); diff --git a/EMCAL/AliEMCALQAChecker.cxx b/EMCAL/AliEMCALQAChecker.cxx index 32ca9caeb57..f72cc668cbe 100644 --- a/EMCAL/AliEMCALQAChecker.cxx +++ b/EMCAL/AliEMCALQAChecker.cxx @@ -111,19 +111,12 @@ fText(new TPaveText(0.2,0.7,0.8,0.9,"NDC")) } //__________________________________________________________________ AliEMCALQAChecker& AliEMCALQAChecker::operator = (const AliEMCALQAChecker &qac) -{ - AliQACheckerBase(qac.GetName(), qac.GetTitle()); - fTextSM = new TText*[fgknSM] ; - fLineCol = static_cast(qac.fLineCol->Clone()) ; - fText = new TPaveText(0.2,0.7,0.8,0.9,"NDC") ; - for (Int_t sm = 0 ; sm < fgknSM ; sm++){ - fTextSM[sm] = static_cast(qac.fTextSM[sm]->Clone()) ; - } - for(Int_t i = 0; i < 4; i++) { +{ // assignment operator; use copy ctor + if (&qac == this) return *this; - fLineRow[i] = static_cast(qac.fLineRow[i]->Clone()) ; - } - return *this ; + this->~AliEMCALQAChecker(); + new (this) AliEMCALQAChecker(qac); + return *this; } //______________________________________________________________________________ diff --git a/EMCAL/AliEMCALQADataMakerRec.cxx b/EMCAL/AliEMCALQADataMakerRec.cxx index 5f31f00a5c5..2e0e3e9e92e 100644 --- a/EMCAL/AliEMCALQADataMakerRec.cxx +++ b/EMCAL/AliEMCALQADataMakerRec.cxx @@ -1080,8 +1080,8 @@ void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo) } } //____________________________________________________________________________ -void AliEMCALQADataMakerRec::GetTruChannelPosition( Int_t &globRow, Int_t &globColumn, Int_t module, Int_t ddl, Int_t branch, Int_t column ) -{ +void AliEMCALQADataMakerRec::GetTruChannelPosition( Int_t &globRow, Int_t &globColumn, Int_t module, Int_t ddl, Int_t branch, Int_t column ) const +{ // from local to global indices Int_t mrow; Int_t mcol; Int_t trow; @@ -1196,18 +1196,18 @@ void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader) FillRawsData(kGL1, etaG, phiG); //loop to sum amplitude of FOR in the gamma patch - Int_t L1GPatchAmp = 0; + Int_t iL1GPatchAmp = 0; for (Int_t L1Gx = 0; L1Gx < sizeL1gpatch; L1Gx ++) { for (Int_t L1Gy = 0; L1Gy < sizeL1gpatch; L1Gy ++) { - if (etaG+L1Gx < 48 && phiG+L1Gy < 64) L1GPatchAmp += iEMCALtrig[etaG+L1Gx][phiG+L1Gy]; + if (etaG+L1Gx < 48 && phiG+L1Gy < 64) iL1GPatchAmp += iEMCALtrig[etaG+L1Gx][phiG+L1Gy]; //cout << iEMCALtrig[etaG+L1Gx][phiG+L1Gy] << endl; } } - //if (L1GPatchAmp > 500) cout << "L1G amp =" << L1GPatchAmp << endl; - FillRawsData(kGL1V0, iV0Sig, L1GPatchAmp); + //if (iL1GPatchAmp > 500) cout << "L1G amp =" << iL1GPatchAmp << endl; + FillRawsData(kGL1V0, iV0Sig, iL1GPatchAmp); } } @@ -1225,17 +1225,17 @@ void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader) FillRawsData(kJL1, etaJ, phiJ); //loop the sum aplitude of FOR in the jet patch - Int_t L1JPatchAmp = 0; + Int_t iL1JPatchAmp = 0; for (Int_t L1Jx = 0; L1Jx < sizeL1jpatch*4; L1Jx ++) { for (Int_t L1Jy = 0; L1Jy < sizeL1jpatch*4; L1Jy ++) { - if (etaJ+L1Jx < 48 && phiJ+L1Jy < 64) L1JPatchAmp += iEMCALtrig[etaJ+L1Jx][phiJ+L1Jy]; + if (etaJ+L1Jx < 48 && phiJ+L1Jy < 64) iL1JPatchAmp += iEMCALtrig[etaJ+L1Jx][phiJ+L1Jy]; } } - //cout << "L1J amp =" << L1JPatchAmp << endl; - FillRawsData(kJL1V0, iV0Sig, L1JPatchAmp); + //cout << "L1J amp =" << iL1JPatchAmp << endl; + FillRawsData(kJL1V0, iV0Sig, iL1JPatchAmp); } } } diff --git a/EMCAL/AliEMCALQADataMakerRec.h b/EMCAL/AliEMCALQADataMakerRec.h index 80a5aa7f682..517805ccd2c 100644 --- a/EMCAL/AliEMCALQADataMakerRec.h +++ b/EMCAL/AliEMCALQADataMakerRec.h @@ -125,7 +125,7 @@ public: virtual void EndOfDetectorCycle(AliQAv1::TASKINDEX_t, TObjArray ** list) ; void GetCalibRefFromOCDB() ; - void GetTruChannelPosition( Int_t &globRow, Int_t &globColumn, Int_t module, Int_t ddl, Int_t branch, Int_t column ) ; + void GetTruChannelPosition( Int_t &globRow, Int_t &globColumn, Int_t module, Int_t ddl, Int_t branch, Int_t column ) const; virtual void InitESDs() ; virtual void InitDigits() ; virtual void InitRecPoints() ; diff --git a/EMCAL/AliEMCALRawUtils.cxx b/EMCAL/AliEMCALRawUtils.cxx index 92cc806248e..93393bddac2 100644 --- a/EMCAL/AliEMCALRawUtils.cxx +++ b/EMCAL/AliEMCALRawUtils.cxx @@ -70,7 +70,7 @@ AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo) : fNoiseThreshol fUseFALTRO(kTRUE), fRawAnalyzer(0), fTriggerRawDigitMaker(0x0) -{ +{ // ctor; set up fit algo etc SetFittingAlgorithm(fitAlgo); const TObjArray* maps = AliEMCALRecParam::GetMappings(); if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!"); @@ -342,7 +342,7 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr, void AliEMCALRawUtils::TrimDigits(TClonesArray *digitsArr) -{ +{ // rm entries with LGnoHG (unphysical), out of time window, and too bad chi2 AliEMCALDigit *digit = 0; Int_t n = 0; Int_t nDigits = digitsArr->GetEntriesFast(); @@ -372,7 +372,7 @@ void AliEMCALRawUtils::TrimDigits(TClonesArray *digitsArr) void AliEMCALRawUtils::SetFittingAlgorithm(Int_t fitAlgo) -{ +{ // select which fitting algo should be used delete fRawAnalyzer; // delete doesn't do anything if the pointer is 0x0 fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer( fitAlgo ); fRawAnalyzer->SetNsampleCut(5); // requirement for fits to be done, for the new methods diff --git a/EMCAL/AliEMCALRawUtils.h b/EMCAL/AliEMCALRawUtils.h index 9f237a0b99b..e3324629c97 100644 --- a/EMCAL/AliEMCALRawUtils.h +++ b/EMCAL/AliEMCALRawUtils.h @@ -79,7 +79,7 @@ private: Float_t fTimeMax; // maximum threshold for the time of the signal Bool_t fUseFALTRO; // use FALTRO and pass it to the digits AliCaloRawAnalyzer *fRawAnalyzer; // e.g. for sample selection for fits - AliEMCALTriggerRawDigitMaker* fTriggerRawDigitMaker; + AliEMCALTriggerRawDigitMaker* fTriggerRawDigitMaker; // trigger raw digit info ClassDef(AliEMCALRawUtils,7) // utilities for raw signal fitting -- 2.39.3