StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtTagWriter.cc
1 /***************************************************************************
2  *
3  * Author: Frank Laue, Ohio State, laue@bnl.gov
4  ***************************************************************************
5  *
6  * Description: part of STAR HBT Framework: StHbtMaker package
7  *
8  **************************************************************************/
9 #include "StHbtMaker/Infrastructure/StHbtTagWriter.hh"
10 
11 #ifdef __ROOT__
12  ClassImp(StHbtTagWriter)
13 #endif
14 
15 StHbtTagWriter* StHbtTagWriter::_instance=0;
16 
17 StHbtTagWriter* StHbtTagWriter::Instance() {
18  if (_instance == 0 ) _instance = new StHbtTagWriter();
19  return _instance;
20 }
21 
22 StHbtTagWriter::StHbtTagWriter() { cout << " StHbtTagWriter::StHbtTagWriter() " << endl; }
23 
24 void StHbtTagWriter::Clear() {
25  for ( int i=0; i<5; i++) {
26  mHbtTag.chargedParticles_Means[i] = 0;
27  mHbtTag.chargedParticles_Sigmas[i] = 0;
28  mHbtTag.positiveParticles_Means[i] = 0;
29  mHbtTag.positiveParticles_Sigmas[i] = 0;
30  mHbtTag.negativeParticles_Means[i] = 0;
31  mHbtTag.negativeParticles_Sigmas[i] = 0;
32  mHbtTag.positivePions_Means[i] = 0;
33  mHbtTag.positivePions_Sigmas[i] = 0;
34  mHbtTag.negativePions_Means[i] = 0;
35  mHbtTag.negativePions_Sigmas[i] = 0;
36  mHbtTag.positiveKaons_Means[i] = 0;
37  mHbtTag.positiveKaons_Sigmas[i] = 0;
38  mHbtTag.negativeKaons_Means[i] = 0;
39  mHbtTag.negativeKaons_Sigmas[i] = 0;
40  mHbtTag.protons_Means[i] = 0;
41  mHbtTag.protons_Sigmas[i] = 0;
42  mHbtTag.antiProtons_Means[i] = 0;
43  mHbtTag.antiProtons_Sigmas[i] = 0;
44  }
45  cout << " StHbtTagWriter::Clear() " << endl;
46 }
47 
48 void StHbtTagWriter::SetTag(const char* c, unsigned char i, float v) {
49  if ( i<5) {
50  if ( strcmp(c,"")==0 && c!=0) /* no-op */;
51  else if ( strcmp(c,"chargedParticlesMeans")==0 ) mHbtTag.chargedParticles_Means[i] = v;
52  else if ( strcmp(c,"chargedParticlesSigmas")==0 ) mHbtTag.chargedParticles_Sigmas[i] = v;
53  else if ( strcmp(c,"positiveParticlesMeans")==0 ) mHbtTag.positiveParticles_Means[i] = v;
54  else if ( strcmp(c,"positiveParticlesSigmas")==0 ) mHbtTag.positiveParticles_Sigmas[i] = v;
55  else if ( strcmp(c,"negativeParticlesMeans")==0 ) mHbtTag.negativeParticles_Means[i] = v;
56  else if ( strcmp(c,"negativeParticlesSigmas")==0 ) mHbtTag.negativeParticles_Sigmas[i] = v;
57  else if ( strcmp(c,"positivePionsMeans")==0 ) mHbtTag.positivePions_Means[i] = v;
58  else if ( strcmp(c,"positivePionsSigmas")==0 ) mHbtTag.positivePions_Sigmas[i] = v;
59  else if ( strcmp(c,"negativePionsMeans")==0 ) mHbtTag.negativePions_Means[i] = v;
60  else if ( strcmp(c,"negativePionsSigmas")==0 ) mHbtTag.negativePions_Sigmas[i] = v;
61  else if ( strcmp(c,"positiveKaonsMeans")==0 ) mHbtTag.positiveKaons_Means[i] = v;
62  else if ( strcmp(c,"positiveKaonsSigmas")==0 ) mHbtTag.positiveKaons_Sigmas[i] = v;
63  else if ( strcmp(c,"negativeKaonsMeans")==0 ) mHbtTag.negativeKaons_Means[i] = v;
64  else if ( strcmp(c,"negativeKaonsSigmas")==0 ) mHbtTag.negativeKaons_Sigmas[i] = v;
65  else if ( strcmp(c,"protonsMeans")==0 ) mHbtTag.protons_Means[i] = v;
66  else if ( strcmp(c,"protonsSigmas")==0 ) mHbtTag.protons_Sigmas[i] = v;
67  else if ( strcmp(c,"antiProtonsMeans")==0 ) mHbtTag.antiProtons_Means[i] = v;
68  else if ( strcmp(c,"antiProtonsSigmas")==0 ) mHbtTag.antiProtons_Sigmas[i] = v;
69  else { cerr << " StHbtTagWriter::SetTag() - unrecognized tag " << endl;}
70  }
71 }
72 
73 float StHbtTagWriter::Tag(const char* c, unsigned char i) {
74  if ( i<5) {
75  if ( strcmp(c,"")==0 && c!=0) /* no-op */;
76  else if ( strcmp(c,"chargedParticlesMeans")==0 ) return mHbtTag.chargedParticles_Means[i];
77  else if ( strcmp(c,"chargedParticlesSigmas")==0 ) return mHbtTag.chargedParticles_Sigmas[i];
78  else if ( strcmp(c,"positiveParticlesMeans")==0 ) return mHbtTag.positiveParticles_Means[i];
79  else if ( strcmp(c,"positiveParticlesSigmas")==0 ) return mHbtTag.positiveParticles_Sigmas[i];
80  else if ( strcmp(c,"negativeParticlesMeans")==0 ) return mHbtTag.negativeParticles_Means[i];
81  else if ( strcmp(c,"negativeParticlesSigmas")==0 ) return mHbtTag.negativeParticles_Sigmas[i];
82  else if ( strcmp(c,"positivePionsMeans")==0 ) return mHbtTag.positivePions_Means[i];
83  else if ( strcmp(c,"positivePionsSigmas")==0 ) return mHbtTag.positivePions_Sigmas[i];
84  else if ( strcmp(c,"negativePionsMeans")==0 ) return mHbtTag.negativePions_Means[i];
85  else if ( strcmp(c,"negativePionsSigmas")==0 ) return mHbtTag.negativePions_Sigmas[i];
86  else if ( strcmp(c,"positiveKaonsMeans")==0 ) return mHbtTag.positiveKaons_Means[i];
87  else if ( strcmp(c,"positiveKaonsSigmas")==0 ) return mHbtTag.positiveKaons_Sigmas[i];
88  else if ( strcmp(c,"negativeKaonsMeans")==0 ) return mHbtTag.negativeKaons_Means[i];
89  else if ( strcmp(c,"negativeKaonsSigmas")==0 ) return mHbtTag.negativeKaons_Sigmas[i];
90  else if ( strcmp(c,"protonsMeans")==0 ) return mHbtTag.protons_Means[i];
91  else if ( strcmp(c,"protonsSigmas")==0 ) return mHbtTag.protons_Sigmas[i];
92  else if ( strcmp(c,"antiProtonsMeans")==0 ) return mHbtTag.antiProtons_Means[i];
93  else if ( strcmp(c,"antiProtonsSigmas")==0 ) return mHbtTag.antiProtons_Sigmas[i];
94  else { cerr << " StHbtTagWriter::Tag() - unrecognized tag " << endl; return 0.;}
95  }
96  return 0;
97 }
98