ROOT logo
#include "TCTScan.h"


ClassImp(TCTScan)

TCTScan::TCTScan(Int_t num)
{
  // Constructor 
  //    Int_t num ; number of MeasureWF to be stored in the array
Num=num;
//filenames = new TClonesArray("TString",Num);
vf =new TClonesArray("MeasureWF",Num);
//vf->BypassStreamer(kFALSE);
}

TCTScan::TCTScan(Char_t *FileName,Float_t Start)
{
  // Constructor 
  //    Int_t num ; number of MeasureWF to be stored in the array
  //Num=num;
//filenames = new TClonesArray("TString",Num);
//vf =new TClonesArray("MeasureWF",Num);
//vf->BypassStreamer(kFALSE);

 // Constructor
  // 		Char_t *FileName ; File Name
  // 		Int_t bins       ; Number of bins per waveform
  // 		Int_t Start       ; Shift in time (Start time)
  FILE *in;
  Float_t temp1,temp2;
  Float_t t0,deltat,data,time,Power;
  Float_t StartBin,EndBin;
  Int_t show=1,Points,Multiple,i,j;
  Float_t Date[6];

  if((in=fopen((const Char_t *)FileName,"r+"))==NULL) {printf("\n Error opening file for reading\n"); return;}

  fscanf(in,"%f %f %f %f %f %f\n",&Date[0],&Date[1],&Date[2],&Date[3],&Date[4],&Date[5]);
  if(show) printf("DATE= %4.0f %4.0f %4.0f %4.0f %4.0f %4.0f\n",Date[0],Date[1],Date[2],Date[3],Date[4],Date[5]);
  fscanf(in,"%f %f\n",&temp1,&temp2); 
  Num=(Int_t) temp1;
  TypeOfGeneration=(Int_t) temp2;

  if(show) printf("Number of Channels =%d , Type of Generation=%d\n",Num,TypeOfGeneration); 
  fscanf(in,"%e %e %d %d\n",&t0,&deltat,&Points,&Multiple);  
  // if(deltat>1e-6) { deltat*=1e-9; t0*=1e-9;}
  if(show) printf("Start Time=%5.2e, TimeStep=%5.2e, Points=%d, NumVoltages=%d\n",t0,deltat,Points,Multiple); 

  Float_t *Voltages=new Float_t [Multiple];
  Float_t *Temperature=new Float_t [Multiple];
  Float_t *Current=new Float_t [Multiple];

  for(i=0;i<Multiple-1;i++) {fscanf(in,"%f ",&Temperature[i]); if(show) printf("%5.1f ",Temperature[i]); }; 
  fscanf(in,"%f\n",&Temperature[i]); if(show) printf("%5.1f\n",Temperature[i]);
  for(i=0;i<Multiple-1;i++) {fscanf(in,"%f ",&Voltages[i]); if(show) printf("%5.2f ",Voltages[i]);}; 
  fscanf(in,"%f\n",&Voltages[i]); if(show) printf("%5.2f \n",Voltages[i]);
  for(i=0;i<Multiple-1;i++) {fscanf(in,"%e ",&Current[i]); if(show) printf("%5.2e ",Current[i]); }; 
  fscanf(in,"%e\n",&Current[i]); if(show) printf("%5.2e\n",Current[i]);

  if(deltat<1e-6) {deltat*=1e9; t0*=1e9;}
  StartBin=t0+Start;
  EndBin=StartBin+deltat*Points; 
  if(show) printf("Start Bin=%5.2e, End Bin=%5.2e, Bins=%d\n",StartBin,EndBin,Points);

  //  MeasureWF *tempWF=new MeasureWF(Multiple);
  //  TClonesArray &entryp = *tempWFhisto;   
  ///////////////////////////////////////////////////////////

  TH1F *his[1000];
  //  TH1F **his;
  //  *his=new TH1F [Multiple];
  //TH1F *his[10];


  Char_t *HistoNameMWF=new Char_t [300];
  Char_t HistoName[200];
  //Define histograms
  printf("Defining histograms \n");
  for(i=0;i<Multiple;i++) 
    {
      sprintf(HistoName,"MWF : Vbias=%f(%d)",Voltages[i],i);
      his[i]=new TH1F(HistoName,HistoName,Points,StartBin,EndBin);
    }

  //Loop over files
  vf =new TClonesArray("MeasureWF",Num);
  TClonesArray &entryp = *vf;
  for(Int_t k=0;k<Num;k++)
    {  
            printf("channel = %d\n",k);
            new(entryp[k]) MeasureWF(Multiple);
	    Get(k)->SetCurrents(Current);
            Get(k)->SetTemperatures(Temperature);
	    Get(k)->SetVoltages(Voltages);
	    Get(k)->SetDate(Date);
	    printf("vectors filled\n");

	for(j=0;j<Points;j++) 
	  for(i=0;i<Multiple;i++)
	    {
            if(i==Multiple-1) {fscanf(in,"%e\n",&data);} else {fscanf(in,"%e\t",&data);}
	    his[i]->SetBinContent(j,(Double_t)data);
	    }  
	
      printf("Adopting histograms \n");

       for(i=0;i<Multiple;i++)
	 {
	        sprintf(HistoNameMWF,"Ch=%d : MWF : Vbias=%5.2f(%d)",k,Voltages[i],i);
		his[i]->SetTitle(HistoNameMWF);
                Get(k)->AddHisto(i,Voltages[i],his[i]);
	 }
       
    }
  
 while(!feof(in)) Get(0)->Header.Append(getc(in));
 for(Int_t k=1;k<Num;k++)  Get(k)->Header=Get(0)->Header;
 
  fclose(in);
 printf("File %s read and closed!\n",FileName);

}


TCTScan::~TCTScan()
{
  // Destructor
  // if(pt!=NULL) delete pt;
 delete vf;
//delete filenames;
}

void TCTScan::SetNum(Int_t num)
{
  // Constructor 
  //    Int_t num ; number of MeasureWF to be stored in the array
Num=num;
//filenames = new TClonesArray("TString",Num);
 if(vf!=NULL) delete vf;
vf =new TClonesArray("MeasureWF",Num);
//vf->BypassStreamer(kFALSE);
}

void TCTScan::AddMeasureWF(Int_t index,Char_t *name,Float_t offset,Int_t bins)
{
  //	Add new MeasureWF
  //		Int_t index    ;  index 
  //		Char_t *name   ;  file name of the measurement
  //		Float_t offset ;  start time shift
  TClonesArray &entryp = *vf;
  new(entryp[index]) MeasureWF(name,bins+1,offset);
}

void TCTScan::AddMeasureWF(Int_t index, MeasureWF *mwf)
{
  //	Add new MeasureWF
  //		Int_t index    ;  index 
  //		MeasuredWF *mwf;  measured vaweform
  TClonesArray &entryp = *vf;
  new(entryp[index]) MeasureWF(mwf->GetEntries());
   entryp[index]=mwf;			       
}

void TCTScan::Merge(TCTScan *scan)
{
  //	Merges two TCTScans!
Int_t newNum=scan->GetNum()+Num;
vf->ExpandCreate(newNum);
TClonesArray &entryp = *vf;
printf("Expanding finished\n");
for(Int_t i=Num;i<newNum;i++)
  entryp[i]=scan->Get(i-Num);
printf("Looping finished\n");
Num=newNum;
  
}

void TCTScan::Info(Int_t start,Int_t end)
{
  //Shows Info
if(start==-1111) start=0;
if(end==-1111) end=Num-1;
for(Int_t i=start;i<=end;i++)
  {
    printf(">>>>>>>> ENTRY NUMBER = %d !\n",i);
    Get(i)->Info();
  printf("\n");
  }
}
void TCTScan::NormArray(Int_t num,Float_t *array)
{
  //array normalization
Float_t max=0;
Int_t maxi=0,i=0;
for(i=0;i<num;i++) if(array[i]>max) {max=array[i]; maxi=i;}
for(i=0;i<num;i++) array[i]/=max;
}

TGraphErrors *TCTScan::FDV(Float_t mint, Float_t maxt,Float_t x0,Float_t x1,Float_t x2, Float_t x3,Int_t model,Int_t opt,Float_t StartTime, Float_t fluence,Float_t Errorx, Float_t Errory)
{
  //Draws FDV vs. time or vs. tempeature plot! CCE is drawn and fitted!
  //	     Float mint ; Time window 
  //	     Float maxt ; 
  //	     Float_t x0 ;  first point of the first line
  //	     Float_t x1 ;  second point of the first line
  //	     Float_t x2 ;  first point of the second line
  //	     Float_t x3 ;  second point of the second line
  //         Int_t model;  lin-lin=0  scale  sqrt-lin=1
  //	     Int_t opt  ;  opt=0; time  ,  opt=1; temperature	opt=2; Neff time; opt=3; Neff temperature
  //         Int_t StartTime; Start Time;
  //	     Float_t Fluence; fluence (10^12);
  //	     Float_t Errorx ; 
  //	     Float_t Errory ;  
Float_t *fdv=new Float_t[Num];
Float_t *x=new Float_t[Num];
Float_t *xe=new Float_t[Num];
Float_t *fdve=new Float_t[Num];
Int_t k=0;
if(StartTime==-1111) StartTime=Get(0)->GetTime();
for(Int_t i=0;i<Num;i++)
  {
    //    if(TMath::Abs(Get(i)->GetCurrent(Get(i)->GetEntries()-1))!=TMath::Abs(Get(i)->GetCurrent(Get(i)->GetEntries()-2)))
    //      {
    fdv[i]=Get(i)->GetFDV(mint,maxt,x0,x1,x2,x3,model,0); 
    if(opt>1) {fdv[i]=fdv[i]/(69.3*fluence)*100; fdve[i]=Errory;}    
    if(opt==0 || opt==2)  x[i]=Get(i)->GetTime()-StartTime; else x[i]=Get(i)->GetT();
    xe[i]=Errorx;
    //printf("%d %e %e \n",i,fdv[k],Get(i)->GetCurrent(Get(i)->GetEntries()-1));
    //    printf("time %f ,%f mint=%f,maxt=%f,x0=%f,x1=%f,x2=%f,x3=%f \n",x[i],fdv[i],mint, maxt, x0 ,x1,x2,x3);
    //    k++;
    //     }
  }
TGraphErrors *it=new TGraphErrors(Num,x,fdv,xe,fdve);
 it->SetLineWidth(4);
 it->SetMarkerStyle(21);
if(opt==0) it->SetTitle("FDV vs. Time"); else  if(opt==1) it->SetTitle("FDV vs. Temperature");
else if(opt==2) it->SetTitle("Neff vs. Time");  if(opt==3) it->SetTitle("Neff vs. Temperature");

if(opt==0 || opt==2) it->Draw("APL"); else it->Draw("AP");
if(opt==0 || opt==2) it->GetHistogram()->SetXTitle("time[h]"); else it->GetHistogram()->SetXTitle("T[C]");
if(opt==0 || opt==1) it->GetHistogram()->SetYTitle("FDV [V]"); else it->GetHistogram()->SetYTitle("N_{eff}/#Phi_{eq} [10^{-2} cm^{-1}]");
it->GetHistogram()->Draw();
if(opt==0 || opt==2) it->Draw("APL"); else it->Draw("AP");
return(it);
}

TGraph *TCTScan::FDV(Elec *el,Float_t x0,Float_t x1,Float_t x2, Float_t x3,Int_t model,Int_t opt)
{
  //Draws FDV vs. time or vs. tempeature plot using electronics. CCE is drawn and fitted with shaped signal max!
  //	     Elec *el   ;  electronics
  //	     Float_t x0 ;  first point of the first line
  //	     Float_t x1 ;  second point of the first line
  //	     Float_t x2 ;  first point of the second line
  //	     Float_t x3 ;  second point of the second line
  //         Int_t model;  lin-lin=0  scale  sqrt-lin=1
  //	     Int_t opt  ;  opt=0; temperature  ,  opt=1; time	
Float_t *fdv=new Float_t[Num];
Float_t *x=new Float_t[Num];
Float_t StartTime=Get(0)->GetTime();

for(Int_t i=0;i<Num;i++)
  {
    fdv[i]=Get(i)->GetFDV(el,x0,x1,x2,x3,model,0);
    if(opt==0)  x[i]=Get(i)->GetTime()-StartTime; else x[i]=Get(i)->GetT();
    //    printf("time %f ,%f mint=%f,maxt=%f,x0=%f,x1=%f,x2=%f,x3=%f \n",x[i],fdv[i],mint, maxt, x0 ,x1,x2,x3);
  }
TGraph *it=new TGraph(Num,x,fdv);
 it->SetLineWidth(4);
 it->SetMarkerStyle(21);
if(opt==0) it->SetTitle("FDV vs. Time"); else  it->SetTitle("FDV vs. Temperature");
if(opt==0) it->Draw("APL"); else it->Draw("AP");
if(opt==0) it->GetHistogram()->SetXTitle("time[h]"); else it->GetHistogram()->SetXTitle("T[C]");
 it->GetHistogram()->SetYTitle("FDv[V]");
it->GetHistogram()->Draw();
if(opt==0 ) it->Draw("APL"); else it->Draw("AP");
return(it);
}

TGraph *TCTScan::CCEE(Elec *el,Float_t Volt,Int_t opt)
{
  // Draws CCE vs. temperature or time at given voltage using electronics
  //		Elec *el     ; electronics
  //		Float_t Volt ; voltage
  //	        Int_t opt    ;  opt=0; temperature  ,  opt=1; time     
TH1F *his=new TH1F();
Float_t *I=new Float_t[Num];
Float_t *x=new Float_t[Num];
Double_t xmax;
Double_t xmin;
Float_t StartTime=Get(0)->GetTime();
for(Int_t i=0;i<Num;i++)
  {
    Get(i)->GetHistogram(Volt,his);
    xmax=his->GetXaxis()->GetXmax();
    xmin=his->GetXaxis()->GetXmin();
    his->GetXaxis()->SetLimits(xmin*1e-9,xmax*1e-9);
    el->preamp(his);
    el->CRshape(his);
    el->RCshape(his);
    el->RCshape(his);
    I[i]=his->GetMaximum();
    if(opt==0)  x[i]=Get(i)->GetTime()-StartTime; else x[i]=Get(i)->GetT(Volt);
  }

NormArray(Num,I);
TGraph *it=new TGraph(Num,x,I);
 it->SetLineWidth(4);
 it->SetMarkerStyle(21);
if(opt==0) it->SetTitle("CCE vs. Time"); else  it->SetTitle("CCE (electronics) vs. Temperature");
if(opt==0) it->Draw("APL"); else it->Draw("AP"); 
if(opt==0) it->GetHistogram()->SetXTitle("time[h]"); else it->GetHistogram()->SetXTitle("T[C]");
 it->GetHistogram()->SetYTitle("Charge [arb.]");
it->GetHistogram()->Draw();
if(opt==0) it->Draw("APL"); else it->Draw("AP"); 
return(it);
}


TGraph *TCTScan::CCE(Float_t Volt,Int_t opt,Float_t mint, Float_t maxt)
{
  // Draws CCE vs. temperature or time at given voltage using charge
  //		Float_t Volt ; voltage
  //	        Int_t opt    ;  opt=0; temperature  ,  opt=1; time 
  //		Float_t maxt ; integration interval 
  //		Float_t mint ; 
Float_t *I=new Float_t[Num];
Float_t *x=new Float_t[Num];
Float_t StartTime=Get(0)->GetTime();
for(Int_t i=0;i<Num;i++)
  {
    I[i]=Get(i)->Integral(Volt,mint,maxt);
    if(opt==0)  x[i]=Get(i)->GetTime()-StartTime; else x[i]=Get(i)->GetT(Volt);
  }


TGraph *it=new TGraph(Num,x,I);
 it->SetLineWidth(4);
 it->SetMarkerStyle(21);
if(opt==0) it->SetTitle("CCE vs. Time"); else  it->SetTitle("CCE vs. Temperature");
if(opt==0) it->Draw("APL"); else it->Draw("AP");
if(opt==0) it->GetHistogram()->SetXTitle("time[h]"); else it->GetHistogram()->SetXTitle("T[C]");
 it->GetHistogram()->SetYTitle("CCE");
it->GetHistogram()->Draw();
if(opt==0) it->Draw("APL"); else it->Draw("AP");

return(it);
}

void TCTScan::ReadFile(Char_t *name, Int_t *step,Int_t count,Float_t shift,Int_t bins)
{
  // Reads multiple files of type .tct
  //	Char_t *name ; file name -> the part of the string that changes should be replaced with @
  //	Float_t step ; step size
  //	Int_t count  ; index in the vector (TCTScan) to put the first measurement in
  //    Float_t shift; (same shift as in the constructor of the MeasureWF)
Int_t index,k=0,offset=0;
Int_t i;
Char_t filename[300];
Char_t extension[100];

Char_t v[6];
while(name[k]!='@' && name[k]!='\0') k++; index=k; 
strcpy(extension,&name[index+1]); name[index]='\0';


for(i=0;i<count;i++)
  {

    sprintf(filename,"%s%d%s",name,step[i],extension);
    printf("%d %s\n",count,filename);
    AddMeasureWF(i,filename,shift,bins);
  }
}

Int_t TCTScan::i2a(Char_t *v,Float_t vol,Int_t sign)
{
  // int to ascii with signs (same as in MeasureWF)
Int_t k=0;
       if(sign) if(vol>0) v[k++]='+'; else {v[k++]='-'; vol=-vol;}
       if(!sign) vol=vol>0?vol:-vol; 
       if((Int_t) vol/100!=0) v[k++]=(Char_t)(((Int_t) vol)/100)+48;
       v[k++]=(Char_t)(((Int_t) vol%100)/10)+48;
       v[k++]=(Char_t)((Int_t) vol%10)+48; 
       v[k++]='\0';
       return k-1;
}

void TCTScan::DrawMulti(Float_t volt,Float_t low,Float_t high,Int_t Start,Int_t End, Int_t Step,Int_t Deconv)
{
  // Draws Multiple vaweforms at given voltage vs. temperature or time
  //		Float_t volt ; voltage
  //		Float_t low  ; time interval to display
  //		Float_t high ;
  //		Int_t Start  ; start index in the vector
  // 		Int_t End    ; end index in the vector
  // 		Int_t Step   ; step (default=1) 
  //		Int_t Deconv ; Deconvolute=1, No Deconvolution=0
Char_t v[5];
Int_t cii=0;
Int_t colori[]={1,2,3,4,5,6,7,13,28,30,34,38,40,31,46,49,1,2,3,4,5,6,7};
Float_t max=0;
Int_t i,maxi,color; 
Elec *elTCT=new Elec(10e-12,50,100e-9);
TH1F *ch;
TH1F *his,*hisd,*hism;
if(Start==-1) Start=0;
if(End==-1) End=Num-1;

 for(i=Start;i<=End;i+=Step) 
   {
     ch=Get(i)->GetHA(volt); 
     if(ch->GetMaximum()>max) {max=ch->GetMaximum(); maxi=i;}
   }
 if(max==0) maxi=End; //printf("maxi=%d",maxi);

ch=Get(maxi)->GetHA(volt);   
elTCT->SetCp(Get(max)->CAP);
 

 if(Deconv)
   {
     hism=new TH1F("Deconvoluted","Deconvoluted",ch->GetNbinsX(),ch->GetXaxis()->GetXmin(),
     ch->GetXaxis()->GetXmax()); 
     hisd=new TH1F("Deconvolution","Deconvoution",ch->GetNbinsX(),ch->GetXaxis()->GetXmin(),
     ch->GetXaxis()->GetXmax()); 
     ch->Copy(*hism); elTCT->Revpreamp((TH1F *)hism,1e9);
   } 
   else hism=ch;
 
 hism->SetXTitle("t[ns]");
 hism->SetYTitle("I[V/50#Omega]");
 hism->SetLabelSize(0.045,"X");
 hism->SetLabelSize(0.045,"Y");
 i2a(v,volt,0); //title without signs
 TString title="TCT Measurement @ U=";title=title+v; title=title+" V";
 hism->SetTitle((const char *)title);

if(low!=-1111. || high!=-1111.) hism->GetXaxis()->SetRange( hism->GetXaxis()->FindBin(low),hism->GetXaxis()->FindBin(high));
 hism->DrawCopy();
 
 for(i=Start;i<=End;i+=Step)
    {
      color=colori[cii];
    //      color=i/7*40+i%7+1; 
      his=Get(i)->GetHA(volt);   
      if(Deconv) 
	 {
	  his->Copy(*hisd); 
	  elTCT->SetCp(Get(i)->CAP);
	  elTCT->Revpreamp((TH1F *)hisd,1e9);
	 } else hisd=his;
      //      color=colori[i-Start];
      hisd->SetLineColor((Color_t)color);
      hisd->DrawCopy("SAME"); 
      cii++;    
    }
    Legend(hism,Start,End,Step);
}

void TCTScan::DrawMultiCS(Float_t volt,Float_t low,Float_t high,Int_t Start,Int_t End)
{
  // Draws multi current shapes (see MeasureWF) at given voltage vs. temperature or time
  //		Float_t volt ; voltage
  //		Float_t low  ; time interval to display
  //		Float_t high ;
  //		Int_t Start  ; start index in the vector
  // 		Int_t End    ; end index in the vector
Char_t v[5];
Int_t colori[]={1,2,3,4,5,6,7,13,28,30,34,38,40,31,46,49,1,2,3,4,5,6,7};
Float_t max=0;
Int_t i,maxi,color; 
TH1F *ch;
TH1F *his;
if(Start==-1) Start=0;
if(End==-1) End=Num-1;

 for(i=Start;i<=End;i++) 
   {
     ch=Get(i)->ChargeShape(volt); 
     if(ch->GetMaximum()>max) {max=ch->GetMaximum(); maxi=i;}
   }
 if(max==0) maxi=End; //printf("maxi=%d",maxi);

ch=Get(maxi)->ChargeShape(volt);   

if(low!=-1111. || high!=-1111.) ch->GetXaxis()->SetRange( ch->GetXaxis()->FindBin(low),ch->GetXaxis()->FindBin(high));
  
 ch->SetXTitle("t[ns]");
 ch->SetYTitle("Charge [arb.]");
 ch->SetLabelSize(0.045,"X");
 ch->SetLabelSize(0.045,"Y");
 i2a(v,volt,0);
 TString title="TCT Measurement @ U=";title=title+v; title=title+" V";
 ch->SetTitle((const char *)title);
 ch->DrawCopy();

 for(i=Start;i<=End;i++)
    {
      //      color=i/7*40+i%7+1; 
      his=Get(i)->ChargeShape(volt);   
      color=colori[i-Start];
      his->SetLineColor((Color_t)color);
      his->DrawCopy("SAME");
      }
    Legend(ch,Start,End);
}

void TCTScan::DrawMultiCCE(Float_t minit,Float_t maxit,Int_t Start,Int_t End,Int_t model)
{
  // Draws multiple CCE (see MeasureWF) vs. temperature or time
  //		Float_t minit ; integration time interval
  //		Float_t maxit ;
  //		Int_t Start   ; start index in the vector
  // 		Int_t End     ; end index in the vector
  //		Int_t model   ; lin-lin=0  scale  sqrt-lin=1
Char_t v[5];
Int_t colori[]={1,2,3,4,5,6,7,13,28,30,34,38,40,31,46,49,1,2,3,4,5,6,7};
Float_t max=0;
Int_t i,maxi,color; 
TGraph *ch;
TH1F *his;
if(Start==-1) Start=0;
if(End==-1) End=Num-1;

 for(i=Start;i<=End;i++) 
   {
     ch=Get(i)->CCE(minit,maxit,model,0);
     color=colori[i-Start];
     ch->SetLineColor((Color_t)color);  
     ch->SetLineWidth(2);
     if(i==Start) 
       {
	 ch->Draw("AL"); 
	 ch->SetTitle("Charge vs. Voltage (diff. T)");
	 if(model!=1) ch->GetHistogram()->SetXTitle("U[V]"); else ch->GetHistogram()->SetXTitle("Sqrt U[ Sqrt V]");//	 ch->GetHistogram()->SetXTitle("U[V]");
	 ch->GetHistogram()->SetYTitle("Charge [arb.]");
	 ch->GetHistogram()->Draw(); 
	 ch->Draw("AL"); 
	 his=ch->GetHistogram();
       }
     else ch->Draw("L");	
   }

   Legend(his,Start,End);
}


TGraph *TCTScan::DrawIT(Float_t Volt,Int_t opt)
{
  // Draws current at given voltage vs. temperature (time)
Int_t i;
Float_t *x=new Float_t [Num];
Float_t *y=new Float_t [Num];

Float_t StartTime=Get(0)->GetTime();
for(i=0;i<Num;i++)
  {
    y[i]=Get(i)->GetCurrent(Volt)*1e6;    
    if(opt==0)  x[i]=Get(i)->GetTime()-StartTime; else x[i]=Get(i)->GetT();
  }
 TGraph *it=new TGraph(Num,x,y);

 it->SetLineWidth(4);
 it->SetMarkerStyle(21);
 if(opt==0) it->SetTitle("Current vs. Time"); else it->SetTitle("Current vs. Temperature");
if(opt==0) it->Draw("APL"); else it->Draw("AP"); 
if(opt==0) it->GetHistogram()->SetXTitle("time[h]"); else it->GetHistogram()->SetXTitle("T[C]");
 it->GetHistogram()->SetYTitle("I[uA]");
 it->GetHistogram()->Draw();
if(opt==0) it->Draw("APL"); else it->Draw("AP"); 
return(it);

}


void TCTScan::Legend(TH1F *ch,Int_t start, Int_t end,Int_t Step)
{
  //Draws legend
Float_t minx,miny,maxy,maxx,x1,x2,y1,y2;
TString title,utit="T=";
Char_t v[5]; 
Int_t color,cii=0;;
Int_t colori[]={1,2,3,4,5,6,7,13,28,30,34,38,40,31,46,49,1,2,3,4,5,6,7};
TText *text;

minx=ch->GetXaxis()->GetBinCenter(ch->GetXaxis()->GetFirst());
maxx=ch->GetXaxis()->GetBinCenter(ch->GetXaxis()->GetLast());
miny=ch->GetMinimum();
maxy=ch->GetMaximum();

x1=(maxx-minx)*0.6+minx; 
x2=(maxx-minx)*0.9+minx;
y2=(maxy-miny)*0.35+miny;
y1=(maxy-miny)*0.95+miny;

//printf("coords: x1=%f y1=%f x2=%f y2=%f\n",x1,y1,x2,y2);

 if(pt!=NULL) delete pt;
 pt=new TPaveText(x1,y1,x2,y2);

for(Int_t i=start;i<=end;i+=Step)
  { 
   i2a(v,(Int_t) Get(i)->GetT()); 
   //   color=i/7*40+i%7+1; 
   color=colori[cii];
   title=utit+v; title=title+" C";
   text=pt->AddText((const char *)title);
   text->SetTextColor((Color_t)color);
   text->SetTextSize(0.05);
   cii++;
  }
pt->Draw();
}

/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
ClassImp(PSTCT)

PSTCT::PSTCT(char *FileName, Float_t time0, Int_t Bin)
{
  //////////////////////////////////////////////////////////////////////////// 
  // Class for manipulation of the 3D/Position Sensitive TCT Measurements
  // 
  // char *FileName;  name of the file with data
  // Float_t time0 ;  time shift of the points. Used mainly to set the arrival of the laser pulse at t=0 ns;
  // Int Bin; Selects the timeformat of the measurements; 
  //          0 - ascii (default) older format has a type 11 while newer has type 22
  //          1 - binary (prefered in new measurements)
  //          2 - binary (little endian)
  // Example of use :
  // // Convert into MeasureWF along projection
  // PSTCT aa("../Meritve/scanz-grobo-1.tct", 92.2,1); // The second parameter is to set the scale such that signal start at t=0;
  // aa.CorrectBaseLine();   // Baseline correction 
  // aa.PrintInfo();         // Information about the read data 
  // // example of projection the data along Y, 41 point at indexes of Z=23,X=0, U1=0, U2=0;
  // MeasureWF *wf=aa.Projection(0,1,0,0,23,0,0,41); 
  // strcpy(wf.suffix," #mum");
  // strcpy(wf.prefix,"Y=");
  // //Draw waveforms and substract the 0 waveform from the rest (cancel oscilations
  // wf.DrawMulti(-1,40,1,40,4,0,0);

 

  Int_t i,j,Cs,Us,Ss,ofs=0;
Char_t filef[5];
 float header[200];
for(i=0;i<4;i++) WFOnOff[i]=0;
Date=TArrayI(6);
 User=NULL;
 Comment=NULL;
 Sample=NULL;
 
 if(Bin==2) BLE_CODE=0; else BLE_CODE=1;
 // BLE_CODE=0;
if(!Bin) sprintf(filef,"r+"); else sprintf(filef,"rb+");
if((in=fopen((const Char_t *)FileName,filef))==NULL) {printf("\n Error opening file for reading\n"); return;}

 if(!Bin)  // read ASCII file 
   {
 fscanf(in,"%d",&type); // check the file type
 if(!(type==11 || type==22 || type==33 || type==51 || type==81 || type==82))  // if it is something else exit
     {
   printf("Can not read other formats than waveform: %d!\n",type); 
     }
   else
     {
 fscanf(in,"%d %d %d %d %d %d\n",&Date[0],&Date[1],&Date[2],&Date[3],&Date[4],&Date[5]);
 fscanf(in,"%d\n",&abstime);
 fscanf(in,"%f %f %d\n",&x0,&dx,&Nx);
 fscanf(in,"%f %f %d\n",&y0,&dy,&Ny);
 fscanf(in,"%f %f %d\n",&z0,&dz,&Nz);

if(type==22) fscanf(in,"%d %d %d\n",&WFOnOff[0],&WFOnOff[1],&WFOnOff[2]); //Read in the wafeform off on
if(type==33 || type==51 || type==81 || type==82) fscanf(in,"%d %d %d %d\n",&WFOnOff[0],&WFOnOff[1],&WFOnOff[2],&WFOnOff[3]); //Read in the wafeform off on

fscanf(in,"%d",&NU1); U1=TArrayF(NU1); 
 for(i=0;i<NU1;i++) fscanf(in,"%f",&U1[i]); //printf("%d %d %f\n",NU1,i,U1[i]);}

 if(type!=11) fscanf(in,"%d",&NU2); else NU2=1;
 U2=TArrayF(NU2); 
 if(type!=11) for(i=0;i<NU2;i++) fscanf(in,"%f",&U2[i]);

 I2=TArrayF(NU2*NU1); 
 I1=TArrayF(NU2*NU1); 

 fscanf(in,"%f %f %d\n",&t0,&dt,&NP);

 numxyz=Nx*Ny*Nz;
 
 for(i=0;i<9;i++) xyz[i]=new Float_t [numxyz*NU1*NU2];

 if(WFOnOff[0]) {histo1 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo1->BypassStreamer(kFALSE);}
 if(WFOnOff[1]) {histo2 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo2->BypassStreamer(kFALSE);}
 if(WFOnOff[2]) {histo3 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo3->BypassStreamer(kFALSE);}
 if(WFOnOff[3]) {histo4 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo4->BypassStreamer(kFALSE);}
     }
 ReadWFs(time0);
   }
 else
   {

     int read=fread((void *)header,sizeof(float),1,in);
     if(BLE_CODE) swooip(header,read);

     //get the file type
     type=(Int_t) header[0]; 
     printf("File type = %d - reading \n",type); // print the file type
     
     //read in the buffer
     rewind(in);
     read=fread((void *)header,sizeof(float),200,in);

     //  for(int ii=0;ii<50;ii++) printf("%d %f\n",ii,header[ii]);
     if(BLE_CODE) swooip(header,read);
     //get date 
     for(i=0;i<6;i++) Date[i]=(Int_t) header[i+1];

     //get absolute time
     abstime=(int) header[7];
     //get moving matrix
     x0=header[8];  dx=header[9]; Nx=(int)header[10]; 
     y0=header[11]; dy=header[12]; Ny=(int)header[13]; 
     z0=header[14]; dz=header[15]; Nz=(int)header[16]; 

     //adjust the reading of the header
     if(type==33 || type==51 || type==81 || type==82) ofs=1; else ofs=0;
     //get the on/off channels  
     for(i=0;i<3+ofs;i++) WFOnOff[i]=(int)header[17+i];

     //get number of voltage steps for the first power source
     //     printf("%f %d\n",header[20+ofs],header[20+ofs]); 
     NU1=(int)header[20+ofs]; U1=TArrayF(NU1);
     //get voltage steps for first power source 
     for(i=0;i<NU1;i++) U1[i]=header[21+ofs+i];
     //get number of voltage steps for the second power source
     NU2=(int)header[21+NU1+ofs];U2=TArrayF(NU2);
     //get voltage steps for first power source 
     for(i=0;i<NU2;i++) U2[i]=header[22+ofs+NU1+i];
     //get time scale
     t0=header[22+ofs+NU1+NU2]; if(TMath::Abs(t0)>1e-3) t0*=1e-9;
     dt=header[23+ofs+NU1+NU2]; if(TMath::Abs(dt)>1e-3) dt*=1e-9;
     NP=(int)header[24+ofs+NU1+NU2];
     //////    Header information coded from type=30 on
     switch(type)
       {
       case 82:
       case 81:
       case 51:
       case 33:     
     T=header[25+ofs+NU1+NU2];
     Source=(int)header[26+ofs+NU1+NU2];
     //rewind to the appropriate position
     fseek(in,(27+NU1+NU2+ofs)*sizeof(Float_t),SEEK_SET); 
     fread(&Us,sizeof(int),1,in); if(BLE_CODE) swooip((float *) &Us,1);
     User=new Char_t[Us+1];
     fread(User,sizeof(Char_t),Us,in);
     User[Us]='\0';
     fread(&Ss,sizeof(int),1,in); if(BLE_CODE)  swooip((float *) &Ss,1);
     Sample=new Char_t[Ss+1];
     fread(Sample,sizeof(Char_t),Ss,in);
     Sample[Ss]='\0';
     fread(&Cs,sizeof(int),1,in); if(BLE_CODE)  swooip((float *) &Cs,1);
     Comment=new Char_t[Cs+1]; 
     fread(Comment,1,Cs,in);
     Comment[Cs]='\0';
     //     fseek(in,(28+ofs+NU1+NU2+Us+Ss+Cs)*sizeof(Float_t),SEEK_SET);
        break;
       case 22: 
	 fseek(in,(25+NU1+NU2+ofs)*sizeof(Float_t),SEEK_SET); 
	 break;
       }
     
     ////////////////////////////////////////////
     //initializa current arrays
     I2=TArrayF(NU2*NU1); 
     I1=TArrayF(NU2*NU1); 
     //number of steps
     numxyz=Nx*Ny*Nz;     
     for(i=0;i<22;i++) xyz[i]=new Float_t [numxyz*NU1*NU2]; //book arrays for x,y,z,U1,U2,I1,I2,BM,time
    //intitialize histograms 
 if(WFOnOff[0]) {histo1 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo1->BypassStreamer(kFALSE);}
 if(WFOnOff[1]) {histo2 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo2->BypassStreamer(kFALSE);}
 if(WFOnOff[2]) {histo3 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo3->BypassStreamer(kFALSE);}
 if(WFOnOff[3]) {histo4 =new TClonesArray("TH1F",numxyz*NU1*NU2); histo4->BypassStreamer(kFALSE);}
 // for(i=0;i<50;i++) printf("%d %f\n",i,header[i]);
 ReadWFsBin(time0);

   }

 RefInd=-1;
 //Setting the color map
}


void  PSTCT::ReadWFsBin(Float_t time0)
{
  // read in binary waveforms 
  Int_t i,ii,j,k,q,r,numread;
  Float_t data,tU1,tU2,tI1,tI2;
  Char_t hisname1[100];
  Char_t hisname2[100];
  Char_t hisname3[100];
  Char_t hisname4[100];
  TClonesArray &entryp1 = *histo1;  
  TClonesArray &entryp2 = *histo2;  
  TClonesArray &entryp3 = *histo3;  
  TClonesArray &entryp4 = *histo4;  

  Float_t buf[33000];

  for(q=0;q<NU1;q++)
       {
     for(r=0;r<NU2;r++)
         {

	       fread((void *)buf,sizeof(Float_t),4,in); if(BLE_CODE) swooip(buf,4);
               tU1=buf[0]; tU2=buf[1]; tI1=buf[2]; tI2=buf[3];
	       U1[q]=tU1; I1[r+q*NU2]=tI1;
	       U2[r]=tU2; I2[r+q*NU2]=tI2;
	     
	       //       printf("%d %d :: %f %f %f %f\n",r,q,tU1,tU2,tI1,tI2);
       	   for(i=0;i<numxyz;i++)
	     {

	       ii=i+numxyz*r+(NU2*numxyz)*q;
	
	       if(type==33 || type==22) fread((void *)buf,sizeof(Float_t),4,in);  
	       if(type==51) fread((void *)buf,sizeof(Float_t),5,in);  
	       if(type==81) fread((void *)buf,sizeof(Float_t),8,in);  
	       if(type==82) fread((void *)buf,sizeof(Float_t),18,in);  
	       if(BLE_CODE) swooip(buf,18);  // changed from buf,4  
	       //     if(ii<10) {printf("%d :: ",ii); for(int iii=0;iii<18;iii++) printf("%f,",buf[iii]); printf("\n");}

	        for(j=0;j<3;j++) xyz[j][ii]=buf[j]; 
       		xyz[7][ii]=buf[3]; 
		if(type==51) xyz[8][ii]=buf[4];
		if(type==81) {for(j=0;j<4;j++) xyz[j+8][ii]=buf[j+4];}
		if(type==82) {for(j=0;j<14;j++) xyz[j+8][ii]=buf[j+4];}
	        xyz[3][ii]=tU1; xyz[4][ii]=tU2; 
		xyz[5][ii]=tI1; xyz[6][ii]=tI2;
	

	if(WFOnOff[0])
	  {
	    sprintf(hisname1,"Ch. 1:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
	    new(entryp1[ii]) TH1F((const Char_t *)(hisname1),(const Char_t *)(hisname1),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
	  }

	if(WFOnOff[1])
	  {
	    sprintf(hisname2,"Ch. 2:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
            new(entryp2[ii]) TH1F((const Char_t *)(hisname2),(const Char_t *)(hisname2),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
	  }

	if(WFOnOff[2])
	  {
	    sprintf(hisname3,"Ch. 3:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
            new(entryp3[ii]) TH1F((const Char_t *)(hisname3),(const Char_t *)(hisname3),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
	  }

	if(WFOnOff[3])
	  {
       	    sprintf(hisname4,"Ch. 4:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
            new(entryp4[ii]) TH1F((const Char_t *)(hisname4),(const Char_t *)(hisname4),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
	  }


	for(k=0;k<4;k++)
	  {
	   if(WFOnOff[k]==1 && k<4)
	      {
	       	//	printf("reading ...... %d %d ... ",k,ftell(in));
		numread=fread(buf,sizeof(Float_t),NP,in);  if(BLE_CODE) swooip(buf, NP); // printf("%f %f %f\n",buf[NP-3],buf[NP-2],buf[NP-1]);
	       	//	printf("read ...... %d(%d)\n",numread,ii);  if(ii==17) return;
		//fread(buf,sizeof(Float_t),NP,in);  swooip(buf, NP);
		for(j=0;j<NP;j++)
		  {
		         //if(ii<2) if(j%20!=0) printf("%5.2f", buf[j]); else printf("%5.2f\n", buf[j]);
		    switch(k)
		      {
			case 0: 
			  ((TH1F*)entryp1[ii])->SetBinContent(j+1,buf[j]);
      			  //if(j==0) printf("ii=%d k=%d j=%d, buf=%f\n",ii,k,j,buf[j]*1e-3);
      			  //if(ii=0) printf("ii=%d k=%d j=%d, buf=%f\n",ii,k,j,buf[j]*1e-3);
			  break;
			case 1: 
			  ((TH1F*)entryp2[ii])->SetBinContent(j+1,buf[j]);
			  break;
			case 2: 
			  ((TH1F*)entryp3[ii])->SetBinContent(j+1,buf[j]);
			  break;
			case 3: 
       			  ((TH1F*)entryp4[ii])->SetBinContent(j+1,buf[j]);
			  break;
		      }
		  }
		
		//		printf("k=%d \n",k);
	
	      }
	
	  }
	
	     }
	
	 }

       }

  //fclose(in);
}



void  PSTCT::ReadWFs(Float_t time0)
{
  Int_t i,ii,j,k,q,r;
  Float_t data,tU1,tU2,tI1,tI2;
  Char_t hisname1[100];
  Char_t hisname2[100];
  Char_t hisname3[100];
  Char_t hisname4[100];
  TClonesArray &entryp1 = *histo1;  
  TClonesArray &entryp2 = *histo2;  
  TClonesArray &entryp3 = *histo3;  
  TClonesArray &entryp4 = *histo4;  
   

  for(q=0;q<NU1;q++)
       {
     for(r=0;r<NU2;r++)
         {

           if(type!=11) 
	     {
      	       fscanf(in,"%f %f %f %f",&tU1,&tU2,&tI1,&tI2);	     
	       // printf("%d %d :: %f %f %f %f\n",r,q,tU1,tU2,tI1,tI2);	     
		 U1[q]=tU1; I1[r+q*NU2]=tI1;
	         U2[r]=tU2; I2[r+q*NU2]=tI2;
	     }
	     
    
	   for(i=0;i<numxyz;i++)
	     {

        ii=i+numxyz*r+(NU2*numxyz)*q;
	
			if(type==22 || type==33) 
			  {
			    for(j=0;j<4;j++) fscanf(in,"%f",&xyz[j][ii]); xyz[7][ii]=xyz[3][ii]; 
			    xyz[3][ii]=tU1; xyz[4][ii]=tU2; xyz[5][ii]=tI1; xyz[6][ii]=tI2;
			  } 
			 if(type==11) for(j=0;j<5;j++) fscanf(in,"%f",&xyz[j][ii]);

			if(WFOnOff[0])
			  {
				sprintf(hisname1,"Ch. 1:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
				new(entryp1[ii]) TH1F((const Char_t *)(hisname1),(const Char_t *)(hisname1),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
			  }
			if(WFOnOff[1])
			  {
				sprintf(hisname2,"Ch. 2:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
					new(entryp2[ii]) TH1F((const Char_t *)(hisname2),(const Char_t *)(hisname2),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
			  }
			if(WFOnOff[2])
			  {
				sprintf(hisname3,"Ch. 3:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
					new(entryp3[ii]) TH1F((const Char_t *)(hisname3),(const Char_t *)(hisname3),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
			  }

			if(WFOnOff[3])
			  {
				sprintf(hisname4,"Ch. 4:x=%5.3e,y=%5.3e,z=%5.3e,U1=%4.2f, U2=%4.2f ",xyz[0][ii],xyz[1][ii],xyz[2][ii],xyz[3][ii],xyz[4][ii]);
					new(entryp4[ii]) TH1F((const Char_t *)(hisname4),(const Char_t *)(hisname4),NP,t0*1e9-time0,(NP*dt+t0)*1e9-time0);
			  }


			for(k=0;k<4;k++)
			  {
			   if(WFOnOff[k]==1)
				  {
				for(j=0;j<NP;j++)
				  {
					fscanf(in,"%e",&data); //printf("%e ",data);
					switch(k)
					  {
					case 0: 
					  ((TH1F*)entryp1[ii])->SetBinContent(j+1,data);
					  break;
					case 1: 
					  ((TH1F*)entryp2[ii])->SetBinContent(j+1,data);
					  break;
					case 2: 
					  ((TH1F*)entryp3[ii])->SetBinContent(j+1,data);
					  break;
					case 3: 
					  ((TH1F*)entryp4[ii])->SetBinContent(j+1,data);
					  break;

					  }
				  }
			  //	  printf("k=%d \n",k);
				  }
			  }
       }
	 }
  }
    //fclose(in); 
}

//void PSTCT::GetInfo(int ch, int index)
//{ printf("Event #no=%d , ch#=%d:\n",ch,index);}

TH1F *PSTCT::GetHA(int ch , int index)  
{
  TH1F *his;
  switch(ch)
    {
    case 0: 
      his=(TH1F *)histo1->At(index); 
      his->SetLineColor(1);
      break;
    case 1: his=(TH1F *)histo2->At(index); 
      his->SetLineColor(2);
      break;
    case 2: his=(TH1F *)histo3->At(index); 
      his->SetLineColor(4);
      break;
    case 3: his=(TH1F *)histo4->At(index); 
      his->SetLineColor(5);
      break;
    default: his=NULL; break;
    }
  his->GetXaxis()->SetTitle("t [ns]");
  his->GetYaxis()->SetTitle("I [arb.]");

  if(SubHis!=NULL) // if substraction of the waveform is required
    {    
    his=SubRefWF(his,SubHisCopy);
    }

  if(RefC!=-1)  // if reflection correction is required
      return CorrReflCopy(his);
  else
    return(his); // return histogram
}

TH1F *PSTCT::GetHA(Int_t ch , Int_t x, Int_t y, Int_t z, Int_t nu1, Int_t nu2)  
{
  return(GetHA(ch,indx(x,y,z,nu1,nu2)));
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



TH1F *PSTCT::ModGetHA(Int_t ch, Int_t index1, Float_t lrange, Float_t rrange)  
{
        //
	// his = his1 - his 2
	// his2 default graf (index2 = 0 default)

  TH1F *his1, *his2, *his;
  
  Float_t B,A,C;
  Int_t i,p,lbin,rbin,q, index2 = RefInd;  
   
  if(RefInd<0 || RefInd>numxyz*NU1*NU2) return GetHA(ch,index1);                             
   
  switch(ch)
    {
    case 0: 
      his1=(TH1F *)histo1->At(index1);
	  his2=(TH1F *)histo1->At(index2);
      his=new TH1F("txt","txt",his1->GetNbinsX(),his1->GetBinCenter(1),his1->GetBinCenter(his1->GetNbinsX()));
	  his->SetLineColor(1);
      break;
    case 1: 
	  his1=(TH1F *)histo2->At(index1);
	  his2=(TH1F *)histo2->At(index2);
      his=new TH1F("txt","txt",his1->GetNbinsX(),his1->GetBinCenter(1),his1->GetBinCenter(his1->GetNbinsX()));		
      his->SetLineColor(2);
      break;
    case 2: 
	  his1=(TH1F *)histo3->At(index1);
	  his2=(TH1F *)histo3->At(index2);
      his=new TH1F("txt","txt",his1->GetNbinsX(),his1->GetBinCenter(1),his1->GetBinCenter(his1->GetNbinsX()));		
      his->SetLineColor(4);
      break;
    case 3: 
	  his1=(TH1F *)histo4->At(index1);
	  his2=(TH1F *)histo4->At(index2);
      his=new TH1F("txt","txt",his1->GetNbinsX(),his1->GetBinCenter(1),his1->GetBinCenter(his1->GetNbinsX()));		
      his->SetLineColor(5);
      break;
    default: his=NULL; break;
    }

  if (lrange==-1111 && rrange==-1111)
  {
	  lbin = 1;
	  rbin = his1->GetNbinsX();	  
  }
  else
  {
	for(p=0;p<=his1->GetNbinsX();p++)
		{			
			if (lrange >= his1->GetBinCenter(p) && lrange <= his1->GetBinCenter(p+1)) lbin = p;
			if (rrange >= his1->GetBinCenter(p) && rrange <= his1->GetBinCenter(p+1)) rbin = p;
		}	
  }

		for(i=0;i<his1->GetNbinsX();i++) 
		{	
			if(lbin<=i && i<=rbin)
			{
				B=his1->GetBinContent(i);
				A=his2->GetBinContent(i);		
				C = B-A;
				his->SetBinContent(i,C);			
			}else his->SetBinContent(i,his1->GetBinContent(i));
		}	

	return his;
}

TH1F *PSTCT::ModGetHA(Int_t ch , Int_t x, Int_t y, Int_t z, Int_t nu1, Int_t nu2, Float_t lrange, Float_t rrange)  
{
  return(ModGetHA(ch,indx(x,y,z,nu1,nu2),lrange,rrange));
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



TH1F *PSTCT::AverageGetHA(Int_t ch , Int_t start, Int_t stop, Int_t avrg, Int_t v1, Int_t v2, Int_t v3, Int_t v4)  
{
        // Function is used to get the average wafeform:
        // Int_t ch; channel number - amplifier number
        // Int_t start; start index of the average
        // Int_t stop;  stop index of the average
        // Int_t avrg; decides over which direction it calcultes the average
	//avrg = 0  -> x  
	//avrg = 1  -> y
	//avrg = 2  -> z
	//avrg = 3  -> U1
	//avrg = 4  -> U2
        // Int_t v1,v2,v3,v4; are the indexes of the other paramters in the same order as for average

Int_t i,j,t,n,u1s,u2s,u1e,u2e,q1,q2;
Int_t *s[5];
TH1F *his1,*his2;
Float_t zbir;

switch(avrg)
{
	case 0:			
		s[0] = &i,s[1] = &v1,s[2] = &v2,s[3] = &v3,s[4] = &v4;
		if (stop>Nx) stop = Nx;
		if (start<0) start = 0;
	break;
	case 1:		
		s[0] = &v1,s[1] = &i,s[2] = &v2,s[3] = &v3,s[4] = &v4;
		if (stop>Ny) stop = Ny;
		if (start<0) start = 0;
	break;
	case 2:			
		s[0] = &v1,s[1] = &v2,s[2] = &i,s[3] = &v3,s[4] = &v4;
		if (stop>Nz) stop = Nz;
		if (start<0) start = 0;
	break;
	case 3:	
		s[0] = &v1,s[1] = &v2,s[2] = &v3,s[3] = &i,s[4] = &v4;
		if (stop>NU1) stop = NU1;
		if (start<0) start = 0;
	break;
	case 4:			
		s[0] = &v1,s[1] = &v2,s[2] = &v3,s[3] = &v4,s[4] = &i;
		if (stop>NU2) stop = NU2;
		if (start<0) start = 0;
	break;
}

if ((start==-1111 && stop==-1111) || (start==0 && stop==0)) n=1;
else n=stop-start;
	

	his1=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);
	his2 = new TH1F();
	his1->Copy(*his2);
    his2->Reset();

		 for(i=start;i<stop;i++)
		 {			   				
		   his1=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);
		   his2->Add(his1);			  
		 }	 
	
	his2->Scale(1./n);

  return his2;
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Int_t PSTCT::indx(int x, int y, int z, int nu1, int nu2) 
{
  // Function returns the index of the position of the waveform corresponding to x,y,z,nu1,nu2 in the linear array of waveforms.
  // int x; index in the X direction
  // int y; index in the Y direction
  // int z; index in the Z direction
  // int nu1; index of desired votlage (1)
  // int nu2; index of desired voltage (2)
  if(x>Nx-1 || x<0) {printf("index x: out of range\n"); return 0;}
  if(y>Ny-1 || y<0) {printf("index y: out of range\n"); return 0;}
  if(z>Nz-1 || z<0) {printf("index z: out of range\n"); return 0;}
  if(nu1>NU1-1 || nu1<0) {printf("index nu1: out of range\n"); return 0;}
  if(nu2>NU2-1 || nu2<0) {printf("index nu2: out of range\n"); return 0;}

  return( (x+Nx*y+(Nx*Ny)*z)+numxyz*nu2+(NU2*numxyz)*nu1 );
};

void PSTCT::cords(int ix)
{
  // int ix; index valuex = event;
  //xyz values :
  //0 - x
  //1 - z
  //2 - z
  //3 - U1
  //4 - U2
  //5 - I1
  //6 - I2
  //7 - Beam monitor
  //8 - time
  //9 - T laser 
  //10 - T box
  //11 - Vtresh

  printf("Time(%d)=%f \n Position :: X(%d)=%f, Y(%d)=%f, Z(%d)=%f \n Bias :: ",ix,xyz[8][ix],ix,xyz[0][ix],ix,xyz[1][ix],ix,xyz[2][ix]);
  printf("U1(%d)=%f, U2(%d)=%f, I1(%d)=%f, I2(%d)=%f \n",ix,xyz[3][ix],ix,xyz[4][ix],ix,xyz[5][ix],ix,xyz[6][ix]);
  printf("Beam Monitor Value :: (%d)=%f \n",ix,xyz[7][ix]);
  printf("Laser Values :: T1(%d)=%f C, T2(%d)=%f C, Vtresh(%d)=%f mV\n",ix,xyz[9][ix],ix,xyz[10][ix],ix,xyz[11][ix]);
  printf("Used data (%d):: ",ix); for(int ii=0;ii<10;ii++) printf(" %f ",xyz[12+ii][ix]); 
  printf("\n");

};


/*TH2F *PSTCT::Draw(Int_t ch, Int_t mode, Int_t nu1, Int_t nu2, Float_t tlow, Float_t thi)
{
	// case: 0 - select x,y
	// case: 1 - select x,z
	// case: 2 - select x,U1
	// case: 3 - select x,U2
	// case: 4 - select y,z
	// case: 5 - select y,U1
	// case: 6 - select y,U2
	// case: 7 - select z,U1
	// case: 8 - select z,U2
	// case: 9 - select U1,U2

	Char_t txt[100];
Float_t integral,max,min;
Int_t i,j,left,right;

 sprintf(txt,"2d his (%f %f)",U1[nu1],U2[nu1]);

TH2F *his2=new TH2F(txt,txt,Nx,x0,Nx*dx+x0,Ny,y0,Ny*dy+y0);
TH1F *his;

    for(j=0;j<Ny;j++)
     for(i=0;i<Nx;i++)
     {
       switch(mode)
	 {
     case 0:		// integral
	   his=GetHA(ch,i,j,0,nu1,nu2);
	   right=his->GetXaxis()->FindBin(thi);
	   left=his->GetXaxis()->FindBin(tlow);
	   integral=his->Integral(left,right);
	   break;
	 case 1:		// max
	    integral=GetHA(ch,i,j,0,nu1,nu2)->GetMaximum();
	    break;
	 case 2:		// min
	    integral=GetHA(ch,i,j,0,nu1,nu2)->GetMinimum();
	    break; 
	 }
       his2->SetBinContent(i,j,integral);
     }
    
	   max=his2->GetMaximum();
	   min=his2->GetMinimum();

	   if(TMath::Abs(max)>TMath::Abs(min)) 
	     his2->SetMinimum(-TMath::Abs(max)); 
	        else 
	     his2->SetMaximum(TMath::Abs(min));

        return his2;
	}*/

Float_t PSTCT::GetWidth(TH1F *his, Int_t &lbin, Int_t &hbin, Float_t tleft, Float_t tright, Float_t minwidth, Float_t maxwidth, Int_t percentage)
{
	//his -> histogram
	//tleft -> left margin, default 0
	//tright -> right margin, default 25
	//minwidth -> min signal width, default -1111
	//maxwidth -> max signal width, default -1111
	//percentage -> height of min and max, default 50 (50%)

	//return Dt -> ok	
	//return -No of points -> if minwidth & maxwidth are default values
	//return -53 -> error

Float_t q [100];
Int_t j = 0,i,i1,i2,index1,index2,pp;
Float_t val,valn;
Float_t Dt=0,pDt;
Float_t max=0,pmax,max2;
//Float_t *res=new Float_t [3];

	for(i=his->GetXaxis()->FindBin(tleft);i<his->GetXaxis()->FindBin(tright);i++) 
	{
		pmax=his->GetBinContent(i);

		if(max<pmax)
			{
				max=pmax;
				max2=max*percentage/100;			
			}
	}	


	for(i=his->GetXaxis()->FindBin(tleft);i<his->GetXaxis()->FindBin(tright);i++) 
		
	{
		valn=his->GetBinContent(i+1);
		val=his->GetBinContent(i);
		
		if((val<=max2 && valn>max2) || (val>max2 && valn<=max2))	
			 {
				q[j]=his->GetBinCenter(i);				
			    j++;
			 }
	}	

	//	printf("Maximum :: %f\n",max);

	if(j==2)
	       {
	         //printf("Interval %f %f\n",q[0],q[1]);	       
		 lbin=his->GetXaxis()->FindBin(q[0]);
		 hbin=his->GetXaxis()->FindBin(q[1]);
		 return Dt = q[1]-q[0]; 
		 
	       }
	
	else if(j>2)
	{
		if((minwidth==-1111 || maxwidth==-1111)||(minwidth==0 || maxwidth==0)) return -j;		
		else
		{	
			index1=j-1;
			while(index1>0)			
			{	
				index2 = index1-1;
				while(index2>=0)			
				{							
					pDt=q[index1]-q[index2];
					//printf("q[%d] :: %f, q[%d] :: %f, pDt :: %f\n",index1,q[index1],index2,q[index2],pDt);
					if(maxwidth>=pDt && pDt>=minwidth)
					{
						if(pDt>Dt)
						{
							Dt=pDt;
						}
					}
					index2--;
				}
				index1--;
			}
			//printf("Interval %d %d\n",index1,index2);	       
			lbin=his->GetXaxis()->FindBin(q[index1]);
			hbin=his->GetXaxis()->FindBin(q[index2]);
			return Dt;
		}		
	}else return -53;
}


TH2F *PSTCT::Draw(Int_t ch, Int_t stype, Int_t mode, Int_t v1, Int_t v2, Int_t v3, Float_t tlow, Float_t thi)
{
        //  Int_t ch; channel number
        //  Int_t stype
	// case: 0 - select x,y
	// case: 1 - select x,z
	// case: 2 - select x,U1
	// case: 3 - select x,U2
	// case: 4 - select y,z
	// case: 5 - select y,U1
	// case: 6 - select y,U2
	// case: 7 - select z,U1
	// case: 8 - select z,U2
	// case: 9 - select U1,U2
        // Int_t mode; 
        //          mode =0 -> Integral
        //          mode =1 -> maximum signal
        //          mode =2 -> minimum signal
        //          mode =3 -> width of the signal
        // Int_t v1,v2,v3; indexes of the remaining three parameters (order always follows x,y,z,U1,U2) 
        // Float_t tlow, thi; Time windos of the plots
        // 
        // 
        // Example :
        // //plot channel 0 of the, yz plot, with indexesx=0, U1=0, U2=0, in the time windows [0,30 ns]
        //  TH2F *plot=aa.Draw(0,4,0,0,0,0,0,20); 
        //  plot->Draw("COLZ");

Char_t txt[100];
Float_t integral,max,min,width;
Int_t i,j,left,right,t,pX,pY,u1s,u1e,u2s,u2e;
Int_t *s[5];
Int_t lbin,hbin;

TH2F *his2;
TH1F *his;

switch(stype)
{
case 0://x,y
	t = indx(0,0,v1,v2,v3);
	sprintf(txt,"2d his (Z[%d]=%f U1[%d]=%f U2[%d]=%f)",v1,xyz[2][t],v2,xyz[3][t],v3,xyz[4][t]);
	his2 = new TH2F(txt,txt,Nx,x0,Nx*dx+x0,Ny,y0,Ny*dy+y0);
	s[0] = &i,s[1] = &j,s[2] = &v1,s[3] = &v2,s[4] = &v3;
	pX=Nx; pY=Ny;
break;
case 1://x,z
	t = indx(0,v1,0,v2,v3);
	sprintf(txt,"2d his (Y[%d]=%f U1[%d]=%f U2[%d]=%f)",v1,xyz[1][t],v2,xyz[3][t],v3,xyz[4][t]);
	his2 = new TH2F(txt,txt,Nx,x0,Nx*dx+x0,Nz,z0,Nz*dz+z0);	
	s[0] = &i,s[1] = &v1,s[2] = &j,s[3] = &v2,s[4] = &v3;
	pX=Nx; pY=Nz;		
break;
case 2://x,U1
	t = indx(0,v1,v2,0,v3);
	sprintf(txt,"2d his (Y[%d]=%f Z[%d]=%f U2[%d]=%f)",v1,xyz[1][t],v2,xyz[2][t],v3,xyz[4][t]);
	if(U1[NU1-1]<U1[0]) {u1s=U1[NU1-1]; u1e=U1[0];} else { u1s=U1[0]; u1e=U1[NU1-1];}
	his2 = new TH2F(txt,txt,(Int_t) Nx,(Float_t) x0,Nx*dx+x0,NU1,u1s,u1e);
	s[0] = &i,s[1] = &v1,s[2] = &v2,s[3] = &j,s[4] = &v3;
	pX=Nx; pY=NU1;		
break;
case 3://x,U2
	t = indx(0,v1,v2,v3,0);
	sprintf(txt,"2d his (Y[%d]=%f Z[%d]=%f U1[%d]=%f)",v1,xyz[1][t],v2,xyz[2][t],v3,xyz[3][t]);
	if(U2[NU2-1]<U2[0]) {u2s=U2[NU2-1]; u2e=U2[0];} else { u2s=U2[0]; u2e=U2[NU2-1];}
	his2 = new TH2F(txt,txt,Nx,x0,Nx*dx+x0,NU2,u2s,u2e);
	s[0] = &i,s[1] = &v1,s[2] = &v2,s[3] = &v3,s[4] = &j;
	pX=Nx; pY=NU2;
break;
case 4://y,z	
	t = indx(v1,0,0,v2,v3);
	sprintf(txt,"2d his (X[%d]=%f U1[%d]=%f U2[%d]=%f)",v1,xyz[2][t],v2,xyz[3][t],v3,xyz[4][t]);
	his2 = new TH2F(txt,txt,Ny,y0,Ny*dy+y0,Nz,z0,Nz*dz+z0);
	s[0] = &v1,s[1] = &i,s[2] = &j,s[3] = &v2,s[4] = &v3;
	pX=Ny; pY=Nz;			
break;
case 5://y,U1	
	t = indx(v1,0,v2,0,v3);
	sprintf(txt,"2d his (X[%d]=%f Z[%d]=%f U2[%d]=%f)",v1,xyz[0][t],v2,xyz[2][t],v3,xyz[4][t]);
	if(U1[NU1-1]<U1[0]) {u1s=U1[NU1-1]; u1e=U1[0];} else { u1s=U1[0]; u1e=U1[NU1-1];}
	his2 = new TH2F(txt,txt,Ny,y0,Ny*dy+y0,NU1,u1s,u1e);
	s[0] = &v1,s[1] = &i,s[2] = &v2,s[3] = &j,s[4] = &v3;
	pX=Ny; pY=NU1;
	
break;
case 6://y,U2	
	t = indx(v1,0,v2,v3,0);
	sprintf(txt,"2d his (X[%d]=%f Z[%d]=%f U1[%d]=%f)",v1,xyz[0][t],v2,xyz[2][t],v3,xyz[3][t]);
	if(U2[NU2-1]<U2[0]) {u2s=U2[NU2-1]; u2e=U2[0];} else { u2s=U2[0]; u2e=U2[NU2-1];}
	his2 = new TH2F(txt,txt,Ny,y0,Ny*dy+y0,NU2,u2s,u2e);
	s[0] = &v1,s[1] = &i,s[2] = &v2,s[3] = &v3,s[4] = &j;
	pX=Ny; pY=NU2;			
break;
case 7://z,U1	
	t = indx(v1,v2,0,0,v3);
	sprintf(txt,"2d his (X[%d]=%f Y[%d]=%f U2[%d]=%f)",v1,xyz[0][t],v2,xyz[1][t],v3,xyz[4][t]);
	if(U1[NU1-1]<U1[0]) {u1s=U1[NU1-1]; u1e=U1[0];} else { u1s=U1[0]; u1e=U1[NU1-1];}
	his2 = new TH2F(txt,txt,Nz,z0,Nz*dz+z0,NU1,u1s,u1e);
	s[0] = &v1,s[1] = &v2,s[2] = &i,s[3] = &j,s[4] = &v3;
	pX=Nz; pY=NU1;			
break;
case 8://z,U2	
	t = indx(v1,v2,0,v3,0);
	sprintf(txt,"2d his (X[%d]=%f Y[%d]=%f U1[%d]=%f)",v1,xyz[0][t],v2,xyz[1][t],v3,xyz[3][t]);
	if(U2[NU2-1]<U2[0]) {u2s=U2[NU2-1]; u2e=U2[0];} else { u2s=U2[0]; u2e=U2[NU2-1];}
	his2 = new TH2F(txt,txt,Nz,z0,Nz*dz+z0,NU2,u2s,u2e);
	s[0] = &v1,s[1] = &v2,s[2] = &i,s[3] = &v3,s[4] = &j;
	pX=Nz; pY=NU2;
break;
case 9://U1,U2	
	t = indx(v1,v2,v3,0,0);
	sprintf(txt,"2d his (X[%d]=%f Y[%d]=%f Z[%d]=%f)",v1,xyz[0][t],v2,xyz[1][t],v3,xyz[2][t]);
	if(U2[NU2-1]<U2[0]) {u2s=U2[NU2-1]; u2e=U2[0];} else { u2s=U2[0]; u2e=U2[NU2-1];}
	if(U1[NU1-1]<U1[0]) {u1s=U1[NU1-1]; u1e=U1[0];} else { u1s=U1[0]; u1e=U1[NU1-1];}
    his2 = new TH2F(txt,txt,NU1,u1s,u1e,NU2,u2s,u2e);
	s[0] = &v1,s[1] = &v2,s[2] = &v3,s[3] = &i,s[4] = &j;
	pX=NU1; pY=NU2;		
break;
}

			for(j=0;j<pY;j++)
			 for(i=0;i<pX;i++)
			 {
				
			   switch(mode)
			 {			
			 case 0:		// integral					
			   his=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);			   
			   right=his->GetXaxis()->FindBin(thi);
			   left=his->GetXaxis()->FindBin(tlow);	
			   integral=his->Integral(left,right);
			   //printf("Vrednost integrala :: %f\n",integral);
			   break;
			 case 1:		// max
   
				his=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);
			        //integral=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);
			        his->SetAxisRange(tlow,thi);
				integral=his->GetMaximum();
				width = GetWidth(his,lbin,hbin,0,40);
				//if(width > 0)
				//{
				//	printf("[i,j,width] = [%d  %d  %f]\n",i,j,width);
				//}				
				break;
			 case 2:		// min		  	   
			         
			       his=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);
  		               his->SetAxisRange(tlow,thi);
			       integral=his->GetMinimum();
				break; 
			 case 3:		// Dt
				his=GetHA(ch,*s[0],*s[1],*s[2],*s[3],*s[4]);	
				integral = GetWidth(his,lbin,hbin,30,60,3,5);
				break; 
			 }
			   //			   printf("i=%d,j=%d int=%f:: %d %d %d %d %d\n",i,j,integral,*s[0],*s[1],*s[2],*s[3],*s[4]);
			   //printf("i=%d,j=%d int=%f:: %d %d %d %d %d\n",i,j,integral,*s[0],*s[1],*s[2],*s[3],*s[4]);
			   his2->SetBinContent(i+1,j+1,integral);
			 }	   

			   max=his2->GetMaximum();
			   min=his2->GetMinimum();

			   if(TMath::Abs(max)>TMath::Abs(min)) 
				 his2->SetMinimum(-TMath::Abs(max)); 
					else 
				 his2->SetMaximum(TMath::Abs(min));
			   his2->Draw("SURF2");
				return his2;
}


// void PSTCT::DrawMulti(Int_t ch,Int_t dir, Int_t x1,Int_t x2);
// {
//   Int_t i=0,ix;
//   for(i=x1;i<=x2;i++)
//     {
//       switch(dir)
// 	{
// 	case 0: ix=indx(i,
// 	}
      
//     }
// }


MeasureWF *PSTCT::Projection(Int_t num, Int_t *List)
{

  Float_t Delta;
  Int_t i=0,ix;
  MeasureWF *MWF=new MeasureWF(num);
  TH1F *his;
    for(i=0;i<num;i++)
        {
	ix=indx(List[i*6+1],List[i*6+2],List[i*6+3],List[i*6+4],List[i*6+5]);     
	his=GetHA(List[i*6],ix);
	MWF->AddHisto(i,i,his);
        }
    strcpy(MWF->suffix,"");
    MWF->DrawMode=false;
    strcpy(MWF->prefix,"wf="); 
    return MWF;
}





MeasureWF *PSTCT::Projection(int ch, int dir,int x,int y,int z, int nu1, int nu2, int num)
{
  // Projection parameters
  // int ch  -> channel number 
  // int dir -> direction of the projection
  // int x   -> x0 of the projection
  // int y   -> y0 of the projection
  // int z   -> z0 of the projection
  // int nu1 -> voltage 1
  // int nu1 -> voltage 2
  // int num -> number of wfs
  
  Float_t Delta;
  Int_t i=0,ix;
  MeasureWF *MWF=new MeasureWF(num);
  TH1F *his;
    for(i=0;i<num;i++)
        {
         switch(dir)  
	   {
	   case 0: ix=indx(i+x,y,z,nu1,nu2); Delta=i*dx; strcpy(MWF->prefix,"x=");   strcpy(MWF->suffix," #mum"); break;
	   case 1: ix=indx(x,y+i,z,nu1,nu2); Delta=i*dy; strcpy(MWF->prefix,"y=");   strcpy(MWF->suffix," #mum"); break;
	   case 2: ix=indx(x,y,z+i,nu1,nu2); Delta=i*dz; strcpy(MWF->prefix,"z=");   strcpy(MWF->suffix," #mum"); break;
	   case 3: ix=indx(x,y,z,nu1+i,nu2); Delta=U1[nu1+i]; strcpy(MWF->prefix,"U1="); strcpy(MWF->suffix," V");    break;
	   case 4: ix=indx(x,y,z,nu1,nu2+i); Delta=U2[nu2+i]; strcpy(MWF->prefix,"U2="); strcpy(MWF->suffix," V");    break;
	   default: ix=indx(i+x,y,z,nu1,nu2); Delta=i*dx; break;
       	   }
	his=GetHA(ch,ix);
	// Filtering/Corrections


	// 
	MWF->AddHisto(i,Delta,his);
        }
    MWF->DrawMode=false;
    //    strcpy(MWF->suffix," #mum");
    return MWF;
}



void PSTCT::DrawList(Int_t num, Int_t *List)
{
  Float_t Delta;
  Int_t i=0,ix;
  TH1F *his;
    for(i=0;i<num;i++)
        {
	  his=GetHA(List[i*6],List[i*6+1],List[i*6+2],List[i*6+3],List[i*6+4],List[i*6+5]);
	  if(i==0) his->DrawCopy(); else his->DrawCopy("SAME");
        }

}

void PSTCT::DrawList(Int_t num, Int_t *ListC,Int_t *ListP)
{
  // Function draws the list 
  Float_t Delta;
  Int_t i=0,ix;
  TH1F *his;
    for(i=0;i<num;i++)
        {
	  his=GetHA(ListC[i],ListP[i]);
	  if(i==0) his->Draw(); else his->Draw("SAME");
        }

}

void PSTCT::CorrectBaseLine(Float_t xc)
{
  // Function corrects the baseline (DC offset) of all wafeforms
  // Float_t xc ; time denoting the start of the pulse 
  //              correction factor is calculated from all the bins before xc 
  Int_t right[4],left[4];
  Int_t i,j,k;
  Double_t sum=0,corr[4];
  TH1F *his[4];
  Int_t Num=numxyz*NU1*NU2; //number of all waveforms

  
  for(j=0;j<Num;j++)
    {
    if(j==0)  printf("Baseline correction (%d waveforms) :: ",Num);

      if(WFOnOff[0]==1) his[0]=((TH1F *)histo1->At(j));
      if(WFOnOff[1]==1) his[1]=((TH1F *)histo2->At(j));
      if(WFOnOff[2]==1) his[2]=((TH1F *)histo3->At(j));
      if(WFOnOff[3]==1) his[3]=((TH1F *)histo4->At(j));

    for(i=0;i<4;i++)
      {
	if(WFOnOff[i]==1)
	  {
	    right[i]=his[i]->GetXaxis()->FindBin(xc);
	    left[i]=1;
	    his[i]->Integral(left[i],right[i]);
	    corr[i]=his[i]->Integral(left[i],right[i])/(right[i]-left[i]);
	  }
      }

    if(j%100==0) printf("."); 
      //printf("%d :: Baseline correction = %e , Integral before trigger=%e , Nbins=%d!\n",j,corr,his->Integral(left,right),right-left);

    for(k=0;k<3;k++)
      if(WFOnOff[k]==1)
      for(i=1;i<his[k]->GetNbinsX();i++)
	his[k]->SetBinContent(i,his[k]->GetBinContent(i)-corr[k]);
      
    }
  
printf(" finished\n"); 

}


TGraph *PSTCT::DrawArray(Int_t wh1, Int_t wh2)
 {
   // Function draws values in array vs values in second array.
   // For each waveform taken the values of:
   // x,y,z,U1,I1,U2,I2,BM,time  are recorded (note that is also
   // the enumeration order)

   TGraph *gr=NULL;

   if(wh1>=0 &&  wh1<12 && wh2>=0 &&  wh2<12)
     {
     gr=new TGraph(numxyz,xyz[wh1],xyz[wh2]); 
     }
   else 
     printf("Indexes out of range!");


   gr->SetMarkerStyle(20);
   gr->SetMarkerColor(1);
   return gr;
}



void PSTCT::PrintInfo()
{
  // Function prints the information about the class and its members
  
  Int_t i,j;
  printf("Format of the file %d\n",type); 
  printf("*************************************\n");
  if(User!=NULL) printf("User: %s \n",User);
  if(Sample!=NULL) printf("Sample: %s \n",Sample);
  if(Comment!=NULL) printf("Comment: %s \n",Comment);
  printf("*************************************\n");
  printf("Date and time of the meaurement: %d.%d.%d %d:%d:%d\n",Date[0],Date[1],Date[2],Date[3],Date[4],Date[5]);
  printf("Active osciloscope ch: Ch1=%d Ch2=%d Ch3=%d Ch4=%d \n",WFOnOff[0],WFOnOff[1],WFOnOff[2],WFOnOff[3]);
  printf("Number of points %d (X=%d, Y=%d, Z=%d)\n",Nx*Ny*Nz,Nx,Ny,Nz);
  printf("Positions: r0=(%f,%f,%f) dr=(%f,%f,%f) \n",x0,y0,z0,dx,dy,dz);
  printf("Time scale: points=%d, t0=%e, dt=%e\n",NP,t0,dt);

  printf("Temperature: %f\n",T);
  printf("Type of generation: %4.0f\n",Source);
  
  printf("Voltages: NU1=%d , NU2=%d::\n",NU1,NU2);
  for(i=0;i<NU1;i++) 
     for(j=0;j<NU2;j++) 
      printf("U1,U2(%f,%f)::I1,I2(%e,%e)\n",U1[i],U2[j],I1[j+NU2*i],I2[j+NU2*i]); printf("\n");
    

  
}


void  PSTCT::swoo(char *a, char *b) {
  // byte swaping (LABVIEW,HPUX g++)<->(LINUX g++, WINNT cl) 
  char c = *a;
  *a = *b; *b = c;
}

void PSTCT::swooip(float *in, int s) {
 // byte swaping (LABVIEW,HPUX g++)<->(LINUX g++, WINNT cl) 
  char *sr, b;
  while(s--) {
    sr=(char *)in;
    swoo(&sr[0], &sr[3]);
    swoo(&sr[1], &sr[2]);
    in++;
  }
}
 TCTScan.cxx:1
 TCTScan.cxx:2
 TCTScan.cxx:3
 TCTScan.cxx:4
 TCTScan.cxx:5
 TCTScan.cxx:6
 TCTScan.cxx:7
 TCTScan.cxx:8
 TCTScan.cxx:9
 TCTScan.cxx:10
 TCTScan.cxx:11
 TCTScan.cxx:12
 TCTScan.cxx:13
 TCTScan.cxx:14
 TCTScan.cxx:15
 TCTScan.cxx:16
 TCTScan.cxx:17
 TCTScan.cxx:18
 TCTScan.cxx:19
 TCTScan.cxx:20
 TCTScan.cxx:21
 TCTScan.cxx:22
 TCTScan.cxx:23
 TCTScan.cxx:24
 TCTScan.cxx:25
 TCTScan.cxx:26
 TCTScan.cxx:27
 TCTScan.cxx:28
 TCTScan.cxx:29
 TCTScan.cxx:30
 TCTScan.cxx:31
 TCTScan.cxx:32
 TCTScan.cxx:33
 TCTScan.cxx:34
 TCTScan.cxx:35
 TCTScan.cxx:36
 TCTScan.cxx:37
 TCTScan.cxx:38
 TCTScan.cxx:39
 TCTScan.cxx:40
 TCTScan.cxx:41
 TCTScan.cxx:42
 TCTScan.cxx:43
 TCTScan.cxx:44
 TCTScan.cxx:45
 TCTScan.cxx:46
 TCTScan.cxx:47
 TCTScan.cxx:48
 TCTScan.cxx:49
 TCTScan.cxx:50
 TCTScan.cxx:51
 TCTScan.cxx:52
 TCTScan.cxx:53
 TCTScan.cxx:54
 TCTScan.cxx:55
 TCTScan.cxx:56
 TCTScan.cxx:57
 TCTScan.cxx:58
 TCTScan.cxx:59
 TCTScan.cxx:60
 TCTScan.cxx:61
 TCTScan.cxx:62
 TCTScan.cxx:63
 TCTScan.cxx:64
 TCTScan.cxx:65
 TCTScan.cxx:66
 TCTScan.cxx:67
 TCTScan.cxx:68
 TCTScan.cxx:69
 TCTScan.cxx:70
 TCTScan.cxx:71
 TCTScan.cxx:72
 TCTScan.cxx:73
 TCTScan.cxx:74
 TCTScan.cxx:75
 TCTScan.cxx:76
 TCTScan.cxx:77
 TCTScan.cxx:78
 TCTScan.cxx:79
 TCTScan.cxx:80
 TCTScan.cxx:81
 TCTScan.cxx:82
 TCTScan.cxx:83
 TCTScan.cxx:84
 TCTScan.cxx:85
 TCTScan.cxx:86
 TCTScan.cxx:87
 TCTScan.cxx:88
 TCTScan.cxx:89
 TCTScan.cxx:90
 TCTScan.cxx:91
 TCTScan.cxx:92
 TCTScan.cxx:93
 TCTScan.cxx:94
 TCTScan.cxx:95
 TCTScan.cxx:96
 TCTScan.cxx:97
 TCTScan.cxx:98
 TCTScan.cxx:99
 TCTScan.cxx:100
 TCTScan.cxx:101
 TCTScan.cxx:102
 TCTScan.cxx:103
 TCTScan.cxx:104
 TCTScan.cxx:105
 TCTScan.cxx:106
 TCTScan.cxx:107
 TCTScan.cxx:108
 TCTScan.cxx:109
 TCTScan.cxx:110
 TCTScan.cxx:111
 TCTScan.cxx:112
 TCTScan.cxx:113
 TCTScan.cxx:114
 TCTScan.cxx:115
 TCTScan.cxx:116
 TCTScan.cxx:117
 TCTScan.cxx:118
 TCTScan.cxx:119
 TCTScan.cxx:120
 TCTScan.cxx:121
 TCTScan.cxx:122
 TCTScan.cxx:123
 TCTScan.cxx:124
 TCTScan.cxx:125
 TCTScan.cxx:126
 TCTScan.cxx:127
 TCTScan.cxx:128
 TCTScan.cxx:129
 TCTScan.cxx:130
 TCTScan.cxx:131
 TCTScan.cxx:132
 TCTScan.cxx:133
 TCTScan.cxx:134
 TCTScan.cxx:135
 TCTScan.cxx:136
 TCTScan.cxx:137
 TCTScan.cxx:138
 TCTScan.cxx:139
 TCTScan.cxx:140
 TCTScan.cxx:141
 TCTScan.cxx:142
 TCTScan.cxx:143
 TCTScan.cxx:144
 TCTScan.cxx:145
 TCTScan.cxx:146
 TCTScan.cxx:147
 TCTScan.cxx:148
 TCTScan.cxx:149
 TCTScan.cxx:150
 TCTScan.cxx:151
 TCTScan.cxx:152
 TCTScan.cxx:153
 TCTScan.cxx:154
 TCTScan.cxx:155
 TCTScan.cxx:156
 TCTScan.cxx:157
 TCTScan.cxx:158
 TCTScan.cxx:159
 TCTScan.cxx:160
 TCTScan.cxx:161
 TCTScan.cxx:162
 TCTScan.cxx:163
 TCTScan.cxx:164
 TCTScan.cxx:165
 TCTScan.cxx:166
 TCTScan.cxx:167
 TCTScan.cxx:168
 TCTScan.cxx:169
 TCTScan.cxx:170
 TCTScan.cxx:171
 TCTScan.cxx:172
 TCTScan.cxx:173
 TCTScan.cxx:174
 TCTScan.cxx:175
 TCTScan.cxx:176
 TCTScan.cxx:177
 TCTScan.cxx:178
 TCTScan.cxx:179
 TCTScan.cxx:180
 TCTScan.cxx:181
 TCTScan.cxx:182
 TCTScan.cxx:183
 TCTScan.cxx:184
 TCTScan.cxx:185
 TCTScan.cxx:186
 TCTScan.cxx:187
 TCTScan.cxx:188
 TCTScan.cxx:189
 TCTScan.cxx:190
 TCTScan.cxx:191
 TCTScan.cxx:192
 TCTScan.cxx:193
 TCTScan.cxx:194
 TCTScan.cxx:195
 TCTScan.cxx:196
 TCTScan.cxx:197
 TCTScan.cxx:198
 TCTScan.cxx:199
 TCTScan.cxx:200
 TCTScan.cxx:201
 TCTScan.cxx:202
 TCTScan.cxx:203
 TCTScan.cxx:204
 TCTScan.cxx:205
 TCTScan.cxx:206
 TCTScan.cxx:207
 TCTScan.cxx:208
 TCTScan.cxx:209
 TCTScan.cxx:210
 TCTScan.cxx:211
 TCTScan.cxx:212
 TCTScan.cxx:213
 TCTScan.cxx:214
 TCTScan.cxx:215
 TCTScan.cxx:216
 TCTScan.cxx:217
 TCTScan.cxx:218
 TCTScan.cxx:219
 TCTScan.cxx:220
 TCTScan.cxx:221
 TCTScan.cxx:222
 TCTScan.cxx:223
 TCTScan.cxx:224
 TCTScan.cxx:225
 TCTScan.cxx:226
 TCTScan.cxx:227
 TCTScan.cxx:228
 TCTScan.cxx:229
 TCTScan.cxx:230
 TCTScan.cxx:231
 TCTScan.cxx:232
 TCTScan.cxx:233
 TCTScan.cxx:234
 TCTScan.cxx:235
 TCTScan.cxx:236
 TCTScan.cxx:237
 TCTScan.cxx:238
 TCTScan.cxx:239
 TCTScan.cxx:240
 TCTScan.cxx:241
 TCTScan.cxx:242
 TCTScan.cxx:243
 TCTScan.cxx:244
 TCTScan.cxx:245
 TCTScan.cxx:246
 TCTScan.cxx:247
 TCTScan.cxx:248
 TCTScan.cxx:249
 TCTScan.cxx:250
 TCTScan.cxx:251
 TCTScan.cxx:252
 TCTScan.cxx:253
 TCTScan.cxx:254
 TCTScan.cxx:255
 TCTScan.cxx:256
 TCTScan.cxx:257
 TCTScan.cxx:258
 TCTScan.cxx:259
 TCTScan.cxx:260
 TCTScan.cxx:261
 TCTScan.cxx:262
 TCTScan.cxx:263
 TCTScan.cxx:264
 TCTScan.cxx:265
 TCTScan.cxx:266
 TCTScan.cxx:267
 TCTScan.cxx:268
 TCTScan.cxx:269
 TCTScan.cxx:270
 TCTScan.cxx:271
 TCTScan.cxx:272
 TCTScan.cxx:273
 TCTScan.cxx:274
 TCTScan.cxx:275
 TCTScan.cxx:276
 TCTScan.cxx:277
 TCTScan.cxx:278
 TCTScan.cxx:279
 TCTScan.cxx:280
 TCTScan.cxx:281
 TCTScan.cxx:282
 TCTScan.cxx:283
 TCTScan.cxx:284
 TCTScan.cxx:285
 TCTScan.cxx:286
 TCTScan.cxx:287
 TCTScan.cxx:288
 TCTScan.cxx:289
 TCTScan.cxx:290
 TCTScan.cxx:291
 TCTScan.cxx:292
 TCTScan.cxx:293
 TCTScan.cxx:294
 TCTScan.cxx:295
 TCTScan.cxx:296
 TCTScan.cxx:297
 TCTScan.cxx:298
 TCTScan.cxx:299
 TCTScan.cxx:300
 TCTScan.cxx:301
 TCTScan.cxx:302
 TCTScan.cxx:303
 TCTScan.cxx:304
 TCTScan.cxx:305
 TCTScan.cxx:306
 TCTScan.cxx:307
 TCTScan.cxx:308
 TCTScan.cxx:309
 TCTScan.cxx:310
 TCTScan.cxx:311
 TCTScan.cxx:312
 TCTScan.cxx:313
 TCTScan.cxx:314
 TCTScan.cxx:315
 TCTScan.cxx:316
 TCTScan.cxx:317
 TCTScan.cxx:318
 TCTScan.cxx:319
 TCTScan.cxx:320
 TCTScan.cxx:321
 TCTScan.cxx:322
 TCTScan.cxx:323
 TCTScan.cxx:324
 TCTScan.cxx:325
 TCTScan.cxx:326
 TCTScan.cxx:327
 TCTScan.cxx:328
 TCTScan.cxx:329
 TCTScan.cxx:330
 TCTScan.cxx:331
 TCTScan.cxx:332
 TCTScan.cxx:333
 TCTScan.cxx:334
 TCTScan.cxx:335
 TCTScan.cxx:336
 TCTScan.cxx:337
 TCTScan.cxx:338
 TCTScan.cxx:339
 TCTScan.cxx:340
 TCTScan.cxx:341
 TCTScan.cxx:342
 TCTScan.cxx:343
 TCTScan.cxx:344
 TCTScan.cxx:345
 TCTScan.cxx:346
 TCTScan.cxx:347
 TCTScan.cxx:348
 TCTScan.cxx:349
 TCTScan.cxx:350
 TCTScan.cxx:351
 TCTScan.cxx:352
 TCTScan.cxx:353
 TCTScan.cxx:354
 TCTScan.cxx:355
 TCTScan.cxx:356
 TCTScan.cxx:357
 TCTScan.cxx:358
 TCTScan.cxx:359
 TCTScan.cxx:360
 TCTScan.cxx:361
 TCTScan.cxx:362
 TCTScan.cxx:363
 TCTScan.cxx:364
 TCTScan.cxx:365
 TCTScan.cxx:366
 TCTScan.cxx:367
 TCTScan.cxx:368
 TCTScan.cxx:369
 TCTScan.cxx:370
 TCTScan.cxx:371
 TCTScan.cxx:372
 TCTScan.cxx:373
 TCTScan.cxx:374
 TCTScan.cxx:375
 TCTScan.cxx:376
 TCTScan.cxx:377
 TCTScan.cxx:378
 TCTScan.cxx:379
 TCTScan.cxx:380
 TCTScan.cxx:381
 TCTScan.cxx:382
 TCTScan.cxx:383
 TCTScan.cxx:384
 TCTScan.cxx:385
 TCTScan.cxx:386
 TCTScan.cxx:387
 TCTScan.cxx:388
 TCTScan.cxx:389
 TCTScan.cxx:390
 TCTScan.cxx:391
 TCTScan.cxx:392
 TCTScan.cxx:393
 TCTScan.cxx:394
 TCTScan.cxx:395
 TCTScan.cxx:396
 TCTScan.cxx:397
 TCTScan.cxx:398
 TCTScan.cxx:399
 TCTScan.cxx:400
 TCTScan.cxx:401
 TCTScan.cxx:402
 TCTScan.cxx:403
 TCTScan.cxx:404
 TCTScan.cxx:405
 TCTScan.cxx:406
 TCTScan.cxx:407
 TCTScan.cxx:408
 TCTScan.cxx:409
 TCTScan.cxx:410
 TCTScan.cxx:411
 TCTScan.cxx:412
 TCTScan.cxx:413
 TCTScan.cxx:414
 TCTScan.cxx:415
 TCTScan.cxx:416
 TCTScan.cxx:417
 TCTScan.cxx:418
 TCTScan.cxx:419
 TCTScan.cxx:420
 TCTScan.cxx:421
 TCTScan.cxx:422
 TCTScan.cxx:423
 TCTScan.cxx:424
 TCTScan.cxx:425
 TCTScan.cxx:426
 TCTScan.cxx:427
 TCTScan.cxx:428
 TCTScan.cxx:429
 TCTScan.cxx:430
 TCTScan.cxx:431
 TCTScan.cxx:432
 TCTScan.cxx:433
 TCTScan.cxx:434
 TCTScan.cxx:435
 TCTScan.cxx:436
 TCTScan.cxx:437
 TCTScan.cxx:438
 TCTScan.cxx:439
 TCTScan.cxx:440
 TCTScan.cxx:441
 TCTScan.cxx:442
 TCTScan.cxx:443
 TCTScan.cxx:444
 TCTScan.cxx:445
 TCTScan.cxx:446
 TCTScan.cxx:447
 TCTScan.cxx:448
 TCTScan.cxx:449
 TCTScan.cxx:450
 TCTScan.cxx:451
 TCTScan.cxx:452
 TCTScan.cxx:453
 TCTScan.cxx:454
 TCTScan.cxx:455
 TCTScan.cxx:456
 TCTScan.cxx:457
 TCTScan.cxx:458
 TCTScan.cxx:459
 TCTScan.cxx:460
 TCTScan.cxx:461
 TCTScan.cxx:462
 TCTScan.cxx:463
 TCTScan.cxx:464
 TCTScan.cxx:465
 TCTScan.cxx:466
 TCTScan.cxx:467
 TCTScan.cxx:468
 TCTScan.cxx:469
 TCTScan.cxx:470
 TCTScan.cxx:471
 TCTScan.cxx:472
 TCTScan.cxx:473
 TCTScan.cxx:474
 TCTScan.cxx:475
 TCTScan.cxx:476
 TCTScan.cxx:477
 TCTScan.cxx:478
 TCTScan.cxx:479
 TCTScan.cxx:480
 TCTScan.cxx:481
 TCTScan.cxx:482
 TCTScan.cxx:483
 TCTScan.cxx:484
 TCTScan.cxx:485
 TCTScan.cxx:486
 TCTScan.cxx:487
 TCTScan.cxx:488
 TCTScan.cxx:489
 TCTScan.cxx:490
 TCTScan.cxx:491
 TCTScan.cxx:492
 TCTScan.cxx:493
 TCTScan.cxx:494
 TCTScan.cxx:495
 TCTScan.cxx:496
 TCTScan.cxx:497
 TCTScan.cxx:498
 TCTScan.cxx:499
 TCTScan.cxx:500
 TCTScan.cxx:501
 TCTScan.cxx:502
 TCTScan.cxx:503
 TCTScan.cxx:504
 TCTScan.cxx:505
 TCTScan.cxx:506
 TCTScan.cxx:507
 TCTScan.cxx:508
 TCTScan.cxx:509
 TCTScan.cxx:510
 TCTScan.cxx:511
 TCTScan.cxx:512
 TCTScan.cxx:513
 TCTScan.cxx:514
 TCTScan.cxx:515
 TCTScan.cxx:516
 TCTScan.cxx:517
 TCTScan.cxx:518
 TCTScan.cxx:519
 TCTScan.cxx:520
 TCTScan.cxx:521
 TCTScan.cxx:522
 TCTScan.cxx:523
 TCTScan.cxx:524
 TCTScan.cxx:525
 TCTScan.cxx:526
 TCTScan.cxx:527
 TCTScan.cxx:528
 TCTScan.cxx:529
 TCTScan.cxx:530
 TCTScan.cxx:531
 TCTScan.cxx:532
 TCTScan.cxx:533
 TCTScan.cxx:534
 TCTScan.cxx:535
 TCTScan.cxx:536
 TCTScan.cxx:537
 TCTScan.cxx:538
 TCTScan.cxx:539
 TCTScan.cxx:540
 TCTScan.cxx:541
 TCTScan.cxx:542
 TCTScan.cxx:543
 TCTScan.cxx:544
 TCTScan.cxx:545
 TCTScan.cxx:546
 TCTScan.cxx:547
 TCTScan.cxx:548
 TCTScan.cxx:549
 TCTScan.cxx:550
 TCTScan.cxx:551
 TCTScan.cxx:552
 TCTScan.cxx:553
 TCTScan.cxx:554
 TCTScan.cxx:555
 TCTScan.cxx:556
 TCTScan.cxx:557
 TCTScan.cxx:558
 TCTScan.cxx:559
 TCTScan.cxx:560
 TCTScan.cxx:561
 TCTScan.cxx:562
 TCTScan.cxx:563
 TCTScan.cxx:564
 TCTScan.cxx:565
 TCTScan.cxx:566
 TCTScan.cxx:567
 TCTScan.cxx:568
 TCTScan.cxx:569
 TCTScan.cxx:570
 TCTScan.cxx:571
 TCTScan.cxx:572
 TCTScan.cxx:573
 TCTScan.cxx:574
 TCTScan.cxx:575
 TCTScan.cxx:576
 TCTScan.cxx:577
 TCTScan.cxx:578
 TCTScan.cxx:579
 TCTScan.cxx:580
 TCTScan.cxx:581
 TCTScan.cxx:582
 TCTScan.cxx:583
 TCTScan.cxx:584
 TCTScan.cxx:585
 TCTScan.cxx:586
 TCTScan.cxx:587
 TCTScan.cxx:588
 TCTScan.cxx:589
 TCTScan.cxx:590
 TCTScan.cxx:591
 TCTScan.cxx:592
 TCTScan.cxx:593
 TCTScan.cxx:594
 TCTScan.cxx:595
 TCTScan.cxx:596
 TCTScan.cxx:597
 TCTScan.cxx:598
 TCTScan.cxx:599
 TCTScan.cxx:600
 TCTScan.cxx:601
 TCTScan.cxx:602
 TCTScan.cxx:603
 TCTScan.cxx:604
 TCTScan.cxx:605
 TCTScan.cxx:606
 TCTScan.cxx:607
 TCTScan.cxx:608
 TCTScan.cxx:609
 TCTScan.cxx:610
 TCTScan.cxx:611
 TCTScan.cxx:612
 TCTScan.cxx:613
 TCTScan.cxx:614
 TCTScan.cxx:615
 TCTScan.cxx:616
 TCTScan.cxx:617
 TCTScan.cxx:618
 TCTScan.cxx:619
 TCTScan.cxx:620
 TCTScan.cxx:621
 TCTScan.cxx:622
 TCTScan.cxx:623
 TCTScan.cxx:624
 TCTScan.cxx:625
 TCTScan.cxx:626
 TCTScan.cxx:627
 TCTScan.cxx:628
 TCTScan.cxx:629
 TCTScan.cxx:630
 TCTScan.cxx:631
 TCTScan.cxx:632
 TCTScan.cxx:633
 TCTScan.cxx:634
 TCTScan.cxx:635
 TCTScan.cxx:636
 TCTScan.cxx:637
 TCTScan.cxx:638
 TCTScan.cxx:639
 TCTScan.cxx:640
 TCTScan.cxx:641
 TCTScan.cxx:642
 TCTScan.cxx:643
 TCTScan.cxx:644
 TCTScan.cxx:645
 TCTScan.cxx:646
 TCTScan.cxx:647
 TCTScan.cxx:648
 TCTScan.cxx:649
 TCTScan.cxx:650
 TCTScan.cxx:651
 TCTScan.cxx:652
 TCTScan.cxx:653
 TCTScan.cxx:654
 TCTScan.cxx:655
 TCTScan.cxx:656
 TCTScan.cxx:657
 TCTScan.cxx:658
 TCTScan.cxx:659
 TCTScan.cxx:660
 TCTScan.cxx:661
 TCTScan.cxx:662
 TCTScan.cxx:663
 TCTScan.cxx:664
 TCTScan.cxx:665
 TCTScan.cxx:666
 TCTScan.cxx:667
 TCTScan.cxx:668
 TCTScan.cxx:669
 TCTScan.cxx:670
 TCTScan.cxx:671
 TCTScan.cxx:672
 TCTScan.cxx:673
 TCTScan.cxx:674
 TCTScan.cxx:675
 TCTScan.cxx:676
 TCTScan.cxx:677
 TCTScan.cxx:678
 TCTScan.cxx:679
 TCTScan.cxx:680
 TCTScan.cxx:681
 TCTScan.cxx:682
 TCTScan.cxx:683
 TCTScan.cxx:684
 TCTScan.cxx:685
 TCTScan.cxx:686
 TCTScan.cxx:687
 TCTScan.cxx:688
 TCTScan.cxx:689
 TCTScan.cxx:690
 TCTScan.cxx:691
 TCTScan.cxx:692
 TCTScan.cxx:693
 TCTScan.cxx:694
 TCTScan.cxx:695
 TCTScan.cxx:696
 TCTScan.cxx:697
 TCTScan.cxx:698
 TCTScan.cxx:699
 TCTScan.cxx:700
 TCTScan.cxx:701
 TCTScan.cxx:702
 TCTScan.cxx:703
 TCTScan.cxx:704
 TCTScan.cxx:705
 TCTScan.cxx:706
 TCTScan.cxx:707
 TCTScan.cxx:708
 TCTScan.cxx:709
 TCTScan.cxx:710
 TCTScan.cxx:711
 TCTScan.cxx:712
 TCTScan.cxx:713
 TCTScan.cxx:714
 TCTScan.cxx:715
 TCTScan.cxx:716
 TCTScan.cxx:717
 TCTScan.cxx:718
 TCTScan.cxx:719
 TCTScan.cxx:720
 TCTScan.cxx:721
 TCTScan.cxx:722
 TCTScan.cxx:723
 TCTScan.cxx:724
 TCTScan.cxx:725
 TCTScan.cxx:726
 TCTScan.cxx:727
 TCTScan.cxx:728
 TCTScan.cxx:729
 TCTScan.cxx:730
 TCTScan.cxx:731
 TCTScan.cxx:732
 TCTScan.cxx:733
 TCTScan.cxx:734
 TCTScan.cxx:735
 TCTScan.cxx:736
 TCTScan.cxx:737
 TCTScan.cxx:738
 TCTScan.cxx:739
 TCTScan.cxx:740
 TCTScan.cxx:741
 TCTScan.cxx:742
 TCTScan.cxx:743
 TCTScan.cxx:744
 TCTScan.cxx:745
 TCTScan.cxx:746
 TCTScan.cxx:747
 TCTScan.cxx:748
 TCTScan.cxx:749
 TCTScan.cxx:750
 TCTScan.cxx:751
 TCTScan.cxx:752
 TCTScan.cxx:753
 TCTScan.cxx:754
 TCTScan.cxx:755
 TCTScan.cxx:756
 TCTScan.cxx:757
 TCTScan.cxx:758
 TCTScan.cxx:759
 TCTScan.cxx:760
 TCTScan.cxx:761
 TCTScan.cxx:762
 TCTScan.cxx:763
 TCTScan.cxx:764
 TCTScan.cxx:765
 TCTScan.cxx:766
 TCTScan.cxx:767
 TCTScan.cxx:768
 TCTScan.cxx:769
 TCTScan.cxx:770
 TCTScan.cxx:771
 TCTScan.cxx:772
 TCTScan.cxx:773
 TCTScan.cxx:774
 TCTScan.cxx:775
 TCTScan.cxx:776
 TCTScan.cxx:777
 TCTScan.cxx:778
 TCTScan.cxx:779
 TCTScan.cxx:780
 TCTScan.cxx:781
 TCTScan.cxx:782
 TCTScan.cxx:783
 TCTScan.cxx:784
 TCTScan.cxx:785
 TCTScan.cxx:786
 TCTScan.cxx:787
 TCTScan.cxx:788
 TCTScan.cxx:789
 TCTScan.cxx:790
 TCTScan.cxx:791
 TCTScan.cxx:792
 TCTScan.cxx:793
 TCTScan.cxx:794
 TCTScan.cxx:795
 TCTScan.cxx:796
 TCTScan.cxx:797
 TCTScan.cxx:798
 TCTScan.cxx:799
 TCTScan.cxx:800
 TCTScan.cxx:801
 TCTScan.cxx:802
 TCTScan.cxx:803
 TCTScan.cxx:804
 TCTScan.cxx:805
 TCTScan.cxx:806
 TCTScan.cxx:807
 TCTScan.cxx:808
 TCTScan.cxx:809
 TCTScan.cxx:810
 TCTScan.cxx:811
 TCTScan.cxx:812
 TCTScan.cxx:813
 TCTScan.cxx:814
 TCTScan.cxx:815
 TCTScan.cxx:816
 TCTScan.cxx:817
 TCTScan.cxx:818
 TCTScan.cxx:819
 TCTScan.cxx:820
 TCTScan.cxx:821
 TCTScan.cxx:822
 TCTScan.cxx:823
 TCTScan.cxx:824
 TCTScan.cxx:825
 TCTScan.cxx:826
 TCTScan.cxx:827
 TCTScan.cxx:828
 TCTScan.cxx:829
 TCTScan.cxx:830
 TCTScan.cxx:831
 TCTScan.cxx:832
 TCTScan.cxx:833
 TCTScan.cxx:834
 TCTScan.cxx:835
 TCTScan.cxx:836
 TCTScan.cxx:837
 TCTScan.cxx:838
 TCTScan.cxx:839
 TCTScan.cxx:840
 TCTScan.cxx:841
 TCTScan.cxx:842
 TCTScan.cxx:843
 TCTScan.cxx:844
 TCTScan.cxx:845
 TCTScan.cxx:846
 TCTScan.cxx:847
 TCTScan.cxx:848
 TCTScan.cxx:849
 TCTScan.cxx:850
 TCTScan.cxx:851
 TCTScan.cxx:852
 TCTScan.cxx:853
 TCTScan.cxx:854
 TCTScan.cxx:855
 TCTScan.cxx:856
 TCTScan.cxx:857
 TCTScan.cxx:858
 TCTScan.cxx:859
 TCTScan.cxx:860
 TCTScan.cxx:861
 TCTScan.cxx:862
 TCTScan.cxx:863
 TCTScan.cxx:864
 TCTScan.cxx:865
 TCTScan.cxx:866
 TCTScan.cxx:867
 TCTScan.cxx:868
 TCTScan.cxx:869
 TCTScan.cxx:870
 TCTScan.cxx:871
 TCTScan.cxx:872
 TCTScan.cxx:873
 TCTScan.cxx:874
 TCTScan.cxx:875
 TCTScan.cxx:876
 TCTScan.cxx:877
 TCTScan.cxx:878
 TCTScan.cxx:879
 TCTScan.cxx:880
 TCTScan.cxx:881
 TCTScan.cxx:882
 TCTScan.cxx:883
 TCTScan.cxx:884
 TCTScan.cxx:885
 TCTScan.cxx:886
 TCTScan.cxx:887
 TCTScan.cxx:888
 TCTScan.cxx:889
 TCTScan.cxx:890
 TCTScan.cxx:891
 TCTScan.cxx:892
 TCTScan.cxx:893
 TCTScan.cxx:894
 TCTScan.cxx:895
 TCTScan.cxx:896
 TCTScan.cxx:897
 TCTScan.cxx:898
 TCTScan.cxx:899
 TCTScan.cxx:900
 TCTScan.cxx:901
 TCTScan.cxx:902
 TCTScan.cxx:903
 TCTScan.cxx:904
 TCTScan.cxx:905
 TCTScan.cxx:906
 TCTScan.cxx:907
 TCTScan.cxx:908
 TCTScan.cxx:909
 TCTScan.cxx:910
 TCTScan.cxx:911
 TCTScan.cxx:912
 TCTScan.cxx:913
 TCTScan.cxx:914
 TCTScan.cxx:915
 TCTScan.cxx:916
 TCTScan.cxx:917
 TCTScan.cxx:918
 TCTScan.cxx:919
 TCTScan.cxx:920
 TCTScan.cxx:921
 TCTScan.cxx:922
 TCTScan.cxx:923
 TCTScan.cxx:924
 TCTScan.cxx:925
 TCTScan.cxx:926
 TCTScan.cxx:927
 TCTScan.cxx:928
 TCTScan.cxx:929
 TCTScan.cxx:930
 TCTScan.cxx:931
 TCTScan.cxx:932
 TCTScan.cxx:933
 TCTScan.cxx:934
 TCTScan.cxx:935
 TCTScan.cxx:936
 TCTScan.cxx:937
 TCTScan.cxx:938
 TCTScan.cxx:939
 TCTScan.cxx:940
 TCTScan.cxx:941
 TCTScan.cxx:942
 TCTScan.cxx:943
 TCTScan.cxx:944
 TCTScan.cxx:945
 TCTScan.cxx:946
 TCTScan.cxx:947
 TCTScan.cxx:948
 TCTScan.cxx:949
 TCTScan.cxx:950
 TCTScan.cxx:951
 TCTScan.cxx:952
 TCTScan.cxx:953
 TCTScan.cxx:954
 TCTScan.cxx:955
 TCTScan.cxx:956
 TCTScan.cxx:957
 TCTScan.cxx:958
 TCTScan.cxx:959
 TCTScan.cxx:960
 TCTScan.cxx:961
 TCTScan.cxx:962
 TCTScan.cxx:963
 TCTScan.cxx:964
 TCTScan.cxx:965
 TCTScan.cxx:966
 TCTScan.cxx:967
 TCTScan.cxx:968
 TCTScan.cxx:969
 TCTScan.cxx:970
 TCTScan.cxx:971
 TCTScan.cxx:972
 TCTScan.cxx:973
 TCTScan.cxx:974
 TCTScan.cxx:975
 TCTScan.cxx:976
 TCTScan.cxx:977
 TCTScan.cxx:978
 TCTScan.cxx:979
 TCTScan.cxx:980
 TCTScan.cxx:981
 TCTScan.cxx:982
 TCTScan.cxx:983
 TCTScan.cxx:984
 TCTScan.cxx:985
 TCTScan.cxx:986
 TCTScan.cxx:987
 TCTScan.cxx:988
 TCTScan.cxx:989
 TCTScan.cxx:990
 TCTScan.cxx:991
 TCTScan.cxx:992
 TCTScan.cxx:993
 TCTScan.cxx:994
 TCTScan.cxx:995
 TCTScan.cxx:996
 TCTScan.cxx:997
 TCTScan.cxx:998
 TCTScan.cxx:999
 TCTScan.cxx:1000
 TCTScan.cxx:1001
 TCTScan.cxx:1002
 TCTScan.cxx:1003
 TCTScan.cxx:1004
 TCTScan.cxx:1005
 TCTScan.cxx:1006
 TCTScan.cxx:1007
 TCTScan.cxx:1008
 TCTScan.cxx:1009
 TCTScan.cxx:1010
 TCTScan.cxx:1011
 TCTScan.cxx:1012
 TCTScan.cxx:1013
 TCTScan.cxx:1014
 TCTScan.cxx:1015
 TCTScan.cxx:1016
 TCTScan.cxx:1017
 TCTScan.cxx:1018
 TCTScan.cxx:1019
 TCTScan.cxx:1020
 TCTScan.cxx:1021
 TCTScan.cxx:1022
 TCTScan.cxx:1023
 TCTScan.cxx:1024
 TCTScan.cxx:1025
 TCTScan.cxx:1026
 TCTScan.cxx:1027
 TCTScan.cxx:1028
 TCTScan.cxx:1029
 TCTScan.cxx:1030
 TCTScan.cxx:1031
 TCTScan.cxx:1032
 TCTScan.cxx:1033
 TCTScan.cxx:1034
 TCTScan.cxx:1035
 TCTScan.cxx:1036
 TCTScan.cxx:1037
 TCTScan.cxx:1038
 TCTScan.cxx:1039
 TCTScan.cxx:1040
 TCTScan.cxx:1041
 TCTScan.cxx:1042
 TCTScan.cxx:1043
 TCTScan.cxx:1044
 TCTScan.cxx:1045
 TCTScan.cxx:1046
 TCTScan.cxx:1047
 TCTScan.cxx:1048
 TCTScan.cxx:1049
 TCTScan.cxx:1050
 TCTScan.cxx:1051
 TCTScan.cxx:1052
 TCTScan.cxx:1053
 TCTScan.cxx:1054
 TCTScan.cxx:1055
 TCTScan.cxx:1056
 TCTScan.cxx:1057
 TCTScan.cxx:1058
 TCTScan.cxx:1059
 TCTScan.cxx:1060
 TCTScan.cxx:1061
 TCTScan.cxx:1062
 TCTScan.cxx:1063
 TCTScan.cxx:1064
 TCTScan.cxx:1065
 TCTScan.cxx:1066
 TCTScan.cxx:1067
 TCTScan.cxx:1068
 TCTScan.cxx:1069
 TCTScan.cxx:1070
 TCTScan.cxx:1071
 TCTScan.cxx:1072
 TCTScan.cxx:1073
 TCTScan.cxx:1074
 TCTScan.cxx:1075
 TCTScan.cxx:1076
 TCTScan.cxx:1077
 TCTScan.cxx:1078
 TCTScan.cxx:1079
 TCTScan.cxx:1080
 TCTScan.cxx:1081
 TCTScan.cxx:1082
 TCTScan.cxx:1083
 TCTScan.cxx:1084
 TCTScan.cxx:1085
 TCTScan.cxx:1086
 TCTScan.cxx:1087
 TCTScan.cxx:1088
 TCTScan.cxx:1089
 TCTScan.cxx:1090
 TCTScan.cxx:1091
 TCTScan.cxx:1092
 TCTScan.cxx:1093
 TCTScan.cxx:1094
 TCTScan.cxx:1095
 TCTScan.cxx:1096
 TCTScan.cxx:1097
 TCTScan.cxx:1098
 TCTScan.cxx:1099
 TCTScan.cxx:1100
 TCTScan.cxx:1101
 TCTScan.cxx:1102
 TCTScan.cxx:1103
 TCTScan.cxx:1104
 TCTScan.cxx:1105
 TCTScan.cxx:1106
 TCTScan.cxx:1107
 TCTScan.cxx:1108
 TCTScan.cxx:1109
 TCTScan.cxx:1110
 TCTScan.cxx:1111
 TCTScan.cxx:1112
 TCTScan.cxx:1113
 TCTScan.cxx:1114
 TCTScan.cxx:1115
 TCTScan.cxx:1116
 TCTScan.cxx:1117
 TCTScan.cxx:1118
 TCTScan.cxx:1119
 TCTScan.cxx:1120
 TCTScan.cxx:1121
 TCTScan.cxx:1122
 TCTScan.cxx:1123
 TCTScan.cxx:1124
 TCTScan.cxx:1125
 TCTScan.cxx:1126
 TCTScan.cxx:1127
 TCTScan.cxx:1128
 TCTScan.cxx:1129
 TCTScan.cxx:1130
 TCTScan.cxx:1131
 TCTScan.cxx:1132
 TCTScan.cxx:1133
 TCTScan.cxx:1134
 TCTScan.cxx:1135
 TCTScan.cxx:1136
 TCTScan.cxx:1137
 TCTScan.cxx:1138
 TCTScan.cxx:1139
 TCTScan.cxx:1140
 TCTScan.cxx:1141
 TCTScan.cxx:1142
 TCTScan.cxx:1143
 TCTScan.cxx:1144
 TCTScan.cxx:1145
 TCTScan.cxx:1146
 TCTScan.cxx:1147
 TCTScan.cxx:1148
 TCTScan.cxx:1149
 TCTScan.cxx:1150
 TCTScan.cxx:1151
 TCTScan.cxx:1152
 TCTScan.cxx:1153
 TCTScan.cxx:1154
 TCTScan.cxx:1155
 TCTScan.cxx:1156
 TCTScan.cxx:1157
 TCTScan.cxx:1158
 TCTScan.cxx:1159
 TCTScan.cxx:1160
 TCTScan.cxx:1161
 TCTScan.cxx:1162
 TCTScan.cxx:1163
 TCTScan.cxx:1164
 TCTScan.cxx:1165
 TCTScan.cxx:1166
 TCTScan.cxx:1167
 TCTScan.cxx:1168
 TCTScan.cxx:1169
 TCTScan.cxx:1170
 TCTScan.cxx:1171
 TCTScan.cxx:1172
 TCTScan.cxx:1173
 TCTScan.cxx:1174
 TCTScan.cxx:1175
 TCTScan.cxx:1176
 TCTScan.cxx:1177
 TCTScan.cxx:1178
 TCTScan.cxx:1179
 TCTScan.cxx:1180
 TCTScan.cxx:1181
 TCTScan.cxx:1182
 TCTScan.cxx:1183
 TCTScan.cxx:1184
 TCTScan.cxx:1185
 TCTScan.cxx:1186
 TCTScan.cxx:1187
 TCTScan.cxx:1188
 TCTScan.cxx:1189
 TCTScan.cxx:1190
 TCTScan.cxx:1191
 TCTScan.cxx:1192
 TCTScan.cxx:1193
 TCTScan.cxx:1194
 TCTScan.cxx:1195
 TCTScan.cxx:1196
 TCTScan.cxx:1197
 TCTScan.cxx:1198
 TCTScan.cxx:1199
 TCTScan.cxx:1200
 TCTScan.cxx:1201
 TCTScan.cxx:1202
 TCTScan.cxx:1203
 TCTScan.cxx:1204
 TCTScan.cxx:1205
 TCTScan.cxx:1206
 TCTScan.cxx:1207
 TCTScan.cxx:1208
 TCTScan.cxx:1209
 TCTScan.cxx:1210
 TCTScan.cxx:1211
 TCTScan.cxx:1212
 TCTScan.cxx:1213
 TCTScan.cxx:1214
 TCTScan.cxx:1215
 TCTScan.cxx:1216
 TCTScan.cxx:1217
 TCTScan.cxx:1218
 TCTScan.cxx:1219
 TCTScan.cxx:1220
 TCTScan.cxx:1221
 TCTScan.cxx:1222
 TCTScan.cxx:1223
 TCTScan.cxx:1224
 TCTScan.cxx:1225
 TCTScan.cxx:1226
 TCTScan.cxx:1227
 TCTScan.cxx:1228
 TCTScan.cxx:1229
 TCTScan.cxx:1230
 TCTScan.cxx:1231
 TCTScan.cxx:1232
 TCTScan.cxx:1233
 TCTScan.cxx:1234
 TCTScan.cxx:1235
 TCTScan.cxx:1236
 TCTScan.cxx:1237
 TCTScan.cxx:1238
 TCTScan.cxx:1239
 TCTScan.cxx:1240
 TCTScan.cxx:1241
 TCTScan.cxx:1242
 TCTScan.cxx:1243
 TCTScan.cxx:1244
 TCTScan.cxx:1245
 TCTScan.cxx:1246
 TCTScan.cxx:1247
 TCTScan.cxx:1248
 TCTScan.cxx:1249
 TCTScan.cxx:1250
 TCTScan.cxx:1251
 TCTScan.cxx:1252
 TCTScan.cxx:1253
 TCTScan.cxx:1254
 TCTScan.cxx:1255
 TCTScan.cxx:1256
 TCTScan.cxx:1257
 TCTScan.cxx:1258
 TCTScan.cxx:1259
 TCTScan.cxx:1260
 TCTScan.cxx:1261
 TCTScan.cxx:1262
 TCTScan.cxx:1263
 TCTScan.cxx:1264
 TCTScan.cxx:1265
 TCTScan.cxx:1266
 TCTScan.cxx:1267
 TCTScan.cxx:1268
 TCTScan.cxx:1269
 TCTScan.cxx:1270
 TCTScan.cxx:1271
 TCTScan.cxx:1272
 TCTScan.cxx:1273
 TCTScan.cxx:1274
 TCTScan.cxx:1275
 TCTScan.cxx:1276
 TCTScan.cxx:1277
 TCTScan.cxx:1278
 TCTScan.cxx:1279
 TCTScan.cxx:1280
 TCTScan.cxx:1281
 TCTScan.cxx:1282
 TCTScan.cxx:1283
 TCTScan.cxx:1284
 TCTScan.cxx:1285
 TCTScan.cxx:1286
 TCTScan.cxx:1287
 TCTScan.cxx:1288
 TCTScan.cxx:1289
 TCTScan.cxx:1290
 TCTScan.cxx:1291
 TCTScan.cxx:1292
 TCTScan.cxx:1293
 TCTScan.cxx:1294
 TCTScan.cxx:1295
 TCTScan.cxx:1296
 TCTScan.cxx:1297
 TCTScan.cxx:1298
 TCTScan.cxx:1299
 TCTScan.cxx:1300
 TCTScan.cxx:1301
 TCTScan.cxx:1302
 TCTScan.cxx:1303
 TCTScan.cxx:1304
 TCTScan.cxx:1305
 TCTScan.cxx:1306
 TCTScan.cxx:1307
 TCTScan.cxx:1308
 TCTScan.cxx:1309
 TCTScan.cxx:1310
 TCTScan.cxx:1311
 TCTScan.cxx:1312
 TCTScan.cxx:1313
 TCTScan.cxx:1314
 TCTScan.cxx:1315
 TCTScan.cxx:1316
 TCTScan.cxx:1317
 TCTScan.cxx:1318
 TCTScan.cxx:1319
 TCTScan.cxx:1320
 TCTScan.cxx:1321
 TCTScan.cxx:1322
 TCTScan.cxx:1323
 TCTScan.cxx:1324
 TCTScan.cxx:1325
 TCTScan.cxx:1326
 TCTScan.cxx:1327
 TCTScan.cxx:1328
 TCTScan.cxx:1329
 TCTScan.cxx:1330
 TCTScan.cxx:1331
 TCTScan.cxx:1332
 TCTScan.cxx:1333
 TCTScan.cxx:1334
 TCTScan.cxx:1335
 TCTScan.cxx:1336
 TCTScan.cxx:1337
 TCTScan.cxx:1338
 TCTScan.cxx:1339
 TCTScan.cxx:1340
 TCTScan.cxx:1341
 TCTScan.cxx:1342
 TCTScan.cxx:1343
 TCTScan.cxx:1344
 TCTScan.cxx:1345
 TCTScan.cxx:1346
 TCTScan.cxx:1347
 TCTScan.cxx:1348
 TCTScan.cxx:1349
 TCTScan.cxx:1350
 TCTScan.cxx:1351
 TCTScan.cxx:1352
 TCTScan.cxx:1353
 TCTScan.cxx:1354
 TCTScan.cxx:1355
 TCTScan.cxx:1356
 TCTScan.cxx:1357
 TCTScan.cxx:1358
 TCTScan.cxx:1359
 TCTScan.cxx:1360
 TCTScan.cxx:1361
 TCTScan.cxx:1362
 TCTScan.cxx:1363
 TCTScan.cxx:1364
 TCTScan.cxx:1365
 TCTScan.cxx:1366
 TCTScan.cxx:1367
 TCTScan.cxx:1368
 TCTScan.cxx:1369
 TCTScan.cxx:1370
 TCTScan.cxx:1371
 TCTScan.cxx:1372
 TCTScan.cxx:1373
 TCTScan.cxx:1374
 TCTScan.cxx:1375
 TCTScan.cxx:1376
 TCTScan.cxx:1377
 TCTScan.cxx:1378
 TCTScan.cxx:1379
 TCTScan.cxx:1380
 TCTScan.cxx:1381
 TCTScan.cxx:1382
 TCTScan.cxx:1383
 TCTScan.cxx:1384
 TCTScan.cxx:1385
 TCTScan.cxx:1386
 TCTScan.cxx:1387
 TCTScan.cxx:1388
 TCTScan.cxx:1389
 TCTScan.cxx:1390
 TCTScan.cxx:1391
 TCTScan.cxx:1392
 TCTScan.cxx:1393
 TCTScan.cxx:1394
 TCTScan.cxx:1395
 TCTScan.cxx:1396
 TCTScan.cxx:1397
 TCTScan.cxx:1398
 TCTScan.cxx:1399
 TCTScan.cxx:1400
 TCTScan.cxx:1401
 TCTScan.cxx:1402
 TCTScan.cxx:1403
 TCTScan.cxx:1404
 TCTScan.cxx:1405
 TCTScan.cxx:1406
 TCTScan.cxx:1407
 TCTScan.cxx:1408
 TCTScan.cxx:1409
 TCTScan.cxx:1410
 TCTScan.cxx:1411
 TCTScan.cxx:1412
 TCTScan.cxx:1413
 TCTScan.cxx:1414
 TCTScan.cxx:1415
 TCTScan.cxx:1416
 TCTScan.cxx:1417
 TCTScan.cxx:1418
 TCTScan.cxx:1419
 TCTScan.cxx:1420
 TCTScan.cxx:1421
 TCTScan.cxx:1422
 TCTScan.cxx:1423
 TCTScan.cxx:1424
 TCTScan.cxx:1425
 TCTScan.cxx:1426
 TCTScan.cxx:1427
 TCTScan.cxx:1428
 TCTScan.cxx:1429
 TCTScan.cxx:1430
 TCTScan.cxx:1431
 TCTScan.cxx:1432
 TCTScan.cxx:1433
 TCTScan.cxx:1434
 TCTScan.cxx:1435
 TCTScan.cxx:1436
 TCTScan.cxx:1437
 TCTScan.cxx:1438
 TCTScan.cxx:1439
 TCTScan.cxx:1440
 TCTScan.cxx:1441
 TCTScan.cxx:1442
 TCTScan.cxx:1443
 TCTScan.cxx:1444
 TCTScan.cxx:1445
 TCTScan.cxx:1446
 TCTScan.cxx:1447
 TCTScan.cxx:1448
 TCTScan.cxx:1449
 TCTScan.cxx:1450
 TCTScan.cxx:1451
 TCTScan.cxx:1452
 TCTScan.cxx:1453
 TCTScan.cxx:1454
 TCTScan.cxx:1455
 TCTScan.cxx:1456
 TCTScan.cxx:1457
 TCTScan.cxx:1458
 TCTScan.cxx:1459
 TCTScan.cxx:1460
 TCTScan.cxx:1461
 TCTScan.cxx:1462
 TCTScan.cxx:1463
 TCTScan.cxx:1464
 TCTScan.cxx:1465
 TCTScan.cxx:1466
 TCTScan.cxx:1467
 TCTScan.cxx:1468
 TCTScan.cxx:1469
 TCTScan.cxx:1470
 TCTScan.cxx:1471
 TCTScan.cxx:1472
 TCTScan.cxx:1473
 TCTScan.cxx:1474
 TCTScan.cxx:1475
 TCTScan.cxx:1476
 TCTScan.cxx:1477
 TCTScan.cxx:1478
 TCTScan.cxx:1479
 TCTScan.cxx:1480
 TCTScan.cxx:1481
 TCTScan.cxx:1482
 TCTScan.cxx:1483
 TCTScan.cxx:1484
 TCTScan.cxx:1485
 TCTScan.cxx:1486
 TCTScan.cxx:1487
 TCTScan.cxx:1488
 TCTScan.cxx:1489
 TCTScan.cxx:1490
 TCTScan.cxx:1491
 TCTScan.cxx:1492
 TCTScan.cxx:1493
 TCTScan.cxx:1494
 TCTScan.cxx:1495
 TCTScan.cxx:1496
 TCTScan.cxx:1497
 TCTScan.cxx:1498
 TCTScan.cxx:1499
 TCTScan.cxx:1500
 TCTScan.cxx:1501
 TCTScan.cxx:1502
 TCTScan.cxx:1503
 TCTScan.cxx:1504
 TCTScan.cxx:1505
 TCTScan.cxx:1506
 TCTScan.cxx:1507
 TCTScan.cxx:1508
 TCTScan.cxx:1509
 TCTScan.cxx:1510
 TCTScan.cxx:1511
 TCTScan.cxx:1512
 TCTScan.cxx:1513
 TCTScan.cxx:1514
 TCTScan.cxx:1515
 TCTScan.cxx:1516
 TCTScan.cxx:1517
 TCTScan.cxx:1518
 TCTScan.cxx:1519
 TCTScan.cxx:1520
 TCTScan.cxx:1521
 TCTScan.cxx:1522
 TCTScan.cxx:1523
 TCTScan.cxx:1524
 TCTScan.cxx:1525
 TCTScan.cxx:1526
 TCTScan.cxx:1527
 TCTScan.cxx:1528
 TCTScan.cxx:1529
 TCTScan.cxx:1530
 TCTScan.cxx:1531
 TCTScan.cxx:1532
 TCTScan.cxx:1533
 TCTScan.cxx:1534
 TCTScan.cxx:1535
 TCTScan.cxx:1536
 TCTScan.cxx:1537
 TCTScan.cxx:1538
 TCTScan.cxx:1539
 TCTScan.cxx:1540
 TCTScan.cxx:1541
 TCTScan.cxx:1542
 TCTScan.cxx:1543
 TCTScan.cxx:1544
 TCTScan.cxx:1545
 TCTScan.cxx:1546
 TCTScan.cxx:1547
 TCTScan.cxx:1548
 TCTScan.cxx:1549
 TCTScan.cxx:1550
 TCTScan.cxx:1551
 TCTScan.cxx:1552
 TCTScan.cxx:1553
 TCTScan.cxx:1554
 TCTScan.cxx:1555
 TCTScan.cxx:1556
 TCTScan.cxx:1557
 TCTScan.cxx:1558
 TCTScan.cxx:1559
 TCTScan.cxx:1560
 TCTScan.cxx:1561
 TCTScan.cxx:1562
 TCTScan.cxx:1563
 TCTScan.cxx:1564
 TCTScan.cxx:1565
 TCTScan.cxx:1566
 TCTScan.cxx:1567
 TCTScan.cxx:1568
 TCTScan.cxx:1569
 TCTScan.cxx:1570
 TCTScan.cxx:1571
 TCTScan.cxx:1572
 TCTScan.cxx:1573
 TCTScan.cxx:1574
 TCTScan.cxx:1575
 TCTScan.cxx:1576
 TCTScan.cxx:1577
 TCTScan.cxx:1578
 TCTScan.cxx:1579
 TCTScan.cxx:1580
 TCTScan.cxx:1581
 TCTScan.cxx:1582
 TCTScan.cxx:1583
 TCTScan.cxx:1584
 TCTScan.cxx:1585
 TCTScan.cxx:1586
 TCTScan.cxx:1587
 TCTScan.cxx:1588
 TCTScan.cxx:1589
 TCTScan.cxx:1590
 TCTScan.cxx:1591
 TCTScan.cxx:1592
 TCTScan.cxx:1593
 TCTScan.cxx:1594
 TCTScan.cxx:1595
 TCTScan.cxx:1596
 TCTScan.cxx:1597
 TCTScan.cxx:1598
 TCTScan.cxx:1599
 TCTScan.cxx:1600
 TCTScan.cxx:1601
 TCTScan.cxx:1602
 TCTScan.cxx:1603
 TCTScan.cxx:1604
 TCTScan.cxx:1605
 TCTScan.cxx:1606
 TCTScan.cxx:1607
 TCTScan.cxx:1608
 TCTScan.cxx:1609
 TCTScan.cxx:1610
 TCTScan.cxx:1611
 TCTScan.cxx:1612
 TCTScan.cxx:1613
 TCTScan.cxx:1614
 TCTScan.cxx:1615
 TCTScan.cxx:1616
 TCTScan.cxx:1617
 TCTScan.cxx:1618
 TCTScan.cxx:1619
 TCTScan.cxx:1620
 TCTScan.cxx:1621
 TCTScan.cxx:1622
 TCTScan.cxx:1623
 TCTScan.cxx:1624
 TCTScan.cxx:1625
 TCTScan.cxx:1626
 TCTScan.cxx:1627
 TCTScan.cxx:1628
 TCTScan.cxx:1629
 TCTScan.cxx:1630
 TCTScan.cxx:1631
 TCTScan.cxx:1632
 TCTScan.cxx:1633
 TCTScan.cxx:1634
 TCTScan.cxx:1635
 TCTScan.cxx:1636
 TCTScan.cxx:1637
 TCTScan.cxx:1638
 TCTScan.cxx:1639
 TCTScan.cxx:1640
 TCTScan.cxx:1641
 TCTScan.cxx:1642
 TCTScan.cxx:1643
 TCTScan.cxx:1644
 TCTScan.cxx:1645
 TCTScan.cxx:1646
 TCTScan.cxx:1647
 TCTScan.cxx:1648
 TCTScan.cxx:1649
 TCTScan.cxx:1650
 TCTScan.cxx:1651
 TCTScan.cxx:1652
 TCTScan.cxx:1653
 TCTScan.cxx:1654
 TCTScan.cxx:1655
 TCTScan.cxx:1656
 TCTScan.cxx:1657
 TCTScan.cxx:1658
 TCTScan.cxx:1659
 TCTScan.cxx:1660
 TCTScan.cxx:1661
 TCTScan.cxx:1662
 TCTScan.cxx:1663
 TCTScan.cxx:1664
 TCTScan.cxx:1665
 TCTScan.cxx:1666
 TCTScan.cxx:1667
 TCTScan.cxx:1668
 TCTScan.cxx:1669
 TCTScan.cxx:1670
 TCTScan.cxx:1671
 TCTScan.cxx:1672
 TCTScan.cxx:1673
 TCTScan.cxx:1674
 TCTScan.cxx:1675
 TCTScan.cxx:1676
 TCTScan.cxx:1677
 TCTScan.cxx:1678
 TCTScan.cxx:1679
 TCTScan.cxx:1680
 TCTScan.cxx:1681
 TCTScan.cxx:1682
 TCTScan.cxx:1683
 TCTScan.cxx:1684
 TCTScan.cxx:1685
 TCTScan.cxx:1686
 TCTScan.cxx:1687
 TCTScan.cxx:1688
 TCTScan.cxx:1689
 TCTScan.cxx:1690
 TCTScan.cxx:1691
 TCTScan.cxx:1692
 TCTScan.cxx:1693
 TCTScan.cxx:1694
 TCTScan.cxx:1695
 TCTScan.cxx:1696
 TCTScan.cxx:1697
 TCTScan.cxx:1698
 TCTScan.cxx:1699
 TCTScan.cxx:1700
 TCTScan.cxx:1701
 TCTScan.cxx:1702
 TCTScan.cxx:1703
 TCTScan.cxx:1704
 TCTScan.cxx:1705
 TCTScan.cxx:1706
 TCTScan.cxx:1707
 TCTScan.cxx:1708
 TCTScan.cxx:1709
 TCTScan.cxx:1710
 TCTScan.cxx:1711
 TCTScan.cxx:1712
 TCTScan.cxx:1713
 TCTScan.cxx:1714
 TCTScan.cxx:1715
 TCTScan.cxx:1716
 TCTScan.cxx:1717
 TCTScan.cxx:1718
 TCTScan.cxx:1719
 TCTScan.cxx:1720
 TCTScan.cxx:1721
 TCTScan.cxx:1722
 TCTScan.cxx:1723
 TCTScan.cxx:1724
 TCTScan.cxx:1725
 TCTScan.cxx:1726
 TCTScan.cxx:1727
 TCTScan.cxx:1728
 TCTScan.cxx:1729
 TCTScan.cxx:1730
 TCTScan.cxx:1731
 TCTScan.cxx:1732
 TCTScan.cxx:1733
 TCTScan.cxx:1734
 TCTScan.cxx:1735
 TCTScan.cxx:1736
 TCTScan.cxx:1737
 TCTScan.cxx:1738
 TCTScan.cxx:1739
 TCTScan.cxx:1740
 TCTScan.cxx:1741
 TCTScan.cxx:1742
 TCTScan.cxx:1743
 TCTScan.cxx:1744
 TCTScan.cxx:1745
 TCTScan.cxx:1746
 TCTScan.cxx:1747
 TCTScan.cxx:1748
 TCTScan.cxx:1749
 TCTScan.cxx:1750
 TCTScan.cxx:1751
 TCTScan.cxx:1752
 TCTScan.cxx:1753
 TCTScan.cxx:1754
 TCTScan.cxx:1755
 TCTScan.cxx:1756
 TCTScan.cxx:1757
 TCTScan.cxx:1758
 TCTScan.cxx:1759
 TCTScan.cxx:1760
 TCTScan.cxx:1761
 TCTScan.cxx:1762
 TCTScan.cxx:1763
 TCTScan.cxx:1764
 TCTScan.cxx:1765
 TCTScan.cxx:1766
 TCTScan.cxx:1767
 TCTScan.cxx:1768
 TCTScan.cxx:1769
 TCTScan.cxx:1770
 TCTScan.cxx:1771
 TCTScan.cxx:1772
 TCTScan.cxx:1773
 TCTScan.cxx:1774
 TCTScan.cxx:1775
 TCTScan.cxx:1776
 TCTScan.cxx:1777
 TCTScan.cxx:1778
 TCTScan.cxx:1779
 TCTScan.cxx:1780
 TCTScan.cxx:1781
 TCTScan.cxx:1782
 TCTScan.cxx:1783
 TCTScan.cxx:1784
 TCTScan.cxx:1785
 TCTScan.cxx:1786
 TCTScan.cxx:1787
 TCTScan.cxx:1788
 TCTScan.cxx:1789
 TCTScan.cxx:1790
 TCTScan.cxx:1791
 TCTScan.cxx:1792
 TCTScan.cxx:1793
 TCTScan.cxx:1794
 TCTScan.cxx:1795
 TCTScan.cxx:1796
 TCTScan.cxx:1797
 TCTScan.cxx:1798