FEDRA emulsion software from the OPERA Collaboration
grains.C File Reference
#include "init.C"
#include "run.C"
Include dependency graph for grains.C:

Functions

 grains ()
 

Function Documentation

◆ grains()

grains ( )

Configure Odyssey for taking image with processing

Configure Odyssey for taking image with processing

4 {
5  float X0,Y0, DDX=500, DDY=500;
6  char line[256];
7  float Zmid;
8  int res;
9  hwinit();
10  homeall();
11  X0=s->X->Reference+125000/2.;
12  Y0=s->Y->Reference+100000/2.;
13  Zmid=s->Z->Reference+s->EmBotLayer+s->EmBase/2.;
14  s->Z->PosMove(Zmid,1e6,1e6);
15  s->Z->WaitForMoveComplete(1e4);
16  xy(X0,Y0);
17 // printf("Please set the focus to the middle of the base, then type 'q'..\n");
18 // monitor();
19  tunelight();
20  takebggchere(); //take background and equalization map
22 
23  o->ApplyGainCorr=true;
24 // o->ApplyGainCorr=false;
25  o->ApplyFIRF=true;
27  o->SubtractBG=true;
28  if(!finefocus(400,.4)) { return 0;};
29  if(!finefocus(400,2)) {return 0;};
30  Zmid=s->Z->Reference+s->EmBotLayer+s->EmBase/2.;
31  s->Z->PosMove(Zmid,1e6,1e6);
32  s->Z->WaitForMoveComplete(1e4);
33  tunelight();
34  takebggchere(); //take background and equalization map
36  o->ApplyGainCorr=true;
37 // o->ApplyGainCorr=false;
38  o->ApplyFIRF=true;
40  o->SubtractBG=true;
41  if(!finefocus(400,2)) {return 0;};
42  printf("************************* Tuning complete. taking data **************************\n");
43  date=new TDatime();
44  int id0,id1,id2,id3;
45  if(!PC->GetLoadedId(&id0,&id1,&id2,&id3)) {printf("No plate is loaded! Load the plate and re-start the application.\n"); return 0;};
46 // sprintf(line,"dat%dem%d.%d.%d.%d",date->GetDate(),id0,id1,id2,id3);
47  sprintf(line,"z:\\Qcheck\\dat%dem%d.%d.%d.%d",date->GetDate(),id0,id1,id2,id3);
48  gSystem->mkdir(line);
49 // sprintf(line,"cp dat.root z:\\Qcheck\\dat%dem%d.%d.%d.%d\\",date->GetDate(),id0,id1,id2,id3);
50  gSystem->cd(line);
51  Run(false, X0, Y0, DDX, DDY, "dat.root", false);
52  Run(false, X0-20000, Y0-20000, DDX, DDY, "dat1.root", false);
53  Run(false, X0-20000, Y0+20000, DDX, DDY, "dat2.root", false);
54  Run(false, X0+20000, Y0-20000, DDX, DDY, "dat3.root", false);
55 Run(false, X0+20000, Y0+20000, DDX, DDY, "dat4.root", false);
56  printf("************************* Analysing data **************************\n");
57 
58 // printf("making GA object in %s\n",gSystem->pwd());
59  //EdbGA ga("dat.root",6,6,1);
60 // ga.SetRun("dat.root");
61 /* printf("making GA analysis\n");
62  ga.CheckViewGrains();
63  c->cd(1);
64  grains->Draw("ncl","ncl<48","");
65  c->cd(2);
66  grains->Draw("z0","ncl<48","");
67  c->SaveAs("grains.gif");
68 */
69  file=new TFile("dat.root","READ");
70  TTree* Views=(TTree*)file->Get("Views");
71  c=new TCanvas();
72  c->Divide(2,1);
73  c->cd(1);
74  Views->Draw("clusters.eFrame>>ht","eSide==1"); //TOP
75  ht->Scale(1./Views->GetEntries());
76  ht->Draw();
77  c->cd(2);
78  Views->Draw("clusters.eFrame>>ht1","eSide==0"); //BOT
79  ht1->Scale(1./Views->GetEntries());
80  ht1->Draw();
81  c->SaveAs("clust.gif");
82 
83  file=new TFile("dat1.root","READ");
84  TTree* Views=(TTree*)file->Get("Views");
85  c=new TCanvas();
86  c->Divide(2,1);
87  c->cd(1);
88  Views->Draw("clusters.eFrame>>ht","eSide==1"); //TOP
89  ht->Scale(1./Views->GetEntries());
90  ht->Draw();
91  c->cd(2);
92  Views->Draw("clusters.eFrame>>ht1","eSide==0"); //BOT
93  ht1->Scale(1./Views->GetEntries());
94  ht1->Draw();
95  c->SaveAs("clust1.gif");
96 
97  file=new TFile("dat2.root","READ");
98  TTree* Views=(TTree*)file->Get("Views");
99  c=new TCanvas();
100  c->Divide(2,1);
101  c->cd(1);
102  Views->Draw("clusters.eFrame>>ht","eSide==1"); //TOP
103  ht->Scale(1./Views->GetEntries());
104  ht->Draw();
105  c->cd(2);
106  Views->Draw("clusters.eFrame>>ht1","eSide==0"); //BOT
107  ht1->Scale(1./Views->GetEntries());
108  ht1->Draw();
109  c->SaveAs("clust2.gif");
110 
111  file=new TFile("dat3.root","READ");
112  TTree* Views=(TTree*)file->Get("Views");
113  c=new TCanvas();
114  c->Divide(2,1);
115  c->cd(1);
116  Views->Draw("clusters.eFrame>>ht","eSide==1"); //TOP
117  ht->Scale(1./Views->GetEntries());
118  ht->Draw();
119  c->cd(2);
120  Views->Draw("clusters.eFrame>>ht1","eSide==0"); //BOT
121  ht1->Scale(1./Views->GetEntries());
122  ht1->Draw();
123  c->SaveAs("clust3.gif");
124 
125  file=new TFile("dat4.root","READ");
126  TTree* Views=(TTree*)file->Get("Views");
127  c=new TCanvas();
128  c->Divide(2,1);
129  c->cd(1);
130  Views->Draw("clusters.eFrame>>ht","eSide==1"); //TOP
131  ht->Scale(1./Views->GetEntries());
132  ht->Draw();
133  c->cd(2);
134  Views->Draw("clusters.eFrame>>ht1","eSide==0"); //BOT
135  ht1->Scale(1./Views->GetEntries());
136  ht1->Draw();
137  c->SaveAs("clust4.gif");
138 
139  return 1;
140 }
int Threshold
Definition: AcqOdyssey.h:174
bool ApplyFIRF
Definition: AcqOdyssey.h:172
bool SubtractBG
Definition: AcqOdyssey.h:171
bool ApplyGainCorr
Definition: AcqOdyssey.h:173
int GetLoadedId(int *id0=NULL, int *id1=NULL, int *id2=NULL, int *id3=NULL)
Definition: AcqSerialPlateChanger.cxx:576
Float_t X() const
Definition: EdbSegP.h:170
Float_t Z() const
Definition: EdbSegP.h:150
Float_t Y() const
Definition: EdbSegP.h:171
float X0
Definition: emthickness.cpp:69
float Y0
Definition: emthickness.cpp:70
int hwinit()
Definition: hwinit.C:72
AcqOdyssey * o
Definition: hwinit.C:2
int ThrTop
Definition: hwinit.C:11
AcqSerialPlateChanger * PC
Definition: hwinit.C:5
int finefocus(int clu_thre=300, float fineness=4.)
Definition: init.C:109
int tunelight()
Definition: init.C:244
xy(float X, float Y)
Definition: init.C:303
homeall()
Definition: init.C:324
takebggchere()
Definition: init.C:178
void Run(bool AbsCoord=false, float X0, float Y0, float DDX, float DDY, const char *File, bool Images=false)
Definition: run.C:208
new TCanvas()
EdbSegP * s
Definition: tlg2pattern.C:32
TFile * file
Definition: write_pvr.C:3