FEDRA emulsion software from the OPERA Collaboration
EGraphRecProc.cxx File Reference
#include "EGraphRec.h"
#include "EdbScanProc.h"
#include "EdbVertex.h"
#include <TThread.h>
#include <iostream>
Include dependency graph for EGraphRecProc.cxx:

Functions

 ClassImp (EGraphRecProc) void *ThSBProcess(void *ptr)
 
voidThSBCheckProcess (void *ptr)
 

Function Documentation

◆ ClassImp()

ClassImp ( EGraphRecProc  )
25 {
26  EGraphRec *egraph = (EGraphRec*) ptr;
27  EdbScanProc *scanProc = egraph->GetScanProc(); // Scan Proc
28  EdbScanSet *scanSet = egraph->GetScanSet(); // Scan Set
29  EdbPattern *predTracks = egraph->GetPredTracks(); // predicted tracks
30  EdbPVRec *foundTracks = egraph->GetFoundTracks(); // found tracks
31  ProcBrick_t brickToProc = egraph->GetBrickToProc(); // Brick to process
32  ProcId_t procId = egraph->GetProcId();
33 
34  Int_t pID_IC[4] = {brickToProc.brickId, 0, brickToProc.ver,
35  procId.interCalib};
36  Int_t pID_PS[4] = {brickToProc.brickId, 0, brickToProc.ver,
37  procId.predScan};
38  Int_t pID_IC_prev[4] = {brickToProc.brickId, 0, brickToProc.ver,
39  procId.interCalib};
40  Int_t pID_PS_prev[4] = {brickToProc.brickId, 0, brickToProc.ver,
41  procId.predScan};
42 
43  Int_t firstPlate = brickToProc.firstPlate;
44  Int_t lastPlate = brickToProc.lastPlate;
45  Int_t step=(lastPlate>=firstPlate) ? brickToProc.step : -1*brickToProc.step;
46  Int_t nFailurePlates = 0;
47 
48  predTracks->Reset();
49 
50  for (Int_t plate = firstPlate; plate != lastPlate + step; plate += step) {
51 
52  pID_PS[1] = pID_IC[1] = plate;
53  pID_PS_prev[1] = pID_IC_prev[1] = plate - step;
54 
55  // get prediction for the current plate
56 
57  // scanProc->ReadPred(*predTrack, pID_PS);
58 
59  // scanning intercalibration zone
60 
61  // Checking directory (if there is no scanning)
62 
63  TString str;
64  scanProc->MakeFileName(str, pID_PS, "root");
65 
66  FileStat_t buf;
67 
68  if (gSystem->GetPathInfo(gSystem->DirName(str), buf)) {
69  cout << "ERROR! Directory " << gSystem->DirName(str)
70  << " does not exist.\n";
71  cout << "Please run scanning procedure for the plate number "
72  << pID_PS[1] << endl;
73  continue;
74  }
75 
76  // linking process
77 
78  if (egraph->IsSBToLink() && !scanProc->LinkRunAll(pID_IC)) return 0;
79 
80  // alignment process between previous and current plate
81 
82  if (egraph->IsSBToAlgn() && plate != firstPlate) {
83  if (!scanProc->SetAFFDZ(pID_IC_prev, pID_IC, 1300.*step)) return 0;
84  if (scanProc->AlignAll(pID_IC_prev, pID_IC, 1, 4, "-z") < 0) return 0;
85  }
86 
87  // Scan back mode. Search predictions.
88 
89  scanProc->CopyPar(pID_IC, pID_PS);
90 
91  if (plate != firstPlate) {
92  scanProc->CopyAFFPar(pID_IC_prev, pID_IC, pID_PS_prev, pID_PS);
93  scanProc->ProjectFound(pID_PS_prev, pID_PS);
94  }
95 
96  // adding scanned plate to the brick
97  // read affine and assemble "EdbBrickP" object
98 
99  if (scanSet->AddID(new EdbID(pID_PS), step)) {
100  if (scanProc->AssembleScanSet(*scanSet) < 1) return 0;
101  scanSet->SetAsReferencePlate(firstPlate);
102  }
103 
104  // after scann
105 
106  foundTracks->ResetTracks();
107  scanProc->ReadFoundTracks(*scanSet, *foundTracks);
108 
109  // come back to previous scanned plate + 1 if there are no tracks were
110  // found
111 
112  EdbPattern pat;
113  if (!scanProc->ReadFound(pat, pID_PS)) {
114  if (Abs(step) != 1) {
115  plate += -step + (step > 0 ? 1 : -1);
116  if (!nFailurePlates) plate += step;
117  }
118  nFailurePlates++;
119  cout << "Track does not found in the plate " << plate
120  << ". starting scann plate " << plate + step << endl;
121  }
122  else nFailurePlates = 0;
123 
124  egraph->DrawEvent();
125 
126  if (nFailurePlates == 3) {
127  cout << "There are no any tracks during " << nFailurePlates
128  << "plates. Stop scanning" << endl;
129  return 0;
130  }
131  }
132 
133  return 0;
134 }
Definition: EGraphRec.h:24
EdbPattern * GetPredTracks() const
Definition: EGraphRec.h:58
ProcBrick_t GetBrickToProc() const
Definition: EGraphRec.h:54
void DrawEvent()
Definition: EGraphRec.cxx:141
Bool_t IsSBToLink() const
Definition: EGraphRec.h:52
EdbScanSet * GetScanSet() const
Definition: EGraphRec.h:57
ProcId_t GetProcId() const
Definition: EGraphRec.h:55
EdbScanProc * GetScanProc() const
Definition: EGraphRec.h:56
Bool_t IsSBToAlgn() const
Definition: EGraphRec.h:53
EdbPVRec * GetFoundTracks() const
Definition: EGraphRec.h:59
Definition: EdbID.h:7
Definition: EdbPVRec.h:148
void ResetTracks()
Definition: EdbPVRec.cxx:962
Definition: EdbPattern.h:280
void Reset()
Definition: EdbPattern.cxx:1632
Definition: EdbScanProc.h:12
int CopyPar(EdbID id1, EdbID id2, bool overwrite=true)
Definition: EdbScanProc.h:48
int ReadFoundTracks(EdbScanSet &ss, EdbPVRec &ali, int flag=-1)
Definition: EdbScanProc.cxx:220
bool SetAFFDZ(int id1[4], int id2[4], float dz)
Definition: EdbScanProc.cxx:1093
int AlignAll(int id1[4], int id2[4], int npre=1, int nfull=3, const char *opt="-z")
Definition: EdbScanProc.cxx:2661
int CopyAFFPar(int id1c[4], int id2c[4], int id1p[4], int id2p[4], bool overwrite=true)
Definition: EdbScanProc.cxx:1015
int LinkRunAll(int id[4], int npre=3, int nfull=1, int correct_ang=1)
Definition: EdbScanProc.cxx:1104
int ReadFound(EdbPattern &pred, int id[4], int flag=-1)
Definition: EdbScanProc.h:70
void MakeFileName(TString &s, int id[4], const char *suffix, bool inplate=true)
Definition: EdbScanProc.cxx:1885
int AssembleScanSet(EdbScanSet &ss)
Definition: EdbScanProc.cxx:134
bool ProjectFound(int id1[4], int id2[4])
Definition: EdbScanProc.cxx:1135
Definition: EdbScanSet.h:11
Bool_t SetAsReferencePlate(Int_t pid)
Definition: EdbScanSet.cxx:191
Bool_t AddID(EdbID *id, Int_t step)
Definition: EdbScanSet.cxx:493
Int_t plate
Definition: merge_Energy_SytematicSources_Electron.C:1
Definition: EGraphRecProc.h:15
Int_t brickId
Definition: EGraphRecProc.h:16
Int_t step
Definition: EGraphRecProc.h:20
Int_t firstPlate
Definition: EGraphRecProc.h:17
Int_t ver
Definition: EGraphRecProc.h:19
Int_t lastPlate
Definition: EGraphRecProc.h:18
Definition: EGraphRecProc.h:25
Int_t predScan
Definition: EGraphRecProc.h:28
Int_t interCalib
Definition: EGraphRecProc.h:26

◆ ThSBCheckProcess()

void* ThSBCheckProcess ( void ptr)
139 {
140  // Set enable "Execute Event" button after finishing process
141 
142  EGraphRec *egraph = (EGraphRec*) ptr;
143  TThread *thread = egraph->GetThSBProcess();
144  egraph->GetThSBProcess()->Join(); // Join ThSBProcess
145  egraph->GetButtonSBStart()->SetEnabled(kTRUE); // Enable button
146  SafeDelete(thread);
147  return 0;
148 }
TGTextButton * GetButtonSBStart()
Definition: EGraphRec.h:61
TThread * GetThSBProcess() const
Definition: EGraphRec.h:60