1 #include "AliMillePedeRecord.h"
5 /**********************************************************************************************/
6 /* AliMillePedeRecords: class to store the data of single track processing */
7 /* Format: for each measured point the data is stored consequtively */
10 /* Local_param_id dResidual/dLocal_param */
12 /* -2 weight of the measurement */
13 /* Global_param_od dResidual/dGlobal_param */
16 /* The records for all processed tracks are stored in the temporary tree in orgder to be */
17 /* reused for multiple iterations of MillePede */
19 /* Author: ruben.shahoyan@cern.ch */
21 /**********************************************************************************************/
23 ClassImp(AliMillePedeRecord)
25 //_____________________________________________________________________________________________
26 AliMillePedeRecord::AliMillePedeRecord() :
27 fSize(0),fNGroups(0),fGroupID(0),fIndex(0),fValue(0) {SetUniqueID(0);}
29 //_____________________________________________________________________________________________
30 AliMillePedeRecord::AliMillePedeRecord(const AliMillePedeRecord& src) :
31 TObject(src),fSize(src.fSize),fNGroups(src.fNGroups),fGroupID(0),fIndex(0),fValue(0)
33 fIndex = new Int_t[GetDtBufferSize()];
34 memcpy(fIndex,src.fIndex,fSize*sizeof(Int_t));
35 fValue = new Double_t[GetDtBufferSize()];
36 memcpy(fValue,src.fValue,fSize*sizeof(Double_t));
37 fGroupID = new Int_t[GetGrBufferSize()];
38 memcpy(fGroupID,src.fGroupID,GetGrBufferSize()*sizeof(Int_t));
41 //_____________________________________________________________________________________________
42 AliMillePedeRecord& AliMillePedeRecord::operator=(const AliMillePedeRecord& rhs)
46 for (int i=0;i<rhs.GetSize();i++) {
49 rhs.GetIndexValue(i,ind,val);
50 AddIndexValue(ind,val);
52 for (int i=0;i<rhs.GetNGroups();i++) MarkGroup(rhs.GetGroupID(i));
57 //_____________________________________________________________________________________________
58 AliMillePedeRecord::~AliMillePedeRecord() {delete[] fIndex; delete[] fValue; delete[] fGroupID;}
60 //_____________________________________________________________________________________________
61 void AliMillePedeRecord::Reset()
64 for (int i=fNGroups;i--;) fGroupID[i] = -1;
68 //_____________________________________________________________________________________________
69 void AliMillePedeRecord::Print(const Option_t *) const
71 if (!fSize) {AliInfo("No data"); return;}
74 if (fNGroups) printf("Groups: ");
75 for (int i=0;i<fNGroups;i++) printf("%4d |",GetGroupID(i)); printf("\n");
78 Double_t resid = fValue[cnt++];
79 Double_t *derLoc = GetValue()+cnt;
80 int *indLoc = GetIndex()+cnt;
82 while(!IsWeight(cnt)) {nLoc++;cnt++;}
83 Double_t weight = GetValue(cnt++);
84 Double_t *derGlo = GetValue()+cnt;
85 int *indGlo = GetIndex()+cnt;
87 while(!IsResidual(cnt) && cnt<fSize) {nGlo++; cnt++;}
89 printf("\n*** Point#%2d | Residual = %+.4e | Weight = %+.4e\n",point++,resid,weight);
91 for (int i=0;i<nLoc;i++) printf("[%5d] %+.4e|",indLoc[i],derLoc[i]); printf("\n");
93 for (int i=0;i<nGlo;i++) printf("[%5d] %+.4e|",indGlo[i],derGlo[i]); printf("\n");
99 //_____________________________________________________________________________________________
100 void AliMillePedeRecord::ExpandDtBuffer(Int_t bfsize)
102 // add extra space for derivatives data
103 bfsize = TMath::Max(bfsize,GetDtBufferSize());
104 Int_t *tmpI = new Int_t[bfsize];
105 memcpy(tmpI,fIndex, fSize*sizeof(Int_t));
109 Double_t *tmpD = new Double_t[bfsize];
110 memcpy(tmpD,fValue, fSize*sizeof(Double_t));
114 SetDtBufferSize(bfsize);
117 //_____________________________________________________________________________________________
118 void AliMillePedeRecord::ExpandGrBuffer(Int_t bfsize)
120 // add extra space for groupID data
121 bfsize = TMath::Max(bfsize,GetGrBufferSize());
122 Int_t *tmpI = new Int_t[bfsize];
123 memcpy(tmpI,fGroupID, fNGroups*sizeof(Int_t));
126 for (int i=fNGroups;i<bfsize;i++) fGroupID[i] = -1;
128 SetGrBufferSize(bfsize);
131 //_____________________________________________________________________________________________
132 void AliMillePedeRecord::MarkGroup(Int_t id)
134 // mark the presence of the detector group
135 if (fNGroups>0 && fGroupID[fNGroups-1]==id) return; // already there
136 if (fNGroups>=GetGrBufferSize()) ExpandGrBuffer(2*(fNGroups+1));
137 fGroupID[fNGroups++] = id;
140 //_____________________________________________________________________________________________
141 Bool_t AliMillePedeRecord::IsGroupPresent(Int_t id) const
143 for (int i=fNGroups;i--;) if (GetGroupID(i)==id) return kTRUE;