ROOT logo
//////////////////////////////////////////////////////////////////////////////
//
// @(#)hydraTrans/richNew:$Id: $
//*-- Author: Martin Jurkovic   2010
//
//_HADES_CLASS_DESCRIPTION
//////////////////////////////////////////////////////////////////////////////
//
//  HRichThresholdPar
//
//  Parameter container for threshold data.
//
//////////////////////////////////////////////////////////////////////////////

#include "hdetpario.h"
#include "hpario.h"
#include "hrichthresholdpar.h"
#include "richdef.h"

#include <fstream>

using namespace std;

ClassImp(HRichThresholdPar)

HRichThresholdPar::HRichThresholdPar(const Char_t* name,
                                     const Char_t* title,
                                     const Char_t* context)
   : HParSet(name, title, context)
{
   clear();
}

void HRichThresholdPar::clear()
{
// initialize all parameters to -1

   fCalParVers = -1;

   for (Int_t i = 0; i < 6; ++i) {
      fSigmaMultiplier[i]  = -1;
   }

   status = kFALSE;
   resetInputVersions();
}

Bool_t HRichThresholdPar::init(HParIo* inp, Int_t* set)
{
// Initializes the container from an input

   HDetParIo* input = inp->getDetParIo("HRichParIo");
   if (NULL != input) {
      Bool_t returnValue = input->init(this, set);
      cout << "==> Return value: " << returnValue << endl;
#if DEBUG_LEVEL > 3
      printParams();
#endif
      return returnValue;
   }
   return kFALSE;
}

Int_t HRichThresholdPar::write(HParIo* output)
{
// Writes the container to an output

   HDetParIo* out = output->getDetParIo("HRichParIo");
   if (NULL != out) {
      return out->write(this);
   }
   return -1;
}

Bool_t HRichThresholdPar::readline(const Char_t * buf)
{
// Decodes one line read from ASCII file I/O and fills the cells

   cout << "==> Reading line..." << endl;

   sscanf(buf, "%d %f %f %f %f %f %f", &fCalParVers,
          &fSigmaMultiplier[0],
          &fSigmaMultiplier[1],
          &fSigmaMultiplier[2],
          &fSigmaMultiplier[3],
          &fSigmaMultiplier[4],
          &fSigmaMultiplier[5]);
   return kTRUE;
}

void HRichThresholdPar::write(fstream& fout)
{
// Writes the Rich Threshold Parameters to an ASCII file.

   fout.width(8);
   fout << left << fCalParVers;
   for (Int_t sec = 0; sec < 6; ++sec) {
      fout.width(6);
      fout << left << fSigmaMultiplier[sec];
   }
   fout << endl;
   fout << "#########################################################################" << endl;

}

void HRichThresholdPar::printParams()
{
// Prints the lookup table

   TString header;
   putAsciiHeader(header);
   cout << header;

   cout.width(8);
   cout << left << fCalParVers;
   for (Int_t sec = 0; sec < 6; ++sec) {
      cout.width(6);
      cout << left << fSigmaMultiplier[sec];
   }
   cout << endl;
   cout << "#########################################################################" << endl;

}

void HRichThresholdPar::putAsciiHeader(TString& header)
{
   // puts the ASCII header to the string used in HSpecParAsciiFileIo
   header =
      "#########################################################################\n"
      "# Format:\n"
      "# first parameter:      CalParVer\n"
      "# remaining parameters: sigma multiplier for 6 sectors\n";
}
 hrichthresholdpar.cc:1
 hrichthresholdpar.cc:2
 hrichthresholdpar.cc:3
 hrichthresholdpar.cc:4
 hrichthresholdpar.cc:5
 hrichthresholdpar.cc:6
 hrichthresholdpar.cc:7
 hrichthresholdpar.cc:8
 hrichthresholdpar.cc:9
 hrichthresholdpar.cc:10
 hrichthresholdpar.cc:11
 hrichthresholdpar.cc:12
 hrichthresholdpar.cc:13
 hrichthresholdpar.cc:14
 hrichthresholdpar.cc:15
 hrichthresholdpar.cc:16
 hrichthresholdpar.cc:17
 hrichthresholdpar.cc:18
 hrichthresholdpar.cc:19
 hrichthresholdpar.cc:20
 hrichthresholdpar.cc:21
 hrichthresholdpar.cc:22
 hrichthresholdpar.cc:23
 hrichthresholdpar.cc:24
 hrichthresholdpar.cc:25
 hrichthresholdpar.cc:26
 hrichthresholdpar.cc:27
 hrichthresholdpar.cc:28
 hrichthresholdpar.cc:29
 hrichthresholdpar.cc:30
 hrichthresholdpar.cc:31
 hrichthresholdpar.cc:32
 hrichthresholdpar.cc:33
 hrichthresholdpar.cc:34
 hrichthresholdpar.cc:35
 hrichthresholdpar.cc:36
 hrichthresholdpar.cc:37
 hrichthresholdpar.cc:38
 hrichthresholdpar.cc:39
 hrichthresholdpar.cc:40
 hrichthresholdpar.cc:41
 hrichthresholdpar.cc:42
 hrichthresholdpar.cc:43
 hrichthresholdpar.cc:44
 hrichthresholdpar.cc:45
 hrichthresholdpar.cc:46
 hrichthresholdpar.cc:47
 hrichthresholdpar.cc:48
 hrichthresholdpar.cc:49
 hrichthresholdpar.cc:50
 hrichthresholdpar.cc:51
 hrichthresholdpar.cc:52
 hrichthresholdpar.cc:53
 hrichthresholdpar.cc:54
 hrichthresholdpar.cc:55
 hrichthresholdpar.cc:56
 hrichthresholdpar.cc:57
 hrichthresholdpar.cc:58
 hrichthresholdpar.cc:59
 hrichthresholdpar.cc:60
 hrichthresholdpar.cc:61
 hrichthresholdpar.cc:62
 hrichthresholdpar.cc:63
 hrichthresholdpar.cc:64
 hrichthresholdpar.cc:65
 hrichthresholdpar.cc:66
 hrichthresholdpar.cc:67
 hrichthresholdpar.cc:68
 hrichthresholdpar.cc:69
 hrichthresholdpar.cc:70
 hrichthresholdpar.cc:71
 hrichthresholdpar.cc:72
 hrichthresholdpar.cc:73
 hrichthresholdpar.cc:74
 hrichthresholdpar.cc:75
 hrichthresholdpar.cc:76
 hrichthresholdpar.cc:77
 hrichthresholdpar.cc:78
 hrichthresholdpar.cc:79
 hrichthresholdpar.cc:80
 hrichthresholdpar.cc:81
 hrichthresholdpar.cc:82
 hrichthresholdpar.cc:83
 hrichthresholdpar.cc:84
 hrichthresholdpar.cc:85
 hrichthresholdpar.cc:86
 hrichthresholdpar.cc:87
 hrichthresholdpar.cc:88
 hrichthresholdpar.cc:89
 hrichthresholdpar.cc:90
 hrichthresholdpar.cc:91
 hrichthresholdpar.cc:92
 hrichthresholdpar.cc:93
 hrichthresholdpar.cc:94
 hrichthresholdpar.cc:95
 hrichthresholdpar.cc:96
 hrichthresholdpar.cc:97
 hrichthresholdpar.cc:98
 hrichthresholdpar.cc:99
 hrichthresholdpar.cc:100
 hrichthresholdpar.cc:101
 hrichthresholdpar.cc:102
 hrichthresholdpar.cc:103
 hrichthresholdpar.cc:104
 hrichthresholdpar.cc:105
 hrichthresholdpar.cc:106
 hrichthresholdpar.cc:107
 hrichthresholdpar.cc:108
 hrichthresholdpar.cc:109
 hrichthresholdpar.cc:110
 hrichthresholdpar.cc:111
 hrichthresholdpar.cc:112
 hrichthresholdpar.cc:113
 hrichthresholdpar.cc:114
 hrichthresholdpar.cc:115
 hrichthresholdpar.cc:116
 hrichthresholdpar.cc:117
 hrichthresholdpar.cc:118
 hrichthresholdpar.cc:119
 hrichthresholdpar.cc:120
 hrichthresholdpar.cc:121
 hrichthresholdpar.cc:122
 hrichthresholdpar.cc:123
 hrichthresholdpar.cc:124
 hrichthresholdpar.cc:125
 hrichthresholdpar.cc:126
 hrichthresholdpar.cc:127
 hrichthresholdpar.cc:128
 hrichthresholdpar.cc:129
 hrichthresholdpar.cc:130
 hrichthresholdpar.cc:131
 hrichthresholdpar.cc:132
 hrichthresholdpar.cc:133