{ // // An example to draw various variables in the SVAC ntuple! // Original author: Chen, Xin (xchen@slac.stanford.edu) // Additionas and comments by anders (borgland@slac.stanford.edu) // // // To run this macro, do: root drawSvac.C // Or if you are already in ROOT: .x drawSvac.C // gROOT->Reset(); // // Name of the SVAC ntuple file you want to look at: // TFile* f1 = new TFile("/nfs/farm/g/glast/u01/svac_workshop/Workshop-3/Data/GlastRelease_v6r2p1-AdditionalCAL/Run-140001338/140001338_svac.root"); // // 'Output' is the name of the Root tree in the SVAC ntuple and // automatically becomes a pointer to that tree. // Can also explicitly do: //TTree *Output = (TTree*) f1.Get("Output"); // More details about the SVAC ntuple variables are found // in the SVAC ntuple decsription available from the main // Instrument Analysis page. // // This time we will put four plots on the same canvas: // // Define the canvas: TCanvas* c1 = new TCanvas; // Divide it into 4: c1->Divide(2,2); // gPad->SetBorderMode(0); gPad->SetFillColor(10); // // Plot the number of reconstructed tracks: // // Go to the upper left corner of the canvas: c1->cd(1); // fill the plot with red: Output->SetFillColor(2); // Plot: Output->Draw("TkrNumTracks"); // // Plot maximal energy in a CAL crystal: // // Go to the upper right corner of the canvas: c1->cd(2); Output->SetFillColor(2); // Want log scale for this: gPad->SetLogy(); // Plot the maximum energy when it's greater than 0: // Cuts are added in quotes after the first comma. Output->Draw("CalMaxEne","CalMaxEne>0"); // // Plot the energy in each crystal: // Note that this is an array. Root will here automatically // loop over all the entries and plot each separately. // Here we limit ourselves to the first 100 events! // // Go to the lower left corner of the canvas: c1->cd(3); Output->SetFillColor(2); // Want log scale for this: gPad->SetLogy(); // Plot the energy in each crystal when there is energy in the CAL // for the first 100 events: Output->Draw("CalXtalEne","CalMaxEne>0","","100"); // // Plot the number of strips per layer and view: // This is an array and Root will loop over all the entries. // // Go to the lower right corner of the canvas: c1->cd(4); Output->SetFillColor(2); // Want log scale for this: gPad->SetLogy(); // Plot all the elements of the array for the first 100 events: Output->Draw("TkrNumStrips","","","100"); }