1 // draw the 1st sensor of every ladder of requested layers (axis directions - thin arrows)
2 // and the tracking frame of each sensor (axis directions - thick arrows)
4 void drawLr(int layMin=1,int layMax=1)
7 gSystem->Load("libITSUpgradeBase.so");
8 gSystem->Load("libITSUpgradeSim.so");
9 gSystem->Load("libITSUpgradeRec.so");
11 AliGeomManager::LoadGeometry("geometry.root");
14 // Apply misaligment ... ;-)
15 const char *ocdb="local://$ALICE_ROOT/OCDB";
16 AliCDBManager::Instance()->SetDefaultStorage(ocdb);
18 AliCDBManager::Instance()->SetRun(run);
19 AliCDBManager::Instance()->SetSpecificStorage("ITS/Align/Data", Form("local://%s",gSystem->pwd()));
20 AliCDBEntry *entry = AliCDBManager::Instance()->Get("ITS/Align/Data");
21 TClonesArray *array = (TClonesArray*)entry->GetObject();
22 AliGeomManager::ApplyAlignObjsToGeom(*array);
23 gGeoManager->LockGeometry();
25 AliITSUGeomTGeo* gm = new AliITSUGeomTGeo(kTRUE,kTRUE);
26 TObjArray* segmArr = gm->GetSegmentations();
28 int nlr = gm->GetNLayers();
29 if (layMin<0) layMin = 0;
30 if (layMax<0) layMax = nlr-1;
31 else if (layMax>=nlr) layMax = nlr-1;
33 TH2* hh = new TH2F("hh","hh",100,-70,70,100,-70,70);
35 gStyle->SetOptStat(0);
38 TGeoHMatrix *msens=0, *mttr=0;
39 double loc[3]={0,0,0},gloC[3],glo[3],glo1[3],glo2[3],trk[3];
43 for (Int_t lay=layMin;lay<=layMax;lay++) {
45 AliITSUSegmentationPix* segm = (AliITSUSegmentationPix*)segmArr->At(gm->GetLayerDetTypeID(lay));
46 for (int ild=0;ild<gm->GetNLadders(lay);ild++) {
49 printf("Layer %d Ladder %d\n",lay,ild);
50 msens = gm->GetMatrixSens(lay,ild,mod);
51 printf("Sensor Matrix: ");
53 mttr = gm->GetMatrixT2L(lay,ild,mod);
54 printf("T2L Matrix: ");
57 loc[0]=loc[1]=loc[2] = 0;
58 msens->LocalToMaster(loc,gloC);
59 mttr->MasterToLocal(loc,trk);
60 printf("SensorCenter in Lab: ");
61 for (int i=0;i<3;i++) printf("%+9.4f ",gloC[i]); printf("\n");
62 printf("SensorCenter in TRK: ");
63 for (int i=0;i<3;i++) printf("%+9.4f ",trk[i]); printf("\n");
65 double r = TMath::Sqrt(gloC[0]*gloC[0]+gloC[1]*gloC[1]);
69 msens->LocalToMaster(loc,glo);
70 loc[0]= segm->Dx()/2;;
71 msens->LocalToMaster(loc,glo1);
72 TArrow* linS = new TArrow(glo[0],glo[1],glo1[0],glo1[1],0.012); // sensor with pos local X direction
73 linS->SetLineColor((ild+1)%4+1); linS->Draw();
77 msens->LocalToMaster(loc,glo2);
80 linS = new TArrow(gloC[0],gloC[1],glo2[0],glo2[1],0.012); // pos local Y axis
81 linS->SetLineColor((ild+1)%4+1); linS->Draw();
83 TMarker* mrk = new TMarker(gloC[0],gloC[1],31);
84 mrk->SetMarkerColor((ild+1)%4+1);
87 TLatex *latx = new TLatex( gloC[0]*1.2,gloC[1]*1.2,Form("%d",ild));
88 latx->SetTextColor((ild+1)%4+1);
89 latx->SetTextSize(0.02);
92 // Check Tracking to Local Matrix -------
94 // Draw sensors tracking frame
96 mttr->LocalToMaster(trk,loc);
97 msens->LocalToMaster(loc,glo1);
98 TMarker* mrk = new TMarker(glo1[0],glo1[1],24);
99 mrk->SetMarkerColor((ild+1)%4+1);
102 // normal to sensor plane
103 TLine* linN = new TLine(0,0,glo1[0],glo1[1]);
104 linN->SetLineWidth(1);
105 linN->SetLineStyle(2);
106 linN->SetLineColor((ild+1)%4+1);
109 // connect tracking and local frame
110 TLine* linNP = new TLine(gloC[0],gloC[1],glo1[0],glo1[1]);
111 linNP->SetLineWidth(1);
112 linNP->SetLineStyle(2);
113 linNP->SetLineColor((ild+1)%4+1);
116 // direction of X axis of the tracking plane
118 mttr->LocalToMaster(trk,loc);
119 msens->LocalToMaster(loc,glo);
120 TArrow* linX = new TArrow(glo1[0],glo1[1],glo[0],glo[1],0.012);
121 linX->SetLineWidth(2);
122 linX->SetLineStyle(1);
123 linX->SetLineColor((ild+1)%4+1);
127 // direction of tracking Y axis
128 double dx = glo[0]-glo1[0];
129 double dy = glo[1]-glo1[1];
130 double dst = TMath::Sqrt(dx*dx+dy*dy);
132 mttr->LocalToMaster(trk,loc);
133 msens->LocalToMaster(loc,glo);
135 mttr->LocalToMaster(trk,loc);
136 msens->LocalToMaster(loc,glo1);
138 TArrow* linT = new TArrow(glo[0],glo[1],glo1[0],glo1[1],0.012); // normal to sensor plane, pox Y of tracking frame
139 linT->SetLineWidth(2);
140 linT->SetLineStyle(1);
141 linT->SetLineColor((ild+1)%4+1);
144 printf("Layer %d Ladder %d\n",lay,ild);
150 hh->GetXaxis()->SetRangeUser(-rmax,rmax);
151 hh->GetYaxis()->SetRangeUser(-rmax,rmax);