Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:34:36

0001 #include "TFile.h"
0002 #include "TTree.h"
0003 #include "TBranch.h"
0004 #include "TH1F.h"
0005 #include <iostream>
0006 #include <fstream>
0007 
0008  gROOT ->Reset(); 
0009 
0010  string statp = "KS prob";
0011  Double_t ks[12];
0012   
0013  Char_t histo[200];
0014  std::strstream buf;
0015  std::string value;
0016  
0017  TH1F * ch[12];
0018  TH1F * rh[12];
0019  TText* te = new TText();
0020  
0021  TFile * rfile;   
0022  TFile * cfile;
0023  
0024  std::string system;
0025  std::string variable;
0026  std::strstream hn;
0027  std::string hname;
0028  std::string histogram;
0029  ofstream outfile("LowKS_pos_list.dat");
0030 
0031 void SiTrackerHitsComparePosition()
0032  {
0033  
0034  gROOT->ProcessLine(".x HistoCompare.C");
0035  HistoCompare * PV = new HistoCompare();
0036 
0037  gStyle->SetNdivisions(504,"XYZ");
0038  gStyle->SetStatH(0.18);
0039  gStyle->SetStatW(0.35);
0040  
0041  char*  cfilename = "TrackerHitHisto.root"; //current
0042  char*  rfilename = "../TrackerHitHisto.root";  //reference
0043 
0044  delete gROOT->GetListOfFiles()->FindObject(rfilename);
0045  delete gROOT->GetListOfFiles()->FindObject(cfilename); 
0046 
0047  rfile = new TFile(rfilename);
0048  TDirectory * rdir=gDirectory; 
0049  cfile = new TFile(cfilename);
0050  TDirectory * cdir=gDirectory; 
0051 
0052  if(rfile->cd("DQMData/Run 1/TrackerHitsV"))rfile->cd("DQMData/Run 1/TrackerHitsV/Run summary/TrackerHit");
0053  else rfile->cd("DQMData/TrackerHitsV/TrackerHit");
0054  rdir=gDirectory;
0055 
0056  if(cfile->cd("DQMData/Run 1/TrackerHitsV"))cfile->cd("DQMData/Run 1/TrackerHitsV/Run summary/TrackerHit");
0057  else cfile->cd("DQMData/TrackerHitsV/TrackerHit");
0058  cdir=gDirectory; 
0059 
0060  
0061   TLegend leg(0.3, 0.83, 0.55, 0.90);
0062  //Get list of Keys from the Reference file.
0063   TList* ref_list = rfile->GetListOfKeys() ;
0064   if (!ref_list) {
0065       std::cout<<"=========>> AutoComaprison:: There is no Keys available in the Reference file."<<std::endl;
0066       exit(1) ;
0067    }
0068 
0069   //Get list of Keys from the New file.
0070   TList* new_list = cfile->GetListOfKeys() ;
0071   if (!new_list) {
0072       std::cout<<"=========>> AutoComaprison:: There is no Keys available in New file."<<std::endl;
0073       exit(1) ;
0074    }
0075 
0076 
0077   //Iterate on the List of Keys of the  Reference file.
0078   TIter     refkey_iter( ref_list) ;
0079   TKey*     ref_key ;
0080   TObject*  ref_obj ;
0081 
0082   char rver[50];
0083   char cver[50];
0084   while ( ref_key = (TKey*) refkey_iter() ) {
0085       ref_obj = ref_key->ReadObj() ;
0086       if (strcmp(ref_obj->IsA()->GetName(),"TObjString")==0) {
0087 
0088          TObjString * rversion = dynamic_cast< TObjString*> (ref_obj);
0089          sprintf(rver, "%s", rversion->GetName());
0090          std::cout<<" Ref. version =" << rver<<std::endl;
0091      break;
0092       }
0093   }
0094 
0095   //Iterate on the List of Keys of the  Reference file.
0096   TIter     newkey_iter( new_list) ;
0097   TKey*     new_key ;
0098   TObject*  new_obj ;
0099   while ( new_key = (TKey*) newkey_iter() ) {
0100       new_obj = new_key->ReadObj() ;
0101       if (strcmp(new_obj->IsA()->GetName(),"TObjString")==0) {
0102 
0103          TObjString * cversion = dynamic_cast< TObjString*> (new_obj);
0104          sprintf(cver, "%s", cversion->GetName());
0105          std::cout<<" Cur version =" << cver<<std::endl;
0106      break;
0107 
0108       }
0109   }
0110 
0111 
0112 
0113  
0114  TH1F * hsum_st = new TH1F("ks_st", "KS summary position STRIPS", 22 , -0.05 , 1.05);
0115  TH1F * hsum_px = new TH1F("ks_px", "KS summary position PIXELS", 22 , -0.05 , 1.05);
0116  TH1F * hsum_TIB = new TH1F("ks_TIB", "KS summary position TIB", 22 , -0.05 , 1.05);
0117  TH1F * hsum_TOB = new TH1F("ks_TOB", "KS summary position TOB", 22 , -0.05 , 1.05);
0118  TH1F * hsum_TID = new TH1F("ks_TID", "KS summary position TID", 22 , -0.05 , 1.05);
0119  TH1F * hsum_TEC = new TH1F("ks_TEC", "KS summary position TEC", 22 , -0.05 , 1.05);
0120  TH1F * hsum_BPIX = new TH1F("ks_BPIX", "KS summary position BPIX", 22 , -0.05 , 1.05);
0121  TH1F * hsum_FPIX = new TH1F("ks_FPIX", "KS summary position FPIX", 22 , -0.05 , 1.05);
0122 
0123 //=======================================================
0124    variable = "Entryx-Exitx";
0125 //=======================================================
0126 
0127 // TOB
0128    system = "TOB";
0129    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0130    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0131    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0132    
0133    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0134    c->Divide(3,4);   
0135    for (Int_t i=0; i<12; i++) {       
0136      hn << histogram << i+1 <<std::endl; 
0137      hn >> hname;
0138      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0139      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0140      c->cd(i+1);
0141      if (PV->KSok(rh[i] , ch[i])) {
0142        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0143        PV->KSdraw(rh[i] , ch[i]);
0144        rh[i]->Draw("h");      
0145        ch[i]->Draw("h same");             
0146        buf<<"KS="<<ks[i]<<std::endl;
0147        buf>>value;
0148        te->DrawTextNDC(0.5,0.7, value.c_str());
0149        hsum_TOB->Fill(ks[i]);
0150 
0151        leg.Clear();
0152        leg.AddEntry(rh[i],rver , "l");
0153        leg.AddEntry(ch[i],cver , "l");
0154        leg.Draw();
0155 
0156      }
0157      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0158    } 
0159     c->Print(outname_eps.c_str());
0160     c->Print(outname_gif.c_str());
0161    
0162 // TIB
0163    system = "TIB";
0164    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0165    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0166    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0167    
0168    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0169    c->Divide(3,4);   
0170    for (Int_t i=0; i<12; i++) {       
0171      hn << histogram << i+1 <<std::endl; 
0172      hn >> hname;
0173      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0174      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0175      c->cd(i+1);
0176      if (PV->KSok(rh[i] , ch[i])) {
0177        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0178        PV->KSdraw(rh[i] , ch[i]);
0179        rh[i]->Draw("h");      
0180        ch[i]->Draw("h same");             
0181        buf<<"KS="<<ks[i]<<std::endl;
0182        buf>>value;
0183        te->DrawTextNDC(0.5,0.7, value.c_str());
0184        hsum_TIB->Fill(ks[i]);
0185 
0186        leg.Clear();
0187        leg.AddEntry(rh[i],rver , "l");
0188        leg.AddEntry(ch[i],cver , "l");
0189        leg.Draw();
0190 
0191      }
0192      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0193    } 
0194     c->Print(outname_eps.c_str());
0195     c->Print(outname_gif.c_str());
0196    
0197 // TID
0198    system = "TID";
0199    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0200    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0201    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0202    
0203    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0204    c->Divide(3,4);   
0205    for (Int_t i=0; i<12; i++) {       
0206      hn << histogram << i+1 <<std::endl; 
0207      hn >> hname;
0208      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0209      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0210      c->cd(i+1);
0211      if (PV->KSok(rh[i] , ch[i])) {
0212        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0213        PV->KSdraw(rh[i] , ch[i]);
0214        rh[i]->Draw("h");      
0215        ch[i]->Draw("h same");             
0216        buf<<"KS="<<ks[i]<<std::endl;
0217        buf>>value;
0218        te->DrawTextNDC(0.5,0.7, value.c_str());
0219        hsum_TID->Fill(ks[i]);
0220        leg.Clear();
0221        leg.AddEntry(rh[i],rver , "l");
0222        leg.AddEntry(ch[i],cver , "l");
0223        leg.Draw();
0224 
0225      }
0226      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0227    } 
0228     c->Print(outname_eps.c_str());
0229     c->Print(outname_gif.c_str());
0230 
0231 // TEC
0232    system = "TEC";
0233    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0234    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0235    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0236    
0237    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0238    c->Divide(3,4);   
0239    for (Int_t i=0; i<12; i++) {       
0240      hn << histogram << i+1 <<std::endl; 
0241      hn >> hname;
0242      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0243      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0244      c->cd(i+1);
0245      if (PV->KSok(rh[i] , ch[i])) {
0246        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0247        PV->KSdraw(rh[i] , ch[i]);
0248        rh[i]->Draw("h");      
0249        ch[i]->Draw("h same");             
0250        buf<<"KS="<<ks[i]<<std::endl;
0251        buf>>value;
0252        te->DrawTextNDC(0.5,0.7, value.c_str());
0253        hsum_TEC->Fill(ks[i]);
0254        leg.Clear();
0255        leg.AddEntry(rh[i],rver , "l");
0256        leg.AddEntry(ch[i],cver , "l");
0257        leg.Draw();
0258 
0259      }
0260      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0261    } 
0262     c->Print(outname_eps.c_str());
0263     c->Print(outname_gif.c_str());
0264 
0265 // BPIX
0266    system = "BPIX";
0267    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0268    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0269    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0270    
0271    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0272    c->Divide(3,4);   
0273    for (Int_t i=0; i<12; i++) {       
0274      hn << histogram << i+1 <<std::endl; 
0275      hn >> hname;
0276      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0277      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0278      c->cd(i+1);
0279      if (PV->KSok(rh[i] , ch[i])) {
0280        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0281        PV->KSdraw(rh[i] , ch[i]);
0282        rh[i]->Draw("h");      
0283        ch[i]->Draw("h same");             
0284        buf<<"KS="<<ks[i]<<std::endl;
0285        buf>>value;
0286        te->DrawTextNDC(0.5,0.7, value.c_str());
0287        hsum_BPIX->Fill(ks[i]);
0288        leg.Clear();
0289        leg.AddEntry(rh[i],rver , "l");
0290        leg.AddEntry(ch[i],cver , "l");
0291        leg.Draw();
0292      }
0293      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0294    } 
0295     c->Print(outname_eps.c_str());
0296     c->Print(outname_gif.c_str());
0297    
0298    system = "FPIX";
0299    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0300    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0301    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0302    
0303    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0304    c->Divide(3,4);   
0305    for (Int_t i=0; i<12; i++) {       
0306      hn << histogram << i+1 <<std::endl; 
0307      hn >> hname;
0308      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0309      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0310      c->cd(i+1);
0311      if (PV->KSok(rh[i] , ch[i])) {
0312        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0313        PV->KSdraw(rh[i] , ch[i]);
0314        rh[i]->Draw("h");      
0315        ch[i]->Draw("h same");             
0316        buf<<"KS="<<ks[i]<<std::endl;
0317        buf>>value;
0318        te->DrawTextNDC(0.5,0.7, value.c_str());
0319        hsum_FPIX->Fill(ks[i]);
0320        leg.Clear();
0321        leg.AddEntry(rh[i],rver , "l");
0322        leg.AddEntry(ch[i],cver , "l");
0323        leg.Draw();
0324 
0325      }
0326      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0327    } 
0328     c->Print(outname_eps.c_str());
0329     c->Print(outname_gif.c_str());
0330 
0331 //=======================================================
0332    variable = "Entryy-Exity";
0333 //=======================================================
0334 
0335 // TOB
0336    system = "TOB";
0337    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0338    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0339    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0340    
0341    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0342    c->Divide(3,4);   
0343    for (Int_t i=0; i<12; i++) {       
0344      hn << histogram << i+1 <<std::endl; 
0345      hn >> hname;
0346      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0347      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0348      c->cd(i+1);
0349      if (PV->KSok(rh[i] , ch[i])) {
0350        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0351        PV->KSdraw(rh[i] , ch[i]);
0352        rh[i]->Draw("h");      
0353        ch[i]->Draw("h same");             
0354        buf<<"KS="<<ks[i]<<std::endl;
0355        buf>>value;
0356        te->DrawTextNDC(0.5,0.7, value.c_str());
0357        hsum_TOB->Fill(ks[i]);
0358        leg.Clear();
0359        leg.AddEntry(rh[i],rver , "l");
0360        leg.AddEntry(ch[i],cver , "l");
0361        leg.Draw();
0362 
0363      }
0364      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0365    } 
0366     c->Print(outname_eps.c_str());
0367     c->Print(outname_gif.c_str());
0368    
0369 // TIB
0370    system = "TIB";
0371    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0372    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0373    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0374    
0375    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0376    c->Divide(3,4);   
0377    for (Int_t i=0; i<12; i++) {       
0378      hn << histogram << i+1 <<std::endl; 
0379      hn >> hname;
0380      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0381      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0382      c->cd(i+1);
0383      if (PV->KSok(rh[i] , ch[i])) {
0384        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0385        PV->KSdraw(rh[i] , ch[i]);
0386        rh[i]->Draw("h");      
0387        ch[i]->Draw("h same");             
0388        buf<<"KS="<<ks[i]<<std::endl;
0389        buf>>value;
0390        te->DrawTextNDC(0.5,0.7, value.c_str());
0391        hsum_TIB->Fill(ks[i]);
0392        leg.Clear();
0393        leg.AddEntry(rh[i],rver , "l");
0394        leg.AddEntry(ch[i],cver , "l");
0395        leg.Draw();
0396 
0397      }
0398      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0399    } 
0400     c->Print(outname_eps.c_str());
0401     c->Print(outname_gif.c_str());
0402    
0403 // TID
0404    system = "TID";
0405    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0406    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0407    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0408    
0409    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0410    c->Divide(3,4);   
0411    for (Int_t i=0; i<12; i++) {       
0412      hn << histogram << i+1 <<std::endl; 
0413      hn >> hname;
0414      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0415      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0416      c->cd(i+1);
0417      if (PV->KSok(rh[i] , ch[i])) {
0418        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0419        PV->KSdraw(rh[i] , ch[i]);
0420        rh[i]->Draw("h");      
0421        ch[i]->Draw("h same");             
0422        buf<<"KS="<<ks[i]<<std::endl;
0423        buf>>value;
0424        te->DrawTextNDC(0.5,0.7, value.c_str());
0425        hsum_TID->Fill(ks[i]);
0426        leg.Clear();
0427        leg.AddEntry(rh[i],rver , "l");
0428        leg.AddEntry(ch[i],cver , "l");
0429        leg.Draw();
0430 
0431      }
0432      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0433    } 
0434     c->Print(outname_eps.c_str());
0435     c->Print(outname_gif.c_str());
0436 
0437 // TEC
0438    system = "TEC";
0439    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0440    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0441    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0442    
0443    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0444    c->Divide(3,4);   
0445    for (Int_t i=0; i<12; i++) {       
0446      hn << histogram << i+1 <<std::endl; 
0447      hn >> hname;
0448      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0449      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0450      c->cd(i+1);
0451      if (PV->KSok(rh[i] , ch[i])) {
0452        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0453        PV->KSdraw(rh[i] , ch[i]);
0454        rh[i]->Draw("h");      
0455        ch[i]->Draw("h same");             
0456        buf<<"KS="<<ks[i]<<std::endl;
0457        buf>>value;
0458        te->DrawTextNDC(0.5,0.7, value.c_str());
0459        hsum_TEC->Fill(ks[i]);
0460        leg.Clear();
0461        leg.AddEntry(rh[i],rver , "l");
0462        leg.AddEntry(ch[i],cver , "l");
0463        leg.Draw();
0464 
0465      }
0466      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0467    } 
0468     c->Print(outname_eps.c_str());
0469     c->Print(outname_gif.c_str());
0470 
0471 // BPIX
0472    system = "BPIX";
0473    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0474    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0475    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0476    
0477    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0478    c->Divide(3,4);   
0479    for (Int_t i=0; i<12; i++) {       
0480      hn << histogram << i+1 <<std::endl; 
0481      hn >> hname;
0482      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0483      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0484      c->cd(i+1);
0485      if (PV->KSok(rh[i] , ch[i])) {
0486        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0487        PV->KSdraw(rh[i] , ch[i]);
0488        rh[i]->Draw("h");      
0489        ch[i]->Draw("h same");             
0490        buf<<"KS="<<ks[i]<<std::endl;
0491        buf>>value;
0492        te->DrawTextNDC(0.5,0.7, value.c_str());
0493        hsum_BPIX->Fill(ks[i]);
0494        leg.Clear();
0495        leg.AddEntry(rh[i],rver , "l");
0496        leg.AddEntry(ch[i],cver , "l");
0497        leg.Draw();
0498 
0499      }
0500      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0501    } 
0502     c->Print(outname_eps.c_str());
0503     c->Print(outname_gif.c_str());
0504    
0505    system = "FPIX";
0506    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0507    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0508    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0509    
0510    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0511    c->Divide(3,4);   
0512    for (Int_t i=0; i<12; i++) {       
0513      hn << histogram << i+1 <<std::endl; 
0514      hn >> hname;
0515      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0516      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0517      c->cd(i+1);
0518      if (PV->KSok(rh[i] , ch[i])) {
0519        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0520        PV->KSdraw(rh[i] , ch[i]); 
0521        rh[i]->Draw("h");      
0522        ch[i]->Draw("h same");             
0523        buf<<"KS="<<ks[i]<<std::endl;
0524        buf>>value;
0525        te->DrawTextNDC(0.5,0.7, value.c_str());
0526        hsum_FPIX->Fill(ks[i]);
0527        leg.Clear();
0528        leg.AddEntry(rh[i],rver , "l");
0529        leg.AddEntry(ch[i],cver , "l");
0530        leg.Draw();
0531 
0532      }
0533      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0534    } 
0535     c->Print(outname_eps.c_str());
0536     c->Print(outname_gif.c_str());
0537 
0538 //=======================================================
0539    variable = "Entryz-Exitz";
0540 //=======================================================
0541 
0542 // TOB
0543    system = "TOB";
0544    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0545    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0546    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0547    
0548    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0549    c->Divide(3,4);   
0550    for (Int_t i=0; i<12; i++) {       
0551      hn << histogram << i+1 <<std::endl; 
0552      hn >> hname;
0553      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0554      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0555      c->cd(i+1);
0556      if (PV->KSok(rh[i] , ch[i])) {
0557        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0558        PV->KSdraw(rh[i] , ch[i]);
0559        rh[i]->Draw("h");      
0560        ch[i]->Draw("h same");             
0561        buf<<"KS="<<ks[i]<<std::endl;
0562        buf>>value;
0563        te->DrawTextNDC(0.5,0.7, value.c_str());
0564        hsum_TOB->Fill(ks[i]);
0565        leg.Clear();
0566        leg.AddEntry(rh[i],rver , "l");
0567        leg.AddEntry(ch[i],cver , "l");
0568        leg.Draw();
0569 
0570      }
0571      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0572    } 
0573     c->Print(outname_eps.c_str());
0574     c->Print(outname_gif.c_str());
0575    
0576 // TIB
0577    system = "TIB";
0578    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0579    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0580    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0581    
0582    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0583    c->Divide(3,4);   
0584    for (Int_t i=0; i<12; i++) {       
0585      hn << histogram << i+1 <<std::endl; 
0586      hn >> hname;
0587      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0588      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0589      c->cd(i+1);
0590      if (PV->KSok(rh[i] , ch[i])) {
0591        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0592        PV->KSdraw(rh[i] , ch[i]);
0593        rh[i]->Draw("h");      
0594        ch[i]->Draw("h same");             
0595        buf<<"KS="<<ks[i]<<std::endl;
0596        buf>>value;
0597        te->DrawTextNDC(0.5,0.7, value.c_str());
0598        hsum_TIB->Fill(ks[i]);
0599        leg.Clear();
0600        leg.AddEntry(rh[i],rver , "l");
0601        leg.AddEntry(ch[i],cver , "l");
0602        leg.Draw();
0603 
0604      }
0605      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0606    } 
0607     c->Print(outname_eps.c_str());
0608     c->Print(outname_gif.c_str());
0609    
0610 // TID
0611    system = "TID";
0612    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0613    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0614    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0615    
0616    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0617    c->Divide(3,4);   
0618    for (Int_t i=0; i<12; i++) {       
0619      hn << histogram << i+1 <<std::endl; 
0620      hn >> hname;
0621      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0622      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0623      c->cd(i+1);
0624      if (PV->KSok(rh[i] , ch[i])) {
0625        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0626        PV->KSdraw(rh[i] , ch[i]);
0627        rh[i]->Draw("h");      
0628        ch[i]->Draw("h same");             
0629        buf<<"KS="<<ks[i]<<std::endl;
0630        buf>>value;
0631        te->DrawTextNDC(0.5,0.7, value.c_str());
0632        hsum_TID->Fill(ks[i]);
0633        leg.Clear();
0634        leg.AddEntry(rh[i],rver , "l");
0635        leg.AddEntry(ch[i],cver , "l");
0636        leg.Draw();
0637 
0638      }
0639      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0640    } 
0641     c->Print(outname_eps.c_str());
0642     c->Print(outname_gif.c_str());
0643 
0644 // TEC
0645    system = "TEC";
0646    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0647    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0648    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0649    
0650    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0651    c->Divide(3,4);   
0652    for (Int_t i=0; i<12; i++) {       
0653      hn << histogram << i+1 <<std::endl; 
0654      hn >> hname;
0655      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0656      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0657      c->cd(i+1);
0658      if (PV->KSok(rh[i] , ch[i])) {
0659        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0660        PV->KSdraw(rh[i] , ch[i]);
0661        rh[i]->Draw("h");      
0662        ch[i]->Draw("h same");             
0663        buf<<"KS="<<ks[i]<<std::endl;
0664        buf>>value;
0665        te->DrawTextNDC(0.5,0.7, value.c_str());
0666        hsum_TEC->Fill(ks[i]);
0667        leg.Clear();
0668        leg.AddEntry(rh[i],rver , "l");
0669        leg.AddEntry(ch[i],cver , "l");
0670        leg.Draw();
0671 
0672      }
0673      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0674    } 
0675     c->Print(outname_eps.c_str());
0676     c->Print(outname_gif.c_str());
0677 
0678 // BPIX
0679    system = "BPIX";
0680    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0681    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0682    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0683    
0684    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0685    c->Divide(3,4);   
0686    for (Int_t i=0; i<12; i++) {       
0687      hn << histogram << i+1 <<std::endl; 
0688      hn >> hname;
0689      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0690      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0691      c->cd(i+1);
0692      if (PV->KSok(rh[i] , ch[i])) {
0693        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0694        PV->KSdraw(rh[i] , ch[i]);
0695        rh[i]->Draw("h");      
0696        ch[i]->Draw("h same");             
0697        buf<<"KS="<<ks[i]<<std::endl;
0698        buf>>value;
0699        te->DrawTextNDC(0.5,0.7, value.c_str());
0700        hsum_BPIX->Fill(ks[i]);
0701        leg.Clear();
0702        leg.AddEntry(rh[i],rver , "l");
0703        leg.AddEntry(ch[i],cver , "l");
0704        leg.Draw();
0705 
0706      }
0707      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0708    } 
0709     c->Print(outname_eps.c_str());
0710     c->Print(outname_gif.c_str());
0711    
0712    system = "FPIX";
0713    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0714    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0715    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0716    
0717    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0718    c->Divide(3,4);   
0719    for (Int_t i=0; i<12; i++) {       
0720      hn << histogram << i+1 <<std::endl; 
0721      hn >> hname;
0722      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0723      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0724      c->cd(i+1);
0725      if (PV->KSok(rh[i] , ch[i])) {
0726        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0727        PV->KSdraw(rh[i] , ch[i]);
0728        rh[i]->Draw("h");      
0729        ch[i]->Draw("h same");             
0730        buf<<"KS="<<ks[i]<<std::endl;
0731        buf>>value;
0732        te->DrawTextNDC(0.5,0.7, value.c_str());
0733        hsum_FPIX->Fill(ks[i]);
0734        leg.Clear();
0735        leg.AddEntry(rh[i],rver , "l");
0736        leg.AddEntry(ch[i],cver , "l");
0737        leg.Draw();
0738 
0739      }
0740      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0741    } 
0742     c->Print(outname_eps.c_str());
0743     c->Print(outname_gif.c_str());
0744 
0745 //=======================================================
0746    variable = "Localx";
0747 //=======================================================
0748 
0749 // TOB
0750    system = "TOB";
0751    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0752    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0753    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0754    
0755    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0756    c->Divide(3,4);   
0757    for (Int_t i=0; i<12; i++) {       
0758      hn << histogram << i+1 <<std::endl; 
0759      hn >> hname;
0760      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0761      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0762      c->cd(i+1);
0763      if (PV->KSok(rh[i] , ch[i])) {
0764        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0765        PV->KSdraw(rh[i] , ch[i]);
0766        rh[i]->Draw("h");      
0767        ch[i]->Draw("h same");             
0768        buf<<"KS="<<ks[i]<<std::endl;
0769        buf>>value;
0770        te->DrawTextNDC(0.5,0.7, value.c_str());
0771        hsum_TOB->Fill(ks[i]);
0772        leg.Clear();
0773        leg.AddEntry(rh[i],rver , "l");
0774        leg.AddEntry(ch[i],cver , "l");
0775        leg.Draw();
0776 
0777      }
0778      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0779    } 
0780     c->Print(outname_eps.c_str());
0781     c->Print(outname_gif.c_str());
0782    
0783 // TIB
0784    system = "TIB";
0785    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0786    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0787    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0788    
0789    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0790    c->Divide(3,4);   
0791    for (Int_t i=0; i<12; i++) {       
0792      hn << histogram << i+1 <<std::endl; 
0793      hn >> hname;
0794      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0795      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0796      c->cd(i+1);
0797      if (PV->KSok(rh[i] , ch[i])) {
0798        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0799        PV->KSdraw(rh[i] , ch[i]);
0800        rh[i]->Draw("h");      
0801        ch[i]->Draw("h same");             
0802        buf<<"KS="<<ks[i]<<std::endl;
0803        buf>>value;
0804        te->DrawTextNDC(0.5,0.7, value.c_str());
0805        hsum_TIB->Fill(ks[i]);
0806        leg.Clear();
0807        leg.AddEntry(rh[i],rver , "l");
0808        leg.AddEntry(ch[i],cver , "l");
0809        leg.Draw();
0810 
0811      }
0812      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0813    } 
0814     c->Print(outname_eps.c_str());
0815     c->Print(outname_gif.c_str());
0816    
0817 // TID
0818    system = "TID";
0819    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0820    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0821    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0822    
0823    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0824    c->Divide(3,4);   
0825    for (Int_t i=0; i<12; i++) {       
0826      hn << histogram << i+1 <<std::endl; 
0827      hn >> hname;
0828      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0829      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0830      c->cd(i+1);
0831      if (PV->KSok(rh[i] , ch[i])) {
0832        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0833        PV->KSdraw(rh[i] , ch[i]);
0834        rh[i]->Draw("h");      
0835        ch[i]->Draw("h same");             
0836        buf<<"KS="<<ks[i]<<std::endl;
0837        buf>>value;
0838        te->DrawTextNDC(0.5,0.7, value.c_str());
0839        hsum_TID->Fill(ks[i]);
0840        leg.Clear();
0841        leg.AddEntry(rh[i],rver , "l");
0842        leg.AddEntry(ch[i],cver , "l");
0843        leg.Draw();
0844 
0845      }
0846      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0847    } 
0848     c->Print(outname_eps.c_str());
0849     c->Print(outname_gif.c_str());
0850 
0851 // TEC
0852    system = "TEC";
0853    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0854    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0855    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0856    
0857    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0858    c->Divide(3,4);   
0859    for (Int_t i=0; i<12; i++) {       
0860      hn << histogram << i+1 <<std::endl; 
0861      hn >> hname;
0862      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0863      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0864      c->cd(i+1);
0865      if (PV->KSok(rh[i] , ch[i])) {
0866        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0867        PV->KSdraw(rh[i] , ch[i]);
0868        rh[i]->Draw("h");      
0869        ch[i]->Draw("h same");             
0870        buf<<"KS="<<ks[i]<<std::endl;
0871        buf>>value;
0872        te->DrawTextNDC(0.5,0.7, value.c_str());
0873        hsum_TEC->Fill(ks[i]);
0874        leg.Clear();
0875        leg.AddEntry(rh[i],rver , "l");
0876        leg.AddEntry(ch[i],cver , "l");
0877        leg.Draw();
0878 
0879      }
0880      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0881    } 
0882     c->Print(outname_eps.c_str());
0883     c->Print(outname_gif.c_str());
0884 
0885 // BPIX
0886    system = "BPIX";
0887    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0888    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0889    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0890    
0891    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0892    c->Divide(3,4);   
0893    for (Int_t i=0; i<12; i++) {       
0894      hn << histogram << i+1 <<std::endl; 
0895      hn >> hname;
0896      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0897      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0898      c->cd(i+1);
0899      if (PV->KSok(rh[i] , ch[i])) {
0900        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0901        PV->KSdraw(rh[i] , ch[i]);
0902        rh[i]->Draw("h");      
0903        ch[i]->Draw("h same");             
0904        buf<<"KS="<<ks[i]<<std::endl;
0905        buf>>value;
0906        te->DrawTextNDC(0.5,0.7, value.c_str());
0907        hsum_BPIX->Fill(ks[i]);
0908        leg.Clear();
0909        leg.AddEntry(rh[i],rver , "l");
0910        leg.AddEntry(ch[i],cver , "l");
0911        leg.Draw();
0912 
0913      }
0914      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0915    } 
0916     c->Print(outname_eps.c_str());
0917     c->Print(outname_gif.c_str());
0918    
0919    system = "FPIX";
0920    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0921    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0922    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0923    
0924    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0925    c->Divide(3,4);   
0926    for (Int_t i=0; i<12; i++) {       
0927      hn << histogram << i+1 <<std::endl; 
0928      hn >> hname;
0929      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0930      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0931      c->cd(i+1);
0932      if (PV->KSok(rh[i] , ch[i])) {
0933        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0934        PV->KSdraw(rh[i] , ch[i]);
0935        rh[i]->Draw("h");      
0936        ch[i]->Draw("h same");             
0937        buf<<"KS="<<ks[i]<<std::endl;
0938        buf>>value;
0939        te->DrawTextNDC(0.5,0.7, value.c_str());
0940        hsum_FPIX->Fill(ks[i]);
0941        leg.Clear();
0942        leg.AddEntry(rh[i],rver , "l");
0943        leg.AddEntry(ch[i],cver , "l");
0944        leg.Draw();
0945 
0946      }
0947      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0948    } 
0949     c->Print(outname_eps.c_str());
0950     c->Print(outname_gif.c_str());
0951 
0952 //=======================================================
0953    variable = "Localy";
0954 //=======================================================
0955 
0956 // TOB
0957    system = "TOB";
0958    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0959    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0960    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0961    
0962    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0963    c->Divide(3,4);   
0964    for (Int_t i=0; i<12; i++) {       
0965      hn << histogram << i+1 <<std::endl; 
0966      hn >> hname;
0967      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
0968      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
0969      c->cd(i+1);
0970      if (PV->KSok(rh[i] , ch[i])) {
0971        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
0972        PV->KSdraw(rh[i] , ch[i]);
0973        rh[i]->Draw("h");      
0974        ch[i]->Draw("h same");             
0975        buf<<"KS="<<ks[i]<<std::endl;
0976        buf>>value;
0977        te->DrawTextNDC(0.5,0.7, value.c_str());
0978        hsum_TOB->Fill(ks[i]);
0979        leg.Clear();
0980        leg.AddEntry(rh[i],rver , "l");
0981        leg.AddEntry(ch[i],cver , "l");
0982        leg.Draw();
0983 
0984      }
0985      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
0986    } 
0987     c->Print(outname_eps.c_str());
0988     c->Print(outname_gif.c_str());
0989    
0990 // TIB
0991    system = "TIB";
0992    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
0993    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
0994    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
0995    
0996    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
0997    c->Divide(3,4);   
0998    for (Int_t i=0; i<12; i++) {       
0999      hn << histogram << i+1 <<std::endl; 
1000      hn >> hname;
1001      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
1002      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
1003      c->cd(i+1);
1004      if (PV->KSok(rh[i] , ch[i])) {
1005        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
1006        PV->KSdraw(rh[i] , ch[i]);
1007        rh[i]->Draw("h");      
1008        ch[i]->Draw("h same");             
1009        buf<<"KS="<<ks[i]<<std::endl;
1010        buf>>value;
1011        te->DrawTextNDC(0.5,0.7, value.c_str());
1012        hsum_TIB->Fill(ks[i]);
1013        leg.Clear();
1014        leg.AddEntry(rh[i],rver , "l");
1015        leg.AddEntry(ch[i],cver , "l");
1016        leg.Draw();
1017 
1018      }
1019      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
1020    } 
1021     c->Print(outname_eps.c_str());
1022     c->Print(outname_gif.c_str());
1023    
1024 // TID
1025    system = "TID";
1026    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
1027    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
1028    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
1029    
1030    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
1031    c->Divide(3,4);   
1032    for (Int_t i=0; i<12; i++) {       
1033      hn << histogram << i+1 <<std::endl; 
1034      hn >> hname;
1035      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
1036      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
1037      c->cd(i+1);
1038      if (PV->KSok(rh[i] , ch[i])) {
1039        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
1040        PV->KSdraw(rh[i] , ch[i]);
1041        rh[i]->Draw("h");      
1042        ch[i]->Draw("h same");             
1043        buf<<"KS="<<ks[i]<<std::endl;
1044        buf>>value;
1045        te->DrawTextNDC(0.5,0.7, value.c_str());
1046        hsum_TID->Fill(ks[i]);
1047        leg.Clear();
1048        leg.AddEntry(rh[i],rver , "l");
1049        leg.AddEntry(ch[i],cver , "l");
1050        leg.Draw();
1051 
1052      }
1053      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
1054    } 
1055     c->Print(outname_eps.c_str());
1056     c->Print(outname_gif.c_str());
1057 
1058 // TEC
1059    system = "TEC";
1060    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
1061    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
1062    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
1063    
1064    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
1065    c->Divide(3,4);   
1066    for (Int_t i=0; i<12; i++) {       
1067      hn << histogram << i+1 <<std::endl; 
1068      hn >> hname;
1069      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
1070      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
1071      c->cd(i+1);
1072      if (PV->KSok(rh[i] , ch[i])) {
1073        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
1074        PV->KSdraw(rh[i] , ch[i]);
1075        rh[i]->Draw("h");      
1076        ch[i]->Draw("h same");             
1077        buf<<"KS="<<ks[i]<<std::endl;
1078        buf>>value;
1079        te->DrawTextNDC(0.5,0.7, value.c_str());
1080        hsum_TEC->Fill(ks[i]);
1081        leg.Clear();
1082        leg.AddEntry(rh[i],rver , "l");
1083        leg.AddEntry(ch[i],cver , "l");
1084        leg.Draw();
1085 
1086      }
1087      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
1088    } 
1089     c->Print(outname_eps.c_str());
1090     c->Print(outname_gif.c_str());
1091 
1092 // BPIX
1093    system = "BPIX";
1094    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
1095    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
1096    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
1097    
1098    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
1099    c->Divide(3,4);   
1100    for (Int_t i=0; i<12; i++) {       
1101      hn << histogram << i+1 <<std::endl; 
1102      hn >> hname;
1103      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
1104      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
1105      c->cd(i+1);
1106      if (PV->KSok(rh[i] , ch[i])) {
1107        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
1108        PV->KSdraw(rh[i] , ch[i]);
1109        rh[i]->Draw("h");      
1110        ch[i]->Draw("h same");             
1111        buf<<"KS="<<ks[i]<<std::endl;
1112        buf>>value;
1113        te->DrawTextNDC(0.5,0.7, value.c_str());
1114        hsum_BPIX->Fill(ks[i]);
1115        leg.Clear();
1116        leg.AddEntry(rh[i],rver , "l");
1117        leg.AddEntry(ch[i],cver , "l");
1118        leg.Draw();
1119 
1120      }
1121      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
1122    } 
1123     c->Print(outname_eps.c_str());
1124     c->Print(outname_gif.c_str());
1125    
1126    system = "FPIX";
1127    string outname_eps = "pos_"+variable+"_"+system+"_KS.eps";
1128    string outname_gif = "pos_"+variable+"_"+system+"_KS.gif";
1129    histogram = ""+system+"Hit/"+variable+"_"+system+"_";
1130    
1131    TCanvas * c = new TCanvas(system.c_str(),system.c_str(),600,800);
1132    c->Divide(3,4);   
1133    for (Int_t i=0; i<12; i++) {       
1134      hn << histogram << i+1 <<std::endl; 
1135      hn >> hname;
1136      rh[i] = (TH1F*)rdir->Get(hname.c_str())->Clone();
1137      ch[i] = (TH1F*)cdir->Get(hname.c_str())->Clone();      
1138      c->cd(i+1);
1139      if (PV->KSok(rh[i] , ch[i])) {
1140        ks[i] = PV->KSCompute(rh[i] , ch[i] , te );
1141        PV->KSdraw(rh[i] , ch[i]);
1142        rh[i]->Draw("h");      
1143        ch[i]->Draw("h same");             
1144        buf<<"KS="<<ks[i]<<std::endl;
1145        buf>>value;
1146        te->DrawTextNDC(0.5,0.7, value.c_str());
1147        hsum_FPIX->Fill(ks[i]);
1148        leg.Clear();
1149        leg.AddEntry(rh[i],rver , "l");
1150        leg.AddEntry(ch[i],cver , "l");
1151        leg.Draw();
1152 
1153      }
1154      if (ks[i] < 0.1) outfile << ch[i]->GetName() <<" KS probability = "<< ks[i] <<" "<<endl;
1155    } 
1156     c->Print(outname_eps.c_str());
1157     c->Print(outname_gif.c_str());
1158 
1159 //===================================================
1160 // Summary plots
1161 //===================================================
1162 
1163  hsum_st -> Add (hsum_TIB);
1164  hsum_st -> Add (hsum_TOB);
1165  hsum_st -> Add (hsum_TID);
1166  hsum_st -> Add (hsum_TEC); 
1167  hsum_px -> Add (hsum_BPIX);
1168  hsum_px -> Add (hsum_FPIX);
1169  
1170  TCanvas * s = new TCanvas("s","s",600,800);
1171  s->Divide(2,4);
1172  
1173  s->cd (1);
1174  hsum_TIB -> Draw();
1175  s->cd (2);
1176  hsum_TOB -> Draw();
1177  s->cd (3);
1178  hsum_TID -> Draw();
1179  s->cd (4);
1180  hsum_TEC -> Draw();
1181  s->cd (5);
1182  hsum_BPIX -> Draw();
1183  s->cd (6);
1184  hsum_FPIX -> Draw();
1185  s->cd (7);
1186  hsum_st -> Draw();
1187  s->cd (8);
1188  hsum_px -> Draw();
1189  
1190  s->Print("pos_summary_KS.eps");  
1191  s->Print("pos_summary_KS.gif");  
1192 
1193 }
1194 
1195