ROOT logo
//*-- AUTHOR : Rainer Schicker
//_HADES_CLASS_DESCRIPTION
//////////////////////////////////////////////////////////////////
//  HTBoxDetector
//
//  class for detector TBox
//  stores the setup in an array of 1 module;
//////////////////////////////////////////////////////////////////

#include "hades.h"
#include "hcategory.h"
#include "hdetpario.h"
#include "hlinearcategory.h"
#include "hmatrixcategory.h"
#include "hparasciifileio.h"
#include "hpario.h"
#include "hparrootfileio.h"
#include "hruntimedb.h"
#include "hstartdef.h"
#include "htboxdetector.h"

#include <stdio.h>

ClassImp(HTBoxDetector)

HTBoxDetector::HTBoxDetector()
{
   // constructor
   fName = "TBox";
   maxSectors = -1;
   maxModules = 1;
   maxComponents = 8;
   modules = new TArrayI(maxModules);
}


HTBoxDetector::HTBoxDetector(Int_t mods, Int_t chan)
{
   // constructor
   fName = "TBox";
   maxSectors = -1;
   maxModules = mods;
   maxComponents = chan;
   modules = new TArrayI(maxModules);
}


HTBoxDetector::~HTBoxDetector()
{
   // destructor
   if (modules) delete modules;
   modules = 0;
}


Bool_t HTBoxDetector::init(void)
{
   // nothing to be done
   return kTRUE;
}

HCategory* HTBoxDetector::buildMatrixCategory(const Text_t* className)
{
   Int_t maxMod = getMaxModInSetup();
   if (maxMod == 0) return 0;
   Int_t* sizes = new Int_t[2]; // 2 levels
   sizes[0] = maxMod;
   sizes[1] = maxComponents;
   HMatrixCategory* category = new HMatrixCategory(className, 2, sizes, 1.0);
   delete [] sizes;
   return category;
}


HCategory* HTBoxDetector::buildLinearCategory(const Text_t* className)
{
   Int_t size = getMaxModInSetup() * maxComponents;
   if (size) {
      HLinearCategory* category = new HLinearCategory(className, size);
      return category;
   }
   printf("TBox linear category could not be built\n");
   return NULL;
}


HCategory* HTBoxDetector::buildCategory(Cat_t cat)
{
   // builds the default categories (here MatrixCategories)
   switch (cat) {
      case catTBoxChan    :
         return buildLinearCategory("HTBoxChan");
      default :
         return NULL;
   }
}

Int_t HTBoxDetector::getMaxModInSetup(void)
{
   Int_t maxMod = -1;
   for (Int_t i = 0; i < maxModules; i++) {
      if (modules->At(i)) maxMod = (i > maxMod) ? i : maxMod;
   }
   maxMod++;
   return maxMod;
}
 htboxdetector.cc:1
 htboxdetector.cc:2
 htboxdetector.cc:3
 htboxdetector.cc:4
 htboxdetector.cc:5
 htboxdetector.cc:6
 htboxdetector.cc:7
 htboxdetector.cc:8
 htboxdetector.cc:9
 htboxdetector.cc:10
 htboxdetector.cc:11
 htboxdetector.cc:12
 htboxdetector.cc:13
 htboxdetector.cc:14
 htboxdetector.cc:15
 htboxdetector.cc:16
 htboxdetector.cc:17
 htboxdetector.cc:18
 htboxdetector.cc:19
 htboxdetector.cc:20
 htboxdetector.cc:21
 htboxdetector.cc:22
 htboxdetector.cc:23
 htboxdetector.cc:24
 htboxdetector.cc:25
 htboxdetector.cc:26
 htboxdetector.cc:27
 htboxdetector.cc:28
 htboxdetector.cc:29
 htboxdetector.cc:30
 htboxdetector.cc:31
 htboxdetector.cc:32
 htboxdetector.cc:33
 htboxdetector.cc:34
 htboxdetector.cc:35
 htboxdetector.cc:36
 htboxdetector.cc:37
 htboxdetector.cc:38
 htboxdetector.cc:39
 htboxdetector.cc:40
 htboxdetector.cc:41
 htboxdetector.cc:42
 htboxdetector.cc:43
 htboxdetector.cc:44
 htboxdetector.cc:45
 htboxdetector.cc:46
 htboxdetector.cc:47
 htboxdetector.cc:48
 htboxdetector.cc:49
 htboxdetector.cc:50
 htboxdetector.cc:51
 htboxdetector.cc:52
 htboxdetector.cc:53
 htboxdetector.cc:54
 htboxdetector.cc:55
 htboxdetector.cc:56
 htboxdetector.cc:57
 htboxdetector.cc:58
 htboxdetector.cc:59
 htboxdetector.cc:60
 htboxdetector.cc:61
 htboxdetector.cc:62
 htboxdetector.cc:63
 htboxdetector.cc:64
 htboxdetector.cc:65
 htboxdetector.cc:66
 htboxdetector.cc:67
 htboxdetector.cc:68
 htboxdetector.cc:69
 htboxdetector.cc:70
 htboxdetector.cc:71
 htboxdetector.cc:72
 htboxdetector.cc:73
 htboxdetector.cc:74
 htboxdetector.cc:75
 htboxdetector.cc:76
 htboxdetector.cc:77
 htboxdetector.cc:78
 htboxdetector.cc:79
 htboxdetector.cc:80
 htboxdetector.cc:81
 htboxdetector.cc:82
 htboxdetector.cc:83
 htboxdetector.cc:84
 htboxdetector.cc:85
 htboxdetector.cc:86
 htboxdetector.cc:87
 htboxdetector.cc:88
 htboxdetector.cc:89
 htboxdetector.cc:90
 htboxdetector.cc:91
 htboxdetector.cc:92
 htboxdetector.cc:93
 htboxdetector.cc:94
 htboxdetector.cc:95
 htboxdetector.cc:96
 htboxdetector.cc:97
 htboxdetector.cc:98
 htboxdetector.cc:99
 htboxdetector.cc:100
 htboxdetector.cc:101
 htboxdetector.cc:102
 htboxdetector.cc:103
 htboxdetector.cc:104
 htboxdetector.cc:105
 htboxdetector.cc:106