User Tools

Site Tools


itk:extracting_channels_from_root_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
itk:extracting_channels_from_root_files [2016/09/15 18:12]
mbeydler
itk:extracting_channels_from_root_files [2016/09/15 20:04] (current)
mbeydler
Line 1: Line 1:
 ====== Extracting channels from ROOT files ====== ====== Extracting channels from ROOT files ======
  
-Overview: The TestAnalysis.py script allows the user of the HSIO to print off specific problematic channels after running a test. The user inputs the root file from the test, the specific histogram they would like to analyze, and must put the maximum number of hits possible in a given channel+Overview: This script ({{:itk:channelextraction.py|}}) allows the user to print a list of problematic channels after running a test. The user inputs the ROOT file from the test, the specific histogram they would like to analyze, and must input the maximum number of hits possible in the channels
  
-Instructions: +Instructions: 
 +  * Download the package using the command  
 +<code bash> 
 +wget https://atlaswww.hep.anl.gov/asc/wikidoc/lib/exe/fetch.php?media=itk:channelextraction.py -O ChannelExtraction.py 
 +</code> 
 +  * Once you have the package, make sure that you have already installed ROOT or can open the ROOT file from your test. 
 +  * Open the script ''vim (or emacs/whatever text editor you use) ChannelExtraction.py''
 +  * Input your ROOT file that contains the histogram from the test, the name of the histogram, and the maximum number of hits possible in all of the channels. 
 +  * Save script. 
 +  * Run script using ''python ChannelExtraction.py''  
 +  * The information will be printed to the command line.
  
 Script: Script:
 +<code python> #This script allows the user to see the specific ouput for specific pixels on different electronic tests
 +  from ROOT import *
  
-''#This script allows the user to see the specific ouput for specific pixels on different electronic tests+  #The user must input the root file, histogram, and the maximum number for bin content 
 +  fileName = "~/calibData/TEST_NAME_0000RUN#/histos.root"  #For example: an analog test with run number 11 ~/calibData/ANALOG_TEST_000011/histos.root. 
 +  histogramName = "Mod_94220425_Occupancy_Point_000"    #This is the corresponding histogram name for the analog test. 
 +  maxValBin = 50     #This is the corresponding maximum hits for the analog test.
  
- +  #Do not modify the rest of the code, it should work given what the user has place above. 
-from ROOT import * +  test = TFile.Open(fileName) 
- +  h = test.Get(histogramName) 
-#The user must input the root file, histogram, and the maximum number for bin content +  h.Draw("colz"
-fileName = "" +  for i in range(1, h.GetNbinsX()): 
-histogramName = "" +        for j in range(1, h.GetNbinsY()): 
-maxValBin = 50 +        binContent = h.GetBinContent(i, j) 
- +        if binContent < maxValBin: 
-#Do not modify the rest of the code, it should work given what the user has place above. +              print "*****************************" 
-test = TFile.Open(fileName) +              print "Pixel column (x): ", i 
-h = test.Get(histogramName) +              print "Pixel row (y): ", j 
-h.Draw("colz"+              print "Number of hits: ", binContent 
- +              print "*****************************" </code> 
-for i in range(1, h.GetNbinsX()): +               
-    for j in range(1, h.GetNbinsY()): + 
-    binContent = h.GetBinContent(i, j) +
-    if binContent < maxValBin: +
-        print "*****************************" +
-        print "Pixel column (x): ", i +
-        print "Pixel row (y): ", j +
-        print "Number of hits: ", binContent +
-        print "*****************************" +
- +
-''+
itk/extracting_channels_from_root_files.1473963132.txt.gz · Last modified: 2016/09/15 18:12 by mbeydler