Changeset 4387 for trunk


Ignore:
Timestamp:
07/15/04 11:23:59 (20 years ago)
Author:
jlopez
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/macros/lightcurve.C

    r4377 r4387  
    1 Bool_t debug = kFALSE;
    2 
    3 
    41Double_t ChiSquareNDof(TH1D *h1, TH1D *h2)
    52{
     
    6158{
    6259
     60  gROOT->Reset();
     61  gStyle->SetTimeOffset(-3600);
     62
     63  // Configuration
     64  const Bool_t debug = kFALSE;
     65  const Double_t timebin = 480.; //[sec]
     66  TString psname = "./20040422_Mrk421." + timebin + "s.ps";
     67  cout << psname << endl;
     68  return;
     69
    6370  //Constanst
    64   const Double_t ConvDegToRad = TMath::ACos(-1)/180.;
    65 
    66   // Time binning
    67   const Double_t timebin = 500.; //[sec]
     71  const Double_t kConvDegToRad = TMath::ACos(-1)/180.;
    6872  const Double_t kSec = 1e6;  //[sec/microsec]
    6973  const Double_t kDay = 24.*60.*60.;  //[Day/sec]
     
    114118  //alpha plot integration for gammas
    115119  Double_t sigexccmin = 0.;
    116   Double_t sigexccmax = 30.;
     120  Double_t sigexccmax = 20.;
    117121  Double_t bkgnormmin = 40.;
    118122  Double_t bkgnormmax = 80.;
     
    186190  plist_on.AddToList(&hAlpha_on_abs);
    187191  MBinning binsAlpha_on_abs("BinningAlpha_on_abs");
    188   Int_t nbins_abs = 9;
     192  Int_t nbins_abs = 18;
    189193  Double_t minalpha_abs = 0.;
    190194  Double_t maxalpha_abs =90.;
     
    528532                          hAlpha_on_abs_timebin->Fill(TMath::Abs(alpha));
    529533                          hSrcPos_on_timebin->Fill(srcposx,srcposy);
    530                           hCosZenith_on_timebin->Fill(TMath::Cos(zenith*ConvDegToRad));
     534                          hCosZenith_on_timebin->Fill(TMath::Cos(zenith*kConvDegToRad));
    531535                         
    532536                          if (zenith != 0 && zenith < zenithMinimumOn[numberTimeBins-1])
     
    618622 
    619623  for (UInt_t bin=0; bin<numberTimeBins; bin++)
    620     cout << bin << " timeOn " << timeOn[bin] << " min-max zenithOn " << zenithMinimumOn[bin] << "-" <<  zenithMaximumOn[bin] << " min-max cos(zenithOn) " << TMath::Cos(zenithMinimumOn[bin]*ConvDegToRad) << "-" <<  TMath::Cos(zenithMaximumOn[bin]*ConvDegToRad) << " numberOnEvents " << numberOnEvents[bin] << endl;
     624    cout << bin << " timeOn " << timeOn[bin] << " min-max zenithOn " << zenithMinimumOn[bin] << "-" <<  zenithMaximumOn[bin] << " min-max cos(zenithOn) " << TMath::Cos(zenithMinimumOn[bin]*kConvDegToRad) << "-" <<  TMath::Cos(zenithMaximumOn[bin]*kConvDegToRad) << " numberOnEvents " << numberOnEvents[bin] << endl;
    621625
    622626
     
    881885//     }
    882886 
     887
     888  TArrayD meanTimeBinOnInSec(numberTimeBins);
     889  TArrayD widthTimeBinOnInSec(numberTimeBins);
     890 
    883891  for (UInt_t bin=0; bin<numberTimeBins; bin++)
    884892    {
     893     
     894      meanTimeBinOnInSec[bin]  = (meanTimeBinOn[bin]-(Int_t)meanTimeBinOn[bin]);
     895      if (meanTimeBinOnInSec[bin] > 0.5)
     896        meanTimeBinOnInSec[bin] = meanTimeBinOnInSec[bin] - 1 ;
     897      meanTimeBinOnInSec[bin] *= kDay;
     898
     899      widthTimeBinOnInSec[bin] = widthTimeBinOn[bin]*kDay;
     900
    885901      numberOffEvents[bin] = (Double_t) ((TH1F*)alphaHistoOff[bin])->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);
    886902      numberBkgEventsToNormOff[bin] =  (Double_t) ((TH1F*)alphaHistoOff[bin])->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);
     
    911927
    912928 
    913   TString psname = "./prueba.ps";
     929
    914930  TString openpsname = psname + "(";
    915931  TString closepsname = psname + ")";
     
    917933  TCanvas *c1 = new TCanvas;
    918934  c1->cd(1);
    919   TGraphErrors* lightcurvegraph = new TGraphErrors(numberTimeBins,meanTimeBinOn.GetArray(),numberExcessEventsPerMin.GetArray(),widthTimeBinOn.GetArray(),errorNumberExcessEventsPerMin.GetArray());
     935  TGraphErrors* lightcurvegraph = new TGraphErrors(numberTimeBins,meanTimeBinOnInSec.GetArray(),numberExcessEventsPerMin.GetArray(),widthTimeBinOnInSec.GetArray(),errorNumberExcessEventsPerMin.GetArray());
    920936  lightcurvegraph->SetTitle("LightCurve");
    921937  lightcurvegraph->SetMinimum(0.);
     
    923939  lightcurvegraph->SetMarkerSize(0.03);
    924940  lightcurvegraph->Draw("AP");
     941  lightcurvegraph->GetXaxis()->SetTimeDisplay(1);
    925942  c1->Print(openpsname);
    926943     
Note: See TracChangeset for help on using the changeset viewer.