ROOT logo
//
//*-- Author: M. Jurkovic martin.jurkovic@ph.tum.de
//_HADES_CLASS_DESCRIPTION
/////////////////////////////////////////////////////////////
//  HStart2Hit
//
//  This class contains START2 hit data
//
/////////////////////////////////////////////////////////////

#include "hstart2hit.h"

#include "TBuffer.h"

ClassImp(HStart2Hit)


HStart2Hit::HStart2Hit(void)
{

    fModule      = -1,
    fStrip       = -1;
    fMultiplicity= 0;
    fTime        = -1000000.;
    fWidth       = -1000000.;
    fFlag        = kFALSE;
    fCorrFlag    = -1;
    fResolution  = -1000;
    fSimWidth    = -1000;
    fTrack       = -1;
    fTime2       = -1000000.;
    fIteration   = 0;
    resetClusterStrip(2);
}

void  HStart2Hit::resetClusterStrip(UInt_t firstOrSecond)
{

    if(firstOrSecond>1 || firstOrSecond == 0 ) nFirstCluster  = 0;
    if(firstOrSecond>1 || firstOrSecond == 1 ) nSecondCluster = 0;
    for(Int_t i=0;i<MAXNSTRIP;i++) {
	if(firstOrSecond>1 || firstOrSecond == 0 ) fFirstCluster [i]=-1;
	if(firstOrSecond>1 || firstOrSecond == 1 ) fSecondCluster[i]=-1;
    }
}

Bool_t  HStart2Hit::setClusterStrip (UInt_t firstOrSecond, Int_t stripindex,Int_t hitindex)
{
    Int_t st = stripindex*1000+hitindex;
    return setClusterStrip (firstOrSecond, st);
}

Bool_t  HStart2Hit::setClusterStrip (UInt_t firstOrSecond, Int_t stripandhitindex)
{
    if(firstOrSecond>1) {
	Error("setClusterStrip()","Cluster selection too large (%i)",firstOrSecond);
	return kFALSE;
    }
    if(firstOrSecond==0 && nFirstCluster<MAXNSTRIP-1){

        fFirstCluster[nFirstCluster] = stripandhitindex;
	nFirstCluster++;
        return kTRUE;
    }
    if(firstOrSecond==1 && nSecondCluster<MAXNSTRIP-1){

        fSecondCluster[nSecondCluster] = stripandhitindex;
	nSecondCluster++;
        return kTRUE;
    }
    return kFALSE;
}

Int_t  HStart2Hit::getClusterStrip (UInt_t firstOrSecond, Int_t num)
{
    if(firstOrSecond>1) {
	Error("getClusterStrip()","Cluster selection too large (%i)",firstOrSecond);
	return -1;
    }
    if(firstOrSecond==0 && num<nFirstCluster) {  return fFirstCluster [num]; }
    if(firstOrSecond==1 && num<nSecondCluster){  return fSecondCluster[num]; }
    return -1;
}

Int_t  HStart2Hit::getClusterStrip (UInt_t firstOrSecond, Int_t num, Int_t& stripindex,Int_t& hitindex)
{
    hitindex=stripindex=-1;
    Int_t st= getClusterStrip ( firstOrSecond, num );
    if(st>-1){
        stripindex = st/1000;
        hitindex  = st - stripindex*1000;
        return st;
    }
    return -1;
}

void HStart2Hit::Streamer(TBuffer &R__b)
{
   // Stream an object of class HStart2Hit.

   UInt_t R__s, R__c;
   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
      TObject::Streamer(R__b);
      R__b >> fModule;
      R__b >> fStrip;
      R__b >> fMultiplicity;
      R__b >> fTime;
      R__b >> fWidth;
      R__b >> fFlag;

      if (R__v > 1) R__b >> fCorrFlag;
      else                  fCorrFlag = -1;

      if (R__v > 2) R__b >> fResolution;
      else                  fResolution = -1000;
      if (R__v > 5) R__b >> fSimWidth;
      else                  fSimWidth = -1000;

      if (R__v > 3) R__b >> fTrack;
      else                  fTrack = -1;

      if (R__v > 4){
          R__b >> fIteration;
	  R__b >> fTime2;
	  R__b >> nFirstCluster;
	  R__b >> nSecondCluster;
	  R__b.ReadStaticArray((Int_t*)fFirstCluster);
	  R__b.ReadStaticArray((Int_t*)fSecondCluster);

      } else {
          fIteration = 0;
	  resetClusterStrip(2);
      }
      R__b.CheckByteCount(R__s, R__c, HStart2Hit::IsA());
   } else {
      R__c = R__b.WriteVersion(HStart2Hit::IsA(), kTRUE);
      TObject::Streamer(R__b);
      R__b << fModule;
      R__b << fStrip;
      R__b << fMultiplicity;
      R__b << fTime;
      R__b << fWidth;
      R__b << fFlag;
      R__b << fCorrFlag;
      R__b << fResolution;
      R__b << fSimWidth;
      R__b << fTrack;
      R__b << fIteration;
      R__b << fTime2;
      R__b << nFirstCluster;
      R__b << nSecondCluster;
      R__b.WriteArray((Int_t*)fFirstCluster,MAXNSTRIP);
      R__b.WriteArray((Int_t*)fSecondCluster,MAXNSTRIP);
      R__b.SetByteCount(R__c, kTRUE);
   }
}

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