+Int_t AliTRDtrapConfigHandler::LoadConfig()
+{
+ // load a default configuration which is suitable for simulation
+ // for a detailed description of the registers see the TRAP manual
+ // if you want to resimulate tracklets on real data use the appropriate config instead
+
+ AliTRDtrapConfig *cfg = AliTRDtrapConfig::Instance();
+
+ // HC header configuration bits
+ cfg->SetTrapReg(AliTRDtrapConfig::kC15CPUA, 0x2102); // zs, deh
+
+ // no. of timebins
+ cfg->SetTrapReg(AliTRDtrapConfig::kC13CPUA, 24);
+
+ // pedestal filter
+ cfg->SetTrapReg(AliTRDtrapConfig::kFPNP, 4*10);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFPTC, 0);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFPBY, 0); // bypassed!
+
+ // gain filter
+ for (Int_t adc = 0; adc < 20; adc++) {
+ cfg->SetTrapReg(AliTRDtrapConfig::TrapReg_t(AliTRDtrapConfig::kFGA0+adc), 40);
+ cfg->SetTrapReg(AliTRDtrapConfig::TrapReg_t(AliTRDtrapConfig::kFGF0+adc), 15);
+ }
+ cfg->SetTrapReg(AliTRDtrapConfig::kFGTA, 20);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFGTB, 2060);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFGBY, 0); // bypassed!
+
+ // tail cancellation
+ cfg->SetTrapReg(AliTRDtrapConfig::kFTAL, 200);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFTLL, 0);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFTLS, 200);
+ cfg->SetTrapReg(AliTRDtrapConfig::kFTBY, 0);
+
+ // tracklet calculation
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPQS0, 5);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPQE0, 10);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPQS1, 11);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPQE1, 20);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPFS, 5);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPFE, 20);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPVBY, 0);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPVT, 10);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPHT, 150);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPFP, 40);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPCL, 1);
+ cfg->SetTrapReg(AliTRDtrapConfig::kTPCT, 10);
+
+ // ndrift (+ 5 binary digits)
+ ltuParam.SetNtimebins(20 << 5);
+ ConfigureNTimebins();
+
+ // deflection + tilt correction
+ ltuParam.SetRawOmegaTau(0.16133);
+ ConfigureDyCorr();
+
+ // deflection range table
+ ltuParam.SetRawPtMin(0.1);
+ ConfigureDRange();
+
+ // hit position LUT
+ // reset values
+ const UShort_t lutPos[128] = {
+ 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15,
+ 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26,
+ 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 26,
+ 26, 26, 26, 25, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 18, 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 7};
+ for (Int_t iCOG = 0; iCOG < 128; iCOG++)
+ cfg->SetTrapReg((AliTRDtrapConfig::TrapReg_t) (AliTRDtrapConfig::kTPL00 + iCOG), lutPos[iCOG]);
+
+ // now calculate it from PRF
+ AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
+
+ Double_t padResponse[3]; // pad response left, central, right
+ Double_t padResponseR[3]; // pad response left, central, right
+ Double_t padResponseL[3]; // pad response left, central, right
+
+ for (Int_t iBin = 0; iBin < 128; iBin++)
+ cfg->SetTrapReg((AliTRDtrapConfig::TrapReg_t) (AliTRDtrapConfig::kTPL00 + iBin), 0, 0, 0, 0);
+
+ for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
+ TGraph gr(128);
+ for (Int_t iBin = 0; iBin < 256*0.5; iBin++) {
+ cal->PadResponse(1., iBin*1./256., iLayer, padResponse);
+ cal->PadResponse(1., iBin*1./256.-1., iLayer, padResponseR);
+ cal->PadResponse(1., iBin*1./256.+1., iLayer, padResponseL);
+ gr.SetPoint(iBin, (0.5 * (padResponseR[1] - padResponseL[1])/padResponse[1] * 256), iBin);
+ }
+ for (Int_t iBin = 0; iBin < 128; iBin++) {
+ Int_t corr = gr.Eval(iBin) - iBin;
+ if (corr < 0)
+ corr = 0;
+ else if (corr > 31)
+ corr = 31;
+ for (Int_t iStack = 0; iStack < 540/6; iStack++) {
+ cfg->SetTrapReg((AliTRDtrapConfig::TrapReg_t) (AliTRDtrapConfig::kTPL00 + iBin), corr, 6*iStack + iLayer);
+ }
+ }
+ }
+
+ // event buffer
+ cfg->SetTrapReg(AliTRDtrapConfig::kEBSF, 1); // 0: store filtered; 1: store unfiltered
+
+ // zs applied to data stored in event buffer (sel. by EBSF)
+ cfg->SetTrapReg(AliTRDtrapConfig::kEBIS, 15 << 2); // single indicator threshold (plus two digits)
+ cfg->SetTrapReg(AliTRDtrapConfig::kEBIT, 30 << 2); // sum indicator threshold (plus two digits)
+ cfg->SetTrapReg(AliTRDtrapConfig::kEBIL, 0xf0); // lookup table
+ cfg->SetTrapReg(AliTRDtrapConfig::kEBIN, 0); // neighbour sensitivity
+
+ // raw data
+ cfg->SetTrapReg(AliTRDtrapConfig::kNES, (0x0000 << 16) | 0x1000);
+
+ return 0;
+}
+