]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixing Coverity defects
authorihrivnac <Ivana.Hrivnacova@cern.ch>
Thu, 15 Jan 2015 14:04:16 +0000 (15:04 +0100)
committerihrivnac <Ivana.Hrivnacova@cern.ch>
Thu, 15 Jan 2015 14:05:09 +0000 (15:05 +0100)
MUON/MUONcalign/AliMUONAlignmentTask.cxx
MUON/MUONevaluation/AliMUONCheck.cxx
MUON/MUONevaluation/AliMUONTrackLight.cxx
MUON/MUONevaluation/AliMUONTrackLight.h

index dc0961283f98f0e31fbe19c43ffc836efb92e1bb..80734ecfaa26b9839f01adacbca7e50db3779680 100644 (file)
@@ -529,6 +529,11 @@ void AliMUONAlignmentTask::NotifyRun()
       // propagete to Alignment class
       // and printout
       AliMagF* magF = dynamic_cast<AliMagF*>( TGeoGlobalMagField::Instance()->GetField() );
+      if ( !magF ) {
+        AliError( "Failed to get field" );
+        return;
+      }
+      
       fBFieldOn = TMath::Abs( magF->GetFactorDip() ) > 1e-5;
       fAlign->SetBFieldOn( fBFieldOn );
       AliInfo( Form( "Dipole magnetic field factor: %.2f", magF->GetFactorDip() ) );
index c63bf9a424e68b17201710a5c41ed99437e690a5..0ae52324e8d56091ab614db362bbf739f84a0b49 100644 (file)
@@ -811,11 +811,11 @@ AliMUONCheck::CheckOccupancy(Bool_t perDetEle) const
                dEoccupancyBending[ichamber][idetele],
                dEoccupancyNonBending[ichamber][idetele]);  
                
-          if ( dEchannelsBending[ichamber][idetele] != 0 && dEchannelsBending[ichamber][idetele] !=0 ) {     
+          if ( dEchannelsBending[ichamber][idetele] != 0 && dEchannelsNonBending[ichamber][idetele] !=0 ) {
             printf(">>> DetEle %4d Occupancy Bending %5.2f %%  Occupancy NonBending %5.2f %% \n", 
                  idetele+100*(ichamber+1), 
                  100.*((Float_t) dEoccupancyBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]),
-                 100.*((Float_t) dEoccupancyNonBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]));
+                 100.*((Float_t) dEoccupancyNonBending[ichamber][idetele])/((Float_t) dEchannelsNonBending[ichamber][idetele]));
           }       
         }
       }
index 1dd51a4d858ee5b7e42565cf660a058325a17bd4..1040c742a6967007ab3b38dbbbe739cfe2616851 100644 (file)
@@ -418,8 +418,44 @@ Bool_t AliMUONTrackLight::IsParentPionOrKaon(Int_t idparent){
 }
 //====================================
 Bool_t AliMUONTrackLight::IsDiquark(Int_t pdg) const{
-  /// check if the provided pdg code corresponds to a diquark 
+  /// check if the provided pdg code corresponds to a diquark
   pdg = TMath::Abs(pdg);
   if((pdg > 1000) && (pdg%100 < 10)) return kTRUE;
   else return kFALSE;
 }
+//====================================
+void AliMUONTrackLight::SetParentPDGCode(Int_t index, Int_t pdg) {
+  /// Set hadronised parents and grandparents
+  if ( index < fgkNParentsMax ) {
+    fParentPDGCode[index] = pdg;
+  } else {
+    AliErrorStream() << "Index outside the array size." << std::endl;
+  }
+}
+//====================================
+void AliMUONTrackLight::SetParentPythiaLine(Int_t index, Int_t line) {
+  /// Set line of Pythia output for hadronised parents & grandparents
+  if ( index < fgkNParentsMax ) {
+    fParentPythiaLine[index] = line;
+  } else {
+    AliErrorStream() << "Index outside the array size." << std::endl;
+  }
+}
+//====================================
+void AliMUONTrackLight::SetQuarkPDGCode(Int_t index, Int_t pdg){
+  /// Set pdg of the string [0], quarks/gluons [1,2], sometimes proton [3]
+  if ( index < 4 ) {
+    fQuarkPDGCode[index] = pdg;
+  } else {
+    AliErrorStream() << "Index outside the array size." << std::endl;
+  }
+}
+//====================================
+void AliMUONTrackLight::SetQuarkPythiaLine(Int_t index, Int_t line){
+  /// Set line of Pythia output for string [0] and quarks [1,2], sometimes proton [3]
+  if ( index < 4 ) {
+    fQuarkPythiaLine[index] = line;
+  } else {
+    AliErrorStream() << "Index outside the array size." << std::endl;
+  }
+}
index dc976cac55477ba772dcb555d9103ff13930694f..be4f2575abada01c74c8864e4422ea6b65128d1f 100644 (file)
@@ -129,13 +129,13 @@ protected:
   /// Set flag for oscillation
   void SetOscillation(Bool_t oscillation) { fOscillation = oscillation; }
   /// Set hadronised parents and grandparents 
-  void SetParentPDGCode(Int_t index, Int_t pdg) { fParentPDGCode[index] = pdg; } 
+  void SetParentPDGCode(Int_t index, Int_t pdg);
   /// Set line of Pythia output for hadronised parents & grandparents
-  void SetParentPythiaLine(Int_t index, Int_t line) { fParentPythiaLine[index] = line; } 
+  void SetParentPythiaLine(Int_t index, Int_t line);
   /// Set pdg of the string [0], quarks/gluons [1,2], sometimes proton [3] 
-  void SetQuarkPDGCode(Int_t index, Int_t pdg){ fQuarkPDGCode[index] = pdg; }
+  void SetQuarkPDGCode(Int_t index, Int_t pdg);
   /// Set line of Pythia output for string [0] and quarks [1,2], sometimes proton [3]
-  void SetQuarkPythiaLine(Int_t index, Int_t line){ fQuarkPythiaLine[index] = line; }
+  void SetQuarkPythiaLine(Int_t index, Int_t line);
   void ResetQuarkInfo();
 
   ClassDef(AliMUONTrackLight,1)  /// Muon Track for analysis