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[] 
)
49 {
50  if (argc < 2) { print_help_message(); return 0; }
51 
52  TEnv cenv("alignenv");
54  gEDBDEBUGLEVEL = cenv.GetValue("emalign.EdbDebugLevel" , 1);
55  const char *env = cenv.GetValue("emalign.env" , "align.rootrc");
56  const char *outdir = cenv.GetValue("emalign.outdir" , "..");
57 
58  bool do_ida = false;
59  bool do_idb = false;
60  EdbID idA,idB;
61  bool do_fa = false;
62  bool do_fb = false;
63  const char *fa=0;
64  const char *fb=0;
65 
66  float DZ=0;
67 
68  for(int i=1; i<argc; i++ ) {
69  char *key = argv[i];
70 
71  if (!strncmp(key,"-A=",3))
72  {
73  if(strlen(key)>3) if(idA.Set(key+3)) do_ida=true;
74  }
75  else if (!strncmp(key,"-B=",3))
76  {
77  if(strlen(key)>3) if(idB.Set(key+3)) do_idb=true;
78  }
79  else if (!strncmp(key,"-FA=",4))
80  {
81  if(strlen(key)>4) { fa=key+4; do_fa=true; }
82  }
83  else if (!strncmp(key,"-FB=",4))
84  {
85  if(strlen(key)>4) { fb=key+4; do_fb=true; }
86  }
87  else if (!strncmp(key,"-dz=",4))
88  {
89  if(strlen(key)>4) DZ = atof(key+4);
90  }
91  else if(!strncmp(key,"-v=",3))
92  {
93  if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
94  }
95  }
96 
97  if(!((do_ida&&do_idb)||(do_fa&&do_fb))) { print_help_message(); return 0; }
98 
99  cenv.SetValue("emalign.env" , env);
100  cenv.ReadFile( cenv.GetValue("emalign.env" , "align.rootrc") ,kEnvLocal);
101  cenv.SetValue("emalign.outdir" , outdir);
102 
104  sproc.eProcDirClient = cenv.GetValue("emalign.outdir","..");
105 
106  cenv.WriteFile("align.save.rootrc");
107 
108  EdbAffine2D aff(cenv.GetValue("emaligns2s.applyAff" , "1 0 0 1 0 0") );
109 
110  if(do_ida&&do_idb) {
111  printf("\n----------------------------------------------------------------------------\n");
112  printf("align %s and %s with dz = %f\n" ,idA.AsString(), idB.AsString(), DZ);
113  printf("----------------------------------------------------------------------------\n\n");
114 
115  sproc.AlignNewNopar(idA,idB,cenv,&aff, DZ);
116  }
117  if(do_fa&&do_fb) {
118  printf("\n----------------------------------------------------------------------------\n");
119  printf("align %s and %s with dz = %f\n" ,fa, fb, DZ);
120  printf("----------------------------------------------------------------------------\n\n");
121 
122  sproc.AlignNewCPFiles(fa,fb,cenv,&aff, DZ);
123  }
124 
125  cenv.WriteFile("align.save.rootrc");
126  return 1;
127 }
Definition: EdbAffine.h:17
Definition: EdbID.h:7
char * AsString() const
Definition: EdbID.cxx:24
bool Set(const char *id_string)
Definition: EdbID.cxx:17
Definition: EdbScanProc.h:12
int AlignNewCPFiles(const char *f1, const char *f2, TEnv &cenv, EdbAffine2D *aff=0, float dz=0)
Definition: EdbScanProc.cxx:520
int AlignNewNopar(EdbID id1, EdbID id2, TEnv &cenv, EdbAffine2D *aff=0, float dz=0)
Definition: EdbScanProc.cxx:485
TString eProcDirClient
Definition: EdbScanProc.h:14
EdbScanProc * sproc
Definition: comptonmap.cpp:29
void set_default(TEnv &cenv)
Definition: emaligns2s.cpp:29
void print_help_message()
Definition: emaligns2s.cpp:12
TEnv cenv("emrec")
const char * outdir
Definition: emrec.cpp:37
gEDBDEBUGLEVEL
Definition: energy.C:7
float DZ
Definition: hwinit.C:66

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

◆ set_default()

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