FEDRA emulsion software from the OPERA Collaboration
empred.cpp File Reference
#include <string.h>
#include <iostream>
#include <TEnv.h>
#include "EdbLog.h"
#include "EdbScanProc.h"
#include "EdbScanTracking.h"
Include dependency graph for empred.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[] 
)
37{
38 TEnv cenv("predenv");
40 gEDBDEBUGLEVEL = cenv.GetValue("empred.EdbDebugLevel" , 1);
41 const char *outdir = cenv.GetValue("empred.outdir" , "..");
42
43 if (argc < 2) { print_help_message(); cenv.Print(); return 0; }
44
45 bool do_set1 = false;
46 bool do_set2 = false;
47 int plate=0;
48 EdbID idset1,idset2;
49
50 for(int i=1; i<argc; i++ ) {
51 char *key = argv[i];
52
53 if (!strncmp(key,"-set1=",6))
54 {
55 if(strlen(key)>6) if(idset1.Set(key+6)) do_set1=true;
56 }
57 else if(!strncmp(key,"-set2=",6))
58 {
59 if(strlen(key)>6) if(idset2.Set(key+6)) do_set2=true;
60 }
61 else if(!strncmp(key,"-plate=",7))
62 {
63 if(strlen(key)>4) { plate = atoi(key+7); }
64 }
65 else if(!strncmp(key,"-o=",3))
66 {
67 if(strlen(key)>3) outdir=key+3;
68 }
69 else if(!strncmp(key,"-v=",3))
70 {
71 if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
72 }
73 }
74
75 if(!do_set1) { print_help_message(); cenv.Print(); return 0; }
76
77 cenv.ReadFile( cenv.GetValue("empred.env" , "empred.rootrc") ,kEnvLocal);
78 cenv.SetValue("empred.outdir" , outdir);
79 cenv.WriteFile("empred.save.rootrc");
80
83 printf("\n----------------------------------------------------------------------------\n");
84 printf("prepare predictions %s for the plate %d\n", idset1.AsString(), plate );
85 printf("----------------------------------------------------------------------------\n\n");
86
87 EdbScanSet *ss1 = sproc.ReadScanSet(idset1);
88
89 TCut cut = cenv.GetValue("empred.trcut" ,"nseg>2");
91 sproc.ReadTracksTree(idset1, ali, cut);
92
93 if(do_set2)
94 {
95 EdbID fromid(idset1); fromid.ePlate = plate;
96 EdbID predid(idset2); predid.ePlate = plate;
97 EdbLayer la;
98 sproc.ReadAffToLayer( la, fromid, predid );
99 EdbLayer *layer = ss1->GetPlate(plate);
100 layer->SubstructCorrections(la);
101 int n = sproc.MakeTracksPred( *(ali.eTracks), predid, *layer);
102 Log(1,"empred","%d predictions found using cut %s",n,cut.GetTitle());
103 }
104 else
105 {
106 EdbID predid(idset1); predid.ePlate = plate;
107 EdbLayer *layer = ss1->GetPlate(plate);
108 int n = sproc.MakeTracksPred( *(ali.eTracks), predid, *layer);
109 layer->Print();
110 Log(1,"empred","%d predictions found using cut %s",n,cut.GetTitle());
111 }
112
113 cenv.WriteFile("empred.save.rootrc");
114
115 return 1;
116}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
Definition: EdbID.h:7
char * AsString() const
Definition: EdbID.cxx:26
bool Set(const char *id_string)
Definition: EdbID.cxx:19
Definition: EdbLayer.h:39
void SubstructCorrections(EdbLayer &la)
Definition: EdbLayer.cxx:102
void Print()
Definition: EdbLayer.cxx:149
Definition: EdbPVRec.h:148
TObjArray * eTracks
Definition: EdbPVRec.h:161
scanned data processing
Definition: EdbScanProc.h:12
bool ReadAffToLayer(EdbLayer &la, EdbID id1, EdbID id2)
Definition: EdbScanProc.cxx:65
int MakeTracksPred(TObjArray &tracks, EdbID id, EdbLayer &layer)
Definition: EdbScanProc.cxx:3265
int ReadTracksTree(EdbID id, EdbPVRec &ali, TCut cut="1")
Definition: EdbScanProc.cxx:604
TString eProcDirClient
directory path for root data
Definition: EdbScanProc.h:14
EdbScanSet * ReadScanSet(EdbID id)
Definition: EdbScanProc.cxx:1482
Definition: EdbScanSet.h:11
EdbPlateP * GetPlate(Int_t p)
Definition: EdbScanSet.h:56
EdbScanProc * sproc
Definition: comptonmap.cpp:29
void set_default(TEnv &cenv)
Definition: empred.cpp:27
void print_help_message()
Definition: empred.cpp:12
TEnv cenv("emrec")
const char * outdir
Definition: emrec.cpp:37
TCut cut
Definition: check_shower.C:6
gEDBDEBUGLEVEL
Definition: energy.C:7
EdbPVRec * ali
Definition: test_oracle.C:9
Int_t plate
Definition: merge_Energy_SytematicSources_Electron.C:1

◆ print_help_message()

void print_help_message ( )
13{
14 cout<< "\nUsage: \n\t empred -set1=ID1 -plate=P [ -set2=ID2 -o=DATA_DIRECTORY -v=DEBUG] \n\n";
15 cout<< "\t\t ID1 - id of the tracks tree formed as BRICK.PLATE.MAJOR.MINOR \n";
16 cout<< "\t\t P - id of the prediction plate\n";
17 cout<< "\t\t ID2 - optional: id of the target dataset \n";
18 cout<< "\t\t -o - the data directory\n";
19 cout<< "\nExample: \n";
20 cout<< "\t emtra -set1=4554.0.1.0 -plate=1 -set2=4554.0.1.100 \n";
21 cout<< "\t\t In this example predictions produced starting from 4554.10.1.0.trk.root for plate 1,\n\t\t applied the affine transformation (if any) 4554.0.1.0_4554.0.1.100.aff.par \n\t\t and produce predictions as p001/4554.1.1.100.pred.root \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<<endl;
25}

◆ set_default()

void set_default ( TEnv &  cenv)
28{
29 // default parameters for predictions preparation
30 cenv.SetValue("empred.trcut" , "nseg>2");
31 cenv.SetValue("empred.outdir" , "..");
32 cenv.SetValue("empred.env" , "empred.rootrc");
33 cenv.SetValue("empred.EdbDebugLevel" , 1);
34}