Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
326 f9daq 1
#include <stdio.h>
2
#include <stdlib.h>
3
 
4
#include <TROOT.h>
5
#include <TH1D.h>
6
#include <TH2D.h>
7
#include <TH3D.h>
8
#include <TCanvas.h>
9
#include <TStyle.h>
10
#include <TSystem.h>
11
#include <TFile.h>
12
#include <TDirectory.h>
13
#include <TPaveText.h>
14
 
15
#include "base.h"
16
#include "map.h"
17
 
18
int mapped(){
19
  char pdfname[256];
20
 
21
  GRID m = mapping();
22
 
23
  TCanvas * c = new TCanvas("Koordinatni sistemi","Koordinatni sistemi",500,500);
24
  c->Divide(2,2);
25
 
26
  gStyle->SetOptStat(0);
27
 
28
  TH2D *mapBack = new TH2D("mapBack", "Mapping - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
29
  TH2D *posBack = new TH2D("posBack", "Scan Position - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
30
  TH2D *posChipBack = new TH2D("posChipBack", "Position on chip - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
31
  TH2D *kvadratki = new TH2D("kvadratki", "", 12, -0.5, 11.5, 12, -0.5, 11.5);
32
 
33
  for (int x=0;x<12;x++){
34
    for (int y=0;y<12;y++){
35
      mapBack->Fill(x,y,m.koordinatniSistem[x][y]);
36
      posBack->Fill(x,y,m.pozicijaPixla[m.koordinatniSistem[x][y]]);
37
      posChipBack->Fill(x,y,m.pozicijaPixlaNaCipu[m.koordinatniSistem[x][y]]);
38
      kvadratki->Fill(x,y,144);
39
    }
40
  }
41
 
42
  c->cd(1);
43
 
44
    mapBack->GetYaxis()->SetTickLength(0.01);
45
    mapBack->GetYaxis()->SetLabelOffset(0.03);
46
 
47
    mapBack->GetXaxis()->SetTickLength(0.01);
48
    mapBack->GetXaxis()->SetLabelOffset(0.03);
49
 
50
 
51
    mapBack->DrawCopy("TEXT");
52
    kvadratki->DrawCopy("BOX,SAME");
53
 
54
 
55
  c->cd(3);
56
    posBack->GetYaxis()->SetTickLength(0.01);
57
    posBack->GetYaxis()->SetLabelOffset(0.03);
58
 
59
    posBack->GetXaxis()->SetTickLength(0.01);
60
    posBack->GetXaxis()->SetLabelOffset(0.03);
61
 
62
    posBack->DrawCopy("TEXT");
63
    kvadratki->DrawCopy("BOX,SAME");
64
 
65
  c->cd(4);
66
 
67
    posChipBack->GetYaxis()->SetTickLength(0.01);
68
    posChipBack->GetYaxis()->SetLabelOffset(0.03);
69
 
70
    posChipBack->GetXaxis()->SetTickLength(0.01);
71
    posChipBack->GetXaxis()->SetLabelOffset(0.03);
72
 
73
    posChipBack->DrawCopy("TEXT");
74
    kvadratki->DrawCopy("BOX,SAME");
75
 
76
 
77
  sprintf(pdfname,"map.pdf");
78
  c->SaveAs(pdfname,"pdf");
79
 
80
  return 0;
81
}
82
/*
83
int newFile(){
84
  GRID m = mapping();
85
  FILE *f = fopen("map.txt", "w");
86
  if (f == NULL)
87
  {
88
      printf("Error opening file!\n");
89
      exit(1);
90
  }
91
  for (int x=0;x<12;x++){
92
    for (int y=0;y<12;y++){
93
      fprintf(f, "%d\t%d\t%d\t%d\t%d\n", m.koordinatniSistemCHIP[y][x], m.koordinatniSistemPIXEL[y][x], x, 11-y,(11-x)+y*12);
94
    }
95
  }
96
 
97
  fclose(f);
98
  return 0;
99
}
100
 
101
GRID mapping2(){
102
  int f[6];
103
  int ndim = 400;
104
  char line[400];
105
  GRID m;
106
  FILE * fp = fopen("mapNEW.map","r");
107
 
108
  while (fgets(line,ndim,fp) != NULL) {
109
    sscanf(line,"%d%d%d%d%d%d",&f[0],&f[1],&f[2],&f[3],&f[4],&f[5]);
110
    //m.koordinatniSistem[f[2]][f[3]] = f[0]*36+f[1];
111
    m.koordinatniSistemCHIP[11-f[2]][11-f[3]] = f[0];
112
    m.koordinatniSistemPIXEL[11-f[2]][11-f[3]] = f[1];
113
    m.koordinatniSistem[11-f[2]][11-f[3]] = f[0]*36+f[1];
114
    m.pozicijaPixla[f[0]*36+f[1]] = f[4];
115
    m.pozicijaPixlaNaCipu[f[0]*36+f[1]] = f[5];
116
  }
117
  fclose(fp);
118
 
119
  TCanvas * c = new TCanvas("Koordinatni sistemi","Koordinatni sistemi",1000,1000);
120
  c->Divide(2,2);
121
 
122
  //gStyle->SetOptStat(0);
123
  TH2D *mapBack = new TH2D("mapBack", "Mapping - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
124
  TH2D *zaporedje = new TH2D("zaporedje", "zaporedje meritve - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
125
  TH2D *chips = new TH2D("chips", "chips - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
126
  TH2D *pixelonchp = new TH2D("pixelonchp", "pixelonchp - from back side", 12, -0.5, 11.5, 12, -0.5, 11.5);
127
  TH2D *kvadratki = new TH2D("kvadratki", "", 12, -0.5, 11.5, 12, -0.5, 11.5);
128
 
129
 
130
  for (int x=0;x<12;x++){
131
    for (int y=0;y<12;y++){
132
      mapBack->Fill(x,y,m.koordinatniSistem[x][y]);
133
      zaporedje->Fill(x,y,m.pozicijaPixla[m.koordinatniSistem[x][y]]);
134
      chips->Fill(x,y,m.pozicijaPixlaNaCipu[m.koordinatniSistem[x][y]]);
135
      pixelonchp->Fill(x,y,m.koordinatniSistemPIXEL[x][y]);
136
      //mapBackNew->Fill(x,y,m.koordinatniSistem[y][11-x]);
137
      //posBack->Fill(x,y,m.pozicijaPixla[m.koordinatniSistem[x][y]]);
138
      //posChipBack->Fill(x,y,m.pozicijaPixlaNaCipu[m.koordinatniSistem[x][y]]);
139
      kvadratki->Fill(x,y,144);
140
    }
141
  }
142
  c->cd(1);
143
    mapBack->GetYaxis()->SetTickLength(0.01);
144
    mapBack->GetYaxis()->SetLabelOffset(0.03);
145
 
146
    mapBack->GetXaxis()->SetTickLength(0.01);
147
    mapBack->GetXaxis()->SetLabelOffset(0.03);
148
 
149
 
150
    mapBack->DrawCopy("TEXT");
151
    kvadratki->DrawCopy("BOX,SAME");
152
  c->cd(2);
153
    zaporedje->GetYaxis()->SetTickLength(0.01);
154
    zaporedje->GetYaxis()->SetLabelOffset(0.03);
155
 
156
    zaporedje->GetXaxis()->SetTickLength(0.01);
157
    zaporedje->GetXaxis()->SetLabelOffset(0.03);
158
 
159
 
160
    zaporedje->DrawCopy("TEXT");
161
    kvadratki->DrawCopy("BOX,SAME");
162
  c->cd(3);
163
    chips->GetYaxis()->SetTickLength(0.01);
164
    chips->GetYaxis()->SetLabelOffset(0.03);
165
 
166
    chips->GetXaxis()->SetTickLength(0.01);
167
    chips->GetXaxis()->SetLabelOffset(0.03);
168
 
169
 
170
    chips->DrawCopy("TEXT");
171
    kvadratki->DrawCopy("BOX,SAME");
172
  c->cd(4);
173
    pixelonchp->GetYaxis()->SetTickLength(0.01);
174
    pixelonchp->GetYaxis()->SetLabelOffset(0.03);
175
 
176
    pixelonchp->GetXaxis()->SetTickLength(0.01);
177
    pixelonchp->GetXaxis()->SetLabelOffset(0.03);
178
 
179
 
180
    pixelonchp->DrawCopy("TEXT");
181
    kvadratki->DrawCopy("BOX,SAME");
182
 
183
 
184
  return m;
185
}
186
*/