Results for known Moller events

From New IAC Wiki
Revision as of 19:45, 5 April 2016 by Vanwdani (talk | contribs)
Jump to navigation Jump to search

Looking at effects of Solenoid

void Effects_GeV()
{
        struct evt_t
                {
                Int_t event;
                Float_t KE;
                Float_t shift;
                };
        ifstream in;
        evt_t evt;

        double E,delta_phi;
        Int_t nlines=0;

        float Base_Number1,Base_Number2,Base_Number3,Base_Number4,Base_Number5=0;
        float normal1,normal2,normal3,normal4,normal5;
        float neg5T_number1,neg5T_number2,neg5T_number3,neg5T_number4,neg5T_number5;
        float pos5T_number1,pos5T_number2,pos5T_number3,pos5T_number4,pos5T_number5;
        float neg25T_number1,neg25T_number2,neg25T_number3,neg25T_number4,neg25T_number5;
        float pos25T_number1,pos25T_number2,pos25T_number3,pos25T_number4,pos25T_number5;
        float pos6T_number1,pos6T_number2,pos6T_number3,pos6T_number4,pos6T_number5;
        float pos4T_number1,pos4T_number2,pos4T_number3,pos4T_number4,pos4T_number5;
        float avg_0T,avg_pos5T,avg_neg5T,avg_neg25T,avg_pos25T,avg_pos4T,avg_pos6T;
        float total_0T,total_pos5T,total_neg5T,total_pos25T,total_neg25T,total_pos4T,total_pos6T;
        float stderror_0T,stderror_pos5T,stderror_neg5T,stderror_pos25T,stderror_neg25T,stderror_pos4T,stderror_pos6T;

        TFile *f = new TFile("Phi_Shift_counts_GeV.root","RECREATE");
        TTree *tree = new TTree("Phi_Shift_counts_GeV","Phi Shift counts wrt 0T");


//
//Count entries from 0T
//
        in.open("Energy_Phi_Shift_GeV_0T_1.dat");
        tree->Branch("evt",&evt.event,"event/I:KE/F:shift");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                }
        Base_Number1=nlines;
        normal1=Base_Number1/Base_Number1;
        nlines=0;
        in.close();

        in.open("Energy_Phi_Shift_GeV_0T_2.dat");
        tree->Branch("evt",&evt.event,"event/I:KE/F:shift");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                }
        Base_Number2=nlines;
        normal2=Base_Number2/Base_Number2;
        nlines=0;
        in.close();

        in.open("Energy_Phi_Shift_GeV_0T_3.dat");

        tree->Branch("evt",&evt.event,"event/I:KE/F:shift");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                }   
        Base_Number3=nlines;
        normal3=Base_Number3/Base_Number3;
        nlines=0;
        in.close();

        in.open("Energy_Phi_Shift_GeV_0T_4.dat");
        tree->Branch("evt",&evt.event,"event/I:KE/F:shift");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                }
        Base_Number4=nlines;
        normal4=Base_Number4/Base_Number4;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_0T_5.dat");
        tree->Branch("evt",&evt.event,"event/I:KE/F:shift");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                }
        Base_Number5=nlines;
        normal5=Base_Number5/Base_Number5;
        nlines=0;
        in.close();
                
                 
//
// Normalize the -5T file
//
        in.open("Energy_Phi_Shift_GeV_neg5T_1.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                
                }
        neg5T_number1=nlines/Base_Number1;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_neg5T_2.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                 
                }
        neg5T_number2=nlines/Base_Number2;
        nlines=0;
        in.close(); 
        
        in.open("Energy_Phi_Shift_GeV_neg5T_3.dat");
        while(in.good())
                {  
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        neg5T_number3=nlines/Base_Number3;
        nlines=0;
        in.close();
                 
        in.open("Energy_Phi_Shift_GeV_neg5T_4.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        neg5T_number4=nlines/Base_Number4;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_neg5T_5.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                 
                }
        neg5T_number5=nlines/Base_Number5;
        nlines=0;
        in.close();
        
                 
//
// Normalize the 5T file
//
        in.open("Energy_Phi_Shift_GeV_pos5T_1.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos5T_number1=nlines/Base_Number1;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_pos5T_2.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos5T_number2=nlines/Base_Number2;
        nlines=0;
        in.close();
                
        
        in.open("Energy_Phi_Shift_GeV_pos5T_3.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos5T_number3=nlines/Base_Number3;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos5T_4.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos5T_number4=nlines/Base_Number4;
        nlines=0;
        in.close();
                 
        in.open("Energy_Phi_Shift_GeV_pos5T_5.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
  
                }
        pos5T_number5=nlines/Base_Number5;
        nlines=0;
        in.close();
                 
                
//
// Normalize the -2.5T file
//      
        in.open("Energy_Phi_Shift_GeV_neg25T_1.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        neg25T_number1=nlines/Base_Number1;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_neg25T_2.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        neg25T_number2=nlines/Base_Number2;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_neg25T_3.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        neg25T_number3=nlines/Base_Number3;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_neg25T_4.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        neg25T_number4=nlines/Base_Number4;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_neg25T_5.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                
                }
        neg25T_number5=nlines/Base_Number5;
        nlines=0;
        in.close();
        
                 
//
// Normalize the 2.5T file
//
        in.open("Energy_Phi_Shift_GeV_pos25T_1.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos25T_number1=nlines/Base_Number1;
        nlines=0;
                
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos25T_2.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos25T_number2=nlines/Base_Number2;
        nlines=0;
                
        in.close();
                 
        in.open("Energy_Phi_Shift_GeV_pos25T_3.dat");
        while(in.good())
                {  
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                 
                }
        pos25T_number3=nlines/Base_Number3;
        nlines=0;
        
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos25T_4.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                
                }
        pos25T_number4=nlines/Base_Number4;
        nlines=0;
                 
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos25T_5.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos25T_number5=nlines/Base_Number5;
        nlines=0;
                
        in.close();
        
                 
//
// Normalize the 6T file
//              
        in.open("Energy_Phi_Shift_GeV_pos6T_1.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                
                }
        pos6T_number1=nlines/Base_Number1;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos6T_2.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                
                }
        pos6T_number2=nlines/Base_Number2;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos6T_3.dat");
        while(in.good())
                {  
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                 
                }
        pos6T_number3=nlines/Base_Number3;
        nlines=0;
        in.close();
                 
        in.open("Energy_Phi_Shift_GeV_pos6T_4.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos6T_number4=nlines/Base_Number4;
        nlines=0;
        in.close();
        
        in.open("Energy_Phi_Shift_GeV_pos6T_5.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                 
                }
        pos6T_number5=nlines/Base_Number5;
        nlines=0;
        in.close();
        
                 
//
// Normalize the 4T file
//
        in.open("Energy_Phi_Shift_GeV_pos4T_1.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos4T_number1=nlines/Base_Number1;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_pos4T_2.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos4T_number2=nlines/Base_Number2;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_pos4T_3.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos4T_number3=nlines/Base_Number3;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_pos4T_4.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
        
                }
        pos4T_number4=nlines/Base_Number4;
        nlines=0;
        in.close();
                
        in.open("Energy_Phi_Shift_GeV_pos4T_5.dat");
        while(in.good())
                {
                evt.event=nlines;
                in >> evt.KE >> evt.shift;
                nlines++;
                 
                }
        pos4T_number5=nlines/Base_Number5;
        nlines=0;
        in.close();
        
                 
//
// Calculate the error bars
//
//      B=0T
        total_0T=normal1+normal2+normal3+normal4+normal5;
        avg_0T=total_0T/5;
        
//      B=5T
        total_pos5T=pos5T_number1+pos5T_number2+pos5T_number3+pos5T_number4+pos5T_number5;
        avg_pos5T=total_pos5T/5;
        
//      B=-5T
        total_neg5T=neg5T_number1+neg5T_number2+neg5T_number3+neg5T_number4+neg5T_number5;
        avg_neg5T=total_neg5T/5;
                
//      B=2.5T
        total_pos25T=pos25T_number1+pos25T_number2+pos25T_number3+pos25T_number4+pos25T_number5;
        avg_pos25T=total_pos25T/5;
        
//      B=-2.5T
        total_neg25T=neg25T_number1+neg25T_number2+neg25T_number3+neg25T_number4+neg25T_number5;
        avg_neg25T=total_neg25T/5;
        
//      B=4T
        total_pos4T=pos4T_number1+pos4T_number2+pos4T_number3+pos4T_number4+pos4T_number5;
        avg_pos4T=total_pos4T/5;
                
//      B=6T
        total_pos6T=pos6T_number1+pos6T_number2+pos6T_number3+pos6T_number4+pos6T_number5;
        avg_pos6T=total_pos6T/5;
        
        stderror_0T=0;
        stderror_0T=(normal1-avg_0T)*(normal1-avg_0T)+stderror_0T;
        stderror_0T=(normal2-avg_0T)*(normal2-avg_0T)+stderror_0T;
        stderror_0T=(normal3-avg_0T)*(normal3-avg_0T)+stderror_0T;
        stderror_0T=(normal4-avg_0T)*(normal4-avg_0T)+stderror_0T;
        stderror_0T=(normal5-avg_0T)*(normal5-avg_0T)+stderror_0T;
        stderror_0T=sqrt(stderror_0T);
        stderror_0T=stderror_0T/4;
        
        stderror_pos5T=0;
        stderror_pos5T=(pos5T_number1-avg_pos5T)*(pos5T_number1-avg_pos5T)+stderror_pos5T;
        stderror_pos5T=(pos5T_number2-avg_pos5T)*(pos5T_number2-avg_pos5T)+stderror_pos5T;
        stderror_pos5T=(pos5T_number3-avg_pos5T)*(pos5T_number3-avg_pos5T)+stderror_pos5T;
        stderror_pos5T=(pos5T_number4-avg_pos5T)*(pos5T_number4-avg_pos5T)+stderror_pos5T;
        stderror_pos5T=(pos5T_number5-avg_pos5T)*(pos5T_number5-avg_pos5T)+stderror_pos5T;
        stderror_pos5T=sqrt(stderror_pos5T);
        stderror_pos5T=stderror_pos5T/4;
                
        stderror_neg5T=0;
        stderror_neg5T=(neg5T_number1-avg_neg5T)*(neg5T_number1-avg_neg5T)+stderror_neg25T;
        stderror_neg5T=(neg5T_number1-avg_neg5T)*(neg5T_number1-avg_neg5T)+stderror_neg25T;
        stderror_neg5T=(neg5T_number1-avg_neg5T)*(neg5T_number1-avg_neg5T)+stderror_neg25T;
        stderror_neg5T=(neg5T_number1-avg_neg5T)*(neg5T_number1-avg_neg5T)+stderror_neg25T;
        stderror_neg5T=(neg5T_number1-avg_neg5T)*(neg5T_number1-avg_neg5T)+stderror_neg25T;
        stderror_neg5T=sqrt(stderror_neg5T);
        stderror_neg5T=stderror_neg5T/4;
                 
        stderror_neg25T=0;
        stderror_neg25T=(neg25T_number1-avg_neg25T)*(neg25T_number1-avg_neg25T)+stderror_neg25T;
        stderror_neg25T=(neg25T_number2-avg_neg25T)*(neg25T_number2-avg_neg25T)+stderror_neg25T;
        stderror_neg25T=(neg25T_number3-avg_neg25T)*(neg25T_number3-avg_neg25T)+stderror_neg25T;
        stderror_neg25T=(neg25T_number4-avg_neg25T)*(neg25T_number4-avg_neg25T)+stderror_neg25T;
        stderror_neg25T=(neg25T_number5-avg_neg25T)*(neg25T_number5-avg_neg25T)+stderror_neg25T;
        stderror_neg25T=sqrt(stderror_neg25T);
        stderror_neg25T=stderror_neg25T/4;
        
        stderror_pos25T=0;
        stderror_pos25T=(pos25T_number1-avg_pos25T)*(pos25T_number1-avg_pos25T)+stderror_pos25T;
        stderror_pos25T=(pos25T_number2-avg_pos25T)*(pos25T_number2-avg_pos25T)+stderror_pos25T;
        stderror_pos25T=(pos25T_number3-avg_pos25T)*(pos25T_number3-avg_pos25T)+stderror_pos25T;
        stderror_pos25T=(pos25T_number4-avg_pos25T)*(pos25T_number4-avg_pos25T)+stderror_pos25T;
        stderror_pos25T=(pos25T_number5-avg_pos25T)*(pos25T_number5-avg_pos25T)+stderror_pos25T;
        stderror_pos25T=sqrt(stderror_pos25T);
        stderror_pos25T=stderror_pos25T/4;
        
        stderror_pos4T=0;
        stderror_pos4T=(pos4T_number1-avg_pos4T)*(pos4T_number1-avg_pos4T)+stderror_pos4T;
        stderror_pos4T=(pos4T_number2-avg_pos4T)*(pos4T_number2-avg_pos4T)+stderror_pos4T;
        stderror_pos4T=(pos4T_number3-avg_pos4T)*(pos4T_number3-avg_pos4T)+stderror_pos4T;
        stderror_pos4T=(pos4T_number4-avg_pos4T)*(pos4T_number4-avg_pos4T)+stderror_pos4T;
        stderror_pos4T=(pos4T_number5-avg_pos4T)*(pos4T_number5-avg_pos4T)+stderror_pos4T;
        stderror_pos4T=sqrt(stderror_pos4T);
        stderror_pos4T=stderror_pos4T/4;
                
        stderror_pos6T=0;
        stderror_pos6T=(pos6T_number1-avg_pos6T)*(pos6T_number1-avg_pos6T)+stderror_pos6T;
        stderror_pos6T=(pos6T_number2-avg_pos6T)*(pos6T_number2-avg_pos6T)+stderror_pos6T;
        stderror_pos6T=(pos6T_number3-avg_pos6T)*(pos6T_number3-avg_pos6T)+stderror_pos6T;
        stderror_pos6T=(pos6T_number4-avg_pos6T)*(pos6T_number4-avg_pos6T)+stderror_pos6T;
        stderror_pos6T=(pos6T_number5-avg_pos6T)*(pos6T_number5-avg_pos6T)+stderror_pos6T;
        stderror_pos6T=sqrt(stderror_pos6T);
        stderror_pos6T=stderror_pos6T/4;
       
// Make an xmgrace file
        
        fprintf(stdout,"%d %g %g\n",-5,avg_neg5T,stderror_neg5T);
        fprintf(stdout,"%d %g %g\n",-2.5,avg_neg25T,stderror_neg25T);
        fprintf(stdout,"%d %g %g\n",0,avg_0T,stderror_0T);
        fprintf(stdout,"%d %g %g\n",2.5,avg_pos25T,stderror_pos25T);
        fprintf(stdout,"%d %g %g\n",4,avg_pos4T,stderror_pos4T);
        fprintf(stdout,"%d %g %g\n",5,avg_pos5T,stderror_pos5T);
        fprintf(stdout,"%d %g %g\n",6,avg_pos6T,stderror_pos6T);
        
        
        tree->Print();
        tree->Write();   
        f->Write();
        
        delete tree;
        delete f;
        
}

MeV graph.png

GeV graph.png

Total graph.png