Skip to content

Commit

Permalink
Adapt GTU simulation to match sagitta calculation in hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
martenole authored and qgp committed Dec 8, 2015
1 parent 6eae38d commit c1bb50e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 80 deletions.
113 changes: 39 additions & 74 deletions TRD/TRDbase/AliTRDgtuParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ const Int_t AliTRDgtuParam::fgkBitExcessYProj = 2;
const Int_t AliTRDgtuParam::fgkPtInfinity = std::numeric_limits<Int_t>::max();

// ---- conversion rejection via sagitta method -----
Float_t AliTRDgtuParam::fgPtCut = .62;
Float_t AliTRDgtuParam::fgInvPtDevCut = .262144;
Float_t AliTRDgtuParam::fgLayerInvXpos[6] = {0.0033335557, 0.00319918101, 0.003075219878, 0.002960506839, 0.002854044181, 0.002754972726};
Float_t AliTRDgtuParam::fgLayerXpos[6] = {299.98 , 312.58 , 325.18 , 337.78 , 350.38 , 362.98};
Int_t AliTRDgtuParam::fgShiftLengthNorm = 1e6;
Int_t AliTRDgtuParam::fgCorrectionMode = 0;
Bool_t AliTRDgtuParam::fgWriteSagittaOutputToTrackWordBC = kFALSE;

// ----- geometry constants used in GTU -----
const Bool_t AliTRDgtuParam::fgZChannelMap[5][16][6][16] = {
Expand Down Expand Up @@ -1252,6 +1253,42 @@ const Float_t AliTRDgtuParam::fgkAcoeff[32][6] = {
{ -1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1, -1}
};
const Float_t AliTRDgtuParam::fgkZposLookupTable[5][6][16] = {
{{297.25 ,289.75 ,282.25 ,274.75 ,267.25 ,259.75 ,252.25 ,244.75 ,237.25 ,229.75 ,222.25 ,214.75 ,207.25 ,199.75 ,192.25 ,184.75},
{297.25 ,289.75 ,282.25 ,274.75 ,267.25 ,259.75 ,252.25 ,244.75 ,237.25 ,229.75 ,222.25 ,214.75 ,207.25 ,199.75 ,192.25 ,184.75},
{311.25 ,303.5 ,295.5 ,287.5 ,279.5 ,271.5 ,263.5 ,255.5 ,247.5 ,239.5 ,231.5 ,223.5 ,215.5 ,207.5 ,199.5 ,191.75},
{325.25 ,317.25 ,308.75 ,300.25 ,291.75 ,283.25 ,274.75 ,266.25 ,257.75 ,249.25 ,240.75 ,232.25 ,223.75 ,215.25 ,206.75 ,198.75},
{339.25 ,331 ,322 ,313 ,304 ,295 ,286 ,277 ,268 ,259 ,250 ,241 ,232 ,223 ,214 ,205.75},
{342.75 ,334 ,325 ,316 ,307 ,298 ,289 ,280 ,271 ,262 ,253 ,244 ,235 ,226 ,217 ,208.25}},

{{173.25 ,165.75 ,158.25 ,150.75 ,143.25 ,135.75 ,128.25 ,120.75 ,113.25 ,105.75 ,98.25 ,90.75 ,83.25 ,75.75 ,68.25 ,60.75},
{173.25 ,165.75 ,158.25 ,150.75 ,143.25 ,135.75 ,128.25 ,120.75 ,113.25 ,105.75 ,98.25 ,90.75 ,83.25 ,75.75 ,68.25 ,60.75},
{180.25 ,172.5 ,164.5 ,156.5 ,148.5 ,140.5 ,132.5 ,124.5 ,116.5 ,108.5 ,100.5 ,92.5 ,84.5 ,76.5 ,68.5 ,60.75},
{187.25 ,179.25 ,170.75 ,162.25 ,153.75 ,145.25 ,136.75 ,128.25 ,119.75 ,111.25 ,102.75 ,94.25 ,85.75 ,77.25 ,68.75 ,60.75},
{194.25 ,186 ,177 ,168 ,159 ,150 ,141 ,132 ,123 ,114 ,105 ,96 ,87 ,78 ,69 ,60.75},
{195.75 ,187 ,178 ,169 ,160 ,151 ,142 ,133 ,124 ,115 ,106 ,97 ,88 ,79 ,70 ,61.25}},

{{49 ,40.5 ,31.5 ,22.5 ,13.5 ,4.5 ,-4.5 ,-13.5 ,-22.5 ,-31.5 ,-40.5 ,-49 ,9999 ,9999 ,9999 ,9999},
{49 ,40.5 ,31.5 ,22.5 ,13.5 ,4.5 ,-4.5 ,-13.5 ,-22.5 ,-31.5 ,-40.5 ,-49 ,9999 ,9999 ,9999 ,9999},
{49 ,40.5 ,31.5 ,22.5 ,13.5 ,4.5 ,-4.5 ,-13.5 ,-22.5 ,-31.5 ,-40.5 ,-49 ,9999 ,9999 ,9999 ,9999},
{49 ,40.5 ,31.5 ,22.5 ,13.5 ,4.5 ,-4.5 ,-13.5 ,-22.5 ,-31.5 ,-40.5 ,-49 ,9999 ,9999 ,9999 ,9999},
{49 ,40.5 ,31.5 ,22.5 ,13.5 ,4.5 ,-4.5 ,-13.5 ,-22.5 ,-31.5 ,-40.5 ,-49 ,9999 ,9999 ,9999 ,9999},
{49 ,40.5 ,31.5 ,22.5 ,13.5 ,4.5 ,-4.5 ,-13.5 ,-22.5 ,-31.5 ,-40.5 ,-49 ,9999 ,9999 ,9999 ,9999}},

{{-60.75 ,-68.25 ,-75.75 ,-83.25 ,-90.75 ,-98.25 ,-105.75 ,-113.25 ,-120.75 ,-128.25 ,-135.75 ,-143.25 ,-150.75 ,-158.25 ,-165.75 ,-173.25},
{-60.75 ,-68.25 ,-75.75 ,-83.25 ,-90.75 ,-98.25 ,-105.75 ,-113.25 ,-120.75 ,-128.25 ,-135.75 ,-143.25 ,-150.75 ,-158.25 ,-165.75 ,-173.25},
{-60.75 ,-68.5 ,-76.5 ,-84.5 ,-92.5 ,-100.5 ,-108.5 ,-116.5 ,-124.5 ,-132.5 ,-140.5 ,-148.5 ,-156.5 ,-164.5 ,-172.5 ,-180.25},
{-60.75 ,-68.75 ,-77.25 ,-85.75 ,-94.25 ,-102.75 ,-111.25 ,-119.75 ,-128.25 ,-136.75 ,-145.25 ,-153.75 ,-162.25 ,-170.75 ,-179.25 ,-187.25},
{-60.75 ,-69 ,-78 ,-87 ,-96 ,-105 ,-114 ,-123 ,-132 ,-141 ,-150 ,-159 ,-168 ,-177 ,-186 ,-194.25},
{-61.25 ,-70 ,-79 ,-88 ,-97 ,-106 ,-115 ,-124 ,-133 ,-142 ,-151 ,-160 ,-169 ,-178 ,-187 ,-195.75}},

{{-184.75 ,-192.25 ,-199.75 ,-207.25 ,-214.75 ,-222.25 ,-229.75 ,-237.25 ,-244.75 ,-252.25 ,-259.75 ,-267.25 ,-274.75 ,-282.25 ,-289.75 ,-297.25},
{-184.75 ,-192.25 ,-199.75 ,-207.25 ,-214.75 ,-222.25 ,-229.75 ,-237.25 ,-244.75 ,-252.25 ,-259.75 ,-267.25 ,-274.75 ,-282.25 ,-289.75 ,-297.25},
{-191.75 ,-199.5 ,-207.5 ,-215.5 ,-223.5 ,-231.5 ,-239.5 ,-247.5 ,-255.5 ,-263.5 ,-271.5 ,-279.5 ,-287.5 ,-295.5 ,-303.5 ,-311.25},
{-198.75 ,-206.75 ,-215.25 ,-223.75 ,-232.25 ,-240.75 ,-249.25 ,-257.75 ,-266.25 ,-274.75 ,-283.25 ,-291.75 ,-300.25 ,-308.75 ,-317.25 ,-325.25},
{-205.75 ,-214 ,-223 ,-232 ,-241 ,-250 ,-259 ,-268 ,-277 ,-286 ,-295 ,-304 ,-313 ,-322 ,-331 ,-339.25},
{-208.25 ,-217 ,-226 ,-235 ,-244 ,-253 ,-262 ,-271 ,-280 ,-289 ,-298 ,-307 ,-316 ,-325 ,-334 ,-342.75}
}};
const Int_t AliTRDgtuParam::fgkMaskID[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
-1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 2, -1, 3, 4, 5,
Expand Down Expand Up @@ -1744,79 +1781,7 @@ Int_t AliTRDgtuParam::GetZpos(Int_t stack, Int_t layer, Int_t binZ)
return 9999;
}

// Stack 0
Float_t zPosLookupStack0Lr0[16]={297.25,289.75,282.25,274.75,267.25,259.75,252.25,244.75,237.25,229.75,222.25,214.75,207.25,199.75,192.25,184.75};
Float_t zPosLookupStack0Lr1[16]={297.25,289.75,282.25,274.75,267.25,259.75,252.25,244.75,237.25,229.75,222.25,214.75,207.25,199.75,192.25,184.75};
Float_t zPosLookupStack0Lr2[16]={311.25,303.5,295.5,287.5,279.5,271.5,263.5,255.5,247.5,239.5,231.5,223.5,215.5,207.5,199.5,191.75};
Float_t zPosLookupStack0Lr3[16]={325.25,317.25,308.75,300.25,291.75,283.25,274.75,266.25,257.75,249.25,240.75,232.25,223.75,215.25,206.75,198.75};
Float_t zPosLookupStack0Lr4[16]={339.25,331,322,313,304,295,286,277,268,259,250,241,232,223,214,205.75};
Float_t zPosLookupStack0Lr5[16]={342.75,334,325,316,307,298,289,280,271,262,253,244,235,226,217,208.25};
// Stack 1
Float_t zPosLookupStack1Lr0[16]={173.25,165.75,158.25,150.75,143.25,135.75,128.25,120.75,113.25,105.75,98.25,90.75,83.25,75.75,68.25,60.75};
Float_t zPosLookupStack1Lr1[16]={173.25,165.75,158.25,150.75,143.25,135.75,128.25,120.75,113.25,105.75,98.25,90.75,83.25,75.75,68.25,60.75};
Float_t zPosLookupStack1Lr2[16]={180.25,172.5,164.5,156.5,148.5,140.5,132.5,124.5,116.5,108.5,100.5,92.5,84.5,76.5,68.5,60.75};
Float_t zPosLookupStack1Lr3[16]={187.25,179.25,170.75,162.25,153.75,145.25,136.75,128.25,119.75,111.25,102.75,94.25,85.75,77.25,68.75,60.75};
Float_t zPosLookupStack1Lr4[16]={194.25,186,177,168,159,150,141,132,123,114,105,96,87,78,69,60.75};
Float_t zPosLookupStack1Lr5[16]={195.75,187,178,169,160,151,142,133,124,115,106,97,88,79,70,61.25};
// Stack 2
Float_t zPosLookupStack2Lr0[12]={49,40.5,31.5,22.5,13.5,4.5,-4.5,-13.5,-22.5,-31.5,-40.5,-49};
Float_t zPosLookupStack2Lr1[12]={49,40.5,31.5,22.5,13.5,4.5,-4.5,-13.5,-22.5,-31.5,-40.5,-49};
Float_t zPosLookupStack2Lr2[12]={49,40.5,31.5,22.5,13.5,4.5,-4.5,-13.5,-22.5,-31.5,-40.5,-49};
Float_t zPosLookupStack2Lr3[12]={49,40.5,31.5,22.5,13.5,4.5,-4.5,-13.5,-22.5,-31.5,-40.5,-49};
Float_t zPosLookupStack2Lr4[12]={49,40.5,31.5,22.5,13.5,4.5,-4.5,-13.5,-22.5,-31.5,-40.5,-49};
Float_t zPosLookupStack2Lr5[12]={49,40.5,31.5,22.5,13.5,4.5,-4.5,-13.5,-22.5,-31.5,-40.5,-49};
// Stack 3
Float_t zPosLookupStack3Lr0[16]={-60.75,-68.25,-75.75,-83.25,-90.75,-98.25,-105.75,-113.25,-120.75,-128.25,-135.75,-143.25,-150.75,-158.25,-165.75,-173.25};
Float_t zPosLookupStack3Lr1[16]={-60.75,-68.25,-75.75,-83.25,-90.75,-98.25,-105.75,-113.25,-120.75,-128.25,-135.75,-143.25,-150.75,-158.25,-165.75,-173.25};
Float_t zPosLookupStack3Lr2[16]={-60.75,-68.5,-76.5,-84.5,-92.5,-100.5,-108.5,-116.5,-124.5,-132.5,-140.5,-148.5,-156.5,-164.5,-172.5,-180.25};
Float_t zPosLookupStack3Lr3[16]={-60.75,-68.75,-77.25,-85.75,-94.25,-102.75,-111.25,-119.75,-128.25,-136.75,-145.25,-153.75,-162.25,-170.75,-179.25,-187.25};
Float_t zPosLookupStack3Lr4[16]={-60.75,-69,-78,-87,-96,-105,-114,-123,-132,-141,-150,-159,-168,-177,-186,-194.25};
Float_t zPosLookupStack3Lr5[16]={-61.25,-70,-79,-88,-97,-106,-115,-124,-133,-142,-151,-160,-169,-178,-187,-195.75};
// Stack 4
Float_t zPosLookupStack4Lr0[16]={-184.75,-192.25,-199.75,-207.25,-214.75,-222.25,-229.75,-237.25,-244.75,-252.25,-259.75,-267.25,-274.75,-282.25,-289.75,-297.25};
Float_t zPosLookupStack4Lr1[16]={-184.75,-192.25,-199.75,-207.25,-214.75,-222.25,-229.75,-237.25,-244.75,-252.25,-259.75,-267.25,-274.75,-282.25,-289.75,-297.25};
Float_t zPosLookupStack4Lr2[16]={-191.75,-199.5,-207.5,-215.5,-223.5,-231.5,-239.5,-247.5,-255.5,-263.5,-271.5,-279.5,-287.5,-295.5,-303.5,-311.25};
Float_t zPosLookupStack4Lr3[16]={-198.75,-206.75,-215.25,-223.75,-232.25,-240.75,-249.25,-257.75,-266.25,-274.75,-283.25,-291.75,-300.25,-308.75,-317.25,-325.25};
Float_t zPosLookupStack4Lr4[16]={-205.75,-214,-223,-232,-241,-250,-259,-268,-277,-286,-295,-304,-313,-322,-331,-339.25};
Float_t zPosLookupStack4Lr5[16]={-208.25,-217,-226,-235,-244,-253,-262,-271,-280,-289,-298,-307,-316,-325,-334,-342.75};

Float_t *zPosLookup[5][6];
zPosLookup[0][0]=zPosLookupStack0Lr0;
zPosLookup[0][1]=zPosLookupStack0Lr1;
zPosLookup[0][2]=zPosLookupStack0Lr2;
zPosLookup[0][3]=zPosLookupStack0Lr3;
zPosLookup[0][4]=zPosLookupStack0Lr4;
zPosLookup[0][5]=zPosLookupStack0Lr5;

zPosLookup[1][0]=zPosLookupStack1Lr0;
zPosLookup[1][1]=zPosLookupStack1Lr1;
zPosLookup[1][2]=zPosLookupStack1Lr2;
zPosLookup[1][3]=zPosLookupStack1Lr3;
zPosLookup[1][4]=zPosLookupStack1Lr4;
zPosLookup[1][5]=zPosLookupStack1Lr5;

zPosLookup[2][0]=zPosLookupStack2Lr0;
zPosLookup[2][1]=zPosLookupStack2Lr1;
zPosLookup[2][2]=zPosLookupStack2Lr2;
zPosLookup[2][3]=zPosLookupStack2Lr3;
zPosLookup[2][4]=zPosLookupStack2Lr4;
zPosLookup[2][5]=zPosLookupStack2Lr5;

zPosLookup[3][0]=zPosLookupStack3Lr0;
zPosLookup[3][1]=zPosLookupStack3Lr1;
zPosLookup[3][2]=zPosLookupStack3Lr2;
zPosLookup[3][3]=zPosLookupStack3Lr3;
zPosLookup[3][4]=zPosLookupStack3Lr4;
zPosLookup[3][5]=zPosLookupStack3Lr5;

zPosLookup[4][0]=zPosLookupStack4Lr0;
zPosLookup[4][1]=zPosLookupStack4Lr1;
zPosLookup[4][2]=zPosLookupStack4Lr2;
zPosLookup[4][3]=zPosLookupStack4Lr3;
zPosLookup[4][4]=zPosLookupStack4Lr4;
zPosLookup[4][5]=zPosLookupStack4Lr5;

return zPosLookup[stack][layer][binZ]*10;
return fgkZposLookupTable[stack][layer][binZ]*10;
}

Int_t AliTRDgtuParam::GetTanOfTiltingAngle(Int_t layer)
Expand Down
10 changes: 7 additions & 3 deletions TRD/TRDbase/AliTRDgtuParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class AliTRDgtuParam : public TObject {
Int_t GetDeltaY() const { return fgDeltaY; }
Int_t GetDeltaAlpha() const { return fgDeltaAlpha; }
//conversion rejection stuff
static Int_t GetPtCut() { return ( (Int_t) fgPtCut * fgShiftLengthNorm); }
static Int_t GetInvPtDevCut() { return (Int_t) (fgInvPtDevCut * fgShiftLengthNorm); }
static Int_t GetShiftLengthNorm() { return fgShiftLengthNorm; }
static Int_t GetCorrectionMode() { return fgCorrectionMode; }
static Bool_t GetWriteSagittaOutputToTrackWordBC() { return fgWriteSagittaOutputToTrackWordBC; }
static Int_t GetLayerInvXpos(Int_t layer) { return fgLayerInvXpos[layer]*1e6; }
static Int_t GetLayerXpos(Int_t layer) { return fgLayerXpos[layer]*10; }
Int_t GetZpos(Int_t stack, Int_t layer, Int_t binZ);
Expand All @@ -83,9 +84,10 @@ class AliTRDgtuParam : public TObject {
static void SetDeltaY(Int_t dy) { fgDeltaY = dy; }
static void SetDeltaAlpha(Int_t da) { fgDeltaAlpha = da; }

static void SetPtCut(Float_t dPt) {fgPtCut = dPt; }
static void SetInvPtDevCut(Float_t dInvPt) {fgInvPtDevCut = dInvPt; }
static void SetShiftLengthNorm(Int_t shiftLengthNorm) {fgShiftLengthNorm = shiftLengthNorm; }
static void SetCorrectionMode(Int_t corrMode) {fgCorrectionMode = corrMode; }
static void SetWriteSagittaOutputToTrackWordBC(Bool_t writeSagittaOutputToTrackWordBC) { fgWriteSagittaOutputToTrackWordBC = writeSagittaOutputToTrackWordBC; }

static void SetUseGTUconst(Bool_t b) { fgUseGTUconst = b; }
static Bool_t GetUseGTUconst() { return fgUseGTUconst; }
Expand Down Expand Up @@ -139,9 +141,10 @@ class AliTRDgtuParam : public TObject {
static Int_t fgDeltaY; // accepted deviation in y_proj, default: 9
static Int_t fgDeltaAlpha; // accepted deviation in alpha, default: 11

static Float_t fgPtCut; // max deviation from straight line fit 1/pt to sagitta 1/pt
static Float_t fgInvPtDevCut; // max deviation from straight line fit 1/pt to sagitta 1/pt
static Int_t fgShiftLengthNorm; // shift normalization factor for integer calculation
static Int_t fgCorrectionMode; // choose between optimizations for sagitta method
static Bool_t fgWriteSagittaOutputToTrackWordBC; // write result of sagitta calculation in gtu simulation to track parameters b and c
static Float_t fgLayerInvXpos[6]; // inverse of x position for tracklets in different layers
static Float_t fgLayerXpos[6]; // x position for tracklets in different layers

Expand All @@ -159,6 +162,7 @@ class AliTRDgtuParam : public TObject {
static const Float_t fgkInnerPadLength[6]; // geometry constant from GTU implementation
static const Float_t fgkOuterPadLength[6]; // geometry constant from GTU implementation
static const Float_t fgkAcoeff[32][6]; // geometry constant from GTU implementation
static const Float_t fgkZposLookupTable[5][6][16]; //chamber z position used for sagitta calculation
static const Int_t fgkMaskID[64]; // geometry constant from GTU implementation

Float_t fVertexSize; // assumed vertex size (z-dir.) for the z-channel map
Expand Down
11 changes: 9 additions & 2 deletions TRD/TRDbase/AliTRDgtuTMU.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track)
trklYpos[layer] = trk->GetYbin() - ((Int_t) (1./fGtuParam->GetBinWidthY()*fGtuParam->CorrectYforAlignmentOCDB(trk->GetDetector(),
fGtuParam->GetZpos(fGtuParam->GetGeo()->GetStack(trk->GetDetector()), layer, trk->GetZbin())))); //ocdb alignment correction
padTiltingCorrection = zDiff * fGtuParam->GetTanOfTiltingAngle(layer);
padTiltingCorrection *= 6.52e-7; // *=1e-8 to account for previous shifts and /=160e-4 for the bin width of yPos
padTiltingCorrection *= 6.25e-7; // *=1e-8 to account for previous shifts and /=160e-4 for the bin width of yPos
if ( (corrMode == 2) || (corrMode == 3) ) trklYpos[layer] = trklYpos[layer] + padTiltingCorrection;


Expand All @@ -1211,7 +1211,14 @@ Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track)

invPtDev = a * fGtuParam->Getc1Inv(track->GetTrackletMask()) - s;

track->SetFitParams(a << 2, TMath::Nint(128. * b), TMath::Nint(256. * c));
if (!fGtuParam->GetWriteSagittaOutputToTrackWordBC())
track->SetFitParams(a << 2, TMath::Nint(128. * b), TMath::Nint(256. * c));
else {
c = ((invPtDev & 0xfff) ^ 0x800) - 0x800;
b = (invPtDev >> 12) & 0xfff;
if (TMath::Abs(invPtDev) < fGtuParam->GetInvPtDevCut()) b += 1 << 12;
track->SetFitParams(a << 2, b, c);
}
if (corrMode == 0) track->SetInvPtDev(invPtDev);
else if (corrMode != 0) track->SetInvPtDev( a * fGtuParam->Getc1Inv(track->GetTrackletMask()) - ((Int_t) sTmp) );
//following lines are for debugging purposes only
Expand Down
2 changes: 1 addition & 1 deletion TRD/TRDbase/AliTRDtrackGTU.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ AliESDTrdTrack* AliTRDtrackGTU::CreateTrdTrack() const
trk->SetSector(fSector);
trk->SetLabel(fLabel);

if ( TMath::Abs(fInvPtDev) > AliTRDgtuParam::GetPtCut() )
if ( TMath::Abs(fInvPtDev) > AliTRDgtuParam::GetInvPtDevCut() )
trk->SetFlags(1 << 5);

for (Int_t iLayer = 0; iLayer < AliTRDgtuParam::GetNLayers(); iLayer++) {
Expand Down

0 comments on commit c1bb50e

Please sign in to comment.