FEDRA emulsion software from the OPERA Collaboration
emlink.cpp File Reference
#include <string.h>
#include <iostream>
#include <TEnv.h>
#include <TRint.h>
#include "EdbLog.h"
#include "EdbScanProc.h"
Include dependency graph for emlink.cpp:

Functions

int main (int argc, char *argv[])
 
void print_help_message ()
 
void set_default (TEnv &cenv)
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
77{
78 if (argc < 2) { print_help_message(); return 0; }
79
80 TEnv cenv("linkenv");
82 gEDBDEBUGLEVEL = cenv.GetValue("emlink.EdbDebugLevel" , 1);
83 const char *env = cenv.GetValue("emlink.env" , "link.rootrc");
84 const char *outdir = cenv.GetValue("emlink.outdir" , "..");
85
86 bool do_id = false;
87 bool do_set = false;
88 bool do_new = false;
89 bool do_check = false;
90 bool do_check_view = false;
91 Int_t brick=0, plate=0, major=0, minor=0;
92 Int_t npre=0, nfull=0;
93 Int_t correct_ang=0;
94
95 for(int i=1; i<argc; i++ ) {
96 char *key = argv[i];
97
98 if (!strncmp(key,"-id=",4))
99 {
100 if(strlen(key)>4) sscanf(key+4,"%d.%d.%d.%d",&brick,&plate,&major,&minor);
101 do_id=true;
102 }
103 else if(!strncmp(key,"-set=",5))
104 {
105 if(strlen(key)>5) sscanf(key+5,"%d.%d.%d.%d",&brick,&plate,&major,&minor);
106 do_set=true;
107 }
108 else if(!strncmp(key,"-o=",3))
109 {
110 if(strlen(key)>3) outdir=key+3;
111 }
112 else if(!strncmp(key,"-p=",3))
113 {
114 if(strlen(key)>3) npre = atoi(key+3);
115 }
116 else if(!strncmp(key,"-f=",3))
117 {
118 if(strlen(key)>3) nfull = atoi(key+3);
119 }
120 else if(!strncmp(key,"-a",2))
121 {
122 correct_ang=1;
123 }
124 else if(!strncmp(key,"-new",4))
125 {
126 do_new=true;
127 }
128 else if(!strncmp(key,"-check",6))
129 {
130 do_check=true;
131 }
132 else if(!strncmp(key,"-view",5))
133 {
134 do_check_view=true;
135 }
136 else if(!strncmp(key,"-v=",3))
137 {
138 if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
139 }
140 }
141
142 if(!(do_id||do_set)) { print_help_message(); return 0; }
143
144 cenv.SetValue("emlink.env" , env);
145 cenv.ReadFile( cenv.GetValue("emlink.env" , "link.rootrc") ,kEnvLocal);
146 cenv.SetValue("emlink.outdir" , outdir);
147 cenv.WriteFile("link.save.rootrc");
148
149
152 if(do_id) {
153 printf("\n----------------------------------------------------------------------------\n");
154 printf("link run with id= %d.%d.%d.%d\n", brick,plate, major,minor);
155 printf("----------------------------------------------------------------------------\n\n");
156
157 EdbID id(brick,plate,major,minor);
158 if(do_new) {
159 EdbID id0=id; id0.ePlate=0;
161 if(ss) {
162 EdbPlateP *plate = ss->GetPlate(id.ePlate);
163 if(plate) sproc.LinkRunTest(id, *plate, cenv);
164 }
165 }
166 else if(do_check_view) sproc.CheckViewOverlaps(id, cenv);
167 else if(npre+nfull>0) sproc.LinkRunAll(id, npre, nfull, correct_ang);
168 }
169 if(do_set) {
170 printf("\n----------------------------------------------------------------------------\n");
171 printf("link set with id= %d.%d.%d.%d\n", brick,plate, major,minor);
172 printf("----------------------------------------------------------------------------\n\n");
173
174 EdbID id(brick,plate,major,minor);
176 if(ss) {
177 if(do_new) {
180 }
181 else if(npre+nfull>0) sproc.LinkSet(*ss, npre, nfull, correct_ang);
182 }
183
184 if(do_check)
185 {
186 //int argc2=1;
187 //char *argv2[]={"-l"};
188 //TRint app("APP",&argc2, argv2);
190 //app.Run();
191 }
192 }
193 cenv.WriteFile("link.save.rootrc");
194
195 return 1;
196}
BRICK brick
Definition: RecDispMC.C:103
Definition: EdbID.h:7
Int_t ePlate
Definition: EdbID.h:11
Definition: EdbBrick.h:14
scanned data processing
Definition: EdbScanProc.h:12
void MakeLinkSetSummary(EdbID id)
Definition: EdbScanProc.cxx:2910
void LinkRunTest(EdbID id, EdbPlateP &plate, TEnv &cenv)
Definition: EdbScanProc.cxx:3139
int LinkSet(EdbScanSet &sc, int npre=3, int nfull=1, int correct_ang=1)
Definition: EdbScanProc.cxx:622
void CheckViewOverlaps(EdbID id, TEnv &cenv)
Definition: EdbScanProc.cxx:3203
int LinkRunAll(int id[4], int npre=3, int nfull=1, int correct_ang=1)
Definition: EdbScanProc.cxx:1065
void LinkSetNewTest(EdbScanSet &sc, TEnv &cenv)
Definition: EdbScanProc.cxx:3243
TString eProcDirClient
directory path for root data
Definition: EdbScanProc.h:14
EdbScanSet * ReadScanSet(EdbID id)
Definition: EdbScanProc.cxx:1482
Definition: EdbScanSet.h:11
EdbScanProc * sproc
Definition: comptonmap.cpp:29
TEnv cenv("emrec")
bool do_set
Definition: emrec.cpp:36
const char * outdir
Definition: emrec.cpp:37
gEDBDEBUGLEVEL
Definition: energy.C:7
ss
Definition: energy.C:62
Int_t plate
Definition: merge_Energy_SytematicSources_Electron.C:1
UInt_t id
Definition: tlg2couples.C:117

◆ print_help_message()

void print_help_message ( )
14{
15 cout<< "\nUsage: \n\t emlink -id=ID [-p=NPRE -f=NFULL -o=DATA_DIRECTORY -a -v=DEBUG] \n";
16 cout<< "\t emlink -set=ID [-p=NPRE -f=NFULL -o=DATA_DIRECTORY -a -v=DEBUG] \n\n";
17 cout<< "\t\t ID - id of the data piece or dataset formed as BRICK.PLATE.MAJOR.MINOR \n";
18 cout<< "\t\t NPRE - number of the prealignments (default is 0)\n";
19 cout<< "\t\t NFULL - number of the fullalignments (default is 0)\n";
20 cout<< "\t\t -a - apply the angular correction when do prelinking (default is not)\n";
21 cout<< "\t\t -new - new linking (renewed 06-04-11)\n";
22 cout<< "\t\t -view - check view overlaps\n";
23 cout<< "\t\t DEBUG - verbosity level: 0-print nothing, 1-errors only, 2-normal, 3-print all messages\n";
24 cout<< "\nExample: \n";
25 cout<< "\t emlink -id=4554.10.1.0 -o=/scratch/BRICKS \n";
26 cout<< "\n If the data location directory is not explicitly defined\n";
27 cout<< " the current directory assumed to be the brick directory \n";
28 cout<< "\n If the parameters file (link.rootrc) is not presented - the default \n";
29 cout<< " parameters are used. After the execution them will be saved into link.save.rootrc\n";
30 cout<<endl;
31}

◆ set_default()

void set_default ( TEnv &  cenv)
35{
36 // default parameters for the new linking
37 cenv.SetValue("fedra.link.AFID" , 1 ); // 1 is usually fine for scanned data; for the db-read data use 0!
38 cenv.SetValue("fedra.link.PixelCorr" , "0 1. 1.");
39 cenv.SetValue("fedra.link.CheckUpDownOffset" , 1 ); // check dXdY offsets between up and correspondent down views
40 cenv.SetValue("fedra.link.BinOK" , 6. );
41 cenv.SetValue("fedra.link.NcorrMin" , 100 );
42 cenv.SetValue("fedra.link.DoCorrectShrinkage" , true );
43 cenv.SetValue("fedra.link.read.InvertSides" , 0 );
44 cenv.SetValue("fedra.link.read.HeaderCut" , "1" );
45 cenv.SetValue("fedra.link.read.UseDensityAsW" , false );
46 cenv.SetValue("fedra.link.read.ICUT" , "-1 -500. 500. -500. 500. -1. 1. -1. 1. 0. 50.");
47 cenv.SetValue("fedra.link.RemoveDoublets" , "1 5. .1 1"); //yes/no dr dt checkview(0,1,2)
48 cenv.SetValue("fedra.link.DumpDoubletsTree" , false );
49 cenv.SetValue("fedra.link.shr.NsigmaEQ" , 7.5 );
50 cenv.SetValue("fedra.link.shr.Shr0" , .9 );
51 cenv.SetValue("fedra.link.shr.DShr" , .3 );
52 cenv.SetValue("fedra.link.shr.ThetaLimits" ,"0.005 1.");
53 cenv.SetValue("fedra.link.DoCorrectAngles" , true );
54 cenv.SetValue("fedra.link.ang.Chi2max" , 1.5 );
55 cenv.SetValue("fedra.link.DoFullLinking" , true );
56 cenv.SetValue("fedra.link.full.NsigmaEQ" , 5.5 );
57 cenv.SetValue("fedra.link.full.DR" , 30. );
58 cenv.SetValue("fedra.link.full.DT" , 0.1 );
59 cenv.SetValue("fedra.link.full.CHI2Pmax" , 3. );
60 cenv.SetValue("fedra.link.DoSaveCouples" , true );
61 cenv.SetValue("fedra.link.DumpDoubletsTree" , false);
62 cenv.SetValue("fedra.link.Sigma0" , "1 1 0.013 0.013");
63 cenv.SetValue("fedra.link.PulsRamp0" , "6 9");
64 cenv.SetValue("fedra.link.PulsRamp04" , "6 9");
65 cenv.SetValue("fedra.link.Degrad" , 5 );
66
67 cenv.SetValue("fedra.link.LLfunction" , "0.256336-0.16489*x+2.11098*x*x" );
68 cenv.SetValue("fedra.link.CPRankingAlg" , 0 );
69
70 cenv.SetValue("emlink.outdir" , "..");
71 cenv.SetValue("emlink.env" , "link.rootrc");
72 cenv.SetValue("emlink.EdbDebugLevel" , 1);
73}