HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hrichdetector.cc
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // $Id: $
4 //
5 //*-- Author : RICH team member
6 //*-- Revised : Martin Jurkovic <martin.jurkovic@ph.tum.de> 2010
7 //
8 //_HADES_CLASS_DESCRIPTION
9 //////////////////////////////////////////////////////////////////////////////
10 //
11 // HRichDetector
12 //
13 //
14 //
15 //////////////////////////////////////////////////////////////////////////////
16 
17 
18 #include "TClass.h"
19 
20 #include "hades.h"
21 #include "hcategory.h"
22 #include "hdetpario.h"
23 #include "hlinearcategory.h"
24 #include "hmatrixcategory.h"
25 #include "hparasciifileio.h"
26 #include "hpario.h"
27 #include "hparrootfileio.h"
28 #include "hrichanalysis.h"
29 #include "hrichdetector.h"
30 #include "hrichparasciifileio.h"
31 #include "hrichparrootfileio.h"
32 #include "htaskset.h"
33 #include "richdef.h"
34 
35 #include <string.h>
36 
37 using namespace std;
38 
40 
41 HRichDetector::HRichDetector(void) : HDetector("Rich", "The RICH detector")
42 {
43 
44  maxModules = 1;
45  modules = new TArrayI(RICH_MAX_SECTORS);
46  maxComponents = RICH700_MAX_PMT; // JAM2018 must set this if you want to work with geometry parameter!
47 
48 }
49 
50 HTask* HRichDetector::buildTask(const Text_t* name,
51  const Option_t* opt)
52 {
53  if (NULL != name && 0 == strcmp(name, "default")) {
54  name = NULL;
55  }
56 
57  HTaskSet* pDetTasks = new HTaskSet("Rich", "List of Rich tasks");
58 
59  if (NULL == name) {
60  //default list of tasks
61  pDetTasks->add(new HRichAnalysis("rich.ana", "Ring finder", kFALSE));
62  return pDetTasks;
63  }
64 
65  return HDetector::buildTask(name, opt);
66 }
67 
68 HCategory* HRichDetector::buildLinearCat(const Text_t* classname,
69  const Int_t size)
70 {
71  HLinearCategory* category = NULL;
72 
73  category = new HLinearCategory(classname, size);
74  return category;
75 }
76 
77 HCategory* HRichDetector::buildMatrixCat(const Text_t* classname,
78  const Float_t fillRate)
79 {
80  Int_t sizes[3];
81  HMatrixCategory* category = NULL;
82 
83  sizes[0] = RICH_MAX_SECTORS;
84  sizes[1] = RICH700_MAX_ROWS;
85  sizes[2] = RICH700_MAX_COLS;
86 
87  category = new HMatrixCategory(classname, 3, sizes, fillRate);
88  return category;
89 }
90 
91 HCategory* HRichDetector::buildSimMatrixCat(const Text_t* classname,
92  const Float_t fillRate,
93  const Int_t size)
94 {
95 
96  HMatrixCategory *category = NULL;
97  Int_t ini[2];
98 
99  ini[0] = RICH_MAX_SECTORS;
100  ini[1] = size;
101 
102  category = new HMatrixCategory(classname, 2, ini, fillRate);
103  return category;
104 }
105 
106 // new JAM2017
107 HCategory* HRichDetector::build700MatrixCat(const Text_t* classname,
108  const Float_t fillRate)
109 {
110 
111  HMatrixCategory *category = NULL;
112  Int_t ini[2];
113 
114  ini[0] = RICH700_MAX_PMT+1; // indices in database are from 1 to RICH700_MAX_PMT, ignore 0 slot here!
115  ini[1] = RICH700_MAX_PMTPIXELS+1; // indices in database are from 1 to RICH700_MAX_PMTPIXELS, ignore 0 slot here!
116 
117  category = new HMatrixCategory(classname, 2, ini, fillRate);
118  return category;
119 }
120 
121 
122 
124 {
125  switch (cat) {
126  case catRichCal :
127  return buildMatrixCat("HRichCal", 1);
128  case catRichHit :
129  return buildLinearCat("HRichHit");
130  case catRichTrack :
131  return buildLinearCat("HRichTrack");
132  case catRichDirClus :
133  return buildMatrixCat("HRichDirClus", 0.5);
134  case catRichHitHdr :
135  return buildLinearCat("HRichHitHeader");
136  case catRich700Raw :
137  return build700MatrixCat("HRich700Raw",1);
138 
139  default:
140  return NULL;
141  }
142 }
143 
145 {
146 // Initialization according to Ilse's scheme
147 // activates the input/output class for the parameters
148 // needed by the Rich
149 
150 
151  if (0 == strncmp(io->IsA()->GetName(), "HOraIo", strlen("HOraIo"))) {
152  io->setDetParIo("HRichParIo");
153  return;
154  }
155 
156  if (0 == strncmp(io->IsA()->GetName(), "HParRootFileIo", strlen("HParRootFileIo"))) {
157  HRichParRootFileIo* p = NULL;
158  p = new HRichParRootFileIo(static_cast<HParRootFileIo*>(io)->getParRootFile());
159  io->setDetParIo(p);
160  }
161 
162  if (0 == strncmp(io->IsA()->GetName(), "HParAsciiFileIo", strlen("HParAsciiFileIo"))) {
163  HRichParAsciiFileIo* p = NULL;
164  p = new HRichParAsciiFileIo(static_cast<HParAsciiFileIo*>(io)->getFile());
165  io->setDetParIo(p);
166  }
167 
168 }
169 
171 {
172 // Writes the Rich setup to output
173 
174  HDetParIo* out = NULL;
175  out = output->getDetParIo("HRichParIo");
176  if (NULL != out)
177  return out->write(this);
178  return kFALSE;
179 }
#define RICH_MAX_SECTORS
Definition: richdef.h:4
const Cat_t catRichDirClus
Definition: richdef.h:43
const Cat_t catRichHitHdr
Definition: richdef.h:42
const Cat_t catRichHit
Definition: richdef.h:41
Short_t Cat_t
Definition: haddef.h:8
virtual void setDetParIo(HDetParIo *)
Definition: hpario.cc:34
#define RICH700_MAX_ROWS
Definition: richdef.h:13
void activateParIo(HParIo *io)
virtual HDetParIo * getDetParIo(const Text_t *)
Definition: hpario.cc:50
Definition: hpario.h:11
HCategory * buildMatrixCat(const Text_t *classname, const Float_t fillRate)
Bool_t write(HParIo *io)
#define RICH700_MAX_PMTPIXELS
Definition: richdef.h:32
HCategory * buildCategory(Cat_t cat)
return output
virtual HTask * buildTask(const Text_t *, const Option_t *)
Definition: hdetector.h:36
ClassImp(HRichDetector) HRichDetector
#define RICH700_MAX_PMT
Definition: richdef.h:33
HTask * buildTask(const Text_t name[], const Option_t *opt="")
HCategory * buildSimMatrixCat(const Text_t *classname, const Float_t fillRate, const Int_t size=200)
Bool_t add(HTask *)
Definition: htaskset.cc:82
#define RICH700_MAX_COLS
Definition: richdef.h:12
Definition: htask.h:14
virtual Int_t write(HParSet *)
Definition: hdetpario.h:30
HCategory * build700MatrixCat(const Text_t *classname, const Float_t fillRate)
const Cat_t catRich700Raw
Definition: richdef.h:45
const Cat_t catRichCal
Definition: richdef.h:40
HCategory * buildLinearCat(const Text_t *classname, const Int_t size=1000)
const Cat_t catRichTrack
Definition: richdef.h:44