From cb729508194cced9a057f5a71f247a094183a6a2 Mon Sep 17 00:00:00 2001 From: masera Date: Thu, 19 Oct 2006 07:53:13 +0000 Subject: [PATCH] changes to be compliant with Eff C++ rules --- ITS/AliITSFindClustersV2.cxx | 105 +++++++++++---------- ITS/AliITSNeuralPoint.cxx | 79 ++++++++++++---- ITS/AliITSNeuralTrack.cxx | 66 ++++++++++--- ITS/AliITSNeuralTrack.h | 16 ++-- ITS/AliITSNeuralTracker.cxx | 150 +++++++++++++++++------------ ITS/AliITSNeuralTracker.h | 36 +++---- ITS/AliITSRiemannFit.cxx | 96 ++++++++++++++----- ITS/AliITSRiemannFit.h | 6 +- ITS/AliITStrackerANN.cxx | 178 +++++++++++++++++++++++++++++++---- ITS/AliITStrackerANN.h | 33 +++---- 10 files changed, 539 insertions(+), 226 deletions(-) diff --git a/ITS/AliITSFindClustersV2.cxx b/ITS/AliITSFindClustersV2.cxx index 3b980a113fc..7a5904c603d 100644 --- a/ITS/AliITSFindClustersV2.cxx +++ b/ITS/AliITSFindClustersV2.cxx @@ -38,7 +38,16 @@ ClassImp(AliITSFindClustersV2) //______________________________________________________________________ -AliITSFindClustersV2::AliITSFindClustersV2(){ +AliITSFindClustersV2::AliITSFindClustersV2(): +fAr(0), +fDeletfAr(kFALSE), +fGeom(0), +fInFileName(0), +fOutFileName(0), +fIn(0), +fOut(0), +fInit(kFALSE), +fSlowFast(kFALSE){ // Default constructor. // Inputs: // none. @@ -47,19 +56,19 @@ AliITSFindClustersV2::AliITSFindClustersV2(){ // Return: // A zero-ed constructed AliITSFindClustersV2 class. - fAr = 0; - fDeletfAr = kFALSE; // fAr=0 dont't delete it. - fGeom = 0; - fInFileName = 0; - fOutFileName = 0; - fIn = 0; - fOut = 0; - fSlowFast = kFALSE; // slow simulation - fInit = kFALSE; // Init failed } //______________________________________________________________________ AliITSFindClustersV2::AliITSFindClustersV2(const TString infile, - const TString outfile){ + const TString outfile): +fAr(0), +fDeletfAr(kFALSE), +fGeom(0), +fInFileName(0), +fOutFileName(0), +fIn(0), +fOut(0), +fInit(kFALSE), +fSlowFast(kFALSE){ // Standard constructor. // Inputs: // const TString infile Input file name where the RecPoints are @@ -72,16 +81,6 @@ AliITSFindClustersV2::AliITSFindClustersV2(const TString infile, // Return: // A standardly constructed AliITSFindClustersV2 class. - fAr = 0; - fDeletfAr = kFALSE; // fAr=0 dont't delete it. - fGeom = 0; - fInFileName = 0; - fOutFileName = 0; - fIn = 0; - fOut = 0; - fSlowFast = kFALSE; // slow simulation - fInit = kFALSE; // Init failed - fInFileName = new TString(infile); if(outfile.CompareTo("")!=0){ fOutFileName = new TString(outfile); @@ -130,7 +129,16 @@ AliITSFindClustersV2::AliITSFindClustersV2(const TString infile, } //______________________________________________________________________ AliITSFindClustersV2::AliITSFindClustersV2(TFile *in, - TFile *out){ + TFile *out): +fAr(0), +fDeletfAr(kFALSE), +fGeom(0), +fInFileName(0), +fOutFileName(0), +fIn(0), +fOut(0), +fInit(kFALSE), +fSlowFast(kFALSE){ // Standard constructor. // Inputs: // const TFile *in Input file where the RecPoints are @@ -143,16 +151,6 @@ AliITSFindClustersV2::AliITSFindClustersV2(TFile *in, // Return: // A standardly constructed AliITSFindClustersV2 class. - fAr = 0; - fDeletfAr = kFALSE; // fAr=0 dont't delete it. - fGeom = 0; - fInFileName = 0; - fOutFileName = 0; - fIn = 0; - fOut = 0; - fSlowFast = kFALSE; // slow simulation - fInit = kFALSE; // Init failed - fIn = in; fOut = out; fAr = (AliRun*) fIn->Get("gAlice"); @@ -186,7 +184,16 @@ AliITSFindClustersV2::AliITSFindClustersV2(TFile *in, } //______________________________________________________________________ AliITSFindClustersV2::AliITSFindClustersV2(AliRun *ar, - const TString outfile){ + const TString outfile): +fAr(0), +fDeletfAr(kFALSE), +fGeom(0), +fInFileName(0), +fOutFileName(0), +fIn(0), +fOut(0), +fInit(kFALSE), +fSlowFast(kFALSE){ // Standard constructor. // Inputs: // const TString infile Input file name where the RecPoints are @@ -199,16 +206,6 @@ AliITSFindClustersV2::AliITSFindClustersV2(AliRun *ar, // Return: // A standardly constructed AliITSFindClustersV2 class. - fAr = 0; - fDeletfAr = kFALSE; // fAr=0 dont't delete it. - fGeom = 0; - fInFileName = 0; - fOutFileName = 0; - fIn = 0; - fOut = 0; - fSlowFast = kFALSE; // slow simulation - fInit = kFALSE; // Init failed - if(outfile.CompareTo("")!=0){ fOutFileName = new TString(outfile); } // end if outfile.CompareeTo("")!=0 @@ -246,18 +243,26 @@ AliITSFindClustersV2::AliITSFindClustersV2(AliRun *ar, fInit = kTRUE; } //______________________________________________________________________ -AliITSFindClustersV2::AliITSFindClustersV2(const AliITSFindClustersV2 &/*rec*/):TTask(/*rec*/){ +AliITSFindClustersV2::AliITSFindClustersV2(const AliITSFindClustersV2 &rec):TTask(rec), +fAr(rec.fAr), +fDeletfAr(rec.fDeletfAr), +fGeom(rec.fGeom), +fInFileName(rec.fInFileName), +fOutFileName(rec.fOutFileName), +fIn(rec.fIn), +fOut(rec.fOut), +fInit(rec.fInit), +fSlowFast(rec.fSlowFast){ // Copy constructor. - Error("Copy constructor","Copy constructor not allowed"); } //______________________________________________________________________ -AliITSFindClustersV2& AliITSFindClustersV2::operator=(const AliITSFindClustersV2& /*source*/){ - // Assignment operator. This is a function which is not allowed to be - // done. - Error("operator=","Assignment operator not allowed\n"); - return *this; +AliITSFindClustersV2& AliITSFindClustersV2::operator=(const AliITSFindClustersV2& source){ + // Assignment operator. + this->~AliITSFindClustersV2(); + new(this) AliITSFindClustersV2(source); + return *this; } //______________________________________________________________________ diff --git a/ITS/AliITSNeuralPoint.cxx b/ITS/AliITSNeuralPoint.cxx index f126884f951..960a8405cb0 100644 --- a/ITS/AliITSNeuralPoint.cxx +++ b/ITS/AliITSNeuralPoint.cxx @@ -22,39 +22,71 @@ ClassImp(AliITSNeuralPoint) // //------------------------------------------------------------------------------------------------------ // -AliITSNeuralPoint::AliITSNeuralPoint() -{ +AliITSNeuralPoint::AliITSNeuralPoint(): +fX(0), +fY(0), +fZ(0), +fConfX(0), +fConfY(0), +fEX(0), +fEY(0), +fEZ(0), +fCharge(0), +fModule(0), +fIndex(0), +fLayer(0), +fUser(0), +fZSort(0){ // Default constructor. // Defines the point as a noise point in the origin. - fX = fY = fZ = 0.; - fEX = fEY = fEZ = 0.; - fLayer = 0; fLabel[0] = fLabel[1] = fLabel[2] = -1; - fModule = 0; - fIndex = 0; - fUser = 0; + } // //------------------------------------------------------------------------------------------------------ // AliITSNeuralPoint::AliITSNeuralPoint(AliITSNeuralPoint *p) : -fX(p->fX), fY(p->fY), fZ(p->fZ), fEX(p->fEX), fEY(p->fEY), fEZ(p->fEZ) +fX(p->fX), +fY(p->fY), +fZ(p->fZ), +fConfX(p->fConfX), +fConfY(p->fConfY), +fEX(p->fEX), +fEY(p->fEY), +fEZ(p->fEZ), +fCharge(p->fCharge), +fModule(p->fModule), +fIndex(p->fIndex), +fLayer(p->fLayer), +fUser(p->fUser), +fZSort(p->fZSort) { // Modified copy constructor. // Accepts a pointer to a like object and copies its datamembers. - fLayer = p->fLayer; + for (Int_t i = 0; i < 3; i++) fLabel[i] = p->fLabel[i]; - fModule = p->fModule; - fIndex = p->fIndex; - fUser = p->fUser; - fCharge = p->fCharge; + } // //------------------------------------------------------------------------------------------------------ // -AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm) +AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm): +fX(0), +fY(0), +fZ(0), +fConfX(0), +fConfY(0), +fEX(0), +fEY(0), +fEZ(0), +fCharge(0), +fModule(0), +fIndex(0), +fLayer(0), +fUser(0), +fZSort(0) { // Conversion constructor. // Accepts a AliITSRecPoint and a AliITSgeomMatrix, @@ -98,8 +130,21 @@ AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeomMatrix *gm) // //------------------------------------------------------------------------------------------------- // -AliITSNeuralPoint::AliITSNeuralPoint -(AliITSRecPoint *rp, AliITSgeom *geom, Short_t module, Short_t index) +AliITSNeuralPoint::AliITSNeuralPoint(AliITSRecPoint *rp, AliITSgeom *geom, Short_t module, Short_t index): +fX(0), +fY(0), +fZ(0), +fConfX(0), +fConfY(0), +fEX(0), +fEY(0), +fEZ(0), +fCharge(0), +fModule(0), +fIndex(0), +fLayer(0), +fUser(0), +fZSort(0) { // Conversion constructor. // Accepts a AliITSRecPoint and an AliITSgeom, diff --git a/ITS/AliITSNeuralTrack.cxx b/ITS/AliITSNeuralTrack.cxx index 3b2a0e78738..348dc094768 100644 --- a/ITS/AliITSNeuralTrack.cxx +++ b/ITS/AliITSNeuralTrack.cxx @@ -50,21 +50,31 @@ ClassImp(AliITSNeuralTrack) // // // -AliITSNeuralTrack::AliITSNeuralTrack() : fMatrix(5,5), fVertex() -{ +AliITSNeuralTrack::AliITSNeuralTrack() : +fXC(0.0), +fYC(0.0), +fR(0.0), +fC(0.0), +fTanL(0.0), +fG0(0.0), +fDt(0.0), +fDz(0.0), +fStateR(0.0), +fStatePhi(0.0), +fStateZ(0.0), +fMatrix(5,5), +fChi2(0.0), +fNSteps(0.0), +fMass(0.1396),// default assumption: pion +fField(2.0),// default assumption: B = 0.4 Tesla +fPDG(0), +fLabel(0), +fCount(0), +fVertex(){ // Default constructor Int_t i; - fMass = 0.1396; // default assumption: pion - fField = 2.0; // default assumption: B = 0.4 Tesla - - fXC = fYC = fR = fC = 0.0; - fTanL = fG0 = fDt = fDz = 0.0; - fStateR = fStatePhi = fStateZ = fChi2 = fNSteps = 0.0; - - fLabel = 0; - fCount = 0; for (i = 0; i < 6; i++) fPoint[i] = 0; fVertex.X() = 0.0; @@ -77,9 +87,28 @@ AliITSNeuralTrack::AliITSNeuralTrack() : fMatrix(5,5), fVertex() // // // -AliITSNeuralTrack::AliITSNeuralTrack(AliITSNeuralTrack &track) -: TObject((TObject&)track), fMatrix(5,5), fVertex() -{ +AliITSNeuralTrack::AliITSNeuralTrack(const AliITSNeuralTrack &track) +: TObject((TObject&)track), +fXC(0.0), +fYC(0.0), +fR(0.0), +fC(0.0), +fTanL(0.0), +fG0(0.0), +fDt(0.0), +fDz(0.0), +fStateR(0.0), +fStatePhi(0.0), +fStateZ(0.0), +fMatrix(5,5), +fChi2(0.0), +fNSteps(0.0), +fMass(0.1396),// default assumption: pion +fField(2.0),// default assumption: B = 0.4 Tesla +fPDG(0), +fLabel(0), +fCount(0), +fVertex(){ // copy constructor Int_t i; @@ -105,6 +134,13 @@ AliITSNeuralTrack::AliITSNeuralTrack(AliITSNeuralTrack &track) // // // + +AliITSNeuralTrack& AliITSNeuralTrack::operator=(const AliITSNeuralTrack& track){ + //assignment operator + this->~AliITSNeuralTrack(); + new(this) AliITSNeuralTrack(track); + return *this; +} AliITSNeuralTrack::~AliITSNeuralTrack() { Int_t l; @@ -218,7 +254,7 @@ void AliITSNeuralTrack::Insert(AliITSNeuralPoint *point) // // // -Int_t AliITSNeuralTrack::OccupationMask() +Int_t AliITSNeuralTrack::OccupationMask() const { // Returns a byte which maps the occupied slots. // Each bit represents a layer going from the less significant on. diff --git a/ITS/AliITSNeuralTrack.h b/ITS/AliITSNeuralTrack.h index 3521e49bc30..c924dc54a3c 100644 --- a/ITS/AliITSNeuralTrack.h +++ b/ITS/AliITSNeuralTrack.h @@ -1,6 +1,9 @@ #ifndef ALIITSNEURALTRACK_H #define ALIITSNEURALTRACK_H - +/////////////////////////////////////////////////// +// // +// Neural track class // +/////////////////////////////////////////////////// #include class TObjArray; @@ -11,9 +14,10 @@ class AliITSIOTrack; class AliITSNeuralTrack : public TObject { public: - AliITSNeuralTrack(); - AliITSNeuralTrack(AliITSNeuralTrack &track); - virtual ~AliITSNeuralTrack(); + AliITSNeuralTrack(); + AliITSNeuralTrack(const AliITSNeuralTrack &track); + AliITSNeuralTrack& operator=(const AliITSNeuralTrack& track ); + virtual ~AliITSNeuralTrack(); // Points insertion and goodness evaluation @@ -22,8 +26,8 @@ public: void CleanAllSlots(Bool_t del = kFALSE) {Int_t i; for(i=0;i<6;i++) CleanSlot(i,del);} void GetModuleData(Int_t i, Int_t &mod, Int_t &pos); void Insert(AliITSNeuralPoint *point); - Bool_t IsGood(Int_t min) {return (fCount >= min);} - Int_t OccupationMask(); + Bool_t IsGood(Int_t min) const {return (fCount >= min);} + Int_t OccupationMask() const; void PrintLabels(); // Fit procedures diff --git a/ITS/AliITSNeuralTracker.cxx b/ITS/AliITSNeuralTracker.cxx index 65f152aee4b..e185a80f533 100644 --- a/ITS/AliITSNeuralTracker.cxx +++ b/ITS/AliITSNeuralTracker.cxx @@ -47,8 +47,25 @@ ClassImp(AliITSNeuralTracker) //-------------------------------------------------------------------------------------------- -AliITSNeuralTracker::AliITSNeuralTracker() -{ +AliITSNeuralTracker::AliITSNeuralTracker(): +fSectorNum(1), +fSectorWidth(0), +fPolarInterval(45.0), +fCurvNum(0), +fCurvCut(0), +fStructureOK(kFALSE), +fVX(0.0), +fVY(0.0), +fVZ(0.0), +fActMinimum(0.5), +fEdge1(0.3), +fEdge2(0.7), +fTemperature(1.0), +fStabThreshold(0.001), +fGain2CostRatio(1.0), +fAlignExponent(1.0), +fChains(0), +fNeurons(0){ // CONSTRUCTOR // // Initializes some data-members: @@ -60,16 +77,8 @@ AliITSNeuralTracker::AliITSNeuralTracker() // With these settings the neural tracker can't work // because it has not any curvature cut set. - fCurvNum = 0; - fCurvCut = 0; - fSectorNum = 1; fSectorWidth = TMath::Pi() * 2.0; - fPolarInterval = 45.0; - - fStructureOK = kFALSE; - - fVX = fVY = fVZ = 0.0; Int_t ilayer, itheta; for (ilayer = 0; ilayer < 6; ilayer++) { @@ -82,16 +91,8 @@ AliITSNeuralTracker::AliITSNeuralTracker() fHelixMatchCutMax[ilayer] = 1.0; } - fEdge1 = 0.3; - fEdge2= 0.7; - fTemperature = 1.0; - fStabThreshold = 0.001; - fGain2CostRatio = 1.0; - fAlignExponent = 1.0; - fActMinimum = 0.5; - fNeurons = 0; fChains = new TTree("TreeC", "Sextines of points"); fChains->Branch("l0", &fPoint[0], "l0/I"); @@ -101,6 +102,35 @@ AliITSNeuralTracker::AliITSNeuralTracker() fChains->Branch("l4", &fPoint[4], "l4/I"); fChains->Branch("l5", &fPoint[5], "l5/I"); } + +AliITSNeuralTracker::AliITSNeuralTracker(const AliITSNeuralTracker &n):TObject(n), +fSectorNum(n.fSectorNum), +fSectorWidth(n.fSectorWidth), +fPolarInterval(n.fPolarInterval), +fCurvNum(n.fCurvNum), +fCurvCut(n.fCurvCut), +fStructureOK(n.fStructureOK), +fVX(n.fVX), +fVY(n.fVY), +fVZ(n.fVZ), +fActMinimum(n.fActMinimum), +fEdge1(n.fEdge1), +fEdge2(n.fEdge2), +fTemperature(n.fTemperature), +fStabThreshold(n.fStabThreshold), +fGain2CostRatio(n.fGain2CostRatio), +fAlignExponent(n.fAlignExponent), +fChains(n.fChains), +fNeurons(n.fNeurons){ + //copy contructor +} + +AliITSNeuralTracker& AliITSNeuralTracker::operator=(const AliITSNeuralTracker& t){ + //assignment operator + this->~AliITSNeuralTracker(); + new(this) AliITSNeuralTracker(t); + return *this; +} // //-------------------------------------------------------------------------------------------- // @@ -1252,60 +1282,62 @@ Double_t AliITSNeuralTracker::AliITSneuron::Weight(AliITSneuron *n) // // // -AliITSNeuralTracker::AliITSNeuralTracker(const AliITSNeuralTracker &t) -: TObject((TObject&)t) -{ - // NO copy constructor - Fatal("AliITSNeuralTracker", "No copy constructor allowed!"); - exit(0); -} -AliITSNeuralTracker& AliITSNeuralTracker::operator=(const AliITSNeuralTracker&) -{ - // NO assignment operator - Fatal("AliITSNeuralTracker", "No assignment allowed!"); - return *this; -} -// -AliITSNeuralTracker::AliITSNode::AliITSNode(const AliITSNode &t) -: AliITSNeuralPoint((AliITSNeuralPoint&)t) + + +AliITSNeuralTracker::AliITSNode::AliITSNode(const AliITSNode &t): AliITSNeuralPoint((AliITSNeuralPoint&)t), +fPosInTree(t.fPosInTree), +fInnerOf(t.fInnerOf), +fOuterOf(t.fOuterOf), +fMatches(t.fMatches), +fNext(t.fNext), +fPrev(t.fPrev) { - // NO copy constructor - Fatal("AliITSNode", "No copy constructor allowed!"); - exit(0); + //copy constructor } -AliITSNeuralTracker::AliITSNode& AliITSNeuralTracker::AliITSNode::operator=(const AliITSNode&) + +AliITSNeuralTracker::AliITSNode& AliITSNeuralTracker::AliITSNode::operator=(const AliITSNode& t) { - // NO assignment operator - Fatal("AliITSNode", "No assignment allowed!"); - return *this; + // assignment operator + this->~AliITSNode(); + new(this) AliITSNode(t); + return *this; } -// + + AliITSNeuralTracker::AliITSneuron::AliITSneuron(const AliITSneuron &t) -: TObject((TObject&)t) + : TObject((TObject&)t), +fUsed(t.fUsed), +fActivation(t.fActivation), +fInner(t.fInner), +fOuter(t.fOuter), +fGain(t.fGain) { - // NO copy constructor - Fatal("AliITSneuron", "No copy constructor allowed!"); - exit(0); + //copy constructor } -AliITSNeuralTracker::AliITSneuron& AliITSNeuralTracker::AliITSneuron::operator=(const AliITSneuron&) + +AliITSNeuralTracker::AliITSneuron& AliITSNeuralTracker::AliITSneuron::operator=(const AliITSneuron& t) { - // NO assignment operator - Fatal("AliITSneuron", "No assignment allowed!"); - return *this; + //assignment operator + this->~AliITSneuron(); + new(this) AliITSneuron(t); + return *this; } -// + + AliITSNeuralTracker::AliITSlink::AliITSlink(const AliITSlink &t) -: TObject((TObject&)t) + : TObject((TObject&)t), +fWeight(t.fWeight), +fLinked(t.fLinked) { - // NO copy constructor - Fatal("AliITSlink", "No copy constructor allowed!"); - exit(0); + //copy constructor } -AliITSNeuralTracker::AliITSlink& AliITSNeuralTracker::AliITSlink::operator=(const AliITSlink&) + +AliITSNeuralTracker::AliITSlink& AliITSNeuralTracker::AliITSlink::operator=(const AliITSlink& t) { - // NO assignment operator - Fatal("AliITSlink", "No assignment allowed!"); - return *this; + // assignment operator + this->~AliITSlink(); + new(this) AliITSlink(t); + return *this; } diff --git a/ITS/AliITSNeuralTracker.h b/ITS/AliITSNeuralTracker.h index 6e52977d0c3..6bb9f5aae30 100644 --- a/ITS/AliITSNeuralTracker.h +++ b/ITS/AliITSNeuralTracker.h @@ -22,9 +22,6 @@ class AliITSNeuralTracker : public TObject { public: AliITSNeuralTracker(); - AliITSNeuralTracker(const AliITSNeuralTracker &t); - AliITSNeuralTracker& operator=(const AliITSNeuralTracker&); - virtual ~AliITSNeuralTracker(); // ****************************************************************************** @@ -35,18 +32,17 @@ public: // ****************************************************************************** class AliITSNode : public AliITSNeuralPoint { public: - AliITSNode() {fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0;} - AliITSNode(const AliITSNode &t); - AliITSNode(AliITSNeuralPoint *p, Bool_t init = kTRUE) // declared inline - : AliITSNeuralPoint(p) { fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0; + AliITSNode():fPosInTree(0),fInnerOf(0),fOuterOf(0),fMatches(0),fNext(0),fPrev(0){} + + AliITSNode(AliITSNeuralPoint *p, Bool_t init = kTRUE): AliITSNeuralPoint(p),fPosInTree(0),fInnerOf(0),fOuterOf(0),fMatches(0),fNext(0),fPrev(0) { if (init) { fInnerOf = new TObjArray; fOuterOf = new TObjArray; fMatches = new TObjArray;}} AliITSNode(AliITSRecPoint *p, AliITSgeomMatrix *gm) - : AliITSNeuralPoint(p,gm) {fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0;} + : AliITSNeuralPoint(p,gm),fPosInTree(0),fInnerOf(0),fOuterOf(0),fMatches(0),fNext(0),fPrev(0) {} virtual ~AliITSNode() {fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0;} - AliITSNode& operator=(const AliITSNode&); + Double_t ThetaDeg() {return GetTheta()*180.0/TMath::Pi();} @@ -63,9 +59,9 @@ public: AliITSNode*& Prev() {return fPrev;} private: - + AliITSNode(const AliITSNode &t); + AliITSNode& operator=(const AliITSNode& t); Int_t fPosInTree; // position in tree of converted points - TObjArray *fInnerOf; //! TObjArray *fOuterOf; //! TObjArray *fMatches; //! @@ -87,10 +83,10 @@ public: class AliITSneuron : public TObject { public: AliITSneuron():fUsed(0),fActivation(0.),fInner(0),fOuter(0),fGain(0) { } - AliITSneuron(const AliITSneuron &t); + virtual ~AliITSneuron() {fInner=fOuter=0;fGain=0;} - AliITSneuron& operator=(const AliITSneuron&); + Double_t Weight(AliITSneuron *n); void Add2Gain(AliITSneuron *n, Double_t multconst, Double_t exponent); @@ -103,6 +99,9 @@ public: private: + AliITSneuron(const AliITSneuron &t); + AliITSneuron& operator=(const AliITSneuron& t); + Int_t fUsed; // utility flag Double_t fActivation; // Activation value AliITSNode *fInner; //! inner point @@ -123,15 +122,17 @@ public: class AliITSlink : public TObject { public: AliITSlink() : fWeight(0.), fLinked(0) { } - AliITSlink(const AliITSlink &t); - virtual ~AliITSlink() {fLinked = 0;} - AliITSlink& operator=(const AliITSlink&); + virtual ~AliITSlink() {fLinked = 0;} + Double_t& Weight() {return fWeight;} AliITSneuron*& Linked() {return fLinked;} private: + + AliITSlink(const AliITSlink &t); + AliITSlink& operator=(const AliITSlink& t); Double_t fWeight; // Weight value AliITSneuron *fLinked; //! the connected neuron @@ -183,6 +184,9 @@ public: private: + AliITSNeuralTracker(const AliITSNeuralTracker &n); + AliITSNeuralTracker& operator=(const AliITSNeuralTracker& t); + Bool_t CheckOccupation() const; Int_t fSectorNum; // number of azymuthal sectors diff --git a/ITS/AliITSRiemannFit.cxx b/ITS/AliITSRiemannFit.cxx index 24fdba6de9b..edc035428a1 100644 --- a/ITS/AliITSRiemannFit.cxx +++ b/ITS/AliITSRiemannFit.cxx @@ -74,37 +74,40 @@ ClassImp(AliITSRiemannFit) -AliITSRiemannFit::AliITSRiemannFit() { +AliITSRiemannFit::AliITSRiemannFit(): +fSizeEvent(0), +fPrimaryTracks(0), +fPoints(0), +fParticles(0), +fPointRecs(0) { /////////////////////////////////////////////////////////// // Default constructor. // Set everything to zero. //////////////////////////////////////////////////////////// - fSizeEvent = 0; - fPoints = 0; - fPrimaryTracks = 0; - fPointRecs = 0; - // - // test erase -// fspdi = 0; -// fspdo = 0; + for(Int_t i=0;i<6;i++)fPLay[i] = 0; } //______________________________________________________________________ -AliITSRiemannFit::AliITSRiemannFit(const AliITSRiemannFit &rf) : TObject(rf) { +AliITSRiemannFit::AliITSRiemannFit(const AliITSRiemannFit &rf) : TObject(rf), +fSizeEvent(rf.fSizeEvent), +fPrimaryTracks(rf.fPrimaryTracks), +fPoints(rf.fPoints), +fParticles(rf.fParticles), +fPointRecs(rf.fPointRecs) { // Copy constructor - // Copies are not allowed. The method is protected to avoid misuse. - Error("AliITSRiemannFit","Copy constructor not allowed\n"); + } //______________________________________________________________________ -AliITSRiemannFit& AliITSRiemannFit::operator=(const AliITSRiemannFit& /* rf */){ +AliITSRiemannFit& AliITSRiemannFit::operator=(const AliITSRiemannFit& rf){ // Assignment operator - // Assignment is not allowed. The method is protected to avoid misuse. - Error("= operator","Assignment operator not allowed\n"); + this->~AliITSRiemannFit(); + new(this) AliITSRiemannFit(rf); return *this; + } //______________________________________________________________________ @@ -130,20 +133,19 @@ AliITSRiemannFit::~AliITSRiemannFit() { } //---------------------------------------------------------------------- -AliITSRiemannFit::AliITSRiemannFit(Int_t size,Int_t ntracks) { +AliITSRiemannFit::AliITSRiemannFit(Int_t size,Int_t ntracks): +fSizeEvent(size), +fPrimaryTracks(ntracks), +fPoints(0), +fParticles(0), +fPointRecs(0) { /////////////////////////////////////////////////////////// // Constructor. // Set fSizeEvent to size and fPrimaryTracks to ntracks. // Others to zero. //////////////////////////////////////////////////////////// - fSizeEvent = size; - fPoints = 0; - fPrimaryTracks = ntracks; - // - // test erase -// fspdi = 0; -// fspdo = 0; + AliPointtl *first = new AliPointtl[fSizeEvent]; AliPointtl **pointRecs = new AliPointtl*[fSizeEvent]; for(Int_t i=0;i<6;i++)fPLay[i] = 0; @@ -152,7 +154,26 @@ AliITSRiemannFit::AliITSRiemannFit(Int_t size,Int_t ntracks) { } // --------------------------------------------------------------------- -AliITSRiemannFit::AliPointtl::AliPointtl(){ +AliITSRiemannFit::AliPointtl::AliPointtl(): +fLay(0), +fLad(0), +fDet(0), +fTrack(0), +fx(0), +fy(0), +fz(0), +fr(0), +fdE(0), +fdx(0), +fdy(0), +fdz(0), +fOrigin(0), +fMomentum(0), +fCode(0), +fName(0), +fPt(0), +fPhi(0), +fEta(0),fVertexPhi(0){ // default constructor SetLay(); SetLad(); @@ -176,6 +197,33 @@ AliITSRiemannFit::AliPointtl::AliPointtl(){ SetVertexPhi(); } +AliITSRiemannFit::AliPointtl::AliPointtl(const AliPointtl& ap): +fLay(ap.fLay), +fLad(ap.fLad), +fDet(ap.fDet), +fTrack(ap.fTrack), +fx(ap.fx), +fy(ap.fy), +fz(ap.fz), +fr(ap.fr), +fdE(ap.fdE), +fdx(ap.fdx), +fdy(ap.fdy), +fdz(ap.fdz), +fOrigin(ap.fOrigin), +fMomentum(ap.fMomentum), +fCode(ap.fCode), +fName(ap.fName), +fPt(ap.fPt), +fPhi(ap.fPhi), +fEta(ap.fEta), +fVertexPhi(ap.fVertexPhi){ + //copy constructor +} + + + + // --------------------------------------------------------------------- void FillPoints(AliITSRiemannFit::AliPointtl **Points,Int_t &index,Float_t *xpoint, diff --git a/ITS/AliITSRiemannFit.h b/ITS/AliITSRiemannFit.h index 586a64c83f9..1d57a7dfbb4 100644 --- a/ITS/AliITSRiemannFit.h +++ b/ITS/AliITSRiemannFit.h @@ -66,9 +66,11 @@ class AliITSRiemannFit : public TObject{ void SetVertexPhi(Float_t vert=0) { fVertexPhi = vert;} private : // copy constructor (NO copy ctr. allowed) - AliPointtl(const AliPointtl& /*ap */) {} + AliPointtl(const AliPointtl& ap); // assignment operator (NO assignment allowed) - AliPointtl& operator=(const AliPointtl& /* ap */) {return *this;} + AliPointtl& operator=(const AliPointtl& ap){ + this->~AliPointtl(); new(this) AliPointtl(ap);return *this; + } Int_t fLay,fLad,fDet,fTrack; // layer,ladder,detector and track Float_t fx,fy,fz,fr; // global position of point Float_t fdE,fdx,fdy,fdz; // Errors diff --git a/ITS/AliITStrackerANN.cxx b/ITS/AliITStrackerANN.cxx index f1a60ae8b90..db565a5e8dd 100644 --- a/ITS/AliITStrackerANN.cxx +++ b/ITS/AliITStrackerANN.cxx @@ -42,9 +42,61 @@ const Double_t AliITStrackerANN::fgkTwoPi = 6.283185307; // 2 * pi ClassImp(AliITStrackerANN) + +AliITStrackerANN::AliITStrackerANN() : AliITStrackerV2(), +fVertexX(0.0), +fVertexY(0.0), +fVertexZ(0.0), +fSectorNum(0), +fSectorWidth(0), +fPolarInterval(0), +fCurvNum(0), +fCurvCut(0), +fActMinimum(0), +fEdge1(0), +fEdge2(0), +fStabThreshold(0), +fTemperature(0), +fGain2CostRatio(0), +fExponent(0), +fNLayers(0), +fFirstModInLayer(0), +fIndexMap(0), +fFoundTracks(0), +fNodes(0), +fNeurons(0), +fMsgLevel(0), +fStructureOK(0), +fGeom(0){ + //Default constructor +} //__________________________________________________________________________________ AliITStrackerANN::AliITStrackerANN(const AliITSgeom *geom, Int_t msglev) -: AliITStrackerV2(geom), fMsgLevel(msglev) +: AliITStrackerV2(geom), +fVertexX(0.0), +fVertexY(0.0), +fVertexZ(0.0), +fSectorNum(0), +fSectorWidth(0), +fPolarInterval(0), +fCurvNum(0), +fCurvCut(0), +fActMinimum(0), +fEdge1(0), +fEdge2(0), +fStabThreshold(0), +fTemperature(0), +fGain2CostRatio(0), +fExponent(0), +fNLayers(0), +fFirstModInLayer(0), +fIndexMap(0), +fFoundTracks(0), +fNodes(0), +fNeurons(0), +fMsgLevel(msglev), +fStructureOK(0), +fGeom(0) { /************************************************************************** @@ -134,6 +186,42 @@ AliITStrackerANN::AliITStrackerANN(const AliITSgeom *geom, Int_t msglev) fFoundTracks = 0; } + +AliITStrackerANN::AliITStrackerANN(const AliITStrackerANN &n) : AliITStrackerV2((AliITStrackerV2&)n), +fVertexX(n.fVertexX), +fVertexY(n.fVertexY), +fVertexZ(n.fVertexZ), +fSectorNum(n.fSectorNum), +fSectorWidth(n.fSectorWidth), +fPolarInterval(n.fPolarInterval), +fCurvNum(n.fCurvNum), +fCurvCut(n.fCurvCut), +fActMinimum(n.fActMinimum), +fEdge1(n.fEdge1), +fEdge2(n.fEdge2), +fStabThreshold(n.fStabThreshold), +fTemperature(n.fTemperature), +fGain2CostRatio(n.fGain2CostRatio), +fExponent(n.fExponent), +fNLayers(n.fNLayers), +fFirstModInLayer(n.fFirstModInLayer), +fIndexMap(n.fIndexMap), +fFoundTracks(n.fFoundTracks), +fNodes(n.fNodes), +fNeurons(n.fNeurons), +fMsgLevel(n.fMsgLevel), +fStructureOK(n.fStructureOK), +fGeom(n.fGeom){ + //Copy constructor +} + +AliITStrackerANN& AliITStrackerANN::operator=(const AliITStrackerANN& arg){ + //Assignment operator + this->~AliITStrackerANN(); + new(this) AliITStrackerANN(arg); + return *this; +} + //__________________________________________________________________________________ void AliITStrackerANN::SetCuts (Int_t ncurv, Double_t *curv, Double_t *theta2D, Double_t *theta3D, Double_t *helix) @@ -1687,18 +1775,42 @@ Double_t AliITStrackerANN::Weight(AliITSneuron *nAB, AliITSneuron *nBC) ******************************************/ //__________________________________________________________________________________ -AliITStrackerANN::AliITSnode::AliITSnode() -: fUsed(kFALSE), fClusterRef(-1), - fMatches(NULL), fInnerOf(NULL), fOuterOf(NULL), - fNext(NULL), fPrev(NULL) +AliITStrackerANN::AliITSnode::AliITSnode(): +fX(0.0), +fY(0.0), +fZ(0.0), +fEX2(0.0), +fEY2(0.0), +fEZ2(0.0), +fUsed(kFALSE), +fClusterRef(-1), +fMatches(NULL), +fInnerOf(NULL), +fOuterOf(NULL), +fNext(NULL), +fPrev(NULL) { // Constructor for the embedded 'AliITSnode' class. // It initializes all pointer-like objects. - fX = fY = fZ = 0.0; - fEX2 = fEY2 = fEZ2 = 0.0; } +AliITStrackerANN::AliITSnode::AliITSnode(const AliITSnode &n) : TObject((TObject&)n), +fX(n.fX), +fY(n.fY), +fZ(n.fZ), +fEX2(n.fEX2), +fEY2(n.fEY2), +fEZ2(n.fEZ2), +fUsed(n.fUsed), +fClusterRef(n.fClusterRef), +fMatches(n.fMatches), +fInnerOf(n.fInnerOf), +fOuterOf(n.fOuterOf), +fNext(n.fNext), +fPrev(n.fPrev){ + //copy constructor +} //__________________________________________________________________________________ AliITStrackerANN::AliITSnode::~AliITSnode() { @@ -1794,14 +1906,26 @@ Double_t AliITStrackerANN::AliITSnode::GetError(Option_t *option) //__________________________________________________________________________________ AliITStrackerANN::AliITSneuron::AliITSneuron -(AliITSnode *inner, AliITSnode *outer, Double_t minAct, Double_t maxAct) - : fUsed(0), fInner(inner), fOuter(outer) +(AliITSnode *inner, AliITSnode *outer, Double_t minAct, Double_t maxAct): +fUsed(0), +fActivation(0), +fInner(inner), +fOuter(outer), +fGain(0) { // Default neuron constructor fActivation = gRandom->Rndm() * (maxAct-minAct) + minAct; fGain = new TObjArray; } - + +AliITStrackerANN::AliITSneuron::AliITSneuron(const AliITSneuron &n) : TObject((TObject&)n), +fUsed(n.fUsed), +fActivation(n.fActivation), +fInner(n.fInner), +fOuter(n.fOuter), +fGain(n.fGain){ + //copy constructor +} //__________________________________________________________________________________ Double_t AliITStrackerANN::AliITSneuron::Activate(Double_t temperature) { @@ -1899,18 +2023,20 @@ Double_t AliITStrackerANN::AliITSneuron::Activate(Double_t temperature) **********************************************/ //__________________________________________________________________________________ -AliITStrackerANN::AliITStrackANN::AliITStrackANN(Int_t dim) : fNPoints(dim) +AliITStrackerANN::AliITStrackANN::AliITStrackANN(Int_t dim) : +fNPoints(dim), +fXCenter(0.0), +fYCenter(0.0), +fRadius(0.0), +fCurv(0.0), +fDTrans(0.0), +fDLong(0.0), +fTanLambda(0.0), +fPhi(0.0), +fNode(0) { // Default constructor for the AliITStrackANN class - fXCenter = 0.0; - fYCenter = 0.0; - fRadius = 0.0; - fCurv = 0.0; - fDTrans = 0.0; - fDLong = 0.0; - fTanLambda = 0.0; - if (! dim) { fNode = 0; } @@ -1921,6 +2047,20 @@ AliITStrackerANN::AliITStrackANN::AliITStrackANN(Int_t dim) : fNPoints(dim) } } +AliITStrackerANN::AliITStrackANN::AliITStrackANN(const AliITStrackANN &n) : TObject((TObject&)n), +fNPoints(n.fNPoints), +fXCenter(n.fXCenter), +fYCenter(n.fYCenter), +fRadius(n.fRadius), +fCurv(n.fCurv), +fDTrans(n.fDTrans), +fDLong(n.fDLong), +fTanLambda(n.fTanLambda), +fPhi(n.fPhi), +fNode(n.fNode) +{ + //copy constructor +} //__________________________________________________________________________________ Int_t AliITStrackerANN::AliITStrackANN::CheckOccupation() const { diff --git a/ITS/AliITStrackerANN.h b/ITS/AliITStrackerANN.h index c6ea5a411f5..eaafa371d42 100644 --- a/ITS/AliITStrackerANN.h +++ b/ITS/AliITStrackerANN.h @@ -18,12 +18,10 @@ public: /* Constructors */ - AliITStrackerANN() : AliITStrackerV2() { /* does nothing */ }; + AliITStrackerANN(); AliITStrackerANN(const AliITSgeom *geom, Int_t msglev = 0); - AliITStrackerANN(const AliITStrackerANN &n) : AliITStrackerV2((AliITStrackerV2&)n) - { /* nothing */ } - AliITStrackerANN& operator=(const AliITStrackerANN& /*arg*/) - { return *this; } + AliITStrackerANN(const AliITStrackerANN &n); + AliITStrackerANN& operator=(const AliITStrackerANN& arg); /* Destructor */ // virtual ~AliITStrackerANN(); @@ -39,8 +37,8 @@ public: AliITSnode(); ~AliITSnode(); - AliITSnode(const AliITSnode &n) : TObject((TObject&)n) - { /* nothing */ } + AliITSnode(const AliITSnode &n); + AliITSnode& operator=(const AliITSnode& /*arg*/) { return *this; } @@ -108,10 +106,10 @@ public: AliITSneuron() : fUsed(0), fActivation(0.), fInner(0), fOuter(0), fGain(0) {fGain = new TObjArray;} AliITSneuron(AliITSnode *inner, AliITSnode *outer, Double_t minAct, Double_t maxAct); - AliITSneuron(const AliITSneuron &n) : TObject((TObject&)n) - { /* nothing */ } - AliITSneuron& operator=(const AliITSneuron& /*arg*/) - { return *this; } + AliITSneuron(const AliITSneuron &n); + AliITSneuron& operator=(const AliITSneuron& arg) + {this->~AliITSneuron();new(this) AliITSneuron(arg); + return *this; } /* (NEURON) Destructor: frees memory from dynamic allocated objects */ @@ -148,13 +146,13 @@ public: class AliITSlink : public TObject { public: - AliITSlink() {fWeight = 0.0; fLinked = 0;} + AliITSlink():fWeight(0.0),fLinked() {} AliITSlink(Double_t w, AliITSneuron *n) : fWeight(w), fLinked(n) { } virtual ~AliITSlink() {fLinked = 0;} - AliITSlink(const AliITSlink &n) : TObject((TObject&)n) - { /* nothing */ } - AliITSlink& operator=(const AliITSlink& /*arg*/) - { return *this; } + AliITSlink(const AliITSlink &n) : TObject((TObject&)n),fWeight(n.fWeight),fLinked(n.fLinked) {} + AliITSlink& operator=(const AliITSlink& arg) + { this->~AliITSlink();new(this) AliITSlink(arg); + return *this; } /* contribution */ Double_t Contribution() {return fLinked->Activation() * fWeight;} @@ -176,8 +174,7 @@ public: public: AliITStrackANN(Int_t dim = 0); - AliITStrackANN(const AliITStrackANN &n) : TObject((TObject&)n) - { /* nothing */ } + AliITStrackANN(const AliITStrackANN &n); AliITStrackANN& operator=(const AliITStrackANN& /*arg*/) { return *this; } -- 2.43.0