FEDRA emulsion software from the OPERA Collaboration
test.C File Reference

Functions

void r (int rid=2)
 
void read_clusters_fast (int rid=2)
 
 t (int n=1000)
 
void updateframe (int rid=2, int nviews=2)
 
void w (int rid=2, int nviews=2)
 
void wRan (int rid=2, int nareas=2, int nviews=2)
 

Function Documentation

◆ r()

void r ( int  rid = 2)
202{
203 // test of reading from RUN rid
204
205 EdbRun *run = new EdbRun(rid);
206
207 int nviews = run->GetEntries();
208
209 EdbView *view =0;
210 TList *clFrame =0;
211 EdbCluster *cluster =0;
212 TObjArray *frames =0; // array of images
213
214 for( int iv=0; iv<nviews; iv++ ) { // views cycle
215
216 view = run->GetEntry(iv);
217 view->Print();
218
219 int nframes = view->GetNframesTop() + view->GetNframesBot();
220
221 for( int ifr=0; ifr<nframes; ifr++) { // frames cycle
222
223 frames = view->GetFrames();
224 // if(frames) printf("Number of Frames = %d\n", frames->GetEntries() );
225
226 clFrame = view->GetClustersFrame(ifr);
227
228 int nclFr = clFrame->Capacity();
229
230 for( int icl=0; icl<nclFr; icl++) { // clusters cycle
231
232 cluster = (EdbCluster*)(clFrame->At(icl));
233 // cluster->Print();
234
235 float x = cluster->GetX();
236
237 } // end of clusters cycle
238
239 } // end of frames cycle
240
241 } // end of views cycle
242
243}
Definition: EdbCluster.h:19
Float_t GetX() const
Definition: EdbCluster.h:51
Definition: EdbRun.h:75
int GetEntries() const
Definition: EdbRun.h:136
EdbView * GetEntry(int entry, int ih=1, int icl=0, int iseg=1, int itr=0, int ifr=0)
Definition: EdbRun.cxx:462
Base scanning data object: entry into Run tree.
Definition: EdbView.h:134
Int_t GetNframesTop() const
Definition: EdbView.h:207
Int_t GetNframesBot() const
Definition: EdbView.h:208
TList * GetClustersFrame(int frame) const
Definition: EdbView.cxx:285
void Print(Option_t *opt=0) const
Definition: EdbView.cxx:185
TClonesArray * GetFrames() const
Definition: EdbView.h:167
EdbRun * run
Definition: check_raw.C:38

◆ read_clusters_fast()

void read_clusters_fast ( int  rid = 2)
247{
248 // test of clusters reading from RUN rid
249
250 EdbRun *run = new EdbRun(rid);
251 int nviews = run->GetEntries();
252
253 EdbView *view =0;
254 EdbCluster *cluster =0;
255
256 for( int iv=0; iv<nviews; iv++ ) { // views cycle
257
258 view = run->GetEntry(iv);
259 view->Print();
260
261 int ncl = view->Nclusters();
262
263 int frame = 0;
264
265 for( int icl=0; icl<ncl; icl++) {
266 cluster = view->GetCluster(icl);
267 cluster->Print();
268 frame = cluster->GetFrame();
269 }
270 }
271}
Int_t GetFrame() const
Definition: EdbCluster.h:56
void Print(Option_t *opt=0) const
Definition: EdbCluster.cxx:58
Int_t Nclusters() const
Definition: EdbView.h:215
EdbCluster * GetCluster(int i) const
Definition: EdbView.h:218

◆ t()

t ( int  n = 1000)
275{
276 TH1F *hist = new TH1F("hist","hist",100,0,99);
277
278 for(int i=0; i<n; i++) hist->Fill( gRandom->Integer(100) );
279 hist->Draw();
280}
void hist()
Definition: init.C:23

◆ updateframe()

void updateframe ( int  rid = 2,
int  nviews = 2 
)
11{
12 // test of writing into run file
13 // Parameters: rid - run identifier
14 // nviews - number of views to be written
15 //
16
17 EdbRun *run = new EdbRun(rid,"UPDATE");
18 EdbView *view=run->GetView();
19 for( int ivc=0; ivc<nviews; ivc++) { // views cycle
20 view->AddFrame(ivc+1,10.);
21 run->AddView(view);
22 }
23 run->Close();
24}
void Close()
Definition: EdbRun.cxx:439
EdbView * GetView() const
Definition: EdbRun.h:110
void AddView()
Definition: EdbRun.cxx:305
void AddFrame(int id, float z, int ncl=0, int npix=0)
Definition: EdbView.cxx:268

◆ w()

void w ( int  rid = 2,
int  nviews = 2 
)
28{
29 // test of writing into run file
30 // Parameters: rid - run identifier
31 // nviews - number of views to be written
32 //
33
34 EdbRun *run = new EdbRun(rid,"RECREATE");
35
36 float width = 120, height = 110; // microns
37 int colomns = 512, rows = 512; // pixels
38
39 run->GetHeader()->SetCCD( width, height, rows, colomns );
40
41 int plateID=111;
42 float up=100, base=850, down=100;
43 float shrU=2, shrD=2;
44
45 run->GetHeader()->SetPlate( plateID, up,base,down, shrU,shrD );
46
47 run->GetHeader()->SetArea( 9, 300,300, 16,16, 0);
48
49 float z1 = 0, z2=100, z3=800, z4=900;
50
51
52 run->Print();
53
54 EdbView *view=run->GetView();
55 EdbViewHeader *vh = view->GetHeader();
56
57 for( int ivc=0; ivc<nviews; ivc++) { // views cycle
58
59 Int_t iv = ivc; // View ID in the Area
60 Int_t ia = 20; // Area ID in Run (prediction id)
61 Float_t xf = 30; // stage coord, top left corner
62 Float_t yf = 40; //
63 Float_t z1 = 0; //
64 Float_t z2 = 100; //
65 Float_t z3 = 800; //
66 Float_t z4 = 900; //
67 Int_t nft = 3; // top | number of frames in the view (0,1,2...16...)
68 Int_t nfb = 3; // botoom |
69
70 Float_t *levels = new Float_t[nft+nfb];
71 Int_t *ncl = new Int_t[nft+nfb];
72 Int_t *npix = new Int_t[nft+nfb];
73
74 vh->SetViewID( iv );
75 vh->SetAreaID( ia );
76 vh->SetCoordXY(xf,yf);
77 vh->SetCoordZ(z1,z2,z3,z4);
78 vh->SetNframes(nft,nfb);
79 vh->SetAffine(1,0,0,1,0,0);
80
81 for( int ifr=0; ifr<nft+nfb; ifr++ ) { // frames cycle
82
83 for( int icl=0; icl<3; icl++ ) { // clusters cycle
84
85 float x=ivc*1000, y=2, z=3; // cluster coord
86 float ar =40; // cluster area
87 float vol =50; // cluster volume
88 int side=0; // emulsion side (top=0, bottom=1) ?
89 if( ifr>nft-1 ) side=1;
90
91 view->AddCluster(x,y,z, ar, vol, ifr, side);
92
93 } // end of clusters cycle
94
95 levels[ifr] = 10.*ifr+ivc;
96 ncl[ifr] = 100.*ifr+ivc;
97 npix[ifr] = 1000.*ifr+ivc;
98 view->AddFrame( ifr, levels[ifr], ncl[ifr], npix[ifr] );
99
100 } // end of frames cycle
101
102 vh->SetZlevels(nft+nfb,levels);
103
104 run->AddView(view);
105
106 } // end of views cycle
107
108 run->Close();
109}
EdbPatternsVolume * vol
Definition: RecDispNU.C:116
void SetArea(int N, float stepx, float stepy, int ft, int fb, int path)
Definition: EdbRunHeader.h:209
void SetCCD(int nx=0, int ny=0, float px=0, float py=0, char *name="", char *title="")
stage setting functions
Definition: EdbRunHeader.h:179
void SetPlate(int id, float up, float base, float down, float shru, float shrd, char *name="", char *title="")
Definition: EdbRunHeader.h:200
EdbRunHeader * GetHeader() const
Definition: EdbRun.h:138
void Print() const
Definition: EdbRun.cxx:580
view identification
Definition: EdbView.h:26
void SetZlevels(Int_t n, const Float_t *array)
Definition: EdbView.h:74
void SetCoordZ(float z1, float z2, float z3, float z4)
Definition: EdbView.h:102
void SetAreaID(int id)
Definition: EdbView.h:100
void SetViewID(int id)
Definition: EdbView.h:99
void SetNframes(int top, int bot)
Definition: EdbView.h:104
void SetAffine(float a11, float a12, float a21, float a22, float b1, float b2)
Definition: EdbView.h:67
void SetCoordXY(float x, float y)
Definition: EdbView.h:101
EdbViewHeader * GetHeader() const
Definition: EdbView.h:163
EdbCluster * AddCluster(EdbCluster *c)
Definition: EdbView.h:225

◆ wRan()

void wRan ( int  rid = 2,
int  nareas = 2,
int  nviews = 2 
)
113{
114 // test of writing into run file random generated clusters
115 // Parameters: rid - run identifier
116 // nviews - number of views to write
117 //
118
119 // TStopwatch timer;
120 //printf("Starting timer\n");
121 //timer.Start();
122
123 EdbRun *run = new EdbRun(rid,"RECREATE");
124
125 run->SetTitle("Test row data");
126 run->SetComment("I will not say that women have no character; \n\t\t rather, they have a new one every day. \n \t\t\t\t -- Heine ");
127
128 float width = 150, height = 150; // microns
129 int colomns = 512, rows = 512; // pixels
130
131 run->GetHeader()->SetCCD( width, height, rows, colomns );
132
133 int plateID=111;
134 float up=100, base=200, down=100;
135 float shrU=2, shrD=2;
136
137 run->GetHeader()->SetPlate( plateID, up,base,down, shrU,shrD );
138
139 float z1 = 0, z2=100, z3=300, z4=400;
140 //run->GetPlateSet()->Set( z1,z2,z3,z4 );
141
142 //run->GetHeader()->Write("RunHeader");
143 run->Print();
144
145 EdbCluster *cluster=0;
146 EdbSegment *seg=new EdbSegment();
147
148 EdbView *view=run->GetView();
149 EdbViewHeader *vh = view->GetHeader();
150
151 for( int iac=0; iac<nareas; iac++) { // areas cycle
152 printf("Process area: %d (%d)\n", iac, nareas );
153
154 for( int ivc=0; ivc<nviews; ivc++) { // views cycle
155
156 Int_t iv = ivc; // View ID in the Area
157 Int_t ia = iac; // Area ID in Run (prediction id)
158 Float_t xf = 0; // stage coord, top left corner
159 Float_t yf = 0; //
160 Int_t nft = 16; // top | number of frames in the view (0,1,2...16...)
161 Int_t nfb = 16; // botoom |
162
163 vh->SetViewID( iv );
164 vh->SetAreaID( ia );
165 vh->SetCoordXY(xf,yf);
166 vh->SetCoordZ(z1,z2,z3,z4);
167 vh->SetNframes(nft,nfb);
168 vh->SetAffine(1,0,0,1,0,0);
169
170 // view->GenerateClustersFog(.1);
171
172 float x0=0, y0=0, z0=0;
173 float ax=0, ay=0;
174
175 for( int itr=0; itr<350; itr++ ) {
176 x0 = gRandom->Rndm()*512;
177 y0 = gRandom->Rndm()*512;
178 z0 = gRandom->Rndm()*400;
179 ax = gRandom->Gaus( 0, 0.1 );
180 ay = gRandom->Gaus( 0, 0.1 );
181 x0 = x0 - ax*(z0-z1);
182 y0 = y0 - ay*(z0-z1);
183
184 seg->Set( x0,y0, z1, ax, ay, 40, 1, 16, itr );
185 view->AddSegment(seg);
186 view->GenerateClustersSegment( seg, 25., 0.2 );
187 }
188
189 run->AddView(view);
190 view->Clear();
191
192 }
193 } // end of views cycle
194
195 run->Close();
196 // timer.Print();
197 // printf("Time at the end of job = %f seconds\n",timer.CpuTime());
198}
brick z0
Definition: RecDispMC.C:106
void SetTitle(const char *tit)
Definition: EdbRun.h:133
void SetComment(const char *com)
Definition: EdbRun.h:132
segment of the track
Definition: EdbSegment.h:63
void Set(float x, float y, float z, float tx, float ty, float dz=0, int side=0, int puls=0, int id=0)
Definition: EdbSegment.cxx:93
EdbSegment * AddSegment(float x, float y, float z, float tx, float ty, float dz=0, int side=0, int puls=0, int id=-1)
Definition: EdbView.h:231
void Clear()
Definition: EdbView.cxx:79
void GenerateClustersSegment(EdbSegment *segment, int n0=25, float sigma=.1)
Definition: EdbView.cxx:567