HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hmdccutstat.cc
Go to the documentation of this file.
1 //*-- AUTHOR : Jochen Markert
2 
3 //_HADES_CLASS_DESCRIPTION
4 ///////////////////////////////////////////////////////////////
5 //HMdcCutStat
6 //
7 // class for statistics on cut time1, time2 and time2-time1
8 // and wires less than 4 per module
9 //////////////////////////////////////////////////////////////
10 
11 #include "hmdccutstat.h"
12 #include "hades.h"
13 #include "hruntimedb.h"
14 #include "hmdcparasciifileio.h"
15 #include "hpario.h"
16 #include "hmdcdetector.h"
17 #include "hspectrometer.h"
18 
20 HMdcCutStat::HMdcCutStat(const Char_t* name,const Char_t* title,
21  const Char_t* context,Int_t s,Int_t m)
22  : HParSet(name,title,context), fSecs(s)
23 {
24  fMdcCutStat=this;
25  for (Int_t i=0;i<s; i++) fSecs.AddAt(new HMdcCutStatSec(m),i);
26  setNameTitle();
27  if (gHades) {
28  fMdc = (HMdcDetector*)(((HSpectrometer*)(gHades->getSetup()))->getDetector("Mdc"));
29  } else {
30  fMdc = 0;
31  }
32 }
34 {}
36 {
37  return fMdcCutStat;
38 }
40 {
42  return fMdcCutStat;
43 }
45 {
46  if(fMdcCutStat) delete fMdcCutStat;
47  fMdcCutStat=0;
48 }
50 {
51  for (Int_t i=0;i<getSize();i++)
52  {
53  HMdcCutStatSec &sector = (*this)[i];
54  for (Int_t m=0; m<sector.getSize(); m++)
55  {
56  HMdcCutStatMod &mod = sector[m];
57  mod.clear();
58  }
59  }
60 }
62 {
63  strcpy(detName,"Mdc");
64 }
65 void HMdcCutStat::getCal1StatCut(Int_t s,Int_t mod, Int_t *cT1, Int_t *cT2,
66  Int_t *cT12, Int_t *cWire,Int_t* cT1T12,Int_t* cBump,Int_t* cAll,Int_t* all)
67 { // returns values of different cut statistics to Int_t*
68  // cT1 : cut in T1
69  // cT2 : cut in T2
70  // cT12 : cut in T2-T1
71  // cWire : cut in number of Wires <4
72  // cT1T12 : cut in T1 and T2-T1
73  // cBump : cut in T1 and T2-T1
74  // cAll : all cuts
75  // all : all hits
76 
77  HMdcCutStatMod &m = (*this)[s][mod];
78  *cT1 = m.getCal1StatCutT1();
79  *cT2 = m.getCal1StatCutT2();
80  *cT12 = m.getCal1StatCutT12();
81  *cWire = m.getCal1StatCutWire();
82  *cT1T12 = m.getCal1StatCutT1T12();
83  *cBump = m.getCal1StatCutBump();
84  *cAll = m.getCal1StatCutAll();
85  *all = m.getCal1StatAll();
86 }
87 void HMdcCutStat::setCal1StatCut(Int_t s,Int_t mod, Int_t cT1, Int_t cT2,
88  Int_t cT12,Int_t cBump, Int_t cWire)
89 {
90  // counts up values of different cut statistics
91  // cT1 : cut in T1
92  // cT2 : cut in T2
93  // cT12 : cut in T2-T1
94  // cWire : cut in number of Wires <4
95  // cT1T12 : cut in T1 and T2-T1 internaly filled
96  // cBump : cut in T1 and T2-T1 internaly filled
97  // cAll : all cuts internaly filled
98  // all : all hits internaly filled
99 
100  HMdcCutStatMod &m = (*this)[s][mod];
101  if(cT1==1) m.setCal1StatCutT1();
102  if(cT2==1) m.setCal1StatCutT2();
103  if(cT12==1) m.setCal1StatCutT12();
104  if(cWire==1) m.setCal1StatCutWire();
105  if(cT1==1 ||
106  cT12==1) m.setCal1StatCutT1T12();
107  if(cBump==1) m.setCal1StatCutBump();
108  if(cT1==1 ||
109  cT2==1 ||
110  cT12==1 ||
111  cBump==1 ||
112  cWire==1) m.setCal1StatCutAll();
113  m.setCal1StatAll();
114 }
115 Bool_t HMdcCutStat::init(HParIo* inp,Int_t* set) {
116  // intitializes the container from an input
117  HDetParIo* input=inp->getDetParIo("HMdcParIo");
118  if (input) return (input->init(this,set));
119  return kFALSE;
120 }
122  // writes the container to an output
123  HDetParIo* out=output->getDetParIo("HMdcParIo");
124  if (out) return out->write(this);
125  return -1;
126 }
127 void HMdcCutStat::putAsciiHeader(TString& b) {
128  b =
129  "#######################################################################\n"
130  "# Statistic onDrift time cuts for noise reduction of the MDC\n"
131  "# Format:\n"
132  "# sector mod ct1 ct2 ct12 cwires ct1t12 cbump call all \n"
133  "#######################################################################\n";
134 }
135 Bool_t HMdcCutStat::writeline(Char_t*buf, Int_t s, Int_t m) {
136  Bool_t r = kTRUE;
137  if (fMdc) {
138  if (fMdc->getModule(s,m) != 0) {
139  if (s>-1 && s<getSize()) {
140  HMdcCutStatSec &sector = (*this)[s];
141  if (m>-1 && m<sector.getSize()) {
142  sprintf(buf,"%i %i %i %i %i %i %i %i %i %i \n",
143  s,m,
144  (*this)[s][m].getCal1StatCutT1(),
145  (*this)[s][m].getCal1StatCutT2(),
146  (*this)[s][m].getCal1StatCutT12(),
147  (*this)[s][m].getCal1StatCutWire(),
148  (*this)[s][m].getCal1StatCutT1T12(),
149  (*this)[s][m].getCal1StatCutBump(),
150  (*this)[s][m].getCal1StatCutAll(),
151  (*this)[s][m].getCal1StatAll());
152 
153  } else r = kFALSE;
154  } else r = kFALSE;
155  } else { strcpy(buf,""); }
156  }
157  return r;
158 }
void setNameTitle()
Definition: hmdccutstat.cc:61
void setCal1StatCutT1()
Definition: hmdccutstat.h:25
Int_t getCal1StatCutBump(void)
Definition: hmdccutstat.h:54
Text_t detName[20]
Definition: hparset.h:11
Int_t getCal1StatCutWire(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:152
void setCal1StatCutT12()
Definition: hmdccutstat.h:31
Int_t getCal1StatCutT12(void)
Definition: hmdccutstat.h:51
virtual Int_t getModule(Int_t sector, Int_t mod)
Definition: hdetector.cc:85
Int_t getSize()
Definition: hmdccutstat.h:116
virtual Bool_t init(HParSet *, Int_t *)
Definition: hdetpario.h:27
HMdcDetector * fMdc
Definition: hmdccutstat.h:124
Bool_t writeline(Char_t *, Int_t, Int_t)
Definition: hmdccutstat.cc:135
ClassImp(HDbColumn) HDbColumn
Definition: hdbcolumn.cc:18
Int_t getCal1StatCutT2(void)
Definition: hmdccutstat.h:50
virtual HDetParIo * getDetParIo(const Text_t *)
Definition: hpario.cc:50
Int_t getSize()
Definition: hmdccutstat.h:178
Int_t getCal1StatCutWire(void)
Definition: hmdccutstat.h:52
Definition: hpario.h:11
virtual Int_t write()
Definition: hparset.cc:119
TString input
Definition: GarReader.C:5
Int_t getCal1StatCutT2(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:146
void clear(void)
Definition: hmdccutstat.cc:49
HSpectrometer * getSetup(void)
Definition: hades.h:112
Int_t getCal1StatAll(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:161
void setCal1StatCutT1T12()
Definition: hmdccutstat.h:37
Definition: hparset.h:9
Hades * gHades
Definition: hades.cc:1213
void setCal1StatCut(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t)
Definition: hmdccutstat.cc:87
Int_t getCal1StatCutT1(void)
Definition: hmdccutstat.h:49
void setCal1StatCutAll()
Definition: hmdccutstat.h:43
return output
static HMdcCutStat * fMdcCutStat
Definition: hmdccutstat.h:125
Int_t getCal1StatAll(void)
Definition: hmdccutstat.h:56
Int_t getCal1StatCutT1(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:143
HMdcCutStat(const Char_t *name="MdcCutStat", const Char_t *title="Statistic on Cuts on time1, time2 & time2-time1 and wires<4", const Char_t *context="", Int_t secs=6, Int_t mods=4)
Definition: hmdccutstat.cc:20
void putAsciiHeader(TString &)
Definition: hmdccutstat.cc:127
void setCal1StatCutBump()
Definition: hmdccutstat.h:40
void setCal1StatCutWire()
Definition: hmdccutstat.h:34
static HMdcCutStat * getExObject()
Definition: hmdccutstat.cc:35
void setCal1StatCutT2()
Definition: hmdccutstat.h:28
void setCal1StatAll()
Definition: hmdccutstat.h:46
virtual Int_t write(HParSet *)
Definition: hdetpario.h:30
Int_t getCal1StatCutT1T12(void)
Definition: hmdccutstat.h:53
Int_t getCal1StatCutT1T12(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:155
TObjArray fSecs
Definition: hmdccutstat.h:122
static void deleteHMdcCutStat()
Definition: hmdccutstat.cc:44
static HMdcCutStat * getObject()
Definition: hmdccutstat.cc:39
void getCal1StatCut(Int_t, Int_t, Int_t *, Int_t *, Int_t *, Int_t *, Int_t *, Int_t *, Int_t *, Int_t *)
Definition: hmdccutstat.cc:65
Int_t getCal1StatCutAll(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:158
Int_t getCal1StatCutT12(Int_t sec, Int_t mod)
Definition: hmdccutstat.h:149
void clear(void)
Definition: hmdccutstat.h:78
Int_t getCal1StatCutAll(void)
Definition: hmdccutstat.h:55
virtual Bool_t init(void)
Definition: hparset.h:21