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

Functions

int main (int argc, char *argv[])
 
void print_help_message ()
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
36{
37 if (argc < 2) { print_help_message(); return 0; }
38
40
41 const char *outdir = "..";
42 const char *suff = "raw.root";
43 bool do_set = false;
44 bool noaff = false;
45 bool reset = false;
46 bool resetaff = false;
47 bool resetpar = false;
48 EdbID id;
49 int from_plate = 57;
50 int to_plate = 1;
51 float z0 = 0;
52 float dz = -1300;
53 float dzbase = 210;
54 int refplate = -1;
55
56 EdbAffine2D affup;
57 bool do_updateaff=0;
58 bool do_updatesetrawaff=0;
59 bool do_updatesetaff=0;
60 bool do_copyset=0;
61 EdbID idA, idB;
62
63 for(int i=1; i<argc; i++ ) {
64 char *key = argv[i];
65
66 if(!strncmp(key,"-set=",5))
67 {
68 if(strlen(key)>5) id.Set(key+5);
69 do_set=true;
70 }
71 else if(!strncmp(key,"-o=",3))
72 {
73 if(strlen(key)>3) outdir=key+3;
74 }
75 else if(!strncmp(key,"-suff=",6))
76 {
77 if(strlen(key)>6) suff=key+6;
78 }
79 else if(!strncmp(key,"-noaff",6))
80 {
81 noaff=true;
82 }
83 else if(!strncmp(key,"-resetaff",9))
84 {
85 resetaff=true;
86 }
87 else if(!strncmp(key,"-refplate=",10))
88 {
89 refplate= atoi(key+10);
90 printf("\n******** refplate = %d *********** \n",refplate);
91 }
92 else if(!strncmp(key,"-resetpar",9))
93 {
94 resetpar=true;
95 }
96 else if(!strncmp(key,"-reset",6))
97 {
98 reset=true;
99 }
100 else if(!strncmp(key,"-v=",3))
101 {
102 if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
103 }
104 else if(!strncmp(key,"-updateaff=",11))
105 {
106 if(strlen(key)>11) {
107 affup.Set(key+11);
108 affup.Print();
109 do_updateaff=1;
110 }
111 }
112 else if(!strncmp(key,"-updatesetrawaff",16))
113 {
114 do_updatesetrawaff=1;
115 }
116 else if(!strncmp(key,"-updatesetaff",13))
117 {
118 do_updatesetaff=1;
119 }
120 else if(!strncmp(key,"-copyset",8))
121 {
122 do_copyset=1;
123 }
124 else if(!strncmp(key,"-A=",3))
125 {
126 if(strlen(key)>3) idA.Set(key+3);
127 }
128 else if(!strncmp(key,"-B=",3))
129 {
130 if(strlen(key)>3) idB.Set(key+3);
131 }
132 else if(!strncmp(key,"-dz=",4))
133 {
134 if(strlen(key)>4) dz = atof(key+4);
135 }
136 else if(!strncmp(key,"-dzbase=",8))
137 {
138 if(strlen(key)>8) dzbase = atof(key+8);
139 }
140 else if(!strncmp(key,"-from_plate=",12))
141 {
142 if(strlen(key)>12) from_plate = atoi(key+12);
143 }
144 else if(!strncmp(key,"-to_plate=",10))
145 {
146 if(strlen(key)>10) to_plate = atoi(key+10);
147 }
148 }
149
151 else {
152
155 if(id.eBrick<1) return 0;
156 Log(1,"makescanset"," for id %s", id.AsString());
157
158 if (resetaff) {
159 EdbScanSet *sc = sproc.ReadScanSet(id);
160 sproc.MakeAFFSet(*sc);
161 }
162 else if(refplate>-1) {
163 EdbScanSet *sc = sproc.ReadScanSet(id);
164 sc->SetAsReferencePlate(refplate);
165 //sc->Print();
166 sproc.WriteScanSet(id,*sc);
167 }
168 else if(do_updateaff)
169 {
170 printf("updateaff: %s\n",affup.AsString());
171 sproc.UpdateSetWithAff(id,affup);
172 }
173 else if(do_updatesetrawaff)
174 {
175 printf("Update set raw aff: %s with %s_%s\n",id.AsString(), idA.AsString(), idB.AsString() );
176 sproc.UpdateSetWithAff(id,idA,idB);
177 }
178 else if(do_updatesetaff)
179 {
180 printf("Update set aff: %s with %s\n",id.AsString(), idA.AsString() );
181// sproc.UpdateSetWithAff(id,idA);
182 EdbScanSet *ss = sproc.ReadScanSet(id); if(!ss) return 0;
183 EdbScanSet *ssu = sproc.ReadScanSet(idA); if(!ssu) return 0;
184 ss->TransformBrick(*ssu);
185 sproc.WriteScanSet( id ,*ss );
186 SafeDelete(ss); SafeDelete(ssu);
187 }
188 else if(do_copyset)
189 {
190 printf("Copy set: %s into %s\n", idA.AsString(),id.AsString() );
191 EdbScanSet *ssu = sproc.ReadScanSet(idA); if(!ssu) return 0;
193 printf("1\n");
194 ss.Copy(*ssu);
195 printf("2\n");
196 ss.UpdateIDS(id.eBrick, id.eMajor, id.eMinor);
197 printf("3\n");
198 sproc.WriteScanSet( id ,ss );
199 printf("4\n");
201 //SafeDelete(ssu);
202 }
203 else {
204 EdbScanSet sc(id);
205 sc.MakeNominalSet(id,from_plate, to_plate, z0, dz, 1, dzbase);
206 sproc.MakeScannedIDList( id, sc, from_plate, to_plate, suff);
207 sproc.WriteScanSet(id,sc);
208 if(resetpar) sproc.MakeParSet(sc);
209 else if(reset) sproc.PrepareSetStructure(sc);
210 else if(!noaff) {
212 sproc.UpdateSetWithAff(id,id);
213 }
214 }
215 if(gEDBDEBUGLEVEL>1) {
217 if(ss) ss->Print();
218 }
219 }
220
221}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
brick z0
Definition: RecDispMC.C:106
brick dz
Definition: RecDispMC.C:107
Definition: EdbAffine.h:17
void Print(Option_t *opt="") const
Definition: EdbAffine.cxx:52
const char * AsString() const
Definition: EdbAffine.cxx:57
void Set(EdbAffine2D &a)
Definition: EdbAffine.h:36
Definition: EdbID.h:7
char * AsString() const
Definition: EdbID.cxx:26
bool Set(const char *id_string)
Definition: EdbID.cxx:19
scanned data processing
Definition: EdbScanProc.h:12
bool PrepareSetStructure(EdbScanSet &sc)
Definition: EdbScanProc.cxx:441
void UpdateSetWithAff(EdbID idset, EdbAffine2D aff)
Definition: EdbScanProc.cxx:2730
int WriteScanSet(EdbID id, EdbScanSet &ss)
Definition: EdbScanProc.cxx:1428
bool MakeAFFSet(EdbScanSet &sc)
Definition: EdbScanProc.cxx:394
bool MakeParSet(EdbScanSet &sc)
Definition: EdbScanProc.cxx:422
void UpdateSetWithPlatePar(EdbID id)
Definition: EdbScanProc.cxx:2765
void MakeScannedIDList(EdbID id0, EdbScanSet &sc, int pl_from, int pl_to, const char *suffix)
Definition: EdbScanProc.cxx:646
TString eProcDirClient
directory path for root data
Definition: EdbScanProc.h:14
EdbScanSet * ReadScanSet(EdbID id)
Definition: EdbScanProc.cxx:1482
Definition: EdbScanSet.h:11
void MakeNominalSet(EdbID id, int from_plate=57, int to_plate=1, float z0=0, float dz=-1300, float shr=1, float dzbase=210., float dzem=45.)
Definition: EdbScanSet.cxx:74
Bool_t SetAsReferencePlate(Int_t pid)
Definition: EdbScanSet.cxx:191
EdbScanProc * sproc
Definition: comptonmap.cpp:29
bool do_set
Definition: emrec.cpp:36
const char * outdir
Definition: emrec.cpp:37
gEDBDEBUGLEVEL
Definition: energy.C:7
ss
Definition: energy.C:62
void print_help_message()
Definition: makescanset.cpp:10
bool noaff
Definition: mc2raw.cxx:44
UInt_t id
Definition: tlg2couples.C:117

◆ print_help_message()

void print_help_message ( )
11{
12 cout<< "\nUsage: \n\t makescanset -set=setID [-suff=suffix -dz=DZ -o=DATA_DIRECTORY -v=DEBUG] \n";
13 cout<< "\t\t suffix - file suffix to be searched - (default: raw.root \n)";
14 cout<< "\t\t DZ - plate-to-plate step (default = -1300.)\n";
15 cout<< "\t\t DEBUG - verbosity level: 0-print nothing, 1-errors only, 2-normal, 3-print all messages\n";
16 cout<< "\t\t -noaff - do not read aff-files - the default is yes \n";
17 cout<< "\t\t -resetaff - recreate aff-files using values from set.root\n";
18 cout<< "\t\t -refplate=id - recalculate set.root in respect to plate [id] and update it\n";
19 cout<< "\t\t -resetpar - reset pxxx/x.x.x.x.par-files (shrinkage correction, etc) using values from set.root\n";
20 cout<< "\t\t -reset - reset *.aff.par and *.par files\n";
21 cout<< "\t\t -updateaff=\"aff\" - update scanset with a given aff\n";
22 cout<< "\t\t -updatesetrawaff -A=ida -B=idb - update scanset with affine transformations found between plates of the scansets A and B\n";
23 cout<< "\t\t -updatesetaff -A=ida - update scanset with affine transformations of set A\n";
24 cout<< "\t\t -copyset -A=ida - copy A into set - keep geometry, modify only ID's\n";
25 cout<< "\t\t -dzbase=base - set dzbase (210 default)\n";
26 cout<< "\t\t -from_plate=nfirst - the first plate id (default=57)\n";
27 cout<< "\t\t -to_plate=nlast - the last plate id (default=1)\n";
28 cout<< "\nExample: \n";
29 cout<< "\t makescanset -set=4554.0.1.1000 -o=/scratch/BRICKS \n";
30 cout<< "\n If the data location directory if not explicitly define\n";
31 cout<< "\t the current directory will be assumed to be the brick directory \n";
32 cout<<endl;
33}