Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:14:00

0001 #define __CINT__
0002 
0003 #ifdef __linux__
0004 #include "/home/gnukazuk/soft/MyLibrary/include/MyLibrary.hh"
0005 // #include "/home/gnukazuk/cernbox/Analysis_new/COMPASS_DY/common_macro/include/CommonInclude.hh"
0006 
0007 #elif __APPLE__
0008 // #include "/Users/nukazuka/local/MyLibrary/include/MyLibrary.hh"
0009 #include "/Users/genki/soft/MyLibrary/include/MyLibrary.hh"
0010 // #include "/Users/nukazuka/cernbox/Analysis_new/COMPASS_DY/common_macro/include/CommonInclude.hh"
0011 // #include "/Users/gnukazuk/cernbox/Analysis_new/COMPASS_DY/common_macro/include/CommonInclude.hh"
0012 
0013 #endif
0014 
0015 
0016 bool IsInAcceptance( double z, double theta )
0017 {
0018   double slope = TMath::Tan( theta );
0019   double intercept = -slope * z;
0020 
0021   double slope_min = 10 /( 20 - z );
0022   double slope_max = 10 / (-20 - z );
0023 
0024   if( slope_min < slope && slope < slope_max )
0025     return true;
0026 
0027   
0028   return false;
0029 }
0030 
0031 int theta_dist()
0032 {
0033   TRandom3* randamer = new TRandom3( 0 );
0034 
0035   TH2D* hist = new TH2D( "z_theta", "z_{vtx} vs #theta;z_{vtx} (cm);#theta (degree);Entries", 1000, -50, 50, 360, 0, 360 );
0036   TH1D* hist_theta = new TH1D( "theta_dist", "#theta distribution;#theta (degree);Entries", 360, 0, 360 );
0037   TH1D* hist_z = new TH1D( "z_dist", "z_{vtx} distribution;z_{vtx} (cm);Entresi", 1000, -50, 50 );
0038   double z = -50;
0039   for( int i=0; i<1e2; i++ )
0040     {
0041       //double z = randamer->Gaus( 0, 10 );
0042       double theta = randamer->Uniform( 0,360 );
0043       theta = 14;
0044       // hist_theta->Fill( randamer->Uniform( 0,360 ) );
0045       // hist_z->Fill( randamer->Gaus( 0, 10 ) );
0046       hist->Fill(z, theta );
0047 
0048       cout << setw(10) << z << " "
0049        << setw(10) << theta << " "
0050        << IsInAcceptance( z, theta )
0051        << endl;
0052 
0053       z += 1;
0054     }
0055 
0056   //  hist_theta->Draw();
0057   //hist_z->Draw();
0058   hist->Draw( "colz" );
0059 
0060   return 0;
0061 }