Ignore:
Timestamp:
07/01/03 16:44:15 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhistmc/MHMcCT1CollectionArea.cc

    r2242 r2258  
    254254    {
    255255      // This theta is not exactly the one of the MC events, just about
    256       // the same:
     256      // the same (bins have been selected so):
     257
    257258      Float_t theta = fHistAll->GetYaxis()->GetBinCenter(thetabin);
    258259
    259       Float_t emin1, emax1, emin2, emax2;
    260       Float_t index, expo, k1, k2;
    261       Float_t numevts1, numevts2;
    262       Float_t r1, r2;        // Impact parameter range (on ground).
    263 
    264       emin1 = 0;  emax1 = 0; emin2 = 0;  emax2 = 0;
    265       expo = 0.; k1 = 0.; k2 = 0.; r1 = 0.; r2 = 0.;
    266       numevts1 = 0; numevts2 = 0;
     260      Float_t emin[4];
     261      Float_t emax[4];
     262      Float_t index[4];
     263      Float_t numevts[4];
     264      Float_t rmin[4];
     265      Float_t rmax[4];     // Impact parameter range (on ground).
     266
     267      memset(emin,    0, 4*sizeof(Float_t));
     268      memset(emax,    0, 4*sizeof(Float_t));
     269      memset(index,   0, 4*sizeof(Float_t));
     270      memset(numevts, 0, 4*sizeof(Float_t));
     271      memset(rmin,    0, 4*sizeof(Float_t));
     272      memset(rmax,    0, 4*sizeof(Float_t));
     273
     274      //
     275      // rmin and rmax are the minimum and maximum values of the impact
     276      // parameter of the shower on the ground (horizontal plane).
     277      //
     278
     279      Int_t num_MC_samples = 0;
    267280
    268281      if (theta > 8 && theta < 9)   // 8.75 deg
    269282        {
    270           r1 = 0.;
    271           r2 = 250.;     //meters
    272           emin1 = 300.;
    273           emax1 = 400.;  // Energies in GeV.
    274           emin2 = 400.;
    275           emax2 = 30000.;
    276           numevts1 = 4000.;
    277           numevts2 = 25740.;
     283          rmin[0] = 0.;
     284          rmax[0] = 250.;     //meters
     285          emin[0] = 300.;
     286          emax[0] = 400.;  // Energies in GeV.
     287          index[0] = 1.5;
     288          numevts[0] = 4000.;
     289
     290          rmin[1] = 0.;
     291          rmax[1] = 250.;     //meters
     292          emin[1] = 400.;
     293          emax[1] = 30000.;
     294          index[1] = 1.5;
     295          numevts[1] = 25740.;
     296
     297          num_MC_samples = 2;
    278298        }
    279299      else if (theta > 20 && theta < 21)  // 20.5 deg
    280300        {
    281           r1 = 0.;
    282           r2 = 263.;     //meters
    283           emin1 = 300.;
    284           emax1 = 400.;  // Energies in GeV.
    285           emin2 = 400.;
    286           emax2 = 30000.;
    287           numevts1 = 6611.;
    288           numevts2 = 24448.;
     301          rmin[0] = 0.;
     302          rmax[0] = 263.;     //meters
     303          emin[0] = 300.;
     304          emax[0] = 400.;  // Energies in GeV.
     305          index[0] = 1.5;
     306          numevts[0] = 6611.;
     307
     308          rmin[1] = 0.;
     309          rmax[1] = 263.;     //meters
     310          emin[1] = 400.;
     311          emax[1] = 30000.;
     312          index[1] = 1.5;
     313          numevts[1] = 24448.;
     314
     315          num_MC_samples = 2;
    289316        }
    290317      else if (theta > 26 && theta < 27)  // 26.5 degrees
    291318        {
    292           r1 = 0.;
    293           r2 = 290.;     //meters
    294           emin1 = 300.;
    295           emax1 = 400.;  // Energies in GeV.
    296           emax2 = emax1;          emin2 = 400.;
    297           emax2 = 30000.;
    298           numevts1 = 4000.;
    299           numevts2 = 26316.;
     319          rmin[0] = 0.;
     320          rmax[0] = 290.;     //meters
     321          emin[0] = 300.;
     322          emax[0] = 400.;  // Energies in GeV.
     323          index[0] = 1.5;
     324          numevts[0] = 4000.;
     325
     326          rmin[1] = 0.;
     327          rmax[1] = 290.;     //meters
     328          emin[1] = 400.;
     329          emax[1] = 30000.;
     330          index[1] = 1.5;
     331          numevts[1] = 26316.;
     332
     333          num_MC_samples = 2;
    300334        }
    301335      else if (theta > 32 && theta < 33)  // 32.5 degrees
    302336        {
    303           r1 = 0.;
    304           r2 = 350.;     //meters
    305           emin1 = 300.;
    306           emax1 = 30000.;  // Energies in GeV.
    307           emax2 = emax1;
    308           numevts1 = 33646.;
     337          rmin[0] = 0.;
     338          rmax[0] = 350.;     //meters
     339          emin[0] = 300.;
     340          emax[0] = 30000.;  // Energies in GeV.
     341          index[0] = 1.5;
     342          numevts[0] = 33646.;
     343
     344          num_MC_samples = 1;
    309345        }
    310346      else if (theta > 38 && theta < 39)  // 38.75 degrees
    311347        {
    312           r1 = 0.;
    313           r2 = 380.;     //meters
    314           emin1 = 300.;
    315           emax1 = 30000.;  // Energies in GeV.
    316           emax2 = emax1;
    317           numevts1 = 38415.;
     348          rmin[0] = 0.;
     349          rmax[0] = 380.;     //meters
     350          emin[0] = 300.;
     351          emax[0] = 30000.;  // Energies in GeV.
     352          index[0] = 1.5;
     353          numevts[0] = 38415.;
     354
     355          num_MC_samples = 1;
    318356        }
    319357      else if (theta > 45 && theta < 47)  // 46 degrees
    320358        {
    321           r1 = 0.;
    322           r2 = 565.;     //meters
    323           emin1 = 300.;
    324           emax1 = 50000.;  // Energies in GeV.
    325           emax2 = emax1;
    326           numevts1 = 30197.;
    327         }
    328 
    329       index = 1.5;     // Differential spectral Index.
    330       expo = 1.-index;
    331       k1 = numevts1 / (pow(emax1,expo) - pow(emin1,expo));
    332       k2 = numevts2 / (pow(emax2,expo) - pow(emin2,expo));
     359          rmin[0] = 0.;
     360          rmax[0] = 565.;     //meters
     361          emin[0] = 300.;
     362          emax[0] = 50000.;  // Energies in GeV.
     363          index[0] = 1.5;
     364          numevts[0] = 30197.;
     365
     366          num_MC_samples = 1;
     367        }
     368
     369      //
     370      // TO BE FIXED: Add the cases for 55 and 65 degrees zenith angle.
     371      //
    333372
    334373      for (Int_t i=1; i <= fHistAll->GetNbinsX(); i++)
    335374        {
    336           const Float_t e1 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i));
    337           const Float_t e2 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i+1));
    338 
    339           if (e1 < emin1 || e2 > emax2)
    340             continue;
    341 
    342           Float_t events;
    343 
    344           if (e2 <= emax1)
    345             events = k1 * (pow(e2, expo) - pow(e1, expo));
    346           else if (e1 >= emin2)
    347             events = k2 * (pow(e2, expo) - pow(e1, expo));
    348           else
    349             events =
    350               k1 * (pow(emax1, expo) - pow(e1, expo))+
    351               k2 * (pow(e2, expo) - pow(emin2, expo));
     375          Float_t e1 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i));
     376          Float_t e2 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i+1));
     377
     378          Float_t events = 0.;
     379
     380          for (Int_t sample = 0; sample < num_MC_samples; sample++)
     381            {
     382              Float_t expo = 1.-index[sample];
     383              Float_t k = numevts[sample] / (pow(emax[sample],expo) - pow(emin[sample],expo));
     384
     385              if (e2 < emin[sample] || e1 > emax[sample])
     386                continue;
     387
     388              if (emin[sample] > e1)
     389                e1 = emin[sample];
     390
     391              if (emax[sample] < e2)
     392                e2 = emax[sample];
     393
     394              events += k * (pow(e2, expo) - pow(e1, expo));
     395            }
    352396
    353397          fHistAll->SetBinContent(i, thetabin, events);
     
    357401      // -----------------------------------------------------------
    358402
    359       const Float_t dr = TMath::Pi() * (r2*r2 - r1*r1);
     403      const Float_t dr = TMath::Pi() * (rmax[0]*rmax[0] - rmin[0]*rmin[0]);
    360404
    361405      for (Int_t ix = 1; ix <= fHistAll->GetNbinsX(); ix++)
     
    392436          const Double_t efferr = sqrt((1.-eff)*Ns)/Na;
    393437
    394 
     438          //
     439          // Total area, perpendicular to the observation direction
     440          // in which the events were generated (correct for cos theta):
     441          //
    395442          const Float_t area = dr * cos(theta*TMath::Pi()/180.);
    396443
Note: See TracChangeset for help on using the changeset viewer.