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

Functions

void get_aff ()
 
int get_sb_hist (char *id_proc="8000000001131121")
 
 get_volume (char *idproc)
 
int init ()
 
void test_oracle ()
 

Variables

EdbPVRecali =0
 
TOracleServerEdb =0
 

Function Documentation

◆ get_aff()

void get_aff ( )
30{
31 // minimal example of db query to tree conversion
32
33 if(!db) if(!init()) return;
34 TTree *t = new TTree("t","t");
35 int n =db->QueryTree( "select * from tb_plates order by id",t);
36 printf("%d entries\n",n);
37 t->Draw("mapdx:z","calibration>0","*");
38 delete db;
39 db=0;
40}
Int_t QueryTree(char *query, TTree *tree, char *leafs=0)
Definition: TOracleServer.cxx:318
TTree * t
Definition: check_shower.C:4
int init()
Definition: test_oracle.C:20
TOracleServerE * db
Definition: test_oracle.C:8

◆ get_sb_hist()

int get_sb_hist ( char *  id_proc = "8000000001131121")
44{
45 // more elaborated example of db query to tree conversion
46
47 if(!db) if(!init()) return;
48
49 TFile *f=new TFile("sbh.root","RECREATE");
50 TTree *t = new TTree("t","t");
51
52 char *leaflist = new char[512];
53 leaflist = "track/f:grains/f:fpx/f:fpy/f:fsx/f:fsy/f:ppx/f:ppy/f:psx/f:psy/f:z/f:plate/f:path/f:proc/f:brick/f";
54
55 char *query = new char[2048];
56 sprintf(query,"\
57select id_track,grains,fpx,fpy,fsx,fsy,ppx,ppy,psx,psy,z,id_plate,path,id_processoperation-8000000000000000,id_eventbrick \
58from vw_scanback_history \
59where id_eventbrick=7 and ID_PROCESSOPERATION=%s and id_plate=1 and path in \
60(select path from vw_scanback_history \
61where id_eventbrick=7 and ID_PROCESSOPERATION=%s \
62and id_plate=7 and abs(fpy-ppy)<50 and abs(fpx-ppx)<50) \
63and ppy>25000 and ppy<75000 ",
64id_proc,id_proc);
65
66 int n =db->QueryTree(query,t,leaflist);
67
68 printf("%d entries\n",n);
69 t->Write();
70 t->Draw("ppx-fpx","grains>0");
71 f->Close();
72 delete db; db=0;
73}
FILE * f
Definition: RecDispMC.C:150

◆ get_volume()

get_volume ( char *  idproc)
77{
78 // example of the access to the scanned volume
79
80 if(!db) if(!init()) return;
81
82 ali = new EdbPVRec();
83
85
86 int n = db->ReadVolume(idproc, *v);
87 v->Print();
88 TFile f("vol.root","RECREATE");
89 ali->Write("ali");
90 f.Close();
91 delete db; db=0;
92}
Definition: EdbPVRec.h:148
Definition: EdbPattern.h:334
void Print() const
Definition: EdbPattern.cxx:1693
Int_t ReadVolume(char *id_volume, EdbPatternsVolume &vol)
Definition: TOracleServerE.cxx:65
EdbPVRec * ali
Definition: test_oracle.C:9

◆ init()

int init ( )
21{
22 db = (TOracleServerE *)TSQLServer::Connect("oracle://operasoft:1521/dbtest","opera","neutrino");
23 printf("Server info: %s\n", db->ServerInfo());
24 if(!db) return 0;
25 return 1;
26}
Definition: TOracleServerE.h:10
const char * ServerInfo()
Definition: TOracleServer.cxx:305

◆ test_oracle()

void test_oracle ( )
13{
14 //get_aff(); // minimal example of sql query to tree conversion
15 //get_sb_hist(); // more elaborated example (selections may depends on lab)
16 get_volume("8000000000900207"); // this function read total-scan volume into EdbPVRec object and save it
17}
get_volume(char *idproc)
Definition: test_oracle.C:76

Variable Documentation

◆ ali

EdbPVRec* ali =0

◆ db