FEDRA emulsion software from the OPERA Collaboration
emaligns2s.cpp File Reference
#include <string.h>
#include <iostream>
#include <TRint.h>
#include <TEnv.h>
#include "EdbLog.h"
#include "EdbScanProc.h"
Include dependency graph for emaligns2s.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[] 
)
48{
49 if (argc < 2) { print_help_message(); return 0; }
50
51 TEnv cenv("alignenv");
53 gEDBDEBUGLEVEL = cenv.GetValue("emalign.EdbDebugLevel" , 1);
54 const char *env = cenv.GetValue("emalign.env" , "align.rootrc");
55 const char *outdir = cenv.GetValue("emalign.outdir" , "..");
56
57 bool do_ida = false;
58 bool do_idb = false;
59 EdbID idA,idB;
60 float DZ=0;
61
62 for(int i=1; i<argc; i++ ) {
63 char *key = argv[i];
64
65 if (!strncmp(key,"-A=",3))
66 {
67 if(strlen(key)>3) if(idA.Set(key+3)) do_ida=true;
68 }
69 else if (!strncmp(key,"-B=",3))
70 {
71 if(strlen(key)>3) if(idB.Set(key+3)) do_idb=true;
72 }
73 else if (!strncmp(key,"-dz=",4))
74 {
75 if(strlen(key)>4) DZ = atof(key+4);
76 }
77 else if(!strncmp(key,"-v=",3))
78 {
79 if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
80 }
81 }
82
83 if(!(do_ida&&do_idb)) { print_help_message(); return 0; }
84
85 cenv.SetValue("emalign.env" , env);
86 cenv.ReadFile( cenv.GetValue("emalign.env" , "align.rootrc") ,kEnvLocal);
87 cenv.SetValue("emalign.outdir" , outdir);
88
90 sproc.eProcDirClient = cenv.GetValue("emalign.outdir","..");
91
92 cenv.WriteFile("align.save.rootrc");
93
94 EdbAffine2D aff(cenv.GetValue("emaligns2s.applyAff" , "1 0 0 1 0 0") );
95
96 if(do_ida&&do_idb) {
97 printf("\n----------------------------------------------------------------------------\n");
98 printf("align %s and %s with dz = %f\n" ,idA.AsString(), idB.AsString(), DZ);
99 printf("----------------------------------------------------------------------------\n\n");
100
101 sproc.AlignNewNopar(idA,idB,cenv,&aff, DZ);
102 }
103
104 cenv.WriteFile("align.save.rootrc");
105 return 1;
106}
Definition: EdbAffine.h:17
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
int AlignNewNopar(EdbID id1, EdbID id2, TEnv &cenv, EdbAffine2D *aff=0, float dz=0)
Definition: EdbScanProc.cxx:485
TString eProcDirClient
directory path for root data
Definition: EdbScanProc.h:14
EdbScanProc * sproc
Definition: comptonmap.cpp:29
void set_default(TEnv &cenv)
Definition: emaligns2s.cpp:28
void print_help_message()
Definition: emaligns2s.cpp:12
TEnv cenv("emrec")
const char * outdir
Definition: emrec.cpp:37
float DZ
Definition: hwinit.C:66
gEDBDEBUGLEVEL
Definition: energy.C:7

◆ print_help_message()

void print_help_message ( )
13{
14 cout<< "\nUsage: \n\t emaligns2s -A=idA -B=idB [ -dz=DZ -v=DEBUG] \n";
15 cout<< "\t Standalone alignment between 2 couples trees independent to datasets\n";
16 cout<< "\t do not requires the presence of dataset files.\n";
17 cout<< "\t Input: idA.cp.root idB.cp.root align.rootrc\n";
18 cout<< "\t Output: AFF/idA_idB.al.root .par\n";
19 cout<< "\nExample: \n";
20 cout<< "\t emaligns2s -idA=4554.11.1.1 -idB=4554.10.1.1 -dz=-1300 -v=2\n";
21 cout<< "\n If the data location directory if not explicitly defined\n";
22 cout<< " the current directory will be assumed to be the brick directory \n";
23 cout<< "\n If the parameters file (align.rootrc) is not presented - the default \n";
24 cout<< " parameters will be used. After the execution them are saved into align.save.rootrc file\n";
25 cout<<endl;
26}

◆ set_default()

void set_default ( TEnv &  cenv)
29{
30 // default parameters for the new alignment
31 cenv.SetValue("fedra.align.OffsetMax" , 1000. );
32 cenv.SetValue("fedra.align.DZ" , 250. );
33 cenv.SetValue("fedra.align.DPHI" , 0.02 );
34 cenv.SetValue("fedra.align.SigmaR" , 25. );
35 cenv.SetValue("fedra.align.SigmaT" , 0.012);
36 cenv.SetValue("fedra.align.DoFine" , 1 );
37 cenv.SetValue("fedra.readCPcut" , "eCHI2P<2.0&&s.eW>10&&eN1==1&&eN2==1&&s.Theta()>0.05&&s.Theta()<0.99");
38 cenv.SetValue("fedra.align.SaveCouples" , 1 );
39 cenv.SetValue("emaligns2s.applyAff" , "1 0 0 1 0 0");
40
41 cenv.SetValue("emalign.outdir" , ".." );
42 cenv.SetValue("emalign.env" , "align.rootrc");
43 cenv.SetValue("emalign.EdbDebugLevel" , 1 );
44}