HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
heventpr.cxx
Go to the documentation of this file.
1 /*
2  * Look for Event by number and print event map if found
3  */
4 #include <cstdlib>
5 #include <cstdio>
6 #include <iostream>
7 
8 #include "HarpoConfig.h"
9 #include "HarpoReader.h"
10 #include "HarpoRunHeader.h"
11 #include "HarpoEvent.h"
12 #include "Pmm2Event.h"
13 
14 int main(int argc, char **argv)
15 {
16  std::cout << "Starting" << std::endl;
17 
18  Bool_t found = false;
19  HarpoRunHeader *hdr;
20 
21  HarpoConfig *cfg = new HarpoConfig(argc,argv);
22  cfg->Init(); // Last call before Get.., Reading Config file not hire
23 
24  cfg->print();
25 
26  //exit(0);
27 
28  HarpoReader *rdr = new HarpoReader( cfg );
29 
30  if ( rdr->Init() ) {
31  hdr = rdr->GetRunHeader();
32  hdr->print();
33  }
34  else
35  {
36  printf ("Int ERROR exiting ...\n");
37  return 1;
38  }
39 
40  //if ( rdr->NextEvent() ) printf("\n Next Event OK\n");
41  std::cout << "Finding event " << cfg->GetNEvent() << std::endl;
42  found = rdr->Find(cfg->GetNEvent());
43  if (found) {
44  std::cout << "Event " << cfg->GetNEvent() << " found." << std::endl;
45  HarpoEvent *evt = rdr->GetEvent();
46  evt->print();
47 
48  ULong_t ndet;
49  for(ndet=0;ndet<gkNDetectors;ndet++) {
50  if (gHDetSet->isExist(ndet)) {
51  std::cout << "Found " << HarpoDet(ndet).GetDescription()
52  << " data for event " << cfg->GetNEvent() << std::endl;
53  evt->GetDetEvent(ndet)->print();
54  if ((ndet == XDCC) || ( ndet == YDCC )) {
55  HarpoDccMap * m = evt->GetDccMap(ndet);
56  if ( m != NULL ) {
57  m->print();
58  } else {
59  std::cout << "No Data Map for plane "<< ndet << std::endl;
60  }
61  } else if ( ndet == PMM2 ) {
62  // Pmm2Event *anaEvt =static_cast<Pmm2Event *>(evt->GetDetEvent(ndet));
63  // anaEvt->print();
64  } else {
65  // std::cout << "Found " << HarpoDet(ndet).GetDescription()
66  // << " data for event " << cfg->GetNEvent() << std::endl;
67  }
68 
69  }
70  }
71  }
72  else
73  {
74  std::cout << "Event " << cfg->GetNEvent() << " no found." << std::endl;
75  }
76 
77  std::cout << " Done after event " << rdr->GetReadEvts()
78  << " ( EOF ) : " << rdr->isDone()
79  << " Err " << rdr->isError() << std::endl;
80  return 0;
81 }
82 
83 
84 
85 
Dcc Plane Y.
Definition: HarpoDet.h:20
Bool_t isError()
Read errors.
Definition: HarpoReader.h:77
Long_t Find(Long_t eventNo)
Find raw event by event number.
Definition: HarpoReader.h:82
void print()
Definition: HarpoEvent.cxx:123
int main(int argc, char **argv)
Definition: heventpr.cxx:14
Bool_t Init(hReadMode mode=hSyncTime)
Definition: HarpoReader.h:73
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
Dcc Plane X.
Definition: HarpoDet.h:19
A class hold HARPO run iformation.
A class which instantiate the real top level reader.
Definition: HarpoReader.h:33
Bool_t isDone()
EOF reached.
Definition: HarpoReader.h:75
virtual void print()
Base class for all Harpo Detectors.
Definition: HarpoDet.h:27
void Init()
Definition: HarpoConfig.h:63
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
Definition: HarpoDccMap.h:29
HarpoDetEvent * GetDetEvent(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:93
void print() const
HarpoEvent * GetEvent()
Definition: HarpoReader.h:68
Unknown Detector.
Definition: HarpoDet.h:18
Long64_t GetNEvent()
Get Event number with we looking for.
Definition: HarpoConfig.h:124
Long_t GetReadEvts()
Number of readed events.
Definition: HarpoReader.h:87
void print() const
Read config file in libconfig format.
A class store HARPO row event data and header. Provide access metods to the row event data...
Definition: HarpoEvent.h:29
const char * GetDescription() const
Definition: HarpoDet.h:34
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:108
HarpoRunHeader * GetRunHeader()
Definition: HarpoReader.h:70
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71