Adding distrotion map visualization
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 30 Apr 2010 10:48:49 +0000 (10:48 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 30 Apr 2010 10:48:49 +0000 (10:48 +0000)
Marian

TPC/CalibMacros/AliTPCCorrectionDemo.C

index 6374e80..e48b8e4 100644 (file)
@@ -59,3 +59,110 @@ void AliTPCCorrectionDemo() {
   c->cd(3);exb.CreateHistoDRPhiinZR(1.)->Draw("surf2");
   c->cd(4);cc.CreateHistoDRPhiinZR(1.)->Draw("surf2");
 }
+
+
+
+void MakeDistortionMap(){
+  //
+  // make distortiona map example for specific transformation 
+  //
+  Int_t run=0;
+  TTreeSRedirector *pcstream =  new TTreeSRedirector("distort.root");
+  Double_t vdrift = 2.6; // [cm/us]   // to be updated: per second (ideally)
+  Double_t bzField = -0.5; // [Tesla] // to be updated: per run
+  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
+
+  // Correction Terms for effective omegaTau; obtained by a laser calibration run
+  Double_t T1 = 0.9;
+  Double_t T2 = 1.5;
+  AliMagF* magF= new AliMagF("Maps","Maps", bzField/0.5, 1.);
+  TGeoGlobalMagField::Instance()->SetField(magF);
+
+  AliCDBManager::Instance()->SetDefaultStorage("local:////$ALICE_ROOT/OCDB");
+  AliCDBManager::Instance()->SetRun(run);
+  AliGeomManager::LoadGeometry();
+  AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC");
+
+
+  AliTPCExBTwist twist;
+  twist.SetName("twistX001");
+  twist.SetXTwist(0.001);
+  
+  AliTPCGGVoltError GGerror;
+  GGerror.SetDeltaVGGA(50.);
+  GGerror.SetDeltaVGGC(50.);
+  GGerror.InitGGVoltErrorDistortion();
+  GGerror.SetName("ggoffsetA50C50");
+  AliTPCExBBShape exb;
+  exb.SetBField(magF);
+  exb.SetName("ExB");
+  TObjArray cs;
+  cs.Add(&twist);
+  cs.Add(&GGerror);
+  cs.Add(&exb);
+  
+  AliTPCComposedCorrection *cc = new AliTPCComposedCorrection;
+  cc->SetCorrections(&cs);
+  cc->SetOmegaTauT1T2(wt,T1,T2);
+  //cc->SetMode(1);
+  cc->SetName("composed");
+  Double_t par[5]={0,0,0,0,0};
+  Double_t cov[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+  for (Double_t theta=-1.; theta<1; theta+=0.1){
+    for (Double_t alpha=-3.14; alpha<3.14; alpha+=0.2){
+      par[0]=0;
+      par[1]=theta*85;
+      par[2]=0;
+      par[3]=theta;
+      par[4]=(gRandom->Rndm()-0.5);
+      AliExternalTrackParam trackIn(85,alpha,par,cov);
+      //FitDistortedTrack(&trackIn, cc, 85, -1,pcstream);
+      twist.FitDistortedTrack(&trackIn, 85, -1,pcstream);
+      GGerror.FitDistortedTrack(&trackIn, 85, -1,pcstream);
+      exb.FitDistortedTrack(&trackIn, 85, -1,pcstream);
+      cc->FitDistortedTrack(&trackIn, 85, -1,pcstream);      
+    }
+  }
+  delete pcstream;
+}
+
+void DrawDistortionMap(){
+  //
+  // Example -drawing of distortion maps
+  //
+  TFile f("distort.root");
+  TTree *   fitDistorttwistX001= (TTree*)f.Get("fitDistorttwistX001");
+  TTree *   fitDistortggoffsetA50C50=(TTree*)f.Get("fitDistortggoffsetA50C50");
+  TTree *   fitDistortExB=(TTree*)f.Get("fitDistortExB");
+  TTree *   fitDistortcomposed=(TTree*)f.Get("fitDistortcomposed");
+  fitDistortExB->SetMarkerColor(1);
+  fitDistorttwistX001->SetMarkerColor(2);
+  fitDistortggoffsetA50C50->SetMarkerColor(4);
+  fitDistortExB->SetMarkerStyle(20);
+  fitDistorttwistX001->SetMarkerStyle(21);
+  fitDistortggoffsetA50C50->SetMarkerStyle(22);
+  //
+  // example draw delta local y/r-phi as function of fi
+  Int_t entries=0;
+
+  entries = fitDistortExB->Draw("track1.fP[0]-track0.fP[0]:track0.fAlpha","","");
+  TGraph * grY0= new TGraph(entries, fitDistortExB->GetV2(),fitDistortExB->GetV1());
+  entries = fitDistortggoffsetA50C50->Draw("track1.fP[0]-track0.fP[0]:track0.fAlpha","","");
+  TGraph * grY1= new TGraph(entries, fitDistortggoffsetA50C50->GetV2(),fitDistortggoffsetA50C50->GetV1());
+  entries = fitDistorttwistX001->Draw("track1.fP[0]-track0.fP[0]:track0.fAlpha","","");
+  TGraph * grY2= new TGraph(entries, fitDistorttwistX001->GetV2(),fitDistorttwistX001->GetV1());
+  entries = fitDistortcomposed->Draw("track1.fP[0]-track0.fP[0]:track0.fAlpha","","");
+  TGraph * grY3= new TGraph(entries, fitDistortcomposed->GetV2(),fitDistortcomposed->GetV1());
+  grY0->SetMinimum(-0.4);
+  grY0->SetMaximum(0.4);
+  grY0->SetMarkerStyle(20), grY0->SetMarkerColor(1);
+  grY1->SetMarkerStyle(21), grY1->SetMarkerColor(2);
+  grY2->SetMarkerStyle(22), grY2->SetMarkerColor(4);
+  grY3->SetMarkerStyle(24), grY3->SetMarkerColor(5); 
+  grY0->Draw("ap");
+  grY1->Draw("p");
+  grY2->Draw("p");
+  grY3->Draw("p");
+}
+