diff --git a/RecoLocalMuon/CSCValidation/macros/README b/RecoLocalMuon/CSCValidation/macros/README index d98220a042922..0f191e97d9395 100644 --- a/RecoLocalMuon/CSCValidation/macros/README +++ b/RecoLocalMuon/CSCValidation/macros/README @@ -1,3 +1,12 @@ +## COMMENTS FROM TIM COX 12.07.2022 + +## This README seems to have lost many of the files it references. +## I suspect it was the README to go with several files and code updates +## for CSCValidation macros perhaps from Nikolai Terentiev + +## TO DO: Decide what to do with it. +## At least useful to document how old macros were run. +------------------------------------------------------------------------------------------- 1. Root scripts and headers for CVS, RecoLocalMuon/CSCValidation/, output root files and text files for storage (examples for run 62232) diff --git a/RecoLocalMuon/CSCValidation/macros/makePlots.C b/RecoLocalMuon/CSCValidation/macros/makePlots.C new file mode 100644 index 0000000000000..8d20315fdd45d --- /dev/null +++ b/RecoLocalMuon/CSCValidation/macros/makePlots.C @@ -0,0 +1,1283 @@ +// makePlots.C makes plots from root file output of CSCValidation + +// Original author: Andy Kubik (NWU) +// - Updated by many people over the past 15 years +// - This version from Sicheng Wang (UCSB) - Jul 2022 +// - but with addition of rechit and segment positions from Andy's version +// - Please contact CSC DPG for current status - 12.07.2022 + +#include "myFunctions.C" + +void makePlots(std::string input_file) { + extern TFile* OpenFiles(std::string path); + extern void makeCSCOccupancy(std::string histoname, TFile * f1, std::string histotitle, std::string savename); + extern void Draw2DTempPlot( + std::string histo, TFile * f1, bool includeME11, std::string savename, bool hasLabels = false); + extern void make1DPlot( + std::string histoname, TFile * f1, std::string histotitle, int statoption, std::string savename); + extern void make1DPlot(std::string histoname, + TFile * f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename); + extern void printEmptyChambers(std::string histoname, std::string oname, TFile * f); + extern void GlobalPosfromTree( + std::string graphname, TFile * f1, int endcap, int station, std::string type, std::string savename); + extern void NikolaiPlots(TFile * f_in, int flag); + extern void makeEffGif(std::string histoname, TFile * f1, std::string histotitle, std::string savename); + extern void Draw2DEfficiency(std::string histo, TFile * f1, std::string title, std::string savename); + extern void make2DPlot( + std::string histoname, TFile * f1, std::string histotitle, int statoption, std::string savename); + extern void make2DPlot(std::string histoname, + TFile * f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename); + extern void makeProfile( + std::string histoname, TFile * f1, std::string histotitle, int statoption, std::string savename); + extern void makeProfile(std::string histoname, + TFile * f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename); + + TFile* f1; + f1 = OpenFiles(input_file); + + //produce occupancy plots + makeCSCOccupancy("GeneralHists/hCSCOccupancy", f1, "CSC Occupancy", "CSCOccupancy.png"); + Draw2DTempPlot("Digis/hOWires", f1, true, "hOWires.png"); + Draw2DTempPlot("Digis/hOStrips", f1, true, "hOStrips.png"); + Draw2DTempPlot("recHits/hORecHits", f1, true, "hORecHits.png"); + Draw2DTempPlot("Segments/hOSegments", f1, true, "hOSegments.png"); + make1DPlot("Digis/hOStripSerial", f1, "Strip Occupancy by Chamber Serial", 10, "hOStripSerial.png"); + make1DPlot("Digis/hOWireSerial", f1, "Wire Occupancy by Chamber Serial", 10, "hOWireSerial.png"); + make1DPlot("Segments/hOSegmentsSerial", f1, "Segment Occupancy by Chamber Serial", 10, "hOSegmentsSerial.png"); + make1DPlot("recHits/hORecHitsSerial", f1, "recHit Occupancy by Chamber Serial", 10, "hORecHitsSerial.png"); + make1DPlot("Trigger/hltBits", f1, "HLT Bits Fired", 0, "hltTriggerBits.png"); + + //Print dead chamber lists + printEmptyChambers("Digis/hOWires", "wire digis", f1); + printEmptyChambers("Digis/hOStrips", "strip digis", f1); + printEmptyChambers("recHits/hORecHits", "rechits", f1); + + //Make global position graphs from trees + GlobalPosfromTree("Global recHit positions ME+1", f1, 1, 1, "rechit", "rHglobal_station_+1.png"); + GlobalPosfromTree("Global recHit positions ME+2", f1, 1, 2, "rechit", "rHglobal_station_+2.png"); + GlobalPosfromTree("Global recHit positions ME+3", f1, 1, 3, "rechit", "rHglobal_station_+3.png"); + GlobalPosfromTree("Global recHit positions ME+4", f1, 1, 4, "rechit", "rHglobal_station_+4.png"); + GlobalPosfromTree("Global recHit positions ME-1", f1, 2, 1, "rechit", "rHglobal_station_-1.png"); + GlobalPosfromTree("Global recHit positions ME-2", f1, 2, 2, "rechit", "rHglobal_station_-2.png"); + GlobalPosfromTree("Global recHit positions ME-3", f1, 2, 3, "rechit", "rHglobal_station_-3.png"); + GlobalPosfromTree("Global recHit positions ME-4", f1, 2, 4, "rechit", "rHglobal_station_-4.png"); + GlobalPosfromTree("Global Segment positions ME+1", f1, 1, 1, "segment", "Sglobal_station_+1.png"); + GlobalPosfromTree("Global Segment positions ME+2", f1, 1, 2, "segment", "Sglobal_station_+2.png"); + GlobalPosfromTree("Global Segment positions ME+3", f1, 1, 3, "segment", "Sglobal_station_+3.png"); + GlobalPosfromTree("Global Segment positions ME+4", f1, 1, 4, "segment", "Sglobal_station_+4.png"); + GlobalPosfromTree("Global Segment positions ME-1", f1, 2, 1, "segment", "Sglobal_station_-1.png"); + GlobalPosfromTree("Global Segment positions ME-2", f1, 2, 2, "segment", "Sglobal_station_-2.png"); + GlobalPosfromTree("Global Segment positions ME-3", f1, 2, 3, "segment", "Sglobal_station_-3.png"); + GlobalPosfromTree("Global Segment positions ME-4", f1, 2, 4, "segment", "Sglobal_station_-4.png"); + + //Nikolai's plots + NikolaiPlots(f1, 1); + NikolaiPlots(f1, 2); + NikolaiPlots(f1, 3); + NikolaiPlots(f1, 4); + + //produce number of X per event plots + make1DPlot("Digis/hStripNFired", f1, "Fired Strips per Event", 111110, "Digis_hStripNFired.png"); + make1DPlot("Digis/hWirenGroupsTotal", f1, "Fired Wires per Event", 111110, "Digis_hWirenGroupsTotal.png"); + make1DPlot("recHits/hRHnrechits", f1, "RecHits per Event", 111110, "recHits_hRHnrechits.png"); + make1DPlot("Segments/hSnSegments", f1, "Segments per Event", 111110, "Segments_hSnSegments.png"); + + //produce wire timing plots + make1DPlot("Digis/hWireTBin+11", f1, "Wire TimeBin Fired ME+1/1", 111110, "Digis_hWireTBin+11.png"); + make1DPlot("Digis/hWireTBin+12", f1, "Wire TimeBin Fired ME+1/2", 111110, "Digis_hWireTBin+12.png"); + make1DPlot("Digis/hWireTBin+13", f1, "Wire TimeBin Fired ME+1/3", 111110, "Digis_hWireTBin+13.png"); + make1DPlot("Digis/hWireTBin+21", f1, "Wire TimeBin Fired ME+2/1", 111110, "Digis_hWireTBin+21.png"); + make1DPlot("Digis/hWireTBin+22", f1, "Wire TimeBin Fired ME+2/2", 111110, "Digis_hWireTBin+22.png"); + make1DPlot("Digis/hWireTBin+31", f1, "Wire TimeBin Fired ME+3/1", 111110, "Digis_hWireTBin+31.png"); + make1DPlot("Digis/hWireTBin+32", f1, "Wire TimeBin Fired ME+3/2", 111110, "Digis_hWireTBin+32.png"); + make1DPlot("Digis/hWireTBin+41", f1, "Wire TimeBin Fired ME+4/1", 111110, "Digis_hWireTBin+41.png"); + make1DPlot("Digis/hWireTBin+42", f1, "Wire TimeBin Fired ME+4/2", 111110, "Digis_hWireTBin+42.png"); + make1DPlot("Digis/hWireTBin-11", f1, "Wire TimeBin Fired ME-1/1", 111110, "Digis_hWireTBin-11.png"); + make1DPlot("Digis/hWireTBin-12", f1, "Wire TimeBin Fired ME-1/2", 111110, "Digis_hWireTBin-12.png"); + make1DPlot("Digis/hWireTBin-13", f1, "Wire TimeBin Fired ME-1/3", 111110, "Digis_hWireTBin-13.png"); + make1DPlot("Digis/hWireTBin-21", f1, "Wire TimeBin Fired ME-2/1", 111110, "Digis_hWireTBin-21.png"); + make1DPlot("Digis/hWireTBin-22", f1, "Wire TimeBin Fired ME-2/2", 111110, "Digis_hWireTBin-22.png"); + make1DPlot("Digis/hWireTBin-31", f1, "Wire TimeBin Fired ME-3/1", 111110, "Digis_hWireTBin-31.png"); + make1DPlot("Digis/hWireTBin-32", f1, "Wire TimeBin Fired ME-3/2", 111110, "Digis_hWireTBin-32.png"); + make1DPlot("Digis/hWireTBin-41", f1, "Wire TimeBin Fired ME-4/1", 111110, "Digis_hWireTBin-41.png"); + make1DPlot("Digis/hWireTBin-42", f1, "Wire TimeBin Fired ME-4/2", 111110, "Digis_hWireTBin-42.png"); + + //produce pedestal noise plots + make1DPlot("PedestalNoise/hStripPedME+11", + f1, + "Pedestal Noise Distribution ME+1/1b", + 111110, + "PedestalNoise_hStripPedME+11.png"); + make1DPlot("PedestalNoise/hStripPedME+14", + f1, + "Pedestal Noise Distribution ME+1/1a", + 111110, + "PedestalNoise_hStripPedME+11a.png"); + make1DPlot("PedestalNoise/hStripPedME+12", + f1, + "Pedestal Noise Distribution ME+1/2", + 111110, + "PedestalNoise_hStripPedME+12.png"); + make1DPlot("PedestalNoise/hStripPedME+13", + f1, + "Pedestal Noise Distribution ME+1/3", + 111110, + "PedestalNoise_hStripPedME+13.png"); + make1DPlot("PedestalNoise/hStripPedME+21", + f1, + "Pedestal Noise Distribution ME+2/1", + 111110, + "PedestalNoise_hStripPedME+21.png"); + make1DPlot("PedestalNoise/hStripPedME+22", + f1, + "Pedestal Noise Distribution ME+2/2", + 111110, + "PedestalNoise_hStripPedME+22.png"); + make1DPlot("PedestalNoise/hStripPedME+31", + f1, + "Pedestal Noise Distribution ME+3/1", + 111110, + "PedestalNoise_hStripPedME+31.png"); + make1DPlot("PedestalNoise/hStripPedME+32", + f1, + "Pedestal Noise Distribution ME+3/2", + 111110, + "PedestalNoise_hStripPedME+32.png"); + make1DPlot("PedestalNoise/hStripPedME+41", + f1, + "Pedestal Noise Distribution ME+4/1", + 111110, + "PedestalNoise_hStripPedME+41.png"); + make1DPlot("PedestalNoise/hStripPedME+42", + f1, + "Pedestal Noise Distribution ME+4/2", + 111110, + "PedestalNoise_hStripPedME+42.png"); + make1DPlot("PedestalNoise/hStripPedME-11", + f1, + "Pedestal Noise Distribution ME-1/1b", + 111110, + "PedestalNoise_hStripPedME-11.png"); + make1DPlot("PedestalNoise/hStripPedME-14", + f1, + "Pedestal Noise Distribution ME-1/1a", + 111110, + "PedestalNoise_hStripPedME-11a.png"); + make1DPlot("PedestalNoise/hStripPedME-12", + f1, + "Pedestal Noise Distribution ME-1/2", + 111110, + "PedestalNoise_hStripPedME-12.png"); + make1DPlot("PedestalNoise/hStripPedME-13", + f1, + "Pedestal Noise Distribution ME-1/3", + 111110, + "PedestalNoise_hStripPedME-13.png"); + make1DPlot("PedestalNoise/hStripPedME-21", + f1, + "Pedestal Noise Distribution ME-2/1", + 111110, + "PedestalNoise_hStripPedME-21.png"); + make1DPlot("PedestalNoise/hStripPedME-22", + f1, + "Pedestal Noise Distribution ME-2/2", + 111110, + "PedestalNoise_hStripPedME-22.png"); + make1DPlot("PedestalNoise/hStripPedME-31", + f1, + "Pedestal Noise Distribution ME-3/1", + 111110, + "PedestalNoise_hStripPedME-31.png"); + make1DPlot("PedestalNoise/hStripPedME-32", + f1, + "Pedestal Noise Distribution ME-3/2", + 111110, + "PedestalNoise_hStripPedME-32.png"); + make1DPlot("PedestalNoise/hStripPedME-41", + f1, + "Pedestal Noise Distribution ME-4/1", + 111110, + "PedestalNoise_hStripPedME-41.png"); + make1DPlot("PedestalNoise/hStripPedME-42", + f1, + "Pedestal Noise Distribution ME-4/2", + 111110, + "PedestalNoise_hStripPedME-42.png"); + + // resolution + make1DPlot("Resolution/hSResid+11", + f1, + "Expected Position from Fit - Reconstructed, ME+1/1b", + 111110, + "Resolution_hSResid+11.png"); + make1DPlot("Resolution/hSResid+12", + f1, + "Expected Position from Fit - Reconstructed, ME+1/2", + 111110, + "Resolution_hSResid+12.png"); + make1DPlot("Resolution/hSResid+13", + f1, + "Expected Position from Fit - Reconstructed, ME+1/3", + 111110, + "Resolution_hSResid+13.png"); + make1DPlot("Resolution/hSResid+14", + f1, + "Expected Position from Fit - Reconstructed, ME+1/1a", + 111110, + "Resolution_hSResid+11a.png"); + make1DPlot("Resolution/hSResid+21", + f1, + "Expected Position from Fit - Reconstructed, ME+2/1", + 111110, + "Resolution_hSResid+21.png"); + make1DPlot("Resolution/hSResid+22", + f1, + "Expected Position from Fit - Reconstructed, ME+2/2", + 111110, + "Resolution_hSResid+22.png"); + make1DPlot("Resolution/hSResid+31", + f1, + "Expected Position from Fit - Reconstructed, ME+3/1", + 111110, + "Resolution_hSResid+31.png"); + make1DPlot("Resolution/hSResid+32", + f1, + "Expected Position from Fit - Reconstructed, ME+3/2", + 111110, + "Resolution_hSResid+32.png"); + make1DPlot("Resolution/hSResid+41", + f1, + "Expected Position from Fit - Reconstructed, ME+4/1", + 111110, + "Resolution_hSResid+41.png"); + make1DPlot("Resolution/hSResid+42", + f1, + "Expected Position from Fit - Reconstructed, ME+4/2", + 111110, + "Resolution_hSResid+42.png"); + make1DPlot("Resolution/hSResid-11", + f1, + "Expected Position from Fit - Reconstructed, ME-1/1b", + 111110, + "Resolution_hSResid-11.png"); + make1DPlot("Resolution/hSResid-12", + f1, + "Expected Position from Fit - Reconstructed, ME-1/2", + 111110, + "Resolution_hSResid-12.png"); + make1DPlot("Resolution/hSResid-13", + f1, + "Expected Position from Fit - Reconstructed, ME-1/3", + 111110, + "Resolution_hSResid-13.png"); + make1DPlot("Resolution/hSResid-14", + f1, + "Expected Position from Fit - Reconstructed, ME-1/1a", + 111110, + "Resolution_hSResid-11a.png"); + make1DPlot("Resolution/hSResid-21", + f1, + "Expected Position from Fit - Reconstructed, ME-2/1", + 111110, + "Resolution_hSResid-21.png"); + make1DPlot("Resolution/hSResid-22", + f1, + "Expected Position from Fit - Reconstructed, ME-2/2", + 111110, + "Resolution_hSResid-22.png"); + make1DPlot("Resolution/hSResid-31", + f1, + "Expected Position from Fit - Reconstructed, ME-3/1", + 111110, + "Resolution_hSResid-31.png"); + make1DPlot("Resolution/hSResid-32", + f1, + "Expected Position from Fit - Reconstructed, ME-3/2", + 111110, + "Resolution_hSResid-32.png"); + make1DPlot("Resolution/hSResid-41", + f1, + "Expected Position from Fit - Reconstructed, ME-4/1", + 111110, + "Resolution_hSResid-41.png"); + make1DPlot("Resolution/hSResid-42", + f1, + "Expected Position from Fit - Reconstructed, ME-4/2", + 111110, + "Resolution_hSResid-42.png"); + + // rechit strip position + make1DPlot("recHits/hRHstpos+11", f1, "Strip Position (ME+1/1b)", 1110, "recHits_hRHstpos+11.png"); + make1DPlot("recHits/hRHstpos+14", f1, "Strip Position (ME+1/1a)", 1110, "recHits_hRHstpos+11a.png"); + make1DPlot("recHits/hRHstpos+12", f1, "Strip Position (ME+1/2)", 1110, "recHits_hRHstpos+12.png"); + make1DPlot("recHits/hRHstpos+13", f1, "Strip Position (ME+1/3)", 1110, "recHits_hRHstpos+13.png"); + make1DPlot("recHits/hRHstpos+21", f1, "Strip Position (ME+2/1)", 1110, "recHits_hRHstpos+21.png"); + make1DPlot("recHits/hRHstpos+22", f1, "Strip Position (ME+2/2)", 1110, "recHits_hRHstpos+22.png"); + make1DPlot("recHits/hRHstpos+31", f1, "Strip Position (ME+3/1)", 1110, "recHits_hRHstpos+31.png"); + make1DPlot("recHits/hRHstpos+32", f1, "Strip Position (ME+3/2)", 1110, "recHits_hRHstpos+32.png"); + make1DPlot("recHits/hRHstpos+41", f1, "Strip Position (ME+4/1)", 1110, "recHits_hRHstpos+41.png"); + make1DPlot("recHits/hRHstpos+42", f1, "Strip Position (ME+4/2)", 1110, "recHits_hRHstpos+42.png"); + make1DPlot("recHits/hRHstpos-11", f1, "Strip Position (ME-1/1b)", 1110, "recHits_hRHstpos-11.png"); + make1DPlot("recHits/hRHstpos-14", f1, "Strip Position (ME-1/1a)", 1110, "recHits_hRHstpos-11a.png"); + make1DPlot("recHits/hRHstpos-12", f1, "Strip Position (ME-1/2)", 1110, "recHits_hRHstpos-12.png"); + make1DPlot("recHits/hRHstpos-13", f1, "Strip Position (ME-1/3)", 1110, "recHits_hRHstpos-13.png"); + make1DPlot("recHits/hRHstpos-21", f1, "Strip Position (ME-2/1)", 1110, "recHits_hRHstpos-21.png"); + make1DPlot("recHits/hRHstpos-22", f1, "Strip Position (ME-2/2)", 1110, "recHits_hRHstpos-22.png"); + make1DPlot("recHits/hRHstpos-31", f1, "Strip Position (ME-3/1)", 1110, "recHits_hRHstpos-31.png"); + make1DPlot("recHits/hRHstpos-32", f1, "Strip Position (ME-3/2)", 1110, "recHits_hRHstpos-32.png"); + make1DPlot("recHits/hRHstpos-41", f1, "Strip Position (ME-4/1)", 1110, "recHits_hRHstpos-41.png"); + make1DPlot("recHits/hRHstpos-42", f1, "Strip Position (ME-4/2)", 1110, "recHits_hRHstpos-42.png"); + + // rechit timing + make1DPlot("recHits/hRHTiming+11", f1, "RecHit Timing ME+1/1b", 111110, "recHits_hRHTiming+11.png"); + make1DPlot("recHits/hRHTiming+14", f1, "RecHit Timing ME+1/1a", 111110, "recHits_hRHTiming+11a.png"); + make1DPlot("recHits/hRHTiming+12", f1, "RecHit Timing ME+1/2", 111110, "recHits_hRHTiming+12.png"); + make1DPlot("recHits/hRHTiming+13", f1, "RecHit Timing ME+1/3", 111110, "recHits_hRHTiming+13.png"); + make1DPlot("recHits/hRHTiming+21", f1, "RecHit Timing ME+2/1", 111110, "recHits_hRHTiming+21.png"); + make1DPlot("recHits/hRHTiming+22", f1, "RecHit Timing ME+2/2", 111110, "recHits_hRHTiming+22.png"); + make1DPlot("recHits/hRHTiming+31", f1, "RecHit Timing ME+3/1", 111110, "recHits_hRHTiming+31.png"); + make1DPlot("recHits/hRHTiming+32", f1, "RecHit Timing ME+3/2", 111110, "recHits_hRHTiming+32.png"); + make1DPlot("recHits/hRHTiming+41", f1, "RecHit Timing ME+4/1", 111110, "recHits_hRHTiming+41.png"); + make1DPlot("recHits/hRHTiming+42", f1, "RecHit Timing ME+4/2", 111110, "recHits_hRHTiming+42.png"); + make1DPlot("recHits/hRHTiming-11", f1, "RecHit Timing ME-1/1b", 111110, "recHits_hRHTiming-11.png"); + make1DPlot("recHits/hRHTiming-14", f1, "RecHit Timing ME-1/1a", 111110, "recHits_hRHTiming-11a.png"); + make1DPlot("recHits/hRHTiming-12", f1, "RecHit Timing ME-1/2", 111110, "recHits_hRHTiming-12.png"); + make1DPlot("recHits/hRHTiming-13", f1, "RecHit Timing ME-1/3", 111110, "recHits_hRHTiming-13.png"); + make1DPlot("recHits/hRHTiming-21", f1, "RecHit Timing ME-2/1", 111110, "recHits_hRHTiming-21.png"); + make1DPlot("recHits/hRHTiming-22", f1, "RecHit Timing ME-2/2", 111110, "recHits_hRHTiming-22.png"); + make1DPlot("recHits/hRHTiming-31", f1, "RecHit Timing ME-3/1", 111110, "recHits_hRHTiming-31.png"); + make1DPlot("recHits/hRHTiming-32", f1, "RecHit Timing ME-3/2", 111110, "recHits_hRHTiming-32.png"); + make1DPlot("recHits/hRHTiming-41", f1, "RecHit Timing ME-4/1", 111110, "recHits_hRHTiming-41.png"); + make1DPlot("recHits/hRHTiming-42", f1, "RecHit Timing ME-4/2", 111110, "recHits_hRHTiming-42.png"); + + // rechit charge + make1DPlot("recHits/hRHSumQ+11", f1, "Sum 3x3 RecHit Charge ME+1/1b", 111110, "recHits_hRHSumQ+11.png"); + make1DPlot("recHits/hRHSumQ+14", f1, "Sum 3x3 RecHit Charge ME+1/1a", 111110, "recHits_hRHSumQ+11a.png"); + make1DPlot("recHits/hRHSumQ+12", f1, "Sum 3x3 RecHit Charge ME+1/2", 111110, "recHits_hRHSumQ+12.png"); + make1DPlot("recHits/hRHSumQ+13", f1, "Sum 3x3 RecHit Charge ME+1/3", 111110, "recHits_hRHSumQ+13.png"); + make1DPlot("recHits/hRHSumQ+21", f1, "Sum 3x3 RecHit Charge ME+2/1", 111110, "recHits_hRHSumQ+21.png"); + make1DPlot("recHits/hRHSumQ+22", f1, "Sum 3x3 RecHit Charge ME+2/2", 111110, "recHits_hRHSumQ+22.png"); + make1DPlot("recHits/hRHSumQ+31", f1, "Sum 3x3 RecHit Charge ME+3/1", 111110, "recHits_hRHSumQ+31.png"); + make1DPlot("recHits/hRHSumQ+32", f1, "Sum 3x3 RecHit Charge ME+3/2", 111110, "recHits_hRHSumQ+32.png"); + make1DPlot("recHits/hRHSumQ+41", f1, "Sum 3x3 RecHit Charge ME+4/1", 111110, "recHits_hRHSumQ+41.png"); + make1DPlot("recHits/hRHSumQ+42", f1, "Sum 3x3 RecHit Charge ME+4/2", 111110, "recHits_hRHSumQ+42.png"); + make1DPlot("recHits/hRHSumQ-11", f1, "Sum 3x3 RecHit Charge ME-1/1b", 111110, "recHits_hRHSumQ-11.png"); + make1DPlot("recHits/hRHSumQ-14", f1, "Sum 3x3 RecHit Charge ME-1/1a", 111110, "recHits_hRHSumQ-11a.png"); + make1DPlot("recHits/hRHSumQ-12", f1, "Sum 3x3 RecHit Charge ME-1/2", 111110, "recHits_hRHSumQ-12.png"); + make1DPlot("recHits/hRHSumQ-13", f1, "Sum 3x3 RecHit Charge ME-1/3", 111110, "recHits_hRHSumQ-13.png"); + make1DPlot("recHits/hRHSumQ-21", f1, "Sum 3x3 RecHit Charge ME-2/1", 111110, "recHits_hRHSumQ-21.png"); + make1DPlot("recHits/hRHSumQ-22", f1, "Sum 3x3 RecHit Charge ME-2/2", 111110, "recHits_hRHSumQ-22.png"); + make1DPlot("recHits/hRHSumQ-31", f1, "Sum 3x3 RecHit Charge ME-3/1", 111110, "recHits_hRHSumQ-31.png"); + make1DPlot("recHits/hRHSumQ-32", f1, "Sum 3x3 RecHit Charge ME-3/2", 111110, "recHits_hRHSumQ-32.png"); + make1DPlot("recHits/hRHSumQ-41", f1, "Sum 3x3 RecHit Charge ME-4/1", 111110, "recHits_hRHSumQ-41.png"); + make1DPlot("recHits/hRHSumQ-42", f1, "Sum 3x3 RecHit Charge ME-4/2", 111110, "recHits_hRHSumQ-42.png"); + + make1DPlot("recHits/hRHRatioQ+11", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/1b", 111110, "recHits_hRHRatioQ+11.png"); + make1DPlot("recHits/hRHRatioQ+14", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/1a", 111110, "recHits_hRHRatioQ+11a.png"); + make1DPlot("recHits/hRHRatioQ+12", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/2", 111110, "recHits_hRHRatioQ+12.png"); + make1DPlot("recHits/hRHRatioQ+13", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/3", 111110, "recHits_hRHRatioQ+13.png"); + make1DPlot("recHits/hRHRatioQ+21", f1, "Charge Ratio (Ql_Qr)/Qt ME+2/1", 111110, "recHits_hRHRatioQ+21.png"); + make1DPlot("recHits/hRHRatioQ+22", f1, "Charge Ratio (Ql_Qr)/Qt ME+2/2", 111110, "recHits_hRHRatioQ+22.png"); + make1DPlot("recHits/hRHRatioQ+31", f1, "Charge Ratio (Ql_Qr)/Qt ME+3/1", 111110, "recHits_hRHRatioQ+31.png"); + make1DPlot("recHits/hRHRatioQ+32", f1, "Charge Ratio (Ql_Qr)/Qt ME+3/2", 111110, "recHits_hRHRatioQ+32.png"); + make1DPlot("recHits/hRHRatioQ+41", f1, "Charge Ratio (Ql_Qr)/Qt ME+4/1", 111110, "recHits_hRHRatioQ+41.png"); + make1DPlot("recHits/hRHRatioQ+42", f1, "Charge Ratio (Ql_Qr)/Qt ME+4/2", 111110, "recHits_hRHRatioQ+42.png"); + make1DPlot("recHits/hRHRatioQ-11", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/1b", 111110, "recHits_hRHRatioQ-11.png"); + make1DPlot("recHits/hRHRatioQ-14", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/1a", 111110, "recHits_hRHRatioQ-11a.png"); + make1DPlot("recHits/hRHRatioQ-12", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/2", 111110, "recHits_hRHRatioQ-12.png"); + make1DPlot("recHits/hRHRatioQ-13", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/3", 111110, "recHits_hRHRatioQ-13.png"); + make1DPlot("recHits/hRHRatioQ-21", f1, "Charge Ratio (Ql_Qr)/Qt ME-2/1", 111110, "recHits_hRHRatioQ-21.png"); + make1DPlot("recHits/hRHRatioQ-22", f1, "Charge Ratio (Ql_Qr)/Qt ME-2/2", 111110, "recHits_hRHRatioQ-22.png"); + make1DPlot("recHits/hRHRatioQ-31", f1, "Charge Ratio (Ql_Qr)/Qt ME-3/1", 111110, "recHits_hRHRatioQ-31.png"); + make1DPlot("recHits/hRHRatioQ-32", f1, "Charge Ratio (Ql_Qr)/Qt ME-3/2", 111110, "recHits_hRHRatioQ-32.png"); + make1DPlot("recHits/hRHRatioQ-41", f1, "Charge Ratio (Ql_Qr)/Qt ME-4/1", 111110, "recHits_hRHRatioQ-41.png"); + make1DPlot("recHits/hRHRatioQ-42", f1, "Charge Ratio (Ql_Qr)/Qt ME-4/2", 111110, "recHits_hRHRatioQ-42.png"); + + //hits on a segment + make1DPlot("Segments/hSnHits+11", f1, "N Hits on Segments ME+1/1b", 1110, "Segments_hSnHits+11.png"); + make1DPlot("Segments/hSnHits+14", f1, "N Hits on Segments ME+1/1a", 1110, "Segments_hSnHits+11a.png"); + make1DPlot("Segments/hSnHits+12", f1, "N Hits on Segments ME+1/2", 1110, "Segments_hSnHits+12.png"); + make1DPlot("Segments/hSnHits+13", f1, "N Hits on Segments ME+1/3", 1110, "Segments_hSnHits+13.png"); + make1DPlot("Segments/hSnHits+21", f1, "N Hits on Segments ME+2/1", 1110, "Segments_hSnHits+21.png"); + make1DPlot("Segments/hSnHits+22", f1, "N Hits on Segments ME+2/2", 1110, "Segments_hSnHits+22.png"); + make1DPlot("Segments/hSnHits+31", f1, "N Hits on Segments ME+3/1", 1110, "Segments_hSnHits+31.png"); + make1DPlot("Segments/hSnHits+32", f1, "N Hits on Segments ME+3/2", 1110, "Segments_hSnHits+32.png"); + make1DPlot("Segments/hSnHits+41", f1, "N Hits on Segments ME+4/1", 1110, "Segments_hSnHits+41.png"); + make1DPlot("Segments/hSnHits+42", f1, "N Hits on Segments ME+4/2", 1110, "Segments_hSnHits+42.png"); + make1DPlot("Segments/hSnHits-11", f1, "N Hits on Segments ME-1/1b", 1110, "Segments_hSnHits-11.png"); + make1DPlot("Segments/hSnHits-14", f1, "N Hits on Segments ME-1/1a", 1110, "Segments_hSnHits-11a.png"); + make1DPlot("Segments/hSnHits-12", f1, "N Hits on Segments ME-1/2", 1110, "Segments_hSnHits-12.png"); + make1DPlot("Segments/hSnHits-13", f1, "N Hits on Segments ME-1/3", 1110, "Segments_hSnHits-13.png"); + make1DPlot("Segments/hSnHits-21", f1, "N Hits on Segments ME-2/1", 1110, "Segments_hSnHits-21.png"); + make1DPlot("Segments/hSnHits-22", f1, "N Hits on Segments ME-2/2", 1110, "Segments_hSnHits-22.png"); + make1DPlot("Segments/hSnHits-31", f1, "N Hits on Segments ME-3/1", 1110, "Segments_hSnHits-31.png"); + make1DPlot("Segments/hSnHits-32", f1, "N Hits on Segments ME-3/2", 1110, "Segments_hSnHits-32.png"); + make1DPlot("Segments/hSnHits-41", f1, "N Hits on Segments ME-4/1", 1110, "Segments_hSnHits-41.png"); + make1DPlot("Segments/hSnHits-42", f1, "N Hits on Segments ME-4/2", 1110, "Segments_hSnHits-42.png"); + + // segment chi2 + make1DPlot("Segments/hSChiSq+11", f1, "Segment Chi2/ndof ME+1/1b", 111110, "Segments_hSChiSq+11.png"); + make1DPlot("Segments/hSChiSq+14", f1, "Segment Chi2/ndof ME+1/1a", 111110, "Segments_hSChiSq+11a.png"); + make1DPlot("Segments/hSChiSq+12", f1, "Segment Chi2/ndof ME+1/2", 111110, "Segments_hSChiSq+12.png"); + make1DPlot("Segments/hSChiSq+13", f1, "Segment Chi2/ndof ME+1/3", 111110, "Segments_hSChiSq+13.png"); + make1DPlot("Segments/hSChiSq+21", f1, "Segment Chi2/ndof ME+2/1", 111110, "Segments_hSChiSq+21.png"); + make1DPlot("Segments/hSChiSq+22", f1, "Segment Chi2/ndof ME+2/2", 111110, "Segments_hSChiSq+22.png"); + make1DPlot("Segments/hSChiSq+31", f1, "Segment Chi2/ndof ME+3/1", 111110, "Segments_hSChiSq+31.png"); + make1DPlot("Segments/hSChiSq+32", f1, "Segment Chi2/ndof ME+3/2", 111110, "Segments_hSChiSq+32.png"); + make1DPlot("Segments/hSChiSq+41", f1, "Segment Chi2/ndof ME+4/1", 111110, "Segments_hSChiSq+41.png"); + make1DPlot("Segments/hSChiSq+42", f1, "Segment Chi2/ndof ME+4/2", 111110, "Segments_hSChiSq+42.png"); + make1DPlot("Segments/hSChiSq-11", f1, "Segment Chi2/ndof ME-1/1b", 111110, "Segments_hSChiSq-11.png"); + make1DPlot("Segments/hSChiSq-14", f1, "Segment Chi2/ndof ME-1/1a", 111110, "Segments_hSChiSq-11a.png"); + make1DPlot("Segments/hSChiSq-12", f1, "Segment Chi2/ndof ME-1/2", 111110, "Segments_hSChiSq-12.png"); + make1DPlot("Segments/hSChiSq-13", f1, "Segment Chi2/ndof ME-1/3", 111110, "Segments_hSChiSq-13.png"); + make1DPlot("Segments/hSChiSq-21", f1, "Segment Chi2/ndof ME-2/1", 111110, "Segments_hSChiSq-21.png"); + make1DPlot("Segments/hSChiSq-22", f1, "Segment Chi2/ndof ME-2/2", 111110, "Segments_hSChiSq-22.png"); + make1DPlot("Segments/hSChiSq-31", f1, "Segment Chi2/ndof ME-3/1", 111110, "Segments_hSChiSq-31.png"); + make1DPlot("Segments/hSChiSq-32", f1, "Segment Chi2/ndof ME-3/2", 111110, "Segments_hSChiSq-32.png"); + make1DPlot("Segments/hSChiSq-41", f1, "Segment Chi2/ndof ME-4/1", 111110, "Segments_hSChiSq-41.png"); + make1DPlot("Segments/hSChiSq-42", f1, "Segment Chi2/ndof ME-4/2", 111110, "Segments_hSChiSq-42.png"); + + //miscellaneous + make1DPlot("Segments/hSGlobalPhi", f1, "Segment Global Phi", 1110, "Segments_hSGlobalPhi.png"); + make1DPlot("Segments/hSGlobalTheta", f1, "Segment Global Theta", 1110, "Segments_hSGlobalTheta.png"); + + //STA muons + make1DPlot("STAMuons/trNSAMuons", f1, "Number STA Muons per Event", 111110, "STAMuons_nMuons.png"); + make1DPlot("STAMuons/trLength", f1, "Length along Z of STA Muons", 111110, "STAMuons_zLength.png"); + make1DPlot("STAMuons/trN", f1, "Number hits per STA Muons", 111110, "STAMuons_nHits.png"); + make1DPlot("STAMuons/trNCSC", f1, "Number CSC hits per STA Muons", 111110, "STAMuons_nCSCHits.png"); + make1DPlot("STAMuons/trNp", f1, "Number hits per STA Muons (plus side)", 111110, "STAMuons_nHits_plus.png"); + make1DPlot("STAMuons/trNCSCm", f1, "Number CSC hits per STA Muons (plus side)", 111110, "STAMuons_nCSCHits_plus.png"); + make1DPlot("STAMuons/trNm", f1, "Number hits per STA Muons (minus side)", 111110, "STAMuons_nHits_minus.png"); + make1DPlot( + "STAMuons/trNCSCp", f1, "Number CSC hits per STA Muons (minus side)", 111110, "STAMuons_nCSCHits_minus.png"); + make1DPlot("STAMuons/trNormChi2", f1, "Normalized Chi^2 of STA Muons", 111110, "STAMuons_chi2.png"); + make1DPlot("STAMuons/trP", f1, "Momentum of STA Muons", 111110, "STAMuons_p.png"); + make1DPlot("STAMuons/trPT", f1, "Transverse Momentum of STA Muons", 111110, "STAMuons_pt.png"); + + //Nikolai's plots + NikolaiPlots(f1, 1); + NikolaiPlots(f1, 2); + NikolaiPlots(f1, 3); + NikolaiPlots(f1, 4); + + //efficiency plots + //TODO: change how this is done (here rather than in CSCValidation.cc) + makeEffGif("Efficiency/hRHSTE", f1, "RecHit Efficiency", "Efficiency_hRHEff.png"); + makeEffGif("Efficiency/hSSTE", f1, "Segment Efficiency", "Efficiency_hSEff.png"); + Draw2DEfficiency("Efficiency/hRHSTE2", f1, "RecHit Efficiency 2D", "Efficiency_hRHEff2.png"); + Draw2DEfficiency("Efficiency/hSSTE2", f1, "Segment Efficiency 2D", "Efficiency_hSEff2.png"); + Draw2DEfficiency("Efficiency/hWireSTE2", f1, "Wire Efficiency 2D", "Efficiency_hWireEff2.png"); + Draw2DEfficiency("Efficiency/hStripSTE2", f1, "Strip Efficiency 2D", "Efficiency_hStripEff2.png"); + //Draw2DTempPlot("Efficiency/hSensitiveAreaEvt", f1, false, "Efficiency_hEvts2.png"); + Draw2DEfficiency("Efficiency/hSensitiveAreaEvt", f1, "Events in Sensitive Area", "Efficiency_hEvts2.png"); + + makeEffGif("Efficiency/hRHSTETight", f1, "RecHit Efficiency Tight", "Efficiency_hRHEff_tight.png"); + makeEffGif("Efficiency/hSSTETight", f1, "Segment Efficiency Tight", "Efficiency_hSEff_tight.png"); + Draw2DEfficiency("Efficiency/hRHSTE2Tight", f1, "RecHit Efficiency 2D Tight", "Efficiency_hRHEff2_tight.png"); + Draw2DEfficiency("Efficiency/hSSTE2Tight", f1, "Segment Efficiency 2D Tight", "Efficiency_hSEff2_tight.png"); + Draw2DEfficiency("Efficiency/hWireSTE2Tight", f1, "Wire Efficiency 2D Tight", "Efficiency_hWireEff2_tight.png"); + Draw2DEfficiency("Efficiency/hStripSTE2Tight", f1, "Strip Efficiency 2D Tight", "Efficiency_hStripEff2_tight.png"); + + //Draw2DTempPlot2("Efficiency/hRHSTE2", f1, true, "Efficiency_hRHEff2.png"); + //Draw2DTempPlot2("Efficiency/hSSTE2", f1, true, "Efficiency_hSEff2.png"); + //Draw2DTempPlot2("Efficiency/hWireSTE2", f1, true, "Efficiency_hWireEff2.png"); + //Draw2DTempPlot2("Efficiency/hWireSTE2", f1, true, "Efficiency_hStripEff2.png"); + + //Timing Monitor + make1DPlot("TimeMonitoring/ALCT_getBX", + f1, + "ALCT position in L1A window", + "CSCALCTDigi.getBX()", + "", + 111110, + "ALCT_getBX.png"); + make1DPlot("TimeMonitoring/ALCT_getFullBX", + f1, + "BXN l1a_delay clocks ago from L1A", + "CSCALCTDigi.getFullBX()", + "", + 111110, + "ALCT_getFullBX.png"); + make1DPlot("TimeMonitoring/BX_L1CSCCand", f1, "BX of L1GMT CSC Cand", 111110, "BX_L1CSCCand.png"); + make1DPlot("TimeMonitoring/BX_L1CSCCand_w_beamHalo", + f1, + "BX of L1GMT CSC Cand (quality=1)", + 111110, + "BX_L1CSCCand_w_beamHalo.png"); + make1DPlot( + "TimeMonitoring/CLCT_getBX", f1, "Last two bits of CLCT bxn", "CSCCLCTDigi.getBX()", "", 111110, "CLCT_getBX.png"); + make1DPlot("TimeMonitoring/CLCT_getFullBX", + f1, + "CLCT bxn at pretrigger", + "CSCCLCTDigi.getFullBX()", + "", + 111110, + "CLCT_getFullBX.png"); + make1DPlot("TimeMonitoring/CorrelatedLCTS_getBX", f1, "CorrelatedLCT.getBX()", 111110, "CorrelatedLCTS_getBX.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime", + f1, + "ALCTMatchTime (all chambers)", + "ALCT position in CLCT window (bx)", + "", + 1110, + "TMB_ALCTMatchTime.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime+1", f1, "TMB_ALCTMatchTime (ME +1)", 1110, "TMB_ALCTMatchTime+1.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime+2", f1, "TMB_ALCTMatchTime (ME +2)", 1110, "TMB_ALCTMatchTime+2.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime+3", f1, "TMB_ALCTMatchTime (ME +3)", 1110, "TMB_ALCTMatchTime+3.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime+4", f1, "TMB_ALCTMatchTime (ME +4)", 1110, "TMB_ALCTMatchTime+4.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime-1", f1, "TMB_ALCTMatchTime (ME -1)", 1110, "TMB_ALCTMatchTime-1.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime-2", f1, "TMB_ALCTMatchTime (ME -2)", 1110, "TMB_ALCTMatchTime-2.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime-3", f1, "TMB_ALCTMatchTime (ME -3)", 1110, "TMB_ALCTMatchTime-3.png"); + make1DPlot("TimeMonitoring/TMB_ALCTMatchTime-4", f1, "TMB_ALCTMatchTime (ME -4)", 1110, "TMB_ALCTMatchTime-4.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+11", f1, "TMB_ALCTMatchTime (ME +1/1b)", 1110, "TMB_ALCTMatchTime+11b.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+12", f1, "TMB_ALCTMatchTime (ME +1/2)", 1110, "TMB_ALCTMatchTime+12.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+13", f1, "TMB_ALCTMatchTime (ME +1/3)", 1110, "TMB_ALCTMatchTime+13.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+14", f1, "TMB_ALCTMatchTime (ME +1/1a)", 1110, "TMB_ALCTMatchTime+11a.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+21", f1, "TMB_ALCTMatchTime (ME +2/1)", 1110, "TMB_ALCTMatchTime+21.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+22", f1, "TMB_ALCTMatchTime (ME +2/2)", 1110, "TMB_ALCTMatchTime+23.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+31", f1, "TMB_ALCTMatchTime (ME +3/1)", 1110, "TMB_ALCTMatchTime+31.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+32", f1, "TMB_ALCTMatchTime (ME +3/2)", 1110, "TMB_ALCTMatchTime+33.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+41", f1, "TMB_ALCTMatchTime (ME +4/1)", 1110, "TMB_ALCTMatchTime+41.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime+42", f1, "TMB_ALCTMatchTime (ME +4/2)", 1110, "TMB_ALCTMatchTime+43.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-11", f1, "TMB_ALCTMatchTime (ME -1/1b)", 1110, "TMB_ALCTMatchTime-11b.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-12", f1, "TMB_ALCTMatchTime (ME -1/2)", 1110, "TMB_ALCTMatchTime-12.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-13", f1, "TMB_ALCTMatchTime (ME -1/3)", 1110, "TMB_ALCTMatchTime-13.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-14", f1, "TMB_ALCTMatchTime (ME -1/1a)", 1110, "TMB_ALCTMatchTime-11a.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-21", f1, "TMB_ALCTMatchTime (ME -2/1)", 1110, "TMB_ALCTMatchTime-21.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-22", f1, "TMB_ALCTMatchTime (ME -2/2)", 1110, "TMB_ALCTMatchTime-22.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-31", f1, "TMB_ALCTMatchTime (ME -3/1)", 1110, "TMB_ALCTMatchTime-31.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-32", f1, "TMB_ALCTMatchTime (ME -3/2)", 1110, "TMB_ALCTMatchTime-32.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-41", f1, "TMB_ALCTMatchTime (ME -4/1)", 1110, "TMB_ALCTMatchTime-41.png"); + make1DPlot( + "TimeMonitoring/TMB_ALCTMatchTime-42", f1, "TMB_ALCTMatchTime (ME -4/2)", 1110, "TMB_ALCTMatchTime-42.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount", + f1, + "TMB BXN count at L1A arrival", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount+1", + f1, + "TMB BXN count at L1A arrival (Station +1)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount+1.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount+2", + f1, + "TMB BXN count at L1A arrival (Station +2)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount+2.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount+3", + f1, + "TMB BXN count at L1A arrival (Station +3)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount+3.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount+4", + f1, + "TMB BXN count at L1A arrival (Station +4)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount+4.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount-1", + f1, + "TMB BXN count at L1A arrival (Station -1)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount-1.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount-2", + f1, + "TMB BXN count at L1A arrival (Station -2)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount-2.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount-3", + f1, + "TMB BXN count at L1A arrival (Station -3)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount-3.png"); + make1DPlot("TimeMonitoring/TMB_BXNCount-4", + f1, + "TMB BXN count at L1A arrival (Station -4)", + "TMBHeader.BXNCount()", + "", + 1110, + "TMB_BXNCount-4.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring", + "ns", + "", + 1110, + "diff_opposite_endcaps.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+11", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +1/1b)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+11b.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+12", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +1/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+12.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+13", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +1/3)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+13.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+14", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +1/1a)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+11a.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+21", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +2/1)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+21.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+22", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +2/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+22.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+31", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +3/1)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+31.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+32", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +3/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+32.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+41", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +4/1)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+41.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType+42", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME +4/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType+42.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-11", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -1/1b)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-11b.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-12", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -1/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-12.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-13", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -1/3)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-13.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-14", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -1/1a)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-11a.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-21", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -2/1)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-21.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-22", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -2/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-22.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-31", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -3/1)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-31.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-32", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -3/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-32.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-41", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -4/1)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-41.png"); + make1DPlot("TimeMonitoring/diff_opposite_endcaps_byType-42", + f1, + "#Delta t [ME+]-[ME-] for chambers in the same station and ring (ME -4/2)", + "ns", + "", + 1110, + "diff_opposite_endcaps_byType-42.png"); + make1DPlot("TimeMonitoring/h1D_TMB_ALCT_rel_L1A", f1, "h1D_TMB_ALCT_rel_L1A", 1110, "h1D_TMB_ALCT_rel_L1A.png"); + make2DPlot("TimeMonitoring/h2D_TMB_ALCT_rel_L1A", f1, "h2D_TMB_ALCT_rel_L1A", 1110, "h2D_TMB_ALCT_rel_L1A.png"); + make2DPlot("TimeMonitoring/h2D_TMB_ALCT_rel_L1A_by_ring", + f1, + "h2D_TMB_ALCT_rel_L1A_by_ring", + 1110, + "h2D_TMB_ALCT_rel_L1A_by_ring.png"); + make2DPlot("TimeMonitoring/h2D_TMB_ALCT_rel_L1A_v_ALCTT0KeyWG", + f1, + "h2D_TMB_ALCT_rel_L1A_v_ALCTT0KeyWG", + 1110, + "h2D_TMB_ALCT_rel_L1A_v_ALCTT0KeyWG.png"); + make2DPlot("TimeMonitoring/n_ALCTs_v_BX_L1CSCCand", + f1, + "Number of ALCTs vs. BX of L1GMT CSC Cand", + "bxn", + "", + 1110, + "n_ALCTs_v_BX_L1CSCCand.png"); + make2DPlot("TimeMonitoring/n_ALCTs_v_BX_L1CSCCand_w_beamHalo", + f1, + "Number of ALCTs vs. BX of L1GMT CSC Cand (quality = 1)", + "bxn", + "", + 1110, + "n_ALCTs_v_BX_L1CSCCand_w_beamHalo.png"); + make2DPlot("TimeMonitoring/n_CLCTs_v_BX_L1CSCCand", + f1, + "Number of CLCTs vs. BX of L1GMT CSC Cand", + "bxn", + "", + 1110, + "n_CLCTs_v_BX_L1CSCCand.png"); + make2DPlot("TimeMonitoring/n_CLCTs_v_BX_L1CSCCand_w_beamHalo", + f1, + "Number of CLCTs vs. BX of L1GMT CSC Cand (quality = 1)", + "bxn", + "", + 1110, + "n_CLCTs_v_BX_L1CSCCand_w_beamHalo.png"); + make2DPlot("TimeMonitoring/n_CorrelatedLCTs_v_BX_L1CSCCand", + f1, + "Number of CorrelatedLCTs vs. BX of L1GMT CSC Cand", + "bxn", + "", + 1110, + "n_CorrelatedLCTs_v_BX_L1CSCCand.png"); + make2DPlot("TimeMonitoring/n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo", + f1, + "Number of CorrelatedLCTs vs. BX of L1GMT CSC Cand (quality = 1)", + "bxn", + "", + 1110, + "n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo.png"); + make2DPlot("TimeMonitoring/n_RecHits_v_BX_L1CSCCand", + f1, + "Number of RecHits vs. BX of L1GMT CSC Cand", + "bxn", + "", + 1110, + "n_RecHits_v_BX_L1CSCCand.png"); + make2DPlot("TimeMonitoring/n_RecHits_v_BX_L1CSCCand_w_beamHalo", + f1, + "Number of RecHits vs. BX of L1GMT CSC Cand (quality = 1)", + "bxn", + "", + 1110, + "n_RecHits_v_BX_L1CSCCand_w_beamHalo.png"); + make2DPlot("TimeMonitoring/n_Segments_v_BX_L1CSCCand", + f1, + "Number of Segments vs. BX of L1GMT CSC Cand", + "bxn", + "", + 1110, + "n_Segments_v_BX_L1CSCCand.png"); + make2DPlot("TimeMonitoring/n_Segments_v_BX_L1CSCCand_w_beamHalo", + f1, + "Number of Segments vs. BX of L1GMT CSC Cand (quality = 1)", + "bxn", + "", + 1110, + "n_Segments_v_BX_L1CSCCand_w_beamHalo.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+11", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +1/1b)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+11b.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+12", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +1/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+12.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+13", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +1/3)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+13.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+14", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +1/1a)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+11a.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+21", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +2/1)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+21.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+22", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +2/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+22.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+31", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +3/1)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+31.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+32", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +3/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+32.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+41", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +4/1)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+41.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+42", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME +4/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG+42.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-11", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -1/1b)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-11b.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-12", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -1/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-12.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-13", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -1/3)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-13.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-14", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -1/1a)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-11a.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-21", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -2/1)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-21.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-22", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -2/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-23.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-31", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -3/1)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-31.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-32", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -3/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-32.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-41", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -4/1)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-41.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-42", + f1, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG (ME -4/2)", + 1110, + "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG-42.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+11", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +1/1b)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+11b.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+12", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +1/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+12.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+13", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +1/3)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+13.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+14", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +1/1a)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+11a.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+21", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +2/1)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+21.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+22", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +2/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+22.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+31", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +3/1)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+31.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+32", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +3/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+32.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+41", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +4/1)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+41.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+42", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME +4/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG+42.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-11", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -1/1b)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-11b.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-12", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -1/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-12.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-13", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -1/3)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-13.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-14", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -1/1a)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-11a.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-21", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -2/1)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-21.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-22", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -2/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-22.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-31", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -3/1)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-31.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-32", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -3/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-32.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-41", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -4/1)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-41.png"); + makeProfile("TimeMonitoring/prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-42", + f1, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG (ME -4/2)", + 1110, + "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG-42.png"); + makeProfile("TimeMonitoring/prof_TMB_ALCTMatchTime", + f1, + "Mean ALCTMatchTime by chamber", + "serialized chamber number", + "ALCT position in CLCT window [bx]", + 1110, + "prof_TMB_ALCTMatchTime.png"); + makeProfile("TimeMonitoring/prof_TMB_ALCTMatchTime_v_ALCT0KeyWG", + f1, + "Mean ALCTMatchTime by ALCT0KeyWG", + "wire group", + "ALCT position in CLCT window [bx]", + 1110, + "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG.png"); + makeProfile("TimeMonitoring/prof_TMB_ALCT_rel_L1A", + f1, + "Mean (L1A - ALCT) at TMB by chamber", + "serialized chamber number", + "L1A - ALCT at TMB [bx]", + 1110, + "prof_TMB_ALCT_rel_L1A.png"); + makeProfile("TimeMonitoring/prof_TMB_ALCT_rel_L1A_by_ring", + f1, + "Mean (L1A - ALCT) at TMB by ring", + "ring number", + "L1A - ALCT at TMB [bx]", + 1110, + "prof_TMB_ALCT_rel_L1A_by_ring.png"); + makeProfile("TimeMonitoring/prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG", + f1, + "Mean (L1A - ALCT) at TMB by ALCT0KeyWG", + "wire group", + "L1A - ALCT at TMB [bx]", + 1110, + "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG.png"); + make2DPlot("TimeMonitoring/seg_time_vs_absglobZ", + f1, + "Segment time vs. abs(z position)", + "|z| of segment [cm]", + "ns", + 1110, + "seg_time_vs_absglobZ.png"); + make2DPlot("TimeMonitoring/seg_time_vs_distToIP", + f1, + "Segment time vs. distance to IP", + " distance of segment to IP [cm]", + "ns", + 1110, + "seg_time_vs_distToIP.png"); + make2DPlot("TimeMonitoring/seg_time_vs_globZ", + f1, + "Segment time vs. z position", + "z of segment [cm]", + "ns", + 1110, + "seg_time_vs_globZ.png"); + makeProfile("TimeMonitoring/timeChamber", + f1, + "Mean segment time by chamber", + "serialized chamber number", + "ns", + 1110, + "timeChamber.png"); + makeProfile("TimeMonitoring/timeChamberByType+11", + f1, + "Segment mean time by chamber (ME +1/1b)", + "chamber number", + "ns", + 1110, + "timeChamberByType+11b.png"); + makeProfile("TimeMonitoring/timeChamberByType+12", + f1, + "Segment mean time by chamber (ME +1/3)", + "chamber number", + "ns", + 1110, + "timeChamberByType+12.png"); + makeProfile("TimeMonitoring/timeChamberByType+13", + f1, + "Segment mean time by chamber (ME +1/3)", + "chamber number", + "ns", + 1110, + "timeChamberByType+13.png"); + makeProfile("TimeMonitoring/timeChamberByType+14", + f1, + "Segment mean time by chamber (ME +1/1a)", + "chamber number", + "ns", + 1110, + "timeChamberByType+11a.png"); + makeProfile("TimeMonitoring/timeChamberByType+21", + f1, + "Segment mean time by chamber (ME +2/1)", + "chamber number", + "ns", + 1110, + "timeChamberByType+21.png"); + makeProfile("TimeMonitoring/timeChamberByType+22", + f1, + "Segment mean time by chamber (ME +2/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType+22.png"); + makeProfile("TimeMonitoring/timeChamberByType+31", + f1, + "Segment mean time by chamber (ME +3/1)", + "chamber number", + "ns", + 1110, + "timeChamberByType+31.png"); + makeProfile("TimeMonitoring/timeChamberByType+32", + f1, + "Segment mean time by chamber (ME +3/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType+32.png"); + makeProfile("TimeMonitoring/timeChamberByType+41", + f1, + "Segment mean time by chamber (ME +4/1)", + "chamber number", + "ns", + 1110, + "timeChamberByType+41.png"); + makeProfile("TimeMonitoring/timeChamberByType+42", + f1, + "Segment mean time by chamber (ME +4/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType+42.png"); + makeProfile("TimeMonitoring/timeChamberByType-11", + f1, + "Segment mean time by chamber (ME -1/1b)", + "chamber number", + "ns", + 1110, + "timeChamberByType-11b.png"); + makeProfile("TimeMonitoring/timeChamberByType-12", + f1, + "Segment mean time by chamber (ME -1/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType-12.png"); + makeProfile("TimeMonitoring/timeChamberByType-13", + f1, + "Segment mean time by chamber (ME -1/3)", + "chamber number", + "ns", + 1110, + "timeChamberByType-13.png"); + makeProfile("TimeMonitoring/timeChamberByType-14", + f1, + "Segment mean time by chamber (ME -1/1a)", + "chamber number", + "ns", + 1110, + "timeChamberByType-11a.png"); + makeProfile("TimeMonitoring/timeChamberByType-21", + f1, + "Segment mean time by chamber (ME -2/1)", + "chamber number", + "ns", + 1110, + "timeChamberByType-21.png"); + makeProfile("TimeMonitoring/timeChamberByType-22", + f1, + "Segment mean time by chamber (ME -2/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType-22.png"); + makeProfile("TimeMonitoring/timeChamberByType-31", + f1, + "Segment mean time by chamber (ME -3/1)", + "chamber number", + "ns", + 1110, + "timeChamberByType-31.png"); + makeProfile("TimeMonitoring/timeChamberByType-32", + f1, + "Segment mean time by chamber (ME -3/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType-32.png"); + makeProfile("TimeMonitoring/timeChamberByType-41", + f1, + "Segment mean time by chamber (ME -4/1)", + "chamber number", + "ns", + 1110, + "timeChamberByType-41.png"); + makeProfile("TimeMonitoring/timeChamberByType-42", + f1, + "Segment mean time by chamber (ME -4/2)", + "chamber number", + "ns", + 1110, + "timeChamberByType-42.png"); +} diff --git a/RecoLocalMuon/CSCValidation/macros/makePlots.sh b/RecoLocalMuon/CSCValidation/macros/makePlots.sh index 6cc62e6de5c1b..db15342fa1c20 100755 --- a/RecoLocalMuon/CSCValidation/macros/makePlots.sh +++ b/RecoLocalMuon/CSCValidation/macros/makePlots.sh @@ -1,272 +1,13 @@ -#!/bin/bash - -# this script will take output histos from CSCValidation and make 'nice' looking .pngs -# -# to run this script, do -# ./makePlots.sh -# where is the paths to the output root files from CSCValiation - -# example: ./makePlots.sh CMSSW_1_8_0_pre8/src/RecoLocalMuon/CSCValidation/test/validationHists.root - +#!/bin/bash +## +## Call makePlots.C to make plots from root file output of CSCValidation +## CSC DPG - Tim Cox - 15.07.2022 +## Run it like +## ./makePlots.sh path_to_root_file +## The plots are png files and produced in the current directory +## ARG1=$1 +echo "Called with arg = "${ARG1} -MACRO=makePlots.C -cat > ${MACRO}<Reset(); - gROOT->ProcessLine(".L myFunctions.C"); - - std::string Path = "${ARG1}"; - - TFile *f1; - f1 = OpenFiles(Path); - - //produce occupancy plots - makeCSCOccupancy("GeneralHists/hCSCOccupancy", f1, "CSC Occupancy","CSCOccupancy.png"); - Draw2DTempPlot("Digis/hOWires", f1, true, "hOWires.png"); - Draw2DTempPlot("Digis/hOStrips", f1, true, "hOStrips.png"); - Draw2DTempPlot("recHits/hORecHits", f1, true, "hORecHits.png"); - Draw2DTempPlot("Segments/hOSegments", f1, true, "hOSegments.png"); - make1DPlot("Digis/hOStripSerial",f1,"Strip Occupancy by Chamber Serial", 10, "hOStripSerial.png"); - make1DPlot("Digis/hOWireSerial",f1,"Wire Occupancy by Chamber Serial", 10, "hOWireSerial.png"); - make1DPlot("Segments/hOSegmentsSerial",f1,"Segment Occupancy by Chamber Serial", 10, "hOSegmentsSerial.png"); - make1DPlot("recHits/hORecHitsSerial",f1,"recHit Occupancy by Chamber Serial", 10, "hORecHitsSerial.png"); - - //Print dead chamber lists - printEmptyChambers("Digis/hOWires", "wire digis", f1); - printEmptyChambers("Digis/hOStrips", "strip digis", f1); - printEmptyChambers("recHits/hORecHits", "rechits", f1); - - //Make global position graphs from trees - GlobalPosfromTree("Global recHit positions ME+1", f1, 1, 1, "rechit", "rHglobal_station_+1.png"); - GlobalPosfromTree("Global recHit positions ME+2", f1, 1, 2, "rechit", "rHglobal_station_+2.png"); - GlobalPosfromTree("Global recHit positions ME+3", f1, 1, 3, "rechit", "rHglobal_station_+3.png"); - GlobalPosfromTree("Global recHit positions ME+4", f1, 1, 4, "rechit", "rHglobal_station_+4.png"); - GlobalPosfromTree("Global recHit positions ME-1", f1, 2, 1, "rechit", "rHglobal_station_-1.png"); - GlobalPosfromTree("Global recHit positions ME-2", f1, 2, 2, "rechit", "rHglobal_station_-2.png"); - GlobalPosfromTree("Global recHit positions ME-3", f1, 2, 3, "rechit", "rHglobal_station_-3.png"); - GlobalPosfromTree("Global recHit positions ME-4", f1, 2, 4, "rechit", "rHglobal_station_-4.png"); - GlobalPosfromTree("Global Segment positions ME+1", f1, 1, 1, "segment", "Sglobal_station_+1.png"); - GlobalPosfromTree("Global Segment positions ME+2", f1, 1, 2, "segment", "Sglobal_station_+2.png"); - GlobalPosfromTree("Global Segment positions ME+3", f1, 1, 3, "segment", "Sglobal_station_+3.png"); - GlobalPosfromTree("Global Segment positions ME+4", f1, 1, 4, "segment", "Sglobal_station_+4.png"); - GlobalPosfromTree("Global Segment positions ME-1", f1, 2, 1, "segment", "Sglobal_station_-1.png"); - GlobalPosfromTree("Global Segment positions ME-2", f1, 2, 2, "segment", "Sglobal_station_-2.png"); - GlobalPosfromTree("Global Segment positions ME-3", f1, 2, 3, "segment", "Sglobal_station_-3.png"); - GlobalPosfromTree("Global Segment positions ME-4", f1, 2, 4, "segment", "Sglobal_station_-4.png"); - - //Nikolai's plots - NikolaiPlots(f1,1); - NikolaiPlots(f1,2); - NikolaiPlots(f1,3); - NikolaiPlots(f1,4); - - //produce number of X per event plots - make1DPlot("Digis/hStripNFired",f1,"Fired Strips per Event", 1110, "Digis_hStripNFired.png"); - make1DPlot("Digis/hWirenGroupsTotal",f1,"Fired Wires per Event", 1110, "Digis_hWirenGroupsTotal.png"); - make1DPlot("recHits/hRHnrechits",f1,"RecHits per Event", 1110, "recHits_hRHnrechits.png"); - make1DPlot("Segments/hSnSegments",f1,"Segments per Event", 1110, "Segments_hSnSegments.png"); - - //efficiency plots - makeEffGif("Efficiency/hRHSTE", f1, "RecHit Efficiecy", "Efficiency_hRHEff.png"); - makeEffGif("Efficiency/hSSTE", f1, "Segment Efficiecy", "Efficiency_hSEff.png"); - Draw2DEfficiency("Efficiency/hRHSTE2", f1, "RecHit Efficiency 2D", "Efficiency_hRHEff2.png"); - Draw2DEfficiency("Efficiency/hSSTE2", f1, "Segment Efficiency 2D", "Efficiency_hSEff2.png"); - Draw2DEfficiency("Efficiency/hWireSTE2", f1, "Wire Efficiency 2D", "Efficiency_hWireEff2.png"); - Draw2DEfficiency("Efficiency/hStripSTE2", f1, "Strip Efficiency 2D", "Efficiency_hStripEff2.png"); - Draw2DTempPlot("Efficiency/hSensitiveAreaEvt", f1, false, "Efficiency_hEvts2.png"); - - - //produce wire timing plots - make1DPlot("Digis/hWireTBin+11",f1,"Wire TimeBin Fired ME+1/1", 1110,"Digis_hWireTBin+11.png"); - make1DPlot("Digis/hWireTBin+12",f1,"Wire TimeBin Fired ME+1/2", 1110,"Digis_hWireTBin+12.png"); - make1DPlot("Digis/hWireTBin+13",f1,"Wire TimeBin Fired ME+1/3", 1110,"Digis_hWireTBin+13.png"); - make1DPlot("Digis/hWireTBin+21",f1,"Wire TimeBin Fired ME+2/1", 1110,"Digis_hWireTBin+21.png"); - make1DPlot("Digis/hWireTBin+22",f1,"Wire TimeBin Fired ME+2/2", 1110,"Digis_hWireTBin+22.png"); - make1DPlot("Digis/hWireTBin+31",f1,"Wire TimeBin Fired ME+3/1", 1110,"Digis_hWireTBin+31.png"); - make1DPlot("Digis/hWireTBin+32",f1,"Wire TimeBin Fired ME+3/2", 1110,"Digis_hWireTBin+32.png"); - make1DPlot("Digis/hWireTBin+41",f1,"Wire TimeBin Fired ME+4/1", 1110,"Digis_hWireTBin+41.png"); - make1DPlot("Digis/hWireTBin-11",f1,"Wire TimeBin Fired ME-1/1", 1110,"Digis_hWireTBin-11.png"); - make1DPlot("Digis/hWireTBin-12",f1,"Wire TimeBin Fired ME-1/2", 1110,"Digis_hWireTBin-12.png"); - make1DPlot("Digis/hWireTBin-13",f1,"Wire TimeBin Fired ME-1/3", 1110,"Digis_hWireTBin-13.png"); - make1DPlot("Digis/hWireTBin-21",f1,"Wire TimeBin Fired ME-2/1", 1110,"Digis_hWireTBin-21.png"); - make1DPlot("Digis/hWireTBin-22",f1,"Wire TimeBin Fired ME-2/2", 1110,"Digis_hWireTBin-22.png"); - make1DPlot("Digis/hWireTBin-31",f1,"Wire TimeBin Fired ME-3/1", 1110,"Digis_hWireTBin-31.png"); - make1DPlot("Digis/hWireTBin-32",f1,"Wire TimeBin Fired ME-3/2", 1110,"Digis_hWireTBin-32.png"); - make1DPlot("Digis/hWireTBin-41",f1,"Wire TimeBin Fired ME-4/1", 1110,"Digis_hWireTBin-41.png"); - - - //produce pedestal noise plots - make1DPlot("PedestalNoise/hStripPedME+11",f1,"Pedestal Noise Distribution ME+1/1b", 1110,"PedestalNoise_hStripPedME+11.png"); - make1DPlot("PedestalNoise/hStripPedME+14",f1,"Pedestal Noise Distribution ME+1/1a", 1110,"PedestalNoise_hStripPedME+11a.png"); - make1DPlot("PedestalNoise/hStripPedME+12",f1,"Pedestal Noise Distribution ME+1/2", 1110,"PedestalNoise_hStripPedME+12.png"); - make1DPlot("PedestalNoise/hStripPedME+13",f1,"Pedestal Noise Distribution ME+1/3", 1110,"PedestalNoise_hStripPedME+13.png"); - make1DPlot("PedestalNoise/hStripPedME+21",f1,"Pedestal Noise Distribution ME+2/1", 1110,"PedestalNoise_hStripPedME+21.png"); - make1DPlot("PedestalNoise/hStripPedME+22",f1,"Pedestal Noise Distribution ME+2/2", 1110,"PedestalNoise_hStripPedME+22.png"); - make1DPlot("PedestalNoise/hStripPedME+31",f1,"Pedestal Noise Distribution ME+3/1", 1110,"PedestalNoise_hStripPedME+31.png"); - make1DPlot("PedestalNoise/hStripPedME+32",f1,"Pedestal Noise Distribution ME+3/2", 1110,"PedestalNoise_hStripPedME+32.png"); - make1DPlot("PedestalNoise/hStripPedME+41",f1,"Pedestal Noise Distribution ME+4/1", 1110,"PedestalNoise_hStripPedME+41.png"); - make1DPlot("PedestalNoise/hStripPedME-11",f1,"Pedestal Noise Distribution ME-1/1b", 1110,"PedestalNoise_hStripPedME-11.png"); - make1DPlot("PedestalNoise/hStripPedME-14",f1,"Pedestal Noise Distribution ME-1/1a", 1110,"PedestalNoise_hStripPedME-11a.png"); - make1DPlot("PedestalNoise/hStripPedME-12",f1,"Pedestal Noise Distribution ME-1/2", 1110,"PedestalNoise_hStripPedME-12.png"); - make1DPlot("PedestalNoise/hStripPedME-13",f1,"Pedestal Noise Distribution ME-1/3", 1110,"PedestalNoise_hStripPedME-13.png"); - make1DPlot("PedestalNoise/hStripPedME-21",f1,"Pedestal Noise Distribution ME-2/1", 1110,"PedestalNoise_hStripPedME-21.png"); - make1DPlot("PedestalNoise/hStripPedME-22",f1,"Pedestal Noise Distribution ME-2/2", 1110,"PedestalNoise_hStripPedME-22.png"); - make1DPlot("PedestalNoise/hStripPedME-31",f1,"Pedestal Noise Distribution ME-3/1", 1110,"PedestalNoise_hStripPedME-31.png"); - make1DPlot("PedestalNoise/hStripPedME-32",f1,"Pedestal Noise Distribution ME-3/2", 1110,"PedestalNoise_hStripPedME-32.png"); - make1DPlot("PedestalNoise/hStripPedME-41",f1,"Pedestal Noise Distribution ME-4/1", 1110,"PedestalNoise_hStripPedME-41.png"); - - // resolution - make1DPlot("Resolution/hSResid+11",f1,"Expected Position from Fit - Reconstructed, ME+1/1b", 1110,"Resolution_hSResid+11.png"); - make1DPlot("Resolution/hSResid+12",f1,"Expected Position from Fit - Reconstructed, ME+1/2", 1110,"Resolution_hSResid+12.png"); - make1DPlot("Resolution/hSResid+13",f1,"Expected Position from Fit - Reconstructed, ME+1/3", 1110,"Resolution_hSResid+13.png"); - make1DPlot("Resolution/hSResid+14",f1,"Expected Position from Fit - Reconstructed, ME+1/1a", 1110,"Resolution_hSResid+11a.png"); - make1DPlot("Resolution/hSResid+21",f1,"Expected Position from Fit - Reconstructed, ME+2/1", 1110,"Resolution_hSResid+21.png"); - make1DPlot("Resolution/hSResid+22",f1,"Expected Position from Fit - Reconstructed, ME+2/2", 1110,"Resolution_hSResid+22.png"); - make1DPlot("Resolution/hSResid+31",f1,"Expected Position from Fit - Reconstructed, ME+3/1", 1110,"Resolution_hSResid+31.png"); - make1DPlot("Resolution/hSResid+32",f1,"Expected Position from Fit - Reconstructed, ME+3/2", 1110,"Resolution_hSResid+32.png"); - make1DPlot("Resolution/hSResid+41",f1,"Expected Position from Fit - Reconstructed, ME+4/1", 1110,"Resolution_hSResid+41.png"); - make1DPlot("Resolution/hSResid-11",f1,"Expected Position from Fit - Reconstructed, ME-1/1b", 1110,"Resolution_hSResid-11.png"); - make1DPlot("Resolution/hSResid-12",f1,"Expected Position from Fit - Reconstructed, ME-1/2", 1110,"Resolution_hSResid-12.png"); - make1DPlot("Resolution/hSResid-13",f1,"Expected Position from Fit - Reconstructed, ME-1/3", 1110,"Resolution_hSResid-13.png"); - make1DPlot("Resolution/hSResid-14",f1,"Expected Position from Fit - Reconstructed, ME-1/1a", 1110,"Resolution_hSResid-11a.png"); - make1DPlot("Resolution/hSResid-21",f1,"Expected Position from Fit - Reconstructed, ME-2/1", 1110,"Resolution_hSResid-21.png"); - make1DPlot("Resolution/hSResid-22",f1,"Expected Position from Fit - Reconstructed, ME-2/2", 1110,"Resolution_hSResid-22.png"); - make1DPlot("Resolution/hSResid-31",f1,"Expected Position from Fit - Reconstructed, ME-3/1", 1110,"Resolution_hSResid-31.png"); - make1DPlot("Resolution/hSResid-32",f1,"Expected Position from Fit - Reconstructed, ME-3/2", 1110,"Resolution_hSResid-32.png"); - make1DPlot("Resolution/hSResid-41",f1,"Expected Position from Fit - Reconstructed, ME-4/1", 1110,"Resolution_hSResid-41.png"); - - // rechit strip position - make1DPlot("recHits/hRHstpos+11",f1,"Strip Position (ME+1/1b)", 1110,"recHits_hRHstpos+11.png"); - make1DPlot("recHits/hRHstpos+14",f1,"Strip Position (ME+1/1a)", 1110,"recHits_hRHstpos+11a.png"); - make1DPlot("recHits/hRHstpos+12",f1,"Strip Position (ME+1/2)", 1110,"recHits_hRHstpos+12.png"); - make1DPlot("recHits/hRHstpos+13",f1,"Strip Position (ME+1/3)", 1110,"recHits_hRHstpos+13.png"); - make1DPlot("recHits/hRHstpos+21",f1,"Strip Position (ME+2/1)", 1110,"recHits_hRHstpos+21.png"); - make1DPlot("recHits/hRHstpos+22",f1,"Strip Position (ME+2/2)", 1110,"recHits_hRHstpos+22.png"); - make1DPlot("recHits/hRHstpos+31",f1,"Strip Position (ME+3/1)", 1110,"recHits_hRHstpos+31.png"); - make1DPlot("recHits/hRHstpos+32",f1,"Strip Position (ME+3/2)", 1110,"recHits_hRHstpos+32.png"); - make1DPlot("recHits/hRHstpos+41",f1,"Strip Position (ME+4/1)", 1110,"recHits_hRHstpos+41.png"); - make1DPlot("recHits/hRHstpos-11",f1,"Strip Position (ME-1/1b)", 1110,"recHits_hRHstpos-11.png"); - make1DPlot("recHits/hRHstpos-14",f1,"Strip Position (ME-1/1a)", 1110,"recHits_hRHstpos-11a.png"); - make1DPlot("recHits/hRHstpos-12",f1,"Strip Position (ME-1/2)", 1110,"recHits_hRHstpos-12.png"); - make1DPlot("recHits/hRHstpos-13",f1,"Strip Position (ME-1/3)", 1110,"recHits_hRHstpos-13.png"); - make1DPlot("recHits/hRHstpos-21",f1,"Strip Position (ME-2/1)", 1110,"recHits_hRHstpos-21.png"); - make1DPlot("recHits/hRHstpos-22",f1,"Strip Position (ME-2/2)", 1110,"recHits_hRHstpos-22.png"); - make1DPlot("recHits/hRHstpos-31",f1,"Strip Position (ME-3/1)", 1110,"recHits_hRHstpos-31.png"); - make1DPlot("recHits/hRHstpos-32",f1,"Strip Position (ME-3/2)", 1110,"recHits_hRHstpos-32.png"); - make1DPlot("recHits/hRHstpos-41",f1,"Strip Position (ME-4/1)", 1110,"recHits_hRHstpos-41.png"); - - // rechit timing - make1DPlot("recHits/hRHTiming+11",f1,"RecHit Timing ME+1/1b", 1110,"recHits_hRHTiming+11.png"); - make1DPlot("recHits/hRHTiming+14",f1,"RecHit Timing ME+1/1a", 1110,"recHits_hRHTiming+11a.png"); - make1DPlot("recHits/hRHTiming+12",f1,"RecHit Timing ME+1/2", 1110,"recHits_hRHTiming+12.png"); - make1DPlot("recHits/hRHTiming+13",f1,"RecHit Timing ME+1/3", 1110,"recHits_hRHTiming+13.png"); - make1DPlot("recHits/hRHTiming+21",f1,"RecHit Timing ME+2/1", 1110,"recHits_hRHTiming+21.png"); - make1DPlot("recHits/hRHTiming+22",f1,"RecHit Timing ME+2/2", 1110,"recHits_hRHTiming+22.png"); - make1DPlot("recHits/hRHTiming+31",f1,"RecHit Timing ME+3/1", 1110,"recHits_hRHTiming+31.png"); - make1DPlot("recHits/hRHTiming+32",f1,"RecHit Timing ME+3/2", 1110,"recHits_hRHTiming+32.png"); - make1DPlot("recHits/hRHTiming+41",f1,"RecHit Timing ME+4/1", 1110,"recHits_hRHTiming+41.png"); - make1DPlot("recHits/hRHTiming-11",f1,"RecHit Timing ME-1/1b", 1110,"recHits_hRHTiming-11.png"); - make1DPlot("recHits/hRHTiming-14",f1,"RecHit Timing ME-1/1a", 1110,"recHits_hRHTiming-11a.png"); - make1DPlot("recHits/hRHTiming-12",f1,"RecHit Timing ME-1/2", 1110,"recHits_hRHTiming-12.png"); - make1DPlot("recHits/hRHTiming-13",f1,"RecHit Timing ME-1/3", 1110,"recHits_hRHTiming-13.png"); - make1DPlot("recHits/hRHTiming-21",f1,"RecHit Timing ME-2/1", 1110,"recHits_hRHTiming-21.png"); - make1DPlot("recHits/hRHTiming-22",f1,"RecHit Timing ME-2/2", 1110,"recHits_hRHTiming-22.png"); - make1DPlot("recHits/hRHTiming-31",f1,"RecHit Timing ME-3/1", 1110,"recHits_hRHTiming-31.png"); - make1DPlot("recHits/hRHTiming-32",f1,"RecHit Timing ME-3/2", 1110,"recHits_hRHTiming-32.png"); - make1DPlot("recHits/hRHTiming-41",f1,"RecHit Timing ME-4/1", 1110,"recHits_hRHTiming-41.png"); - - // rechit charge - make1DPlot("recHits/hRHSumQ+11",f1,"Sum 3x3 RecHit Charge ME+1/1b", 1110,"recHits_hRHSumQ+11.png"); - make1DPlot("recHits/hRHSumQ+14",f1,"Sum 3x3 RecHit Charge ME+1/1a", 1110,"recHits_hRHSumQ+11a.png"); - make1DPlot("recHits/hRHSumQ+12",f1,"Sum 3x3 RecHit Charge ME+1/2", 1110,"recHits_hRHSumQ+12.png"); - make1DPlot("recHits/hRHSumQ+13",f1,"Sum 3x3 RecHit Charge ME+1/3", 1110,"recHits_hRHSumQ+13.png"); - make1DPlot("recHits/hRHSumQ+21",f1,"Sum 3x3 RecHit Charge ME+2/1", 1110,"recHits_hRHSumQ+21.png"); - make1DPlot("recHits/hRHSumQ+22",f1,"Sum 3x3 RecHit Charge ME+2/2", 1110,"recHits_hRHSumQ+22.png"); - make1DPlot("recHits/hRHSumQ+31",f1,"Sum 3x3 RecHit Charge ME+3/1", 1110,"recHits_hRHSumQ+31.png"); - make1DPlot("recHits/hRHSumQ+32",f1,"Sum 3x3 RecHit Charge ME+3/2", 1110,"recHits_hRHSumQ+32.png"); - make1DPlot("recHits/hRHSumQ+41",f1,"Sum 3x3 RecHit Charge ME+4/1", 1110,"recHits_hRHSumQ+41.png"); - make1DPlot("recHits/hRHSumQ-11",f1,"Sum 3x3 RecHit Charge ME-1/1b", 1110,"recHits_hRHSumQ-11.png"); - make1DPlot("recHits/hRHSumQ-14",f1,"Sum 3x3 RecHit Charge ME-1/1a", 1110,"recHits_hRHSumQ-11a.png"); - make1DPlot("recHits/hRHSumQ-12",f1,"Sum 3x3 RecHit Charge ME-1/2", 1110,"recHits_hRHSumQ-12.png"); - make1DPlot("recHits/hRHSumQ-13",f1,"Sum 3x3 RecHit Charge ME-1/3", 1110,"recHits_hRHSumQ-13.png"); - make1DPlot("recHits/hRHSumQ-21",f1,"Sum 3x3 RecHit Charge ME-2/1", 1110,"recHits_hRHSumQ-21.png"); - make1DPlot("recHits/hRHSumQ-22",f1,"Sum 3x3 RecHit Charge ME-2/2", 1110,"recHits_hRHSumQ-22.png"); - make1DPlot("recHits/hRHSumQ-31",f1,"Sum 3x3 RecHit Charge ME-3/1", 1110,"recHits_hRHSumQ-31.png"); - make1DPlot("recHits/hRHSumQ-32",f1,"Sum 3x3 RecHit Charge ME-3/2", 1110,"recHits_hRHSumQ-32.png"); - make1DPlot("recHits/hRHSumQ-41",f1,"Sum 3x3 RecHit Charge ME-4/1", 1110,"recHits_hRHSumQ-41.png"); - - make1DPlot("recHits/hRHRatioQ+11",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/1b", 1110,"recHits_hRHRatioQ+11.png"); - make1DPlot("recHits/hRHRatioQ+14",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/1a", 1110,"recHits_hRHRatioQ+11a.png"); - make1DPlot("recHits/hRHRatioQ+12",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/2", 1110,"recHits_hRHRatioQ+12.png"); - make1DPlot("recHits/hRHRatioQ+13",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/3", 1110,"recHits_hRHRatioQ+13.png"); - make1DPlot("recHits/hRHRatioQ+21",f1,"Charge Ratio (Ql_Qr)/Qt ME+2/1", 1110,"recHits_hRHRatioQ+21.png"); - make1DPlot("recHits/hRHRatioQ+22",f1,"Charge Ratio (Ql_Qr)/Qt ME+2/2", 1110,"recHits_hRHRatioQ+22.png"); - make1DPlot("recHits/hRHRatioQ+31",f1,"Charge Ratio (Ql_Qr)/Qt ME+3/1", 1110,"recHits_hRHRatioQ+31.png"); - make1DPlot("recHits/hRHRatioQ+32",f1,"Charge Ratio (Ql_Qr)/Qt ME+3/2", 1110,"recHits_hRHRatioQ+32.png"); - make1DPlot("recHits/hRHRatioQ+41",f1,"Charge Ratio (Ql_Qr)/Qt ME+4/1", 1110,"recHits_hRHRatioQ+41.png"); - make1DPlot("recHits/hRHRatioQ-11",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/1b", 1110,"recHits_hRHRatioQ-11.png"); - make1DPlot("recHits/hRHRatioQ-14",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/1a", 1110,"recHits_hRHRatioQ-11a.png"); - make1DPlot("recHits/hRHRatioQ-12",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/2", 1110,"recHits_hRHRatioQ-12.png"); - make1DPlot("recHits/hRHRatioQ-13",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/3", 1110,"recHits_hRHRatioQ-13.png"); - make1DPlot("recHits/hRHRatioQ-21",f1,"Charge Ratio (Ql_Qr)/Qt ME-2/1", 1110,"recHits_hRHRatioQ-21.png"); - make1DPlot("recHits/hRHRatioQ-22",f1,"Charge Ratio (Ql_Qr)/Qt ME-2/2", 1110,"recHits_hRHRatioQ-22.png"); - make1DPlot("recHits/hRHRatioQ-31",f1,"Charge Ratio (Ql_Qr)/Qt ME-3/1", 1110,"recHits_hRHRatioQ-31.png"); - make1DPlot("recHits/hRHRatioQ-32",f1,"Charge Ratio (Ql_Qr)/Qt ME-3/2", 1110,"recHits_hRHRatioQ-32.png"); - make1DPlot("recHits/hRHRatioQ-41",f1,"Charge Ratio (Ql_Qr)/Qt ME-4/1", 1110,"recHits_hRHRatioQ-41.png"); - - //hits on a segment - make1DPlot("Segments/hSnHits+11",f1,"N Hits on Segments ME+1/1b", 1110,"Segments_hSnHits+11.png"); - make1DPlot("Segments/hSnHits+14",f1,"N Hits on Segments ME+1/1a", 1110,"Segments_hSnHits+11a.png"); - make1DPlot("Segments/hSnHits+12",f1,"N Hits on Segments ME+1/2", 1110,"Segments_hSnHits+12.png"); - make1DPlot("Segments/hSnHits+13",f1,"N Hits on Segments ME+1/3", 1110,"Segments_hSnHits+13.png"); - make1DPlot("Segments/hSnHits+21",f1,"N Hits on Segments ME+2/1", 1110,"Segments_hSnHits+21.png"); - make1DPlot("Segments/hSnHits+22",f1,"N Hits on Segments ME+2/2", 1110,"Segments_hSnHits+22.png"); - make1DPlot("Segments/hSnHits+31",f1,"N Hits on Segments ME+3/1", 1110,"Segments_hSnHits+31.png"); - make1DPlot("Segments/hSnHits+32",f1,"N Hits on Segments ME+3/2", 1110,"Segments_hSnHits+32.png"); - make1DPlot("Segments/hSnHits+41",f1,"N Hits on Segments ME+4/1", 1110,"Segments_hSnHits+41.png"); - make1DPlot("Segments/hSnHits-11",f1,"N Hits on Segments ME-1/1b", 1110,"Segments_hSnHits-11.png"); - make1DPlot("Segments/hSnHits-14",f1,"N Hits on Segments ME-1/1a", 1110,"Segments_hSnHits-11a.png"); - make1DPlot("Segments/hSnHits-12",f1,"N Hits on Segments ME-1/2", 1110,"Segments_hSnHits-12.png"); - make1DPlot("Segments/hSnHits-13",f1,"N Hits on Segments ME-1/3", 1110,"Segments_hSnHits-13.png"); - make1DPlot("Segments/hSnHits-21",f1,"N Hits on Segments ME-2/1", 1110,"Segments_hSnHits-21.png"); - make1DPlot("Segments/hSnHits-22",f1,"N Hits on Segments ME-2/2", 1110,"Segments_hSnHits-22.png"); - make1DPlot("Segments/hSnHits-31",f1,"N Hits on Segments ME-3/1", 1110,"Segments_hSnHits-31.png"); - make1DPlot("Segments/hSnHits-32",f1,"N Hits on Segments ME-3/2", 1110,"Segments_hSnHits-32.png"); - make1DPlot("Segments/hSnHits-41",f1,"N Hits on Segments ME-4/1", 1110,"Segments_hSnHits-41.png"); - - // segment chi2 - make1DPlot("Segments/hSChiSq+11",f1,"Segment Chi2/ndof ME+1/1b", 1110,"Segments_hSChiSq+11.png"); - make1DPlot("Segments/hSChiSq+14",f1,"Segment Chi2/ndof ME+1/1a", 1110,"Segments_hSChiSq+11a.png"); - make1DPlot("Segments/hSChiSq+12",f1,"Segment Chi2/ndof ME+1/2", 1110,"Segments_hSChiSq+12.png"); - make1DPlot("Segments/hSChiSq+13",f1,"Segment Chi2/ndof ME+1/3", 1110,"Segments_hSChiSq+13.png"); - make1DPlot("Segments/hSChiSq+21",f1,"Segment Chi2/ndof ME+2/1", 1110,"Segments_hSChiSq+21.png"); - make1DPlot("Segments/hSChiSq+22",f1,"Segment Chi2/ndof ME+2/2", 1110,"Segments_hSChiSq+22.png"); - make1DPlot("Segments/hSChiSq+31",f1,"Segment Chi2/ndof ME+3/1", 1110,"Segments_hSChiSq+31.png"); - make1DPlot("Segments/hSChiSq+32",f1,"Segment Chi2/ndof ME+3/2", 1110,"Segments_hSChiSq+32.png"); - make1DPlot("Segments/hSChiSq+41",f1,"Segment Chi2/ndof ME+4/1", 1110,"Segments_hSChiSq+41.png"); - make1DPlot("Segments/hSChiSq-11",f1,"Segment Chi2/ndof ME-1/1b", 1110,"Segments_hSChiSq-11.png"); - make1DPlot("Segments/hSChiSq-14",f1,"Segment Chi2/ndof ME-1/1a", 1110,"Segments_hSChiSq-11a.png"); - make1DPlot("Segments/hSChiSq-12",f1,"Segment Chi2/ndof ME-1/2", 1110,"Segments_hSChiSq-12.png"); - make1DPlot("Segments/hSChiSq-13",f1,"Segment Chi2/ndof ME-1/3", 1110,"Segments_hSChiSq-13.png"); - make1DPlot("Segments/hSChiSq-21",f1,"Segment Chi2/ndof ME-2/1", 1110,"Segments_hSChiSq-21.png"); - make1DPlot("Segments/hSChiSq-22",f1,"Segment Chi2/ndof ME-2/2", 1110,"Segments_hSChiSq-22.png"); - make1DPlot("Segments/hSChiSq-31",f1,"Segment Chi2/ndof ME-3/1", 1110,"Segments_hSChiSq-31.png"); - make1DPlot("Segments/hSChiSq-32",f1,"Segment Chi2/ndof ME-3/2", 1110,"Segments_hSChiSq-32.png"); - make1DPlot("Segments/hSChiSq-41",f1,"Segment Chi2/ndof ME-4/1", 1110,"Segments_hSChiSq-41.png"); - - //miscellaneous - make1DPlot("Segments/hSGlobalPhi",f1,"Segment Global Phi", 1110,"Segments_hSGlobalPhi.png"); - make1DPlot("Segments/hSGlobalTheta",f1,"Segment Global Theta", 1110,"Segments_hSGlobalTheta.png"); - - - -} - -EOF - -root -l -q -b ${MACRO} - -rm makePlots.C - +# run root in batch (-b), no banner (-l), quit after processing (-q) +root -b -l -q 'makePlots.C( "'${ARG1}'" )' diff --git a/RecoLocalMuon/CSCValidation/macros/makePlots_OLD.C b/RecoLocalMuon/CSCValidation/macros/makePlots_OLD.C new file mode 100644 index 0000000000000..eae1a8788ce9a --- /dev/null +++ b/RecoLocalMuon/CSCValidation/macros/makePlots_OLD.C @@ -0,0 +1,436 @@ +// This function makes plots from root file output of CSCValidation, input_file +// Pass it to root e.g. see makePlots.sh script +// It requires local file "myFunctions.C" +// Original author: Andy Kubik (NWU) +// - Please contact CSC DPG for current status - 12.07.2022 + +// - includes rechit and segment position plots +// - does not include segment time plots - MUST BE ADDED + +#include "myFunctions.C" + +void makePlots(std::string input_file) { + extern TFile* OpenFiles(std::string path); + extern void makeCSCOccupancy(std::string histoname, TFile * f1, std::string histotitle, std::string savename); + extern void Draw2DTempPlot( + std::string histo, TFile * f1, bool includeME11, std::string savename, bool hasLabels = false); + extern void make1DPlot( + std::string histoname, TFile * f1, std::string histotitle, int statoption, std::string savename); + extern void make1DPlot(std::string histoname, + TFile * f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename); + extern void printEmptyChambers(std::string histoname, std::string oname, TFile * f); + extern void GlobalPosfromTree( + std::string graphname, TFile * f1, int endcap, int station, std::string type, std::string savename); + extern void NikolaiPlots(TFile * f_in, int flag); + extern void makeEffGif(std::string histoname, TFile * f1, std::string histotitle, std::string savename); + extern void Draw2DEfficiency(std::string histo, TFile * f1, std::string title, std::string savename); + extern void make2DPlot( + std::string histoname, TFile * f1, std::string histotitle, int statoption, std::string savename); + extern void make2DPlot(std::string histoname, + TFile * f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename); + extern void makeProfile( + std::string histoname, TFile * f1, std::string histotitle, int statoption, std::string savename); + extern void makeProfile(std::string histoname, + TFile * f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename); + + // gROOT->Reset(); + // gROOT->ProcessLine(".L myFunctions.C"); + + TFile* f1; + f1 = OpenFiles(input_file); + + //produce occupancy plots + makeCSCOccupancy("GeneralHists/hCSCOccupancy", f1, "CSC Occupancy", "CSCOccupancy.png"); + Draw2DTempPlot("Digis/hOWires", f1, true, "hOWires.png"); + Draw2DTempPlot("Digis/hOStrips", f1, true, "hOStrips.png"); + Draw2DTempPlot("recHits/hORecHits", f1, true, "hORecHits.png"); + Draw2DTempPlot("Segments/hOSegments", f1, true, "hOSegments.png"); + make1DPlot("Digis/hOStripSerial", f1, "Strip Occupancy by Chamber Serial", 10, "hOStripSerial.png"); + make1DPlot("Digis/hOWireSerial", f1, "Wire Occupancy by Chamber Serial", 10, "hOWireSerial.png"); + make1DPlot("Segments/hOSegmentsSerial", f1, "Segment Occupancy by Chamber Serial", 10, "hOSegmentsSerial.png"); + make1DPlot("recHits/hORecHitsSerial", f1, "recHit Occupancy by Chamber Serial", 10, "hORecHitsSerial.png"); + + //Print dead chamber lists + printEmptyChambers("Digis/hOWires", "wire digis", f1); + printEmptyChambers("Digis/hOStrips", "strip digis", f1); + printEmptyChambers("recHits/hORecHits", "rechits", f1); + + //Make global position graphs from trees + GlobalPosfromTree("Global recHit positions ME+1", f1, 1, 1, "rechit", "rHglobal_station_+1.png"); + GlobalPosfromTree("Global recHit positions ME+2", f1, 1, 2, "rechit", "rHglobal_station_+2.png"); + GlobalPosfromTree("Global recHit positions ME+3", f1, 1, 3, "rechit", "rHglobal_station_+3.png"); + GlobalPosfromTree("Global recHit positions ME+4", f1, 1, 4, "rechit", "rHglobal_station_+4.png"); + GlobalPosfromTree("Global recHit positions ME-1", f1, 2, 1, "rechit", "rHglobal_station_-1.png"); + GlobalPosfromTree("Global recHit positions ME-2", f1, 2, 2, "rechit", "rHglobal_station_-2.png"); + GlobalPosfromTree("Global recHit positions ME-3", f1, 2, 3, "rechit", "rHglobal_station_-3.png"); + GlobalPosfromTree("Global recHit positions ME-4", f1, 2, 4, "rechit", "rHglobal_station_-4.png"); + GlobalPosfromTree("Global Segment positions ME+1", f1, 1, 1, "segment", "Sglobal_station_+1.png"); + GlobalPosfromTree("Global Segment positions ME+2", f1, 1, 2, "segment", "Sglobal_station_+2.png"); + GlobalPosfromTree("Global Segment positions ME+3", f1, 1, 3, "segment", "Sglobal_station_+3.png"); + GlobalPosfromTree("Global Segment positions ME+4", f1, 1, 4, "segment", "Sglobal_station_+4.png"); + GlobalPosfromTree("Global Segment positions ME-1", f1, 2, 1, "segment", "Sglobal_station_-1.png"); + GlobalPosfromTree("Global Segment positions ME-2", f1, 2, 2, "segment", "Sglobal_station_-2.png"); + GlobalPosfromTree("Global Segment positions ME-3", f1, 2, 3, "segment", "Sglobal_station_-3.png"); + GlobalPosfromTree("Global Segment positions ME-4", f1, 2, 4, "segment", "Sglobal_station_-4.png"); + + //Nikolai's plots + NikolaiPlots(f1, 1); + NikolaiPlots(f1, 2); + NikolaiPlots(f1, 3); + NikolaiPlots(f1, 4); + + //produce number of X per event plots + make1DPlot("Digis/hStripNFired", f1, "Fired Strips per Event", 1110, "Digis_hStripNFired.png"); + make1DPlot("Digis/hWirenGroupsTotal", f1, "Fired Wires per Event", 1110, "Digis_hWirenGroupsTotal.png"); + make1DPlot("recHits/hRHnrechits", f1, "RecHits per Event", 1110, "recHits_hRHnrechits.png"); + make1DPlot("Segments/hSnSegments", f1, "Segments per Event", 1110, "Segments_hSnSegments.png"); + + //efficiency plots + makeEffGif("Efficiency/hRHSTE", f1, "RecHit Efficiency", "Efficiency_hRHEff.png"); + makeEffGif("Efficiency/hSSTE", f1, "Segment Efficiency", "Efficiency_hSEff.png"); + Draw2DEfficiency("Efficiency/hRHSTE2", f1, "RecHit Efficiency 2D", "Efficiency_hRHEff2.png"); + Draw2DEfficiency("Efficiency/hSSTE2", f1, "Segment Efficiency 2D", "Efficiency_hSEff2.png"); + Draw2DEfficiency("Efficiency/hWireSTE2", f1, "Wire Efficiency 2D", "Efficiency_hWireEff2.png"); + Draw2DEfficiency("Efficiency/hStripSTE2", f1, "Strip Efficiency 2D", "Efficiency_hStripEff2.png"); + Draw2DTempPlot("Efficiency/hSensitiveAreaEvt", f1, false, "Efficiency_hEvts2.png"); + + //produce wire timing plots + make1DPlot("Digis/hWireTBin+11", f1, "Wire TimeBin Fired ME+1/1", 1110, "Digis_hWireTBin+11.png"); + make1DPlot("Digis/hWireTBin+12", f1, "Wire TimeBin Fired ME+1/2", 1110, "Digis_hWireTBin+12.png"); + make1DPlot("Digis/hWireTBin+13", f1, "Wire TimeBin Fired ME+1/3", 1110, "Digis_hWireTBin+13.png"); + make1DPlot("Digis/hWireTBin+21", f1, "Wire TimeBin Fired ME+2/1", 1110, "Digis_hWireTBin+21.png"); + make1DPlot("Digis/hWireTBin+22", f1, "Wire TimeBin Fired ME+2/2", 1110, "Digis_hWireTBin+22.png"); + make1DPlot("Digis/hWireTBin+31", f1, "Wire TimeBin Fired ME+3/1", 1110, "Digis_hWireTBin+31.png"); + make1DPlot("Digis/hWireTBin+32", f1, "Wire TimeBin Fired ME+3/2", 1110, "Digis_hWireTBin+32.png"); + make1DPlot("Digis/hWireTBin+41", f1, "Wire TimeBin Fired ME+4/1", 1110, "Digis_hWireTBin+41.png"); + make1DPlot("Digis/hWireTBin-11", f1, "Wire TimeBin Fired ME-1/1", 1110, "Digis_hWireTBin-11.png"); + make1DPlot("Digis/hWireTBin-12", f1, "Wire TimeBin Fired ME-1/2", 1110, "Digis_hWireTBin-12.png"); + make1DPlot("Digis/hWireTBin-13", f1, "Wire TimeBin Fired ME-1/3", 1110, "Digis_hWireTBin-13.png"); + make1DPlot("Digis/hWireTBin-21", f1, "Wire TimeBin Fired ME-2/1", 1110, "Digis_hWireTBin-21.png"); + make1DPlot("Digis/hWireTBin-22", f1, "Wire TimeBin Fired ME-2/2", 1110, "Digis_hWireTBin-22.png"); + make1DPlot("Digis/hWireTBin-31", f1, "Wire TimeBin Fired ME-3/1", 1110, "Digis_hWireTBin-31.png"); + make1DPlot("Digis/hWireTBin-32", f1, "Wire TimeBin Fired ME-3/2", 1110, "Digis_hWireTBin-32.png"); + make1DPlot("Digis/hWireTBin-41", f1, "Wire TimeBin Fired ME-4/1", 1110, "Digis_hWireTBin-41.png"); + + //produce pedestal noise plots + make1DPlot("PedestalNoise/hStripPedME+11", + f1, + "Pedestal Noise Distribution ME+1/1b", + 1110, + "PedestalNoise_hStripPedME+11.png"); + make1DPlot("PedestalNoise/hStripPedME+14", + f1, + "Pedestal Noise Distribution ME+1/1a", + 1110, + "PedestalNoise_hStripPedME+11a.png"); + make1DPlot("PedestalNoise/hStripPedME+12", + f1, + "Pedestal Noise Distribution ME+1/2", + 1110, + "PedestalNoise_hStripPedME+12.png"); + make1DPlot("PedestalNoise/hStripPedME+13", + f1, + "Pedestal Noise Distribution ME+1/3", + 1110, + "PedestalNoise_hStripPedME+13.png"); + make1DPlot("PedestalNoise/hStripPedME+21", + f1, + "Pedestal Noise Distribution ME+2/1", + 1110, + "PedestalNoise_hStripPedME+21.png"); + make1DPlot("PedestalNoise/hStripPedME+22", + f1, + "Pedestal Noise Distribution ME+2/2", + 1110, + "PedestalNoise_hStripPedME+22.png"); + make1DPlot("PedestalNoise/hStripPedME+31", + f1, + "Pedestal Noise Distribution ME+3/1", + 1110, + "PedestalNoise_hStripPedME+31.png"); + make1DPlot("PedestalNoise/hStripPedME+32", + f1, + "Pedestal Noise Distribution ME+3/2", + 1110, + "PedestalNoise_hStripPedME+32.png"); + make1DPlot("PedestalNoise/hStripPedME+41", + f1, + "Pedestal Noise Distribution ME+4/1", + 1110, + "PedestalNoise_hStripPedME+41.png"); + make1DPlot("PedestalNoise/hStripPedME-11", + f1, + "Pedestal Noise Distribution ME-1/1b", + 1110, + "PedestalNoise_hStripPedME-11.png"); + make1DPlot("PedestalNoise/hStripPedME-14", + f1, + "Pedestal Noise Distribution ME-1/1a", + 1110, + "PedestalNoise_hStripPedME-11a.png"); + make1DPlot("PedestalNoise/hStripPedME-12", + f1, + "Pedestal Noise Distribution ME-1/2", + 1110, + "PedestalNoise_hStripPedME-12.png"); + make1DPlot("PedestalNoise/hStripPedME-13", + f1, + "Pedestal Noise Distribution ME-1/3", + 1110, + "PedestalNoise_hStripPedME-13.png"); + make1DPlot("PedestalNoise/hStripPedME-21", + f1, + "Pedestal Noise Distribution ME-2/1", + 1110, + "PedestalNoise_hStripPedME-21.png"); + make1DPlot("PedestalNoise/hStripPedME-22", + f1, + "Pedestal Noise Distribution ME-2/2", + 1110, + "PedestalNoise_hStripPedME-22.png"); + make1DPlot("PedestalNoise/hStripPedME-31", + f1, + "Pedestal Noise Distribution ME-3/1", + 1110, + "PedestalNoise_hStripPedME-31.png"); + make1DPlot("PedestalNoise/hStripPedME-32", + f1, + "Pedestal Noise Distribution ME-3/2", + 1110, + "PedestalNoise_hStripPedME-32.png"); + make1DPlot("PedestalNoise/hStripPedME-41", + f1, + "Pedestal Noise Distribution ME-4/1", + 1110, + "PedestalNoise_hStripPedME-41.png"); + + // resolution + make1DPlot("Resolution/hSResid+11", + f1, + "Expected Position from Fit - Reconstructed, ME+1/1b", + 1110, + "Resolution_hSResid+11.png"); + make1DPlot("Resolution/hSResid+12", + f1, + "Expected Position from Fit - Reconstructed, ME+1/2", + 1110, + "Resolution_hSResid+12.png"); + make1DPlot("Resolution/hSResid+13", + f1, + "Expected Position from Fit - Reconstructed, ME+1/3", + 1110, + "Resolution_hSResid+13.png"); + make1DPlot("Resolution/hSResid+14", + f1, + "Expected Position from Fit - Reconstructed, ME+1/1a", + 1110, + "Resolution_hSResid+11a.png"); + make1DPlot("Resolution/hSResid+21", + f1, + "Expected Position from Fit - Reconstructed, ME+2/1", + 1110, + "Resolution_hSResid+21.png"); + make1DPlot("Resolution/hSResid+22", + f1, + "Expected Position from Fit - Reconstructed, ME+2/2", + 1110, + "Resolution_hSResid+22.png"); + make1DPlot("Resolution/hSResid+31", + f1, + "Expected Position from Fit - Reconstructed, ME+3/1", + 1110, + "Resolution_hSResid+31.png"); + make1DPlot("Resolution/hSResid+32", + f1, + "Expected Position from Fit - Reconstructed, ME+3/2", + 1110, + "Resolution_hSResid+32.png"); + make1DPlot("Resolution/hSResid+41", + f1, + "Expected Position from Fit - Reconstructed, ME+4/1", + 1110, + "Resolution_hSResid+41.png"); + make1DPlot("Resolution/hSResid-11", + f1, + "Expected Position from Fit - Reconstructed, ME-1/1b", + 1110, + "Resolution_hSResid-11.png"); + make1DPlot("Resolution/hSResid-12", + f1, + "Expected Position from Fit - Reconstructed, ME-1/2", + 1110, + "Resolution_hSResid-12.png"); + make1DPlot("Resolution/hSResid-13", + f1, + "Expected Position from Fit - Reconstructed, ME-1/3", + 1110, + "Resolution_hSResid-13.png"); + make1DPlot("Resolution/hSResid-14", + f1, + "Expected Position from Fit - Reconstructed, ME-1/1a", + 1110, + "Resolution_hSResid-11a.png"); + make1DPlot("Resolution/hSResid-21", + f1, + "Expected Position from Fit - Reconstructed, ME-2/1", + 1110, + "Resolution_hSResid-21.png"); + make1DPlot("Resolution/hSResid-22", + f1, + "Expected Position from Fit - Reconstructed, ME-2/2", + 1110, + "Resolution_hSResid-22.png"); + make1DPlot("Resolution/hSResid-31", + f1, + "Expected Position from Fit - Reconstructed, ME-3/1", + 1110, + "Resolution_hSResid-31.png"); + make1DPlot("Resolution/hSResid-32", + f1, + "Expected Position from Fit - Reconstructed, ME-3/2", + 1110, + "Resolution_hSResid-32.png"); + make1DPlot("Resolution/hSResid-41", + f1, + "Expected Position from Fit - Reconstructed, ME-4/1", + 1110, + "Resolution_hSResid-41.png"); + + // rechit strip position + make1DPlot("recHits/hRHstpos+11", f1, "Strip Position (ME+1/1b)", 1110, "recHits_hRHstpos+11.png"); + make1DPlot("recHits/hRHstpos+14", f1, "Strip Position (ME+1/1a)", 1110, "recHits_hRHstpos+11a.png"); + make1DPlot("recHits/hRHstpos+12", f1, "Strip Position (ME+1/2)", 1110, "recHits_hRHstpos+12.png"); + make1DPlot("recHits/hRHstpos+13", f1, "Strip Position (ME+1/3)", 1110, "recHits_hRHstpos+13.png"); + make1DPlot("recHits/hRHstpos+21", f1, "Strip Position (ME+2/1)", 1110, "recHits_hRHstpos+21.png"); + make1DPlot("recHits/hRHstpos+22", f1, "Strip Position (ME+2/2)", 1110, "recHits_hRHstpos+22.png"); + make1DPlot("recHits/hRHstpos+31", f1, "Strip Position (ME+3/1)", 1110, "recHits_hRHstpos+31.png"); + make1DPlot("recHits/hRHstpos+32", f1, "Strip Position (ME+3/2)", 1110, "recHits_hRHstpos+32.png"); + make1DPlot("recHits/hRHstpos+41", f1, "Strip Position (ME+4/1)", 1110, "recHits_hRHstpos+41.png"); + make1DPlot("recHits/hRHstpos-11", f1, "Strip Position (ME-1/1b)", 1110, "recHits_hRHstpos-11.png"); + make1DPlot("recHits/hRHstpos-14", f1, "Strip Position (ME-1/1a)", 1110, "recHits_hRHstpos-11a.png"); + make1DPlot("recHits/hRHstpos-12", f1, "Strip Position (ME-1/2)", 1110, "recHits_hRHstpos-12.png"); + make1DPlot("recHits/hRHstpos-13", f1, "Strip Position (ME-1/3)", 1110, "recHits_hRHstpos-13.png"); + make1DPlot("recHits/hRHstpos-21", f1, "Strip Position (ME-2/1)", 1110, "recHits_hRHstpos-21.png"); + make1DPlot("recHits/hRHstpos-22", f1, "Strip Position (ME-2/2)", 1110, "recHits_hRHstpos-22.png"); + make1DPlot("recHits/hRHstpos-31", f1, "Strip Position (ME-3/1)", 1110, "recHits_hRHstpos-31.png"); + make1DPlot("recHits/hRHstpos-32", f1, "Strip Position (ME-3/2)", 1110, "recHits_hRHstpos-32.png"); + make1DPlot("recHits/hRHstpos-41", f1, "Strip Position (ME-4/1)", 1110, "recHits_hRHstpos-41.png"); + + // rechit timing + make1DPlot("recHits/hRHTiming+11", f1, "RecHit Timing ME+1/1b", 1110, "recHits_hRHTiming+11.png"); + make1DPlot("recHits/hRHTiming+14", f1, "RecHit Timing ME+1/1a", 1110, "recHits_hRHTiming+11a.png"); + make1DPlot("recHits/hRHTiming+12", f1, "RecHit Timing ME+1/2", 1110, "recHits_hRHTiming+12.png"); + make1DPlot("recHits/hRHTiming+13", f1, "RecHit Timing ME+1/3", 1110, "recHits_hRHTiming+13.png"); + make1DPlot("recHits/hRHTiming+21", f1, "RecHit Timing ME+2/1", 1110, "recHits_hRHTiming+21.png"); + make1DPlot("recHits/hRHTiming+22", f1, "RecHit Timing ME+2/2", 1110, "recHits_hRHTiming+22.png"); + make1DPlot("recHits/hRHTiming+31", f1, "RecHit Timing ME+3/1", 1110, "recHits_hRHTiming+31.png"); + make1DPlot("recHits/hRHTiming+32", f1, "RecHit Timing ME+3/2", 1110, "recHits_hRHTiming+32.png"); + make1DPlot("recHits/hRHTiming+41", f1, "RecHit Timing ME+4/1", 1110, "recHits_hRHTiming+41.png"); + make1DPlot("recHits/hRHTiming-11", f1, "RecHit Timing ME-1/1b", 1110, "recHits_hRHTiming-11.png"); + make1DPlot("recHits/hRHTiming-14", f1, "RecHit Timing ME-1/1a", 1110, "recHits_hRHTiming-11a.png"); + make1DPlot("recHits/hRHTiming-12", f1, "RecHit Timing ME-1/2", 1110, "recHits_hRHTiming-12.png"); + make1DPlot("recHits/hRHTiming-13", f1, "RecHit Timing ME-1/3", 1110, "recHits_hRHTiming-13.png"); + make1DPlot("recHits/hRHTiming-21", f1, "RecHit Timing ME-2/1", 1110, "recHits_hRHTiming-21.png"); + make1DPlot("recHits/hRHTiming-22", f1, "RecHit Timing ME-2/2", 1110, "recHits_hRHTiming-22.png"); + make1DPlot("recHits/hRHTiming-31", f1, "RecHit Timing ME-3/1", 1110, "recHits_hRHTiming-31.png"); + make1DPlot("recHits/hRHTiming-32", f1, "RecHit Timing ME-3/2", 1110, "recHits_hRHTiming-32.png"); + make1DPlot("recHits/hRHTiming-41", f1, "RecHit Timing ME-4/1", 1110, "recHits_hRHTiming-41.png"); + + // rechit charge + make1DPlot("recHits/hRHSumQ+11", f1, "Sum 3x3 RecHit Charge ME+1/1b", 1110, "recHits_hRHSumQ+11.png"); + make1DPlot("recHits/hRHSumQ+14", f1, "Sum 3x3 RecHit Charge ME+1/1a", 1110, "recHits_hRHSumQ+11a.png"); + make1DPlot("recHits/hRHSumQ+12", f1, "Sum 3x3 RecHit Charge ME+1/2", 1110, "recHits_hRHSumQ+12.png"); + make1DPlot("recHits/hRHSumQ+13", f1, "Sum 3x3 RecHit Charge ME+1/3", 1110, "recHits_hRHSumQ+13.png"); + make1DPlot("recHits/hRHSumQ+21", f1, "Sum 3x3 RecHit Charge ME+2/1", 1110, "recHits_hRHSumQ+21.png"); + make1DPlot("recHits/hRHSumQ+22", f1, "Sum 3x3 RecHit Charge ME+2/2", 1110, "recHits_hRHSumQ+22.png"); + make1DPlot("recHits/hRHSumQ+31", f1, "Sum 3x3 RecHit Charge ME+3/1", 1110, "recHits_hRHSumQ+31.png"); + make1DPlot("recHits/hRHSumQ+32", f1, "Sum 3x3 RecHit Charge ME+3/2", 1110, "recHits_hRHSumQ+32.png"); + make1DPlot("recHits/hRHSumQ+41", f1, "Sum 3x3 RecHit Charge ME+4/1", 1110, "recHits_hRHSumQ+41.png"); + make1DPlot("recHits/hRHSumQ-11", f1, "Sum 3x3 RecHit Charge ME-1/1b", 1110, "recHits_hRHSumQ-11.png"); + make1DPlot("recHits/hRHSumQ-14", f1, "Sum 3x3 RecHit Charge ME-1/1a", 1110, "recHits_hRHSumQ-11a.png"); + make1DPlot("recHits/hRHSumQ-12", f1, "Sum 3x3 RecHit Charge ME-1/2", 1110, "recHits_hRHSumQ-12.png"); + make1DPlot("recHits/hRHSumQ-13", f1, "Sum 3x3 RecHit Charge ME-1/3", 1110, "recHits_hRHSumQ-13.png"); + make1DPlot("recHits/hRHSumQ-21", f1, "Sum 3x3 RecHit Charge ME-2/1", 1110, "recHits_hRHSumQ-21.png"); + make1DPlot("recHits/hRHSumQ-22", f1, "Sum 3x3 RecHit Charge ME-2/2", 1110, "recHits_hRHSumQ-22.png"); + make1DPlot("recHits/hRHSumQ-31", f1, "Sum 3x3 RecHit Charge ME-3/1", 1110, "recHits_hRHSumQ-31.png"); + make1DPlot("recHits/hRHSumQ-32", f1, "Sum 3x3 RecHit Charge ME-3/2", 1110, "recHits_hRHSumQ-32.png"); + make1DPlot("recHits/hRHSumQ-41", f1, "Sum 3x3 RecHit Charge ME-4/1", 1110, "recHits_hRHSumQ-41.png"); + + make1DPlot("recHits/hRHRatioQ+11", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/1b", 1110, "recHits_hRHRatioQ+11.png"); + make1DPlot("recHits/hRHRatioQ+14", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/1a", 1110, "recHits_hRHRatioQ+11a.png"); + make1DPlot("recHits/hRHRatioQ+12", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/2", 1110, "recHits_hRHRatioQ+12.png"); + make1DPlot("recHits/hRHRatioQ+13", f1, "Charge Ratio (Ql_Qr)/Qt ME+1/3", 1110, "recHits_hRHRatioQ+13.png"); + make1DPlot("recHits/hRHRatioQ+21", f1, "Charge Ratio (Ql_Qr)/Qt ME+2/1", 1110, "recHits_hRHRatioQ+21.png"); + make1DPlot("recHits/hRHRatioQ+22", f1, "Charge Ratio (Ql_Qr)/Qt ME+2/2", 1110, "recHits_hRHRatioQ+22.png"); + make1DPlot("recHits/hRHRatioQ+31", f1, "Charge Ratio (Ql_Qr)/Qt ME+3/1", 1110, "recHits_hRHRatioQ+31.png"); + make1DPlot("recHits/hRHRatioQ+32", f1, "Charge Ratio (Ql_Qr)/Qt ME+3/2", 1110, "recHits_hRHRatioQ+32.png"); + make1DPlot("recHits/hRHRatioQ+41", f1, "Charge Ratio (Ql_Qr)/Qt ME+4/1", 1110, "recHits_hRHRatioQ+41.png"); + make1DPlot("recHits/hRHRatioQ-11", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/1b", 1110, "recHits_hRHRatioQ-11.png"); + make1DPlot("recHits/hRHRatioQ-14", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/1a", 1110, "recHits_hRHRatioQ-11a.png"); + make1DPlot("recHits/hRHRatioQ-12", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/2", 1110, "recHits_hRHRatioQ-12.png"); + make1DPlot("recHits/hRHRatioQ-13", f1, "Charge Ratio (Ql_Qr)/Qt ME-1/3", 1110, "recHits_hRHRatioQ-13.png"); + make1DPlot("recHits/hRHRatioQ-21", f1, "Charge Ratio (Ql_Qr)/Qt ME-2/1", 1110, "recHits_hRHRatioQ-21.png"); + make1DPlot("recHits/hRHRatioQ-22", f1, "Charge Ratio (Ql_Qr)/Qt ME-2/2", 1110, "recHits_hRHRatioQ-22.png"); + make1DPlot("recHits/hRHRatioQ-31", f1, "Charge Ratio (Ql_Qr)/Qt ME-3/1", 1110, "recHits_hRHRatioQ-31.png"); + make1DPlot("recHits/hRHRatioQ-32", f1, "Charge Ratio (Ql_Qr)/Qt ME-3/2", 1110, "recHits_hRHRatioQ-32.png"); + make1DPlot("recHits/hRHRatioQ-41", f1, "Charge Ratio (Ql_Qr)/Qt ME-4/1", 1110, "recHits_hRHRatioQ-41.png"); + + //hits on a segment + make1DPlot("Segments/hSnHits+11", f1, "N Hits on Segments ME+1/1b", 1110, "Segments_hSnHits+11.png"); + make1DPlot("Segments/hSnHits+14", f1, "N Hits on Segments ME+1/1a", 1110, "Segments_hSnHits+11a.png"); + make1DPlot("Segments/hSnHits+12", f1, "N Hits on Segments ME+1/2", 1110, "Segments_hSnHits+12.png"); + make1DPlot("Segments/hSnHits+13", f1, "N Hits on Segments ME+1/3", 1110, "Segments_hSnHits+13.png"); + make1DPlot("Segments/hSnHits+21", f1, "N Hits on Segments ME+2/1", 1110, "Segments_hSnHits+21.png"); + make1DPlot("Segments/hSnHits+22", f1, "N Hits on Segments ME+2/2", 1110, "Segments_hSnHits+22.png"); + make1DPlot("Segments/hSnHits+31", f1, "N Hits on Segments ME+3/1", 1110, "Segments_hSnHits+31.png"); + make1DPlot("Segments/hSnHits+32", f1, "N Hits on Segments ME+3/2", 1110, "Segments_hSnHits+32.png"); + make1DPlot("Segments/hSnHits+41", f1, "N Hits on Segments ME+4/1", 1110, "Segments_hSnHits+41.png"); + make1DPlot("Segments/hSnHits-11", f1, "N Hits on Segments ME-1/1b", 1110, "Segments_hSnHits-11.png"); + make1DPlot("Segments/hSnHits-14", f1, "N Hits on Segments ME-1/1a", 1110, "Segments_hSnHits-11a.png"); + make1DPlot("Segments/hSnHits-12", f1, "N Hits on Segments ME-1/2", 1110, "Segments_hSnHits-12.png"); + make1DPlot("Segments/hSnHits-13", f1, "N Hits on Segments ME-1/3", 1110, "Segments_hSnHits-13.png"); + make1DPlot("Segments/hSnHits-21", f1, "N Hits on Segments ME-2/1", 1110, "Segments_hSnHits-21.png"); + make1DPlot("Segments/hSnHits-22", f1, "N Hits on Segments ME-2/2", 1110, "Segments_hSnHits-22.png"); + make1DPlot("Segments/hSnHits-31", f1, "N Hits on Segments ME-3/1", 1110, "Segments_hSnHits-31.png"); + make1DPlot("Segments/hSnHits-32", f1, "N Hits on Segments ME-3/2", 1110, "Segments_hSnHits-32.png"); + make1DPlot("Segments/hSnHits-41", f1, "N Hits on Segments ME-4/1", 1110, "Segments_hSnHits-41.png"); + + // segment chi2 + make1DPlot("Segments/hSChiSq+11", f1, "Segment Chi2/ndof ME+1/1b", 1110, "Segments_hSChiSq+11.png"); + make1DPlot("Segments/hSChiSq+14", f1, "Segment Chi2/ndof ME+1/1a", 1110, "Segments_hSChiSq+11a.png"); + make1DPlot("Segments/hSChiSq+12", f1, "Segment Chi2/ndof ME+1/2", 1110, "Segments_hSChiSq+12.png"); + make1DPlot("Segments/hSChiSq+13", f1, "Segment Chi2/ndof ME+1/3", 1110, "Segments_hSChiSq+13.png"); + make1DPlot("Segments/hSChiSq+21", f1, "Segment Chi2/ndof ME+2/1", 1110, "Segments_hSChiSq+21.png"); + make1DPlot("Segments/hSChiSq+22", f1, "Segment Chi2/ndof ME+2/2", 1110, "Segments_hSChiSq+22.png"); + make1DPlot("Segments/hSChiSq+31", f1, "Segment Chi2/ndof ME+3/1", 1110, "Segments_hSChiSq+31.png"); + make1DPlot("Segments/hSChiSq+32", f1, "Segment Chi2/ndof ME+3/2", 1110, "Segments_hSChiSq+32.png"); + make1DPlot("Segments/hSChiSq+41", f1, "Segment Chi2/ndof ME+4/1", 1110, "Segments_hSChiSq+41.png"); + make1DPlot("Segments/hSChiSq-11", f1, "Segment Chi2/ndof ME-1/1b", 1110, "Segments_hSChiSq-11.png"); + make1DPlot("Segments/hSChiSq-14", f1, "Segment Chi2/ndof ME-1/1a", 1110, "Segments_hSChiSq-11a.png"); + make1DPlot("Segments/hSChiSq-12", f1, "Segment Chi2/ndof ME-1/2", 1110, "Segments_hSChiSq-12.png"); + make1DPlot("Segments/hSChiSq-13", f1, "Segment Chi2/ndof ME-1/3", 1110, "Segments_hSChiSq-13.png"); + make1DPlot("Segments/hSChiSq-21", f1, "Segment Chi2/ndof ME-2/1", 1110, "Segments_hSChiSq-21.png"); + make1DPlot("Segments/hSChiSq-22", f1, "Segment Chi2/ndof ME-2/2", 1110, "Segments_hSChiSq-22.png"); + make1DPlot("Segments/hSChiSq-31", f1, "Segment Chi2/ndof ME-3/1", 1110, "Segments_hSChiSq-31.png"); + make1DPlot("Segments/hSChiSq-32", f1, "Segment Chi2/ndof ME-3/2", 1110, "Segments_hSChiSq-32.png"); + make1DPlot("Segments/hSChiSq-41", f1, "Segment Chi2/ndof ME-4/1", 1110, "Segments_hSChiSq-41.png"); + + //miscellaneous + make1DPlot("Segments/hSGlobalPhi", f1, "Segment Global Phi", 1110, "Segments_hSGlobalPhi.png"); + make1DPlot("Segments/hSGlobalTheta", f1, "Segment Global Theta", 1110, "Segments_hSGlobalTheta.png"); +} diff --git a/RecoLocalMuon/CSCValidation/macros/makePlots_OLD.sh b/RecoLocalMuon/CSCValidation/macros/makePlots_OLD.sh new file mode 100755 index 0000000000000..23608fc1ff80f --- /dev/null +++ b/RecoLocalMuon/CSCValidation/macros/makePlots_OLD.sh @@ -0,0 +1,275 @@ +#!/bin/bash + +# this script will take output histos from CSCValidation and make 'nice' looking .pngs +# author: Andy Kubic +# last updated - Tim Cox - 11.07.2022 + +# to run this script, do +# ./makePlots.sh +# where is the paths to the output root files from CSCValiation + +# example: ./makePlots.sh CMSSW_1_8_0_pre8/src/RecoLocalMuon/CSCValidation/test/validationHists.root +# the plots are created in the current directory + +ARG1=$1 + +MACRO=makePlots.C +cat > ${MACRO}<Reset(); + gROOT->ProcessLine(".L myFunctions.C"); + + std::string Path = "${ARG1}"; + + TFile *f1; + f1 = OpenFiles(Path); + + //produce occupancy plots + makeCSCOccupancy("GeneralHists/hCSCOccupancy", f1, "CSC Occupancy","CSCOccupancy.png"); + Draw2DTempPlot("Digis/hOWires", f1, true, "hOWires.png"); + Draw2DTempPlot("Digis/hOStrips", f1, true, "hOStrips.png"); + Draw2DTempPlot("recHits/hORecHits", f1, true, "hORecHits.png"); + Draw2DTempPlot("Segments/hOSegments", f1, true, "hOSegments.png"); + make1DPlot("Digis/hOStripSerial",f1,"Strip Occupancy by Chamber Serial", 10, "hOStripSerial.png"); + make1DPlot("Digis/hOWireSerial",f1,"Wire Occupancy by Chamber Serial", 10, "hOWireSerial.png"); + make1DPlot("Segments/hOSegmentsSerial",f1,"Segment Occupancy by Chamber Serial", 10, "hOSegmentsSerial.png"); + make1DPlot("recHits/hORecHitsSerial",f1,"recHit Occupancy by Chamber Serial", 10, "hORecHitsSerial.png"); + + //Print dead chamber lists + printEmptyChambers("Digis/hOWires", "wire digis", f1); + printEmptyChambers("Digis/hOStrips", "strip digis", f1); + printEmptyChambers("recHits/hORecHits", "rechits", f1); + + //Make global position graphs from trees + GlobalPosfromTree("Global recHit positions ME+1", f1, 1, 1, "rechit", "rHglobal_station_+1.png"); + GlobalPosfromTree("Global recHit positions ME+2", f1, 1, 2, "rechit", "rHglobal_station_+2.png"); + GlobalPosfromTree("Global recHit positions ME+3", f1, 1, 3, "rechit", "rHglobal_station_+3.png"); + GlobalPosfromTree("Global recHit positions ME+4", f1, 1, 4, "rechit", "rHglobal_station_+4.png"); + GlobalPosfromTree("Global recHit positions ME-1", f1, 2, 1, "rechit", "rHglobal_station_-1.png"); + GlobalPosfromTree("Global recHit positions ME-2", f1, 2, 2, "rechit", "rHglobal_station_-2.png"); + GlobalPosfromTree("Global recHit positions ME-3", f1, 2, 3, "rechit", "rHglobal_station_-3.png"); + GlobalPosfromTree("Global recHit positions ME-4", f1, 2, 4, "rechit", "rHglobal_station_-4.png"); + GlobalPosfromTree("Global Segment positions ME+1", f1, 1, 1, "segment", "Sglobal_station_+1.png"); + GlobalPosfromTree("Global Segment positions ME+2", f1, 1, 2, "segment", "Sglobal_station_+2.png"); + GlobalPosfromTree("Global Segment positions ME+3", f1, 1, 3, "segment", "Sglobal_station_+3.png"); + GlobalPosfromTree("Global Segment positions ME+4", f1, 1, 4, "segment", "Sglobal_station_+4.png"); + GlobalPosfromTree("Global Segment positions ME-1", f1, 2, 1, "segment", "Sglobal_station_-1.png"); + GlobalPosfromTree("Global Segment positions ME-2", f1, 2, 2, "segment", "Sglobal_station_-2.png"); + GlobalPosfromTree("Global Segment positions ME-3", f1, 2, 3, "segment", "Sglobal_station_-3.png"); + GlobalPosfromTree("Global Segment positions ME-4", f1, 2, 4, "segment", "Sglobal_station_-4.png"); + + //Nikolai's plots + NikolaiPlots(f1,1); + NikolaiPlots(f1,2); + NikolaiPlots(f1,3); + NikolaiPlots(f1,4); + + //produce number of X per event plots + make1DPlot("Digis/hStripNFired",f1,"Fired Strips per Event", 1110, "Digis_hStripNFired.png"); + make1DPlot("Digis/hWirenGroupsTotal",f1,"Fired Wires per Event", 1110, "Digis_hWirenGroupsTotal.png"); + make1DPlot("recHits/hRHnrechits",f1,"RecHits per Event", 1110, "recHits_hRHnrechits.png"); + make1DPlot("Segments/hSnSegments",f1,"Segments per Event", 1110, "Segments_hSnSegments.png"); + + //efficiency plots + makeEffGif("Efficiency/hRHSTE", f1, "RecHit Efficiency", "Efficiency_hRHEff.png"); + makeEffGif("Efficiency/hSSTE", f1, "Segment Efficiency", "Efficiency_hSEff.png"); + Draw2DEfficiency("Efficiency/hRHSTE2", f1, "RecHit Efficiency 2D", "Efficiency_hRHEff2.png"); + Draw2DEfficiency("Efficiency/hSSTE2", f1, "Segment Efficiency 2D", "Efficiency_hSEff2.png"); + Draw2DEfficiency("Efficiency/hWireSTE2", f1, "Wire Efficiency 2D", "Efficiency_hWireEff2.png"); + Draw2DEfficiency("Efficiency/hStripSTE2", f1, "Strip Efficiency 2D", "Efficiency_hStripEff2.png"); + Draw2DTempPlot("Efficiency/hSensitiveAreaEvt", f1, false, "Efficiency_hEvts2.png"); + + + //produce wire timing plots + make1DPlot("Digis/hWireTBin+11",f1,"Wire TimeBin Fired ME+1/1", 1110,"Digis_hWireTBin+11.png"); + make1DPlot("Digis/hWireTBin+12",f1,"Wire TimeBin Fired ME+1/2", 1110,"Digis_hWireTBin+12.png"); + make1DPlot("Digis/hWireTBin+13",f1,"Wire TimeBin Fired ME+1/3", 1110,"Digis_hWireTBin+13.png"); + make1DPlot("Digis/hWireTBin+21",f1,"Wire TimeBin Fired ME+2/1", 1110,"Digis_hWireTBin+21.png"); + make1DPlot("Digis/hWireTBin+22",f1,"Wire TimeBin Fired ME+2/2", 1110,"Digis_hWireTBin+22.png"); + make1DPlot("Digis/hWireTBin+31",f1,"Wire TimeBin Fired ME+3/1", 1110,"Digis_hWireTBin+31.png"); + make1DPlot("Digis/hWireTBin+32",f1,"Wire TimeBin Fired ME+3/2", 1110,"Digis_hWireTBin+32.png"); + make1DPlot("Digis/hWireTBin+41",f1,"Wire TimeBin Fired ME+4/1", 1110,"Digis_hWireTBin+41.png"); + make1DPlot("Digis/hWireTBin-11",f1,"Wire TimeBin Fired ME-1/1", 1110,"Digis_hWireTBin-11.png"); + make1DPlot("Digis/hWireTBin-12",f1,"Wire TimeBin Fired ME-1/2", 1110,"Digis_hWireTBin-12.png"); + make1DPlot("Digis/hWireTBin-13",f1,"Wire TimeBin Fired ME-1/3", 1110,"Digis_hWireTBin-13.png"); + make1DPlot("Digis/hWireTBin-21",f1,"Wire TimeBin Fired ME-2/1", 1110,"Digis_hWireTBin-21.png"); + make1DPlot("Digis/hWireTBin-22",f1,"Wire TimeBin Fired ME-2/2", 1110,"Digis_hWireTBin-22.png"); + make1DPlot("Digis/hWireTBin-31",f1,"Wire TimeBin Fired ME-3/1", 1110,"Digis_hWireTBin-31.png"); + make1DPlot("Digis/hWireTBin-32",f1,"Wire TimeBin Fired ME-3/2", 1110,"Digis_hWireTBin-32.png"); + make1DPlot("Digis/hWireTBin-41",f1,"Wire TimeBin Fired ME-4/1", 1110,"Digis_hWireTBin-41.png"); + + + //produce pedestal noise plots + make1DPlot("PedestalNoise/hStripPedME+11",f1,"Pedestal Noise Distribution ME+1/1b", 1110,"PedestalNoise_hStripPedME+11.png"); + make1DPlot("PedestalNoise/hStripPedME+14",f1,"Pedestal Noise Distribution ME+1/1a", 1110,"PedestalNoise_hStripPedME+11a.png"); + make1DPlot("PedestalNoise/hStripPedME+12",f1,"Pedestal Noise Distribution ME+1/2", 1110,"PedestalNoise_hStripPedME+12.png"); + make1DPlot("PedestalNoise/hStripPedME+13",f1,"Pedestal Noise Distribution ME+1/3", 1110,"PedestalNoise_hStripPedME+13.png"); + make1DPlot("PedestalNoise/hStripPedME+21",f1,"Pedestal Noise Distribution ME+2/1", 1110,"PedestalNoise_hStripPedME+21.png"); + make1DPlot("PedestalNoise/hStripPedME+22",f1,"Pedestal Noise Distribution ME+2/2", 1110,"PedestalNoise_hStripPedME+22.png"); + make1DPlot("PedestalNoise/hStripPedME+31",f1,"Pedestal Noise Distribution ME+3/1", 1110,"PedestalNoise_hStripPedME+31.png"); + make1DPlot("PedestalNoise/hStripPedME+32",f1,"Pedestal Noise Distribution ME+3/2", 1110,"PedestalNoise_hStripPedME+32.png"); + make1DPlot("PedestalNoise/hStripPedME+41",f1,"Pedestal Noise Distribution ME+4/1", 1110,"PedestalNoise_hStripPedME+41.png"); + make1DPlot("PedestalNoise/hStripPedME-11",f1,"Pedestal Noise Distribution ME-1/1b", 1110,"PedestalNoise_hStripPedME-11.png"); + make1DPlot("PedestalNoise/hStripPedME-14",f1,"Pedestal Noise Distribution ME-1/1a", 1110,"PedestalNoise_hStripPedME-11a.png"); + make1DPlot("PedestalNoise/hStripPedME-12",f1,"Pedestal Noise Distribution ME-1/2", 1110,"PedestalNoise_hStripPedME-12.png"); + make1DPlot("PedestalNoise/hStripPedME-13",f1,"Pedestal Noise Distribution ME-1/3", 1110,"PedestalNoise_hStripPedME-13.png"); + make1DPlot("PedestalNoise/hStripPedME-21",f1,"Pedestal Noise Distribution ME-2/1", 1110,"PedestalNoise_hStripPedME-21.png"); + make1DPlot("PedestalNoise/hStripPedME-22",f1,"Pedestal Noise Distribution ME-2/2", 1110,"PedestalNoise_hStripPedME-22.png"); + make1DPlot("PedestalNoise/hStripPedME-31",f1,"Pedestal Noise Distribution ME-3/1", 1110,"PedestalNoise_hStripPedME-31.png"); + make1DPlot("PedestalNoise/hStripPedME-32",f1,"Pedestal Noise Distribution ME-3/2", 1110,"PedestalNoise_hStripPedME-32.png"); + make1DPlot("PedestalNoise/hStripPedME-41",f1,"Pedestal Noise Distribution ME-4/1", 1110,"PedestalNoise_hStripPedME-41.png"); + + // resolution + make1DPlot("Resolution/hSResid+11",f1,"Expected Position from Fit - Reconstructed, ME+1/1b", 1110,"Resolution_hSResid+11.png"); + make1DPlot("Resolution/hSResid+12",f1,"Expected Position from Fit - Reconstructed, ME+1/2", 1110,"Resolution_hSResid+12.png"); + make1DPlot("Resolution/hSResid+13",f1,"Expected Position from Fit - Reconstructed, ME+1/3", 1110,"Resolution_hSResid+13.png"); + make1DPlot("Resolution/hSResid+14",f1,"Expected Position from Fit - Reconstructed, ME+1/1a", 1110,"Resolution_hSResid+11a.png"); + make1DPlot("Resolution/hSResid+21",f1,"Expected Position from Fit - Reconstructed, ME+2/1", 1110,"Resolution_hSResid+21.png"); + make1DPlot("Resolution/hSResid+22",f1,"Expected Position from Fit - Reconstructed, ME+2/2", 1110,"Resolution_hSResid+22.png"); + make1DPlot("Resolution/hSResid+31",f1,"Expected Position from Fit - Reconstructed, ME+3/1", 1110,"Resolution_hSResid+31.png"); + make1DPlot("Resolution/hSResid+32",f1,"Expected Position from Fit - Reconstructed, ME+3/2", 1110,"Resolution_hSResid+32.png"); + make1DPlot("Resolution/hSResid+41",f1,"Expected Position from Fit - Reconstructed, ME+4/1", 1110,"Resolution_hSResid+41.png"); + make1DPlot("Resolution/hSResid-11",f1,"Expected Position from Fit - Reconstructed, ME-1/1b", 1110,"Resolution_hSResid-11.png"); + make1DPlot("Resolution/hSResid-12",f1,"Expected Position from Fit - Reconstructed, ME-1/2", 1110,"Resolution_hSResid-12.png"); + make1DPlot("Resolution/hSResid-13",f1,"Expected Position from Fit - Reconstructed, ME-1/3", 1110,"Resolution_hSResid-13.png"); + make1DPlot("Resolution/hSResid-14",f1,"Expected Position from Fit - Reconstructed, ME-1/1a", 1110,"Resolution_hSResid-11a.png"); + make1DPlot("Resolution/hSResid-21",f1,"Expected Position from Fit - Reconstructed, ME-2/1", 1110,"Resolution_hSResid-21.png"); + make1DPlot("Resolution/hSResid-22",f1,"Expected Position from Fit - Reconstructed, ME-2/2", 1110,"Resolution_hSResid-22.png"); + make1DPlot("Resolution/hSResid-31",f1,"Expected Position from Fit - Reconstructed, ME-3/1", 1110,"Resolution_hSResid-31.png"); + make1DPlot("Resolution/hSResid-32",f1,"Expected Position from Fit - Reconstructed, ME-3/2", 1110,"Resolution_hSResid-32.png"); + make1DPlot("Resolution/hSResid-41",f1,"Expected Position from Fit - Reconstructed, ME-4/1", 1110,"Resolution_hSResid-41.png"); + + // rechit strip position + make1DPlot("recHits/hRHstpos+11",f1,"Strip Position (ME+1/1b)", 1110,"recHits_hRHstpos+11.png"); + make1DPlot("recHits/hRHstpos+14",f1,"Strip Position (ME+1/1a)", 1110,"recHits_hRHstpos+11a.png"); + make1DPlot("recHits/hRHstpos+12",f1,"Strip Position (ME+1/2)", 1110,"recHits_hRHstpos+12.png"); + make1DPlot("recHits/hRHstpos+13",f1,"Strip Position (ME+1/3)", 1110,"recHits_hRHstpos+13.png"); + make1DPlot("recHits/hRHstpos+21",f1,"Strip Position (ME+2/1)", 1110,"recHits_hRHstpos+21.png"); + make1DPlot("recHits/hRHstpos+22",f1,"Strip Position (ME+2/2)", 1110,"recHits_hRHstpos+22.png"); + make1DPlot("recHits/hRHstpos+31",f1,"Strip Position (ME+3/1)", 1110,"recHits_hRHstpos+31.png"); + make1DPlot("recHits/hRHstpos+32",f1,"Strip Position (ME+3/2)", 1110,"recHits_hRHstpos+32.png"); + make1DPlot("recHits/hRHstpos+41",f1,"Strip Position (ME+4/1)", 1110,"recHits_hRHstpos+41.png"); + make1DPlot("recHits/hRHstpos-11",f1,"Strip Position (ME-1/1b)", 1110,"recHits_hRHstpos-11.png"); + make1DPlot("recHits/hRHstpos-14",f1,"Strip Position (ME-1/1a)", 1110,"recHits_hRHstpos-11a.png"); + make1DPlot("recHits/hRHstpos-12",f1,"Strip Position (ME-1/2)", 1110,"recHits_hRHstpos-12.png"); + make1DPlot("recHits/hRHstpos-13",f1,"Strip Position (ME-1/3)", 1110,"recHits_hRHstpos-13.png"); + make1DPlot("recHits/hRHstpos-21",f1,"Strip Position (ME-2/1)", 1110,"recHits_hRHstpos-21.png"); + make1DPlot("recHits/hRHstpos-22",f1,"Strip Position (ME-2/2)", 1110,"recHits_hRHstpos-22.png"); + make1DPlot("recHits/hRHstpos-31",f1,"Strip Position (ME-3/1)", 1110,"recHits_hRHstpos-31.png"); + make1DPlot("recHits/hRHstpos-32",f1,"Strip Position (ME-3/2)", 1110,"recHits_hRHstpos-32.png"); + make1DPlot("recHits/hRHstpos-41",f1,"Strip Position (ME-4/1)", 1110,"recHits_hRHstpos-41.png"); + + // rechit timing + make1DPlot("recHits/hRHTiming+11",f1,"RecHit Timing ME+1/1b", 1110,"recHits_hRHTiming+11.png"); + make1DPlot("recHits/hRHTiming+14",f1,"RecHit Timing ME+1/1a", 1110,"recHits_hRHTiming+11a.png"); + make1DPlot("recHits/hRHTiming+12",f1,"RecHit Timing ME+1/2", 1110,"recHits_hRHTiming+12.png"); + make1DPlot("recHits/hRHTiming+13",f1,"RecHit Timing ME+1/3", 1110,"recHits_hRHTiming+13.png"); + make1DPlot("recHits/hRHTiming+21",f1,"RecHit Timing ME+2/1", 1110,"recHits_hRHTiming+21.png"); + make1DPlot("recHits/hRHTiming+22",f1,"RecHit Timing ME+2/2", 1110,"recHits_hRHTiming+22.png"); + make1DPlot("recHits/hRHTiming+31",f1,"RecHit Timing ME+3/1", 1110,"recHits_hRHTiming+31.png"); + make1DPlot("recHits/hRHTiming+32",f1,"RecHit Timing ME+3/2", 1110,"recHits_hRHTiming+32.png"); + make1DPlot("recHits/hRHTiming+41",f1,"RecHit Timing ME+4/1", 1110,"recHits_hRHTiming+41.png"); + make1DPlot("recHits/hRHTiming-11",f1,"RecHit Timing ME-1/1b", 1110,"recHits_hRHTiming-11.png"); + make1DPlot("recHits/hRHTiming-14",f1,"RecHit Timing ME-1/1a", 1110,"recHits_hRHTiming-11a.png"); + make1DPlot("recHits/hRHTiming-12",f1,"RecHit Timing ME-1/2", 1110,"recHits_hRHTiming-12.png"); + make1DPlot("recHits/hRHTiming-13",f1,"RecHit Timing ME-1/3", 1110,"recHits_hRHTiming-13.png"); + make1DPlot("recHits/hRHTiming-21",f1,"RecHit Timing ME-2/1", 1110,"recHits_hRHTiming-21.png"); + make1DPlot("recHits/hRHTiming-22",f1,"RecHit Timing ME-2/2", 1110,"recHits_hRHTiming-22.png"); + make1DPlot("recHits/hRHTiming-31",f1,"RecHit Timing ME-3/1", 1110,"recHits_hRHTiming-31.png"); + make1DPlot("recHits/hRHTiming-32",f1,"RecHit Timing ME-3/2", 1110,"recHits_hRHTiming-32.png"); + make1DPlot("recHits/hRHTiming-41",f1,"RecHit Timing ME-4/1", 1110,"recHits_hRHTiming-41.png"); + + // rechit charge + make1DPlot("recHits/hRHSumQ+11",f1,"Sum 3x3 RecHit Charge ME+1/1b", 1110,"recHits_hRHSumQ+11.png"); + make1DPlot("recHits/hRHSumQ+14",f1,"Sum 3x3 RecHit Charge ME+1/1a", 1110,"recHits_hRHSumQ+11a.png"); + make1DPlot("recHits/hRHSumQ+12",f1,"Sum 3x3 RecHit Charge ME+1/2", 1110,"recHits_hRHSumQ+12.png"); + make1DPlot("recHits/hRHSumQ+13",f1,"Sum 3x3 RecHit Charge ME+1/3", 1110,"recHits_hRHSumQ+13.png"); + make1DPlot("recHits/hRHSumQ+21",f1,"Sum 3x3 RecHit Charge ME+2/1", 1110,"recHits_hRHSumQ+21.png"); + make1DPlot("recHits/hRHSumQ+22",f1,"Sum 3x3 RecHit Charge ME+2/2", 1110,"recHits_hRHSumQ+22.png"); + make1DPlot("recHits/hRHSumQ+31",f1,"Sum 3x3 RecHit Charge ME+3/1", 1110,"recHits_hRHSumQ+31.png"); + make1DPlot("recHits/hRHSumQ+32",f1,"Sum 3x3 RecHit Charge ME+3/2", 1110,"recHits_hRHSumQ+32.png"); + make1DPlot("recHits/hRHSumQ+41",f1,"Sum 3x3 RecHit Charge ME+4/1", 1110,"recHits_hRHSumQ+41.png"); + make1DPlot("recHits/hRHSumQ-11",f1,"Sum 3x3 RecHit Charge ME-1/1b", 1110,"recHits_hRHSumQ-11.png"); + make1DPlot("recHits/hRHSumQ-14",f1,"Sum 3x3 RecHit Charge ME-1/1a", 1110,"recHits_hRHSumQ-11a.png"); + make1DPlot("recHits/hRHSumQ-12",f1,"Sum 3x3 RecHit Charge ME-1/2", 1110,"recHits_hRHSumQ-12.png"); + make1DPlot("recHits/hRHSumQ-13",f1,"Sum 3x3 RecHit Charge ME-1/3", 1110,"recHits_hRHSumQ-13.png"); + make1DPlot("recHits/hRHSumQ-21",f1,"Sum 3x3 RecHit Charge ME-2/1", 1110,"recHits_hRHSumQ-21.png"); + make1DPlot("recHits/hRHSumQ-22",f1,"Sum 3x3 RecHit Charge ME-2/2", 1110,"recHits_hRHSumQ-22.png"); + make1DPlot("recHits/hRHSumQ-31",f1,"Sum 3x3 RecHit Charge ME-3/1", 1110,"recHits_hRHSumQ-31.png"); + make1DPlot("recHits/hRHSumQ-32",f1,"Sum 3x3 RecHit Charge ME-3/2", 1110,"recHits_hRHSumQ-32.png"); + make1DPlot("recHits/hRHSumQ-41",f1,"Sum 3x3 RecHit Charge ME-4/1", 1110,"recHits_hRHSumQ-41.png"); + + make1DPlot("recHits/hRHRatioQ+11",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/1b", 1110,"recHits_hRHRatioQ+11.png"); + make1DPlot("recHits/hRHRatioQ+14",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/1a", 1110,"recHits_hRHRatioQ+11a.png"); + make1DPlot("recHits/hRHRatioQ+12",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/2", 1110,"recHits_hRHRatioQ+12.png"); + make1DPlot("recHits/hRHRatioQ+13",f1,"Charge Ratio (Ql_Qr)/Qt ME+1/3", 1110,"recHits_hRHRatioQ+13.png"); + make1DPlot("recHits/hRHRatioQ+21",f1,"Charge Ratio (Ql_Qr)/Qt ME+2/1", 1110,"recHits_hRHRatioQ+21.png"); + make1DPlot("recHits/hRHRatioQ+22",f1,"Charge Ratio (Ql_Qr)/Qt ME+2/2", 1110,"recHits_hRHRatioQ+22.png"); + make1DPlot("recHits/hRHRatioQ+31",f1,"Charge Ratio (Ql_Qr)/Qt ME+3/1", 1110,"recHits_hRHRatioQ+31.png"); + make1DPlot("recHits/hRHRatioQ+32",f1,"Charge Ratio (Ql_Qr)/Qt ME+3/2", 1110,"recHits_hRHRatioQ+32.png"); + make1DPlot("recHits/hRHRatioQ+41",f1,"Charge Ratio (Ql_Qr)/Qt ME+4/1", 1110,"recHits_hRHRatioQ+41.png"); + make1DPlot("recHits/hRHRatioQ-11",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/1b", 1110,"recHits_hRHRatioQ-11.png"); + make1DPlot("recHits/hRHRatioQ-14",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/1a", 1110,"recHits_hRHRatioQ-11a.png"); + make1DPlot("recHits/hRHRatioQ-12",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/2", 1110,"recHits_hRHRatioQ-12.png"); + make1DPlot("recHits/hRHRatioQ-13",f1,"Charge Ratio (Ql_Qr)/Qt ME-1/3", 1110,"recHits_hRHRatioQ-13.png"); + make1DPlot("recHits/hRHRatioQ-21",f1,"Charge Ratio (Ql_Qr)/Qt ME-2/1", 1110,"recHits_hRHRatioQ-21.png"); + make1DPlot("recHits/hRHRatioQ-22",f1,"Charge Ratio (Ql_Qr)/Qt ME-2/2", 1110,"recHits_hRHRatioQ-22.png"); + make1DPlot("recHits/hRHRatioQ-31",f1,"Charge Ratio (Ql_Qr)/Qt ME-3/1", 1110,"recHits_hRHRatioQ-31.png"); + make1DPlot("recHits/hRHRatioQ-32",f1,"Charge Ratio (Ql_Qr)/Qt ME-3/2", 1110,"recHits_hRHRatioQ-32.png"); + make1DPlot("recHits/hRHRatioQ-41",f1,"Charge Ratio (Ql_Qr)/Qt ME-4/1", 1110,"recHits_hRHRatioQ-41.png"); + + //hits on a segment + make1DPlot("Segments/hSnHits+11",f1,"N Hits on Segments ME+1/1b", 1110,"Segments_hSnHits+11.png"); + make1DPlot("Segments/hSnHits+14",f1,"N Hits on Segments ME+1/1a", 1110,"Segments_hSnHits+11a.png"); + make1DPlot("Segments/hSnHits+12",f1,"N Hits on Segments ME+1/2", 1110,"Segments_hSnHits+12.png"); + make1DPlot("Segments/hSnHits+13",f1,"N Hits on Segments ME+1/3", 1110,"Segments_hSnHits+13.png"); + make1DPlot("Segments/hSnHits+21",f1,"N Hits on Segments ME+2/1", 1110,"Segments_hSnHits+21.png"); + make1DPlot("Segments/hSnHits+22",f1,"N Hits on Segments ME+2/2", 1110,"Segments_hSnHits+22.png"); + make1DPlot("Segments/hSnHits+31",f1,"N Hits on Segments ME+3/1", 1110,"Segments_hSnHits+31.png"); + make1DPlot("Segments/hSnHits+32",f1,"N Hits on Segments ME+3/2", 1110,"Segments_hSnHits+32.png"); + make1DPlot("Segments/hSnHits+41",f1,"N Hits on Segments ME+4/1", 1110,"Segments_hSnHits+41.png"); + make1DPlot("Segments/hSnHits-11",f1,"N Hits on Segments ME-1/1b", 1110,"Segments_hSnHits-11.png"); + make1DPlot("Segments/hSnHits-14",f1,"N Hits on Segments ME-1/1a", 1110,"Segments_hSnHits-11a.png"); + make1DPlot("Segments/hSnHits-12",f1,"N Hits on Segments ME-1/2", 1110,"Segments_hSnHits-12.png"); + make1DPlot("Segments/hSnHits-13",f1,"N Hits on Segments ME-1/3", 1110,"Segments_hSnHits-13.png"); + make1DPlot("Segments/hSnHits-21",f1,"N Hits on Segments ME-2/1", 1110,"Segments_hSnHits-21.png"); + make1DPlot("Segments/hSnHits-22",f1,"N Hits on Segments ME-2/2", 1110,"Segments_hSnHits-22.png"); + make1DPlot("Segments/hSnHits-31",f1,"N Hits on Segments ME-3/1", 1110,"Segments_hSnHits-31.png"); + make1DPlot("Segments/hSnHits-32",f1,"N Hits on Segments ME-3/2", 1110,"Segments_hSnHits-32.png"); + make1DPlot("Segments/hSnHits-41",f1,"N Hits on Segments ME-4/1", 1110,"Segments_hSnHits-41.png"); + + // segment chi2 + make1DPlot("Segments/hSChiSq+11",f1,"Segment Chi2/ndof ME+1/1b", 1110,"Segments_hSChiSq+11.png"); + make1DPlot("Segments/hSChiSq+14",f1,"Segment Chi2/ndof ME+1/1a", 1110,"Segments_hSChiSq+11a.png"); + make1DPlot("Segments/hSChiSq+12",f1,"Segment Chi2/ndof ME+1/2", 1110,"Segments_hSChiSq+12.png"); + make1DPlot("Segments/hSChiSq+13",f1,"Segment Chi2/ndof ME+1/3", 1110,"Segments_hSChiSq+13.png"); + make1DPlot("Segments/hSChiSq+21",f1,"Segment Chi2/ndof ME+2/1", 1110,"Segments_hSChiSq+21.png"); + make1DPlot("Segments/hSChiSq+22",f1,"Segment Chi2/ndof ME+2/2", 1110,"Segments_hSChiSq+22.png"); + make1DPlot("Segments/hSChiSq+31",f1,"Segment Chi2/ndof ME+3/1", 1110,"Segments_hSChiSq+31.png"); + make1DPlot("Segments/hSChiSq+32",f1,"Segment Chi2/ndof ME+3/2", 1110,"Segments_hSChiSq+32.png"); + make1DPlot("Segments/hSChiSq+41",f1,"Segment Chi2/ndof ME+4/1", 1110,"Segments_hSChiSq+41.png"); + make1DPlot("Segments/hSChiSq-11",f1,"Segment Chi2/ndof ME-1/1b", 1110,"Segments_hSChiSq-11.png"); + make1DPlot("Segments/hSChiSq-14",f1,"Segment Chi2/ndof ME-1/1a", 1110,"Segments_hSChiSq-11a.png"); + make1DPlot("Segments/hSChiSq-12",f1,"Segment Chi2/ndof ME-1/2", 1110,"Segments_hSChiSq-12.png"); + make1DPlot("Segments/hSChiSq-13",f1,"Segment Chi2/ndof ME-1/3", 1110,"Segments_hSChiSq-13.png"); + make1DPlot("Segments/hSChiSq-21",f1,"Segment Chi2/ndof ME-2/1", 1110,"Segments_hSChiSq-21.png"); + make1DPlot("Segments/hSChiSq-22",f1,"Segment Chi2/ndof ME-2/2", 1110,"Segments_hSChiSq-22.png"); + make1DPlot("Segments/hSChiSq-31",f1,"Segment Chi2/ndof ME-3/1", 1110,"Segments_hSChiSq-31.png"); + make1DPlot("Segments/hSChiSq-32",f1,"Segment Chi2/ndof ME-3/2", 1110,"Segments_hSChiSq-32.png"); + make1DPlot("Segments/hSChiSq-41",f1,"Segment Chi2/ndof ME-4/1", 1110,"Segments_hSChiSq-41.png"); + + //miscellaneous + make1DPlot("Segments/hSGlobalPhi",f1,"Segment Global Phi", 1110,"Segments_hSGlobalPhi.png"); + make1DPlot("Segments/hSGlobalTheta",f1,"Segment Global Theta", 1110,"Segments_hSGlobalTheta.png"); + + + +} + +EOF + +root -l -q -b ${MACRO} + +rm makePlots.C + diff --git a/RecoLocalMuon/CSCValidation/macros/makePlots_interactive.sh b/RecoLocalMuon/CSCValidation/macros/makePlots_interactive.sh new file mode 100755 index 0000000000000..6d42bff8147b2 --- /dev/null +++ b/RecoLocalMuon/CSCValidation/macros/makePlots_interactive.sh @@ -0,0 +1,13 @@ +#!/bin/bash +## +## Call makePlots.C to make plots from root file output of CSCValidation +## CSC DPG - Tim Cox - 12.07.2022 +## Run it like +## ./makePlots.sh path_to_root_file +## The plots are png files and produced in the current directory +## Remains in root, so need '.q' to quit +## +ARG1=$1 +echo "Called with arg = "${ARG1} +root 'makePlots.C( "'${ARG1}'" )' + diff --git a/RecoLocalMuon/CSCValidation/macros/myFunctions.C b/RecoLocalMuon/CSCValidation/macros/myFunctions.C index cde0a2e094cd6..b74764d6496a5 100644 --- a/RecoLocalMuon/CSCValidation/macros/myFunctions.C +++ b/RecoLocalMuon/CSCValidation/macros/myFunctions.C @@ -1,45 +1,69 @@ -TFile* OpenFiles(std::string path){ +// myFunctions.C contains various functions required by makePlots.C +// for making plots of root file output from CSCValidation +// Original author: Andy Kubik (NWU) +// - Updated by many people over the past 15 years +// - This version from Sicheng Wang (UCSB) Jul-2022 +// - Please contact CSC DPG for current status - 12.07.2022 +void drawColoredChamberLines(int station, int nchamber1[4][36]); + +TFile *OpenFiles(std::string path) { TFile *f; - f = new TFile(path.c_str(),"READ"); + f = new TFile(path.c_str(), "READ"); return f; - } -void printEmptyChambers(std::string histoname, std::string oname, TFile* f){ - TH2I *plot = (TH2I*)f->Get(histoname.c_str()); +void printEmptyChambers(std::string histoname, std::string oname, TFile *f) { + TH2I *plot = (TH2I *)f->Get(histoname.c_str()); std::string endcap, chamber; - int limitr, limitc; + int limitr, limitc; std::vector deadchambers; - - for (int e = 0; e < 2; e++){ - for (int s = 0; s < 4; s++){ - if (s == 0) limitr = 4; - if (s == 1 || s == 2) limitr = 2; - if (s == 3) limitr = 1; - for (int r = 0; r < limitr; r++){ - if (s == 0) limitc = 36; - if (s != 0 && r == 0) limitc = 18; - if (s != 0 && r == 1) limitc = 36; - for (int c = 0; c < limitc; c++){ - int type = 0; - if (s == 0 && r == 0) type = 2; - else if (s == 0 && r == 1) type = 3; - else if (s == 0 && r == 2) type = 4; - else if (s == 0 && r == 3) type = 1; - else type = (s+1)*2 + (r+1); - if (e == 0) type = type + 10; - if (e == 1) type = 11 - type; - int bin = plot->GetBin((c+1),type); + + for (int e = 0; e < 2; e++) { + for (int s = 0; s < 4; s++) { + if (s == 0) + limitr = 4; + if (s == 1 || s == 2) + limitr = 2; + if (s == 3) + limitr = 1; + for (int r = 0; r < limitr; r++) { + if (s == 0) + limitc = 36; + if (s != 0 && r == 0) + limitc = 18; + if (s != 0 && r == 1) + limitc = 36; + for (int c = 0; c < limitc; c++) { + int type = 0; + if (s == 0 && r == 0) + type = 2; + else if (s == 0 && r == 1) + type = 3; + else if (s == 0 && r == 2) + type = 4; + else if (s == 0 && r == 3) + type = 1; + else + type = (s + 1) * 2 + (r + 1); + if (e == 0) + type = type + 10; + if (e == 1) + type = 11 - type; + int bin = plot->GetBin((c + 1), type); float content = plot->GetBinContent(bin); std::ostringstream oss; - if (e == 0) endcap = "+"; - if (e == 1) endcap = "-"; - oss << "ME " << endcap << (s+1) << "/" << (r+1) << "/" << (c+1); + if (e == 0) + endcap = "+"; + if (e == 1) + endcap = "-"; + oss << "ME " << endcap << (s + 1) << "/" << (r + 1) << "/" << (c + 1); chamber = oss.str(); - if (content == 0){ - if (oname == "wire digis" && (s == 0 && r == 3)) continue; - else deadchambers.push_back(chamber); + if (content == 0) { + if (oname == "wire digis" && (s == 0 && r == 3)) + continue; + else + deadchambers.push_back(chamber); } } } @@ -48,27 +72,110 @@ void printEmptyChambers(std::string histoname, std::string oname, TFile* f){ int n_dc = deadchambers.size(); ofstream file; - file.open("deadchamberlist.txt",ios::app); + file.open("deadchamberlist.txt", ios::app); file << "Chambers with missing " << oname << "...\n" << endl; - if (n_dc > 0){ - for (int n = 0; n < n_dc; n++){ + if (n_dc > 0) { + for (int n = 0; n < n_dc; n++) { file << deadchambers[n] << endl; } } file << "\n\n\n\n"; file.close(); +} + +void make1DPlot(std::string histoname, TFile *f1, std::string histotitle, int statoption, std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.7); + h1->GetXaxis()->SetTitleSize(0.06); + h1->GetYaxis()->SetTitleSize(0.06); + h1->GetYaxis()->CenterTitle(kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); + + h1->Draw(); + + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; } -void make1DPlot(std::string histoname, TFile* f1, std::string histotitle, int statoption, std::string savename){ +void make1DPlot(std::string histoname, + TFile *f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); - TH1F *h1 = (TH1F*)f1->Get(histoname.c_str()); + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitle(xtitle.c_str()); + h1->GetYaxis()->SetTitle(ytitle.c_str()); + h1->GetXaxis()->SetTitleOffset(0.85); + h1->GetYaxis()->SetTitleOffset(0.85); + h1->GetXaxis()->SetTitleSize(0.05); + h1->GetYaxis()->SetTitleSize(0.05); + h1->GetYaxis()->CenterTitle(kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); - TCanvas *c = new TCanvas("c","my canvas",1); + h1->Draw(); + + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; +} - if (h1){ - if (statoption == 0) gStyle->SetOptStat(kFALSE); - else gStyle->SetOptStat(statoption); +void make2DPlot(std::string histoname, TFile *f1, std::string histotitle, int statoption, std::string savename) { + TH2F *h1 = (TH2F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); gStyle->SetHistFillColor(92); gStyle->SetFrameFillColor(4000); gStyle->SetTitleW(0.7); @@ -84,24 +191,150 @@ void make1DPlot(std::string histoname, TFile* f1, std::string histotitle, int st h1->GetYaxis()->SetLabelSize(0.04); h1->GetXaxis()->SetTitleOffset(0.7); h1->GetXaxis()->SetTitleSize(0.06); - h1->GetXaxis()->SetNdivisions(208,kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); + + h1->Draw(); + + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; +} + +void make2DPlot(std::string histoname, + TFile *f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename) { + TH2F *h1 = (TH2F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); + + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetTitle(xtitle.c_str()); + h1->GetYaxis()->SetTitle(ytitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.85); + h1->GetYaxis()->SetTitleOffset(0.85); + h1->GetXaxis()->SetTitleSize(0.05); + h1->GetYaxis()->SetTitleSize(0.05); + h1->GetYaxis()->CenterTitle(kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); h1->Draw(); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); } delete c; +} + +void makeProfile(std::string histoname, TFile *f1, std::string histotitle, int statoption, std::string savename) { + TProfile *h1 = (TProfile *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); + + h1->GetYaxis()->SetRangeUser(h1->GetYmin(), h1->GetYmax()); + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.7); + h1->GetXaxis()->SetTitleSize(0.06); + h1->GetXaxis()->SetNdivisions(208, kTRUE); + + h1->Draw(); + + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; } +void makeProfile(std::string histoname, + TFile *f1, + std::string histotitle, + std::string xtitle, + std::string ytitle, + int statoption, + std::string savename) { + TProfile *h1 = (TProfile *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); + + h1->GetYaxis()->SetRangeUser(h1->GetYmin(), h1->GetYmax()); + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetTitle(xtitle.c_str()); + h1->GetYaxis()->SetTitle(ytitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.85); + h1->GetYaxis()->SetTitleOffset(0.85); + h1->GetXaxis()->SetTitleSize(0.05); + h1->GetYaxis()->SetTitleSize(0.05); + h1->GetYaxis()->CenterTitle(kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); -void makeCSCOccupancy(std::string histoname, TFile* f1, std::string histotitle, std::string savename){ + h1->Draw(); - TH1F *h1 = (TH1F*)f1->Get(histoname.c_str()); + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; +} + +void makeCSCOccupancy(std::string histoname, TFile *f1, std::string histotitle, std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); - TCanvas *c = new TCanvas("c","my canvas",1); + TCanvas *c = new TCanvas("c", "my canvas", 1); - if (h1){ + if (h1) { gStyle->SetOptStat(kFALSE); gStyle->SetHistFillColor(92); gStyle->SetFrameFillColor(4000); @@ -118,40 +351,46 @@ void makeCSCOccupancy(std::string histoname, TFile* f1, std::string histotitle, h1->GetYaxis()->SetLabelSize(0.04); h1->GetXaxis()->SetTitleOffset(0.7); h1->GetXaxis()->SetTitleSize(0.06); - h1->GetXaxis()->SetNdivisions(208,kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); - h1->GetXaxis()->SetBinLabel(2,"Total Events"); - h1->GetXaxis()->SetBinLabel(4,"# Events with Wires"); - h1->GetXaxis()->SetBinLabel(6,"# Events with Strips"); - h1->GetXaxis()->SetBinLabel(8,"# Events with Wires&Strips"); - h1->GetXaxis()->SetBinLabel(10,"# Events with Rechits"); - h1->GetXaxis()->SetBinLabel(12,"# Events with Segments"); - h1->GetXaxis()->SetBinLabel(14,"Events Rejected"); + h1->GetXaxis()->SetBinLabel(2, "Total Events"); + h1->GetXaxis()->SetBinLabel(4, "# Events with Wires"); + h1->GetXaxis()->SetBinLabel(6, "# Events with Strips"); + h1->GetXaxis()->SetBinLabel(8, "# Events with Wires&Strips"); + h1->GetXaxis()->SetBinLabel(10, "# Events with Rechits"); + h1->GetXaxis()->SetBinLabel(12, "# Events with Segments"); + h1->GetXaxis()->SetBinLabel(14, "Events Rejected"); h1->Draw(); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); } delete c; - } -void make1DPlot2(std::string histoname1, std::string histoname2, int statoption, TFile* f1, std::string t1, std::string t2, std::string savename){ +void make1DPlot2(std::string histoname1, + std::string histoname2, + int statoption, + TFile *f1, + std::string t1, + std::string t2, + std::string savename) { + // use this if you want two plots on one canvas - // use this if you want two plots on one canvas - - TH1F *a1 = (TH1F*)f1->Get(histoname1.c_str()); - TH1F *b1 = (TH1F*)f1->Get(histoname2.c_str()); + TH1F *a1 = (TH1F *)f1->Get(histoname1.c_str()); + TH1F *b1 = (TH1F *)f1->Get(histoname2.c_str()); - TCanvas *c = new TCanvas("c","my canvas",1); - c->Divide(1,2); + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->Divide(1, 2); - if (a1){ + if (a1) { c->cd(1); - if (statoption == 0) gStyle->SetOptStat(kFALSE); - else gStyle->SetOptStat(statoption); + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); gStyle->SetHistFillColor(92); gStyle->SetFrameFillColor(4000); gStyle->SetTitleW(0.4); @@ -166,62 +405,56 @@ void make1DPlot2(std::string histoname1, std::string histoname2, int statoption, a1->GetYaxis()->SetLabelSize(0.06); a1->GetXaxis()->SetTitleOffset(0.7); a1->GetXaxis()->SetTitleSize(0.06); - a1->GetXaxis()->SetNdivisions(208,kTRUE); + a1->GetXaxis()->SetNdivisions(208, kTRUE); a1->Draw(); } - if (b1){ + if (b1) { gStyle->SetHistFillColor(72); b1->UseCurrentStyle(); - t2 = t2 + " (run " + run + ")"; + //t2 = t2 + " (run " + run + ")"; b1->SetTitle(t2.c_str()); b1->GetXaxis()->SetLabelSize(0.06); b1->GetYaxis()->SetLabelSize(0.06); b1->GetXaxis()->SetTitleOffset(0.7); b1->GetXaxis()->SetTitleSize(0.06); - b1->GetXaxis()->SetNdivisions(508,kTRUE); + b1->GetXaxis()->SetNdivisions(508, kTRUE); c->cd(2); b1->Draw(); } c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); delete c; - } -void makeEffGif(std::string histoname, TFile* f1, std::string histotitle, std::string savename){ - - - TH1F *ho = (TH1F*)f1->Get(histoname.c_str()); +void makeEffGif(std::string histoname, TFile *f1, std::string histotitle, std::string savename) { + TH1F *ho = (TH1F *)f1->Get(histoname.c_str()); - TCanvas *c = new TCanvas("c","my canvas",1); + TCanvas *c = new TCanvas("c", "my canvas", 1); - TH1F *hn = new TH1F("tmp",histotitle.c_str(),20,0.5,20.5); - - - if (ho){ + TH1F *hn = new TH1F("tmp", histotitle.c_str(), 20, 0.5, 20.5); + if (ho) { float Num = 1; float Den = 1; - for (int i=0;i<20;i++){ - Num = ho->GetBinContent(i+1); - Den = ho->GetBinContent(i+21); + for (int i = 0; i < 20; i++) { + Num = ho->GetBinContent(i + 1); + Den = ho->GetBinContent(i + 21); //getEfficiency(Num, Den, eff); float Eff = 0.; float EffE = 0.; - if(fabs(Den)>0.000000001){ - Eff = Num/Den; - if(Num 0.000000001) { + Eff = Num / Den; + if (Num < Den) { + EffE = sqrt((1. - Eff) * Eff / Den); } } - hn->SetBinContent(i+1, Eff); - hn->SetBinError(i+1, EffE); + hn->SetBinContent(i + 1, Eff); + hn->SetBinError(i + 1, EffE); } - gStyle->SetOptStat(kFALSE); gStyle->SetHistFillColor(92); gStyle->SetFrameFillColor(4000); @@ -238,140 +471,143 @@ void makeEffGif(std::string histoname, TFile* f1, std::string histotitle, std::s hn->GetYaxis()->SetLabelSize(0.04); hn->GetXaxis()->SetTitleOffset(0.7); hn->GetXaxis()->SetTitleSize(0.06); - hn->GetXaxis()->SetNdivisions(208,kTRUE); - hn->GetYaxis()->SetRangeUser(0.5,1.1); + hn->GetXaxis()->SetNdivisions(208, kTRUE); + hn->GetYaxis()->SetRangeUser(0.5, 1.1); hn->SetMarkerStyle(6); - hn->GetXaxis()->SetBinLabel(1,"ME +1/1b"); - hn->GetXaxis()->SetBinLabel(2,"ME +1/2"); - hn->GetXaxis()->SetBinLabel(3,"ME +1/3"); - hn->GetXaxis()->SetBinLabel(4,"ME +1/1a"); - hn->GetXaxis()->SetBinLabel(5,"ME +2/1"); - hn->GetXaxis()->SetBinLabel(6,"ME +2/2"); - hn->GetXaxis()->SetBinLabel(7,"ME +3/1"); - hn->GetXaxis()->SetBinLabel(8,"ME +3/2"); - hn->GetXaxis()->SetBinLabel(9,"ME +4/1"); - hn->GetXaxis()->SetBinLabel(10,"ME +4/2"); - hn->GetXaxis()->SetBinLabel(11,"ME -1/1b"); - hn->GetXaxis()->SetBinLabel(12,"ME -1/2"); - hn->GetXaxis()->SetBinLabel(13,"ME -1/3"); - hn->GetXaxis()->SetBinLabel(14,"ME -1/1a"); - hn->GetXaxis()->SetBinLabel(15,"ME -2/1"); - hn->GetXaxis()->SetBinLabel(16,"ME -2/2"); - hn->GetXaxis()->SetBinLabel(17,"ME -3/1"); - hn->GetXaxis()->SetBinLabel(18,"ME -3/2"); - hn->GetXaxis()->SetBinLabel(19,"ME -4/1"); - hn->GetXaxis()->SetBinLabel(20,"ME -4/2"); + hn->GetXaxis()->SetBinLabel(1, "ME +1/1b"); + hn->GetXaxis()->SetBinLabel(2, "ME +1/2"); + hn->GetXaxis()->SetBinLabel(3, "ME +1/3"); + hn->GetXaxis()->SetBinLabel(4, "ME +1/1a"); + hn->GetXaxis()->SetBinLabel(5, "ME +2/1"); + hn->GetXaxis()->SetBinLabel(6, "ME +2/2"); + hn->GetXaxis()->SetBinLabel(7, "ME +3/1"); + hn->GetXaxis()->SetBinLabel(8, "ME +3/2"); + hn->GetXaxis()->SetBinLabel(9, "ME +4/1"); + hn->GetXaxis()->SetBinLabel(10, "ME +4/2"); + hn->GetXaxis()->SetBinLabel(11, "ME -1/1b"); + hn->GetXaxis()->SetBinLabel(12, "ME -1/2"); + hn->GetXaxis()->SetBinLabel(13, "ME -1/3"); + hn->GetXaxis()->SetBinLabel(14, "ME -1/1a"); + hn->GetXaxis()->SetBinLabel(15, "ME -2/1"); + hn->GetXaxis()->SetBinLabel(16, "ME -2/2"); + hn->GetXaxis()->SetBinLabel(17, "ME -3/1"); + hn->GetXaxis()->SetBinLabel(18, "ME -3/2"); + hn->GetXaxis()->SetBinLabel(19, "ME -4/1"); + hn->GetXaxis()->SetBinLabel(20, "ME -4/2"); hn->Draw(); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); } delete c; delete hn; } -void Draw2DProfile(std::string histoname, TFile* f1, std::string title, std::string option, std::string savename){ +void Draw2DProfile(std::string histoname, TFile *f1, std::string title, std::string option, std::string savename) { + TProfile2D *test = (TProfile2D *)f1->Get(histoname.c_str()); + TH2D *plot = test->ProjectionXY("test2", option.c_str()); - TProfile2D *test = f1->Get(histoname.c_str()); - TH2D *plot = test->ProjectionXY("test2",option.c_str()); - - if (plot){ - TCanvas *c = new TCanvas("c","my canvas",1); - gStyle->SetPalette(1,0); + if (plot) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); gPad->SetFillColor(4000); c->SetFillStyle(4000); gStyle->SetStatColor(0); gStyle->SetTitleFillColor(0); plot->SetStats(kFALSE); - plot->GetYaxis()->SetBinLabel(1,"ME- 4/1"); - plot->GetYaxis()->SetBinLabel(2,"ME- 3/2"); - plot->GetYaxis()->SetBinLabel(3,"ME- 3/1"); - plot->GetYaxis()->SetBinLabel(4,"ME- 2/2"); - plot->GetYaxis()->SetBinLabel(5,"ME- 2/1"); - plot->GetYaxis()->SetBinLabel(6,"ME- 1/3"); - plot->GetYaxis()->SetBinLabel(7,"ME- 1/2"); - plot->GetYaxis()->SetBinLabel(8,"ME- 1/1b"); - plot->GetYaxis()->SetBinLabel(9,"ME- 1/1a"); - plot->GetYaxis()->SetBinLabel(10,"ME+ 1/1a"); - plot->GetYaxis()->SetBinLabel(11,"ME+ 1/1b"); - plot->GetYaxis()->SetBinLabel(12,"ME+ 1/2"); - plot->GetYaxis()->SetBinLabel(13,"ME+ 1/3"); - plot->GetYaxis()->SetBinLabel(14,"ME+ 2/1"); - plot->GetYaxis()->SetBinLabel(15,"ME+ 2/2"); - plot->GetYaxis()->SetBinLabel(16,"ME+ 3/1"); - plot->GetYaxis()->SetBinLabel(17,"ME+ 3/2"); - plot->GetYaxis()->SetBinLabel(18,"ME+ 4/1"); + plot->GetYaxis()->SetBinLabel(1, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(2, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(4, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(6, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(10, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 4/1"); plot->SetTitle(title.c_str()); - for (int i = 1; i < 37; i++){ + for (int i = 1; i < 37; i++) { ostringstream oss1; oss1 << i; string ch = oss1.str(); - plot->GetXaxis()->SetBinLabel(i,ch.c_str()); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); } c->SetRightMargin(0.12); - plot->GetYaxis()->SetNdivisions(20,kFALSE); - plot->GetXaxis()->SetNdivisions(36,kFALSE); + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); plot->GetXaxis()->SetTitle("Chamber #"); c->SetGrid(); plot->Draw("colz"); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); delete c; } - } -void Draw2DEfficiency(std::string histo, TFile* f1, std::string title, std::string savename){ - - TCanvas *c = new TCanvas("c","my canvas",1); - gStyle->SetPalette(1,0); +void Draw2DEfficiency(std::string histo, TFile *f1, std::string title, std::string savename) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); gPad->SetFillColor(4000); c->SetFillStyle(4000); gStyle->SetStatColor(0); gStyle->SetTitleFillColor(0); + gStyle->SetOptStat(10); - TH2F *num = (TH2F*)f1->Get(histo.c_str()); - TH2F *denom = (TH2F*)f1->Get("Efficiency/hEffDenominator"); - - TH2F *plot = new TH2F("plot",title.c_str(),36,0.5,36.5,18,0.5,18.5); - - plot->Divide(num,denom,1.,1.,"B"); - - plot->SetStats(kFALSE); - - plot->GetYaxis()->SetBinLabel(1,"ME- 4/1"); - plot->GetYaxis()->SetBinLabel(2,"ME- 3/2"); - plot->GetYaxis()->SetBinLabel(3,"ME- 3/1"); - plot->GetYaxis()->SetBinLabel(4,"ME- 2/2"); - plot->GetYaxis()->SetBinLabel(5,"ME- 2/1"); - plot->GetYaxis()->SetBinLabel(9,"ME- 1/1a"); - plot->GetYaxis()->SetBinLabel(6,"ME- 1/3"); - plot->GetYaxis()->SetBinLabel(7,"ME- 1/2"); - plot->GetYaxis()->SetBinLabel(8,"ME- 1/1b"); - plot->GetYaxis()->SetBinLabel(11,"ME+ 1/1b"); - plot->GetYaxis()->SetBinLabel(12,"ME+ 1/2"); - plot->GetYaxis()->SetBinLabel(13,"ME+ 1/3"); - plot->GetYaxis()->SetBinLabel(10,"ME+ 1/1a"); - plot->GetYaxis()->SetBinLabel(14,"ME+ 2/1"); - plot->GetYaxis()->SetBinLabel(15,"ME+ 2/2"); - plot->GetYaxis()->SetBinLabel(16,"ME+ 3/1"); - plot->GetYaxis()->SetBinLabel(17,"ME+ 3/2"); - plot->GetYaxis()->SetBinLabel(18,"ME+ 4/1"); - - for (int i = 1; i < 37; i++){ + TH2F *num = (TH2F *)f1->Get(histo.c_str()); + TH2F *denom = (TH2F *)f1->Get("Efficiency/hEffDenominator"); + if (histo.find("Tight") != std::string::npos) + denom = (TH2F *)f1->Get("Efficiency/hEffDenominatorTight"); + + TH2F *plot = new TH2F("plot", title.c_str(), 36, 0.5, 36.5, 20, 0.5, 20.5); + + if (num && denom) + plot->Divide(num, denom, 1., 1., "B"); + + //plot->SetStats(kFALSE); + + plot->GetYaxis()->SetBinLabel(1, "ME- 4/2"); //jun28 + plot->GetYaxis()->SetBinLabel(2, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(4, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(6, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(10, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(19, "ME+ 4/1"); + plot->GetYaxis()->SetBinLabel(20, "ME+ 4/2"); //jun28 + + for (int i = 1; i < 37; i++) { ostringstream oss1; oss1 << i; string ch = oss1.str(); - plot->GetXaxis()->SetBinLabel(i,ch.c_str()); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); } c->SetRightMargin(0.12); - plot->GetYaxis()->SetNdivisions(20,kFALSE); - plot->GetXaxis()->SetNdivisions(36,kFALSE); + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); plot->GetXaxis()->SetTitle("Chamber #"); @@ -380,80 +616,155 @@ void Draw2DEfficiency(std::string histo, TFile* f1, std::string title, std::stri plot->Draw("COLZ"); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); delete c; delete plot; - } +void Draw2DTempPlot(std::string histo, TFile *f1, bool includeME11, std::string savename, bool hasLabels = false) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gStyle->SetOptStat(10); -void Draw2DTempPlot(std::string histo, TFile* f1, bool includeME11, std::string savename){ + TH2I *plot = (TH2I *)f1->Get(histo.c_str()); + + //plot->SetStats(kFALSE); + + if (!hasLabels) { + if (includeME11) { + plot->GetYaxis()->SetBinLabel(1, "ME- 4/2"); + plot->GetYaxis()->SetBinLabel(2, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(4, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(6, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(10, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(19, "ME+ 4/1"); + plot->GetYaxis()->SetBinLabel(20, "ME+ 4/2"); + } else { + plot->GetYaxis()->SetBinLabel(1, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(2, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(4, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(6, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(10, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 4/1"); + } + + for (int i = 1; i < 37; i++) { + ostringstream oss1; + oss1 << i; + string ch = oss1.str(); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); + } + + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); + + plot->GetXaxis()->SetTitle("Chamber #"); - TCanvas *c = new TCanvas("c","my canvas",1); - gStyle->SetPalette(1,0); + c->SetGrid(); + } + + c->SetRightMargin(0.12); + plot->Draw("COLZ"); + + c->Update(); + c->Print(savename.c_str(), "png"); + delete c; +} + +void Draw2DTempPlot2(std::string histo, TFile *f1, bool includeME11, std::string savename) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); gPad->SetFillColor(4000); c->SetFillStyle(4000); gStyle->SetStatColor(0); gStyle->SetTitleFillColor(0); - TH2I *plot = (TH2I*)f1->Get(histo.c_str()); + TH2F *plot = (TH2F *)f1->Get(histo.c_str()); plot->SetStats(kFALSE); - - if (includeME11){ - plot->GetYaxis()->SetBinLabel(1,"ME- 4/2"); - plot->GetYaxis()->SetBinLabel(2,"ME- 4/1"); - plot->GetYaxis()->SetBinLabel(3,"ME- 3/2"); - plot->GetYaxis()->SetBinLabel(4,"ME- 3/1"); - plot->GetYaxis()->SetBinLabel(5,"ME- 2/2"); - plot->GetYaxis()->SetBinLabel(6,"ME- 2/1"); - plot->GetYaxis()->SetBinLabel(10,"ME- 1/1a"); - plot->GetYaxis()->SetBinLabel(7,"ME- 1/3"); - plot->GetYaxis()->SetBinLabel(8,"ME- 1/2"); - plot->GetYaxis()->SetBinLabel(9,"ME- 1/1b"); - plot->GetYaxis()->SetBinLabel(12,"ME+ 1/1b"); - plot->GetYaxis()->SetBinLabel(13,"ME+ 1/2"); - plot->GetYaxis()->SetBinLabel(14,"ME+ 1/3"); - plot->GetYaxis()->SetBinLabel(11,"ME+ 1/1a"); - plot->GetYaxis()->SetBinLabel(15,"ME+ 2/1"); - plot->GetYaxis()->SetBinLabel(16,"ME+ 2/2"); - plot->GetYaxis()->SetBinLabel(17,"ME+ 3/1"); - plot->GetYaxis()->SetBinLabel(18,"ME+ 3/2"); - plot->GetYaxis()->SetBinLabel(19,"ME+ 4/1"); - plot->GetYaxis()->SetBinLabel(20,"ME+ 4/2"); - } - else { - plot->GetYaxis()->SetBinLabel(1,"ME- 4/1"); - plot->GetYaxis()->SetBinLabel(2,"ME- 3/2"); - plot->GetYaxis()->SetBinLabel(3,"ME- 3/1"); - plot->GetYaxis()->SetBinLabel(4,"ME- 2/2"); - plot->GetYaxis()->SetBinLabel(5,"ME- 2/1"); - plot->GetYaxis()->SetBinLabel(6,"ME- 1/3"); - plot->GetYaxis()->SetBinLabel(7,"ME- 1/2"); - plot->GetYaxis()->SetBinLabel(8,"ME- 1/1b"); - plot->GetYaxis()->SetBinLabel(9,"ME- 1/1a"); - plot->GetYaxis()->SetBinLabel(10,"ME+ 1/1a"); - plot->GetYaxis()->SetBinLabel(11,"ME+ 1/1b"); - plot->GetYaxis()->SetBinLabel(12,"ME+ 1/2"); - plot->GetYaxis()->SetBinLabel(13,"ME+ 1/3"); - plot->GetYaxis()->SetBinLabel(14,"ME+ 2/1"); - plot->GetYaxis()->SetBinLabel(15,"ME+ 2/2"); - plot->GetYaxis()->SetBinLabel(16,"ME+ 3/1"); - plot->GetYaxis()->SetBinLabel(17,"ME+ 3/2"); - plot->GetYaxis()->SetBinLabel(18,"ME+ 4/1"); + + if (includeME11) { + plot->GetYaxis()->SetBinLabel(1, "ME- 4/2"); + plot->GetYaxis()->SetBinLabel(2, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(4, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(6, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(10, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(19, "ME+ 4/1"); + plot->GetYaxis()->SetBinLabel(20, "ME+ 4/2"); + } else { + plot->GetYaxis()->SetBinLabel(1, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(2, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(4, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(6, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(10, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 4/1"); } - for (int i = 1; i < 37; i++){ + for (int i = 1; i < 37; i++) { ostringstream oss1; oss1 << i; string ch = oss1.str(); - plot->GetXaxis()->SetBinLabel(i,ch.c_str()); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); } c->SetRightMargin(0.12); - plot->GetYaxis()->SetNdivisions(20,kFALSE); - plot->GetXaxis()->SetNdivisions(36,kFALSE); + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); plot->GetXaxis()->SetTitle("Chamber #"); @@ -462,129 +773,207 @@ void Draw2DTempPlot(std::string histo, TFile* f1, bool includeME11, std::string plot->Draw("COLZ"); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); delete c; - } -void GlobalPosfromTree(std::string graphname, TFile* f1, int endcap, int station, std::string type, std::string savename){ - - TTree *t1; - TBranch *b1; - struct posRecord { - int endcap; - int station; - int ring; - int chamber; - int layer; - float localx; - float localy; - float globalx; - float globaly; - } points; - - - if (type == "rechit"){ - t1 = (TTree*)f1->Get("recHits/rHPositions"); - b1 = t1->GetBranch("rHpos"); - b1->SetAddress(&points); - } - - if (type == "segment"){ - t1 = (TTree*)f1->Get("Segments/segPositions"); - b1 = t1->GetBranch("segpos"); - b1->SetAddress(&points); - } - - int n1 = (int)t1->GetEntries(); - const int nevents1 = n1; - float globx1[nevents1]; - float globy1[nevents1]; - int nstation1 = 0; - const int num_of_rings = 4; - const int num_of_chambers = 36; - int nchamber1[num_of_rings][num_of_chambers]; - for (int i=0; iGetEntry(i); - if (points.station == station && points.endcap == endcap){ - globx1[nstation1] = points.globalx; - globy1[nstation1] = points.globaly; - nstation1++; - nchamber1[points.ring-1][points.chamber-1]++; - } - } - - TCanvas *c = new TCanvas("c","my canvas",1); - c->SetCanvasSize(700,700); - TGraph *graph1 = new TGraph(nstation1,globx1,globy1); - - std::string name1 = graphname; - - gStyle->SetPalette(1,0); - gStyle->SetTitleW(0.9); - gStyle->SetTitleH(0.1); - gStyle->SetStatColor(0); - gStyle->SetTitleFillColor(0); - gPad->SetFillColor(4000); - c->SetFillStyle(4000); - gStyle->SetOptStat(10); - - - graph1->GetXaxis()->SetLimits(-720,720); - graph1->GetYaxis()->SetLimits(-720,720); - graph1->GetXaxis()->SetRangeUser(-720,720); - graph1->GetYaxis()->SetRangeUser(-720,720); - - graph1->SetTitle(name1.c_str()); - graph1->UseCurrentStyle(); - graph1->Draw("AP"); - - // drawChamberLines(station); - drawColoredChamberLines(station,nchamber1); - - c->Print(savename.c_str(),"png"); - delete c; - - -} // end GlobalPosfromTree - -drawChamberLines(int station){ +void GlobalPosfromTree( + std::string graphname, TFile *f1, int endcap, int station, std::string type, std::string savename) { + TTree *t1; + TBranch *b1; + struct posRecord { + int endcap; + int station; + int ring; + int chamber; + int layer; + float localx; + float localy; + float globalx; + float globaly; + } points; + + if (type == "rechit") { + t1 = (TTree *)f1->Get("recHits/rHPositions"); + b1 = t1->GetBranch("rHpos"); + b1->SetAddress(&points); + } + + if (type == "segment") { + t1 = (TTree *)f1->Get("Segments/segPositions"); + b1 = t1->GetBranch("segpos"); + b1->SetAddress(&points); + } + + int n1 = (int)t1->GetEntries(); + const int nevents1 = n1; + TVectorF globx1(nevents1); + TVectorF globy1(nevents1); + int nstation1 = 0; + const int num_of_rings = 4; + const int num_of_chambers = 36; + int nchamber1[num_of_rings][num_of_chambers]; + for (int i = 0; i < num_of_rings; i++) { + for (int j = 0; j < num_of_chambers; j++) { + nchamber1[i][j] = 0; + } + } + + for (int i = 0; i < nevents1; i++) { + b1->GetEntry(i); + if (points.station == station && points.endcap == endcap) { + globx1[nstation1] = points.globalx; + globy1[nstation1] = points.globaly; + nstation1++; + nchamber1[points.ring - 1][points.chamber - 1]++; + } + } + + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->SetCanvasSize(700, 700); + //TGraph *graph1 = new TGraph(nstation1,globx1,globy1); + TGraph *graph1 = new TGraph(globx1, globy1); + + std::string name1 = graphname; + + gStyle->SetPalette(1, 0); + gStyle->SetTitleW(0.9); + gStyle->SetTitleH(0.1); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + + //asking to show the total number of entries for rechit and seg plots + //i.e. SetOptStat(10), returns 0 entries for some reason + gStyle->SetOptStat(0); + + graph1->GetXaxis()->SetLimits(-720, 720); + graph1->GetYaxis()->SetLimits(-720, 720); + graph1->GetXaxis()->SetRangeUser(-720, 720); + graph1->GetYaxis()->SetRangeUser(-720, 720); + + graph1->SetTitle(name1.c_str()); + graph1->UseCurrentStyle(); + graph1->Draw("AP"); + + // drawChamberLines(station); + drawColoredChamberLines(station, nchamber1); + + c->Print(savename.c_str(), "png"); + delete c; + +} // end GlobalPosfromTree + +void GlobalPosfromChain(std::string graphname, + TChain *ch1, + int endcap, + int station, + std::string type, + std::string savename, + const int maxNumPoints = 10'000'000) { + struct posRecord { + int endcap; + int station; + int ring; + int chamber; + int layer; + float localx; + float localy; + float globalx; + float globaly; + } points; + + if (type == "rechit") + ch1->SetBranchAddress("rHpos", &points); + else if (type == "segment") + ch1->SetBranchAddress("segpos", &points); + + int n1 = ch1->GetEntries(); + const int nevents1 = TMath::Min(n1, maxNumPoints); + TVectorF globx1(nevents1); + TVectorF globy1(nevents1); + int nstation1 = 0; + const int num_of_rings = 4; + const int num_of_chambers = 36; + int nchamber1[num_of_rings][num_of_chambers]; + for (int i = 0; i < num_of_rings; i++) { + for (int j = 0; j < num_of_chambers; j++) { + nchamber1[i][j] = 0; + } + } + + for (int i = 0; i < nevents1; i++) { + ch1->GetEntry(i); + if (points.station == station && points.endcap == endcap) { + globx1[nstation1] = points.globalx; + globy1[nstation1] = points.globaly; + nstation1++; + nchamber1[points.ring - 1][points.chamber - 1]++; + } + } + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->SetCanvasSize(700, 700); + gStyle->SetPalette(1, 0); + gStyle->SetTitleW(0.9); + gStyle->SetTitleH(0.1); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + + //asking to show the total number of entries for rechit and seg plots + //i.e. SetOptStat(10), returns 0 entries for some reason + gStyle->SetOptStat(0); + + TGraph *graph1 = new TGraph(globx1, globy1); + std::string name1 = graphname; + graph1->GetXaxis()->SetLimits(-720, 720); + graph1->GetYaxis()->SetLimits(-720, 720); + graph1->GetXaxis()->SetRangeUser(-720, 720); + graph1->GetYaxis()->SetRangeUser(-720, 720); + + graph1->SetTitle(name1.c_str()); + graph1->UseCurrentStyle(); + graph1->Draw("AP"); + + drawColoredChamberLines(station, nchamber1); + + c->Print(savename.c_str(), "png"); + +} // end GlobalPosfromChain + +void drawChamberLines(int station) { gStyle->SetLineWidth(2); float pi = 3.14159; - TVector3 x(0,0,1); + TVector3 x(0, 0, 1); int linecolor = 1; //for alternating colors, set 2 diff colors here int lc1 = 1; int lc2 = 1; + if (station == 1) { + TVector3 p1(101, 9.361, 0); + TVector3 p2(101, -9.361, 0); + TVector3 p3(260, -22.353, 0); + TVector3 p4(260, 22.353, 0); - if (station == 1){ - TVector3 p1(101,9.361,0); - TVector3 p2(101,-9.361,0); - TVector3 p3(260,-22.353,0); - TVector3 p4(260,22.353,0); - - TLine *line1; + TLine *line1; TLine *line2; TLine *line3; TLine *line4; - for (int i = 0; i < 36; i++){ - - if (linecolor == lc1) linecolor = lc2; - else linecolor = lc1; + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -595,27 +984,27 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - p1.Rotate(pi/18,x); - p2.Rotate(pi/18,x); - p3.Rotate(pi/18,x); - p4.Rotate(pi/18,x); - + p1.Rotate(pi / 18, x); + p2.Rotate(pi / 18, x); + p3.Rotate(pi / 18, x); + p4.Rotate(pi / 18, x); } - TVector3 q1(281.49,25.5,0); - TVector3 q2(281.49,-25.5,0); - TVector3 q3(455.99,-41.87,0); - TVector3 q4(455.99,41.87,0); + TVector3 q1(281.49, 25.5, 0); + TVector3 q2(281.49, -25.5, 0); + TVector3 q3(455.99, -41.87, 0); + TVector3 q4(455.99, 41.87, 0); - for (int i = 0; i < 36; i++){ - - if (linecolor == lc2) linecolor = lc1; - else linecolor = lc2; + for (int i = 0; i < 36; i++) { + if (linecolor == lc2) + linecolor = lc1; + else + linecolor = lc2; - line1 = new TLine(q1(0),q1(1),q2(0),q2(1)); - line2 = new TLine(q2(0),q2(1),q3(0),q3(1)); - line3 = new TLine(q3(0),q3(1),q4(0),q4(1)); - line4 = new TLine(q4(0),q4(1),q1(0),q1(1)); + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); @@ -627,27 +1016,27 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - q1.Rotate(pi/18,x); - q2.Rotate(pi/18,x); - q3.Rotate(pi/18,x); - q4.Rotate(pi/18,x); - + q1.Rotate(pi / 18, x); + q2.Rotate(pi / 18, x); + q3.Rotate(pi / 18, x); + q4.Rotate(pi / 18, x); } - TVector3 r1(511.99,31.7,0); - TVector3 r2(511.99,-31.7,0); - TVector3 r3(676.15,-46.05,0); - TVector3 r4(676.15,46.05.6,0); - - for (int i = 0; i < 36; i++){ - - if (linecolor == lc1) linecolor = lc2; - else linecolor = lc1; - - line1 = new TLine(r1(0),r1(1),r2(0),r2(1)); - line2 = new TLine(r2(0),r2(1),r3(0),r3(1)); - line3 = new TLine(r3(0),r3(1),r4(0),r4(1)); - line4 = new TLine(r4(0),r4(1),r1(0),r1(1)); + TVector3 r1(511.99, 31.7, 0); + TVector3 r2(511.99, -31.7, 0); + TVector3 r3(676.15, -46.05, 0); + TVector3 r4(676.15, 46.05, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; + + line1 = new TLine(r1(0), r1(1), r2(0), r2(1)); + line2 = new TLine(r2(0), r2(1), r3(0), r3(1)); + line3 = new TLine(r3(0), r3(1), r4(0), r4(1)); + line4 = new TLine(r4(0), r4(1), r1(0), r1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -658,42 +1047,39 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - r1.Rotate(pi/18,x); - r2.Rotate(pi/18,x); - r3.Rotate(pi/18,x); - r4.Rotate(pi/18,x); - + r1.Rotate(pi / 18, x); + r2.Rotate(pi / 18, x); + r3.Rotate(pi / 18, x); + r4.Rotate(pi / 18, x); } - } + if (station == 2) { + TVector3 p1(146.9, 27.0, 0); + TVector3 p2(146.9, -27.0, 0); + TVector3 p3(336.56, -62.855, 0); + TVector3 p4(336.56, 62.855, 0); - if (station == 2){ - - TVector3 p1(146.9,27.0,0); - TVector3 p2(146.9,-27.0,0); - TVector3 p3(336.56,-62.855,0); - TVector3 p4(336.56,62.855,0); - - p1.Rotate(pi/36,x); - p2.Rotate(pi/36,x); - p3.Rotate(pi/36,x); - p4.Rotate(pi/36,x); + p1.Rotate(pi / 36, x); + p2.Rotate(pi / 36, x); + p3.Rotate(pi / 36, x); + p4.Rotate(pi / 36, x); TLine *line1; TLine *line2; TLine *line3; TLine *line4; - for (int i = 0; i < 36; i++){ - - if (linecolor == lc1) linecolor = lc2; - else linecolor = lc1; + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -704,27 +1090,27 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - p1.Rotate(pi/9,x); - p2.Rotate(pi/9,x); - p3.Rotate(pi/9,x); - p4.Rotate(pi/9,x); - + p1.Rotate(pi / 9, x); + p2.Rotate(pi / 9, x); + p3.Rotate(pi / 9, x); + p4.Rotate(pi / 9, x); } - TVector3 q1(364.02,33.23,0); - TVector3 q2(364.02,-33.23,0); - TVector3 q3(687.08,-63.575,0); - TVector3 q4(687.08,63.575,0); - - for (int i = 0; i < 36; i++){ - - if (linecolor == lc2) linecolor = lc1; - else linecolor = lc2; - - line1 = new TLine(q1(0),q1(1),q2(0),q2(1)); - line2 = new TLine(q2(0),q2(1),q3(0),q3(1)); - line3 = new TLine(q3(0),q3(1),q4(0),q4(1)); - line4 = new TLine(q4(0),q4(1),q1(0),q1(1)); + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc2) + linecolor = lc1; + else + linecolor = lc2; + + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -735,41 +1121,39 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - q1.Rotate(pi/18,x); - q2.Rotate(pi/18,x); - q3.Rotate(pi/18,x); - q4.Rotate(pi/18,x); - + q1.Rotate(pi / 18, x); + q2.Rotate(pi / 18, x); + q3.Rotate(pi / 18, x); + q4.Rotate(pi / 18, x); } - } - if (station == 3){ + if (station == 3) { + TVector3 p1(166.89, 30.7, 0); + TVector3 p2(166.89, -30.7, 0); + TVector3 p3(336.59, -62.855, 0); + TVector3 p4(336.59, 62.855, 0); - TVector3 p1(166.89,30.7,0); - TVector3 p2(166.89,-30.7,0); - TVector3 p3(336.59,-62.855,0); - TVector3 p4(336.59,62.855,0); - - p1.Rotate(pi/36,x); - p2.Rotate(pi/36,x); - p3.Rotate(pi/36,x); - p4.Rotate(pi/36,x); + p1.Rotate(pi / 36, x); + p2.Rotate(pi / 36, x); + p3.Rotate(pi / 36, x); + p4.Rotate(pi / 36, x); TLine *line1; TLine *line2; TLine *line3; TLine *line4; - for (int i = 0; i < 36; i++){ - - if (linecolor == lc1) linecolor = lc2; - else linecolor = lc1; + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -780,27 +1164,27 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - p1.Rotate(pi/9,x); - p2.Rotate(pi/9,x); - p3.Rotate(pi/9,x); - p4.Rotate(pi/9,x); - + p1.Rotate(pi / 9, x); + p2.Rotate(pi / 9, x); + p3.Rotate(pi / 9, x); + p4.Rotate(pi / 9, x); } - TVector3 q1(364.02,33.23,0); - TVector3 q2(364.02,-33.23,0); - TVector3 q3(687.08,-63.575,0); - TVector3 q4(687.08,63.575,0); - - for (int i = 0; i < 36; i++){ - - if (linecolor == lc2) linecolor = lc1; - else linecolor = lc2; - - line1 = new TLine(q1(0),q1(1),q2(0),q2(1)); - line2 = new TLine(q2(0),q2(1),q3(0),q3(1)); - line3 = new TLine(q3(0),q3(1),q4(0),q4(1)); - line4 = new TLine(q4(0),q4(1),q1(0),q1(1)); + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc2) + linecolor = lc1; + else + linecolor = lc2; + + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -811,41 +1195,39 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - q1.Rotate(pi/18,x); - q2.Rotate(pi/18,x); - q3.Rotate(pi/18,x); - q4.Rotate(pi/18,x); - + q1.Rotate(pi / 18, x); + q2.Rotate(pi / 18, x); + q3.Rotate(pi / 18, x); + q4.Rotate(pi / 18, x); } - } - if (station == 4){ - - TVector3 p1(186.99,34.505.15,0); - TVector3 p2(186.99,-34.505,0); - TVector3 p3(336.41,-62.825,0); - TVector3 p4(336.41,62.825,0); + if (station == 4) { + TVector3 p1(186.99, 34.505, 0); + TVector3 p2(186.99, -34.505, 0); + TVector3 p3(336.41, -62.825, 0); + TVector3 p4(336.41, 62.825, 0); - p1.Rotate(pi/36,x); - p2.Rotate(pi/36,x); - p3.Rotate(pi/36,x); - p4.Rotate(pi/36,x); + p1.Rotate(pi / 36, x); + p2.Rotate(pi / 36, x); + p3.Rotate(pi / 36, x); + p4.Rotate(pi / 36, x); TLine *line1; TLine *line2; TLine *line3; TLine *line4; - for (int i = 0; i < 36; i++){ - - if (linecolor == lc1) linecolor = lc2; - else linecolor = lc1; + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); line1->SetLineColor(linecolor); line2->SetLineColor(linecolor); line3->SetLineColor(linecolor); @@ -856,27 +1238,24 @@ drawChamberLines(int station){ line3->Draw(); line4->Draw(); - p1.Rotate(pi/9,x); - p2.Rotate(pi/9,x); - p3.Rotate(pi/9,x); - p4.Rotate(pi/9,x); - + p1.Rotate(pi / 9, x); + p2.Rotate(pi / 9, x); + p3.Rotate(pi / 9, x); + p4.Rotate(pi / 9, x); } - } +} -} - -void compare1DPlot(std::string histoname, TFile* f1, TFile* f2, std::string histotitle, int statoption, std::string savename){ - +void compare1DPlot( + std::string histoname, TFile *f1, TFile *f2, std::string histotitle, int statoption, std::string savename) { // used to compare two of the same histogram from different releases/runs/etc - TH1F *h2 = (TH1F*)f1->Get(histoname.c_str()); - TH1F *h1 = (TH1F*)f2->Get(histoname.c_str()); + TH1F *h2 = (TH1F *)f1->Get(histoname.c_str()); + TH1F *h1 = (TH1F *)f2->Get(histoname.c_str()); - TCanvas *c = new TCanvas("c","my canvas",1); + TCanvas *c = new TCanvas("c", "my canvas", 1); - if (h1 && h2){ + if (h1 && h2) { gStyle->SetHistFillColor(92); gStyle->SetFrameFillColor(4000); gStyle->SetTitleW(0.5); @@ -895,75 +1274,68 @@ void compare1DPlot(std::string histoname, TFile* f1, TFile* f2, std::string hist h1->GetYaxis()->SetLabelSize(0.04); h1->GetXaxis()->SetTitleOffset(0.7); h1->GetXaxis()->SetTitleSize(0.06); - h1->GetXaxis()->SetNdivisions(208,kTRUE); + h1->GetXaxis()->SetNdivisions(208, kTRUE); - TLegend *leg = new TLegend(0.79,0.74,0.89,0.84); - leg->AddEntry(h1,"ref","f"); - leg->AddEntry(h2,"new","l"); + TLegend *leg = new TLegend(0.79, 0.74, 0.89, 0.84); + leg->AddEntry(h1, "ref", "f"); + leg->AddEntry(h2, "new", "l"); h1->Draw(); h2->Draw("same e"); leg->Draw(); - } c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); delete c; - } -void compareEffGif(std::string histoname, TFile* f1, TFile* f2, std::string histotitle, std::string savename){ - - - TH1F *h1 = (TH1F*)f1->Get(histoname.c_str()); - TH1F *h2 = (TH1F*)f2->Get(histoname.c_str()); - - TCanvas *c = new TCanvas("c","my canvas",1); +void compareEffGif(std::string histoname, TFile *f1, TFile *f2, std::string histotitle, std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); + TH1F *h2 = (TH1F *)f2->Get(histoname.c_str()); - TH1F *hn1 = new TH1F("tmp1",histotitle.c_str(),20,0.5,20.5); - TH1F *hn2 = new TH1F("tmp2",histotitle.c_str(),20,0.5,20.5); + TCanvas *c = new TCanvas("c", "my canvas", 1); + TH1F *hn1 = new TH1F("tmp1", histotitle.c_str(), 20, 0.5, 20.5); + TH1F *hn2 = new TH1F("tmp2", histotitle.c_str(), 20, 0.5, 20.5); - if (h1 && h2){ - + if (h1 && h2) { float Num = 1; float Den = 1; - for (int i=0;i<20;i++){ - Num = h1->GetBinContent(i+1); - Den = h1->GetBinContent(i+21); + for (int i = 0; i < 20; i++) { + Num = h1->GetBinContent(i + 1); + Den = h1->GetBinContent(i + 21); //getEfficiency(Num, Den, eff); float Eff = 0.; float EffE = 0.; - if(fabs(Den)>0.000000001){ - Eff = Num/Den; - if(Num 0.000000001) { + Eff = Num / Den; + if (Num < Den) { + EffE = sqrt((1. - Eff) * Eff / Den); } } - hn1->SetBinContent(i+1, Eff); - hn1->SetBinError(i+1, EffE); + hn1->SetBinContent(i + 1, Eff); + hn1->SetBinError(i + 1, EffE); } - float Num = 1; - float Den = 1; - for (int i=0;i<20;i++){ - Num = h2->GetBinContent(i+1); - Den = h2->GetBinContent(i+21); + Num = 1; + Den = 1; + for (int i = 0; i < 20; i++) { + Num = h2->GetBinContent(i + 1); + Den = h2->GetBinContent(i + 21); //getEfficiency(Num, Den, eff); float Eff = 0.; float EffE = 0.; - if(fabs(Den)>0.000000001){ - Eff = Num/Den; - if(Num 0.000000001) { + Eff = Num / Den; + if (Num < Den) { + EffE = sqrt((1. - Eff) * Eff / Den); } } - hn2->SetBinContent(i+1, Eff); - hn2->SetBinError(i+1, EffE); + hn2->SetBinContent(i + 1, Eff); + hn2->SetBinError(i + 1, EffE); } - gStyle->SetOptStat(kFALSE); gStyle->SetHistFillColor(92); gStyle->SetFrameFillColor(4000); @@ -980,52 +1352,50 @@ void compareEffGif(std::string histoname, TFile* f1, TFile* f2, std::string hist hn1->GetYaxis()->SetLabelSize(0.04); hn1->GetXaxis()->SetTitleOffset(0.7); hn1->GetXaxis()->SetTitleSize(0.06); - hn1->GetXaxis()->SetNdivisions(208,kTRUE); - hn1->GetYaxis()->SetRangeUser(0.5,1.1); + hn1->GetXaxis()->SetNdivisions(208, kTRUE); + hn1->GetYaxis()->SetRangeUser(0.5, 1.1); hn1->SetMarkerStyle(6); hn1->SetMarkerColor(kBlue); hn2->SetMarkerStyle(6); hn2->SetMarkerColor(kRed); - hn1->GetXaxis()->SetBinLabel(1,"ME +1/1b"); - hn1->GetXaxis()->SetBinLabel(2,"ME +1/2"); - hn1->GetXaxis()->SetBinLabel(3,"ME +1/3"); - hn1->GetXaxis()->SetBinLabel(4,"ME +1/1a"); - hn1->GetXaxis()->SetBinLabel(5,"ME +2/1"); - hn1->GetXaxis()->SetBinLabel(6,"ME +2/2"); - hn1->GetXaxis()->SetBinLabel(7,"ME +3/1"); - hn1->GetXaxis()->SetBinLabel(8,"ME +3/2"); - hn1->GetXaxis()->SetBinLabel(9,"ME +4/1"); - hn1->GetXaxis()->SetBinLabel(10,"ME +4/2"); - hn1->GetXaxis()->SetBinLabel(11,"ME -1/1b"); - hn1->GetXaxis()->SetBinLabel(12,"ME -1/2"); - hn1->GetXaxis()->SetBinLabel(13,"ME -1/3"); - hn1->GetXaxis()->SetBinLabel(14,"ME -1/1a"); - hn1->GetXaxis()->SetBinLabel(15,"ME -2/1"); - hn1->GetXaxis()->SetBinLabel(16,"ME -2/2"); - hn1->GetXaxis()->SetBinLabel(17,"ME -3/1"); - hn1->GetXaxis()->SetBinLabel(18,"ME -3/2"); - hn1->GetXaxis()->SetBinLabel(19,"ME -4/1"); - hn1->GetXaxis()->SetBinLabel(20,"ME -4/2"); - - TLegend *leg = new TLegend(0.79,0.79,0.89,0.89); - leg->AddEntry(hn1,"new","p"); - leg->AddEntry(hn2,"ref","p"); + hn1->GetXaxis()->SetBinLabel(1, "ME +1/1b"); + hn1->GetXaxis()->SetBinLabel(2, "ME +1/2"); + hn1->GetXaxis()->SetBinLabel(3, "ME +1/3"); + hn1->GetXaxis()->SetBinLabel(4, "ME +1/1a"); + hn1->GetXaxis()->SetBinLabel(5, "ME +2/1"); + hn1->GetXaxis()->SetBinLabel(6, "ME +2/2"); + hn1->GetXaxis()->SetBinLabel(7, "ME +3/1"); + hn1->GetXaxis()->SetBinLabel(8, "ME +3/2"); + hn1->GetXaxis()->SetBinLabel(9, "ME +4/1"); + hn1->GetXaxis()->SetBinLabel(10, "ME +4/2"); + hn1->GetXaxis()->SetBinLabel(11, "ME -1/1b"); + hn1->GetXaxis()->SetBinLabel(12, "ME -1/2"); + hn1->GetXaxis()->SetBinLabel(13, "ME -1/3"); + hn1->GetXaxis()->SetBinLabel(14, "ME -1/1a"); + hn1->GetXaxis()->SetBinLabel(15, "ME -2/1"); + hn1->GetXaxis()->SetBinLabel(16, "ME -2/2"); + hn1->GetXaxis()->SetBinLabel(17, "ME -3/1"); + hn1->GetXaxis()->SetBinLabel(18, "ME -3/2"); + hn1->GetXaxis()->SetBinLabel(19, "ME -4/1"); + hn1->GetXaxis()->SetBinLabel(20, "ME -4/2"); + + TLegend *leg = new TLegend(0.79, 0.79, 0.89, 0.89); + leg->AddEntry(hn1, "new", "p"); + leg->AddEntry(hn2, "ref", "p"); hn1->Draw(); hn2->Draw("same"); leg->Draw(); c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); } delete c; delete hn1; delete hn2; - } - -void GlobalPosfromTreeCompare(std::string graphname, TFile* f1, TFile* f2, int endcap, int station, std::string type, std::string savename){ - +void GlobalPosfromTreeCompare( + std::string graphname, TFile *f1, TFile *f2, int endcap, int station, std::string type, std::string savename) { struct posRecord { int endcap; int station; @@ -1043,18 +1413,18 @@ void GlobalPosfromTreeCompare(std::string graphname, TFile* f1, TFile* f2, int e TBranch *b1; TBranch *b2; - if (type == "rechit"){ - t1 = (TTree*)f1->Get("recHits/rHPositions"); - t2 = (TTree*)f2->Get("recHits/rHPositions"); + if (type == "rechit") { + t1 = (TTree *)f1->Get("recHits/rHPositions"); + t2 = (TTree *)f2->Get("recHits/rHPositions"); b1 = t1->GetBranch("rHpos"); b2 = t2->GetBranch("rHpos"); b1->SetAddress(&points1); b2->SetAddress(&points2); } - if (type == "segment"){ - t1 = (TTree*)f1->Get("Segments/segPositions"); - t2 = (TTree*)f2->Get("Segments/segPositions"); + if (type == "segment") { + t1 = (TTree *)f1->Get("Segments/segPositions"); + t2 = (TTree *)f2->Get("Segments/segPositions"); b1 = t1->GetBranch("segpos"); b2 = t2->GetBranch("segpos"); b1->SetAddress(&points1); @@ -1067,7 +1437,6 @@ void GlobalPosfromTreeCompare(std::string graphname, TFile* f1, TFile* f2, int e const int nevents1 = n1; const int nevents2 = n2; - float globx1[nevents1]; float globy1[nevents1]; float globx2[nevents2]; @@ -1075,17 +1444,17 @@ void GlobalPosfromTreeCompare(std::string graphname, TFile* f1, TFile* f2, int e int nstation1 = 0; int nstation2 = 0; - for (int i=0; iGetEntry(i); - if (points1.station == station && points1.endcap == endcap){ + if (points1.station == station && points1.endcap == endcap) { globx1[nstation1] = points1.globalx; globy1[nstation1] = points1.globaly; nstation1++; } } - for (int i=0; iGetEntry(i); - if (points2.station == station && points2.endcap == endcap){ + if (points2.station == station && points2.endcap == endcap) { globx2[nstation2] = points2.globalx; globy2[nstation2] = points2.globaly; nstation2++; @@ -1094,11 +1463,11 @@ void GlobalPosfromTreeCompare(std::string graphname, TFile* f1, TFile* f2, int e std::string name1 = graphname + " (New)"; std::string name2 = graphname + " (Ref)"; - TCanvas *c = new TCanvas("c","my canvas",1); - c->SetCanvasSize(1300,700); - c->Divide(2,1); - TGraph *graph1 = new TGraph(nstation1,globx1,globy1); - TGraph *graph2 = new TGraph(nstation2,globx2,globy2); + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->SetCanvasSize(1300, 700); + c->Divide(2, 1); + TGraph *graph1 = new TGraph(nstation1, globx1, globy1); + TGraph *graph2 = new TGraph(nstation2, globx2, globy2); gStyle->SetTitleW(0.6); gStyle->SetTitleH(0.1); @@ -1118,130 +1487,141 @@ void GlobalPosfromTreeCompare(std::string graphname, TFile* f1, TFile* f2, int e graph2->Draw("AP"); //c->Update(); - c->Print(savename.c_str(),"png"); + c->Print(savename.c_str(), "png"); delete c; - } +void NikolaiPlots(TFile *f_in, int flag) { + gROOT->SetStyle("Plain"); // to get rid of gray color of pad and have it white + gStyle->SetPalette(1, 0); // -void NikolaiPlots(TFile *f_in, int flag){ - -gROOT->SetStyle("Plain"); // to get rid of gray color of pad and have it white -gStyle->SetPalette(1,0); // + std::ostringstream ss, ss1; -std::ostringstream ss,ss1; + std::string folder; + std::string input_histName, input_title_X, input_title_Y, slice_title_X; + Int_t ny; + Float_t ylow, yhigh; + std::string result_histName, result_histTitle, result_title_Y, result_histNameEntries, result_histTitleEntries; + if (flag == 1) { // gas gain results + folder = "GasGain/"; -if(flag==1) { // gas gain results - std::string folder="GasGain/"; + input_histName = "gas_gain_rechit_adc_3_3_sum_location_ME_"; + input_title_X = "Location=(layer-1)*nsegm+segm"; + input_title_Y = "3X3 ADC Sum"; - std::string input_histName = "gas_gain_rechit_adc_3_3_sum_location_ME_"; - std::string input_title_X="Location=(layer-1)*nsegm+segm"; - std::string input_title_Y="3X3 ADC Sum"; + slice_title_X = "3X3 ADC Sum Location"; - std::string slice_title_X="3X3 ADC Sum Location"; + ny = 30; + ylow = 1.0; + yhigh = 31.0; + result_histName = "mean_gas_gain_vs_location_csc_ME_"; + result_histTitle = "Mean 3X3 ADC Sum"; + result_title_Y = "Location=(layer-1)*nsegm+segm"; - Int_t ny=30; - Float_t ylow=1.0, yhigh=31.0; - std::string result_histName = "mean_gas_gain_vs_location_csc_ME_"; - std::string result_histTitle="Mean 3X3 ADC Sum"; - std::string result_title_Y="Location=(layer-1)*nsegm+segm"; - - std::string result_histNameEntries = "entries_gas_gain_vs_location_csc_ME_"; - std::string result_histTitleEntries="Entries 3X3 ADC Sum"; -} - -if(flag==2) { // AFEB timing results - std::string folder="AFEBTiming/"; + result_histNameEntries = "entries_gas_gain_vs_location_csc_ME_"; + result_histTitleEntries = "Entries 3X3 ADC Sum"; + } - std::string input_histName = "afeb_time_bin_vs_afeb_occupancy_ME_"; - std::string input_title_X="AFEB"; - std::string input_title_Y="Time Bin"; + if (flag == 2) { // AFEB timing results + folder = "AFEBTiming/"; - std::string slice_title_X="AFEB"; + input_histName = "afeb_time_bin_vs_afeb_occupancy_ME_"; + input_title_X = "AFEB"; + input_title_Y = "Time Bin"; - Int_t ny=42; - Float_t ylow=1.0, yhigh=42.0; - std::string result_histName = "mean_afeb_time_bin_vs_afeb_csc_ME_"; - std::string result_histTitle="AFEB Mean Time Bin"; - std::string result_title_Y="AFEB"; + slice_title_X = "AFEB"; - std::string result_histNameEntries = "entries_afeb_time_bin_vs_afeb_csc_ME_"; - std::string result_histTitleEntries="Entries AFEB Time Bin"; -} + ny = 42; + ylow = 1.0; + yhigh = 42.0; + result_histName = "mean_afeb_time_bin_vs_afeb_csc_ME_"; + result_histTitle = "AFEB Mean Time Bin"; + result_title_Y = "AFEB"; -if(flag==3) { // Comparator timing results - std::string folder="CompTiming/"; + result_histNameEntries = "entries_afeb_time_bin_vs_afeb_csc_ME_"; + result_histTitleEntries = "Entries AFEB Time Bin"; + } - std::string input_histName = "comp_time_bin_vs_cfeb_occupancy_ME_"; - std::string input_title_X="CFEB"; - std::string input_title_Y="Time Bin"; + if (flag == 3) { // Comparator timing results + folder = "CompTiming/"; - std::string slice_title_X="CFEB"; + input_histName = "comp_time_bin_vs_cfeb_occupancy_ME_"; + input_title_X = "CFEB"; + input_title_Y = "Time Bin"; - Int_t ny=5; - Float_t ylow=1.0, yhigh=6.0; - std::string result_histName = "mean_comp_time_bin_vs_cfeb_csc_ME_"; - std::string result_histTitle="Comparator Mean Time Bin"; - std::string result_title_Y="CFEB"; + slice_title_X = "CFEB"; - std::string result_histNameEntries = "entries_comp_time_bin_vs_cfeb_csc_ME_"; - std::string result_histTitleEntries="Entries Comparator Time Bin"; -} + ny = 5; + ylow = 1.0; + yhigh = 6.0; + result_histName = "mean_comp_time_bin_vs_cfeb_csc_ME_"; + result_histTitle = "Comparator Mean Time Bin"; + result_title_Y = "CFEB"; -if(flag==4) { // Strip ADC timing results - std::string folder="ADCTiming/"; + result_histNameEntries = "entries_comp_time_bin_vs_cfeb_csc_ME_"; + result_histTitleEntries = "Entries Comparator Time Bin"; + } - std::string input_histName = "adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_"; - std::string input_title_X="CFEB"; - std::string input_title_Y="Time Bin"; + if (flag == 4) { // Strip ADC timing results + folder = "ADCTiming/"; - std::string slice_title_X="CFEB"; + input_histName = "adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_"; + input_title_X = "CFEB"; + input_title_Y = "Time Bin"; - Int_t ny=5; - Float_t ylow=1.0, yhigh=6.0; - std::string result_histName = "mean_adc_time_bin_vs_cfeb_csc_ME_"; - std::string result_histTitle="ADC 3X3 Mean Time Bin"; - std::string result_title_Y="CFEB"; + slice_title_X = "CFEB"; - std::string result_histNameEntries = "entries_adc_time_bin_vs_cfeb_csc_ME_"; - std::string result_histTitleEntries="Entries ADC 3X3 Time Bin"; -} + ny = 5; + ylow = 1.0; + yhigh = 6.0; + result_histName = "mean_adc_time_bin_vs_cfeb_csc_ME_"; + result_histTitle = "ADC 3X3 Mean Time Bin"; + result_title_Y = "CFEB"; + result_histNameEntries = "entries_adc_time_bin_vs_cfeb_csc_ME_"; + result_histTitleEntries = "Entries ADC 3X3 Time Bin"; + } -std::vector xTitle; -xTitle.push_back("ME+1/1 CSC"); xTitle.push_back("ME+1/2 CSC"); -xTitle.push_back("ME+1/3 CSC"); -xTitle.push_back("ME+2/1 CSC"); xTitle.push_back("ME+2/2 CSC"); -xTitle.push_back("ME+3/1 CSC"); xTitle.push_back("ME+3/2 CSC"); -xTitle.push_back("ME+4/1 CSC"); xTitle.push_back("ME+4/2 CSC"); -xTitle.push_back("ME-1/1 CSC"); xTitle.push_back("ME-1/2 CSC"); -xTitle.push_back("ME-1/3 CSC"); -xTitle.push_back("ME-2/1 CSC"); xTitle.push_back("ME-2/2 CSC"); -xTitle.push_back("ME-3/1 CSC"); xTitle.push_back("ME-3/2 CSC"); -xTitle.push_back("ME-4/1 CSC"); xTitle.push_back("ME-4/2 CSC"); - -TH2F *h2[500]; -TH2F *h; -Int_t esr[18]={111,112,113,121,122,131,132,141,142, - 211,212,213,221,222,231,232,241,242}; -Int_t entries[18]={0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0}; -Int_t k=0; -TCanvas *c1=new TCanvas("c1","canvas"); -c1->cd(); - -//if(flag==2) { // adding special case for AFEB timing + std::vector xTitle; + xTitle.push_back("ME+1/1 CSC"); + xTitle.push_back("ME+1/2 CSC"); + xTitle.push_back("ME+1/3 CSC"); + xTitle.push_back("ME+2/1 CSC"); + xTitle.push_back("ME+2/2 CSC"); + xTitle.push_back("ME+3/1 CSC"); + xTitle.push_back("ME+3/2 CSC"); + xTitle.push_back("ME+4/1 CSC"); + xTitle.push_back("ME+4/2 CSC"); + xTitle.push_back("ME-1/1 CSC"); + xTitle.push_back("ME-1/2 CSC"); + xTitle.push_back("ME-1/3 CSC"); + xTitle.push_back("ME-2/1 CSC"); + xTitle.push_back("ME-2/2 CSC"); + xTitle.push_back("ME-3/1 CSC"); + xTitle.push_back("ME-3/2 CSC"); + xTitle.push_back("ME-4/1 CSC"); + xTitle.push_back("ME-4/2 CSC"); + + TH2F *h2[500]; + TH2F *h; + Int_t esr[18] = {111, 112, 113, 121, 122, 131, 132, 141, 142, 211, 212, 213, 221, 222, 231, 232, 241, 242}; + Int_t entries[18] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + Int_t k = 0; + TCanvas *c1 = new TCanvas("c1", "canvas"); + c1->cd(); + + //if(flag==2) { // adding special case for AFEB timing ss.str(""); - ss<<"mean_afeb_time_bin_vs_csc_ME"; - ss1.str(""); - ss1<<"Mean AFEB time bin vs CSC and ME"; - gStyle->SetOptStat(0); - TH2F *hb=new TH2F(ss.str().c_str(),ss1.str().c_str(),36,1.0,37.0,18,1.0,19.0); - hb->SetStats(kFALSE); - hb->GetXaxis()->SetTitle("CSC #"); - hb->GetZaxis()->SetLabelSize(0.03); - hb->SetOption("COLZ"); + ss << "mean_afeb_time_bin_vs_csc_ME"; + ss1.str(""); + ss1 << "Mean AFEB time bin vs CSC and ME"; + gStyle->SetOptStat(0); + TH2F *hb = new TH2F(ss.str().c_str(), ss1.str().c_str(), 36, 1.0, 37.0, 18, 1.0, 19.0); + hb->SetStats(kFALSE); + hb->GetXaxis()->SetTitle("CSC #"); + hb->GetZaxis()->SetLabelSize(0.03); + hb->SetOption("COLZ"); hb->GetYaxis()->SetBinLabel(1, "ME- 4/2"); hb->GetYaxis()->SetBinLabel(2, "ME- 4/1"); @@ -1252,766 +1632,922 @@ c1->cd(); hb->GetYaxis()->SetBinLabel(7, "ME- 1/3"); hb->GetYaxis()->SetBinLabel(8, "ME- 1/2"); hb->GetYaxis()->SetBinLabel(9, "ME- 1/1"); - hb->GetYaxis()->SetBinLabel(10,"ME+ 1/1"); - hb->GetYaxis()->SetBinLabel(11,"ME+ 1/2"); - hb->GetYaxis()->SetBinLabel(12,"ME+ 1/3"); - hb->GetYaxis()->SetBinLabel(13,"ME+ 2/1"); - hb->GetYaxis()->SetBinLabel(14,"ME+ 2/2"); - hb->GetYaxis()->SetBinLabel(15,"ME+ 3/1"); - hb->GetYaxis()->SetBinLabel(16,"ME+ 3/2"); - hb->GetYaxis()->SetBinLabel(17,"ME+ 4/1"); - hb->GetYaxis()->SetBinLabel(18,"ME+ 4/2"); -//} - -for(Int_t jesr=0;jesr<18;jesr++) { - ss.str(""); - ss<SetStats(kFALSE); - h->GetXaxis()->SetTitle(xTitle[jesr].c_str()); - h->GetYaxis()->SetTitle(result_title_Y.c_str()); - h->GetZaxis()->SetLabelSize(0.03); - h->SetOption("COLZ"); - - ss.str(""); - ss<SetStats(kFALSE); - hentr->GetXaxis()->SetTitle(xTitle[jesr].c_str()); - hentr->GetYaxis()->SetTitle(result_title_Y.c_str()); - hentr->GetZaxis()->SetLabelSize(0.03); - hentr->SetOption("COLZ"); - - if(flag==2) { // adding special cases for AFEB timing - ss.str(""); - ss<<"normal_afeb_time_bin_vs_csc_ME_"<SetStats(kFALSE); - ha->GetXaxis()->SetTitle(xTitle[jesr].c_str()); - ha->GetYaxis()->SetTitle("Time Bin"); - ha->GetZaxis()->SetLabelSize(0.03); - ha->SetOption("COLZ"); - } - - for(Int_t csc=1;csc<37;csc++) { - Int_t idchamber=esr[jesr]*100+csc; - ss.str(""); - ss<cd(); - TH2F *h2[1]; - h2[k] = (TH2F*)f_in->Get(ss.str().c_str()); - if(h2[k] != NULL) { - - // saving original, adding X,Y titles, color and "BOX" option - h2[k]->GetXaxis()->SetTitle(input_title_X.c_str()); - h2[k]->GetYaxis()->SetTitle(input_title_Y.c_str()); - h2[k]->GetYaxis()->SetTitleOffset(1.2); - h2[k]->SetFillColor(4); - h2[k]->SetOption("BOX"); - gStyle->SetOptStat(1001111); - - // saving Y projection of the whole 2D hist for given chamber - ss.str(""); - ss<ProjectionY(ss.str().c_str(),1,h2[k]->GetNbinsX(),""); - h1d->GetYaxis()->SetTitle("Entries"); - h1d->GetYaxis()->SetTitleOffset(1.2); - gStyle->SetOptStat(1001111); - - if(flag==2 && h1d->GetEntries() > 0) {// adding spec. case for afeb timing - Float_t entr=h1d->GetEntries(); - for(Int_t m=1; mGetNbinsX();m++) { - Float_t w=h1d->GetBinContent(m); - w=100.0*w/entr; - ha->SetBinContent(csc+1,m,w); - } - Float_t mean=h1d->GetMean(); - Int_t me; - if(jesr<9) me=10+jesr; - if(jesr>8) me=18-jesr; - hb->SetBinContent(csc,me,mean); - } - delete h1d; - - // saving slices, finding MEAN in each slice, fill 2D hist - for(Int_t j=1;j<=h2[k]->GetNbinsX();j++) { - Int_t n=j; + hb->GetYaxis()->SetBinLabel(10, "ME+ 1/1"); + hb->GetYaxis()->SetBinLabel(11, "ME+ 1/2"); + hb->GetYaxis()->SetBinLabel(12, "ME+ 1/3"); + hb->GetYaxis()->SetBinLabel(13, "ME+ 2/1"); + hb->GetYaxis()->SetBinLabel(14, "ME+ 2/2"); + hb->GetYaxis()->SetBinLabel(15, "ME+ 3/1"); + hb->GetYaxis()->SetBinLabel(16, "ME+ 3/2"); + hb->GetYaxis()->SetBinLabel(17, "ME+ 4/1"); + hb->GetYaxis()->SetBinLabel(18, "ME+ 4/2"); + //} + + for (Int_t jesr = 0; jesr < 18; jesr++) { + ss.str(""); + ss << result_histName.c_str() << esr[jesr]; + ss1.str(""); + ss1 << result_histTitle; + TH2F *h = new TH2F(ss.str().c_str(), ss1.str().c_str(), 40, 0.0, 40.0, ny, ylow, yhigh); + h->SetStats(kFALSE); + h->GetXaxis()->SetTitle(xTitle[jesr].c_str()); + h->GetYaxis()->SetTitle(result_title_Y.c_str()); + h->GetZaxis()->SetLabelSize(0.03); + h->SetOption("COLZ"); + + ss.str(""); + ss << result_histNameEntries.c_str() << esr[jesr]; + ss1.str(""); + ss1 << result_histTitleEntries; + TH2F *hentr = new TH2F(ss.str().c_str(), ss1.str().c_str(), 40, 0.0, 40.0, ny, ylow, yhigh); + hentr->SetStats(kFALSE); + hentr->GetXaxis()->SetTitle(xTitle[jesr].c_str()); + hentr->GetYaxis()->SetTitle(result_title_Y.c_str()); + hentr->GetZaxis()->SetLabelSize(0.03); + hentr->SetOption("COLZ"); + + //TH2F* ha; + + if (flag == 2) { // adding special cases for AFEB timing + ss.str(""); + ss << "normal_afeb_time_bin_vs_csc_ME_" << esr[jesr]; + ss1.str(""); + ss1 << "Normalized AFEB time bin, %"; + //TH2F *ha=new TH2F(ss.str().c_str(),ss1.str().c_str(),40,0.0,40.0,16,0.0,16.0); + //ha->SetStats(kFALSE); + //ha->GetXaxis()->SetTitle(xTitle[jesr].c_str()); + //ha->GetYaxis()->SetTitle("Time Bin"); + //ha->GetZaxis()->SetLabelSize(0.03); + //ha->SetOption("COLZ"); + } + + for (Int_t csc = 1; csc < 37; csc++) { + Int_t idchamber = esr[jesr] * 100 + csc; + ss.str(""); + ss << folder.c_str() << input_histName.c_str() << idchamber; + f_in->cd(); + TH2F *h2[1]; + h2[k] = (TH2F *)f_in->Get(ss.str().c_str()); + if (h2[k] != NULL) { + // saving original, adding X,Y titles, color and "BOX" option + h2[k]->GetXaxis()->SetTitle(input_title_X.c_str()); + h2[k]->GetYaxis()->SetTitle(input_title_Y.c_str()); + h2[k]->GetYaxis()->SetTitleOffset(1.2); + h2[k]->SetFillColor(4); + h2[k]->SetOption("BOX"); + gStyle->SetOptStat(1001111); + + // saving Y projection of the whole 2D hist for given chamber ss.str(""); - ss<ProjectionY(ss.str().c_str(),j,j,""); - if(h1d->GetEntries() > 0) { - Float_t mean=h1d->GetMean(); - Float_t entr=h1d->GetEntries(); - entries[jesr]=entries[jesr]+1; - h->SetBinContent(csc+1,j,mean); - hentr->SetBinContent(csc+1,j,entr); - ss.str(""); - ss<GetXaxis()->SetTitle(ss.str().c_str()); - h1d->GetYaxis()->SetTitle("Entries"); - h1d->GetYaxis()->SetTitleOffset(1.2); - gStyle->SetOptStat(1001111); - } + ss << input_histName.c_str() << idchamber << "_Y_all"; + TH1D *h1d = h2[k]->ProjectionY(ss.str().c_str(), 1, h2[k]->GetNbinsX(), ""); + h1d->GetYaxis()->SetTitle("Entries"); + h1d->GetYaxis()->SetTitleOffset(1.2); + gStyle->SetOptStat(1001111); + + if (flag == 2 && h1d->GetEntries() > 0) { // adding spec. case for afeb timing + Float_t entr = h1d->GetEntries(); + for (Int_t m = 1; m < h1d->GetNbinsX(); m++) { + Float_t w = h1d->GetBinContent(m); + w = 100.0 * w / entr; + //ha->SetBinContent(csc+1,m,w); + } + Float_t mean = h1d->GetMean(); + Int_t me; + if (jesr < 9) + me = 10 + jesr; + if (jesr > 8) + me = 18 - jesr; + hb->SetBinContent(csc, me, mean); + } delete h1d; - } - } - } - if(entries[jesr]>0) { - h->SetStats(kFALSE); - hentr->SetStats(kFALSE); - c1->Update(); - - // printing - - h->Draw(); - ss.str(""); - ss<Print(ss.str().c_str(),"png"); - - hentr->Draw(); - ss.str(""); - ss<Print(ss.str().c_str(),"png"); - } - delete h; - delete hentr; - if(flag==2) delete ha; -} - if(flag==2) { - hb->Draw(); - ss.str(""); - ss<<"mean_afeb_time_bin_vs_csc_ME"<<".png"; - c1->Print(ss.str().c_str(),"png"); - - c1->Update(); - //delete hb; - } - delete hb; - delete c1; + // saving slices, finding MEAN in each slice, fill 2D hist + for (Int_t j = 1; j <= h2[k]->GetNbinsX(); j++) { + Int_t n = j; + ss.str(""); + ss << input_histName.c_str() << idchamber << "_Y_" << n; + TH1D *h1d = h2[k]->ProjectionY(ss.str().c_str(), j, j, ""); + if (h1d->GetEntries() > 0) { + Float_t mean = h1d->GetMean(); + Float_t entr = h1d->GetEntries(); + entries[jesr] = entries[jesr] + 1; + h->SetBinContent(csc + 1, j, mean); + hentr->SetBinContent(csc + 1, j, entr); + ss.str(""); + ss << slice_title_X << " " << n; + h1d->GetXaxis()->SetTitle(ss.str().c_str()); + h1d->GetYaxis()->SetTitle("Entries"); + h1d->GetYaxis()->SetTitleOffset(1.2); + gStyle->SetOptStat(1001111); + } + delete h1d; + } + } + } + if (entries[jesr] > 0) { + h->SetStats(kFALSE); + hentr->SetStats(kFALSE); + c1->Update(); + + // printing + + h->Draw(); + ss.str(""); + ss << result_histName.c_str() << esr[jesr] << ".png"; + c1->Print(ss.str().c_str(), "png"); + + hentr->Draw(); + ss.str(""); + ss << result_histNameEntries.c_str() << esr[jesr] << ".png"; + c1->Print(ss.str().c_str(), "png"); + } + delete h; + delete hentr; + //if(flag==2) delete ha; + } + if (flag == 2) { + hb->Draw(); + ss.str(""); + ss << "mean_afeb_time_bin_vs_csc_ME" + << ".png"; + c1->Print(ss.str().c_str(), "png"); + + c1->Update(); + //delete hb; + } + delete hb; + delete c1; } +void drawColoredChamberLines(int station, int nchamber1[4][36]) { + // thanks to Luca Sabbatini for this coe + const int maxRingIdxOfRelevance = 2; + const int maxChamberIdxOfRelevance = 35; + const int totalNumberOfChambersOfRelevance = 540; + + Int_t thisRingIdx = 0; + Int_t numChambersInRing = 0; + + float nchamber1Avg = 0.; + float thisRingNchamber1Avg = 0; + float thisRingNchamber1Max = 0; + // Note that thisRingNchamber1Min is only the minumum *non-zero* + // occupancy among all the cmabers for the given ring + float thisRingNchamber1Min = 0; + Int_t thisRingNchamber1Base = 0; + + // rFloatRGB, gFloatRGB, bFloatRGB, are from the RGB color space; + // all three range between [0,1] + // hFloatHLS, lFloatHLS, sFloatHLS, are from the HLS color space; + // lFloatHLS and sFloatHLS range between [0,1], while hFloatHLS + // ranges between [0,360] + Float_t rFloatRGB = 0.; + Float_t gFloatRGB = 0.; + Float_t bFloatRGB = 0.; + Float_t hFloatHLS = 0.; + Float_t lFloatHLS = 0.5; + Float_t sFloatHLS = 1.0; + TColor tempColor; + + // compute average chamber occupancy over all CSCs + for (int i = 0; i < maxRingIdxOfRelevance + 1; i++) { + for (int j = 0; j < maxChamberIdxOfRelevance + 1; j++) { + nchamber1Avg += nchamber1[i][j]; + } + } + nchamber1Avg = nchamber1Avg / totalNumberOfChambersOfRelevance; -drawColoredChamberLines(int station, int nchamber1[4][36]){ - // thanks to Luca Sabbatini for this coe - const int maxRingIdxOfRelevance = 2; - const int maxChamberIdxOfRelevance = 35; - const int totalNumberOfChambersOfRelevance = 540; - - Int_t thisRingIdx = 0; - Int_t numChambersInRing = 0; - - float nchamber1Avg = 0.; - float thisRingNchamber1Avg = 0; - float thisRingNchamber1Max = 0; - // Note that thisRingNchamber1Min is only the minumum *non-zero* - // occupancy among all the cmabers for the given ring - float thisRingNchamber1Min = 0; - Int_t thisRingNchamber1Base = 0; - - // rFloatRGB, gFloatRGB, bFloatRGB, are from the RGB color space; - // all three range between [0,1] - // hFloatHLS, lFloatHLS, sFloatHLS, are from the HLS color space; - // lFloatHLS and sFloatHLS range between [0,1], while hFloatHLS - // ranges between [0,360] - Float_t rFloatRGB = 0.; - Float_t gFloatRGB = 0.; - Float_t bFloatRGB = 0.; - Float_t hFloatHLS = 0.; - Float_t lFloatHLS = 0.5; - Float_t sFloatHLS = 1.0; - TColor tempColor; - - // compute average chamber occupancy over all CSCs - for (int i=0; i < maxRingIdxOfRelevance+1; i++){ - for (int j=0; j < maxChamberIdxOfRelevance+1; j++){ - nchamber1Avg += nchamber1[i][j]; - } - } - nchamber1Avg = nchamber1Avg/totalNumberOfChambersOfRelevance; - - Float_t myFavoriteLineWidth = 2.0; - gStyle->SetLineWidth(myFavoriteLineWidth); - float pi = 3.14159; - TVector3 x(0,0,1); - int linecolor = 1; - - // emptyLineColor is the color of the outline of empty chambers. - // if emptyLineColor is negative, no outline is drawn at all for - // that chamber. - Int_t emptyLineColor = kYellow; - - // note that these can be greater than 360 because I have included - // a line down below that performs a modulus operation: %360, which - // ensures that the resulting hue will indeed be with [0,360] - // - // Hue: 0 30 60 120 180 240 270 300 360 - // | | | | | | | | | - // Color: Red Orange Yellow Green Cyan Blue Vilet Magenta Red - Float_t lineHueMin = 240; - Float_t lineHueMax = 360; - - TLine *line1; - TLine *line2; - TLine *line3; - TLine *line4; - - if (station == 1){ - - // station 1, ring 1 (inner-most ring) - thisRingIdx = 0; - numChambersInRing = 36; - TVector3 p1(101,9.361,0); - TVector3 p2(101,-9.361,0); - TVector3 p3(260,-22.353,0); - TVector3 p4(260,22.353,0); - - - // compute thisRingNchamber1Min, thisRingNchamber1Max, - // thisRingNchamber1Avg and thisRingNchamber1Base - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - // set the line color - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[0][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - // draw the chamber outline using the line color (so long - // as the the chamber isn't empty *and* the user did not - // set a negative line color for empty chambers) - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - - // Rotate coordinate by 1 chamber - p1.Rotate(2*pi/numChambersInRing,x); - p2.Rotate(2*pi/numChambersInRing,x); - p3.Rotate(2*pi/numChambersInRing,x); - p4.Rotate(2*pi/numChambersInRing,x); - - } - - // station 1, ring 2 (middle-ring) - thisRingIdx = 1; - numChambersInRing = 36; - TVector3 q1(281.49,25.5,0); - TVector3 q2(281.49,-25.5,0); - TVector3 q3(455.99,-41.87,0); - TVector3 q4(455.99,41.87,0); - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[thisRingIdx][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(q1(0),q1(1),q2(0),q2(1)); - line2 = new TLine(q2(0),q2(1),q3(0),q3(1)); - line3 = new TLine(q3(0),q3(1),q4(0),q4(1)); - line4 = new TLine(q4(0),q4(1),q1(0),q1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - q1.Rotate(2*pi/numChambersInRing,x); - q2.Rotate(2*pi/numChambersInRing,x); - q3.Rotate(2*pi/numChambersInRing,x); - q4.Rotate(2*pi/numChambersInRing,x); - - } - - // station 1, ring 3 (outer-most ring) - thisRingIdx = 2; - numChambersInRing = 36; - TVector3 r1(511.99,31.7,0); - TVector3 r2(511.99,-31.7,0); - TVector3 r3(676.15,-46.05,0); - TVector3 r4(676.15,46.05.6,0); - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[thisRingIdx][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(r1(0),r1(1),r2(0),r2(1)); - line2 = new TLine(r2(0),r2(1),r3(0),r3(1)); - line3 = new TLine(r3(0),r3(1),r4(0),r4(1)); - line4 = new TLine(r4(0),r4(1),r1(0),r1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - r1.Rotate(2*pi/numChambersInRing,x); - r2.Rotate(2*pi/numChambersInRing,x); - r3.Rotate(2*pi/numChambersInRing,x); - r4.Rotate(2*pi/numChambersInRing,x); - - } - - } - - - if (station == 2){ - - // station 2, ring 1 (inner ring) - thisRingIdx = 0; - numChambersInRing = 18; - TVector3 p1(146.9,27.0,0); - TVector3 p2(146.9,-27.0,0); - TVector3 p3(336.56,-62.855,0); - TVector3 p4(336.56,62.855,0); - - // must "pre-rotate" by one-fourth of a chamber - p1.Rotate((1/4.)*2*pi/numChambersInRing,x); - p2.Rotate((1/4.)*2*pi/numChambersInRing,x); - p3.Rotate((1/4.)*2*pi/numChambersInRing,x); - p4.Rotate((1/4.)*2*pi/numChambersInRing,x); - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[0][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - p1.Rotate(2*pi/numChambersInRing,x); - p2.Rotate(2*pi/numChambersInRing,x); - p3.Rotate(2*pi/numChambersInRing,x); - p4.Rotate(2*pi/numChambersInRing,x); - - } - - // station 2, ring 2 (outer ring) - thisRingIdx = 1; - numChambersInRing = 36; - TVector3 q1(364.02,33.23,0); - TVector3 q2(364.02,-33.23,0); - TVector3 q3(687.08,-63.575,0); - TVector3 q4(687.08,63.575,0); - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[thisRingIdx][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(q1(0),q1(1),q2(0),q2(1)); - line2 = new TLine(q2(0),q2(1),q3(0),q3(1)); - line3 = new TLine(q3(0),q3(1),q4(0),q4(1)); - line4 = new TLine(q4(0),q4(1),q1(0),q1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - q1.Rotate(2*pi/numChambersInRing,x); - q2.Rotate(2*pi/numChambersInRing,x); - q3.Rotate(2*pi/numChambersInRing,x); - q4.Rotate(2*pi/numChambersInRing,x); - - } - - } - - if (station == 3){ - - // station 3, ring 1 (inner ring) - thisRingIdx = 0; - numChambersInRing = 18; - TVector3 p1(166.89,30.7,0); - TVector3 p2(166.89,-30.7,0); - TVector3 p3(336.59,-62.855,0); - TVector3 p4(336.59,62.855,0); - - // must "pre-rotate" by one-fourth of a chamber - p1.Rotate((1/4.)*2*pi/numChambersInRing,x); - p2.Rotate((1/4.)*2*pi/numChambersInRing,x); - p3.Rotate((1/4.)*2*pi/numChambersInRing,x); - p4.Rotate((1/4.)*2*pi/numChambersInRing,x); - - TLine *line1; - TLine *line2; - TLine *line3; - TLine *line4; - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[0][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - p1.Rotate(2*pi/numChambersInRing,x); - p2.Rotate(2*pi/numChambersInRing,x); - p3.Rotate(2*pi/numChambersInRing,x); - p4.Rotate(2*pi/numChambersInRing,x); - - } - - // station 3, ring 2 (outer ring) - thisRingIdx = 1; - numChambersInRing = 36; - TVector3 q1(364.02,33.23,0); - TVector3 q2(364.02,-33.23,0); - TVector3 q3(687.08,-63.575,0); - TVector3 q4(687.08,63.575,0); - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[thisRingIdx][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)*// - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(q1(0),q1(1),q2(0),q2(1)); - line2 = new TLine(q2(0),q2(1),q3(0),q3(1)); - line3 = new TLine(q3(0),q3(1),q4(0),q4(1)); - line4 = new TLine(q4(0),q4(1),q1(0),q1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - q1.Rotate(2*pi/numChambersInRing,x); - q2.Rotate(2*pi/numChambersInRing,x); - q3.Rotate(2*pi/numChambersInRing,x); - q4.Rotate(2*pi/numChambersInRing,x); - - } - - } - - if (station == 4){ - - // station 4, ring 1 (the only ring on station 4... so far) - thisRingIdx = 0; - numChambersInRing = 18; - TVector3 p1(186.99,34.505.15,0); - TVector3 p2(186.99,-34.505,0); - TVector3 p3(336.41,-62.825,0); - TVector3 p4(336.41,62.825,0); - - // must "pre-rotate" by one-fourth of a chamber - p1.Rotate((1/4.)*2*pi/numChambersInRing,x); - p2.Rotate((1/4.)*2*pi/numChambersInRing,x); - p3.Rotate((1/4.)*2*pi/numChambersInRing,x); - p4.Rotate((1/4.)*2*pi/numChambersInRing,x); - - TLine *line1; - TLine *line2; - TLine *line3; - TLine *line4; - - thisRingNchamber1Avg = 0.; - thisRingNchamber1Max = 0.; - for (int j=0; j < numChambersInRing; j++){ - thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; - if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]){ - thisRingNchamber1Max = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Min = thisRingNchamber1Max; - for (int j=0; j < numChambersInRing; j++){ - if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // - nchamber1[thisRingIdx][j] != 0){ - thisRingNchamber1Min = nchamber1[thisRingIdx][j]; - } - } - thisRingNchamber1Avg = thisRingNchamber1Avg/numChambersInRing; - thisRingNchamber1Base = thisRingNchamber1Min; - - for (int i = 0; i < numChambersInRing; i++){ - - if(nchamber1[thisRingIdx][i] != 0){ - hFloatHLS = int((nchamber1[0][i]-thisRingNchamber1Base)/(thisRingNchamber1Max-thisRingNchamber1Base)* // - (lineHueMax-lineHueMin) + lineHueMin)%360; - tempColor.HLS2RGB(hFloatHLS,lFloatHLS,sFloatHLS,rFloatRGB,gFloatRGB,bFloatRGB); - linecolor = tempColor.GetColor(rFloatRGB,gFloatRGB,bFloatRGB); - } - else if(emptyLineColor >= 0){ - linecolor = emptyLineColor; - } - - if((nchamber1[thisRingIdx][i]!=0)|| // - (nchamber1[thisRingIdx][i]==0 && emptyLineColor>=0)) - { - line1 = new TLine(p1(0),p1(1),p2(0),p2(1)); - line2 = new TLine(p2(0),p2(1),p3(0),p3(1)); - line3 = new TLine(p3(0),p3(1),p4(0),p4(1)); - line4 = new TLine(p4(0),p4(1),p1(0),p1(1)); - line1->SetLineColor(linecolor); - line2->SetLineColor(linecolor); - line3->SetLineColor(linecolor); - line4->SetLineColor(linecolor); - - line1->Draw(); - line2->Draw(); - line3->Draw(); - line4->Draw(); - } - p1.Rotate(2*pi/numChambersInRing,x); - p2.Rotate(2*pi/numChambersInRing,x); - p3.Rotate(2*pi/numChambersInRing,x); - p4.Rotate(2*pi/numChambersInRing,x); - - } - - } + Float_t myFavoriteLineWidth = 2.0; + gStyle->SetLineWidth(myFavoriteLineWidth); + float pi = 3.14159; + TVector3 x(0, 0, 1); + int linecolor = 1; -} + // emptyLineColor is the color of the outline of empty chambers. + // if emptyLineColor is negative, no outline is drawn at all for + // that chamber. + Int_t emptyLineColor = kYellow; + + // note that these can be greater than 360 because I have included + // a line down below that performs a modulus operation: %360, which + // ensures that the resulting hue will indeed be with [0,360] + // + // Hue: 0 30 60 120 180 240 270 300 360 + // | | | | | | | | | + // Color: Red Orange Yellow Green Cyan Blue Vilet Magenta Red + Float_t lineHueMin = 240; + Float_t lineHueMax = 360; + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + if (station == 1) { + // station 1, ring 1 (inner-most ring) + thisRingIdx = 0; + numChambersInRing = 36; + TVector3 p1(101, 9.361, 0); + TVector3 p2(101, -9.361, 0); + TVector3 p3(260, -22.353, 0); + TVector3 p4(260, 22.353, 0); + + // compute thisRingNchamber1Min, thisRingNchamber1Max, + // thisRingNchamber1Avg and thisRingNchamber1Base + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + // set the line color + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = + int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + // draw the chamber outline using the line color (so long + // as the the chamber isn't empty *and* the user did not + // set a negative line color for empty chambers) + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + + // Rotate coordinate by 1 chamber + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 1, ring 2 (middle-ring) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(281.49, 25.5, 0); + TVector3 q2(281.49, -25.5, 0); + TVector3 q3(455.99, -41.87, 0); + TVector3 q4(455.99, 41.87, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(q3(0) * q3(0) + q3(1) * q3(1)); + float theta = atan2(q3(1), q3(0)); + r = r + 25; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 1, ring 3 (outer-most ring) + thisRingIdx = 2; + numChambersInRing = 36; + TVector3 r1(511.99, 31.7, 0); + TVector3 r2(511.99, -31.7, 0); + TVector3 r3(676.15, -46.05, 0); + TVector3 r4(676.15, 46.05, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(r1(0), r1(1), r2(0), r2(1)); + line2 = new TLine(r2(0), r2(1), r3(0), r3(1)); + line3 = new TLine(r3(0), r3(1), r4(0), r4(1)); + line4 = new TLine(r4(0), r4(1), r1(0), r1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(r3(0) * r3(0) + r3(1) * r3(1)); + float theta = atan2(r3(1), r3(0)); + r = r + 25; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + r1.Rotate(2 * pi / numChambersInRing, x); + r2.Rotate(2 * pi / numChambersInRing, x); + r3.Rotate(2 * pi / numChambersInRing, x); + r4.Rotate(2 * pi / numChambersInRing, x); + } + } + + if (station == 2) { + // station 2, ring 1 (inner ring) + thisRingIdx = 0; + numChambersInRing = 18; + TVector3 p1(146.9, 27.0, 0); + TVector3 p2(146.9, -27.0, 0); + TVector3 p3(336.56, -62.855, 0); + TVector3 p4(336.56, 62.855, 0); + + // must "pre-rotate" by one-fourth of a chamber + p1.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p2.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p3.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p4.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = + int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(p3(0) * p3(0) + p3(1) * p3(1)); + float theta = atan2(p3(1), p3(0)); + r = r + 10; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 2, ring 2 (outer ring) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(q3(0) * q3(0) + q3(1) * q3(1)); + float theta = atan2(q3(1), q3(0)); + r = r + 25; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + } + + if (station == 3) { + // station 3, ring 1 (inner ring) + thisRingIdx = 0; + numChambersInRing = 18; + TVector3 p1(166.89, 30.7, 0); + TVector3 p2(166.89, -30.7, 0); + TVector3 p3(336.59, -62.855, 0); + TVector3 p4(336.59, 62.855, 0); + + // must "pre-rotate" by one-fourth of a chamber + p1.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p2.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p3.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p4.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = + int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(p3(0) * p3(0) + p3(1) * p3(1)); + float theta = atan2(p3(1), p3(0)); + r = r + 10; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + // station 3, ring 2 (outer ring) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(q3(0) * q3(0) + q3(1) * q3(1)); + float theta = atan2(q3(1), q3(0)); + r = r + 25; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + } + if (station == 4) { + // station 4, ring 1 (the only ring on station 4... so far) + thisRingIdx = 0; + numChambersInRing = 18; + TVector3 p1(186.99, 34.505, 0); + TVector3 p2(186.99, -34.505, 0); + TVector3 p3(336.41, -62.825, 0); + TVector3 p4(336.41, 62.825, 0); + + // must "pre-rotate" by one-fourth of a chamber + p1.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p2.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p3.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p4.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = + int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(p3(0) * p3(0) + p3(1) * p3(1)); + float theta = atan2(p3(1), p3(0)); + r = r + 10; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 4, ring 2 (outer ring) (This is just a copy of the ME3/2 code) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + if ((thisRingNchamber1Max - thisRingNchamber1Base) != 0) + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + int chamberNum = i + 1; + char chStr[3]; + sprintf(chStr, "%d", chamberNum); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.02); + float r = sqrt(q3(0) * q3(0) + q3(1) * q3(1)); + float theta = atan2(q3(1), q3(0)); + r = r + 25; + theta = pi / numChambersInRing + theta; + float xpos = r * cos(theta); + float ypos = r * sin(theta); + l.DrawLatex(xpos, ypos, chStr); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + } +} diff --git a/RecoLocalMuon/CSCValidation/macros/myFunctions_OLD.C b/RecoLocalMuon/CSCValidation/macros/myFunctions_OLD.C new file mode 100644 index 0000000000000..baf3f665ec9ca --- /dev/null +++ b/RecoLocalMuon/CSCValidation/macros/myFunctions_OLD.C @@ -0,0 +1,1975 @@ +TFile *OpenFiles(std::string path) { + TFile *f; + f = new TFile(path.c_str(), "READ"); + return f; +} + +void printEmptyChambers(std::string histoname, std::string oname, TFile *f) { + TH2I *plot = (TH2I *)f->Get(histoname.c_str()); + std::string endcap, chamber; + int limitr, limitc; + std::vector deadchambers; + + for (int e = 0; e < 2; e++) { + for (int s = 0; s < 4; s++) { + if (s == 0) + limitr = 4; + if (s == 1 || s == 2) + limitr = 2; + if (s == 3) + limitr = 1; + for (int r = 0; r < limitr; r++) { + if (s == 0) + limitc = 36; + if (s != 0 && r == 0) + limitc = 18; + if (s != 0 && r == 1) + limitc = 36; + for (int c = 0; c < limitc; c++) { + int type = 0; + if (s == 0 && r == 0) + type = 2; + else if (s == 0 && r == 1) + type = 3; + else if (s == 0 && r == 2) + type = 4; + else if (s == 0 && r == 3) + type = 1; + else + type = (s + 1) * 2 + (r + 1); + if (e == 0) + type = type + 10; + if (e == 1) + type = 11 - type; + int bin = plot->GetBin((c + 1), type); + float content = plot->GetBinContent(bin); + std::ostringstream oss; + if (e == 0) + endcap = "+"; + if (e == 1) + endcap = "-"; + oss << "ME " << endcap << (s + 1) << "/" << (r + 1) << "/" << (c + 1); + chamber = oss.str(); + if (content == 0) { + if (oname == "wire digis" && (s == 0 && r == 3)) + continue; + else + deadchambers.push_back(chamber); + } + } + } + } + } + + int n_dc = deadchambers.size(); + ofstream file; + file.open("deadchamberlist.txt", ios::app); + file << "Chambers with missing " << oname << "...\n" << endl; + if (n_dc > 0) { + for (int n = 0; n < n_dc; n++) { + file << deadchambers[n] << endl; + } + } + file << "\n\n\n\n"; + file.close(); +} + +void make1DPlot(std::string histoname, TFile *f1, std::string histotitle, int statoption, std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); + + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.7); + h1->GetXaxis()->SetTitleSize(0.06); + h1->GetXaxis()->SetNdivisions(208, kTRUE); + + h1->Draw(); + + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; +} + +void makeCSCOccupancy(std::string histoname, TFile *f1, std::string histotitle, std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1) { + gStyle->SetOptStat(kFALSE); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + h1->UseCurrentStyle(); + + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.7); + h1->GetXaxis()->SetTitleSize(0.06); + h1->GetXaxis()->SetNdivisions(208, kTRUE); + + h1->GetXaxis()->SetBinLabel(2, "Total Events"); + h1->GetXaxis()->SetBinLabel(4, "# Events with Wires"); + h1->GetXaxis()->SetBinLabel(6, "# Events with Strips"); + h1->GetXaxis()->SetBinLabel(8, "# Events with Wires&Strips"); + h1->GetXaxis()->SetBinLabel(10, "# Events with Rechits"); + h1->GetXaxis()->SetBinLabel(12, "# Events with Segments"); + h1->GetXaxis()->SetBinLabel(14, "Events Rejected"); + + h1->Draw(); + + c->Update(); + c->Print(savename.c_str(), "png"); + } + + delete c; +} + +void make1DPlot2(std::string histoname1, + std::string histoname2, + int statoption, + TFile *f1, + std::string t1, + std::string t2, + std::string savename) { + // use this if you want two plots on one canvas + + TH1F *a1 = (TH1F *)f1->Get(histoname1.c_str()); + TH1F *b1 = (TH1F *)f1->Get(histoname2.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->Divide(1, 2); + + if (a1) { + c->cd(1); + if (statoption == 0) + gStyle->SetOptStat(kFALSE); + else + gStyle->SetOptStat(statoption); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.4); + gStyle->SetTitleH(0.09); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + a1->UseCurrentStyle(); + a1->SetTitle(t1.c_str()); + a1->GetXaxis()->SetLabelSize(0.06); + a1->GetYaxis()->SetLabelSize(0.06); + a1->GetXaxis()->SetTitleOffset(0.7); + a1->GetXaxis()->SetTitleSize(0.06); + a1->GetXaxis()->SetNdivisions(208, kTRUE); + a1->Draw(); + } + + if (b1) { + gStyle->SetHistFillColor(72); + b1->UseCurrentStyle(); + + t2 = t2 + " (run " + run + ")"; + b1->SetTitle(t2.c_str()); + b1->GetXaxis()->SetLabelSize(0.06); + b1->GetYaxis()->SetLabelSize(0.06); + b1->GetXaxis()->SetTitleOffset(0.7); + b1->GetXaxis()->SetTitleSize(0.06); + b1->GetXaxis()->SetNdivisions(508, kTRUE); + c->cd(2); + b1->Draw(); + } + + c->Update(); + c->Print(savename.c_str(), "png"); + delete c; +} + +void makeEffGif(std::string histoname, TFile *f1, std::string histotitle, std::string savename) { + TH1F *ho = (TH1F *)f1->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + TH1F *hn = new TH1F("tmp", histotitle.c_str(), 20, 0.5, 20.5); + + if (ho) { + float Num = 1; + float Den = 1; + for (int i = 0; i < 20; i++) { + Num = ho->GetBinContent(i + 1); + Den = ho->GetBinContent(i + 21); + //getEfficiency(Num, Den, eff); + float Eff = 0.; + float EffE = 0.; + if (fabs(Den) > 0.000000001) { + Eff = Num / Den; + if (Num < Den) { + EffE = sqrt((1. - Eff) * Eff / Den); + } + } + hn->SetBinContent(i + 1, Eff); + hn->SetBinError(i + 1, EffE); + } + + gStyle->SetOptStat(kFALSE); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + c->SetFillStyle(4000); + hn->UseCurrentStyle(); + + hn->SetTitle(histotitle.c_str()); + hn->GetXaxis()->SetLabelSize(0.04); + hn->GetYaxis()->SetLabelSize(0.04); + hn->GetXaxis()->SetTitleOffset(0.7); + hn->GetXaxis()->SetTitleSize(0.06); + hn->GetXaxis()->SetNdivisions(208, kTRUE); + hn->GetYaxis()->SetRangeUser(0.5, 1.1); + hn->SetMarkerStyle(6); + hn->GetXaxis()->SetBinLabel(1, "ME +1/1b"); + hn->GetXaxis()->SetBinLabel(2, "ME +1/2"); + hn->GetXaxis()->SetBinLabel(3, "ME +1/3"); + hn->GetXaxis()->SetBinLabel(4, "ME +1/1a"); + hn->GetXaxis()->SetBinLabel(5, "ME +2/1"); + hn->GetXaxis()->SetBinLabel(6, "ME +2/2"); + hn->GetXaxis()->SetBinLabel(7, "ME +3/1"); + hn->GetXaxis()->SetBinLabel(8, "ME +3/2"); + hn->GetXaxis()->SetBinLabel(9, "ME +4/1"); + hn->GetXaxis()->SetBinLabel(10, "ME +4/2"); + hn->GetXaxis()->SetBinLabel(11, "ME -1/1b"); + hn->GetXaxis()->SetBinLabel(12, "ME -1/2"); + hn->GetXaxis()->SetBinLabel(13, "ME -1/3"); + hn->GetXaxis()->SetBinLabel(14, "ME -1/1a"); + hn->GetXaxis()->SetBinLabel(15, "ME -2/1"); + hn->GetXaxis()->SetBinLabel(16, "ME -2/2"); + hn->GetXaxis()->SetBinLabel(17, "ME -3/1"); + hn->GetXaxis()->SetBinLabel(18, "ME -3/2"); + hn->GetXaxis()->SetBinLabel(19, "ME -4/1"); + hn->GetXaxis()->SetBinLabel(20, "ME -4/2"); + hn->Draw(); + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; + delete hn; +} + +void Draw2DProfile(std::string histoname, TFile *f1, std::string title, std::string option, std::string savename) { + TProfile2D *test = f1->Get(histoname.c_str()); + TH2D *plot = test->ProjectionXY("test2", option.c_str()); + + if (plot) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + plot->SetStats(kFALSE); + plot->GetYaxis()->SetBinLabel(1, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(2, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(4, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(6, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(10, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 4/1"); + + plot->SetTitle(title.c_str()); + + for (int i = 1; i < 37; i++) { + ostringstream oss1; + oss1 << i; + string ch = oss1.str(); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); + } + + c->SetRightMargin(0.12); + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); + plot->GetXaxis()->SetTitle("Chamber #"); + c->SetGrid(); + + plot->Draw("colz"); + c->Update(); + c->Print(savename.c_str(), "png"); + delete c; + } +} + +void Draw2DEfficiency(std::string histo, TFile *f1, std::string title, std::string savename) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + + TH2F *num = (TH2F *)f1->Get(histo.c_str()); + TH2F *denom = (TH2F *)f1->Get("Efficiency/hEffDenominator"); + + TH2F *plot = new TH2F("plot", title.c_str(), 36, 0.5, 36.5, 18, 0.5, 18.5); + + plot->Divide(num, denom, 1., 1., "B"); + + plot->SetStats(kFALSE); + + plot->GetYaxis()->SetBinLabel(1, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(2, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(4, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(6, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(10, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 4/1"); + + for (int i = 1; i < 37; i++) { + ostringstream oss1; + oss1 << i; + string ch = oss1.str(); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); + } + + c->SetRightMargin(0.12); + + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); + + plot->GetXaxis()->SetTitle("Chamber #"); + + c->SetGrid(); + + plot->Draw("COLZ"); + + c->Update(); + c->Print(savename.c_str(), "png"); + delete c; + delete plot; +} + +void Draw2DTempPlot(std::string histo, TFile *f1, bool includeME11, std::string savename) { + TCanvas *c = new TCanvas("c", "my canvas", 1); + gStyle->SetPalette(1, 0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + + TH2I *plot = (TH2I *)f1->Get(histo.c_str()); + + plot->SetStats(kFALSE); + + if (includeME11) { + plot->GetYaxis()->SetBinLabel(1, "ME- 4/2"); + plot->GetYaxis()->SetBinLabel(2, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(4, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(6, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(10, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(19, "ME+ 4/1"); + plot->GetYaxis()->SetBinLabel(20, "ME+ 4/2"); + } else { + plot->GetYaxis()->SetBinLabel(1, "ME- 4/1"); + plot->GetYaxis()->SetBinLabel(2, "ME- 3/2"); + plot->GetYaxis()->SetBinLabel(3, "ME- 3/1"); + plot->GetYaxis()->SetBinLabel(4, "ME- 2/2"); + plot->GetYaxis()->SetBinLabel(5, "ME- 2/1"); + plot->GetYaxis()->SetBinLabel(6, "ME- 1/3"); + plot->GetYaxis()->SetBinLabel(7, "ME- 1/2"); + plot->GetYaxis()->SetBinLabel(8, "ME- 1/1b"); + plot->GetYaxis()->SetBinLabel(9, "ME- 1/1a"); + plot->GetYaxis()->SetBinLabel(10, "ME+ 1/1a"); + plot->GetYaxis()->SetBinLabel(11, "ME+ 1/1b"); + plot->GetYaxis()->SetBinLabel(12, "ME+ 1/2"); + plot->GetYaxis()->SetBinLabel(13, "ME+ 1/3"); + plot->GetYaxis()->SetBinLabel(14, "ME+ 2/1"); + plot->GetYaxis()->SetBinLabel(15, "ME+ 2/2"); + plot->GetYaxis()->SetBinLabel(16, "ME+ 3/1"); + plot->GetYaxis()->SetBinLabel(17, "ME+ 3/2"); + plot->GetYaxis()->SetBinLabel(18, "ME+ 4/1"); + } + + for (int i = 1; i < 37; i++) { + ostringstream oss1; + oss1 << i; + string ch = oss1.str(); + plot->GetXaxis()->SetBinLabel(i, ch.c_str()); + } + + c->SetRightMargin(0.12); + + plot->GetYaxis()->SetNdivisions(20, kFALSE); + plot->GetXaxis()->SetNdivisions(36, kFALSE); + + plot->GetXaxis()->SetTitle("Chamber #"); + + c->SetGrid(); + + plot->Draw("COLZ"); + + c->Update(); + c->Print(savename.c_str(), "png"); + delete c; +} + +void GlobalPosfromTree( + std::string graphname, TFile *f1, int endcap, int station, std::string type, std::string savename) { + TTree *t1; + TBranch *b1; + struct posRecord { + int endcap; + int station; + int ring; + int chamber; + int layer; + float localx; + float localy; + float globalx; + float globaly; + } points; + + if (type == "rechit") { + t1 = (TTree *)f1->Get("recHits/rHPositions"); + b1 = t1->GetBranch("rHpos"); + b1->SetAddress(&points); + } + + if (type == "segment") { + t1 = (TTree *)f1->Get("Segments/segPositions"); + b1 = t1->GetBranch("segpos"); + b1->SetAddress(&points); + } + + int n1 = (int)t1->GetEntries(); + const int nevents1 = n1; + float globx1[nevents1]; + float globy1[nevents1]; + int nstation1 = 0; + const int num_of_rings = 4; + const int num_of_chambers = 36; + int nchamber1[num_of_rings][num_of_chambers]; + for (int i = 0; i < num_of_rings; i++) { + for (int j = 0; j < num_of_chambers; j++) { + nchamber1[i][j] = 0; + } + } + + for (int i = 0; i < nevents1; i++) { + b1->GetEntry(i); + if (points.station == station && points.endcap == endcap) { + globx1[nstation1] = points.globalx; + globy1[nstation1] = points.globaly; + nstation1++; + nchamber1[points.ring - 1][points.chamber - 1]++; + } + } + + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->SetCanvasSize(700, 700); + TGraph *graph1 = new TGraph(nstation1, globx1, globy1); + + std::string name1 = graphname; + + gStyle->SetPalette(1, 0); + gStyle->SetTitleW(0.9); + gStyle->SetTitleH(0.1); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetOptStat(10); + + graph1->GetXaxis()->SetLimits(-720, 720); + graph1->GetYaxis()->SetLimits(-720, 720); + graph1->GetXaxis()->SetRangeUser(-720, 720); + graph1->GetYaxis()->SetRangeUser(-720, 720); + + graph1->SetTitle(name1.c_str()); + graph1->UseCurrentStyle(); + graph1->Draw("AP"); + + // drawChamberLines(station); + drawColoredChamberLines(station, nchamber1); + + c->Print(savename.c_str(), "png"); + delete c; + +} // end GlobalPosfromTree + +drawChamberLines(int station) { + gStyle->SetLineWidth(2); + float pi = 3.14159; + TVector3 x(0, 0, 1); + int linecolor = 1; + //for alternating colors, set 2 diff colors here + int lc1 = 1; + int lc2 = 1; + + if (station == 1) { + TVector3 p1(101, 9.361, 0); + TVector3 p2(101, -9.361, 0); + TVector3 p3(260, -22.353, 0); + TVector3 p4(260, 22.353, 0); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; + + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + p1.Rotate(pi / 18, x); + p2.Rotate(pi / 18, x); + p3.Rotate(pi / 18, x); + p4.Rotate(pi / 18, x); + } + + TVector3 q1(281.49, 25.5, 0); + TVector3 q2(281.49, -25.5, 0); + TVector3 q3(455.99, -41.87, 0); + TVector3 q4(455.99, 41.87, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc2) + linecolor = lc1; + else + linecolor = lc2; + + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + q1.Rotate(pi / 18, x); + q2.Rotate(pi / 18, x); + q3.Rotate(pi / 18, x); + q4.Rotate(pi / 18, x); + } + + TVector3 r1(511.99, 31.7, 0); + TVector3 r2(511.99, -31.7, 0); + TVector3 r3(676.15, -46.05, 0); + TVector3 r4(676.15, 46.05.6, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; + + line1 = new TLine(r1(0), r1(1), r2(0), r2(1)); + line2 = new TLine(r2(0), r2(1), r3(0), r3(1)); + line3 = new TLine(r3(0), r3(1), r4(0), r4(1)); + line4 = new TLine(r4(0), r4(1), r1(0), r1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + r1.Rotate(pi / 18, x); + r2.Rotate(pi / 18, x); + r3.Rotate(pi / 18, x); + r4.Rotate(pi / 18, x); + } + } + + if (station == 2) { + TVector3 p1(146.9, 27.0, 0); + TVector3 p2(146.9, -27.0, 0); + TVector3 p3(336.56, -62.855, 0); + TVector3 p4(336.56, 62.855, 0); + + p1.Rotate(pi / 36, x); + p2.Rotate(pi / 36, x); + p3.Rotate(pi / 36, x); + p4.Rotate(pi / 36, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; + + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + p1.Rotate(pi / 9, x); + p2.Rotate(pi / 9, x); + p3.Rotate(pi / 9, x); + p4.Rotate(pi / 9, x); + } + + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc2) + linecolor = lc1; + else + linecolor = lc2; + + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + q1.Rotate(pi / 18, x); + q2.Rotate(pi / 18, x); + q3.Rotate(pi / 18, x); + q4.Rotate(pi / 18, x); + } + } + + if (station == 3) { + TVector3 p1(166.89, 30.7, 0); + TVector3 p2(166.89, -30.7, 0); + TVector3 p3(336.59, -62.855, 0); + TVector3 p4(336.59, 62.855, 0); + + p1.Rotate(pi / 36, x); + p2.Rotate(pi / 36, x); + p3.Rotate(pi / 36, x); + p4.Rotate(pi / 36, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; + + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + p1.Rotate(pi / 9, x); + p2.Rotate(pi / 9, x); + p3.Rotate(pi / 9, x); + p4.Rotate(pi / 9, x); + } + + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + for (int i = 0; i < 36; i++) { + if (linecolor == lc2) + linecolor = lc1; + else + linecolor = lc2; + + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + q1.Rotate(pi / 18, x); + q2.Rotate(pi / 18, x); + q3.Rotate(pi / 18, x); + q4.Rotate(pi / 18, x); + } + } + + if (station == 4) { + TVector3 p1(186.99, 34.505.15, 0); + TVector3 p2(186.99, -34.505, 0); + TVector3 p3(336.41, -62.825, 0); + TVector3 p4(336.41, 62.825, 0); + + p1.Rotate(pi / 36, x); + p2.Rotate(pi / 36, x); + p3.Rotate(pi / 36, x); + p4.Rotate(pi / 36, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + for (int i = 0; i < 36; i++) { + if (linecolor == lc1) + linecolor = lc2; + else + linecolor = lc1; + + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + + p1.Rotate(pi / 9, x); + p2.Rotate(pi / 9, x); + p3.Rotate(pi / 9, x); + p4.Rotate(pi / 9, x); + } + } +} + +void compare1DPlot( + std::string histoname, TFile *f1, TFile *f2, std::string histotitle, int statoption, std::string savename) { + // used to compare two of the same histogram from different releases/runs/etc + + TH1F *h2 = (TH1F *)f1->Get(histoname.c_str()); + TH1F *h1 = (TH1F *)f2->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + if (h1 && h2) { + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.5); + gStyle->SetTitleH(0.07); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gPad->SetFillColor(4000); + c->SetFillStyle(4000); + gStyle->SetOptStat(statoption); + h1->UseCurrentStyle(); + h2->UseCurrentStyle(); + h2->SetFillColor(52); + + h1->SetTitle(histotitle.c_str()); + h1->GetXaxis()->SetLabelSize(0.04); + h1->GetYaxis()->SetLabelSize(0.04); + h1->GetXaxis()->SetTitleOffset(0.7); + h1->GetXaxis()->SetTitleSize(0.06); + h1->GetXaxis()->SetNdivisions(208, kTRUE); + + TLegend *leg = new TLegend(0.79, 0.74, 0.89, 0.84); + leg->AddEntry(h1, "ref", "f"); + leg->AddEntry(h2, "new", "l"); + + h1->Draw(); + h2->Draw("same e"); + leg->Draw(); + } + + c->Update(); + c->Print(savename.c_str(), "png"); + delete c; +} + +void compareEffGif(std::string histoname, TFile *f1, TFile *f2, std::string histotitle, std::string savename) { + TH1F *h1 = (TH1F *)f1->Get(histoname.c_str()); + TH1F *h2 = (TH1F *)f2->Get(histoname.c_str()); + + TCanvas *c = new TCanvas("c", "my canvas", 1); + + TH1F *hn1 = new TH1F("tmp1", histotitle.c_str(), 20, 0.5, 20.5); + TH1F *hn2 = new TH1F("tmp2", histotitle.c_str(), 20, 0.5, 20.5); + + if (h1 && h2) { + float Num = 1; + float Den = 1; + for (int i = 0; i < 20; i++) { + Num = h1->GetBinContent(i + 1); + Den = h1->GetBinContent(i + 21); + //getEfficiency(Num, Den, eff); + float Eff = 0.; + float EffE = 0.; + if (fabs(Den) > 0.000000001) { + Eff = Num / Den; + if (Num < Den) { + EffE = sqrt((1. - Eff) * Eff / Den); + } + } + hn1->SetBinContent(i + 1, Eff); + hn1->SetBinError(i + 1, EffE); + } + + float Num = 1; + float Den = 1; + for (int i = 0; i < 20; i++) { + Num = h2->GetBinContent(i + 1); + Den = h2->GetBinContent(i + 21); + //getEfficiency(Num, Den, eff); + float Eff = 0.; + float EffE = 0.; + if (fabs(Den) > 0.000000001) { + Eff = Num / Den; + if (Num < Den) { + EffE = sqrt((1. - Eff) * Eff / Den); + } + } + hn2->SetBinContent(i + 1, Eff); + hn2->SetBinError(i + 1, EffE); + } + + gStyle->SetOptStat(kFALSE); + gStyle->SetHistFillColor(92); + gStyle->SetFrameFillColor(4000); + gStyle->SetTitleW(0.7); + gStyle->SetTitleH(0.07); + gPad->SetFillColor(4000); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + c->SetFillStyle(4000); + hn1->UseCurrentStyle(); + + hn1->SetTitle(histotitle.c_str()); + hn1->GetXaxis()->SetLabelSize(0.04); + hn1->GetYaxis()->SetLabelSize(0.04); + hn1->GetXaxis()->SetTitleOffset(0.7); + hn1->GetXaxis()->SetTitleSize(0.06); + hn1->GetXaxis()->SetNdivisions(208, kTRUE); + hn1->GetYaxis()->SetRangeUser(0.5, 1.1); + hn1->SetMarkerStyle(6); + hn1->SetMarkerColor(kBlue); + hn2->SetMarkerStyle(6); + hn2->SetMarkerColor(kRed); + hn1->GetXaxis()->SetBinLabel(1, "ME +1/1b"); + hn1->GetXaxis()->SetBinLabel(2, "ME +1/2"); + hn1->GetXaxis()->SetBinLabel(3, "ME +1/3"); + hn1->GetXaxis()->SetBinLabel(4, "ME +1/1a"); + hn1->GetXaxis()->SetBinLabel(5, "ME +2/1"); + hn1->GetXaxis()->SetBinLabel(6, "ME +2/2"); + hn1->GetXaxis()->SetBinLabel(7, "ME +3/1"); + hn1->GetXaxis()->SetBinLabel(8, "ME +3/2"); + hn1->GetXaxis()->SetBinLabel(9, "ME +4/1"); + hn1->GetXaxis()->SetBinLabel(10, "ME +4/2"); + hn1->GetXaxis()->SetBinLabel(11, "ME -1/1b"); + hn1->GetXaxis()->SetBinLabel(12, "ME -1/2"); + hn1->GetXaxis()->SetBinLabel(13, "ME -1/3"); + hn1->GetXaxis()->SetBinLabel(14, "ME -1/1a"); + hn1->GetXaxis()->SetBinLabel(15, "ME -2/1"); + hn1->GetXaxis()->SetBinLabel(16, "ME -2/2"); + hn1->GetXaxis()->SetBinLabel(17, "ME -3/1"); + hn1->GetXaxis()->SetBinLabel(18, "ME -3/2"); + hn1->GetXaxis()->SetBinLabel(19, "ME -4/1"); + hn1->GetXaxis()->SetBinLabel(20, "ME -4/2"); + + TLegend *leg = new TLegend(0.79, 0.79, 0.89, 0.89); + leg->AddEntry(hn1, "new", "p"); + leg->AddEntry(hn2, "ref", "p"); + + hn1->Draw(); + hn2->Draw("same"); + leg->Draw(); + c->Update(); + c->Print(savename.c_str(), "png"); + } + delete c; + delete hn1; + delete hn2; +} + +void GlobalPosfromTreeCompare( + std::string graphname, TFile *f1, TFile *f2, int endcap, int station, std::string type, std::string savename) { + struct posRecord { + int endcap; + int station; + int ring; + int chamber; + int layer; + float localx; + float localy; + float globalx; + float globaly; + } points1, points2; + + TTree *t1; + TTree *t2; + TBranch *b1; + TBranch *b2; + + if (type == "rechit") { + t1 = (TTree *)f1->Get("recHits/rHPositions"); + t2 = (TTree *)f2->Get("recHits/rHPositions"); + b1 = t1->GetBranch("rHpos"); + b2 = t2->GetBranch("rHpos"); + b1->SetAddress(&points1); + b2->SetAddress(&points2); + } + + if (type == "segment") { + t1 = (TTree *)f1->Get("Segments/segPositions"); + t2 = (TTree *)f2->Get("Segments/segPositions"); + b1 = t1->GetBranch("segpos"); + b2 = t2->GetBranch("segpos"); + b1->SetAddress(&points1); + b2->SetAddress(&points2); + } + + int n1 = (int)t1->GetEntries(); + int n2 = (int)t2->GetEntries(); + + const int nevents1 = n1; + const int nevents2 = n2; + + float globx1[nevents1]; + float globy1[nevents1]; + float globx2[nevents2]; + float globy2[nevents2]; + int nstation1 = 0; + int nstation2 = 0; + + for (int i = 0; i < nevents1; i++) { + b1->GetEntry(i); + if (points1.station == station && points1.endcap == endcap) { + globx1[nstation1] = points1.globalx; + globy1[nstation1] = points1.globaly; + nstation1++; + } + } + for (int i = 0; i < nevents2; i++) { + b2->GetEntry(i); + if (points2.station == station && points2.endcap == endcap) { + globx2[nstation2] = points2.globalx; + globy2[nstation2] = points2.globaly; + nstation2++; + } + } + + std::string name1 = graphname + " (New)"; + std::string name2 = graphname + " (Ref)"; + TCanvas *c = new TCanvas("c", "my canvas", 1); + c->SetCanvasSize(1300, 700); + c->Divide(2, 1); + TGraph *graph1 = new TGraph(nstation1, globx1, globy1); + TGraph *graph2 = new TGraph(nstation2, globx2, globy2); + + gStyle->SetTitleW(0.6); + gStyle->SetTitleH(0.1); + gStyle->SetStatColor(0); + gStyle->SetTitleFillColor(0); + gStyle->SetOptStat(10); + + c->cd(1); + graph1->SetTitle(name1.c_str()); + graph1->UseCurrentStyle(); + drawChamberLines(station); + graph1->Draw("AP"); + c->cd(2); + graph2->SetTitle(name2.c_str()); + graph2->UseCurrentStyle(); + drawChamberLines(station); + graph2->Draw("AP"); + + //c->Update(); + c->Print(savename.c_str(), "png"); + delete c; +} + +void NikolaiPlots(TFile *f_in, int flag) { + gROOT->SetStyle("Plain"); // to get rid of gray color of pad and have it white + gStyle->SetPalette(1, 0); // + + std::ostringstream ss, ss1; + + if (flag == 1) { // gas gain results + std::string folder = "GasGain/"; + + std::string input_histName = "gas_gain_rechit_adc_3_3_sum_location_ME_"; + std::string input_title_X = "Location=(layer-1)*nsegm+segm"; + std::string input_title_Y = "3X3 ADC Sum"; + + std::string slice_title_X = "3X3 ADC Sum Location"; + + Int_t ny = 30; + Float_t ylow = 1.0, yhigh = 31.0; + std::string result_histName = "mean_gas_gain_vs_location_csc_ME_"; + std::string result_histTitle = "Mean 3X3 ADC Sum"; + std::string result_title_Y = "Location=(layer-1)*nsegm+segm"; + + std::string result_histNameEntries = "entries_gas_gain_vs_location_csc_ME_"; + std::string result_histTitleEntries = "Entries 3X3 ADC Sum"; + } + + if (flag == 2) { // AFEB timing results + std::string folder = "AFEBTiming/"; + + std::string input_histName = "afeb_time_bin_vs_afeb_occupancy_ME_"; + std::string input_title_X = "AFEB"; + std::string input_title_Y = "Time Bin"; + + std::string slice_title_X = "AFEB"; + + Int_t ny = 42; + Float_t ylow = 1.0, yhigh = 42.0; + std::string result_histName = "mean_afeb_time_bin_vs_afeb_csc_ME_"; + std::string result_histTitle = "AFEB Mean Time Bin"; + std::string result_title_Y = "AFEB"; + + std::string result_histNameEntries = "entries_afeb_time_bin_vs_afeb_csc_ME_"; + std::string result_histTitleEntries = "Entries AFEB Time Bin"; + } + + if (flag == 3) { // Comparator timing results + std::string folder = "CompTiming/"; + + std::string input_histName = "comp_time_bin_vs_cfeb_occupancy_ME_"; + std::string input_title_X = "CFEB"; + std::string input_title_Y = "Time Bin"; + + std::string slice_title_X = "CFEB"; + + Int_t ny = 5; + Float_t ylow = 1.0, yhigh = 6.0; + std::string result_histName = "mean_comp_time_bin_vs_cfeb_csc_ME_"; + std::string result_histTitle = "Comparator Mean Time Bin"; + std::string result_title_Y = "CFEB"; + + std::string result_histNameEntries = "entries_comp_time_bin_vs_cfeb_csc_ME_"; + std::string result_histTitleEntries = "Entries Comparator Time Bin"; + } + + if (flag == 4) { // Strip ADC timing results + std::string folder = "ADCTiming/"; + + std::string input_histName = "adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_"; + std::string input_title_X = "CFEB"; + std::string input_title_Y = "Time Bin"; + + std::string slice_title_X = "CFEB"; + + Int_t ny = 5; + Float_t ylow = 1.0, yhigh = 6.0; + std::string result_histName = "mean_adc_time_bin_vs_cfeb_csc_ME_"; + std::string result_histTitle = "ADC 3X3 Mean Time Bin"; + std::string result_title_Y = "CFEB"; + + std::string result_histNameEntries = "entries_adc_time_bin_vs_cfeb_csc_ME_"; + std::string result_histTitleEntries = "Entries ADC 3X3 Time Bin"; + } + + std::vector xTitle; + xTitle.push_back("ME+1/1 CSC"); + xTitle.push_back("ME+1/2 CSC"); + xTitle.push_back("ME+1/3 CSC"); + xTitle.push_back("ME+2/1 CSC"); + xTitle.push_back("ME+2/2 CSC"); + xTitle.push_back("ME+3/1 CSC"); + xTitle.push_back("ME+3/2 CSC"); + xTitle.push_back("ME+4/1 CSC"); + xTitle.push_back("ME+4/2 CSC"); + xTitle.push_back("ME-1/1 CSC"); + xTitle.push_back("ME-1/2 CSC"); + xTitle.push_back("ME-1/3 CSC"); + xTitle.push_back("ME-2/1 CSC"); + xTitle.push_back("ME-2/2 CSC"); + xTitle.push_back("ME-3/1 CSC"); + xTitle.push_back("ME-3/2 CSC"); + xTitle.push_back("ME-4/1 CSC"); + xTitle.push_back("ME-4/2 CSC"); + + TH2F *h2[500]; + TH2F *h; + Int_t esr[18] = {111, 112, 113, 121, 122, 131, 132, 141, 142, 211, 212, 213, 221, 222, 231, 232, 241, 242}; + Int_t entries[18] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + Int_t k = 0; + TCanvas *c1 = new TCanvas("c1", "canvas"); + c1->cd(); + + //if(flag==2) { // adding special case for AFEB timing + ss.str(""); + ss << "mean_afeb_time_bin_vs_csc_ME"; + ss1.str(""); + ss1 << "Mean AFEB time bin vs CSC and ME"; + gStyle->SetOptStat(0); + TH2F *hb = new TH2F(ss.str().c_str(), ss1.str().c_str(), 36, 1.0, 37.0, 18, 1.0, 19.0); + hb->SetStats(kFALSE); + hb->GetXaxis()->SetTitle("CSC #"); + hb->GetZaxis()->SetLabelSize(0.03); + hb->SetOption("COLZ"); + + hb->GetYaxis()->SetBinLabel(1, "ME- 4/2"); + hb->GetYaxis()->SetBinLabel(2, "ME- 4/1"); + hb->GetYaxis()->SetBinLabel(3, "ME- 3/2"); + hb->GetYaxis()->SetBinLabel(4, "ME- 3/1"); + hb->GetYaxis()->SetBinLabel(5, "ME- 2/2"); + hb->GetYaxis()->SetBinLabel(6, "ME- 2/1"); + hb->GetYaxis()->SetBinLabel(7, "ME- 1/3"); + hb->GetYaxis()->SetBinLabel(8, "ME- 1/2"); + hb->GetYaxis()->SetBinLabel(9, "ME- 1/1"); + hb->GetYaxis()->SetBinLabel(10, "ME+ 1/1"); + hb->GetYaxis()->SetBinLabel(11, "ME+ 1/2"); + hb->GetYaxis()->SetBinLabel(12, "ME+ 1/3"); + hb->GetYaxis()->SetBinLabel(13, "ME+ 2/1"); + hb->GetYaxis()->SetBinLabel(14, "ME+ 2/2"); + hb->GetYaxis()->SetBinLabel(15, "ME+ 3/1"); + hb->GetYaxis()->SetBinLabel(16, "ME+ 3/2"); + hb->GetYaxis()->SetBinLabel(17, "ME+ 4/1"); + hb->GetYaxis()->SetBinLabel(18, "ME+ 4/2"); + //} + + for (Int_t jesr = 0; jesr < 18; jesr++) { + ss.str(""); + ss << result_histName.c_str() << esr[jesr]; + ss1.str(""); + ss1 << result_histTitle; + TH2F *h = new TH2F(ss.str().c_str(), ss1.str().c_str(), 40, 0.0, 40.0, ny, ylow, yhigh); + h->SetStats(kFALSE); + h->GetXaxis()->SetTitle(xTitle[jesr].c_str()); + h->GetYaxis()->SetTitle(result_title_Y.c_str()); + h->GetZaxis()->SetLabelSize(0.03); + h->SetOption("COLZ"); + + ss.str(""); + ss << result_histNameEntries.c_str() << esr[jesr]; + ss1.str(""); + ss1 << result_histTitleEntries; + TH2F *hentr = new TH2F(ss.str().c_str(), ss1.str().c_str(), 40, 0.0, 40.0, ny, ylow, yhigh); + hentr->SetStats(kFALSE); + hentr->GetXaxis()->SetTitle(xTitle[jesr].c_str()); + hentr->GetYaxis()->SetTitle(result_title_Y.c_str()); + hentr->GetZaxis()->SetLabelSize(0.03); + hentr->SetOption("COLZ"); + + if (flag == 2) { // adding special cases for AFEB timing + ss.str(""); + ss << "normal_afeb_time_bin_vs_csc_ME_" << esr[jesr]; + ss1.str(""); + ss1 << "Normalized AFEB time bin, %"; + TH2F *ha = new TH2F(ss.str().c_str(), ss1.str().c_str(), 40, 0.0, 40.0, 16, 0.0, 16.0); + ha->SetStats(kFALSE); + ha->GetXaxis()->SetTitle(xTitle[jesr].c_str()); + ha->GetYaxis()->SetTitle("Time Bin"); + ha->GetZaxis()->SetLabelSize(0.03); + ha->SetOption("COLZ"); + } + + for (Int_t csc = 1; csc < 37; csc++) { + Int_t idchamber = esr[jesr] * 100 + csc; + ss.str(""); + ss << folder.c_str() << input_histName.c_str() << idchamber; + f_in->cd(); + TH2F *h2[1]; + h2[k] = (TH2F *)f_in->Get(ss.str().c_str()); + if (h2[k] != NULL) { + // saving original, adding X,Y titles, color and "BOX" option + h2[k]->GetXaxis()->SetTitle(input_title_X.c_str()); + h2[k]->GetYaxis()->SetTitle(input_title_Y.c_str()); + h2[k]->GetYaxis()->SetTitleOffset(1.2); + h2[k]->SetFillColor(4); + h2[k]->SetOption("BOX"); + gStyle->SetOptStat(1001111); + + // saving Y projection of the whole 2D hist for given chamber + ss.str(""); + ss << input_histName.c_str() << idchamber << "_Y_all"; + TH1D *h1d = h2[k]->ProjectionY(ss.str().c_str(), 1, h2[k]->GetNbinsX(), ""); + h1d->GetYaxis()->SetTitle("Entries"); + h1d->GetYaxis()->SetTitleOffset(1.2); + gStyle->SetOptStat(1001111); + + if (flag == 2 && h1d->GetEntries() > 0) { // adding spec. case for afeb timing + Float_t entr = h1d->GetEntries(); + for (Int_t m = 1; m < h1d->GetNbinsX(); m++) { + Float_t w = h1d->GetBinContent(m); + w = 100.0 * w / entr; + ha->SetBinContent(csc + 1, m, w); + } + Float_t mean = h1d->GetMean(); + Int_t me; + if (jesr < 9) + me = 10 + jesr; + if (jesr > 8) + me = 18 - jesr; + hb->SetBinContent(csc, me, mean); + } + delete h1d; + + // saving slices, finding MEAN in each slice, fill 2D hist + for (Int_t j = 1; j <= h2[k]->GetNbinsX(); j++) { + Int_t n = j; + ss.str(""); + ss << input_histName.c_str() << idchamber << "_Y_" << n; + TH1D *h1d = h2[k]->ProjectionY(ss.str().c_str(), j, j, ""); + if (h1d->GetEntries() > 0) { + Float_t mean = h1d->GetMean(); + Float_t entr = h1d->GetEntries(); + entries[jesr] = entries[jesr] + 1; + h->SetBinContent(csc + 1, j, mean); + hentr->SetBinContent(csc + 1, j, entr); + ss.str(""); + ss << slice_title_X << " " << n; + h1d->GetXaxis()->SetTitle(ss.str().c_str()); + h1d->GetYaxis()->SetTitle("Entries"); + h1d->GetYaxis()->SetTitleOffset(1.2); + gStyle->SetOptStat(1001111); + } + delete h1d; + } + } + } + if (entries[jesr] > 0) { + h->SetStats(kFALSE); + hentr->SetStats(kFALSE); + c1->Update(); + + // printing + + h->Draw(); + ss.str(""); + ss << result_histName.c_str() << esr[jesr] << ".png"; + c1->Print(ss.str().c_str(), "png"); + + hentr->Draw(); + ss.str(""); + ss << result_histNameEntries.c_str() << esr[jesr] << ".png"; + c1->Print(ss.str().c_str(), "png"); + } + delete h; + delete hentr; + if (flag == 2) + delete ha; + } + if (flag == 2) { + hb->Draw(); + ss.str(""); + ss << "mean_afeb_time_bin_vs_csc_ME" + << ".png"; + c1->Print(ss.str().c_str(), "png"); + + c1->Update(); + //delete hb; + } + delete hb; + delete c1; +} + +drawColoredChamberLines(int station, int nchamber1[4][36]) { + // thanks to Luca Sabbatini for this coe + const int maxRingIdxOfRelevance = 2; + const int maxChamberIdxOfRelevance = 35; + const int totalNumberOfChambersOfRelevance = 540; + + Int_t thisRingIdx = 0; + Int_t numChambersInRing = 0; + + float nchamber1Avg = 0.; + float thisRingNchamber1Avg = 0; + float thisRingNchamber1Max = 0; + // Note that thisRingNchamber1Min is only the minumum *non-zero* + // occupancy among all the cmabers for the given ring + float thisRingNchamber1Min = 0; + Int_t thisRingNchamber1Base = 0; + + // rFloatRGB, gFloatRGB, bFloatRGB, are from the RGB color space; + // all three range between [0,1] + // hFloatHLS, lFloatHLS, sFloatHLS, are from the HLS color space; + // lFloatHLS and sFloatHLS range between [0,1], while hFloatHLS + // ranges between [0,360] + Float_t rFloatRGB = 0.; + Float_t gFloatRGB = 0.; + Float_t bFloatRGB = 0.; + Float_t hFloatHLS = 0.; + Float_t lFloatHLS = 0.5; + Float_t sFloatHLS = 1.0; + TColor tempColor; + + // compute average chamber occupancy over all CSCs + for (int i = 0; i < maxRingIdxOfRelevance + 1; i++) { + for (int j = 0; j < maxChamberIdxOfRelevance + 1; j++) { + nchamber1Avg += nchamber1[i][j]; + } + } + nchamber1Avg = nchamber1Avg / totalNumberOfChambersOfRelevance; + + Float_t myFavoriteLineWidth = 2.0; + gStyle->SetLineWidth(myFavoriteLineWidth); + float pi = 3.14159; + TVector3 x(0, 0, 1); + int linecolor = 1; + + // emptyLineColor is the color of the outline of empty chambers. + // if emptyLineColor is negative, no outline is drawn at all for + // that chamber. + Int_t emptyLineColor = kYellow; + + // note that these can be greater than 360 because I have included + // a line down below that performs a modulus operation: %360, which + // ensures that the resulting hue will indeed be with [0,360] + // + // Hue: 0 30 60 120 180 240 270 300 360 + // | | | | | | | | | + // Color: Red Orange Yellow Green Cyan Blue Vilet Magenta Red + Float_t lineHueMin = 240; + Float_t lineHueMax = 360; + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + if (station == 1) { + // station 1, ring 1 (inner-most ring) + thisRingIdx = 0; + numChambersInRing = 36; + TVector3 p1(101, 9.361, 0); + TVector3 p2(101, -9.361, 0); + TVector3 p3(260, -22.353, 0); + TVector3 p4(260, 22.353, 0); + + // compute thisRingNchamber1Min, thisRingNchamber1Max, + // thisRingNchamber1Avg and thisRingNchamber1Base + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + // set the line color + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + // draw the chamber outline using the line color (so long + // as the the chamber isn't empty *and* the user did not + // set a negative line color for empty chambers) + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + + // Rotate coordinate by 1 chamber + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 1, ring 2 (middle-ring) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(281.49, 25.5, 0); + TVector3 q2(281.49, -25.5, 0); + TVector3 q3(455.99, -41.87, 0); + TVector3 q4(455.99, 41.87, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 1, ring 3 (outer-most ring) + thisRingIdx = 2; + numChambersInRing = 36; + TVector3 r1(511.99, 31.7, 0); + TVector3 r2(511.99, -31.7, 0); + TVector3 r3(676.15, -46.05, 0); + TVector3 r4(676.15, 46.05.6, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(r1(0), r1(1), r2(0), r2(1)); + line2 = new TLine(r2(0), r2(1), r3(0), r3(1)); + line3 = new TLine(r3(0), r3(1), r4(0), r4(1)); + line4 = new TLine(r4(0), r4(1), r1(0), r1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + r1.Rotate(2 * pi / numChambersInRing, x); + r2.Rotate(2 * pi / numChambersInRing, x); + r3.Rotate(2 * pi / numChambersInRing, x); + r4.Rotate(2 * pi / numChambersInRing, x); + } + } + + if (station == 2) { + // station 2, ring 1 (inner ring) + thisRingIdx = 0; + numChambersInRing = 18; + TVector3 p1(146.9, 27.0, 0); + TVector3 p2(146.9, -27.0, 0); + TVector3 p3(336.56, -62.855, 0); + TVector3 p4(336.56, 62.855, 0); + + // must "pre-rotate" by one-fourth of a chamber + p1.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p2.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p3.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p4.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 2, ring 2 (outer ring) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + } + + if (station == 3) { + // station 3, ring 1 (inner ring) + thisRingIdx = 0; + numChambersInRing = 18; + TVector3 p1(166.89, 30.7, 0); + TVector3 p2(166.89, -30.7, 0); + TVector3 p3(336.59, -62.855, 0); + TVector3 p4(336.59, 62.855, 0); + + // must "pre-rotate" by one-fourth of a chamber + p1.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p2.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p3.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p4.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + + // station 3, ring 2 (outer ring) + thisRingIdx = 1; + numChambersInRing = 36; + TVector3 q1(364.02, 33.23, 0); + TVector3 q2(364.02, -33.23, 0); + TVector3 q3(687.08, -63.575, 0); + TVector3 q4(687.08, 63.575, 0); + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[thisRingIdx][i] - thisRingNchamber1Base) / + (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(q1(0), q1(1), q2(0), q2(1)); + line2 = new TLine(q2(0), q2(1), q3(0), q3(1)); + line3 = new TLine(q3(0), q3(1), q4(0), q4(1)); + line4 = new TLine(q4(0), q4(1), q1(0), q1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + q1.Rotate(2 * pi / numChambersInRing, x); + q2.Rotate(2 * pi / numChambersInRing, x); + q3.Rotate(2 * pi / numChambersInRing, x); + q4.Rotate(2 * pi / numChambersInRing, x); + } + } + + if (station == 4) { + // station 4, ring 1 (the only ring on station 4... so far) + thisRingIdx = 0; + numChambersInRing = 18; + TVector3 p1(186.99, 34.505.15, 0); + TVector3 p2(186.99, -34.505, 0); + TVector3 p3(336.41, -62.825, 0); + TVector3 p4(336.41, 62.825, 0); + + // must "pre-rotate" by one-fourth of a chamber + p1.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p2.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p3.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + p4.Rotate((1 / 4.) * 2 * pi / numChambersInRing, x); + + TLine *line1; + TLine *line2; + TLine *line3; + TLine *line4; + + thisRingNchamber1Avg = 0.; + thisRingNchamber1Max = 0.; + for (int j = 0; j < numChambersInRing; j++) { + thisRingNchamber1Avg += nchamber1[thisRingIdx][j]; + if (thisRingNchamber1Max < nchamber1[thisRingIdx][j]) { + thisRingNchamber1Max = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Min = thisRingNchamber1Max; + for (int j = 0; j < numChambersInRing; j++) { + if (thisRingNchamber1Min > nchamber1[thisRingIdx][j] && // + nchamber1[thisRingIdx][j] != 0) { + thisRingNchamber1Min = nchamber1[thisRingIdx][j]; + } + } + thisRingNchamber1Avg = thisRingNchamber1Avg / numChambersInRing; + thisRingNchamber1Base = thisRingNchamber1Min; + + for (int i = 0; i < numChambersInRing; i++) { + if (nchamber1[thisRingIdx][i] != 0) { + hFloatHLS = int((nchamber1[0][i] - thisRingNchamber1Base) / (thisRingNchamber1Max - thisRingNchamber1Base) * // + (lineHueMax - lineHueMin) + + lineHueMin) % + 360; + tempColor.HLS2RGB(hFloatHLS, lFloatHLS, sFloatHLS, rFloatRGB, gFloatRGB, bFloatRGB); + linecolor = tempColor.GetColor(rFloatRGB, gFloatRGB, bFloatRGB); + } else if (emptyLineColor >= 0) { + linecolor = emptyLineColor; + } + + if ((nchamber1[thisRingIdx][i] != 0) || // + (nchamber1[thisRingIdx][i] == 0 && emptyLineColor >= 0)) { + line1 = new TLine(p1(0), p1(1), p2(0), p2(1)); + line2 = new TLine(p2(0), p2(1), p3(0), p3(1)); + line3 = new TLine(p3(0), p3(1), p4(0), p4(1)); + line4 = new TLine(p4(0), p4(1), p1(0), p1(1)); + line1->SetLineColor(linecolor); + line2->SetLineColor(linecolor); + line3->SetLineColor(linecolor); + line4->SetLineColor(linecolor); + + line1->Draw(); + line2->Draw(); + line3->Draw(); + line4->Draw(); + } + p1.Rotate(2 * pi / numChambersInRing, x); + p2.Rotate(2 * pi / numChambersInRing, x); + p3.Rotate(2 * pi / numChambersInRing, x); + p4.Rotate(2 * pi / numChambersInRing, x); + } + } +} diff --git a/RecoLocalMuon/CSCValidation/src/CSCValHists.h b/RecoLocalMuon/CSCValidation/src/CSCValHists.h index a3142526beadc..03892238f573d 100644 --- a/RecoLocalMuon/CSCValidation/src/CSCValHists.h +++ b/RecoLocalMuon/CSCValidation/src/CSCValHists.h @@ -5,7 +5,11 @@ * * Manages Histograms for CSCValidation * - * Andy Kubik - Northwestern University + * original author: + * Andy Kubik (Northwestern University) + * + * contact + * CSC DPG * */ diff --git a/RecoLocalMuon/CSCValidation/src/CSCValidation.cc b/RecoLocalMuon/CSCValidation/src/CSCValidation.cc index d88f1ba613067..0f880285f536d 100644 --- a/RecoLocalMuon/CSCValidation/src/CSCValidation.cc +++ b/RecoLocalMuon/CSCValidation/src/CSCValidation.cc @@ -1,10 +1,16 @@ /* * validation package for CSC DIGIs, RECHITs and SEGMENTs + more. * - * Michael Schmitt - * Andy Kubik - * Northwestern University + * original authors: + * Michael Schmitt (Northwestern University) + * Andy Kubik (Northwestern University) + * + * CONTACT: CSC DPG (Jul-2022) + * */ + +// UPDATED AND RUNNING IN 12_x 15.07.2022 TIM COX - includes updates from external version + #include "RecoLocalMuon/CSCValidation/src/CSCValidation.h" using namespace std; @@ -50,6 +56,13 @@ CSCValidation::CSCValidation(const ParameterSet& pset) { l1_token = consumes(pset.getParameter("l1aTag")); tr_token = consumes(pset.getParameter("hltTag")); sh_token = consumes(pset.getParameter("simHitTag")); + // conditions + pedestalsToken_ = esConsumes(); + gainsToken_ = esConsumes(); + noiseToken_ = esConsumes(); + crosstalkToken_ = esConsumes(); + + crateToken_ = esConsumes(); // flags to switch on/off individual modules makeOccupancyPlots = pset.getUntrackedParameter("makeOccupancyPlots", true); @@ -98,7 +111,7 @@ CSCValidation::CSCValidation(const ParameterSet& pset) { hRHEff = new TH1F("hRHEff", "recHit Efficiency", 20, 0.5, 20.5); const int nChambers = 36; - const int nTypes = 18; + const int nTypes = 20; float nCH_min = 0.5; float nCh_max = float(nChambers) + 0.5; float nT_min = 0.5; @@ -119,6 +132,17 @@ CSCValidation::CSCValidation(const ParameterSet& pset) { hSensitiveAreaEvt = new TH2F("hSensitiveAreaEvt", "events in sensitive area", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max); + hSSTETight = new TH1F("hSSTETight", "hSSTE Tight", 40, 0, 40); + hRHSTETight = new TH1F("hRHSTETight", "hRHSTE Tight", 40, 0, 40); + + hSSTE2Tight = new TH2F("hSSTE2Tight", "hSSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max); + hRHSTE2Tight = new TH2F("hRHSTE2Tight", "hRHSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max); + hStripSTE2Tight = + new TH2F("hStripSTE2Tight", "hStripSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max); + hWireSTE2Tight = new TH2F("hWireSTE2Tight", "hWireSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max); + hEffDenominatorTight = + new TH2F("hEffDenominatorTight", "hEffDenominator Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max); + // setup trees to hold global position data for rechits and segments if (writeTreeToFile) histos->setupTrees(); @@ -138,6 +162,14 @@ CSCValidation::~CSCValidation() { hStripEff2->Divide(hStripSTE2, hEffDenominator, 1., 1., "B"); hWireEff2->Divide(hWireSTE2, hEffDenominator, 1., 1., "B"); + histos->insertPlot(hRHSTETight, "hRHSTETight", "Efficiency"); + histos->insertPlot(hSSTETight, "hSSTETight", "Efficiency"); + histos->insertPlot(hStripSTE2Tight, "hStripSTE2Tight", "Efficiency"); + histos->insertPlot(hWireSTE2Tight, "hWireSTE2Tight", "Efficiency"); + histos->insertPlot(hRHSTE2Tight, "hRHSTE2Tight", "Efficiency"); + histos->insertPlot(hSSTE2Tight, "hSSTE2Tight", "Efficiency"); + histos->insertPlot(hEffDenominatorTight, "hEffDenominatorTight", "Efficiency"); + histos->insertPlot(hRHSTE, "hRHSTE", "Efficiency"); histos->insertPlot(hSSTE, "hSSTE", "Efficiency"); histos->insertPlot(hSSTE2, "hSSTE2", "Efficiency"); @@ -173,7 +205,7 @@ CSCValidation::~CSCValidation() { //////////////// // Analysis // //////////////// -void CSCValidation::analyze(const Event& event, const EventSetup& eventSetup) { +void CSCValidation::analyze(edm::Event const& event, edm::EventSetup const& eventSetup) { // increment counter nEventsAnalyzed++; @@ -696,20 +728,16 @@ void CSCValidation::doCalibrations(const edm::EventSetup& eventSetup) { LogDebug("Calibrations") << "Loading Calibrations..."; // get the gains - edm::ESHandle hGains; - eventSetup.get().get(hGains); + edm::ESHandle hGains = eventSetup.getHandle(gainsToken_); const CSCDBGains* pGains = hGains.product(); // get the crosstalks - edm::ESHandle hCrosstalk; - eventSetup.get().get(hCrosstalk); + edm::ESHandle hCrosstalk = eventSetup.getHandle(crosstalkToken_); const CSCDBCrosstalk* pCrosstalk = hCrosstalk.product(); // get the noise matrix - edm::ESHandle hNoiseMatrix; - eventSetup.get().get(hNoiseMatrix); + edm::ESHandle hNoiseMatrix = eventSetup.getHandle(noiseToken_); const CSCDBNoiseMatrix* pNoiseMatrix = hNoiseMatrix.product(); // get pedestals - edm::ESHandle hPedestals; - eventSetup.get().get(hPedestals); + edm::ESHandle hPedestals = eventSetup.getHandle(pedestalsToken_); const CSCDBPedestals* pPedestals = hPedestals.product(); LogDebug("Calibrations") << "Calibrations Loaded!"; @@ -799,7 +827,7 @@ void CSCValidation::doWireDigis(edm::Handle wires) { if (nWireGroupsTotal == 0) nWireGroupsTotal = -1; - histos->fill1DHist(nWireGroupsTotal, "hWirenGroupsTotal", "Wires Fired Per Event", 151, -0.5, 150.5, "Digis"); + histos->fill1DHist(nWireGroupsTotal, "hWirenGroupsTotal", "Wires Fired Per Event", 251, -0.5, 250.5, "Digis"); } // ============================================== @@ -841,7 +869,7 @@ void CSCValidation::doStripDigis(edm::Handle strips) { if (nStripsFired == 0) nStripsFired = -1; - histos->fill1DHist(nStripsFired, "hStripNFired", "Fired Strips per Event", 251, -0.5, 250.5, "Digis"); + histos->fill1DHist(nStripsFired, "hStripNFired", "Fired Strips per Event", 351, -0.5, 350.5, "Digis"); } //======================================================= @@ -1017,7 +1045,7 @@ void CSCValidation::doRecHits(edm::Handle recHits, edm::E if (nRecHits == 0) nRecHits = -1; - histos->fill1DHist(nRecHits, "hRHnrechits", "recHits per Event (all chambers)", 151, -0.5, 150.5, "recHits"); + histos->fill1DHist(nRecHits, "hRHnrechits", "recHits per Event (all chambers)", 201, -0.5, 200.5, "recHits"); } // ============================================== @@ -1380,7 +1408,7 @@ int CSCValidation::chamberSerial(CSCDetId id) { if (st == 4 && ri == 1) kSerial = ch + 216; if (st == 4 && ri == 2) - kSerial = ch + 234; // one day... + kSerial = ch + 234; if (ec == 2) kSerial = kSerial + 300; return kSerial; @@ -1599,21 +1627,32 @@ void CSCValidation::doEfficiencies(edm::Handle wires, if (NumberOfLayers > 1) { //if(!(MultiSegments[iE][iS][iR][iC])){ if (AllSegments[iE][iS][iR][iC]) { - //---- Efficient segment evenents - hSSTE->AddBinContent(bin); + //---- Efficient segment events + //hSSTE->AddBinContent(bin); + hSSTE->Fill(bin - 0.5); + if (NumberOfLayers > 3) + hSSTETight->Fill(bin - 0.5); } //---- All segment events (normalization) - hSSTE->AddBinContent(20 + bin); - //} + //hSSTE->AddBinContent(20+bin); + hSSTE->Fill(20 + bin - 0.5); + if (NumberOfLayers > 3) + hSSTETight->Fill(20 + bin - 0.5); + //} //} } if (AllSegments[iE][iS][iR][iC]) { if (NumberOfLayers == 6) { //---- Efficient rechit events - hRHSTE->AddBinContent(bin); + //hRHSTE->AddBinContent(bin); + hRHSTE->Fill(bin - 0.5); + hRHSTETight->Fill(bin - 0.5); ; } //---- All rechit events (normalization) - hRHSTE->AddBinContent(20 + bin); + //hRHSTE->AddBinContent(20+bin); + hRHSTE->Fill(20 + bin - 0.5); + if (NumberOfLayers > 3) + hRHSTETight->Fill(20 + bin - 0.5); ; } } @@ -1633,8 +1672,8 @@ void CSCValidation::doEfficiencies(edm::Handle wires, theSeg.push_back(&theSegments[3]); // Needed for plots - // at the end the chamber types will be numbered as 1 to 18 - // (ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1 ) + // at the end the chamber types will be numbered as 1 to 20 + // (ME-4/2, ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1, ME+4/2 ) std::map chamberTypes; chamberTypes["ME1/a"] = 0.5; chamberTypes["ME1/b"] = 1.5; @@ -1645,6 +1684,7 @@ void CSCValidation::doEfficiencies(edm::Handle wires, chamberTypes["ME3/1"] = 6.5; chamberTypes["ME3/2"] = 7.5; chamberTypes["ME4/1"] = 8.5; + chamberTypes["ME4/2"] = 9.5; if (!theSeg.empty()) { std::map extrapolatedPoint; @@ -1716,7 +1756,7 @@ void CSCValidation::doEfficiencies(edm::Handle wires, if (cscchamberCenter.z() < 0) { verticalScale = -verticalScale; } - verticalScale += 9.5; + verticalScale += 10.5; hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()), verticalScale); if (nRHLayers > 1) { // this chamber contains a reliable signal //chamberTypes[cscchamber->specs()->chamberTypeName()]; @@ -1724,10 +1764,14 @@ void CSCValidation::doEfficiencies(edm::Handle wires, //std::cout<<" verticalScale = "< { + public: + /// Constructor + CSCValidation(const edm::ParameterSet &pset); + + /// Destructor + ~CSCValidation() override; + + /// Perform the analysis + void analyze(edm::Event const &event, edm::EventSetup const &eventSetup) override; + void beginJob() override; + void endJob() override; + + // for noise module + struct ltrh { + bool operator()(const CSCRecHit2D &rh1, const CSCRecHit2D &rh2) const { + return ((rh1.localPosition()).x() - (rh2.localPosition()).x()) < 0; + } + }; + + protected: + private: + // these are the "modules" + // if you would like to add code to CSCValidation, please do so by adding an + // extra module in the form of an additional private member function + void doOccupancies(edm::Handle strips, + edm::Handle wires, + edm::Handle recHits, + edm::Handle cscSegments); + void doStripDigis(edm::Handle strips); + void doWireDigis(edm::Handle wires); + void doRecHits(edm::Handle recHits, edm::ESHandle cscGeom); + void doSimHits(edm::Handle recHits, edm::Handle simHits); + void doPedestalNoise(edm::Handle strips); + void doSegments(edm::Handle cscSegments, edm::ESHandle cscGeom); + void doResolution(edm::Handle cscSegments, edm::ESHandle cscGeom); + void doEfficiencies(edm::Handle wires, + edm::Handle strips, + edm::Handle recHits, + edm::Handle cscSegments, + edm::ESHandle cscGeom); + void doGasGain(const CSCWireDigiCollection &, const CSCStripDigiCollection &, const CSCRecHit2DCollection &); + void doCalibrations(const edm::EventSetup &eventSetup); + void doAFEBTiming(const CSCWireDigiCollection &); + void doCompTiming(const CSCComparatorDigiCollection &); + void doADCTiming(const CSCRecHit2DCollection &); + void doNoiseHits(edm::Handle recHits, + edm::Handle cscSegments, + edm::ESHandle cscGeom, + edm::Handle strips); + bool doTrigger(edm::Handle pCollection); + void doStandalone(edm::Handle saMuons); + void doTimeMonitoring(edm::Handle recHits, + edm::Handle cscSegments, + edm::Handle alcts, + edm::Handle clcts, + edm::Handle correlatedlcts, + edm::Handle pCollection, + edm::ESHandle cscGeom, + const edm::EventSetup &eventSetup, + const edm::Event &event); + bool doHLT(edm::Handle hltResults); + + // some useful functions + bool filterEvents(edm::Handle recHits, + edm::Handle cscSegments, + edm::Handle saMuons); + float fitX(const CLHEP::HepMatrix &sp, const CLHEP::HepMatrix &ep); + float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip); + float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip); + int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip); + void findNonAssociatedRecHits(edm::ESHandle cscGeom, edm::Handle strips); + int chamberSerial(CSCDetId id); + int ringSerial(CSCDetId id); + + // these functions handle Stoyan's efficiency code + void fillEfficiencyHistos(int bin, int flag); + void getEfficiency(float bin, float Norm, std::vector &eff); + void histoEfficiency(TH1F *readHisto, TH1F *writeHisto); + double lineParametrization(double z1Position, double z2Position, double z1Direction) { + double parameterLine = (z2Position - z1Position) / z1Direction; + return parameterLine; + } + double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine) { + double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine; + return extrapolatedPosition; + } + bool withinSensitiveRegion(LocalPoint localPos, + const std::array &layerBounds, + int station, + int ring, + float shiftFromEdge, + float shiftFromDeadZone); + + // counters + int nEventsAnalyzed; + int rhTreeCount; + int segTreeCount; + bool firstEvent; + bool cleanEvent; + + // + // + // The root file for the histograms. + TFile *theFile; + + // + // + // input parameters for this module + bool makePlots; + bool makeComparisonPlots; + std::string refRootFile; + bool writeTreeToFile; + bool isSimulation; + std::string rootFileName; + bool detailedAnalysis; + bool useDigis; + bool makeHLTPlots; + + // filters + bool useQualityFilter; + bool useTriggerFilter; + + // quality filter parameters + double pMin; + double chisqMax; + int nCSCHitsMin, nCSCHitsMax; + double lengthMin, lengthMax; + double deltaPhiMax; + double polarMin, polarMax; + + edm::EDGetTokenT rd_token; + edm::EDGetTokenT wd_token; + edm::EDGetTokenT sd_token; + edm::EDGetTokenT cd_token; + edm::EDGetTokenT al_token; + edm::EDGetTokenT cl_token; + edm::EDGetTokenT co_token; + edm::EDGetTokenT rh_token; + edm::EDGetTokenT se_token; + edm::EDGetTokenT l1_token; + edm::EDGetTokenT tr_token; + edm::EDGetTokenT sa_token; + edm::EDGetTokenT sh_token; + // geometry + edm::ESGetToken geomToken_; + edm::ESGetToken crateToken_; + // conditions data + edm::ESGetToken pedestalsToken_; + edm::ESGetToken gainsToken_; + edm::ESGetToken noiseToken_; + edm::ESGetToken crosstalkToken_; + + // module on/off switches + bool makeOccupancyPlots; + bool makeTriggerPlots; + bool makeStripPlots; + bool makeWirePlots; + bool makeRecHitPlots; + bool makeSimHitPlots; + bool makeSegmentPlots; + bool makeResolutionPlots; + bool makePedNoisePlots; + bool makeEfficiencyPlots; + bool makeGasGainPlots; + bool makeAFEBTimingPlots; + bool makeCompTimingPlots; + bool makeADCTimingPlots; + bool makeRHNoisePlots; + bool makeCalibPlots; + bool makeStandalonePlots; + bool makeTimeMonitorPlots; + + // The histo managing object + CSCValHists *histos; + + // tmp histos for Efficiency + TH1F *hSSTE; + TH1F *hRHSTE; + TH1F *hSEff; + TH1F *hRHEff; + TH2F *hSSTE2; + TH2F *hRHSTE2; + TH2F *hStripSTE2; + TH2F *hWireSTE2; + TH2F *hSEff2; + TH2F *hRHEff2; + TH2F *hStripEff2; + TH2F *hWireEff2; + TH2F *hEffDenominator; + TH2F *hSensitiveAreaEvt; + + TH1F *hSSTETight; + TH1F *hRHSTETight; + TH2F *hSSTE2Tight; + TH2F *hRHSTE2Tight; + TH2F *hStripSTE2Tight; + TH2F *hWireSTE2Tight; + TH2F *hEffDenominatorTight; + + // occupancy + TH2I *hOWires; + TH2I *hOStrips; + TH2I *hORecHits; + TH2I *hOSegments; + + /// Maps and vectors for module doGasGain() + std::vector nmbhvsegm; + std::map > m_wire_hvsegm; + std::map m_single_wire_layer; + + //maps to store the DetId and associated RecHits + std::multimap AllRechits; + std::multimap SegRechits; + std::multimap NonAssociatedRechits; + std::map distRHmap; + + int typeIndex(CSCDetId id) { + // linearlized index bases on endcap, station, and ring + int index = 0; + if (id.station() == 1) { + index = id.ring() + 1; + if (id.ring() == 4) + index = 1; + } else + index = id.station() * 2 + id.ring(); + if (id.endcap() == 1) + index = index + 10; + if (id.endcap() == 2) + index = 11 - index; + return index; } }; - -protected: -private: - // these are the "modules" - // if you would like to add code to CSCValidation, please do so by adding an - // extra module in the form of an additional private member function - void doOccupancies(edm::Handle strips, - edm::Handle wires, - edm::Handle recHits, - edm::Handle cscSegments); - void doStripDigis(edm::Handle strips); - void doWireDigis(edm::Handle wires); - void doRecHits(edm::Handle recHits, edm::ESHandle cscGeom); - void doSimHits(edm::Handle recHits, edm::Handle simHits); - void doPedestalNoise(edm::Handle strips); - void doSegments(edm::Handle cscSegments, edm::ESHandle cscGeom); - void doResolution(edm::Handle cscSegments, edm::ESHandle cscGeom); - void doEfficiencies(edm::Handle wires, - edm::Handle strips, - edm::Handle recHits, - edm::Handle cscSegments, - edm::ESHandle cscGeom); - void doGasGain(const CSCWireDigiCollection &, const CSCStripDigiCollection &, const CSCRecHit2DCollection &); - void doCalibrations(const edm::EventSetup &eventSetup); - void doAFEBTiming(const CSCWireDigiCollection &); - void doCompTiming(const CSCComparatorDigiCollection &); - void doADCTiming(const CSCRecHit2DCollection &); - void doNoiseHits(edm::Handle recHits, - edm::Handle cscSegments, - edm::ESHandle cscGeom, - edm::Handle strips); - bool doTrigger(edm::Handle pCollection); - void doStandalone(edm::Handle saMuons); - void doTimeMonitoring(edm::Handle recHits, - edm::Handle cscSegments, - edm::Handle alcts, - edm::Handle clcts, - edm::Handle correlatedlcts, - edm::Handle pCollection, - edm::ESHandle cscGeom, - const edm::EventSetup &eventSetup, - const edm::Event &event); - bool doHLT(edm::Handle hltResults); - - // some useful functions - bool filterEvents(edm::Handle recHits, - edm::Handle cscSegments, - edm::Handle saMuons); - float fitX(const CLHEP::HepMatrix &sp, const CLHEP::HepMatrix &ep); - float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip); - float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip); - int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip); - void findNonAssociatedRecHits(edm::ESHandle cscGeom, edm::Handle strips); - int chamberSerial(CSCDetId id); - int ringSerial(CSCDetId id); - - // these functions handle Stoyan's efficiency code - void fillEfficiencyHistos(int bin, int flag); - void getEfficiency(float bin, float Norm, std::vector &eff); - void histoEfficiency(TH1F *readHisto, TH1F *writeHisto); - double lineParametrization(double z1Position, double z2Position, double z1Direction) { - double parameterLine = (z2Position - z1Position) / z1Direction; - return parameterLine; - } - double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine) { - double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine; - return extrapolatedPosition; - } - bool withinSensitiveRegion(LocalPoint localPos, - const std::array &layerBounds, - int station, - int ring, - float shiftFromEdge, - float shiftFromDeadZone); - - // counters - int nEventsAnalyzed; - int rhTreeCount; - int segTreeCount; - bool firstEvent; - bool cleanEvent; - - // - // - // The root file for the histograms. - TFile *theFile; - - // - // - // input parameters for this module - bool makePlots; - bool makeComparisonPlots; - std::string refRootFile; - bool writeTreeToFile; - bool isSimulation; - std::string rootFileName; - bool detailedAnalysis; - bool useDigis; - bool makeHLTPlots; - - // filters - bool useQualityFilter; - bool useTriggerFilter; - - // quality filter parameters - double pMin; - double chisqMax; - int nCSCHitsMin, nCSCHitsMax; - double lengthMin, lengthMax; - double deltaPhiMax; - double polarMin, polarMax; - - edm::EDGetTokenT rd_token; - edm::EDGetTokenT wd_token; - edm::EDGetTokenT sd_token; - edm::EDGetTokenT cd_token; - edm::EDGetTokenT al_token; - edm::EDGetTokenT cl_token; - edm::EDGetTokenT co_token; - edm::EDGetTokenT rh_token; - edm::EDGetTokenT se_token; - edm::EDGetTokenT l1_token; - edm::EDGetTokenT tr_token; - edm::EDGetTokenT sa_token; - edm::EDGetTokenT sh_token; - edm::ESGetToken geomToken_; - - // module on/off switches - bool makeOccupancyPlots; - bool makeTriggerPlots; - bool makeStripPlots; - bool makeWirePlots; - bool makeRecHitPlots; - bool makeSimHitPlots; - bool makeSegmentPlots; - bool makeResolutionPlots; - bool makePedNoisePlots; - bool makeEfficiencyPlots; - bool makeGasGainPlots; - bool makeAFEBTimingPlots; - bool makeCompTimingPlots; - bool makeADCTimingPlots; - bool makeRHNoisePlots; - bool makeCalibPlots; - bool makeStandalonePlots; - bool makeTimeMonitorPlots; - - // The histo managing object - CSCValHists *histos; - - // tmp histos for Efficiency - TH1F *hSSTE; - TH1F *hRHSTE; - TH1F *hSEff; - TH1F *hRHEff; - TH2F *hSSTE2; - TH2F *hRHSTE2; - TH2F *hStripSTE2; - TH2F *hWireSTE2; - TH2F *hSEff2; - TH2F *hRHEff2; - TH2F *hStripEff2; - TH2F *hWireEff2; - TH2F *hEffDenominator; - TH2F *hSensitiveAreaEvt; - - // occupancy - TH2I *hOWires; - TH2I *hOStrips; - TH2I *hORecHits; - TH2I *hOSegments; - - /// Maps and vectors for module doGasGain() - std::vector nmbhvsegm; - std::map > m_wire_hvsegm; - std::map m_single_wire_layer; - - //maps to store the DetId and associated RecHits - std::multimap AllRechits; - std::multimap SegRechits; - std::multimap NonAssociatedRechits; - std::map distRHmap; - - int typeIndex(CSCDetId id) { - // linearlized index bases on endcap, station, and ring - int index = 0; - if (id.station() == 1) { - index = id.ring() + 1; - if (id.ring() == 4) - index = 1; - } else - index = id.station() * 2 + id.ring(); - if (id.endcap() == 1) - index = index + 10; - if (id.endcap() == 2) - index = 11 - index; - return index; - } -}; +} // namespace #endif diff --git a/RecoLocalMuon/CSCValidation/test/cscv.py b/RecoLocalMuon/CSCValidation/test/cscv.py new file mode 100644 index 0000000000000..85b9677e54837 --- /dev/null +++ b/RecoLocalMuon/CSCValidation/test/cscv.py @@ -0,0 +1,70 @@ +# Test CSCValidation in 12_x - Tim Cox - 15.07.2022 +# from SingleMuon RAW + +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process("TEST", Run3) + +process.load("Configuration.StandardSequences.GeometryDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +process.load("Configuration.StandardSequences.RawToDigi_Data_cff") +process.load("Configuration.StandardSequences.Reconstruction_cff") +process.load('Configuration.StandardSequences.EndOfProcess_cff') + +# 2022 +##process.GlobalTag.globaltag = 'auto:phase1_2022_realistic' ## FAILS IN 12_3_6 +# 12_3_6 Prompt +process.GlobalTag.globaltag = '123X_dataRun3_Prompt_v12' + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32( 5000 ) ) ## UP TO 5K EVENTS +process.options = cms.untracked.PSet( SkipEvent = cms.untracked.vstring('ProductNotFound') ) +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( +## "root://eoscms.cern.ch://eos/cms/tier0/store/data/Run2022B/SingleMuon/RAW/v1/000/355/208/00000/3004d340-6e3d-4223-9eb2-7d50a65bfe57.root" + "/store/data/Run2022B/SingleMuon/RAW-RECO/ZMu-PromptReco-v1/000/355/558/00000/ce02cf0e-e8f7-471c-b533-61b6f124c095.root" +) +) + +process.cscValidation = cms.EDAnalyzer("CSCValidation", + rootFileName = cms.untracked.string('cscv.root'), + isSimulation = cms.untracked.bool(False), + writeTreeToFile = cms.untracked.bool(True), + useDigis = cms.untracked.bool(True), + detailedAnalysis = cms.untracked.bool(False), + useTriggerFilter = cms.untracked.bool(False), + useQualityFilter = cms.untracked.bool(False), + makeStandalonePlots = cms.untracked.bool(False), + makeTimeMonitorPlots = cms.untracked.bool(True), + rawDataTag = cms.InputTag("rawDataCollector"), + alctDigiTag = cms.InputTag("muonCSCDigis","MuonCSCALCTDigi"), + clctDigiTag = cms.InputTag("muonCSCDigis","MuonCSCCLCTDigi"), + corrlctDigiTag = cms.InputTag("muonCSCDigis","MuonCSCCorrelatedLCTDigi"), + stripDigiTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi"), + wireDigiTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi"), + compDigiTag = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi"), + cscRecHitTag = cms.InputTag("csc2DRecHits"), + cscSegTag = cms.InputTag("cscSegments"), + saMuonTag = cms.InputTag("standAloneMuons"), + l1aTag = cms.InputTag("gtDigis"), + hltTag = cms.InputTag("TriggerResults::HLT"), + makeHLTPlots = cms.untracked.bool(True), + simHitTag = cms.InputTag("g4SimHits", "MuonCSCHits") +) + +# From RECO (and FEVT?) +##process.p = cms.Path(process.cscValidation) + +# From RAW +process.p = cms.Path(process.muonCSCDigis * process.csc2DRecHits * process.cscSegments * process.cscValidation) + +# Path and EndPath definitions +##process.raw2digi_step = cms.Path(process.RawToDigi) +##process.reconstruction_step = cms.Path(process.reconstruction) +##process.cscvalidation_step = cms.Path(process.cscValidation) +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +##process.schedule = cms.Schedule(process.raw2digi_step,process.reconstruction_step,process.cscvalidation_step,process.endjob_step) +process.schedule = cms.Schedule(process.p,process.endjob_step) diff --git a/RecoLocalMuon/CSCValidation/test/cscv_express.py b/RecoLocalMuon/CSCValidation/test/cscv_express.py new file mode 100644 index 0000000000000..f62e6d7393446 --- /dev/null +++ b/RecoLocalMuon/CSCValidation/test/cscv_express.py @@ -0,0 +1,69 @@ +# Test CSCValidation in 12_x - Tim Cox - 10.07.2022 +# from FEVT in Express but unpack and local reco + +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process("TEST", Run3) + +process.load("Configuration.StandardSequences.GeometryDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +process.load("Configuration.StandardSequences.RawToDigi_Data_cff") +process.load("Configuration.StandardSequences.Reconstruction_cff") +process.load('Configuration.StandardSequences.EndOfProcess_cff') + +# 2022 +##process.GlobalTag.globaltag = 'auto:phase1_2022_realistic' ## FAILS IN 12_3_6 +# 12_3_6 Express +process.GlobalTag.globaltag = '123X_dataRun3_Express_v10' + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32( 5000 ) ) ## PROCESS 5K EVENTS +process.options = cms.untracked.PSet( SkipEvent = cms.untracked.vstring('ProductNotFound') ) +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + "/store/express/Run2022B/ExpressPhysics/FEVT/Express-v1/000/355/135/00000/0135acb6-75de-4798-9b1f-7fca60fa4029.root" +) +) + +process.cscValidation = cms.EDAnalyzer("CSCValidation", + rootFileName = cms.untracked.string('cscv.root'), + isSimulation = cms.untracked.bool(False), + writeTreeToFile = cms.untracked.bool(True), + useDigis = cms.untracked.bool(True), + detailedAnalysis = cms.untracked.bool(False), + useTriggerFilter = cms.untracked.bool(False), + useQualityFilter = cms.untracked.bool(False), + makeStandalonePlots = cms.untracked.bool(False), + makeTimeMonitorPlots = cms.untracked.bool(True), + rawDataTag = cms.InputTag("rawDataCollector"), + alctDigiTag = cms.InputTag("muonCSCDigis","MuonCSCALCTDigi"), + clctDigiTag = cms.InputTag("muonCSCDigis","MuonCSCCLCTDigi"), + corrlctDigiTag = cms.InputTag("muonCSCDigis","MuonCSCCorrelatedLCTDigi"), + stripDigiTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi"), + wireDigiTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi"), + compDigiTag = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi"), + cscRecHitTag = cms.InputTag("csc2DRecHits"), + cscSegTag = cms.InputTag("cscSegments"), + saMuonTag = cms.InputTag("standAloneMuons"), + l1aTag = cms.InputTag("gtDigis"), + hltTag = cms.InputTag("TriggerResults::HLT"), + makeHLTPlots = cms.untracked.bool(True), + simHitTag = cms.InputTag("g4SimHits", "MuonCSCHits") +) + +# From RECO (and FEVT?) +##process.p = cms.Path(process.cscValidation) + +# From RAW +process.p = cms.Path(process.muonCSCDigis * process.csc2DRecHits * process.cscSegments * process.cscValidation) + +# Path and EndPath definitions +##process.raw2digi_step = cms.Path(process.RawToDigi) +##process.reconstruction_step = cms.Path(process.reconstruction) +##process.cscvalidation_step = cms.Path(process.cscValidation) +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +##process.schedule = cms.Schedule(process.raw2digi_step,process.reconstruction_step,process.cscvalidation_step,process.endjob_step) +process.schedule = cms.Schedule(process.p,process.endjob_step)