Project
Loading...
Searching...
No Matches
MillePedeRecord.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
18
19#ifndef ALICEO2_FWDALIGN_MILLEPEDERECORD_H
20#define ALICEO2_FWDALIGN_MILLEPEDERECORD_H
21
22#include <TObject.h>
23
24namespace o2
25{
26namespace fwdalign
27{
40{
41 public:
44
47
50
52 ~MillePedeRecord() override;
53
55 void Reset();
56
58 void Print(const Option_t* opt = "") const override;
59
60 Int_t GetSize() const { return fSize; }
61 Int_t* GetIndex() const { return fIndex; }
62 Int_t GetIndex(int i) const { return fIndex[i]; }
63
64 void GetIndexValue(Int_t i, Int_t& ind, Double_t& val) const
65 {
66 ind = fIndex[i];
67 val = fValue[i];
68 }
69
71 void AddIndexValue(Int_t ind, Double_t val);
72
73 void AddResidual(Double_t val) { AddIndexValue(-1, val); }
74 void AddWeight(Double_t val) { AddIndexValue(-2, val); }
75 void SetWeight(Double_t w = 1) { fWeight = w; }
76 Bool_t IsResidual(Int_t i) const { return fIndex[i] == -1; }
77 Bool_t IsWeight(Int_t i) const { return fIndex[i] == -2; }
78
79 Double_t* GetValue() const { return fValue; }
80 Double_t GetValue(Int_t i) const { return fValue[i]; }
81 Double_t GetWeight() const { return fWeight; }
82
84 void MarkGroup(Int_t id);
85 Int_t GetNGroups() const { return fNGroups; }
86 Int_t GetGroupID(Int_t i) const { return fGroupID[i] - 1; }
87
89 Bool_t IsGroupPresent(Int_t id) const;
90
91 UInt_t GetRunID() const { return fRunID; }
92 void SetRunID(UInt_t run) { fRunID = run; }
93
95 Double_t GetGlobalDeriv(Int_t pnt, Int_t indx) const;
96
98 Double_t GetLocalDeriv(Int_t pnt, Int_t indx) const;
99
101 Double_t GetResidual(Int_t pnt) const;
102
104 Double_t GetGloResWProd(Int_t indx) const;
105
107 Double_t GetWeight(Int_t indx) const;
108
109 protected:
110 Int_t GetDtBufferSize() const { return GetUniqueID() & 0x0000ffff; }
111 Int_t GetGrBufferSize() const { return GetUniqueID() >> 16; }
112 void SetDtBufferSize(Int_t sz) { SetUniqueID((GetGrBufferSize() << 16) + sz); }
113 void SetGrBufferSize(Int_t sz) { SetUniqueID(GetDtBufferSize() + (sz << 16)); }
114
116 void ExpandDtBuffer(Int_t bfsize);
117
119 void ExpandGrBuffer(Int_t bfsize);
120
121 protected:
122 Int_t fSize;
123 Int_t fNGroups;
124 UInt_t fRunID;
125 UShort_t* fGroupID;
126 Int_t* fIndex;
127 Double32_t* fValue;
128 Double32_t fWeight;
129
131};
132
133//_____________________________________________________________________________
134inline void MillePedeRecord::AddIndexValue(Int_t ind, Double_t val)
135{
136 if (fSize >= GetDtBufferSize()) {
137 ExpandDtBuffer(2 * (fSize + 1));
138 }
139 fIndex[fSize] = ind;
140 fValue[fSize++] = val;
141}
142
143//_____________________________________________________________________________
144inline Bool_t MillePedeRecord::IsGroupPresent(Int_t id) const
145{
146 id++;
147 for (int i = fNGroups; i--;) {
148 if (fGroupID[i] == id) {
149 return kTRUE;
150 }
151 }
152 return kFALSE;
153}
154
155} // namespace fwdalign
156} // namespace o2
157
158#endif
int32_t i
Store residuals and local/global deriavtives from a single track processing.
MillePedeRecord & operator=(const MillePedeRecord &rhs)
assignment op-r
ClassDefOverride(MillePedeRecord, 3)
Int_t fSize
size of the record
void ExpandDtBuffer(Int_t bfsize)
add extra space for derivatives data
Double_t GetValue(Int_t i) const
Int_t * fIndex
[fSize] index of variables
void AddIndexValue(Int_t ind, Double_t val)
add new pair of index/value
void Print(const Option_t *opt="") const override
print itself
Double_t GetGlobalDeriv(Int_t pnt, Int_t indx) const
get derivative over global variable indx at point pnt
UShort_t * fGroupID
[fNGroups] groups id's+1 (in increasing order)
Int_t fNGroups
number of groups (e.g. detectors) contributing
void MarkGroup(Int_t id)
mark the presence of the detector group
Int_t GetGroupID(Int_t i) const
Double_t GetGloResWProd(Int_t indx) const
get sum of derivative over global variable indx * res. at point * weight
Double32_t fWeight
global weight for the record
void ExpandGrBuffer(Int_t bfsize)
add extra space for groupID data
Double_t GetResidual(Int_t pnt) const
get residual at point pnt
Bool_t IsGroupPresent(Int_t id) const
check if group is defined
~MillePedeRecord() override
destuctor
Bool_t IsResidual(Int_t i) const
void GetIndexValue(Int_t i, Int_t &ind, Double_t &val) const
Double_t GetLocalDeriv(Int_t pnt, Int_t indx) const
get derivative over local variable indx at point pnt
Double32_t * fValue
[fSize] array of values: derivs,residuals
Bool_t IsWeight(Int_t i) const
GLenum src
Definition glcorearb.h:1767
GLuint GLfloat * val
Definition glcorearb.h:1582
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...