ROOT logo
// This class handels the voltage scans produced with TCT Labview software (".tct" files)!
// Waveform vectors are stored in the histograms on which the data manipultaion rutines work

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "TH1F.h"
#include "TMath.h"
#include "TCTReflect.h"

ClassImp(TCTReflect)

TCTReflect::TCTReflect(Float_t x,Float_t y,Float_t z)
{
  RefC=x;
  RefTs=y;
  RefTe=z;
  SubHis=NULL;
  SubHisCopy=0;
}

TH1F *TCTReflect::CorrReflCopy(TH1F *his)
{

 TH1F *hiscopy=new TH1F();
 his->Copy(*hiscopy);
 CorrRefl(hiscopy);
 
 //hiscopy->SetLineColor(2);
 return hiscopy;
}

void TCTReflect::CorrRefl(TH1F *his)
{
 Int_t bin,k;
 Int_t lb=his->GetXaxis()->FindBin(RefTs);
 Int_t hb=his->GetXaxis()->FindBin(RefTe);
 for(Int_t i=0;i<his->GetNbinsX();i++)
    {
      bin=his->GetBinContent(i);
      k=(i-lb)/(hb-lb);
      if(k>0)  his->SetBinContent(i,bin-TMath::Power(RefC,k)*his->GetBinContent(i-k*(hb-lb)));
    }

}


TH1F *TCTReflect::SubRefWF(TH1F *his,Int_t copy)
{
  //  Int_t ret;
  //  Int_t numhis,numsub,num;
  TH1F *hiscopy, *hisw;
  //  Char_t txtname[200],txttitle[200];
  //  num=his->GetNbinsX(); 
  //  numsub=hissub->GetNbinsX(); 
  
  if(copy) 
    {
     hiscopy=new TH1F();
     his->Copy(*hiscopy);
     hisw=hiscopy;  
//       sprintf(txtname,"Copy of %s",his->GetName());
//       sprintf(txttitle,"Copy of %s",his->GetTitle());
//       hiscopy=new TH1F(txtname,txttitle,num,his->GetBinLowEdge(0),his->GetBinUpEdge(num));      
//       hisw=hiscopy;
    }
  else hisw=his;
  
  hisw->Add(SubHis,-1);
  
  //  num=numhis>=numsub?numsub:numhis;
  
  return hisw;
}


void TCTReflect::SetSubRefWF(TH1F *his)
{
  SubHis=new TH1F();
  his->Copy(*SubHis);

}
 TCTReflect.cxx:1
 TCTReflect.cxx:2
 TCTReflect.cxx:3
 TCTReflect.cxx:4
 TCTReflect.cxx:5
 TCTReflect.cxx:6
 TCTReflect.cxx:7
 TCTReflect.cxx:8
 TCTReflect.cxx:9
 TCTReflect.cxx:10
 TCTReflect.cxx:11
 TCTReflect.cxx:12
 TCTReflect.cxx:13
 TCTReflect.cxx:14
 TCTReflect.cxx:15
 TCTReflect.cxx:16
 TCTReflect.cxx:17
 TCTReflect.cxx:18
 TCTReflect.cxx:19
 TCTReflect.cxx:20
 TCTReflect.cxx:21
 TCTReflect.cxx:22
 TCTReflect.cxx:23
 TCTReflect.cxx:24
 TCTReflect.cxx:25
 TCTReflect.cxx:26
 TCTReflect.cxx:27
 TCTReflect.cxx:28
 TCTReflect.cxx:29
 TCTReflect.cxx:30
 TCTReflect.cxx:31
 TCTReflect.cxx:32
 TCTReflect.cxx:33
 TCTReflect.cxx:34
 TCTReflect.cxx:35
 TCTReflect.cxx:36
 TCTReflect.cxx:37
 TCTReflect.cxx:38
 TCTReflect.cxx:39
 TCTReflect.cxx:40
 TCTReflect.cxx:41
 TCTReflect.cxx:42
 TCTReflect.cxx:43
 TCTReflect.cxx:44
 TCTReflect.cxx:45
 TCTReflect.cxx:46
 TCTReflect.cxx:47
 TCTReflect.cxx:48
 TCTReflect.cxx:49
 TCTReflect.cxx:50
 TCTReflect.cxx:51
 TCTReflect.cxx:52
 TCTReflect.cxx:53
 TCTReflect.cxx:54
 TCTReflect.cxx:55
 TCTReflect.cxx:56
 TCTReflect.cxx:57
 TCTReflect.cxx:58
 TCTReflect.cxx:59
 TCTReflect.cxx:60
 TCTReflect.cxx:61
 TCTReflect.cxx:62
 TCTReflect.cxx:63
 TCTReflect.cxx:64
 TCTReflect.cxx:65
 TCTReflect.cxx:66
 TCTReflect.cxx:67
 TCTReflect.cxx:68
 TCTReflect.cxx:69
 TCTReflect.cxx:70
 TCTReflect.cxx:71
 TCTReflect.cxx:72
 TCTReflect.cxx:73
 TCTReflect.cxx:74
 TCTReflect.cxx:75
 TCTReflect.cxx:76
 TCTReflect.cxx:77
 TCTReflect.cxx:78
 TCTReflect.cxx:79
 TCTReflect.cxx:80
 TCTReflect.cxx:81
 TCTReflect.cxx:82