| 1 |
|
|---|
| 2 | // Macro to compare the rotation obtained from simple FOV rotation, with
|
|---|
| 3 | // measured values
|
|---|
| 4 |
|
|---|
| 5 | void rotation()
|
|---|
| 6 | {
|
|---|
| 7 | const Int_t rmax=17427;
|
|---|
| 8 | gStyle->SetMarkerStyle(20);
|
|---|
| 9 | gStyle->SetMarkerSize(1);
|
|---|
| 10 |
|
|---|
| 11 | const char* fname="/mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/macros/20040215_Mrk421.B.pos";
|
|---|
| 12 | TFile* file= new TFile("/mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/hillas/mrk20040215OnRotateNoCalB.root");
|
|---|
| 13 | TTree* chain = (TTree*)file->Get("Parameters");
|
|---|
| 14 |
|
|---|
| 15 | // read position data from file
|
|---|
| 16 | ifstream ifun(fname);
|
|---|
| 17 |
|
|---|
| 18 | Int_t irun;
|
|---|
| 19 | Float_t ix;
|
|---|
| 20 | Float_t iy;
|
|---|
| 21 |
|
|---|
| 22 | // first loop to evaluate number of entries
|
|---|
| 23 | Int_t nentries=0;
|
|---|
| 24 | while(ifun >> irun)
|
|---|
| 25 | {
|
|---|
| 26 | ifun >> ix;
|
|---|
| 27 | ifun >> iy;
|
|---|
| 28 | nentries++;
|
|---|
| 29 | }
|
|---|
| 30 | ifun.close();
|
|---|
| 31 | const Int_t size = nentries;
|
|---|
| 32 | Float_t x[size];
|
|---|
| 33 | Float_t y[size];
|
|---|
| 34 | Int_t run[size];
|
|---|
| 35 |
|
|---|
| 36 | // second loop to actually read values into arrays
|
|---|
| 37 | Int_t i=0;
|
|---|
| 38 | ifstream ifun2(fname);
|
|---|
| 39 | while(ifun2 >> run[i])
|
|---|
| 40 | {
|
|---|
| 41 | ifun2 >> x[i];
|
|---|
| 42 | ifun2 >> y[i];
|
|---|
| 43 | x[i]/=315.;
|
|---|
| 44 | y[i]/=315.;
|
|---|
| 45 | i++;
|
|---|
| 46 | }
|
|---|
| 47 | ifun2.close();
|
|---|
| 48 | TGraph* tray = new TGraph(nentries,x,y);
|
|---|
| 49 |
|
|---|
| 50 | // get data from tree
|
|---|
| 51 | MSrcPosCam* srpos = new MSrcPosCam;
|
|---|
| 52 | MRawRunHeader* hrun = new MRawRunHeader;
|
|---|
| 53 | chain->SetBranchAddress("MSrcPosCam.",&srpos);
|
|---|
| 54 | chain->SetBranchAddress("MRawRunHeader.",&hrun);
|
|---|
| 55 |
|
|---|
| 56 | Int_t ntot = chain->GetEntries();
|
|---|
| 57 | const Int_t ctot =ntot;
|
|---|
| 58 | Float_t xth[ctot];
|
|---|
| 59 | Float_t yth[ctot];
|
|---|
| 60 | Int_t rtot=0;
|
|---|
| 61 | for(Int_t j=0;j<ctot;j++)
|
|---|
| 62 | {
|
|---|
| 63 | chain->GetEntry(j);
|
|---|
| 64 | Int_t arun=hrun->GetRunNumber();
|
|---|
| 65 | if(arun<=rmax)
|
|---|
| 66 | {
|
|---|
| 67 | xth[j]=srpos->GetX()/315.;
|
|---|
| 68 | yth[j]=srpos->GetY()/315.;
|
|---|
| 69 | rtot++;
|
|---|
| 70 | }
|
|---|
| 71 | }
|
|---|
| 72 | TGraph* trayth = new TGraph(rtot,xth,yth);
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | // Plot
|
|---|
| 76 | TPostScript myps("rotation.ps",111);
|
|---|
| 77 | myps.Range(15,15);
|
|---|
| 78 | TCanvas* myC = new TCanvas("myC","pedestal studies",500,500);
|
|---|
| 79 | myC->cd(1);
|
|---|
| 80 |
|
|---|
| 81 | // Null graph to adjust plot limits
|
|---|
| 82 | Float_t nullx[2]={-0.4,0.4};
|
|---|
| 83 | Float_t nully[2]={-0.4,0.4};
|
|---|
| 84 |
|
|---|
| 85 | TGraph grnull(2,nullx,nully);
|
|---|
| 86 | grnull.SetMarkerSize(0);
|
|---|
| 87 | grnull.SetMarkerColor(0);
|
|---|
| 88 | grnull.GetXaxis()->SetTitle("x (deg)");
|
|---|
| 89 | grnull.GetYaxis()->SetTitle("y (deg)");
|
|---|
| 90 | grnull.SetTitle("Source position in camera Mrk421 15th February");
|
|---|
| 91 | grnull.DrawClone("AP");
|
|---|
| 92 |
|
|---|
| 93 | tray->SetMarkerStyle(2);
|
|---|
| 94 | tray->SetMarkerSize(2);
|
|---|
| 95 | trayth->SetMarkerStyle(6);
|
|---|
| 96 | trayth->SetMarkerColor(2);
|
|---|
| 97 |
|
|---|
| 98 | tray->DrawClone("P");
|
|---|
| 99 | trayth->DrawClone("P");
|
|---|
| 100 | myps.Close();
|
|---|
| 101 | }
|
|---|