Jonas

From LHEP Wiki
Revision as of 09:49, 18 March 2015 by Lhep (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CS check in GS

docs.google.com
operashift-cs-scanning@lngs.infn.it 
usual pwd

restart network

be root
/etc/init.d/network restart

example script for plots

check_ThetaAtPlate(int PLATE = 4)
{
printf("starting check_ThetaAtPlate\n");

 sep->SetBranchAddress("TX",&TX);
 sep->SetBranchAddress("TY",&TY);
 sep->SetBranchAddress("plate",&plate);
 sep->SetBranchAddress("brick",&brick);
 
 h3 = new TH1F("h3","Theta on plate",100,0.,.5);
 h7 = new TH1F("h7","Theta on plate",100,0.,.5);

 int b7_COUNT = 0;
 int b3_COUNT = 0;

 for (int i = 0; i<N_ENTRIES; i++)
 {
   sep->GetEntry(i);
   if (plate==38) continue;
   //if (plate!=PLATE) continue;

   if (brick==3){ 
     if (plate!=4) continue;
     h3->Fill(atan(sqrt(TX*TX+TY*TY)));
     b3_COUNT++;
     }
   if (brick==7){ 
     if (plate!=7) continue;
     h7->Fill(atan(sqrt(TX*TX+TY*TY)));
     b7_COUNT++;
     }
 }
 //pion blue
 h7->SetLineColor(kBlue);
//   h7->Sumw2();//scales error NOT needed if you DrawNormalized
//   h7->Scale(1./b7_COUNT); NOT needed if you DrawNormalized
 //muon red
 h3->SetLineColor(kRed);
//   h3->Sumw2();//scales errorNOT needed if you DrawNormalized
//   h3->Scale(1./b3_COUNT); NOT needed if you DrawNormalized

 //Draw
 //gROOT->SetStyle("Plain");
 TCanvas *c1 = new TCanvas("Angular distribution of dTheta","Theta distribution at a Plate",800,600);
 c1->Clear();
 c1->SetBorderMode(0);

 //statistic boxes
 h3->Draw();
 
 c1->Modified();
 c1->Update();
 TPaveStats *st_h3=(TPaveStats *) h3->FindObject("stats");
 st_h3->SetX1NDC(0.75);
 st_h3->SetX2NDC(0.99);
 st_h3->SetY1NDC(0.62);
 st_h3->SetY2NDC(0.80);

 h7->Draw();
 c1->Modified();
 c1->Update();
 TPaveStats *st_h7=(TPaveStats *) h7->FindObject("stats");
 st_h7->SetX1NDC(0.75);
 st_h7->SetX2NDC(0.99);
 st_h7->SetY1NDC(0.80);
 st_h7->SetY2NDC(0.99);
 
 //scale error
 h3->Sumw2();
 h7->Sumw2();

 //title of axis
 h3->GetXaxis()->SetTitle("Theta");
 h3->GetYaxis()->SetTitle("Counts (normalized)");
 h3->GetYaxis()->SetTitleOffset(1.2);

 //draw
 h3->DrawNormalized("e");
 h7->DrawNormalized("esame");
 st_h3->Draw();
 st_h7->Draw();

 //TLegend *leg = new TLegend(.78, .68, .98, .83);
 TLegend *leg = new TLegend(0.75,0.47,0.99,0.62);
 leg->AddEntry(h3, "Muon");
 leg->AddEntry(h7, "Pion");
 leg->SetBorderSize(2);
 leg->Draw();

 char cmd[128];
 sprintf(cmd,"check_ThetaAtPlate_%d.png",PLATE);
 c1->SaveAs(cmd);

 printf(" %d entries from b3 (muon - red)\n",b3_COUNT);
 printf(" %d entries from b7 (pion - blue)\n",b7_COUNT);
}