]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSSumTP.cxx
Changes for #94366: Fix in copy constructor of AliEventplane
[u/mrichter/AliRoot.git] / ITS / AliITSSumTP.cxx
1 #include "AliITSSumTP.h"
2 #include "AliTrackPointArray.h"
3
4 ///////////////////////////////////////////////////////////////////
5 //                                                               //
6 // Class for ITS trackpoints summary + some aux. info  )         //
7 // Author: Ruben Shahoian                                        //
8 //                                                               //
9 ///////////////////////////////////////////////////////////////////
10
11 /* $Id$ */
12
13 ClassImp(AliITSSumTP)
14
15 //__________________________________________
16 AliITSSumTP::AliITSSumTP(const AliITSSumTP& src) : 
17                    TObject(src), fTracks(src.fTracks.GetEntriesFast()), fVertex(src.GetVertex()), 
18                    fNVars(src.fNVars), fCrvVars(0)
19 {
20   // copy c-tor
21   fCrvVars = new Double32_t[fNVars];
22   TObjArray& arrSrc = src.GetTracks();
23   for (int i=fNVars;i--;) fCrvVars[i] = src.fCrvVars[i];
24   for (int i=arrSrc.GetEntriesFast();i--;) fTracks.AddAtAndExpand(arrSrc.UncheckedAt(i),i);
25 }
26
27 //__________________________________________
28 AliITSSumTP& AliITSSumTP::operator=(const AliITSSumTP& src)
29 {
30   // assignment op-r
31   if (this == &src) return *this;
32   Reset();
33   TObject::operator=(src);
34   fVertex = src.GetVertex();
35   fNVars = src.fNVars;
36   fCrvVars = new Double32_t[fNVars];
37   TObjArray& arrSrc = src.GetTracks();
38   for (int i=fNVars;i--;) fCrvVars[i] = src.fCrvVars[i];
39   for (int i=arrSrc.GetEntriesFast();i--;) fTracks.AddAtAndExpand(arrSrc.UncheckedAt(i),i);
40   return *this;
41 }
42
43 //__________________________________________
44 void AliITSSumTP::BookNTracks(Int_t n)
45 {
46   // book space for tracks info
47   delete[] fCrvVars; fCrvVars = 0;
48   fNVars = n*kNVarPerTrack; 
49   if (fNVars>0) {
50     fCrvVars = new Double32_t[fNVars];
51     for (int i=fNVars;i--;) fCrvVars[i]=0; 
52   }
53 }
54
55 //__________________________________________
56 void AliITSSumTP::Reset()
57 {
58   // reset object
59   fTracks.Delete();
60   delete[] fCrvVars; 
61   fCrvVars = 0;
62   fNVars = 0;
63   SetUniqueID(0);
64 }
65
66 //__________________________________________
67 void AliITSSumTP::Print(Option_t *) const
68 {
69   // reset object
70   printf("Vertex: "); fVertex.Print();
71   int ntr = GetNTracks();
72   printf("Number of tracks: %d\n",ntr);
73   for (int itr=0;itr<ntr;itr++) {
74     AliTrackPointArray* tr = GetTrack(itr);
75     printf("#%2d : %d hits CrvGlo: %+.2e/%+.2e CrvTPC: %+.2e/%+.2e\n",itr,tr->GetNPoints(),
76            GetCrvGlo(itr),GetCrvGloErr(itr),
77            GetCrvTPC(itr),GetCrvTPCErr(itr));
78   }
79   //
80 }
81