Ejemplo n.º 1
0
REAL F4_out(double GG,REAL*DP,REAL*Q0,REAL*Q1,REAL*Q2)
{
/*
          u                 u     !  u                 u             
        ==>==\           /==>=====!==>==\           /==>==           
          P1 |           |  P3    !  P3 |           |  P1            
             |           |        !     |           |                
          G  |  t     W+ |  D     !  D  |  W+    t  |  G             
        -1---@==>==@-2>--@==<=====!==<==@-->3-@==>==@---1-           
          P2    P6 |  P7    P4    !  P4   -P9 | -P8    P2            
                   |              !           |                      
                   |        b     !  b        |                      
                   \========>=====!==>========/                      
                            P5    !  P5                              
*/
REAL N,D,R;
REAL * V=va_out;
static REAL C[6];REAL S[1];                                                 
     
if(CalcConst) C4(C);
S[0]=GG*GG;
N=-C[0]*S[0];
D=+C[1];
R=+DP[0]*(DP[0]*(DP[3]*(C[3]*(DP[3]-DP[0]+DP[4])+C[5])-C[2]*DP[4])+DP[4]*(
 C[2]*(DP[3]+DP[4])+C[4]));
R*=(N/D)*Q2[1]*Q2[2];
 if(cb_coeff_out)
 {
  cb_coeff_out[1] += (R*9)/(8);
 }
 return R;
}
Ejemplo n.º 2
0
// convolve one column of I by a [1 p 1] filter (uses SSE)
void convTri1Y( float *I, float *O, int h, float p, int s ) {
  #define C4(m,o) ADD(ADD(LDu(I[m*j-1+o]),MUL(p,LDu(I[m*j+o]))),LDu(I[m*j+1+o]))
  int j=0, k=((~((size_t) O) + 1) & 15)/4, h2=(h-1)/2;
  if( s==2 ) {
    for( ; j<k; j++ ) O[j]=I[2*j]+p*I[2*j+1]+I[2*j+2];
    for( ; j<h2-4; j+=4 ) STR(O[j],_mm_shuffle_ps(C4(2,1),C4(2,5),136));
    for( ; j<h2; j++ ) O[j]=I[2*j]+p*I[2*j+1]+I[2*j+2];
    if( h%2==0 ) O[j]=I[2*j]+(1+p)*I[2*j+1];
  } else {
    O[j]=(1+p)*I[j]+I[j+1]; j++; if(k==0) k=(h<=4) ? h-1 : 4;
    for( ; j<k; j++ ) O[j]=I[j-1]+p*I[j]+I[j+1];
    for( ; j<h-4; j+=4 ) STR(O[j],C4(1,0));
    for( ; j<h-1; j++ ) O[j]=I[j-1]+p*I[j]+I[j+1];
    O[j]=I[j-1]+(1+p)*I[j];
  }
  #undef C4
}
Ejemplo n.º 3
0
// convolve one column of I by a [1; 1] filter (uses SSE)
void conv11Y( float *I, float *O, int h, int side, int s ) {
  #define C4(m,o) ADD(LDu(I[m*j-1+o]),LDu(I[m*j+o]))
  int j=0, k=((~((size_t) O) + 1) & 15)/4;
  const int d = (side % 4 >= 2) ? 1 : 0, h2=(h-d)/2;
  if( s==2 ) {
    for( ; j<k; j++ ) O[j]=I[2*j+d]+I[2*j+d+1];
    for( ; j<h2-4; j+=4 ) STR(O[j],_mm_shuffle_ps(C4(2,d+1),C4(2,d+5),136));
    for( ; j<h2; j++ ) O[j]=I[2*j+d]+I[2*j+d+1];
    if(d==1 && h%2==0) O[j]=2*I[2*j+d];
  } else {
    if(d==0) { O[0]=2*I[0]; j++; if(k==0) k=4; }
    for( ; j<k; j++ ) O[j]=I[j-1+d]+I[j+d];
    for( ; j<h-4-d; j+=4 ) STR(O[j],C4(1,d) );
    for( ; j<h-d; j++ ) O[j]=I[j-1+d]+I[j+d];
    if(d==1) { O[j]=2*I[j]; j++; }
  }
  #undef C4
}
Ejemplo n.º 4
0
double SpinAdapted::StackCreCreCreCre::redMatrixElement(Csf c1, vector<Csf>& ladder, const StackSpinBlock* b)
{
  assert( build_pattern == "(((CC)(C))(C))" );
  double element = 0.0;
  int I = get_orbs()[0]; 
  int J = get_orbs()[1];
  int K = get_orbs()[2];
  int L = get_orbs()[3];
  int Slaterlength = c1.det_rep.begin()->first.size();
  vector<bool> backupSlater1(Slaterlength,0), backupSlater2(Slaterlength,0);

  // Must take into account how the 4-index is built from a combination of the 2-index ops
  std::vector<SpinQuantum> quantum_ladder = get_quantum_ladder().at("(((CC)(C))(C))");
  assert( quantum_ladder.size() == 3 );

  SpinQuantum deltaQuantum12 = quantum_ladder.at(0);
  SpinQuantum deltaQuantum123 = quantum_ladder.at(1);
  SpinQuantum deltaQuantum1234 = quantum_ladder.at(2);
  deltaQuantum[0] = deltaQuantum1234;

  // Spin quantum data for CC
  IrrepSpace sym12 = deltaQuantum12.get_symm();
  int irrep12 = deltaQuantum12.get_symm().getirrep();
  int spin12 = deltaQuantum12.get_s().getirrep();
  // Spin quantum data for (CC)C
  IrrepSpace sym123 = deltaQuantum123.get_symm();
  int irrep123 = deltaQuantum123.get_symm().getirrep();
  int spin123= deltaQuantum123.get_s().getirrep();
  // Spin quantum data for total operator
  IrrepSpace sym1234 = deltaQuantum1234.get_symm();
  int irrep1234 = deltaQuantum1234.get_symm().getirrep();
  int spin1234 = deltaQuantum1234.get_s().getirrep();

  TensorOp C1(I, 1); 
  TensorOp C2(J, 1); 
  TensorOp C3(K, 1); 
  TensorOp C4(L, 1); 

  TensorOp CC = C1.product(C2, spin12, irrep12);
  TensorOp CCC = CC.product(C3, spin123, irrep123);
  TensorOp CCCC = CCC.product(C4, spin1234, irrep1234);

  for (int i=0; i<ladder.size(); i++)
  {
    int index = 0; double cleb=0.0;
    if (nonZeroTensorComponent(c1, deltaQuantum[0], ladder[i], index, cleb)) {
      std::vector<double> MatElements = calcMatrixElements(c1, CCCC, ladder[i], backupSlater1, backupSlater2) ;
      element = MatElements[index]/cleb;
      break;
    }
    else
      continue;
  }
  return element;
}
Ejemplo n.º 5
0
double SpinAdapted::CreDesDesCre::redMatrixElement(Csf c1, vector<Csf>& ladder, const SpinBlock* b)
{
  assert( build_pattern == "(((CD)(D))(C))" );
  double element = 0.0;
  int I = get_orbs()[0]; 
  int J = get_orbs()[1];
  int K = get_orbs()[2];
  int L = get_orbs()[3];

  // Must take into account how the 4-index is built from a combination of the 2-index ops
  std::vector<SpinQuantum> quantum_ladder = get_quantum_ladder().at("(((CD)(D))(C))");
  assert( quantum_ladder.size() == 3 );

  SpinQuantum deltaQuantum12 = quantum_ladder.at(0);
  SpinQuantum deltaQuantum123 = quantum_ladder.at(1);
  SpinQuantum deltaQuantum1234 = quantum_ladder.at(2);
  deltaQuantum[0] = deltaQuantum1234;

  // Spin quantum data for CD
  IrrepSpace sym12 = deltaQuantum12.get_symm();
  int irrep12 = deltaQuantum12.get_symm().getirrep();
  int spin12 = deltaQuantum12.get_s().getirrep();
  // Spin quantum data for (CD)D
  IrrepSpace sym123 = deltaQuantum123.get_symm();
  int irrep123 = deltaQuantum123.get_symm().getirrep();
  int spin123= deltaQuantum123.get_s().getirrep();
  // Spin quantum data for total operator
  IrrepSpace sym1234 = deltaQuantum1234.get_symm();
  int irrep1234 = deltaQuantum1234.get_symm().getirrep();
  int spin1234 = deltaQuantum1234.get_s().getirrep();

  TensorOp C1(I, 1); 
  TensorOp D2(J,-1); 
  TensorOp D3(K,-1); 
  TensorOp C4(L, 1); 

  TensorOp CD = C1.product(D2, spin12, irrep12);
  TensorOp CDD = CD.product(D3, spin123, irrep123);
  TensorOp CDDC = CDD.product(C4, spin1234, irrep1234);

  for (int i=0; i<ladder.size(); i++)
  {
    int index = 0; double cleb=0.0;
    if (nonZeroTensorComponent(c1, deltaQuantum[0], ladder[i], index, cleb)) {
      std::vector<double> MatElements = calcMatrixElements(c1, CDDC, ladder[i]) ;
      element = MatElements[index]/cleb;
      break;
    }
    else
      continue;
  }
  return element;
}
Ejemplo n.º 6
0
void whirlpool_block(WHIRLPOOL_CTX *ctx,const void *inp,size_t n)
	{
	int	r;
	const u8 *p=inp;
	union	{ u64 q[8]; u8 c[64]; } S,K,*H=(void *)ctx->H.q;

#ifdef GO_FOR_MMX
	GO_FOR_MMX(ctx,inp,n);
#endif
							do {
#ifdef OPENSSL_SMALL_FOOTPRINT
	u64	L[8];
	int	i;

	for (i=0;i<64;i++)	S.c[i] = (K.c[i] = H->c[i]) ^ p[i];
	for (r=0;r<ROUNDS;r++)
		{
		for (i=0;i<8;i++)
			{
			L[i]  = i ? 0 : RC[r];
			L[i] ^=	C0(K,i)       ^ C1(K,(i-1)&7) ^
				C2(K,(i-2)&7) ^ C3(K,(i-3)&7) ^
				C4(K,(i-4)&7) ^ C5(K,(i-5)&7) ^
				C6(K,(i-6)&7) ^ C7(K,(i-7)&7);
			}
		memcpy (K.q,L,64);
		for (i=0;i<8;i++)
			{
			L[i] ^= C0(S,i)       ^ C1(S,(i-1)&7) ^
				C2(S,(i-2)&7) ^ C3(S,(i-3)&7) ^
				C4(S,(i-4)&7) ^ C5(S,(i-5)&7) ^
				C6(S,(i-6)&7) ^ C7(S,(i-7)&7);
			}
		memcpy (S.q,L,64);
		}
	for (i=0;i<64;i++)	H->c[i] ^= S.c[i] ^ p[i];
#else
	u64	L0,L1,L2,L3,L4,L5,L6,L7;

#ifdef __STRICT_ALIGNMENT
	if ((size_t)p & 7)
		{
		memcpy (S.c,p,64);
		S.q[0] ^= (K.q[0] = H->q[0]);
		S.q[1] ^= (K.q[1] = H->q[1]);
		S.q[2] ^= (K.q[2] = H->q[2]);
		S.q[3] ^= (K.q[3] = H->q[3]);
		S.q[4] ^= (K.q[4] = H->q[4]);
		S.q[5] ^= (K.q[5] = H->q[5]);
		S.q[6] ^= (K.q[6] = H->q[6]);
		S.q[7] ^= (K.q[7] = H->q[7]);
		}
	else
#endif
		{
		const u64 *pa = (const u64*)p;
		S.q[0] = (K.q[0] = H->q[0]) ^ pa[0];
		S.q[1] = (K.q[1] = H->q[1]) ^ pa[1];
		S.q[2] = (K.q[2] = H->q[2]) ^ pa[2];
		S.q[3] = (K.q[3] = H->q[3]) ^ pa[3];
		S.q[4] = (K.q[4] = H->q[4]) ^ pa[4];
		S.q[5] = (K.q[5] = H->q[5]) ^ pa[5];
		S.q[6] = (K.q[6] = H->q[6]) ^ pa[6];
		S.q[7] = (K.q[7] = H->q[7]) ^ pa[7];
		}

	for(r=0;r<ROUNDS;r++)
		{
#ifdef SMALL_REGISTER_BANK
		L0 =	C0(K,0) ^ C1(K,7) ^ C2(K,6) ^ C3(K,5) ^
			C4(K,4) ^ C5(K,3) ^ C6(K,2) ^ C7(K,1) ^ RC[r];
		L1 =	C0(K,1) ^ C1(K,0) ^ C2(K,7) ^ C3(K,6) ^
			C4(K,5) ^ C5(K,4) ^ C6(K,3) ^ C7(K,2);
		L2 =	C0(K,2) ^ C1(K,1) ^ C2(K,0) ^ C3(K,7) ^
			C4(K,6) ^ C5(K,5) ^ C6(K,4) ^ C7(K,3);
		L3 =	C0(K,3) ^ C1(K,2) ^ C2(K,1) ^ C3(K,0) ^
			C4(K,7) ^ C5(K,6) ^ C6(K,5) ^ C7(K,4);
		L4 =	C0(K,4) ^ C1(K,3) ^ C2(K,2) ^ C3(K,1) ^
			C4(K,0) ^ C5(K,7) ^ C6(K,6) ^ C7(K,5);
		L5 =	C0(K,5) ^ C1(K,4) ^ C2(K,3) ^ C3(K,2) ^
			C4(K,1) ^ C5(K,0) ^ C6(K,7) ^ C7(K,6);
		L6 =	C0(K,6) ^ C1(K,5) ^ C2(K,4) ^ C3(K,3) ^
			C4(K,2) ^ C5(K,1) ^ C6(K,0) ^ C7(K,7);
		L7 =	C0(K,7) ^ C1(K,6) ^ C2(K,5) ^ C3(K,4) ^
			C4(K,3) ^ C5(K,2) ^ C6(K,1) ^ C7(K,0);

		K.q[0] = L0; K.q[1] = L1; K.q[2] = L2; K.q[3] = L3;
		K.q[4] = L4; K.q[5] = L5; K.q[6] = L6; K.q[7] = L7;

		L0 ^=	C0(S,0) ^ C1(S,7) ^ C2(S,6) ^ C3(S,5) ^
			C4(S,4) ^ C5(S,3) ^ C6(S,2) ^ C7(S,1);
		L1 ^=	C0(S,1) ^ C1(S,0) ^ C2(S,7) ^ C3(S,6) ^
			C4(S,5) ^ C5(S,4) ^ C6(S,3) ^ C7(S,2);
		L2 ^=	C0(S,2) ^ C1(S,1) ^ C2(S,0) ^ C3(S,7) ^
			C4(S,6) ^ C5(S,5) ^ C6(S,4) ^ C7(S,3);
		L3 ^=	C0(S,3) ^ C1(S,2) ^ C2(S,1) ^ C3(S,0) ^
			C4(S,7) ^ C5(S,6) ^ C6(S,5) ^ C7(S,4);
		L4 ^=	C0(S,4) ^ C1(S,3) ^ C2(S,2) ^ C3(S,1) ^
			C4(S,0) ^ C5(S,7) ^ C6(S,6) ^ C7(S,5);
		L5 ^=	C0(S,5) ^ C1(S,4) ^ C2(S,3) ^ C3(S,2) ^
			C4(S,1) ^ C5(S,0) ^ C6(S,7) ^ C7(S,6);
		L6 ^=	C0(S,6) ^ C1(S,5) ^ C2(S,4) ^ C3(S,3) ^
			C4(S,2) ^ C5(S,1) ^ C6(S,0) ^ C7(S,7);
		L7 ^=	C0(S,7) ^ C1(S,6) ^ C2(S,5) ^ C3(S,4) ^
			C4(S,3) ^ C5(S,2) ^ C6(S,1) ^ C7(S,0);

		S.q[0] = L0; S.q[1] = L1; S.q[2] = L2; S.q[3] = L3;
		S.q[4] = L4; S.q[5] = L5; S.q[6] = L6; S.q[7] = L7;
#else
		L0  = C0(K,0); L1  = C1(K,0); L2  = C2(K,0); L3  = C3(K,0);
		L4  = C4(K,0); L5  = C5(K,0); L6  = C6(K,0); L7  = C7(K,0);
		L0 ^= RC[r];

		L1 ^= C0(K,1); L2 ^= C1(K,1); L3 ^= C2(K,1); L4 ^= C3(K,1);
		L5 ^= C4(K,1); L6 ^= C5(K,1); L7 ^= C6(K,1); L0 ^= C7(K,1);

		L2 ^= C0(K,2); L3 ^= C1(K,2); L4 ^= C2(K,2); L5 ^= C3(K,2);
		L6 ^= C4(K,2); L7 ^= C5(K,2); L0 ^= C6(K,2); L1 ^= C7(K,2);

		L3 ^= C0(K,3); L4 ^= C1(K,3); L5 ^= C2(K,3); L6 ^= C3(K,3);
		L7 ^= C4(K,3); L0 ^= C5(K,3); L1 ^= C6(K,3); L2 ^= C7(K,3);

		L4 ^= C0(K,4); L5 ^= C1(K,4); L6 ^= C2(K,4); L7 ^= C3(K,4);
		L0 ^= C4(K,4); L1 ^= C5(K,4); L2 ^= C6(K,4); L3 ^= C7(K,4);

		L5 ^= C0(K,5); L6 ^= C1(K,5); L7 ^= C2(K,5); L0 ^= C3(K,5);
		L1 ^= C4(K,5); L2 ^= C5(K,5); L3 ^= C6(K,5); L4 ^= C7(K,5);

		L6 ^= C0(K,6); L7 ^= C1(K,6); L0 ^= C2(K,6); L1 ^= C3(K,6);
		L2 ^= C4(K,6); L3 ^= C5(K,6); L4 ^= C6(K,6); L5 ^= C7(K,6);

		L7 ^= C0(K,7); L0 ^= C1(K,7); L1 ^= C2(K,7); L2 ^= C3(K,7);
		L3 ^= C4(K,7); L4 ^= C5(K,7); L5 ^= C6(K,7); L6 ^= C7(K,7);

		K.q[0] = L0; K.q[1] = L1; K.q[2] = L2; K.q[3] = L3;
		K.q[4] = L4; K.q[5] = L5; K.q[6] = L6; K.q[7] = L7;

		L0 ^= C0(S,0); L1 ^= C1(S,0); L2 ^= C2(S,0); L3 ^= C3(S,0);
		L4 ^= C4(S,0); L5 ^= C5(S,0); L6 ^= C6(S,0); L7 ^= C7(S,0);

		L1 ^= C0(S,1); L2 ^= C1(S,1); L3 ^= C2(S,1); L4 ^= C3(S,1);
		L5 ^= C4(S,1); L6 ^= C5(S,1); L7 ^= C6(S,1); L0 ^= C7(S,1);

		L2 ^= C0(S,2); L3 ^= C1(S,2); L4 ^= C2(S,2); L5 ^= C3(S,2);
		L6 ^= C4(S,2); L7 ^= C5(S,2); L0 ^= C6(S,2); L1 ^= C7(S,2);

		L3 ^= C0(S,3); L4 ^= C1(S,3); L5 ^= C2(S,3); L6 ^= C3(S,3);
		L7 ^= C4(S,3); L0 ^= C5(S,3); L1 ^= C6(S,3); L2 ^= C7(S,3);

		L4 ^= C0(S,4); L5 ^= C1(S,4); L6 ^= C2(S,4); L7 ^= C3(S,4);
		L0 ^= C4(S,4); L1 ^= C5(S,4); L2 ^= C6(S,4); L3 ^= C7(S,4);

		L5 ^= C0(S,5); L6 ^= C1(S,5); L7 ^= C2(S,5); L0 ^= C3(S,5);
		L1 ^= C4(S,5); L2 ^= C5(S,5); L3 ^= C6(S,5); L4 ^= C7(S,5);

		L6 ^= C0(S,6); L7 ^= C1(S,6); L0 ^= C2(S,6); L1 ^= C3(S,6);
		L2 ^= C4(S,6); L3 ^= C5(S,6); L4 ^= C6(S,6); L5 ^= C7(S,6);

		L7 ^= C0(S,7); L0 ^= C1(S,7); L1 ^= C2(S,7); L2 ^= C3(S,7);
		L3 ^= C4(S,7); L4 ^= C5(S,7); L5 ^= C6(S,7); L6 ^= C7(S,7);

		S.q[0] = L0; S.q[1] = L1; S.q[2] = L2; S.q[3] = L3;
		S.q[4] = L4; S.q[5] = L5; S.q[6] = L6; S.q[7] = L7;
#endif
		}

#ifdef __STRICT_ALIGNMENT
	if ((size_t)p & 7)
		{
		int i;
		for(i=0;i<64;i++)	H->c[i] ^= S.c[i] ^ p[i];
		}
	else
#endif
		{
		const u64 *pa=(const u64 *)p;
		H->q[0] ^= S.q[0] ^ pa[0];
		H->q[1] ^= S.q[1] ^ pa[1];
		H->q[2] ^= S.q[2] ^ pa[2];
		H->q[3] ^= S.q[3] ^ pa[3];
		H->q[4] ^= S.q[4] ^ pa[4];
		H->q[5] ^= S.q[5] ^ pa[5];
		H->q[6] ^= S.q[6] ^ pa[6];
		H->q[7] ^= S.q[7] ^ pa[7];
		}
#endif
							p += 64;
							} while(--n);
	}
Ejemplo n.º 7
0
#define C8(b,w) \
    (SelMask(b,0,w) | \
     SelMask(b,1,w) | \
     SelMask(b,2,w) | \
     SelMask(b,3,w) | \
     SelMask(b,4,w) | \
     SelMask(b,5,w) | \
     SelMask(b,6,w) | \
     SelMask(b,7,w))

#if FB_UNIT == 16
#define fbStipple16Bits 0
#define fbStipple8Bits 0
static const pixman_bits_t fbStipple4Bits[16] = {
    C4(  0,4), C4(  1,4), C4(  2,4), C4(  3,4), C4(  4,4), C4(  5,4),
    C4(  6,4), C4(  7,4), C4(  8,4), C4(  9,4), C4( 10,4), C4( 11,4),
    C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),};
static const pixman_bits_t fbStipple2Bits[4] = {
    C2(  0,8), C2(  1,8), C2(  2,8), C2(  3,8),
};
static const pixman_bits_t fbStipple1Bits[2] = {
    C1(  0,16), C1(  1,16),
};
#endif
#if FB_UNIT == 32
#define fbStipple16Bits 0
static const pixman_bits_t fbStipple8Bits[256] = {
    C8(  0,4), C8(  1,4), C8(  2,4), C8(  3,4), C8(  4,4), C8(  5,4),
    C8(  6,4), C8(  7,4), C8(  8,4), C8(  9,4), C8( 10,4), C8( 11,4),
    C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4),
Ejemplo n.º 8
0
Molecule C6H6()
{
    int nAtoms = 12;

    // These are in Angstrom
    Eigen::Vector3d C1(5.274,  1.999, -8.568);
    Eigen::Vector3d C2(6.627,  2.018, -8.209);
    Eigen::Vector3d C3(7.366,  0.829, -8.202);
    Eigen::Vector3d C4(6.752, -0.379, -8.554);
    Eigen::Vector3d C5(5.399, -0.398, -8.912);
    Eigen::Vector3d C6(4.660,  0.791, -8.919);
    Eigen::Vector3d H1(4.704,  2.916, -8.573);
    Eigen::Vector3d H2(7.101,  2.950, -7.938);
    Eigen::Vector3d H3(8.410,  0.844, -7.926);
    Eigen::Vector3d H4(7.322, -1.296, -8.548);
    Eigen::Vector3d H5(4.925, -1.330, -9.183);
    Eigen::Vector3d H6(3.616,  0.776, -9.196);
    // Scale
    C1 /= convertBohrToAngstrom;
    C2 /= convertBohrToAngstrom;
    C3 /= convertBohrToAngstrom;
    C4 /= convertBohrToAngstrom;
    C5 /= convertBohrToAngstrom;
    C6 /= convertBohrToAngstrom;
    H1 /= convertBohrToAngstrom;
    H2 /= convertBohrToAngstrom;
    H3 /= convertBohrToAngstrom;
    H4 /= convertBohrToAngstrom;
    H5 /= convertBohrToAngstrom;
    H6 /= convertBohrToAngstrom;

    Eigen::MatrixXd geom(3, nAtoms);
    geom.col(0) = C1.transpose();
    geom.col(1) = C2.transpose();
    geom.col(2) = C3.transpose();
    geom.col(3) = C4.transpose();
    geom.col(4) = C5.transpose();
    geom.col(5) = C6.transpose();
    geom.col(6) = H1.transpose();
    geom.col(7) = H2.transpose();
    geom.col(8) = H3.transpose();
    geom.col(9) = H4.transpose();
    geom.col(10) = H5.transpose();
    geom.col(11) = H6.transpose();
    Eigen::VectorXd charges(12), masses(12);
    charges << 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0;
    masses  << 12.00, 12.0, 12.0, 12.0, 12.0, 12.0, 1.0078250, 1.0078250, 1.0078250,
            1.0078250, 1.0078250, 1.0078250;

    double radiusC = 1.70 / convertBohrToAngstrom;
    double radiusH = 1.20 / convertBohrToAngstrom;
    std::vector<Atom> atoms;
    atoms.push_back( Atom("Carbon",   "C",  charges(0), masses(0), radiusC, C1, 1.0) );
    atoms.push_back( Atom("Carbon",   "C",  charges(1), masses(1), radiusC, C2, 1.0) );
    atoms.push_back( Atom("Carbon",   "C",  charges(2), masses(2), radiusC, C3, 1.0) );
    atoms.push_back( Atom("Carbon",   "C",  charges(3), masses(3), radiusC, C4, 1.0) );
    atoms.push_back( Atom("Carbon",   "C",  charges(4), masses(4), radiusC, C5, 1.0) );
    atoms.push_back( Atom("Carbon",   "C",  charges(5), masses(5), radiusC, C6, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H",  charges(6), masses(6), radiusH, H1, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H",  charges(7), masses(7), radiusH, H2, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H",  charges(8), masses(8), radiusH, H3, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H",  charges(9), masses(9), radiusH, H4, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H", charges(10), masses(10), radiusH, H5, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H", charges(11), masses(11), radiusH, H6, 1.0) );

    std::vector<Sphere> spheres;
    Sphere sph1(C1, radiusC);
    Sphere sph2(C2, radiusC);
    Sphere sph3(C3, radiusC);
    Sphere sph4(C4, radiusC);
    Sphere sph5(C5, radiusC);
    Sphere sph6(C6, radiusC);

    Sphere sph7(H1, radiusH);
    Sphere sph8(H2, radiusH);
    Sphere sph9(H3, radiusH);
    Sphere sph10(H4, radiusH);
    Sphere sph11(H5, radiusH);
    Sphere sph12(H6, radiusH);

    spheres.push_back(sph1);
    spheres.push_back(sph2);
    spheres.push_back(sph3);
    spheres.push_back(sph4);
    spheres.push_back(sph5);
    spheres.push_back(sph6);
    spheres.push_back(sph7);
    spheres.push_back(sph8);
    spheres.push_back(sph9);
    spheres.push_back(sph10);
    spheres.push_back(sph11);
    spheres.push_back(sph12);

    // D2h as generated by Oxy, Oxz, Oyz
    Symmetry pGroup = buildGroup(0, 0, 0, 0);

    return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup);
};
Ejemplo n.º 9
0
 int main(void){
 Marray<double,4> A4(3,3,3,3);
 Marray<double,4> B4(3,3,3,3);
 Marray<double,4> C4Test(3,3,3,3);
 Marray<double,4> C4(3,3,3,3);
 A4.sucesion(0,1);
 B4.sucesion(0,1);
 Index<'i'> iG;
 Index<'j'> jG;
 Index<'k'> kG;
 Index<'l'> lG;
 Index<'m'> mG;
 Index<'n'> nG;
 for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(k,l,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(kG,lG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(k,m,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(kG,mG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(k,m,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(kG,mG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(l,m,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(lG,mG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(l,m,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(lG,mG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(m,k,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(mG,kG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(m,k,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(mG,kG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(m,l,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(mG,lG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(m,l,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(mG,lG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(m,n,k,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(mG,nG,kG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,k,l)*B4(m,n,l,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,kG,lG)*B4(mG,nG,lG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,j,l,k)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,jG,lG,kG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(k,l,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(kG,lG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(k,m,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(kG,mG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(k,m,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(kG,mG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(l,m,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(lG,mG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(l,m,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(lG,mG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(m,k,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(mG,kG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(m,k,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(mG,kG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(m,l,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(mG,lG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(m,l,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(mG,lG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(m,n,k,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(mG,nG,kG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,j,l)*B4(m,n,l,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,jG,lG)*B4(mG,nG,lG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(k,l,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(kG,lG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(k,m,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(kG,mG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(k,m,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(kG,mG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(l,m,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(lG,mG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(l,m,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(lG,mG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(m,k,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(mG,kG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(m,k,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(mG,kG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(m,l,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(mG,lG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(m,l,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(mG,lG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(m,n,k,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(mG,nG,kG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(i,k,l,j)*B4(m,n,l,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(iG,kG,lG,jG)*B4(mG,nG,lG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(k,l,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(kG,lG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(k,m,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(kG,mG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(k,m,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(kG,mG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(l,m,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(lG,mG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(l,m,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(lG,mG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(m,k,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(mG,kG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(m,k,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(mG,kG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(m,l,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(mG,lG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(m,l,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(mG,lG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(m,n,k,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(mG,nG,kG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,j,l)*B4(m,n,l,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,jG,lG)*B4(mG,nG,lG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(k,l,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(kG,lG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(k,m,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(kG,mG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(k,m,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(kG,mG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(l,m,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(lG,mG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(l,m,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(lG,mG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(m,k,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(mG,kG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(m,k,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(mG,kG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(m,l,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(mG,lG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(m,l,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(mG,lG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(m,n,k,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(mG,nG,kG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,i,l,j)*B4(m,n,l,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,iG,lG,jG)*B4(mG,nG,lG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(k,l,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(kG,lG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(k,m,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(kG,mG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(k,m,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(kG,mG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(l,k,m,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(lG,kG,mG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(l,m,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(lG,mG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(l,m,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(lG,mG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(m,k,l,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(mG,kG,lG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(m,k,n,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(mG,kG,nG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(m,l,k,n);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(mG,lG,kG,nG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(m,l,n,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(mG,lG,nG,kG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(m,n,k,l);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(mG,nG,kG,lG);
assert(C4==C4Test);


C4=0;


for (int i=0;i<3;i++) {
     for (int j=0;j<3;j++){
         for (int l=0;l<3;l++){
            for (int m=0;m<3;m++){
                for (int n=0;n<3;n++){
                    for(int k=0;k<3;k++){
                 C4(i,j,m,n)+=A4(k,l,i,j)*B4(m,n,l,k);
           }
        }
     }
     }
        }
}

C4Test(iG,jG,mG,nG)=A4(kG,lG,iG,jG)*B4(mG,nG,lG,kG);
assert(C4==C4Test);


C4=0;


}
Ejemplo n.º 10
0
#define F1(c, p, n, r, g, b, a, t, s, u)         \
   C4(c, p, n, r, ZERO, ZERO, ONE_FLOAT, t, s, u)
#define I1(c, p, n, r, g, b, a, t, s, u)         \
   C4(c, p, n, r, ZERO, ZERO, ONE_INT, t, s, u)

#define A1(c, p, n, r, g, b, a, t, s, u)         \
   C4(c, p, n, ZERO, ZERO, ZERO, a, t, s, u)

#if NOUVEAU_DRIVER == 0xc0
const struct nvc0_format nvc0_format_table[PIPE_FORMAT_COUNT] =
#else
const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
#endif
{
   C4(A, B8G8R8A8_UNORM, BGRA8_UNORM, B, G, R, A, UNORM, A8B8G8R8, ID),
   F3(A, B8G8R8X8_UNORM, BGRX8_UNORM, B, G, R, xx, UNORM, A8B8G8R8, TD),
   C4(A, B8G8R8A8_SRGB, BGRA8_SRGB, B, G, R, A, UNORM, A8B8G8R8, TD),
   F3(A, B8G8R8X8_SRGB, BGRX8_SRGB, B, G, R, xx, UNORM, A8B8G8R8, TD),
   C4(A, R8G8B8A8_UNORM, RGBA8_UNORM, R, G, B, A, UNORM, A8B8G8R8, IB),
   F3(A, R8G8B8X8_UNORM, RGBX8_UNORM, R, G, B, xx, UNORM, A8B8G8R8, TB),
   C4(A, R8G8B8A8_SRGB, RGBA8_SRGB, R, G, B, A, UNORM, A8B8G8R8, TB),
   F3(A, R8G8B8X8_SRGB, RGBX8_SRGB, R, G, B, xx, UNORM, A8B8G8R8, TB),

   ZX(B, Z16_UNORM, Z16_UNORM, R, R, R, xx, UNORM, Z16, TZ),
   ZX(A, Z32_FLOAT, Z32_FLOAT, R, R, R, xx, FLOAT, ZF32, TZ),
   ZX(A, Z24X8_UNORM, Z24_X8_UNORM, R, R, R, xx, UNORM, X8Z24, TZ),
   SZ(A, X8Z24_UNORM, S8_Z24_UNORM, G, G, G, xx, UNORM, Z24S8, TZ),
   ZS(A, Z24_UNORM_S8_UINT, Z24_S8_UNORM, R, R, R, xx, UNORM, S8Z24, TZ),
   SZ(A, S8_UINT_Z24_UNORM, S8_Z24_UNORM, G, G, G, xx, UNORM, Z24S8, TZ),
   ZS(A, Z32_FLOAT_S8X24_UINT, Z32_S8_X24_FLOAT, R, R, R, xx, FLOAT, ZF32_X24S8, TZ),
Ejemplo n.º 11
0
int multiple_detector_fit()
{

  std::cout << "Beginning : ... " << std::endl;

  Int_t npoints = 1000;
  Double_t emin = 0.2; 
  Double_t emax = 3.0;

  bool use100m = true;
  bool use470m = true;
  bool use600m = true;


  std::vector<int> baselines;
  std::vector<double> scales;
  std::vector<std::string> names;
  std::vector<double> volume;

  if (use100m) baselines.push_back(100);
  if (use470m) baselines.push_back(470);
  if (use600m) baselines.push_back(600);


  double NULLVec[2][20];
  double OscVec[2][1001][7][20];

  for(int i = 0; i < 20; i++){
    NULLVec[0][i] = 0;
    NULLVec[1][i] = 0;

  }

  for(int u = 0; u < 1000; u++){
    for(int s = 0; s < 7; s++){
      for(int i = 0; i < 20; i++){

	OscVec[0][u][s][i] = 0;
        OscVec[1][u][s][i] = 0;

      }
    }
  }


  int nbinsE = 0;


  if (use100m){

    std::string temp_name = /*"../MatrixFiles/combined_ntuple_100m_nu_processed_numu.root";*/"../MatrixFiles/combined_ntuple_100m_nu_processed_CoreyBins_numu.root";

    TFile temp_file(temp_name.c_str());
    TH1D *NULL_100;
    NULL_100 = (TH1D*)(temp_file.Get("NumuCC"));
    nbinsE = NULL_100->GetNbinsX();
    std::cout << nbinsE << std::endl;
      for(int i = 1; i <= nbinsE; i++){
	  NULLVec[0][i-1] = (NULL_100->GetBinContent(i));
      }

    for(int u = 0; u < npoints; u++){
      for(int s = 0; s < 7; s++){
	TH1D *OSC_100;
	TString upoint = Form("%d",u);
	TString name = "Universe_";
	TString name2 = "_MultiSim_";
	TString mul = Form("%d",s);
	
	name += upoint;
	name += name2;
	name += mul;	
       
	OSC_100 = (TH1D*)(temp_file.Get(name));
          for(int i = 1; i <= nbinsE; i++){
              OscVec[0][u][s][i-1] = (OSC_100->GetBinContent(i));
	      //	      if(OscVec[0][u][s][i-1] != OscVec[0][u][s][i-1]) std::cout << "erm" <<std::endl;

	  }

	delete OSC_100;
      }
    }
    
    delete NULL_100;
    temp_file.Close();
  }

  if (use470m){
    std::string temp_name = /*"../MatrixFiles/combined_ntuple_600m_onaxis_nu_processed_numu.root";*/"../MatrixFiles/combined_ntuple_600m_onaxis_nu_processed_CoreyBins_numu.root";

    TFile temp_file(temp_name.c_str());
    TH1D *NULL_470;
    NULL_470 = (TH1D*)(temp_file.Get("NumuCC"));
    nbinsE = NULL_470->GetNbinsX();
    std::cout << nbinsE<< std::endl;
      for(int i = 1; i <= nbinsE; i++){
	  NULLVec[1][i-1] = (NULL_470->GetBinContent(i));
      }

    for(int u = 0; u < npoints; u++){
      for(int s = 0; s < 7; s++){
	TH1D *OSC_470;
	TString upoint = Form("%d",u);//std::to_string(u);
	TString name = "Universe_";
	TString name2 = "_MultiSim_";
	TString mul = Form("%d",s);// = std::to_string(s);
	
	name += upoint;
	name += name2;
	name += mul;	
       
	OSC_470 = (TH1D*)(temp_file.Get(name));
          for(int i = 1; i <= nbinsE; i++){
	    OscVec[1][u][s][i-1] = (OSC_470->GetBinContent(i));
	    if(OscVec[1][u][s][i-1] != OscVec[1][u][s][i-1])  OscVec[1][u][s][i-1] = NULLVec[1][i-1];//std::cout << "erm, u :" << u << " s : " << s << " E : " << i  <<std::endl;

	  }

	delete OSC_470;
      }
    }
    
    delete NULL_470;
    temp_file.Close();
  }

  int nL = 2;
  int mbins = (nbinsE*nL);
 
  TMatrix M6 (mbins,mbins);
  TMatrix M5 (mbins,mbins);
  TMatrix M4 (mbins,mbins);
  TMatrix M3 (mbins,mbins);
  TMatrix M2 (mbins,mbins);
  TMatrix M1 (mbins,mbins);
  TMatrix M0 (mbins,mbins);
  
  TMatrix C6 (mbins,mbins);
  TMatrix C5 (mbins,mbins);
  TMatrix C4 (mbins,mbins);
  TMatrix C3 (mbins,mbins);
  TMatrix C2 (mbins,mbins);
  TMatrix C1 (mbins,mbins);
  TMatrix C0 (mbins,mbins);

  int N = 0;

  TH1D *Fig6 = new TH1D("Fig6",";;",mbins,0,mbins);
  TH1D *Fig5 = new TH1D("Fig5",";;",mbins,0,mbins);
  TH1D *Fig4 = new TH1D("Fig4",";;",mbins,0,mbins);
  TH1D *Fig3 = new TH1D("Fig3",";;",mbins,0,mbins);
  TH1D *Fig2 = new TH1D("Fig2",";;",mbins,0,mbins);
  TH1D *Fig1 = new TH1D("Fig1",";;",mbins,0,mbins);
  TH1D *Fig0 = new TH1D("Fig0",";;",mbins,0,mbins);

  int Erri = 0, Errj = 0;

  std::cout << "Filling Error Matrix..." << std::endl;

  for(int Lrow = 0; Lrow < 2; Lrow++){
    for(int Erow = 0; Erow < nbinsE; Erow++){

      Errj = 0;

      for(int Lcol = 0; Lcol < 2; Lcol++){
        for(int Ecol = 0; Ecol < nbinsE; Ecol++){

          M6 (Erri,Errj) = 0;
          M5 (Erri,Errj) = 0;
          M4 (Erri,Errj) = 0;
          M3 (Erri,Errj) = 0;
          M2 (Erri,Errj) = 0;
          M1 (Erri,Errj) = 0;
          M0 (Erri,Errj) = 0;

	  N = 0;

	  for(int u = 0; u < npoints; u++){

	    M6 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][6][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][6][Ecol]);
            M5 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][5][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][5][Ecol]);
            M4 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][4][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][4][Ecol]);
            M3 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][3][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][3][Ecol]);
            M2 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][2][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][2][Ecol]);
            M1 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][1][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][1][Ecol]);
            M0 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][0][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][0][Ecol]);

	    N++;
	    
	  }

	  M6 (Erri,Errj) /= N;
          M5 (Erri,Errj) /= N;
          M4 (Erri,Errj) /= N;
          M3 (Erri,Errj) /= N;
          M2 (Erri,Errj) /= N;
          M1 (Erri,Errj) /= N;
	  M0 (Erri,Errj) /= N;


	  
	  M6 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M5 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M4 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M3 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M2 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M1 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M0 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
	  
	  if(Erri == Errj) Fig6->SetBinContent(Erri+1, sqrt(M6 (Erri,Errj)));
      if(Erri == Errj) Fig5->SetBinContent(Erri+1, sqrt(M5 (Erri,Errj)));
      if(Erri == Errj) Fig4->SetBinContent(Erri+1, sqrt(M4 (Erri,Errj)));
      if(Erri == Errj) Fig3->SetBinContent(Erri+1, sqrt(M3 (Erri,Errj)));
      if(Erri == Errj) Fig2->SetBinContent(Erri+1, sqrt(M2 (Erri,Errj)));
      if(Erri == Errj) Fig1->SetBinContent(Erri+1, sqrt(M1 (Erri,Errj)));
      if(Erri == Errj) Fig0->SetBinContent(Erri+1, sqrt(M0 (Erri,Errj)));

      std::cout << M6 (Erri,Errj) << "\t";

          Errj++;

	}}

      Erri++;

    }}

  for(int i = 0; i < Erri; i++){
    for(int j = 0; j < Errj; j++){

      C6 (i,j) = M6(i,j) / sqrt(M6 (i,i) * M6 (j,j));
      C5 (i,j) = M5(i,j) / sqrt(M5 (i,i) * M5 (j,j));
      C4 (i,j) = M4(i,j) / sqrt(M4 (i,i) * M4 (j,j));
      C3 (i,j) = M3(i,j) / sqrt(M3 (i,i) * M3 (j,j));
      C2 (i,j) = M2(i,j) / sqrt(M2 (i,i) * M2 (j,j));
      C1 (i,j) = M1(i,j) / sqrt(M1 (i,i) * M1 (j,j));
      C0 (i,j) = M0(i,j) / sqrt(M0 (i,i) * M0 (j,j));

    }
  }
  
  std::cout << "...Error Matrix Filled" << std::endl;


  TCanvas* c6 = new TCanvas("c6","",700,700);
  c6->SetLeftMargin(.1);
  c6->SetBottomMargin(.1);
  c6->SetTopMargin(.075);
  c6->SetRightMargin(.15);
  c6->cd();

  M6.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //  TMatrixFBase->GetZaxis()->SetRangeUser(-0.05,0.4);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("Fractional Error Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);



  TLatex *ND = new TLatex(.15,.01,"LAr1-ND (100m) ");
  ND->SetNDC();
  ND->SetTextFont(62);
  ND->SetTextSize(0.04);
  ND->Draw();

  TLatex *MD = new TLatex(.5,.01,"T600 (600m, on axis)");
  MD->SetNDC();
  MD->SetTextFont(62);
  MD->SetTextSize(0.04);
  MD->Draw();

  TLatex *ND45 = new TLatex(.05,.15,"LAr1-ND (100m) ");
  ND45->SetNDC();
  ND45->SetTextAngle(90);
  ND45->SetTextFont(62);
  ND45->SetTextSize(0.04);
  ND45->Draw();

  TLatex *MD45 = new TLatex(.05,.54,"T600 (600m, on axis)");
  MD45->SetNDC();
  MD45->SetTextAngle(90);
  MD45->SetTextFont(62);
  MD45->SetTextSize(0.04);
  MD45->Draw();

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Flux Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  //  c6->Print("total_matrix.pdf");



  TCanvas* c61 = new TCanvas("c61","",700,700);
  c61->SetLeftMargin(.1);
  c61->SetBottomMargin(.1);
  c61->SetTopMargin(.075);
  c61->SetRightMargin(.15);
  c61->cd();

  C6.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);
  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);


  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Flux Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  //  c61->Print("total_correlation_matrix.pdf");

 

  TCanvas* c5 = new TCanvas("c5","",700,700);
  c5->SetLeftMargin(.1);
  c5->SetBottomMargin(.1);
  c5->SetTopMargin(.075);
  c5->SetRightMargin(.15);
  c5->cd();

  M5.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-0.005,0.045);
  
TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("K^{+} Covariance Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} K#lower[-0.15]{+} Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();




  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();

  //  c5->Print("mult5_matrix.pdf");

  TCanvas* c51 = new TCanvas("c51","",700,700);
  c51->SetLeftMargin(.1);
  c51->SetBottomMargin(.1);
  c51->SetTopMargin(.075);
  c51->SetRightMargin(.15);
  c51->cd();

  C5.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-1,1);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("K#lower[-0.15]{+} Correlation Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} K#lower[-0.15]{+} Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();



  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();

  //  c51->Print("mult5_correlation_matrix.pdf");

  TCanvas* c4 = new TCanvas("c4","",700,700);
  c4->SetLeftMargin(.1);
  c4->SetBottomMargin(.1);
  c4->SetTopMargin(.075);
  c4->SetRightMargin(.15);
  c4->cd();

  M4.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-0.005,0.045);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //TMatrixFBase->GetZaxis()->SetTitle("K#lower[-0.15]{-} Covariance Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} K#lower[-0.15]{-} Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();



  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c4->Print("mult4_matrix.pdf");

  TCanvas* c41 = new TCanvas("c41","",700,700);
  c41->SetLeftMargin(.1);
  c41->SetBottomMargin(.1);
  c41->SetTopMargin(.075);
  c41->SetRightMargin(.15);
  c41->cd();

  C4.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-1,1);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("K#lower[-0.15]{-} Correlation Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} K#lower[-0.15]{-} Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c41->Print("mult4_correlation_matrix.pdf");



  TCanvas* c3 = new TCanvas("c3","",700,700);
  c3->SetLeftMargin(.1);
  c3->SetBottomMargin(.1);
  c3->SetTopMargin(.075);
  c3->SetRightMargin(.15);
  c3->cd();

  M3.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-0.005,0.045);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //TMatrixFBase->GetZaxis()->SetTitle("K#lower[-0.15]{0} Covariance Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} K#lower[-0.15]{0} Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();


  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c3->Print("mult3_matrix.pdf");

  TCanvas* c31 = new TCanvas("c31","",700,700);
  c31->SetLeftMargin(.1);
  c31->SetBottomMargin(.1);
  c31->SetTopMargin(.075);
  c31->SetRightMargin(.15);
  c31->cd();

  C3.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-1,1);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //TMatrixFBase->GetZaxis()->SetTitle("K#lower[-0.15]{0} Correlation Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} K#lower[-0.15]{0} Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();



  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c31->Print("mult3_correlation_matrix.pdf");


  TCanvas* c2 = new TCanvas("c2","",700,700);
  c2->SetLeftMargin(.1);
  c2->SetBottomMargin(.1);
  c2->SetTopMargin(.075);
  c2->SetRightMargin(.15);
  c2->cd();

  M2.Draw("COLZ");
  gStyle->SetPalette(56,0);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-0.005,0.045);
  TMatrixFBase->SetContour(999);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //TMatrixFBase->GetZaxis()->SetTitle("#pi#lower[-0.15]{+} Covariance Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} #pi#lower[-0.15]{+} Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();



  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c2->Print("mult2_matrix.pdf");

  TCanvas* c21 = new TCanvas("c21","",700,700);
  c21->SetLeftMargin(.1);
  c21->SetBottomMargin(.1);
  c21->SetTopMargin(.075);
  c21->SetRightMargin(.15);
  c21->cd();

  C2.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-1,1);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //TMatrixFBase->GetZaxis()->SetTitle("#pi#lower[-0.15]{+} Correlation Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} #pi#lower[-0.15]{+} Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c21->Print("mult2_correlation_matrix.pdf");


  TCanvas* c1 = new TCanvas("c1","",700,700);
  c1->SetLeftMargin(.1);
  c1->SetBottomMargin(.1);
  c1->SetTopMargin(.075);
  c1->SetRightMargin(.15);
  c1->cd();

  M1.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-0.005,0.045);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //TMatrixFBase->GetZaxis()->SetTitle("#pi#lower[-0.15]{-} Covariance Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} #pi#lower[-0.15]{-} Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c1->Print("mult1_matrix.pdf");

  TCanvas* c11 = new TCanvas("c11","",700,700);
  c11->SetLeftMargin(.1);
  c11->SetBottomMargin(.1);
  c11->SetTopMargin(.075);
  c11->SetRightMargin(.15);
  c11->cd();

  C1.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-1,1);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("#pi#lower[-0.15]{-} Correlation Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} #pi#lower[-0.15]{-} Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c11->Print("mult1_correlation_matrix.pdf");


  TCanvas* c0 = new TCanvas("c0","",700,700);
  c0->SetLeftMargin(.1);
  c0->SetBottomMargin(.1);
  c0->SetTopMargin(.075);
  c0->SetRightMargin(.15);
  c0->cd();

  M0.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-0.005,0.045);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("Beam UniSim Covariance Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Beam Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();


  //  c0->Print("mult0_matrix.pdf");

  TCanvas* c01 = new TCanvas("c01","",700,700);
  c01->SetLeftMargin(.1);
  c01->SetBottomMargin(.1);
  c01->SetTopMargin(.075);
  c01->SetRightMargin(.15);
  c01->cd();

  C0.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //TMatrixFBase->GetZaxis()->SetRangeUser(-1,1);

  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("Beam UniSim Correlation Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kYellow);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Beam Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  ND->Draw();
  MD->Draw();
  ND45->Draw();
  MD45->Draw();

  //  c01->Print("mult0_correlation_matrix.pdf");
 
  TCanvas* c86 = new TCanvas("c86","",800,400);
  c86->SetLeftMargin(.1);
  c86->SetBottomMargin(.1);
  c86->SetTopMargin(.05);
  c86->SetRightMargin(.05);
  c86->cd();

  Fig6->GetYaxis()->SetTitle("Fractional Error");
  Fig6->GetYaxis()->SetTitleFont(62);
  Fig6->GetXaxis()->SetTitleFont(62);
  Fig6->GetYaxis()->SetLabelFont(62);
  Fig6->GetXaxis()->SetLabelFont(62);
  Fig6->GetYaxis()->CenterTitle();
  Fig6->GetYaxis()->SetTitleSize(0.06);
  Fig6->GetYaxis()->SetTitleOffset(0.8);
  Fig6->GetXaxis()->SetLabelSize(0.06);
  Fig6->GetYaxis()->SetLabelSize(0.06);
  Fig6->GetXaxis()->SetTitleOffset(1.5);
  Fig6->SetStats(0);
  Fig6->SetMinimum(-0.01);
  Fig6->SetMaximum(0.21);
  Fig6->SetMarkerStyle(8);
  Fig6->GetYaxis()->SetNdivisions(509);
  Fig6->GetXaxis()->SetNdivisions(509);
  Fig6->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);

  TLatex *ND = new TLatex(.23,.85,"LAr1-ND (100m) ");
  ND->SetNDC();
  ND->SetTextFont(62);
  ND->SetTextSize(0.05);
  ND->Draw();

  TLatex *MD = new TLatex(.65,.85,"T600 (600m, on axis)");
  MD->SetNDC();
  MD->SetTextFont(62);
  MD->SetTextSize(0.05);
  MD->Draw();

  //  c86->Print("FractionalErrors_Total.pdf");

  TCanvas* c85 = new TCanvas("c85","",800,400);
  c85->SetLeftMargin(.1);
  c85->SetBottomMargin(.1);
  c85->SetTopMargin(.05);
  c85->SetRightMargin(.05);
  c85->cd();

  Fig5->GetYaxis()->SetTitle("K#lower[-0.2]{+} Fractional Error");
  Fig5->GetYaxis()->SetTitleFont(62);
  Fig5->GetXaxis()->SetTitleFont(62);
  Fig5->GetYaxis()->SetLabelFont(62);
  Fig5->GetXaxis()->SetLabelFont(62);
  Fig5->GetYaxis()->CenterTitle();
  Fig5->GetYaxis()->SetTitleSize(0.06);
  Fig5->GetYaxis()->SetTitleOffset(0.8);
  Fig5->GetXaxis()->SetLabelSize(0.06);
  Fig5->GetYaxis()->SetLabelSize(0.06);
  Fig5->GetXaxis()->SetTitleOffset(1.5);
  Fig5->SetStats(0);
  Fig5->SetMinimum(-0.01);
  Fig5->SetMaximum(0.21);
  Fig5->SetMarkerStyle(8);
  Fig5->GetYaxis()->SetNdivisions(509);
  Fig5->GetXaxis()->SetNdivisions(509);
  Fig5->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);
  ND->Draw();
  MD->Draw();

  //  c85->Print("FractionalErrors_Kplus.pdf");

  
  TCanvas* c84 = new TCanvas("c84","",800,400);
  c84->SetLeftMargin(.1);
  c84->SetBottomMargin(.1);
  c84->SetTopMargin(.05);
  c84->SetRightMargin(.05);
  c84->cd();

  Fig4->GetYaxis()->SetTitle("K#lower[-0.2]{-} Fractional Error");
  Fig4->GetYaxis()->SetTitleFont(62);
  Fig4->GetXaxis()->SetTitleFont(62);
  Fig4->GetYaxis()->SetLabelFont(62);
  Fig4->GetXaxis()->SetLabelFont(62);
  Fig4->GetYaxis()->CenterTitle();
  Fig4->GetYaxis()->SetTitleSize(0.06);
  Fig4->GetYaxis()->SetTitleOffset(0.8);
  Fig4->GetXaxis()->SetLabelSize(0.06);
  Fig4->GetYaxis()->SetLabelSize(0.06);
  Fig4->GetXaxis()->SetTitleOffset(1.5);
  Fig4->SetStats(0);
  Fig4->SetMinimum(-0.01);
  Fig4->SetMaximum(0.21);
  Fig4->SetMarkerStyle(8);
  Fig4->GetYaxis()->SetNdivisions(509);
  Fig4->GetXaxis()->SetNdivisions(509);
  Fig4->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);
  ND->Draw();
  MD->Draw();

  //  c84->Print("FractionalErrors_Kmin.pdf");


  TCanvas* c83 = new TCanvas("c83","",800,400);
  c83->SetLeftMargin(.1);
  c83->SetBottomMargin(.1);
  c83->SetTopMargin(.05);
  c83->SetRightMargin(.05);
  c83->cd();

  Fig3->GetYaxis()->SetTitle("K#lower[-0.2]{0} Fractional Error");
  Fig3->GetYaxis()->SetTitleFont(62);
  Fig3->GetXaxis()->SetTitleFont(62);
  Fig3->GetYaxis()->SetLabelFont(62);
  Fig3->GetXaxis()->SetLabelFont(62);
  Fig3->GetYaxis()->CenterTitle();
  Fig3->GetYaxis()->SetTitleSize(0.06);
  Fig3->GetYaxis()->SetTitleOffset(0.8);
  Fig3->GetXaxis()->SetLabelSize(0.06);
  Fig3->GetYaxis()->SetLabelSize(0.06);
  Fig3->GetXaxis()->SetTitleOffset(1.5);
  Fig3->SetStats(0);
  Fig3->SetMinimum(-0.01);
  Fig3->SetMaximum(0.21);
  Fig3->SetMarkerStyle(8);
  Fig3->GetYaxis()->SetNdivisions(509);
  Fig3->GetXaxis()->SetNdivisions(509);
  Fig3->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);
  ND->Draw();
  MD->Draw();

  //  c83->Print("FractionalErrors_K0.pdf");


  TCanvas* c82 = new TCanvas("c82","",800,400);
  c82->SetLeftMargin(.1);
  c82->SetBottomMargin(.1);
  c82->SetTopMargin(.05);
  c82->SetRightMargin(.05);
  c82->cd();

  Fig2->GetYaxis()->SetTitle("#pi#lower[-0.2]{+} Fractional Error");
  Fig2->GetYaxis()->SetTitleFont(62);
  Fig2->GetXaxis()->SetTitleFont(62);
  Fig2->GetYaxis()->SetLabelFont(62);
  Fig2->GetXaxis()->SetLabelFont(62);
  Fig2->GetYaxis()->CenterTitle();
  Fig2->GetYaxis()->SetTitleSize(0.06);
  Fig2->GetYaxis()->SetTitleOffset(0.8);
  Fig2->GetXaxis()->SetLabelSize(0.06);
  Fig2->GetYaxis()->SetLabelSize(0.06);
  Fig2->GetXaxis()->SetTitleOffset(1.5);
  Fig2->SetStats(0);
  Fig2->SetMinimum(-0.01);
  Fig2->SetMaximum(0.21);
  Fig2->SetMarkerStyle(8);
  Fig2->GetYaxis()->SetNdivisions(509);
  Fig2->GetXaxis()->SetNdivisions(509);
  Fig2->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);
  ND->Draw();
  MD->Draw();

  //  c82->Print("FractionalErrors_piplus.pdf");


  TCanvas* c81 = new TCanvas("c81","",800,400);
  c81->SetLeftMargin(.1);
  c81->SetBottomMargin(.1);
  c81->SetTopMargin(.05);
  c81->SetRightMargin(.05);
  c81->cd();

  Fig1->GetYaxis()->SetTitle("#pi#lower[-0.2]{-} Fractional Error");
  Fig1->GetYaxis()->SetTitleFont(62);
  Fig1->GetXaxis()->SetTitleFont(62);
  Fig1->GetYaxis()->SetLabelFont(62);
  Fig1->GetXaxis()->SetLabelFont(62);
  Fig1->GetYaxis()->CenterTitle();
  Fig1->GetYaxis()->SetTitleSize(0.06);
  Fig1->GetYaxis()->SetTitleOffset(0.8);
  Fig1->GetXaxis()->SetLabelSize(0.06);
  Fig1->GetYaxis()->SetLabelSize(0.06);
  Fig1->GetXaxis()->SetTitleOffset(1.5);
  Fig1->SetStats(0);
  Fig1->SetMinimum(-0.01);
  Fig1->SetMaximum(0.21);
  Fig1->SetMarkerStyle(8);
  Fig1->GetYaxis()->SetNdivisions(509);
  Fig1->GetXaxis()->SetNdivisions(509);
  Fig1->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);
  ND->Draw();
  MD->Draw();

  //  c81->Print("FractionalErrors_pimin.pdf");


  TCanvas* c80 = new TCanvas("c80","",800,400);
  c80->SetLeftMargin(.1);
  c80->SetBottomMargin(.1);
  c80->SetTopMargin(.05);
  c80->SetRightMargin(.05);
  c80->cd();

  Fig0->GetYaxis()->SetTitle("Beam Fractional Error");
  Fig0->GetYaxis()->SetTitleFont(62);
  Fig0->GetXaxis()->SetTitleFont(62);
  Fig0->GetYaxis()->SetLabelFont(62);
  Fig0->GetXaxis()->SetLabelFont(62);
  Fig0->GetYaxis()->CenterTitle();
  Fig0->GetYaxis()->SetTitleSize(0.06);
  Fig0->GetYaxis()->SetTitleOffset(0.8);
  Fig0->GetXaxis()->SetLabelSize(0.06);
  Fig0->GetYaxis()->SetLabelSize(0.06);
  Fig0->GetXaxis()->SetTitleOffset(1.5);
  Fig0->SetStats(0);
  Fig0->SetMinimum(-0.01);
  Fig0->SetMaximum(0.21);
  Fig0->SetMarkerStyle(8);
  Fig0->GetYaxis()->SetNdivisions(509);
  Fig0->GetXaxis()->SetNdivisions(509);
  Fig0->Draw("P");
  split->SetLineColor(1);
  split->SetLineWidth(2);
  split->DrawLine(19,-0.01,19,0.21);
  ND->Draw();
  MD->Draw();

  //  c80->Print("FractionalErrors_beam.pdf");

 
  cout<<"\nEnd of routine.\n";

  return 0;

}
Ejemplo n.º 12
0
int main ()
{
  return C1 () + C2 () + C3 () + C4 () + C5 () + C6 () + C7 () + C8 ();
}
Ejemplo n.º 13
0
int multiple_detector_fit()
{

  std::cout << "Beginning : ... " << std::endl;

  Int_t npoints = 1000;
  Double_t emin = 0.2; 
  Double_t emax = 3.0;

  bool use100m = false;
  bool use470m = true;
  bool use600m = false;


  std::vector<int> baselines;
  std::vector<double> scales;
  std::vector<std::string> names;
  std::vector<double> volume;

  if (use100m) baselines.push_back(100);
  if (use470m) baselines.push_back(470);
  if (use600m) baselines.push_back(600);
  int nL = baselines.size();

  double NULLVec[3][20];
  double OscVec[3][1001][7][20];

  for(int i = 0; i < 20; i++){
    NULLVec[0][i] = 0;
    NULLVec[1][i] = 0;
    NULLVec[2][i] = 0;

  }

  for(int u = 0; u < 1000; u++){
    for(int s = 0; s < 7; s++){
      for(int i = 0; i < 20; i++){

	OscVec[0][u][s][i] = 0;
        OscVec[1][u][s][i] = 0;
        OscVec[2][u][s][i] = 0;

      }
    }
  }


  int nbinsE = 0;

  int counter = 0;
  if (use100m){

    std::string temp_name = "../MatrixFiles/combined_ntuple_100m_nu_processed_numu.root";

    TFile temp_file(temp_name.c_str());
    TH1D *NULL_100;
    NULL_100 = (TH1D*)(temp_file.Get("NumuCC"));
    nbinsE = NULL_100->GetNbinsX();
    std::cout << nbinsE << std::endl;
      for(int i = 1; i <= nbinsE; i++){
	  NULLVec[counter][i-1] = (NULL_100->GetBinContent(i));
      }

    for(int u = 0; u < npoints; u++){
      for(int s = 0; s < 7; s++){
	TH1D *OSC_100;
	TString upoint = Form("%d",u);
	TString name = "Universe_";
	TString name2 = "_MultiSim_";
	TString mul = Form("%d",s);
	
	name += upoint;
	name += name2;
	name += mul;	
       
	OSC_100 = (TH1D*)(temp_file.Get(name));
          for(int i = 1; i <= nbinsE; i++){
              OscVec[counter][u][s][i-1] = (OSC_100->GetBinContent(i));
	      //	      if(OscVec[0][u][s][i-1] != OscVec[0][u][s][i-1]) std::cout << "erm" <<std::endl;

	  }

	delete OSC_100;
      }
    }
    counter++;
    delete NULL_100;
    temp_file.Close();
  }

  if (use470m){
    std::string temp_name = "../MatrixFiles/combined_ntuple_470m_nu_processed_numu.root";

    TFile temp_file(temp_name.c_str());
    TH1D *NULL_470;
    NULL_470 = (TH1D*)(temp_file.Get("NumuCC"));
    nbinsE = NULL_470->GetNbinsX();
    std::cout << nbinsE<< std::endl;
      for(int i = 1; i <= nbinsE; i++){
	  NULLVec[counter][i-1] = (NULL_470->GetBinContent(i));
      }

    for(int u = 0; u < npoints; u++){
      for(int s = 0; s < 7; s++){
	TH1D *OSC_470;
	TString upoint = Form("%d",u);//std::to_string(u);
	TString name = "Universe_";
	TString name2 = "_MultiSim_";
	TString mul = Form("%d",s);// = std::to_string(s);
	
	name += upoint;
	name += name2;
	name += mul;	
       
	OSC_470 = (TH1D*)(temp_file.Get(name));
          for(int i = 1; i <= nbinsE; i++){
	    OscVec[counter][u][s][i-1] = (OSC_470->GetBinContent(i));
	  }

	delete OSC_470;
      }
    }
    counter++;
    delete NULL_470;
    temp_file.Close();
  }

  if (use600m){
    std::string temp_name = "../MatrixFiles/combined_ntuple_600m_onaxis_nu_processed_numu.root";

    TFile temp_file(temp_name.c_str());
    TH1D *NULL_600;
    NULL_600 = (TH1D*)(temp_file.Get("NumuCC"));
    nbinsE = NULL_600->GetNbinsX();
    std::cout << nbinsE<< std::endl;
      for(int i = 1; i <= nbinsE; i++){
	  NULLVec[counter][i-1] = (NULL_600->GetBinContent(i));
      }

    for(int u = 0; u < npoints; u++){
      for(int s = 0; s < 7; s++){
	TH1D *OSC_600;
	TString upoint = Form("%d",u);//std::to_string(u);
	TString name = "Universe_";
	TString name2 = "_MultiSim_";
	TString mul = Form("%d",s);// = std::to_string(s);
	
	name += upoint;
	name += name2;
	name += mul;	
       
	OSC_600 = (TH1D*)(temp_file.Get(name));
          for(int i = 1; i <= nbinsE; i++){
	    OscVec[counter][u][s][i-1] = (OSC_600->GetBinContent(i));

	  }

	delete OSC_600;
      }
    }
    counter++;    
    delete NULL_600;
    temp_file.Close();
  }


  //  int nL = 3;
  int mbins = (nbinsE*nL);
 
  TMatrix M6 (mbins,mbins);
  TMatrix M5 (mbins,mbins);
  TMatrix M4 (mbins,mbins);
  TMatrix M3 (mbins,mbins);
  TMatrix M2 (mbins,mbins);
  TMatrix M1 (mbins,mbins);
  TMatrix M0 (mbins,mbins);
  
  TMatrix C6 (mbins,mbins);
  TMatrix C5 (mbins,mbins);
  TMatrix C4 (mbins,mbins);
  TMatrix C3 (mbins,mbins);
  TMatrix C2 (mbins,mbins);
  TMatrix C1 (mbins,mbins);
  TMatrix C0 (mbins,mbins);

  int N = 0;

  TH1D *Fig6 = new TH1D("Fig6",";;",mbins,0,mbins);
  TH1D *Fig5 = new TH1D("Fig5",";;",mbins,0,mbins);
  TH1D *Fig4 = new TH1D("Fig4",";;",mbins,0,mbins);
  TH1D *Fig3 = new TH1D("Fig3",";;",mbins,0,mbins);
  TH1D *Fig2 = new TH1D("Fig2",";;",mbins,0,mbins);
  TH1D *Fig1 = new TH1D("Fig1",";;",mbins,0,mbins);
  TH1D *Fig0 = new TH1D("Fig0",";;",mbins,0,mbins);

  int Erri = 0, Errj = 0;

  std::cout << "Filling Error Matrix..." << std::endl;

  for(int Lrow = 0; Lrow < nL; Lrow++){
    for(int Erow = 0; Erow < nbinsE; Erow++){

      Errj = 0;

      for(int Lcol = 0; Lcol < nL; Lcol++){
        for(int Ecol = 0; Ecol < nbinsE; Ecol++){

          M6 (Erri,Errj) = 0;
          M5 (Erri,Errj) = 0;
          M4 (Erri,Errj) = 0;
          M3 (Erri,Errj) = 0;
          M2 (Erri,Errj) = 0;
          M1 (Erri,Errj) = 0;
          M0 (Erri,Errj) = 0;

	  N = 0;

	  for(int u = 0; u < npoints; u++){

	    M6 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][6][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][6][Ecol]);
            M5 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][5][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][5][Ecol]);
            M4 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][4][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][4][Ecol]);
            M3 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][3][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][3][Ecol]);
            M2 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][2][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][2][Ecol]);
            M1 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][1][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][1][Ecol]);
            M0 (Erri,Errj) += (NULLVec[Lrow][Erow]-OscVec[Lrow][u][0][Erow])*(NULLVec[Lcol][Ecol]-OscVec[Lcol][u][0][Ecol]);

	    N++;
	    
	  }

	  M6 (Erri,Errj) /= N;
          M5 (Erri,Errj) /= N;
          M4 (Erri,Errj) /= N;
          M3 (Erri,Errj) /= N;
          M2 (Erri,Errj) /= N;
          M1 (Erri,Errj) /= N;
	  M0 (Erri,Errj) /= N;


	  
	  M6 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M5 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M4 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M3 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M2 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M1 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
          M0 (Erri,Errj) /= NULLVec[Lrow][Erow]*NULLVec[Lcol][Ecol];
	  
	  if(Erri == Errj) Fig6->SetBinContent(Erri+1, sqrt(M6 (Erri,Errj)));
      if(Erri == Errj) Fig5->SetBinContent(Erri+1, sqrt(M5 (Erri,Errj)));
      if(Erri == Errj) Fig4->SetBinContent(Erri+1, sqrt(M4 (Erri,Errj)));
      if(Erri == Errj) Fig3->SetBinContent(Erri+1, sqrt(M3 (Erri,Errj)));
      if(Erri == Errj) Fig2->SetBinContent(Erri+1, sqrt(M2 (Erri,Errj)));
      if(Erri == Errj) Fig1->SetBinContent(Erri+1, sqrt(M1 (Erri,Errj)));
      if(Erri == Errj) Fig0->SetBinContent(Erri+1, sqrt(M0 (Erri,Errj)));


          Errj++;

	}}

      Erri++;

    }}

  for(int i = 0; i < Erri; i++){
    for(int j = 0; j < Errj; j++){

      C6 (i,j) = M6(i,j) / sqrt(M6 (i,i) * M6 (j,j));
      C5 (i,j) = M5(i,j) / sqrt(M5 (i,i) * M5 (j,j));
      C4 (i,j) = M4(i,j) / sqrt(M4 (i,i) * M4 (j,j));
      C3 (i,j) = M3(i,j) / sqrt(M3 (i,i) * M3 (j,j));
      C2 (i,j) = M2(i,j) / sqrt(M2 (i,i) * M2 (j,j));
      C1 (i,j) = M1(i,j) / sqrt(M1 (i,i) * M1 (j,j));
      C0 (i,j) = M0(i,j) / sqrt(M0 (i,i) * M0 (j,j));

    }
  }
  
  std::cout << "...Error Matrix Filled" << std::endl;


  TCanvas* c6 = new TCanvas("c6","",700,700);
  c6->SetLeftMargin(.1);
  c6->SetBottomMargin(.1);
  c6->SetTopMargin(.075);
  c6->SetRightMargin(.15);
  c6->cd();

  M6.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //  TMatrixFBase->GetZaxis()->SetRangeUser(-0.05,0.4);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("Fractional Error Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  add_plot_label("  0.2 GeV               #minus             3.0 GeV ", 0.48,0.07,0.04);



  TLatex *MD = new TLatex(.3,.01,"MicroBooNE (470m)");
  MD->SetNDC();
  MD->SetTextFont(62);
  MD->SetTextSize(0.04);
  MD->Draw();

  TLatex *MD45 = new TLatex(.05,.3,"MicroBooNE (470m)");
  MD45->SetNDC();
  MD45->SetTextAngle(90);
  MD45->SetTextFont(62);
  MD45->SetTextSize(0.04);
  MD45->Draw();


  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Flux Fractional Error Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  c6->Print("total_1Det_matrix.pdf");



  TCanvas* c61 = new TCanvas("c61","",700,700);
  c61->SetLeftMargin(.1);
  c61->SetBottomMargin(.1);
  c61->SetTopMargin(.075);
  c61->SetRightMargin(.15);
  c61->cd();

  C6.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);
  add_plot_label("  0.2 GeV               #minus             3.0 GeV ", 0.48,0.07,0.04);

 
  MD->Draw();

  MD45->Draw();


  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Flux Correlation Matrix");
  Total->SetNDC();
  Total->SetTextFont(62);
  Total->SetTextSize(0.045);
  Total->Draw();

  c61->Print("total_1Det_correlation_matrix.pdf");

 
  cout<<"\nEnd of routine.\n";

  return 0;

}