]>
Commit | Line | Data |
---|---|---|
7b85e477 | 1 | #ifndef ALIITSALIGNMILLE2_H |
2 | #define ALIITSALIGNMILLE2_H | |
6526a72c | 3 | |
7b85e477 | 4 | /* Copyright(c) 2007-2009 , ALICE Experiment at CERN, All rights reserved. * |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
057304f3 | 7 | /* $Id$ */ |
6526a72c | 8 | //----------------------------------------------------------------------------- |
7b85e477 | 9 | // |
6526a72c | 10 | // Interface to AliMillePede2 alignment class for the ALICE ITS detector |
11 | // | |
12 | // ITS specific alignment class which interface to AliMillepede. | |
13 | // For each track ProcessTrack calculates the local and global derivatives | |
14 | // at each hit and fill the corresponding local equations. Provide methods for | |
15 | // fixing or constraining detection elements for best results. | |
16 | // | |
17 | // author M. Lunardon (thanks to J. Castillo), ruben.shahoyan@cern.ch | |
18 | //----------------------------------------------------------------------------- | |
7b85e477 | 19 | |
20 | #include <TString.h> | |
21 | #include <TObject.h> | |
6526a72c | 22 | #include <TGeoMatrix.h> |
6be22b3f | 23 | #include <TArrayS.h> |
24 | #include <TArrayD.h> | |
7b85e477 | 25 | #include "AliTrackPointArray.h" |
26 | #include "AliITSAlignMille2Module.h" | |
27 | ||
45993b23 | 28 | class TSystem; |
29 | class TGeoManager; | |
30 | class TVirtualFitter; | |
7b85e477 | 31 | class AliMillePede2; |
32 | class AliAlignObjParams; | |
7b85e477 | 33 | class AliTrackFitterRieman; |
45993b23 | 34 | class AliITSAlignMille2Constraint; |
35 | class AliITSAlignMille2ConstrArray; | |
36 | class AliITSresponseSDD; | |
6be22b3f | 37 | class AliITSTPArrayFit; |
ef24eb3b | 38 | class AliITSsegmentationSDD; |
39 | class AliITSDriftSpeedArraySDD; | |
8102b2c9 | 40 | class AliITSCorrectSDDPoints; |
ef24eb3b | 41 | class AliCDBEntry; |
8102b2c9 | 42 | class AliESDVertex; |
7b85e477 | 43 | |
44 | class AliITSAlignMille2: public TObject | |
45 | { | |
46 | public: | |
6be22b3f | 47 | enum {kX,kY,kZ}; |
1d06ac63 | 48 | enum {kCosmics, kCollision, kNDataType}; |
8102b2c9 | 49 | enum {kNLocal=5,kMaxPoints=20, |
6be22b3f | 50 | kNParChGeom = AliITSAlignMille2Module::kMaxParGeom, |
51 | kNParCh = AliITSAlignMille2Module::kMaxParTot, | |
ef24eb3b | 52 | kMaxITSSensID=2197,kVtxSensID=kMaxITSSensID+1,kMaxITSSensVID=14300,kVtxSensVID=14371, |
53 | kMinITSSupeModuleID=14336, | |
6be22b3f | 54 | kSDDoffsID=240,kNSDDmod=260}; |
7b85e477 | 55 | // |
8102b2c9 | 56 | enum {kCovIScaleBit=BIT(9), |
57 | kSameInitDeltasBit=BIT(14), | |
58 | kSameInitSDDRespBit=BIT(15), | |
59 | kSameInitSDDVDriftBit=BIT(16), | |
60 | kSameDiamondBit=BIT(17), | |
61 | kSameInitSDDCorrMapBit=BIT(18), | |
62 | kSameInitGeomBit=BIT(19) }; | |
63 | // | |
64 | enum {kDiamondIgnore,kDiamondCheckIfPrompt,kDiamondUse}; | |
7b85e477 | 65 | public: |
66 | // | |
6be22b3f | 67 | AliITSAlignMille2(const Char_t *configFilename="AliITSAlignMille.conf",TList* userInfo=0); |
7b85e477 | 68 | virtual ~AliITSAlignMille2(); |
69 | // | |
6526a72c | 70 | AliMillePede2* GetMillePede() const {return fMillepede;} |
6be22b3f | 71 | AliITSTPArrayFit* GetTPAFitter() const {return fTPAFitter;} |
6526a72c | 72 | // |
73 | // configuration methods | |
74 | // | |
75 | Int_t IsVIDDefined(UShort_t voluid) const; | |
76 | Int_t IsVIDContained(UShort_t voluid) const; | |
77 | Int_t IsSymDefined(const Char_t* name) const; | |
78 | Int_t IsSymContained(const Char_t* name) const; | |
8fd71c0a | 79 | Int_t GetRequestedModID(UShort_t voluid) const; |
6526a72c | 80 | // |
7b85e477 | 81 | Int_t GetModuleIndex(const Char_t *symname); |
82 | Int_t GetModuleIndex(UShort_t voluid); | |
83 | UShort_t GetModuleVolumeID(const Char_t *symname); | |
84 | UShort_t GetModuleVolumeID(Int_t index); | |
6526a72c | 85 | AliITSAlignMille2Module* GetMilleModuleByVID(UShort_t voluid) const; // get pointer to the defined supermodule |
86 | AliITSAlignMille2Module* GetMilleModuleBySymName(const Char_t* symname) const; // get pointer to the defined supermodule | |
87 | AliITSAlignMille2Module* GetMilleModuleIfContained(const Char_t* symname) const; | |
88 | AliITSAlignMille2Module* GetMilleModule(Int_t id) const {return (AliITSAlignMille2Module*)fMilleModule[id];} | |
89 | AliITSAlignMille2Module* GetCurrentModule() const {return fCurrentModule;} | |
90 | AliITSAlignMille2Module* GetSuperModule(Int_t id) const {return (AliITSAlignMille2Module*)fSuperModule[id];} | |
ef24eb3b | 91 | AliITSAlignMille2Module* CreateVertexModule(); |
6526a72c | 92 | // |
93 | AliAlignObjParams* GetPrealignedObject(const Char_t* symname) const; | |
94 | AliAlignObjParams* GetConstrRefObject(const Char_t* symname) const; | |
95 | // | |
96 | void ConvertParamsToGlobal(); | |
97 | void ConvertParamsToLocal(); | |
7b85e477 | 98 | // |
6be22b3f | 99 | const Char_t* GetGeometryPath() {return fGeometryPath.Data();} |
100 | const Char_t* GetPreAlignmentPath() {return fPreDeltaPath.Data();} | |
7b85e477 | 101 | TClonesArray* GetPreAlignmentDeltas() const {return fPrealignment;} |
ef24eb3b | 102 | AliITSresponseSDD* GetSDDPrecalResp() const {return fPreRespSDD;} |
103 | AliITSresponseSDD* GetSDDInitResp() const {return fIniRespSDD;} | |
104 | TObjArray* GetSDDInitVDrift() const {return fIniVDriftSDD;} | |
7b85e477 | 105 | void PrintCurrentModuleInfo() const {if (fCurrentModule) fCurrentModule->Print();} |
106 | void Print(Option_t*) const; | |
107 | Bool_t IsConfigured() const {return fIsConfigured;} | |
7b85e477 | 108 | Bool_t GetUseGlobalDelta() const {return fUseGlobalDelta;} |
6526a72c | 109 | Bool_t IsConstraintWrtRef() const {return fConstrRef!=0;} |
110 | Bool_t FixedOrphans() const; | |
6be22b3f | 111 | Bool_t IsLocalYError() const {return fUseLocalYErr;} |
6526a72c | 112 | // |
113 | // geometry stuffs | |
114 | Int_t GetNModules() const {return fNModules;} | |
115 | Int_t GetCurrentModuleIndex() const {return fCurrentModule ? fCurrentModule->GetIndex():-1;} | |
116 | TGeoHMatrix *GetCurrentModuleHMatrix() const {return fCurrentModule ? fCurrentModule->GetMatrix():0;} | |
117 | Double_t *GetCurrentModuleTranslation() const {return fCurrentModule ? fCurrentModule->GetMatrix()->GetTranslation():0;} | |
118 | Int_t GetCurrentModuleInternalIndex() const {return fCurrentModule ? Int_t(fCurrentModule->GetUniqueID()):-1;} | |
119 | Int_t GetTotBadLocEqPoints() const {return fTotBadLocEqPoints;} | |
120 | Int_t GetNConstraints() const {return fConstraints.GetLast()+1;} | |
121 | Int_t InitModuleParams(); | |
7b85e477 | 122 | // |
123 | // fitting methods | |
45993b23 | 124 | AliTrackFitterRieman *GetRiemanFitter() const {return fRieman;} |
7b85e477 | 125 | AliTrackPointArray *PrepareTrack(const AliTrackPointArray *track); |
45993b23 | 126 | AliTrackPointArray *GetCurrentTrack() const {return (AliTrackPointArray*)fTrack;} |
127 | AliTrackPoint *GetCurrentCluster() const {return (AliTrackPoint*)&fCluster;} | |
ef24eb3b | 128 | void ProcessSDDPointInfo(const AliTrackPoint* pnt,Int_t sID, Int_t pntID); |
45993b23 | 129 | void SetCurrentTrack(const AliTrackPointArray *atp) {fTrack = (AliTrackPointArray*)atp;} |
6be22b3f | 130 | void SetCurrentCluster(const AliTrackPoint &atp); |
7b85e477 | 131 | void InitTrackParams(int meth=1); |
ef24eb3b | 132 | Int_t ProcessTrack(const AliTrackPointArray *track, Double_t wgh=1.0); |
133 | Int_t FitTrack(); | |
7b85e477 | 134 | Int_t CheckCurrentTrack(); |
6526a72c | 135 | // |
8102b2c9 | 136 | // methods for point unbiasing (via scaling its inverted cov.matrix) |
137 | Bool_t IsCovIScaleTouched() const {return TestBit(kCovIScaleBit);} | |
138 | void TouchCovIScale(Bool_t v=kTRUE) {SetBit(kCovIScaleBit,v);} | |
139 | Float_t GetCovIScale(Int_t ip) const {return ip<kMaxPoints ? fCovIScale[ip]:-1.;} | |
140 | Float_t* GetCovIScale() const {return (Float_t*)fCovIScale;} | |
141 | void SetCovIScale(Int_t ip, Float_t v=-1.) {if (ip<kMaxPoints) fCovIScale[ip] = v; TouchCovIScale();} | |
142 | void SetCovIScale(Float_t *v, Int_t np) {for (int i=TMath::Min(np,kMaxPoints);i--;) fCovIScale[i]=v[i]; TouchCovIScale();} | |
143 | void ResetCovIScale() {for (int i=kMaxPoints;i--;) fCovIScale[i]=-1; TouchCovIScale(kFALSE);} | |
144 | // | |
7b85e477 | 145 | Int_t CalcIntersectionPoint(Double_t *lpar, Double_t *gpar); |
146 | Int_t CalcDerivatives(Int_t paridx, Bool_t islpar); | |
ef24eb3b | 147 | void JacobianPosGloLoc(int locid,double* jacobian); |
7b85e477 | 148 | Double_t* GetLocalIntersectionPoint() const {return (Double_t*)fPintLoc;} |
149 | Double_t* GetGlobalIntersectionPoint() const {return (Double_t*)fPintGlo;} | |
150 | AliTrackPointArray *SortTrack(const AliTrackPointArray *atp); | |
151 | void SetTemporaryExcludedModule(Int_t index) {fTempExcludedModule=index;} | |
152 | Int_t GetTemporaryExcludedModule() const {return fTempExcludedModule;} | |
6526a72c | 153 | Double_t GetMeasGlo(Int_t dim) const {return fMeasGlo[dim];} |
154 | Double_t GetMeasLoc(Int_t dim) const {return fMeasLoc[dim];} | |
155 | Int_t GetCurrentLayer() const; | |
6be22b3f | 156 | void SetBField(Double_t b=0); |
1d06ac63 | 157 | void SetTypeCosmics() {fDataType = kCosmics;} |
158 | void SetTypeCollision() {fDataType = kCollision;} | |
159 | void SetDataType(Int_t tp=kCosmics) {fDataType = tp>=0&&tp< kNDataType ? tp:kCosmics;} | |
6be22b3f | 160 | void SetUseLocalYErrors(Bool_t v=kTRUE) {fUseLocalYErr = v && fTPAFitter;} |
161 | void SetMinPointsPerSensor( Int_t n ) {fMinPntPerSens = n>0 ? n:0;} | |
162 | Int_t GetMinPointsPerSensor() const {return fMinPntPerSens;} | |
163 | void ConstrainHelixFitPT( Int_t q=0,Double_t pt=-1, Double_t err=-1); | |
164 | void ConstrainHelixFitCurv(Int_t q=0,Double_t crv=-1,Double_t crverr=-1); | |
1d06ac63 | 165 | void RemoveHelixFitConstraint(); |
8102b2c9 | 166 | void SetVertexConstraint(const AliESDVertex* vtx); |
167 | void RemoveVertexConstraint() {fVertexSet = kFALSE;} | |
6be22b3f | 168 | Double_t GetHelixContraintCharge() const {return fConstrCharge;} |
169 | Double_t GetHelixContraintPT() const {return fConstrPT;} | |
170 | Double_t GetHelixContraintPTErr() const {return fConstrPTErr;} | |
1d06ac63 | 171 | Int_t GetDataType() const {return fDataType;} |
6be22b3f | 172 | // |
173 | TGeoHMatrix* GetSensorOrigMatrixSID(Int_t sid) const; | |
174 | TGeoHMatrix* GetSensorOrigMatrixVID(Int_t vid) const; | |
175 | // | |
176 | TGeoHMatrix* GetSensorCurrMatrixSID(Int_t sid) const; | |
177 | TGeoHMatrix* GetSensorCurrMatrixVID(Int_t vid) const; | |
ef24eb3b | 178 | // |
179 | AliCDBEntry* GetCDBEntry(const char* path); | |
7b85e477 | 180 | // Hierarchical contraints |
ef24eb3b | 181 | void TieSDDVDriftsLR(AliITSAlignMille2Module* mod); |
6526a72c | 182 | Bool_t PseudoParentsAllowed() const {return fAllowPseudoParents;} |
183 | void ConstrainModuleSubUnitsMean(Int_t idm, Double_t val=0, UInt_t pattern=0xff); | |
184 | void ConstrainModuleSubUnitsMedian(Int_t idm, Double_t val=0, UInt_t pattern=0xff); | |
185 | void ConstrainOrphansMean(Double_t val=0, UInt_t pattern=0xff); | |
186 | void ConstrainOrphansMedian(Double_t val=0, UInt_t pattern=0xff); | |
187 | void ConstrainLocal(const Char_t* name,Double_t *parcf,Int_t npar,Double_t val,Double_t err); | |
7b85e477 | 188 | // |
45993b23 | 189 | void ApplyGaussianConstraint(const AliITSAlignMille2ConstrArray* cstr); |
6526a72c | 190 | void ApplyPreConstraints(); |
191 | void ApplyPostConstraints(); | |
7b85e477 | 192 | // |
ef24eb3b | 193 | void SetWeightPt(Double_t w=1) {fWeightPt = w;} |
194 | void SetSDDVDCorrMult(Bool_t v=kTRUE) {fIsSDDVDriftMult=v;} | |
195 | Double_t GetWeightPt() const {return fWeightPt;} | |
196 | Bool_t IsSDDVDCorrMult() const {return fIsSDDVDriftMult;} | |
45993b23 | 197 | Bool_t IsParModConstrained(const AliITSAlignMille2Module* mod,Int_t par, Bool_t &meanmed, Bool_t &gaussian) const; |
198 | Bool_t IsParModFamilyVaried(const AliITSAlignMille2Module* mod,Int_t par,Int_t depth=999) const; | |
199 | Bool_t IsParFamilyFree(const AliITSAlignMille2Module* mod,Int_t par,Int_t depth=999) const; | |
7b85e477 | 200 | // |
201 | // millepede methods | |
6526a72c | 202 | Int_t GlobalFit(); |
7b85e477 | 203 | void FixParameter(Int_t param, Double_t value); |
7b85e477 | 204 | void PrintGlobalParameters(); |
7b85e477 | 205 | // |
6be22b3f | 206 | TClonesArray* CreateDeltas(); |
207 | AliITSresponseSDD* CreateSDDResponse(); | |
6526a72c | 208 | // module specific |
7b85e477 | 209 | // |
6526a72c | 210 | Double_t GetTDriftSDD() const; |
211 | Double_t GetVDriftSDD() const; | |
ef24eb3b | 212 | Double_t GetDriftSpeed(Int_t id) const {return fDriftSpeed[id];} |
08517ba6 | 213 | Double_t GetDriftSpeed0(Int_t id) const {return fDriftSpeed0[id];} |
ef24eb3b | 214 | Double_t GetDriftTime0(Int_t id) const {return fDriftTime0[id];} |
215 | ||
6526a72c | 216 | // |
217 | AliITSAlignMille2Constraint* GetConstraint(Int_t i) const {return (AliITSAlignMille2Constraint*)fConstraints.At(i);} | |
218 | AliITSAlignMille2Constraint* GetConstraint(const char* name) const {return (AliITSAlignMille2Constraint*)fConstraints.FindObject(name);} | |
7b85e477 | 219 | // |
220 | // debug stuffs | |
6be22b3f | 221 | void FetchCluster(int ip) {fTrack->GetPoint(fCluster,ip);fCluster.SetUniqueID(ip);} |
45993b23 | 222 | void SetLocalInitParams(const Double_t *par) {for (int i=kNLocal;i--;) fLocalInitParam[i]=par[i];} |
1d06ac63 | 223 | Bool_t IsTypeCosmics() const {return fDataType==kCosmics;} |
224 | Bool_t IsTypeCollision() const {return fDataType==kCollision;} | |
7b85e477 | 225 | Double_t *GetMeasLoc() const {return (Double_t*)fMeasLoc;} |
226 | Double_t *GetSigmaLoc() const {return (Double_t*)fSigmaLoc;} | |
227 | Double_t GetBField() const {return fBField;} | |
1d06ac63 | 228 | Bool_t IsFieldON() const {return fBOn;} |
ef24eb3b | 229 | Bool_t IsDiamondUsed() const {return fUseDiamond;} |
8102b2c9 | 230 | Int_t GetCheckDiamondPoint() const {return fCheckDiamondPoint;} |
231 | void SetCheckDiamondPoint(Int_t m=kDiamondCheckIfPrompt) {fCheckDiamondPoint = m;} | |
232 | Bool_t IsVertexUsed() const {return fUseVertex;} | |
7b85e477 | 233 | Double_t *GetLocalInitParam() const {return (Double_t*)fLocalInitParam;} |
234 | Double_t *GetLocalInitParEr() const {return (Double_t*)fLocalInitParEr;} | |
6526a72c | 235 | Double_t GetLocalDif(int par, int coor) const {return fDerivativeLoc[par][coor];} |
236 | Double_t GetGlobalDif(int par, int coor) const {return fDerivativeGlo[par][coor];} | |
7b85e477 | 237 | Int_t GetPreAlignmentQualityFactor(Int_t index) const;// if not prealign. return -1 |
238 | void SetBug(Int_t bug) {fBug=bug;} // 1:SSD inversion sens.18-19 | |
6526a72c | 239 | static AliITSAlignMille2* GetInstance() {return fgInstance;} |
240 | ||
6be22b3f | 241 | // pepo270809 |
242 | Int_t GetExtraClustersMode() const {return fExtraClustersMode;} | |
243 | void SetExtraClustersMode(Int_t mode) {fExtraClustersMode=mode;} | |
244 | // endpepo270809 | |
245 | ||
6526a72c | 246 | // pepo |
247 | // flag for AliITSAlignMille compatibility | |
248 | Int_t GetMilleVersion() const {return fMilleVersion;} | |
249 | void SetMilleVersion(Int_t m1) {fMilleVersion=m1;} | |
250 | // modified existing methods | |
251 | void SetCurrentModule(Int_t id); | |
252 | // old methods recovered | |
253 | Int_t IsDefined(UShort_t voluid) const {return IsVIDDefined(voluid);} | |
254 | Int_t IsContained(UShort_t voluid) const {return IsVIDContained(voluid);} | |
255 | // moved from private to public | |
1d06ac63 | 256 | void SetRequiredPoint(Char_t* where, Int_t ndet, Int_t updw, Int_t nreqpts,Int_t runtype=-1); |
6526a72c | 257 | Bool_t InitRiemanFit(); |
258 | void SetMinNPtsPerTrack(Int_t pts=3) {fMinNPtsPerTrack=pts;} | |
7b85e477 | 259 | // |
8102b2c9 | 260 | Int_t GetRunID() const {return fRunID;} |
261 | void SetRunID(int run) {fRunID = run;} | |
262 | // | |
263 | AliITSCorrectSDDPoints * GetPreCorrMapSDD() const {return fPreCorrMapSDD;} | |
264 | AliITSCorrectSDDPoints * GetIniCorrMapSDD() const {return fIniCorrMapSDD;} | |
1d06ac63 | 265 | static Bool_t IsZero(Double_t v,Double_t threshold = 1e-15) { return TMath::Abs(v)<threshold; } |
6be22b3f | 266 | static void SetWordBit(UInt_t word,Int_t bitID) { word |= (1<<bitID);} |
267 | static void ResetWordBit(UInt_t word,Int_t bitID) { word &= ~(1<<bitID);} | |
268 | static Bool_t TestWordBit(UInt_t word,Int_t bitID) { return (Bool_t)(word&(1<<bitID));} | |
269 | // | |
4bd2db93 | 270 | protected: |
7b85e477 | 271 | // |
ef24eb3b | 272 | struct Mille2Data { // structure to store data for LocalEquations (X and Z, optionally Y) |
4bd2db93 | 273 | enum {kMaxLev = 7}; |
6be22b3f | 274 | Double_t fMeas[3]; // measured coordinates |
275 | Double_t fSigma[3]; // measured errors | |
276 | Double_t fDerLoc[kNLocal][3]; // calculated local derivatives | |
4bd2db93 | 277 | Int_t fNModFilled, fNGlobFilled, fModuleID[kMaxLev]; // used module info |
278 | Int_t fParMilleID[AliITSAlignMille2Module::kMaxParTot*kMaxLev]; // param id's | |
6be22b3f | 279 | Double_t fDerGlo[AliITSAlignMille2Module::kMaxParTot*kMaxLev][3]; // global derivatives |
4bd2db93 | 280 | }; |
6be22b3f | 281 | // |
7b85e477 | 282 | // configuration methods |
6526a72c | 283 | void Init(); |
abd7ef79 | 284 | Int_t CacheMatricesOrig(); |
285 | Int_t CacheMatricesCurr(); | |
6be22b3f | 286 | Int_t ProcessUserInfo(TList *userInfo=0); |
8102b2c9 | 287 | Int_t GetPathFromUserInfo(TList* cdbList,const char* calib,TString& path, Int_t useBit); |
7b85e477 | 288 | Int_t LoadConfig(const Char_t *cfile="AliITSAlignMille.conf"); |
6526a72c | 289 | TObjArray* GetConfigRecord(FILE* stream, TString& recTitle, TString& recOpt, Bool_t rew); |
18986853 | 290 | Int_t CheckConfigRecords(FILE* stream); |
ef24eb3b | 291 | Int_t ReloadInitCalib(TList *userInfo); |
292 | Int_t ReloadInitCalib(); | |
6526a72c | 293 | // |
294 | void BuildHierarchy(); | |
7b85e477 | 295 | Int_t LoadSuperModuleFile(const Char_t *cfile="ITSMilleSuperModules.root"); |
8102b2c9 | 296 | Int_t LoadGeometry(TString& path); |
6be22b3f | 297 | Int_t LoadSDDResponse(TString& path, AliITSresponseSDD *&resp); |
ef24eb3b | 298 | Int_t LoadSDDVDrift(TString& path, TObjArray *&arr); |
8102b2c9 | 299 | Int_t LoadSDDCorrMap(TString& path, AliITSCorrectSDDPoints *&map); |
6be22b3f | 300 | Int_t LoadDeltas(TString& path, TClonesArray *&arr); |
ef24eb3b | 301 | Int_t LoadDiamond(TString& path); |
7b85e477 | 302 | void ResetLocalEquation(); |
7b85e477 | 303 | Int_t ApplyToGeometry(); |
304 | // | |
6526a72c | 305 | void ConstrainModuleSubUnits(Int_t idm, Double_t val=0, UInt_t pattern=0xff); |
306 | void ConstrainOrphans(Double_t val=0,UInt_t pattern=0xff); | |
307 | void PostConstrainModuleSubUnits(Int_t type,Int_t idm, Double_t val, UInt_t pattern); | |
308 | void PostConstrainOrphans(Int_t type,Double_t val, UInt_t pattern); | |
309 | // | |
6be22b3f | 310 | void SetGeometryPath(const Char_t* filename="geometry.root") { fGeometryPath = filename; } |
6526a72c | 311 | |
ef24eb3b | 312 | void SetInitTrackParamsMeth(Int_t meth=1) {fIniTrackParamsMeth=meth;} |
6526a72c | 313 | // |
314 | void AddConstraint(Double_t *factor, Double_t value, Double_t sigma=0); | |
6be22b3f | 315 | void InitGlobalParameters(Double_t *par); |
316 | Bool_t SetLocalDerivative(Int_t index, Double_t value) {return IsZero(fLocalDerivatives[index]=value);} | |
317 | Bool_t SetGlobalDerivative(Int_t index, Double_t value) {return IsZero(fGlobalDerivatives[index]=value);} | |
6526a72c | 318 | // |
7b85e477 | 319 | // millepede methods |
6526a72c | 320 | // |
4bd2db93 | 321 | Int_t AddLocalEquation(Mille2Data &m); |
6be22b3f | 322 | Int_t AddLocalEquationTPA(Mille2Data &m); |
4bd2db93 | 323 | void SetLocalEquations(const Mille2Data *marr, Int_t neq); |
6526a72c | 324 | void SetUseGlobalDelta(Bool_t v=kTRUE) {fUseGlobalDelta = v;} |
325 | void SetAllowPseudoParents(Bool_t v=kTRUE) {fAllowPseudoParents = v;} | |
326 | Int_t SetConstraintWrtRef(const char* reffname); | |
7b85e477 | 327 | // |
8102b2c9 | 328 | void ConvertDeltas(); |
329 | void ConvSortHierarchically(TObjArray& matArr); | |
330 | Bool_t ConvIsJParentOfI(const TGeoHMatrix* matI,const TGeoHMatrix* matJ) const; | |
331 | AliAlignObjParams* ConvFindDelta(const TClonesArray* arrDelta,const TString& algname) const; | |
332 | ||
7b85e477 | 333 | AliITSAlignMille2(const AliITSAlignMille2& rhs); |
334 | AliITSAlignMille2& operator=(const AliITSAlignMille2& rhs); | |
335 | // | |
336 | protected: | |
337 | // | |
18986853 | 338 | enum { |
ef24eb3b | 339 | kOCDBDefaultPath, |
340 | kOCDBSpecificPath, | |
18986853 | 341 | kGeomFile, |
342 | kSuperModileFile, | |
343 | kConstrRefFile, | |
6be22b3f | 344 | kPreDeltaFile, |
18986853 | 345 | kPreCalSDDFile, |
ef24eb3b | 346 | kPreVDriftSDDFile, |
8102b2c9 | 347 | kPreCorrMapSDDFile, |
348 | kInitCorrMapSDDFile, | |
18986853 | 349 | kInitCalSDDFile, |
ef24eb3b | 350 | kInitVDriftSDDFile, |
6be22b3f | 351 | kInitDeltaFile, |
8102b2c9 | 352 | kInitGeomFile, |
18986853 | 353 | kGlobalDeltas, |
354 | kConstrLocal, | |
355 | kModVolID, | |
356 | kModIndex, | |
357 | kPseudoParents, | |
358 | kTrackFitMethod, | |
359 | kMinPntTrack, | |
360 | kNStDev, | |
361 | kResCutInit, | |
362 | kResCutOther, | |
363 | kLocalSigFactor, | |
364 | kStartFactor, | |
ef24eb3b | 365 | kFinalFactor, |
18986853 | 366 | kBField, |
367 | kSparseMatrix, | |
368 | kRequirePoint, | |
369 | kConstrOrphans, | |
370 | kConstrSubunits, | |
371 | kApplyConstr, | |
6be22b3f | 372 | kExtraClustersMode, |
373 | kTPAFitter, | |
374 | kUseLocalYErr, | |
375 | kMinPointsSens, | |
ef24eb3b | 376 | kSDDVDCorrMult, |
377 | kWeightPt, | |
378 | kUseDiamond, | |
8102b2c9 | 379 | kCorrectDiamond, |
380 | kUseVertex, | |
ef24eb3b | 381 | kSameSDDT0, |
18986853 | 382 | // |
383 | kNKeyWords | |
384 | }; // id's of the keywirds for config file records | |
385 | ||
7b85e477 | 386 | // millepede stuffs |
387 | AliMillePede2 *fMillepede; // Detector independent alignment class | |
ef24eb3b | 388 | Double_t fStartFac; // Initial factor for chi2 cut |
389 | Double_t fFinalFac; // Final factor for chi2 cut | |
7b85e477 | 390 | Double_t fResCutInitial; // Cut on residual for first iteration |
391 | Double_t fResCut; // Cut on residual for other iterations | |
392 | Int_t fNGlobal; // Number of global parameters | |
393 | Int_t fNLocal; // Number of local parameters | |
394 | Int_t fNStdDev; // Number of standard deviations for chi2 cut | |
395 | Bool_t fIsMilleInit; // Flag for initialization | |
6526a72c | 396 | Bool_t fAllowPseudoParents; // For simple constraints don't involve parents into the fit |
7b85e477 | 397 | // |
398 | // fitting stuffs | |
6be22b3f | 399 | AliITSTPArrayFit *fTPAFitter; // TPArrayFitter |
7b85e477 | 400 | AliITSAlignMille2Module *fCurrentModule; // Current SuperModule index |
401 | AliTrackPointArray *fTrack; // pointer to current track | |
6526a72c | 402 | TObjArray fTrackBuff; // buffer for tracks of min length |
7b85e477 | 403 | AliTrackPoint fCluster; // current cluster |
6be22b3f | 404 | Int_t fCurrentSensID; // sensor index for current cluster |
405 | TArrayD fClusLoc; // local coordinates of the clusters | |
406 | TArrayD fClusGlo; // global coordinates of the clusters | |
407 | TArrayD fClusSigLoc; // local cov matrix of the clusters | |
7b85e477 | 408 | Double_t *fGlobalDerivatives; // Array of global derivatives |
409 | Double_t fLocalDerivatives[kNLocal]; // Array of local deriv. | |
410 | Double_t fLocalInitParam[kNLocal]; // Array with inital values for local parameters for current track | |
411 | Double_t fLocalInitParEr[kNLocal][kNLocal];// Array with inital values for local parameters for current track | |
412 | Double_t fModuleInitParam[kNParCh]; // Array with inital values for current module parameters (init geometry) | |
45993b23 | 413 | Double_t fPintLoc[3]; // track/module intersection point in local coordinates |
414 | Double_t fPintLoc0[3]; // track/module intersection point in local coordinates (before variation) | |
415 | Double_t fPintGlo[3]; // track/module intersection point in global coordinates | |
6be22b3f | 416 | Double_t *fMeasLoc; // current point local coordinates (the original ones) |
417 | Double_t *fMeasGlo; // current point glob. coord (AliTrackPoint) | |
418 | Double_t *fSigmaLoc; // stdev current point | |
7b85e477 | 419 | Double_t fSigmaFactor[3]; // multiplicative factor for cluster sigmaX,Y,Z |
6be22b3f | 420 | Double_t fConstrPT; // optional PT constraint for helix (abs value) |
421 | Double_t fConstrPTErr; // error on this constraint (0 - exact) | |
422 | Int_t fConstrCharge; // optional constraint on charge of Helix track (0 - no constraint) | |
8102b2c9 | 423 | Int_t fRunID; // current runID |
7b85e477 | 424 | // |
ef24eb3b | 425 | Double_t fDerivativeLoc[kNLocal][3]; // XYZ deriv. over local params |
6526a72c | 426 | Double_t fDerivativeGlo[kNParCh][3]; // XYZ deriv. over global params |
7b85e477 | 427 | Int_t fMinNPtsPerTrack; // min number of points per track to accept it |
ef24eb3b | 428 | Int_t fIniTrackParamsMeth; // method for track fit |
7b85e477 | 429 | Int_t fTotBadLocEqPoints; // total number of reject points because of bad EqLoc |
430 | AliTrackFitterRieman *fRieman; // riemann fitter for helices | |
431 | // | |
6526a72c | 432 | TObjArray fConstraints; // list of constraints |
6be22b3f | 433 | TObjArray fCacheMatrixOrig; // cach for original geom matrices |
434 | TObjArray fCacheMatrixCurr; // cach for prealigned geom matrices | |
7b85e477 | 435 | // >> new members |
1d06ac63 | 436 | Bool_t fUseGlobalDelta; // intetpret deltas as global |
437 | Bool_t fRequirePoints[kNDataType]; // required points in specific layers | |
438 | Int_t fNReqLayUp[kNDataType][6]; // number of points required in layer[n] with Y>0 | |
439 | Int_t fNReqLayDown[kNDataType][6]; // number of points required in layer[n] with Y<0 | |
440 | Int_t fNReqLay[kNDataType][6]; // number of points required in layer[n] | |
441 | Int_t fNReqDetUp[kNDataType][3]; // number of points required in Detector[n] with Y>0 | |
442 | Int_t fNReqDetDown[kNDataType][3]; // number of points required in Detector[n] with Y<0 | |
443 | Int_t fNReqDet[kNDataType][3]; // number of points required in Detector[n] | |
7b85e477 | 444 | Int_t fTempExcludedModule; /// single module temporary excluded from initial fit |
8102b2c9 | 445 | UInt_t fUserProvided; // settings which user provided: not to update from the UserUnfo |
7b85e477 | 446 | // << new members |
447 | // | |
6be22b3f | 448 | // OCDB stuff |
ef24eb3b | 449 | TList *fIniUserInfo; // initial user info (validity is not guaranteed after initialization) |
8102b2c9 | 450 | TString fIniGeomPath; // where to take the ideal geometry used to produce the points |
ef24eb3b | 451 | TString fIniDeltaPath; // where to take the deltas used to produce the points |
452 | TString fIniSDDRespPath; // where to take the initial SDD response used to produce the points | |
6be22b3f | 453 | TString fPreCalSDDRespPath; // precalibration SDD response file name |
ef24eb3b | 454 | TString fIniSDDVDriftPath; // initial SDD vdrift file name |
8102b2c9 | 455 | TString fPreSDDVDriftPath; // precalibration SDD vdrift file name |
456 | TString fIniSDDCorrMapPath; // initial SDD corr.map file name | |
457 | TString fPreSDDCorrMapPath; // precalibration SDD corr.map file name | |
7b85e477 | 458 | // geometry stuffs |
8102b2c9 | 459 | Bool_t fConvertPreDeltas; // when the prealignment deltas come from UserInfo, convert them from UserInfo geometry to target one |
6be22b3f | 460 | TString fGeometryPath; // Geometry file name |
461 | TString fPreDeltaPath; // file with prealigned objects | |
462 | TString fConstrRefPath; // file with prealigned objects wrt which constraints are defined | |
ef24eb3b | 463 | TString fDiamondPath; // file with diamond constraint |
45993b23 | 464 | TGeoManager *fGeoManager; // pointer to Alice geomanager |
465 | Bool_t fIsConfigured; // flag for loaded config file | |
466 | TArrayS fPreAlignQF; // prealignment flags (not used?) | |
7b85e477 | 467 | // |
ef24eb3b | 468 | AliITSresponseSDD* fIniRespSDD; // array of SDD t0/vdrift calib params used to create the track points |
469 | AliITSresponseSDD* fPreRespSDD; // array of SDD t0/vdrift calib params | |
470 | TObjArray* fIniVDriftSDD; // array of AliITSDriftSpeedArraySDD objects used for original reco | |
471 | TObjArray* fPreVDriftSDD; // array of AliITSDriftSpeedArraySDD objects to be used as a starting point instead of fIniVDriftSDD | |
8102b2c9 | 472 | AliITSCorrectSDDPoints* fIniCorrMapSDD; // SDD initial correction map |
473 | AliITSCorrectSDDPoints* fPreCorrMapSDD; // SDD precalibration correction map | |
ef24eb3b | 474 | AliITSsegmentationSDD* fSegmentationSDD; // extraction of SDD segmentation params |
7b85e477 | 475 | TClonesArray* fPrealignment; // array of prealignment global deltas |
6526a72c | 476 | TClonesArray* fConstrRef; // array of refererence deltas with respect to which the constraint are defined (survey?) |
7b85e477 | 477 | TObjArray fMilleModule; /// array of super modules to be aligned |
478 | TObjArray fSuperModule; /// array of super modules defined in supermodule file | |
479 | Int_t fNModules; // number of defined modules from config file | |
480 | Int_t fNSuperModules; /// number of custom supermodules in SM file | |
481 | Bool_t fUsePreAlignment; // start from prealigned setup | |
6be22b3f | 482 | Bool_t fUseLocalYErr; // use local Yerror due to the sensor thickness |
7b85e477 | 483 | Bool_t fBOn; // magentic field ON |
484 | Double_t fBField; // value of magnetic field | |
1d06ac63 | 485 | Int_t fDataType; // is this cosmics or collision processing? |
6be22b3f | 486 | Int_t fMinPntPerSens; // min number of points per module to vary it |
7b85e477 | 487 | Int_t fBug; /// tag for temporary bug correction |
6526a72c | 488 | // pepo |
489 | Int_t fMilleVersion; /// tag for backward compatibility | |
490 | // endpepo | |
6be22b3f | 491 | // pepo270809 |
492 | Int_t fExtraClustersMode; /// 1=remove random / 2=remove internal / 10=use only tracks with xcl | |
493 | // endpepo270809 | |
6526a72c | 494 | // |
ef24eb3b | 495 | Double_t fTrackWeight; //weight given by the user to current track |
496 | Double_t fWeightPt; //weight track equations by pT in this power | |
497 | Bool_t fIsSDDVDriftMult; //use multiplicative correction for SDD vdrift | |
08517ba6 | 498 | Double_t fDriftSpeed[50]; //temporary array for corrected drift speed of SDD alitrackpoints |
499 | Double_t fDriftSpeed0[50]; //temporary array for original drift speed of SDD alitrackpoints | |
6526a72c | 500 | Double_t fDriftTime0[50]; //temporary array for drift time 0's used for SDD alitrackpoints |
6be22b3f | 501 | Double_t fExtClusterPar[9]; //array to store the parameters of the externally imposed cluster |
ef24eb3b | 502 | AliTrackPoint fDiamond; //optional constraint on the vertex |
503 | AliTrackPoint fDiamondI; //constraint on the vertex with inverted error matrix | |
8102b2c9 | 504 | Double_t fCorrDiamond[3]; //diamond correction |
ef24eb3b | 505 | Bool_t fUseDiamond; //use diamond as a vertex constraint |
8102b2c9 | 506 | Bool_t fUseVertex; //use vertex for constraint |
507 | Bool_t fVertexSet; //vertex is set for current track | |
ef24eb3b | 508 | Int_t fDiamondPointID; //ID of the diamond point in the track |
509 | Int_t fDiamondModID; //id of the fake diamond module | |
8102b2c9 | 510 | Int_t fCheckDiamondPoint; // kDiamondIgnore: ignore in this event, kDiamondCheckIfPrompt: verify if track is prompt, kDiamondUse: use w/o verification |
511 | Float_t fCovIScale[kMaxPoints]; //optional scaling for inv.cov matrix (debiasing). MANAGED BY THE USER EXTERNALLY | |
512 | // | |
513 | TObjArray fConvAlgMatOld; //array to keep matrices of alignables for deltas conversion | |
7b85e477 | 514 | // |
515 | static AliITSAlignMille2* fgInstance; // global pointer on itself | |
516 | static Int_t fgInstanceID; // global counter of the instances | |
6be22b3f | 517 | static const Char_t * fgkRecKeys[]; // keywords for config file records |
518 | static const Char_t fgkXYZ[]; // XYZ labels | |
6526a72c | 519 | // |
7b85e477 | 520 | ClassDef(AliITSAlignMille2, 0) |
7b85e477 | 521 | }; |
522 | ||
6be22b3f | 523 | |
524 | //______________________________________________________________________________________ | |
525 | inline void AliITSAlignMille2::SetCurrentCluster(const AliTrackPoint &atp) | |
526 | { | |
527 | // set current cluster | |
528 | fCluster = atp; | |
529 | fCurrentSensID = AliITSAlignMille2Module::GetIndexFromVolumeID(fCluster.GetVolumeID()); | |
530 | } | |
531 | ||
532 | //______________________________________________________________________________________ | |
533 | inline TGeoHMatrix* AliITSAlignMille2::GetSensorOrigMatrixSID(Int_t sid) const | |
534 | { | |
535 | // get cached original matrix by sensor ID | |
536 | return sid<0 ? 0 : (TGeoHMatrix*) fCacheMatrixOrig[sid]; | |
537 | } | |
538 | ||
539 | //______________________________________________________________________________________ | |
540 | inline TGeoHMatrix* AliITSAlignMille2::GetSensorOrigMatrixVID(Int_t vid) const | |
541 | { | |
542 | // get cached original matrix by sensor volume ID | |
543 | return GetSensorOrigMatrixSID( AliITSAlignMille2Module::GetIndexFromVolumeID(vid) ); | |
544 | } | |
545 | ||
546 | //______________________________________________________________________________________ | |
547 | inline TGeoHMatrix* AliITSAlignMille2::GetSensorCurrMatrixSID(Int_t sid) const | |
548 | { | |
549 | // get cached current matrix by sensor ID | |
550 | return sid<0 ? 0 : (TGeoHMatrix*) fCacheMatrixCurr[sid]; | |
551 | } | |
552 | ||
553 | //______________________________________________________________________________________ | |
554 | inline TGeoHMatrix* AliITSAlignMille2::GetSensorCurrMatrixVID(Int_t vid) const | |
555 | { | |
556 | // get cached current matrix by sensor volume ID | |
557 | return GetSensorCurrMatrixSID( AliITSAlignMille2Module::GetIndexFromVolumeID(vid) ); | |
558 | } | |
559 | ||
7b85e477 | 560 | #endif |
18986853 | 561 |