{ // // An example to draw various variables in either the Merit or SVAC ntuple! // Author: Chen, Xin (xchen@slac.stanford.edu) // Comments by anders :-) // // // To run this macro, do: root drawMeritSvac.C // Or if you are already in ROOT: .x drawMeritSvac.C // gROOT->Reset(); // // Name of the Merit ntuple file you want to look at: // This is a integrated tracker run (real data)! // TFile* f1 = new TFile("/nfs/farm/g/glast/u01/svac_workshop/Workshop-3/Data/GlastRelease_v6r2p1-AdditionalCAL/Run-140001338/140001338_merit.root"); // // 'MeritTuple' is the name of the Root tree in the Merit ntuple and // automatically becomes a pointer to that tree. // Can also explicitly do: //TTree *MeritTuple = (TTree*) f1.Get("MeritTuple"); // // // Make the Merit and SVAC Root trees 'friends' so that we // easily can mix variables from both ntuples: // 'Output' is the name of the tree in the SVAC ntuple. // MeritTuple->AddFriend("Output","/nfs/farm/g/glast/u12/EM2/rootData/398000371/calib-v1r0/svacRoot/emRootv0r0/svacTuple-EM2-v1r0_398000371_svac_svac.root"); // // First plot: Average number of clusters per Si plane! // // Define the canvas: TCanvas* c1 = new TCanvas; // Canvas characteristics: Only one histogram in this canvas. c1->Divide(1,1); gPad->SetBorderMode(0); gPad->SetFillColor(10); // Use log scale: gPad->SetLogy(); // Fill plot with red: MeritTuple->SetFillColor(2); // Draw a plot of average number of clusters per Si plane: // We only plot the clusters for the cut 'TkrNumClusters>0'. // Note that 'TkrNumClusters' is part of the SVAC ntuple. // We plot it like it was part of Merit using the same pointer 'MeritTuple'. // Also note that 'TkrNumClusters' is in fact an array. Here Root automatically // sums up all the entries in the array and plots the sum. // We only look at the first 100 events here. MeritTuple->Draw("TkrNumClusters","TkrNumClusters>0","","100"); // More details about the Merit and SVAC ntuple variables are found // in the Merit ntuple decsription available from the main // Instrument Analysis page. // // Draw a profile plot of number of clusters in a // plane vs. reconstructed z direction: // TCanvas* c2 = new TCanvas; c2->Divide(1,1); gPad->SetBorderMode(0); gPad->SetFillColor(10); // Plotting SVAC variables with a cut made from both SVAC and Merit ('TkrRadLength') variables. // Here we use a more complicated cut. '&&' is standard C++ syntax for 'and'. // Use '||' for 'or'. // We only look at the first 5000 events here. MeritTuple->Draw("TkrNumClusters:VtxZDir","TkrNumTracks>0 && TkrNumClusters>0 && TkrRadLength>0.5", "prof","5000"); // // Draw a plot of reconstructed X position against reconstructed Y position: // TCanvas* c3 = new TCanvas; c3->Divide(1,1); gPad->SetBorderMode(0); gPad->SetFillColor(10); MeritTuple->SetFillColor(2); MeritTuple->Draw("VtxY0:VtxX0","TkrNumTracks>0 && abs(VtxY0)<1000 && abs(VtxX0)<1000"); }