ROOT logo
//*-- AUTHOR : Ilse Koenig
//*-- Created : 17/01/2005
// Modified by M.Golubeva 01.11.2006
// Modified by M.Golubeva 20.02.2007

//_HADES_CLASS_DESCRIPTION 
/////////////////////////////////////////////////////////////
//
//  HWallDetector
//
//  The Forward Wall detector class
//
/////////////////////////////////////////////////////////////

using namespace std;
#include "hwalldetector.h"
#include "walldef.h"
#include "hcategory.h"
#include "hlinearcategory.h"
#include "hmatrixcategory.h"
#include "hwallcalibrater.h"
#include "hwallcalpar.h" //FK//???????
#include "hwallhitf.h"//FK//
#include "hwallrefwinpar.h"
#include "hwallonehit.h"
#include "hwallonehitf.h"
#include "hades.h"
#include "hpario.h"
#include "hparrootfileio.h"
#include "hparasciifileio.h"
#include "hdetpario.h"
#include "hwallparrootfileio.h"
#include "hwallparasciifileio.h"
#include "TClass.h"
#include "TArrayI.h"
#include <iostream> 
#include <iomanip>

ClassImp(HWallDetector) // Forward Wall detector class

HWallDetector::HWallDetector(void) : HDetector("Wall","The Forward Wall detector") {
  // constructor
  maxSectors=-1;
  maxModules=1;
  maxComponents=302;
  //maxComponents=288;
  modules=new TArrayI(1);
}

HWallDetector::~HWallDetector(void) {
}

HCategory* HWallDetector::buildLinearCategory(const Text_t *classname,Float_t fillRate) {
  // builds a linear category for the Forward Wall
  HLinearCategory* category=new HLinearCategory(classname,(Int_t)(maxComponents*fillRate));
  return category;
}

HCategory* HWallDetector::buildMatrixCategory(const Text_t *classname,Float_t fillRate) {
  // builds a matrix category for the Forward Wall
  Int_t sizes[1];
  sizes[0]=maxComponents;
  HMatrixCategory* category=new HMatrixCategory(classname,1,sizes,fillRate);
  return category;
}

HCategory* HWallDetector::buildCategory(Cat_t cat) {
  // builds the categories for the Forward Wall
  switch (cat) {
  case catWallRaw : return buildMatrixCategory("HWallRaw",0.5);
  case catWallCal : return buildMatrixCategory("HWallCal",0.5);
  case catWallOneHit : return buildMatrixCategory("HWallOneHit",0.5);
  case catWallHit : return buildMatrixCategory("HWallHit",0.5);
    //  case catWallGeantRaw : return buildLinearCategory("HGeantWall",0.5);
  default : return NULL;
  }
}

void HWallDetector::activateParIo(HParIo* io) {
  // activates the input/output class for the parameters
  // needed by the Forward Wall
  if (strcmp(io->IsA()->GetName(),"HParOraIo")==0) {
    io->setDetParIo("HWallParIo");
    return;
  }
  if (strcmp(io->IsA()->GetName(),"HParRootFileIo")==0) {
    HWallParRootFileIo* p=new HWallParRootFileIo(((HParRootFileIo*)io)->getParRootFile());
    io->setDetParIo(p);
  }
  if (strcmp(io->IsA()->GetName(),"HParAsciiFileIo")==0) {
    HWallParAsciiFileIo* p=new HWallParAsciiFileIo(((HParAsciiFileIo*)io)->getFile());
    io->setDetParIo(p);
  }
}

Bool_t HWallDetector::write(HParIo* output) {
  // writes the Forward Wall setup to the output
  HDetParIo* out=output->getDetParIo("HWallParIo");
  if (out) return out->write(this);
  return kFALSE;
}

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