makeCovMatrix.C
Go to the documentation of this file.
1 {
2 //________________________________________________________________________________
3 /*
4  makeCovMatrix.C
5 
6  A simple example ROOT script which turns a hard-coded matrix in the script (tDat)
7  into a small ROOT file with just the matrix. The covariance matrix ROOT file
8  is used as an input to grwghtcov, the covariance reweighting routine.
9 
10  The error matrix provided is for reweighting the four z-expansion parameters
11  for the axial form factor. The numerical values are from e-Print arXiv: 1603.03048 [hep-ph],
12  which is calculated from combining Eqs. (32) and (33) to form an error matrix.
13 
14  */
15 #include <TMatrixD.h>
16 
17  int nP = 4; // matrix size
18  TFile *fMat = new TFile("tmat.out.root","recreate");
19 
20  // covariance matrix
21  double tDat[nP][nP] =
22  {{0.0154582, 0.0451836, -0.215641, 0.20647},
23  {0.0451836, 1.08091, -2.38702, 1.0386},
24  {-0.215641, -2.38702, 6.53568, -4.76577},
25  {0.20647, 1.0386, -4.76577, 7.39832} };
26 
27  // flatten matrix into 1-D array
28  double tFlt[nP* nP] = {0.};
29  for (int i=0;i<nP;i++) {
30  for (int j=0;j<nP;j++) {
31  if (tFlt[j*nP+i] != tDat[i][j] && i > j)
32  {
33  std::cout<< "Matrix needs to be symmetric!" << std::endl;
34  std::cout<< i<<","<<j<<": "<<tFlt[j*nP+i] <<","<< tDat[i][j]<<std::endl;
35  exit(1);
36  }
37  tFlt[i*nP+j] = tDat[i][j];
38  }}
39 
40  // make into TMatrixD object and write to file
41  TMatrixD tMat(nP,nP);
42  tMat.SetMatrixArray(tFlt);
43  tMat->Write("tMat",TObject::kOverwrite);
44 
45  fMat->Close();
46  exit(0);
47 }
double tFlt[nP *nP]
Definition: makeCovMatrix.C:28
size_t i(0)
double tDat[nP][nP]
Definition: makeCovMatrix.C:21
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
TFile * fMat
Definition: makeCovMatrix.C:18
TMatrixD tMat(nP, nP)
exit(0)