ROOT logo
#include "TObject.h"
#include "hades.h"
#include "hreconstructor.h"
#include "TClass.h"
//*-- Author : Manuel Sanchez
//*-- Modified : 22/04/2002 by R. Holzmann
//*-- Modified : 9/10/1998 by Manuel Sanchez
//*-- Modified : 27/04/98 by Manuel Sanchez
//*-- Copyright : GENP (Univ. Santiago de Compostela)

//_HADES_CLASS_DESCRIPTION 
///////////////////////////////////////////////////////////////////////
//HReconstructor
//
//  Base class for any reconstruction method or algoritm. See HTask for
// more information.
//
////////////////////////////////////////////////////////////////////////

ClassImp(HReconstructor)

HReconstructor::HReconstructor(void) :
                             HTask("Reconstructor","Generic reconstructor") {
  // Default reconstructor
  fActive=kTRUE;
  fHistograms=NULL;
  fIsTimed=kFALSE;
}

HReconstructor::HReconstructor(const Text_t *name,const Text_t *title) : HTask(name,title){
  // Allocates a new reconstructor with name=name and Title=title
  fActive=kTRUE;
  fHistograms=NULL;
  fIsTimed=kFALSE;
}

HReconstructor::~HReconstructor(void) {
  //Destructor
}

HTask *HReconstructor::next(Int_t &errCode) {
  //Returns next task to be performed according to the return value of the
  //execute() function
  if(fIsTimed) fTimer.Start(kFALSE);
  Int_t e=(fActive) ? execute() : 0;
  if(fIsTimed) fTimer.Stop();
  if (e<0) {
    errCode=e;
    //    printf("task :%s ",this->GetName());
    //  printf("exited with errCode:%i \n",errCode);
    return NULL;
  }
  errCode=0;
  return (HTask *)fOutputs[e];
}


HTask *HReconstructor::getTask(const Char_t *name) {
  if (strcmp(GetName(),name)==0) return this;
  else return NULL;
}


Bool_t HReconstructor::connectTask(HTask *task,Int_t n) {
  // Connects the return value "n" to the task "task"
  if (!fOutputs[n]) 
    fOutputs.AddAt(task,n);
  else { 
    printf("Overwritten fOutputs!\n"); 
    return kFALSE;
  }
  return kTRUE;
}


void HReconstructor::getConnections(void){

Int_t entries = fOutputs.GetEntries();
  printf(".................................................\n");
  printf("Tasks connected to %s:\n\n",this->GetName());
  if( entries == 0 ) {
    printf("   None!\n");
    printf(".................................................\n");
  } else {
    for(Int_t i=0; i<=fOutputs.GetLast();i++){ 
      if (fOutputs[i]) printf("   %s is connected via 'return %3i' \n",
                                                 fOutputs[i]->GetName(), i); 
    }
  }
}


Bool_t HReconstructor::IsFolder(void) const {
  // Returns true. This tells the Root browser to show HReconstructor as a 
  // folder holding other objects
  return kTRUE;
}


void HReconstructor::Browse(TBrowser *b) {
  // Browse function to see the subnodes and histograms supported by a
  // particular reconstructor in a Root Browser.

  if (fHistograms) b->Add(fHistograms,"Control histograms");
}


void HReconstructor::resetTimer(void) {
  // Resets task timer
  //
  if(fIsTimed) fTimer.Reset(); 
}


void HReconstructor::printTimer(void) {
  // Print task timer output
  //
  if(!fActive) {
    printf("%15s:  not active\n",this->GetName());
    return;
  } 
  if(fIsTimed) {
    Float_t realTime = fTimer.RealTime();
    Float_t cpuTime = fTimer.CpuTime();
    printf("%15s:  Real time: %10.2f sec   CPU time: %10.2f sec\n",
                                            this->GetName(),realTime,cpuTime);
  }
  else printf("%15s:  not timed\n",this->GetName());
}






 hreconstructor.cc:1
 hreconstructor.cc:2
 hreconstructor.cc:3
 hreconstructor.cc:4
 hreconstructor.cc:5
 hreconstructor.cc:6
 hreconstructor.cc:7
 hreconstructor.cc:8
 hreconstructor.cc:9
 hreconstructor.cc:10
 hreconstructor.cc:11
 hreconstructor.cc:12
 hreconstructor.cc:13
 hreconstructor.cc:14
 hreconstructor.cc:15
 hreconstructor.cc:16
 hreconstructor.cc:17
 hreconstructor.cc:18
 hreconstructor.cc:19
 hreconstructor.cc:20
 hreconstructor.cc:21
 hreconstructor.cc:22
 hreconstructor.cc:23
 hreconstructor.cc:24
 hreconstructor.cc:25
 hreconstructor.cc:26
 hreconstructor.cc:27
 hreconstructor.cc:28
 hreconstructor.cc:29
 hreconstructor.cc:30
 hreconstructor.cc:31
 hreconstructor.cc:32
 hreconstructor.cc:33
 hreconstructor.cc:34
 hreconstructor.cc:35
 hreconstructor.cc:36
 hreconstructor.cc:37
 hreconstructor.cc:38
 hreconstructor.cc:39
 hreconstructor.cc:40
 hreconstructor.cc:41
 hreconstructor.cc:42
 hreconstructor.cc:43
 hreconstructor.cc:44
 hreconstructor.cc:45
 hreconstructor.cc:46
 hreconstructor.cc:47
 hreconstructor.cc:48
 hreconstructor.cc:49
 hreconstructor.cc:50
 hreconstructor.cc:51
 hreconstructor.cc:52
 hreconstructor.cc:53
 hreconstructor.cc:54
 hreconstructor.cc:55
 hreconstructor.cc:56
 hreconstructor.cc:57
 hreconstructor.cc:58
 hreconstructor.cc:59
 hreconstructor.cc:60
 hreconstructor.cc:61
 hreconstructor.cc:62
 hreconstructor.cc:63
 hreconstructor.cc:64
 hreconstructor.cc:65
 hreconstructor.cc:66
 hreconstructor.cc:67
 hreconstructor.cc:68
 hreconstructor.cc:69
 hreconstructor.cc:70
 hreconstructor.cc:71
 hreconstructor.cc:72
 hreconstructor.cc:73
 hreconstructor.cc:74
 hreconstructor.cc:75
 hreconstructor.cc:76
 hreconstructor.cc:77
 hreconstructor.cc:78
 hreconstructor.cc:79
 hreconstructor.cc:80
 hreconstructor.cc:81
 hreconstructor.cc:82
 hreconstructor.cc:83
 hreconstructor.cc:84
 hreconstructor.cc:85
 hreconstructor.cc:86
 hreconstructor.cc:87
 hreconstructor.cc:88
 hreconstructor.cc:89
 hreconstructor.cc:90
 hreconstructor.cc:91
 hreconstructor.cc:92
 hreconstructor.cc:93
 hreconstructor.cc:94
 hreconstructor.cc:95
 hreconstructor.cc:96
 hreconstructor.cc:97
 hreconstructor.cc:98
 hreconstructor.cc:99
 hreconstructor.cc:100
 hreconstructor.cc:101
 hreconstructor.cc:102
 hreconstructor.cc:103
 hreconstructor.cc:104
 hreconstructor.cc:105
 hreconstructor.cc:106
 hreconstructor.cc:107
 hreconstructor.cc:108
 hreconstructor.cc:109
 hreconstructor.cc:110
 hreconstructor.cc:111
 hreconstructor.cc:112
 hreconstructor.cc:113
 hreconstructor.cc:114
 hreconstructor.cc:115
 hreconstructor.cc:116
 hreconstructor.cc:117
 hreconstructor.cc:118
 hreconstructor.cc:119
 hreconstructor.cc:120
 hreconstructor.cc:121
 hreconstructor.cc:122
 hreconstructor.cc:123
 hreconstructor.cc:124
 hreconstructor.cc:125
 hreconstructor.cc:126
 hreconstructor.cc:127
 hreconstructor.cc:128
 hreconstructor.cc:129
 hreconstructor.cc:130
 hreconstructor.cc:131
 hreconstructor.cc:132
 hreconstructor.cc:133
 hreconstructor.cc:134
 hreconstructor.cc:135