80   TString 
inputfile=
"root://castoratlas//castor/cern.ch/user/l/lorenzi/TrkValidation17.0.0.5_J5.root";
 
   89   TTree *simu = (TTree*)
file->Get(
"Validation/NNinput");
 
   93   std::cout << 
" Training sample obtained... " << std::endl;
 
   95   vector<int>     *NN_sizeX;
 
   96   vector<int>     *NN_sizeY;
 
   97   vector<vector<float> > *NN_matrixOfToT;
 
   98   vector<vector<float> > *NN_vectorOfPitchesY;
 
   99   vector<int>     *NN_ClusterPixLayer;
 
  100   vector<int>     *NN_ClusterPixBarrelEC;
 
  101   vector<float>   *NN_phiBS;
 
  102   vector<float>   *NN_thetaBS;
 
  103   vector<float>   *NN_etaModule;
 
  104   vector<bool>    *NN_useTrackInfo;
 
  105   vector<int>     *NN_columnWeightedPosition;
 
  106   vector<int>     *NN_rowWeightedPosition;
 
  107   vector<double>     *NN_localColumnWeightedPosition;
 
  108   vector<double>     *NN_localRowWeightedPosition;
 
  110   vector<vector<float> > *NN_positionX;
 
  111   vector<vector<float> > *NN_positionY;
 
  112   vector<vector<float> > *NN_position_idX;
 
  113   vector<vector<float> > *NN_position_idY;
 
  114   vector<vector<float> > *NN_theta;
 
  115   vector<vector<float> > *NN_phi;
 
  120   TBranch        *b_NN_matrixOfToT;   
 
  121   TBranch        *b_NN_vectorOfPitchesY;   
 
  122   TBranch        *b_NN_ClusterPixLayer;   
 
  123   TBranch        *b_NN_ClusterPixBarrelEC;   
 
  125   TBranch        *b_NN_thetaBS;   
 
  126   TBranch        *b_NN_etaModule;   
 
  127   TBranch        *b_NN_useTrackInfo;   
 
  128   TBranch        *b_NN_columnWeightedPosition;   
 
  129   TBranch        *b_NN_rowWeightedPosition;   
 
  130   TBranch        *b_NN_localColumnWeightedPosition;   
 
  131   TBranch        *b_NN_localRowWeightedPosition;   
 
  132   TBranch        *b_NN_positionX;   
 
  133   TBranch        *b_NN_positionY;   
 
  134   TBranch        *b_NN_position_idX;   
 
  135   TBranch        *b_NN_position_idY;   
 
  144   NN_vectorOfPitchesY = 0;
 
  145   NN_ClusterPixLayer = 0;
 
  146   NN_ClusterPixBarrelEC = 0;
 
  151   NN_columnWeightedPosition = 0;
 
  152   NN_rowWeightedPosition = 0;
 
  153   NN_localColumnWeightedPosition = 0;
 
  154   NN_localRowWeightedPosition = 0;
 
  165   simu->SetMakeClass(1);
 
  167   simu->SetBranchAddress(
"NN_sizeX", &NN_sizeX, &b_NN_sizeX);
 
  168   simu->SetBranchAddress(
"NN_sizeY", &NN_sizeY, &b_NN_sizeY);
 
  169   simu->SetBranchAddress(
"NN_matrixOfToT", &NN_matrixOfToT, &b_NN_matrixOfToT);
 
  170   simu->SetBranchAddress(
"NN_vectorOfPitchesY", &NN_vectorOfPitchesY, &b_NN_vectorOfPitchesY);
 
  171   simu->SetBranchAddress(
"NN_ClusterPixLayer", &NN_ClusterPixLayer, &b_NN_ClusterPixLayer);
 
  172   simu->SetBranchAddress(
"NN_ClusterPixBarrelEC", &NN_ClusterPixBarrelEC, &b_NN_ClusterPixBarrelEC);
 
  173   simu->SetBranchAddress(
"NN_phiBS", &NN_phiBS, &b_NN_phiBS);
 
  174   simu->SetBranchAddress(
"NN_thetaBS", &NN_thetaBS, &b_NN_thetaBS);
 
  175   simu->SetBranchAddress(
"NN_etaModule", &NN_etaModule, &b_NN_etaModule);
 
  176   simu->SetBranchAddress(
"NN_useTrackInfo", &NN_useTrackInfo, &b_NN_useTrackInfo);
 
  177   simu->SetBranchAddress(
"NN_columnWeightedPosition", &NN_columnWeightedPosition, &b_NN_columnWeightedPosition);
 
  178   simu->SetBranchAddress(
"NN_rowWeightedPosition", &NN_rowWeightedPosition, &b_NN_rowWeightedPosition);
 
  180   simu->SetBranchAddress(
"NN_localColumnWeightedPosition", &NN_localColumnWeightedPosition, &b_NN_localColumnWeightedPosition);
 
  181   simu->SetBranchAddress(
"NN_localRowWeightedPosition", &NN_localRowWeightedPosition, &b_NN_localRowWeightedPosition);
 
  183   simu->SetBranchAddress(
"NN_positionX", &NN_positionX, &b_NN_positionX);
 
  184   simu->SetBranchAddress(
"NN_positionY", &NN_positionY, &b_NN_positionY);
 
  185   simu->SetBranchAddress(
"NN_position_idX", &NN_position_idX, &b_NN_position_idX);
 
  186   simu->SetBranchAddress(
"NN_position_idY", &NN_position_idY, &b_NN_position_idY);
 
  188   simu->SetBranchAddress(
"NN_theta", &NN_theta, &b_NN_theta);
 
  189   simu->SetBranchAddress(
"NN_phi", &NN_phi, &b_NN_phi);
 
  194   cout << 
"Branches set..." << endl;
 
  199   TString    pathWithoutTracks  = 
"/afs/cern.ch/user/g/giacinto/scratch0/PixelClusterisationTF/jetNet/jetNetJune2011/withoutTracks/Weights.root";
 
  200   TString    pathWithTracks     = 
"/afs/cern.ch/user/g/giacinto/scratch0/PixelClusterisationTF/prepareJetNetNtupleApril2011/withTracks/Weights.root";
 
  205   if(!useTrackEstimate){    
 
  207     name+= pathWithoutTracks;
 
  211     name+=pathWithTracks;
 
  217   TFile *_file0 = 
new TFile(
name);
 
  220   cout << 
" Reading back network with minimum" << endl;
 
  229   TH1D* histo1 = 
new TH1D(
"1",
"1",1000,0,1);
 
  230   TH1D* histo2 = 
new TH1D(
"2",
"2",1000,0,1);
 
  231   TH1D* histo3 = 
new TH1D(
"3",
"3",1000,0,1);
 
  233   TH1D* ahisto2= 
new TH1D(
"a2",
"a2",1000,0,1);
 
  234   TH1D* ahisto3= 
new TH1D(
"a3",
"a3",1000,0,1);
 
  237   for (Int_t 
i = 0; 
i < simu->GetEntries(); 
i++) {
 
  239     if (
i % 1000 == 0 ) {
 
  240       std::cout << 
" Counting training / testing events in sample. Looping over event " << 
i << 
" cluster: " << iClus << std::endl;
 
  243     if (
i > 50000 ) 
break;
 
  248     for( 
unsigned int clus =0; clus<NN_sizeX->size(); clus++ ){
 
  250       vector<float>  *matrixOfToT=0;
 
  251       vector<float>   *vectorOfPitchesY=0;
 
  256       Int_t ClusterPixLayer;
 
  257       Int_t ClusterPixBarrelEC;
 
  259       std::vector<float> * positionX=0;
 
  260       std::vector<float> * positionY=0;
 
  262       std::vector<float> * position_idX=0;
 
  263       std::vector<float> * position_idY=0;
 
  266       std::vector<float> * thetaTr=0;
 
  267       std::vector<float> * phiTr=0;
 
  269       double localColumnWeightedPosition;
 
  270       double localRowWeightedPosition;
 
  272       double columnWeightedPosition;
 
  273       double rowWeightedPosition;
 
  277       sizeX = (*NN_sizeX)[clus];
 
  278       sizeY = (*NN_sizeY)[clus];
 
  280       matrixOfToT=&(*NN_matrixOfToT)[clus];
 
  281       vectorOfPitchesY=&(*NN_vectorOfPitchesY)[clus];
 
  283       phiBS = (*NN_phiBS)[clus];
 
  284       thetaBS =(*NN_thetaBS)[clus];
 
  285       etaModule =(*NN_etaModule)[clus];
 
  287       ClusterPixLayer=(*NN_ClusterPixLayer)[clus];
 
  288       ClusterPixBarrelEC = (*NN_ClusterPixBarrelEC)[clus];
 
  290       positionX =&(*NN_positionX)[clus];
 
  291       positionY =&(*NN_positionY)[clus];
 
  293       position_idX =&(*NN_position_idX)[clus];
 
  294       position_idY =&(*NN_position_idY)[clus];
 
  296       thetaTr = &(*NN_theta)[clus];
 
  297       phiTr = &(*NN_phi)[clus];
 
  300       localColumnWeightedPosition =(*NN_localColumnWeightedPosition)[clus];
 
  301       localRowWeightedPosition    =(*NN_localRowWeightedPosition)[clus];
 
  303       columnWeightedPosition =(*NN_columnWeightedPosition)[clus];
 
  304       rowWeightedPosition    =(*NN_rowWeightedPosition)[clus];
 
  310       unsigned int nParticles = positionX->size();
 
  316       thetaTr = &(*NN_theta)[clus];
 
  317       phiTr = &(*NN_phi)[clus];
 
  322       for( 
unsigned int P = 0; 
P < positionX->size(); 
P++){
 
  325     if(iClus > 5000) 
break;
 
  327     double  theta = (*thetaTr)[
P];
 
  328     double  phi   = (*phiTr)[
P];
 
  330     std::vector<Double_t> inputData;
 
  332     for(
unsigned int ME =0; 
ME < matrixOfToT->size(); 
ME++){
 
  334       inputData.push_back(
norm_ToT((*matrixOfToT)[ME]));
 
  337     for (
int s=0;
s<sizeY;
s++)
 
  339         inputData.push_back(
norm_pitch((*vectorOfPitchesY)[
s])); 
 
  345     if (useTrackEstimate)
 
  361     int nParticles= positionX->size();
 
  363     if( nParticles ==1 ) { 
 
  365       histo1->Fill(outputNN[0]/(outputNN[0]+outputNN[1]+outputNN[2])); 
 
  370     if( nParticles ==2 ) { 
 
  372       histo2->Fill(outputNN[0]/(outputNN[0]+outputNN[1]+outputNN[2]));
 
  374       if( outputNN[0]/(outputNN[0]+outputNN[1]+outputNN[2])<0.98 ){
 
  376         ahisto2->Fill(  outputNN[1]/(outputNN[1]+outputNN[2]) );
 
  381     if( nParticles ==3 ) { 
 
  382       histo3->Fill(outputNN[0]/(outputNN[0]+outputNN[1]+outputNN[2])); 
 
  384       if( outputNN[0]/(outputNN[0]+outputNN[1]+outputNN[2])<0.98 ) {
 
  386         ahisto3->Fill(outputNN[1]/(outputNN[1]+outputNN[2])  ); 
 
  405   double* integral1=  histo1->GetIntegral();
 
  406   double* integral2=  histo2->GetIntegral();
 
  407   double* integral3=  histo3->GetIntegral();
 
  411   double integral4[1000];
 
  412   double integral5[1000];
 
  413   for (
int u=0;
u<1000;
u++)
 
  415     xcut[
u]=histo2->GetBinCenter(
u);
 
  416     integral4[
u]=1-integral2[
u];
 
  417     integral5[
u]=1-integral3[
u];
 
  420   TGraphErrors* Have1Vs2=
new TGraphErrors(1000,integral1,integral4,0,0);
 
  421   TGraphErrors* Have1Vs3=
new TGraphErrors(1000,integral1,integral5,0,0);
 
  422   TGraphErrors* HaveCutVs2=
new TGraphErrors(1000,xcut,integral4,0,0);
 
  424   TCanvas * 
c1=
new TCanvas(
"c1",
"c1",600,600);
 
  426   Have1Vs2->SetLineColor(2);
 
  427   Have1Vs2->SetMarkerColor(2);
 
  428   Have1Vs2->SetMarkerSize(0.4);
 
  429   Have1Vs2->SetMarkerStyle(3);
 
  430   Have1Vs2->Draw(
"AP");
 
  432   Have1Vs2->GetXaxis()->SetTitle(
"Fraction of wrongly split single-cluster");
 
  433   Have1Vs2->GetYaxis()->SetTitle(
"Fraction of not split multi-clusters");
 
  438  double* aintegral2=  ahisto2->GetIntegral();
 
  439   double* aintegral3=  ahisto3->GetIntegral();
 
  443   double aintegral4[1000];
 
  444   double aintegral5[1000];
 
  445   for (
int u=0;
u<1000;
u++)
 
  447     axcut[
u]=ahisto2->GetBinCenter(
u);
 
  448     aintegral4[
u]=1-aintegral2[
u];
 
  449     aintegral5[
u]=1-aintegral3[
u];
 
  455   TCanvas* c4=
new TCanvas(
"c4",
"c4",600,600);
 
  457   TGraphErrors* aHave1Vs3=
new TGraphErrors(1000,aintegral2,aintegral5,0,0);
 
  458   TGraphErrors* aHaveCutVs2=
new TGraphErrors(1000,axcut,aintegral4,0,0);
 
  461   aHave1Vs3->GetXaxis()->SetTitle(
"Fraction of wrongly split cluster (2 #rightarrow 3)");
 
  462   aHave1Vs3->GetYaxis()->SetTitle(
"Fraction of not split multi-clusters (3 #rightarrow 2)");
 
  465   aHave1Vs3->SetLineColor(4);
 
  466   aHave1Vs3->SetMarkerColor(4);
 
  467   aHave1Vs3->SetMarkerSize(0.5);
 
  468   aHave1Vs3->SetMarkerStyle(3);
 
  469   aHave1Vs3->Draw(
"AP");