// Author: Andrew M. Rogers, NSCL 07/01/2006
//* Copyright (C) 2006-2008 Andrew M. Rogers

#include <stdio.h>
#include <fstream>
#include <string>

// #include <TClass.h>
// #include <TDirectory.h>
// #include <TProcessID.h>
#include <TTree.h>

#include "THiRAAsic.h"

ClassImp(THiRAAsic);

void THiRAAsic::Initialize(TString iName, Int_t iNum)
{
  //--
  //

  iNum = iNum;
  name    = iName;
}

void THiRAAsic::InitTree(TTree *tree)
{
  //--
  //

  fChain = tree;
  b_Tower  = fChain->GetBranch(name);
}

void THiRAAsic::InitBranch(TTree *tree)
{
  //--
  //
  tree = tree;
  //  Tower.InitBranch(tree);
}

Bool_t THiRAAsic::LoadMap()
{
  //--
  //

  ifstream file(chipMapPath);
  if(!file.is_open()) return kFALSE;

  char   line[200];
  Int_t  asic_fill;
  string crap;

  int    towernum,slot,chip,rchip,tele;
  char   face[10];
  string fa;
  
  file >> asic_fill;
  file.getline(line,200);
  file >> crap;
 
  file.getline(line,200);
  file.getline(line,200);
  file.getline(line,200);
  while (!file.eof()) {
    file.getline(line,200);

    sscanf(line,"%i %i %i %i %i %s",
	   &towernum,&slot,&chip,&rchip,&tele,face);
    #ifdef THIRAASIC_DEBUG
    printf("%i %i %i %i %i %s\n",
    	   towernum,slot,chip,rchip,tele,&face);
    #endif
  
    tower[towernum].slotNum[chip]  = slot;
    tower[towernum].slotNum[rchip] = slot;
    tower[towernum].chipNum[chip]  = 0;
    tower[towernum].chipNum[rchip] = 1;
    fa = face;
    tower[towernum].slot[slot].telenum = tele;

    if (fa == "de") tower[towernum].slot[slot].facenum = 0;
    if (fa == "ef") tower[towernum].slot[slot].facenum = 1;
    if (fa == "eb") tower[towernum].slot[slot].facenum = 2;

    tower[towernum].slotList.push_back(slot);
  }

  file.close();
  
  return kTRUE;
}

void THiRAAsic::Clear(Option_t *)
{
  //--
  //

  //  Tower.Clear();
}

Last change: Sun Dec 21 12:38:48 2008
Last generated: 2008-12-21 12:38

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.