HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hexample.cxx
Go to the documentation of this file.
1 //
2 // File \ref hexample.cxx
3 // Demo code for harpo analyse framework in C++ and Root
4 // Runs noise suppression, clustering, tracking and dummy analysis
5 //
6 //
7 //
8 //
9 
10 #include <stdlib.h>
11 #include <stdio.h>
12 
13 #include "HarpoConfig.h"
14 #include "HarpoReader.h"
15 #include "HarpoRunHeader.h"
16 #include "HarpoAnalyseTemplate.h"
18 #include "HarpoAnalyseWriter.h"
19 #include "HarpoClustering.h"
20 #include "HarpoHoughTracking.h"
21 
22 int main(int argc, char **argv)
23 {
24  Long_t processed = -1; // Processed events counter , negative on error
25 
26  HarpoRunHeader *hdr;
27 
28  HarpoConfig *cfg = new HarpoConfig(argc,argv,0x03);
29  cfg->Init();
30 
31  cfg->print();
32 
33  HarpoReader *rdr = new HarpoReader( cfg );
34  if ( rdr->Init(hSyncTime) ) {
35  hdr = rdr->GetRunHeader();
36  //hdr->print();
37  }
38  else
39  {
40  printf ("Int ERROR exiting ...\n");
41  return 1;
42  }
43 
44  HarpoAnalyseWriter *hanawr = new HarpoAnalyseWriter();
46  HarpoClustering* hanacl = new HarpoClustering();
47  HarpoHoughTracking* hanatr = new HarpoHoughTracking();
49 
50  hana-> Init(); // if errors ???
51  hanabl-> Init(); // if errors ???
52  hanacl-> Init(); // if errors ???
53  hanatr-> Init(); // if errors ???
54  hanawr-> Init(); // if errors ???
55  hanawr->SetRunHeader(hdr);
56 
57 
58  rdr->AddAnalyseFunction(hanabl);
59  rdr->AddAnalyseFunction(hanacl);
60  rdr->AddAnalyseFunction(hanatr);
61  rdr->AddAnalyseFunction(hana);
62  rdr->AddAnalyseFunction(hanawr);
63 
64  processed = rdr->LoopAll();
65 
66  // hana->Fit();
67  hanawr->Save();
68  hana->Save();
69  //rdr->Delete();
70  delete hana;
71  delete rdr;
72  delete cfg;
73  printf("\n Done processed Events %li\n",processed);
74 
75  return 0;
76 }
void Save(char *mode=NULL)
void AddAnalyseFunction(HarpoAnalyse *func)
Definition: HarpoReader.h:56
Dummy analysis to run as test and example. Give basic histograms of the data.
Analysis and suppression of baseline fluctuations.
Bool_t Init(hReadMode mode=hSyncTime)
Definition: HarpoReader.h:73
void Save(char *mode=NULL)
A class hold HARPO run iformation.
A class which instantiate the real top level reader.
Definition: HarpoReader.h:33
Long_t LoopAll()
Read errors.
Definition: HarpoReader.h:79
void Init()
Definition: HarpoConfig.h:63
int main(int argc, char **argv)
Definition: hexample.cxx:22
A class which write harpo events to ROOT Tree.
A virtual class which define intrafece between HARPO Reader and Event Analysis code.
void print() const
Read config file in libconfig format.
HarpoRunHeader * GetRunHeader()
Definition: HarpoReader.h:70
void SetRunHeader(HarpoRunHeader *hdr)
Definition: HarpoAnalyse.h:60
Clustering algorithm, runs on RAW data (HarpoMap), produces HarpoRecoClusters objects.
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50