{ // // An example to draw various variables in the Merit ntuple! // Original Author: Chen, Xin (xchen@slac.stanford.edu) // Additions and comments by anders (borgland@slac.stanford.edu) // // // To run this macro, do: root drawMerit.C // Or if you are already in ROOT: .x drawMerit.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"); // More details about the Merit ntuple variables are found // in the Merit ntuple decsription available from the main // Instrument Analysis page. // // Plot the number of reconstructed tracks: // // Define the canvas: TCanvas* c1 = new TCanvas; // Divide it up: here only one plot per canvas. c1->Divide(1,1); // gPad->SetBorderMode(0); gPad->SetFillColor(10); // Fill the histogram with red: MeritTuple->SetFillColor(2); // Do the actual plotting: MeritTuple->Draw("TkrNumTracks"); // // Plot the number of reconstructed tracks, but this time // only when there are tracks in the event: // // Define a new canvas: TCanvas* c2 = new TCanvas; c2->Divide(1,1); gPad->SetBorderMode(0); gPad->SetFillColor(10); MeritTuple->SetFillColor(2); // Cuts are added in quotes after the first comma: MeritTuple->Draw("TkrNumTracks","TkrNumTracks>0"); // // Plot the number of reconstructed tracks, but this time // only when there are tracks in the event and there is a // TKR trigger (trigger bits defintion can be found from // the main Instrument Analysis web page): // // Define a new canvas: TCanvas* c3 = new TCanvas; c3->Divide(1,1); gPad->SetBorderMode(0); gPad->SetFillColor(10); MeritTuple->SetFillColor(2); // Cuts are added in quotes after the first comma. // Can have more than one cut: Use '&&' for 'and' and '||' for 'or'. MeritTuple->Draw("TkrNumTracks","TkrNumTracks>0 && (GltWord&4)"); // // Draw a plot of the reconstructed X position against the reconstructed Y position: // // Define a new canvas: TCanvas* c4 = new TCanvas; c4->Divide(1,1); gPad->SetBorderMode(0); gPad->SetFillColor(10); MeritTuple->SetFillColor(2); // Plot with cuts: MeritTuple->Draw("VtxY0:VtxX0","TkrNumTracks>0 && abs(VtxY0)<1000 && abs(VtxX0)<1000"); }