27 #include "AliExternalTrackParam.h"
28 #include "AliTrackReference.h"
29 #include "AliTracker.h"
30 #include "AliTrackPointArray.h"
31 #include "THnSparse.h"
32 #include "TParticle.h"
34 #include "TParticlePDG.h"
35 #include "TParticle.h"
36 #include "TTreeStream.h"
39 #include "TTreeStream.h"
72 for (
Int_t i=0;i<6; i++) fResolHisto[i]=0;
112 , fLowBinDY(comp.fLowBinDY)
113 , fUpBinDY(comp.fUpBinDY)
114 , fLowBinDZ(comp.fLowBinDZ)
115 , fUpBinDZ(comp.fUpBinDZ)
116 , fLowBinDSnp(comp.fLowBinDSnp)
117 , fUpBinDSnp(comp.fUpBinDSnp)
118 , fLowBinDTheta(comp.fLowBinDTheta)
119 , fUpBinDTheta(comp.fUpBinDTheta)
120 , fLowBin1Pt(comp.fLowBin1Pt)
121 , fUpBin1Pt(comp.fUpBin1Pt)
122 , fLowBin1PtLoss(comp.fLowBin1PtLoss)
123 , fUpBin1PtLoss(comp.fUpBin1PtLoss)
124 , fNBinsDY(comp.fNBinsDY)
125 , fNBinsDZ(comp.fNBinsDZ)
126 , fNBinsDSnp(comp.fNBinsDSnp)
127 , fNBinsDTheta(comp.fNBinsDTheta)
128 , fNBins1Pt(comp.fNBins1Pt)
129 , fNBins1PtLoss(comp.fNBins1PtLoss)
130 , fLayerID(comp.fLayerID)
131 , fFillAll(comp.fFillAll)
132 , fNCombineBin(comp.fNCombineBin)
148 TNamed::operator=(comp);
183 AliExternalTrackParam *param0 = 0;
184 AliExternalTrackParam *param1 = 0;
189 if (!param0 || !param1)
return 0;
191 Double_t tr1Pt = param0->GetSigned1Pt();
205 Double_t tr1Pt=param0->GetSigned1Pt();
221 Double_t gPos[3]= {point1->GetX(),point1->GetY(),point1->GetZ()};
224 for(
Int_t i=0; i<3; i++)
225 pos[i] = gPos[i]-vxyz[i];
226 Double_t R = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);
227 for(
Int_t i=0; i<3; i++) pxyz[i]= energy*pos[i]/R;
230 for (
Int_t i=0; i<21;i++) cv[i]=0;
231 AliExternalTrackParam * param1 =
new AliExternalTrackParam(gPos,pxyz,cv,param0->Charge());
233 if(!param1)
return 0;
234 Double_t tr1Pt = param0->GetSigned1Pt();
248 param0->Rotate(param1->GetAlpha());
249 AliTracker::PropagateTrackToBxByBz(param0, radius+
fStep, mass,
fStep, kFALSE,0.99,-1);
250 Bool_t isOK = param0->PropagateTo(radius,AliTracker::GetBz());
260 Double_t xyz[3]={ref->X(),ref->Y(),ref->Z()};
261 Double_t pxyz[3]={ref->Px(),ref->Py(),ref->Pz()};
263 for (
Int_t i=0; i<21;i++) cv[i]=0;
264 AliExternalTrackParam * param =
new AliExternalTrackParam(xyz,pxyz,cv,charge);
273 TIterator* iter = li->MakeIterator();
277 if (!comp->InheritsFrom(AliTrackComparison::Class())) {
280 if (strName.CompareTo(comp->GetName())!=0)
return -1;
292 for (
Int_t i=0;i<6;i++){
297 if (h0&&h1) h0->Add(h1);
308 Double_t xminTrack[5], xmaxTrack[5];
312 TString hisNames[6]={
"DeltaY",
"DeltaZ",
"DeltaSnp",
"DeltaTheta",
"Delta1Pt",
"1PtLoss"};
317 axisName[0] =
"#Delta";
318 axisTitle[0] =
"#Delta";
321 xminTrack[1] =-1.0; xmaxTrack[1]=1.0;
322 axisName[1] =
"tanTheta";
323 axisTitle[1] =
"tan(#Theta)";
326 xminTrack[2] =-TMath::Pi(); xmaxTrack[2]=TMath::Pi();
328 axisTitle[2] =
"#phi";
331 xminTrack[3] =-3.; xmaxTrack[3]=3.;
333 axisTitle[3] =
"1/pt";
336 xminTrack[4] =0; xmaxTrack[4]=22;
337 axisName[4] =
"LayerID";
338 axisTitle[4] =
"LayerID";
340 for (
Int_t ihis=0; ihis<6; ihis++){
343 binsTrack[0]=nBins[ihis];
344 xminTrack[0]=lowBins[ihis];
345 xmaxTrack[0]=upBins[ihis];
346 fResolHisto[ihis] =
new THnSparseF(hisNames[ihis],hisNames[ihis], 5, binsTrack,xminTrack, xmaxTrack);
347 for (
Int_t ivar=0;ivar<5;ivar++){
360 Double_t dY = param1->GetY()-param0->GetY();
361 Double_t dZ = param1->GetZ()-param0->GetZ();
362 Double_t dSnp = param1->GetSnp()-param0->GetSnp();
363 Double_t dTheta = param1->Theta()-param0->Theta();
364 Double_t d1Pt = param1->GetSigned1Pt()-param0->GetSigned1Pt();
365 Double_t d1PtLoss = param0->GetSigned1Pt()-tr1Pt;
368 param1->GetXYZ(globalPos);
372 Double_t residual[6] = {dY,dZ,dSnp,dTheta,d1Pt,d1PtLoss};
374 for(
Int_t j=0; j<6; j++)
376 if(!
fFillAll && j<4 && j>1)
continue;
377 argu[j][0] = residual[j];
378 argu[j][1] = param1->GetTgl();
379 argu[j][2] = TMath::ATan2(globalPos[1],globalPos[0]);
380 argu[j][3] = param1->GetSigned1Pt();
406 TString hname = Form(
"%s_%d",GetName(),type);
411 dsName+=Form(
"Debug_%d.root",type);
412 printf(
" Create debug streamer \n");
413 dsName.ReplaceAll(
" ",
"");
414 TTreeSRedirector *pcstream =
new TTreeSRedirector(dsName.Data());
417 const Int_t kMinEntries=10;
419 Int_t idim[4]={0,1,2,3};
423 Int_t nbins3=his0->GetAxis(3)->GetNbins();
424 Int_t first3=his0->GetAxis(3)->GetFirst();
425 Int_t last3 =his0->GetAxis(3)->GetLast();
427 for (
Int_t ibin3=first3; ibin3<last3; ibin3+=1){
429 Double_t x3= his0->GetAxis(3)->GetBinCenter(ibin3);
430 THnSparse * his3= his0->Projection(3,idim);
432 Int_t nbins2 = his3->GetAxis(2)->GetNbins();
433 Int_t first2 = his3->GetAxis(2)->GetFirst();
434 Int_t last2 = his3->GetAxis(2)->GetLast();
436 for (
Int_t ibin2=first2; ibin2<last2; ibin2+=1){
438 Double_t x2= his3->GetAxis(2)->GetBinCenter(ibin2);
439 THnSparse * his2= his3->Projection(2,idim);
440 Int_t nbins1 = his2->GetAxis(1)->GetNbins();
441 Int_t first1 = his2->GetAxis(1)->GetFirst();
442 Int_t last1 = his2->GetAxis(1)->GetLast();
443 for (
Int_t ibin1=first1; ibin1<last1; ibin1++){
445 Double_t x1= his2->GetAxis(1)->GetBinCenter(ibin1);
446 Double_t binWidth= his2->GetAxis(1)->GetBinWidth(ibin1);
450 if (x1<0) his2->GetAxis(1)->SetRange(TMath::Max(ibin1-
fNCombineBin,1),TMath::Min(ibin1,nbins1));
451 if (x1>0) his2->GetAxis(1)->SetRange(TMath::Max(ibin1,1),TMath::Min(ibin1+
fNCombineBin,nbins1));
453 TH1 * hisDelta = his2->Projection(0);
455 Double_t entries = hisDelta->GetEntries();
457 if (entries>kMinEntries){
458 mean = hisDelta->GetMean();
459 rms = hisDelta->GetRMS();
461 Double_t sector = 9.*x2/TMath::Pi();
462 if (sector<0) sector+=18;
466 Double_t prob[5]={0, 0.25,0.5,0.75,1};
467 if (entries>kMinEntries){
468 hisDelta->GetQuantiles(5,quantiles,prob);
469 if(x3>0)hisDelta->GetXaxis()->SetRangeUser(quantiles[0], quantiles[3]);
470 else hisDelta->GetXaxis()->SetRangeUser(quantiles[1], quantiles[4]);
471 rms75=hisDelta->GetRMS();
472 mean75=hisDelta->GetMean();
477 (*pcstream)<<
"distortion"<<
485 "entries="<<entries<<
488 "q25="<<quantiles[1]<<
489 "q50="<<quantiles[2]<<
490 "q75="<<quantiles[3]<<
508 printf(
" Finished! Close debug streamer \n");
THnSparse * GetHnSparse(Int_t index)
virtual Long64_t Merge(TCollection *const li)
Int_t AddTracks(AliExternalTrackParam *param0, AliExternalTrackParam *param1, Double_t mass)
virtual ~AliTrackComparison()
AliTrackComparison & operator=(const AliTrackComparison &comp)
AliExternalTrackParam * MakeTrack(const AliTrackReference *ref, Int_t charge)
Bool_t PropagateToPoint(AliExternalTrackParam *param0, AliExternalTrackParam *param1, Double_t mass)
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void FillHistos(AliExternalTrackParam *param0, AliExternalTrackParam *param1, Double_t tr1Pt)
void MakeDistortionMap(Double_t refX, Int_t type)
virtual void Add(AliTrackComparison *const comp)
THnSparse * fResolHisto[6]