<commit_before>/**************************************************************************
 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/* $Id$ */

//-------------------------------------------------------------------------
//     AOD Pid class to store additional pid information
//     Author: <NAME>
//-------------------------------------------------------------------------

#include "AliAODPid.h"
#include "AliESDtrack.h"
#include "AliLog.h"
#include "AliPID.h"

ClassImp(AliAODPid)


//______________________________________________________________________________
AliAODPid::AliAODPid():
    fITSsignal(0), 
    fTPCsignal(0),
    fTPCsignalN(0),
    fTPCmomentum(0),
    fTRDnSlices(0),
    fTRDntls(0),
    fTRDslices(0x0),
    fTOFesdsignal(0),
    fHMPIDsignal(0)
{
  // default constructor
    for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]   = 0; 
    for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = 0.;
    for(Int_t i=0; i<3; i++) fEMCALPosition[i]    = 0.;
    for(Int_t i=0; i<5; i++) fTOFpidResolution[i] = 0.;
    for(Int_t i=0; i<6; i++) {
      fTRDmomentum[i]      = 0.;
      fTRDncls[i]          = 0;
    }
    for(Int_t i=0; i<3; i++) fEMCALMomentum[i]    = 0.;
    for(Int_t i=0; i<4; i++) fITSdEdxSamples[i]   = 0.;
}

//______________________________________________________________________________
AliAODPid::~AliAODPid() 
{
  delete [] fTRDslices;
  fTRDslices = 0;
  // destructor
}


//______________________________________________________________________________
AliAODPid::AliAODPid(const AliAODPid& pid) : 
  TObject(pid),
  fITSsignal(pid.fITSsignal), 
  fTPCsignal(pid.fTPCsignal),
  fTPCsignalN(pid.fTPCsignalN),
  fTPCmomentum(pid.fTPCmomentum),
  fTRDnSlices(pid.fTRDnSlices),
  fTRDntls(pid.fTRDntls),
  fTRDslices(0x0),
  fTOFesdsignal(pid.fTOFesdsignal),
  fHMPIDsignal(pid.fHMPIDsignal)
{
  // Copy constructor
  SetTRDsignal(fTRDnSlices, pid.fTRDslices);
    for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=pid.fIntTime[i];
    for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = pid.fHMPIDprobs[i];
    for(Int_t i=0; i<3; i++) {
      fEMCALPosition[i]=pid.fEMCALPosition[i];
      fEMCALMomentum[i]=pid.fEMCALMomentum[i];
    }
    for(Int_t i=0; i<6; i++){ 
      fTRDmomentum[i]=pid.fTRDmomentum[i];
      fTRDncls[i] = 0;
    }

    for(Int_t i=0; i<5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];

    for(Int_t i=0; i<4; i++) fITSdEdxSamples[i]=pid.fITSdEdxSamples[i];
}

//______________________________________________________________________________
AliAODPid& AliAODPid::operator=(const AliAODPid& pid)
{
  // Assignment operator
  if(this!=&pid) {
    // copy stuff
    TObject::operator=(pid);

    fITSsignal   = pid.fITSsignal; 
    for (Int_t i = 0; i < 4; i++) fITSdEdxSamples[i]=pid.fITSdEdxSamples[i];
    fTPCsignal   = pid.fTPCsignal;
    fTPCsignalN  = pid.fTPCsignalN;
    fTPCmomentum = pid.fTPCmomentum;


    if(fTRDnSlices != pid.fTRDnSlices) {
      // only delete if number changed or is 0
      delete [] fTRDslices;
      fTRDslices = 0;
      fTRDnSlices = pid.fTRDnSlices;
      if(pid.fTRDnSlices > 0) fTRDslices = new Double32_t[fTRDnSlices];
    }

    memcpy(fTRDslices, pid.fTRDslices, fTRDnSlices*sizeof(Double32_t));

    fTRDntls = pid.fTRDntls;
    for(Int_t i = 0; i < 6; i++){ 
	fTRDmomentum[i] = pid.fTRDmomentum[i];
	fTRDncls[i]     = pid.fTRDncls[i];
    }

    fTOFesdsignal=pid.fTOFesdsignal;
    for (Int_t i = 0; i < 5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];
    for (Int_t i = 0; i < 5; i++) fIntTime[i]=pid.fIntTime[i];
    
    fHMPIDsignal=pid.fHMPIDsignal;
    
    for(Int_t i = 0; i < 5; i++) fHMPIDprobs[i] = pid.fHMPIDprobs[i];
    
    for(Int_t i = 0; i < 3; i++) {
	fEMCALPosition[i]=pid.fEMCALPosition[i];
	fEMCALMomentum[i]=pid.fEMCALMomentum[i];
    }
  }

  return *this;
}
//_______________________________________________________________________________
void AliAODPid::GetIntegratedTimes(Double_t timeint[kSPECIES]) const
{
 // Returns the array with integrated times for each particle hypothesis
for(Int_t i=0; i<kSPECIES; i++) timeint[i]=fIntTime[i];
}<commit_msg>Coverity 18819<commit_after>/**************************************************************************
 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/* $Id$ */

//-------------------------------------------------------------------------
//     AOD Pid class to store additional pid information
//     Author: <NAME>
//-------------------------------------------------------------------------

#include "AliAODPid.h"
#include "AliESDtrack.h"
#include "AliLog.h"
#include "AliPID.h"

ClassImp(AliAODPid)


//______________________________________________________________________________
AliAODPid::AliAODPid():
    fITSsignal(0), 
    fTPCsignal(0),
    fTPCsignalN(0),
    fTPCmomentum(0),
    fTRDnSlices(0),
    fTRDntls(0),
    fTRDslices(0x0),
    fTOFesdsignal(0),
    fHMPIDsignal(0)
{
  // default constructor
    for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]   = 0; 
    for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = 0.;
    for(Int_t i=0; i<3; i++) fEMCALPosition[i]    = 0.;
    for(Int_t i=0; i<5; i++) fTOFpidResolution[i] = 0.;
    for(Int_t i=0; i<6; i++) {
      fTRDmomentum[i]      = 0.;
      fTRDncls[i]          = 0;
    }
    for(Int_t i=0; i<3; i++) fEMCALMomentum[i]    = 0.;
    for(Int_t i=0; i<4; i++) fITSdEdxSamples[i]   = 0.;
}

//______________________________________________________________________________
AliAODPid::~AliAODPid() 
{
  delete [] fTRDslices;
  fTRDslices = 0;
  // destructor
}


//______________________________________________________________________________
AliAODPid::AliAODPid(const AliAODPid& pid) : 
  TObject(pid),
  fITSsignal(pid.fITSsignal), 
  fTPCsignal(pid.fTPCsignal),
  fTPCsignalN(pid.fTPCsignalN),
  fTPCmomentum(pid.fTPCmomentum),
  fTRDnSlices(pid.fTRDnSlices),
  fTRDntls(pid.fTRDntls),
  fTRDslices(0x0),
  fTOFesdsignal(pid.fTOFesdsignal),
  fHMPIDsignal(pid.fHMPIDsignal)
{
  // Copy constructor
  SetTRDsignal(fTRDnSlices, pid.fTRDslices);
    for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=pid.fIntTime[i];
    for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = pid.fHMPIDprobs[i];
    for(Int_t i=0; i<3; i++) {
      fEMCALPosition[i]=pid.fEMCALPosition[i];
      fEMCALMomentum[i]=pid.fEMCALMomentum[i];
    }
    for(Int_t i=0; i<6; i++){ 
      fTRDmomentum[i]=pid.fTRDmomentum[i];
      fTRDncls[i] = 0;
    }

    for(Int_t i=0; i<5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];

    for(Int_t i=0; i<4; i++) fITSdEdxSamples[i]=pid.fITSdEdxSamples[i];
}

//______________________________________________________________________________
AliAODPid& AliAODPid::operator=(const AliAODPid& pid)
{
  // Assignment operator
  if(this!=&pid) {
    // copy stuff
    TObject::operator=(pid);

    fITSsignal   = pid.fITSsignal; 
    for (Int_t i = 0; i < 4; i++) fITSdEdxSamples[i]=pid.fITSdEdxSamples[i];
    fTPCsignal   = pid.fTPCsignal;
    fTPCsignalN  = pid.fTPCsignalN;
    fTPCmomentum = pid.fTPCmomentum;


    if(fTRDnSlices != pid.fTRDnSlices) {
      // only delete if number changed or is 0
      delete [] fTRDslices;
      fTRDslices = 0;
      fTRDnSlices = pid.fTRDnSlices;
      if(pid.fTRDnSlices > 0) fTRDslices = new Double32_t[fTRDnSlices];
    }

    if (fTRDslices && pid.fTRDslices)
      memcpy(fTRDslices, pid.fTRDslices, fTRDnSlices*sizeof(Double32_t));

    fTRDntls = pid.fTRDntls;
    for(Int_t i = 0; i < 6; i++){ 
	fTRDmomentum[i] = pid.fTRDmomentum[i];
	fTRDncls[i]     = pid.fTRDncls[i];
    }

    fTOFesdsignal=pid.fTOFesdsignal;
    for (Int_t i = 0; i < 5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];
    for (Int_t i = 0; i < 5; i++) fIntTime[i]=pid.fIntTime[i];
    
    fHMPIDsignal=pid.fHMPIDsignal;
    
    for(Int_t i = 0; i < 5; i++) fHMPIDprobs[i] = pid.fHMPIDprobs[i];
    
    for(Int_t i = 0; i < 3; i++) {
	fEMCALPosition[i]=pid.fEMCALPosition[i];
	fEMCALMomentum[i]=pid.fEMCALMomentum[i];
    }
  }

  return *this;
}
//_______________________________________________________________________________
void AliAODPid::GetIntegratedTimes(Double_t timeint[kSPECIES]) const
{
 // Returns the array with integrated times for each particle hypothesis
for(Int_t i=0; i<kSPECIES; i++) timeint[i]=fIntTime[i];
}
{'fraction_non_alphanumeric': 0.1796294461507976, 'fraction_numerical': 0.015159021103735262, 'mean_word_length': 2.8718833908707326, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7623242', 'n_tokens_mistral': 3821, 'n_tokens_neox': 3590, 'n_words': 690}