]>
Commit | Line | Data |
---|---|---|
de34b538 | 1 | #ifndef ALIMILLEPEDERECORD_H |
2 | #define ALIMILLEPEDERECORD_H | |
3 | ||
4 | /**********************************************************************************************/ | |
5 | /* AliMillePedeRecords: class to store the data of single track processing */ | |
6 | /* Format: for each measured point the data is stored consequtively */ | |
7 | /* INDEX VALUE */ | |
8 | /* -1 residual */ | |
9 | /* Local_param_id dResidual/dLocal_param */ | |
10 | /* ... ... */ | |
11 | /* -2 weight of the measurement */ | |
12 | /* Global_param_od dResidual/dGlobal_param */ | |
13 | /* ... ... */ | |
14 | /* */ | |
15 | /* The records for all processed tracks are stored in the temporary tree in orgder to be */ | |
16 | /* reused for multiple iterations of MillePede */ | |
17 | /* */ | |
18 | /* Author: ruben.shahoyan@cern.ch */ | |
19 | /* */ | |
20 | /**********************************************************************************************/ | |
21 | #include <TObject.h> | |
22 | ||
23 | class AliMillePedeRecord : public TObject | |
24 | { | |
25 | public: | |
26 | AliMillePedeRecord(); | |
27 | AliMillePedeRecord(const AliMillePedeRecord& src); | |
28 | AliMillePedeRecord& operator=(const AliMillePedeRecord& rhs); | |
29 | // | |
30 | virtual ~AliMillePedeRecord(); | |
31 | void Reset(); | |
32 | void Print(const Option_t *opt="") const; | |
33 | // | |
34 | Int_t GetSize() const {return fSize;} | |
35 | Int_t *GetIndex() const {return fIndex;} | |
36 | Int_t GetIndex(int i) const {return fIndex[i];} | |
37 | // | |
38 | void GetIndexValue(Int_t i,Int_t &ind,Double_t &val) const {ind=fIndex[i]; val=fValue[i];} | |
39 | void AddIndexValue(Int_t ind, Double_t val); | |
40 | void AddResidual(Double_t val) {AddIndexValue(-1,val);} | |
41 | void AddWeight(Double_t val) {AddIndexValue(-2,val);} | |
a8c5b94c | 42 | void SetWeight(Double_t w=1) {fWeight = w;} |
de34b538 | 43 | Bool_t IsResidual(Int_t i) const {return fIndex[i]==-1;} |
44 | Bool_t IsWeight(Int_t i) const {return fIndex[i]==-2;} | |
45 | // | |
46 | Double_t *GetValue() const {return fValue;} | |
47 | Double_t GetValue(Int_t i) const {return fValue[i];} | |
a8c5b94c | 48 | Double_t GetWeight() const {return fWeight;} |
de34b538 | 49 | // |
50 | void MarkGroup(Int_t id); | |
51 | Int_t GetNGroups() const {return fNGroups;} | |
a8c5b94c | 52 | Int_t GetGroupID(Int_t i) const {return fGroupID[i]-1;} |
de34b538 | 53 | Bool_t IsGroupPresent(Int_t id) const; |
e30a812f | 54 | UInt_t GetRunID() const {return fRunID;} |
55 | void SetRunID(UInt_t run) {fRunID = run;} | |
de34b538 | 56 | // |
9b86a63d | 57 | // Aux methods |
58 | Double_t GetGlobalDeriv(Int_t pnt, Int_t indx) const; | |
59 | Double_t GetLocalDeriv(Int_t pnt, Int_t indx) const; | |
60 | Double_t GetResidual(Int_t pnt) const; | |
61 | Double_t GetGloResWProd(Int_t indx) const; | |
ca7f226b | 62 | Double_t GetWeight(Int_t indx) const; |
9b86a63d | 63 | // |
de34b538 | 64 | protected: |
65 | Int_t GetDtBufferSize() const {return GetUniqueID()&0x0000ffff;} | |
66 | Int_t GetGrBufferSize() const {return GetUniqueID()>>16;} | |
67 | void SetDtBufferSize(Int_t sz) {SetUniqueID((GetGrBufferSize()<<16)+sz);} | |
68 | void SetGrBufferSize(Int_t sz) {SetUniqueID(GetDtBufferSize()+(sz<<16));} | |
69 | void ExpandDtBuffer(Int_t bfsize); | |
70 | void ExpandGrBuffer(Int_t bfsize); | |
71 | // | |
72 | protected: | |
73 | Int_t fSize; // size of the record | |
74 | Int_t fNGroups; // number of groups (e.g. detectors) contributing | |
e30a812f | 75 | UInt_t fRunID; // run ID |
a8c5b94c | 76 | UShort_t* fGroupID; //[fNGroups] groups id's+1 (in increasing order) |
de34b538 | 77 | Int_t * fIndex; //[fSize] index of variables |
a8c5b94c | 78 | Double32_t* fValue; //[fSize] array of values: derivs,residuals |
79 | Double32_t fWeight; //global weight for the record | |
de34b538 | 80 | // |
e30a812f | 81 | ClassDef(AliMillePedeRecord,3) // Record of track residuals and local/global deriavtives |
de34b538 | 82 | }; |
83 | ||
a8c5b94c | 84 | //_____________________________________________________________________________________________ |
de34b538 | 85 | inline void AliMillePedeRecord::AddIndexValue(Int_t ind, Double_t val) |
86 | { | |
a8c5b94c | 87 | // add new pair of index/value |
de34b538 | 88 | if (fSize>=GetDtBufferSize()) ExpandDtBuffer(2*(fSize+1)); |
89 | fIndex[fSize]=ind; | |
90 | fValue[fSize++]=val; | |
91 | } | |
92 | ||
a8c5b94c | 93 | //_____________________________________________________________________________________________ |
94 | inline Bool_t AliMillePedeRecord::IsGroupPresent(Int_t id) const | |
95 | { | |
96 | // check if group is defined | |
97 | id++; | |
98 | for (int i=fNGroups;i--;) if (fGroupID[i]==id) return kTRUE; | |
99 | return kFALSE; | |
100 | } | |
101 | ||
de34b538 | 102 | #endif |