+ // Read pi0 principals from the pi0 file
+
+ fFileNamePrincipalPi0 = "$ALICE_ROOT/PHOS/PCA_pi0_40-120.root" ;
+ TFile fPi0( fFileNamePrincipalPi0.Data(), "read" ) ;
+ fPrincipalPi0 = dynamic_cast<TPrincipal*> (fPi0.Get("principal")) ;
+ fPi0.Close() ;
+
+ // Open parameters file and initialization of the Parameters matrix.
+ // In the File Parameters.dat are all the parameters. These are introduced
+ // in a matrix of 16x4
+ //
+ // All the parameters defined in this file are, in order of row:
+ // line 0 : calibration
+ // lines 1,2 : CPV rectangular cat for X and Z
+ // line 3 : TOF cut
+ // lines 4-8 : parameters to calculate photon PCA ellipse
+ // lines 9-13: parameters to calculate pi0 PCA ellipse
+ // lines 14-15: parameters to calculate border for high-pt photons and pi0
+
+ fFileNameParameters = gSystem->ExpandPathName("$ALICE_ROOT/PHOS/Parameters.dat");
+ fParameters = new TMatrix(16,4) ;
+ const Int_t maxLeng=255;
+ char string[maxLeng];
+
+ // Open a text file with PID parameters
+ FILE *fd = fopen(fFileNameParameters.Data(),"r");
+ if (!fd)
+ Fatal("SetParameter","File %s with a PID parameters cannot be opened\n",
+ fFileNameParameters.Data());
+
+ Int_t i=0;
+ // Read parameter file line-by-line and skip empty line and comments
+ while (fgets(string,maxLeng,fd) != NULL) {
+ if (string[0] == '\n' ) continue;
+ if (string[0] == '!' ) continue;
+ sscanf(string, "%f %f %f %f",
+ &(*fParameters)(i,0), &(*fParameters)(i,1),
+ &(*fParameters)(i,2), &(*fParameters)(i,3));
+ i++;
+ //printf("line %d: %s",i,string);
+ }
+ fclose(fd);
+}