Last active
February 3, 2016 23:47
-
-
Save jdbrice/bb4e0a49678e7d81766a to your computer and use it in GitHub Desktop.
Produces Root file with histograms for Tof Status QA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| TFile * f = new TFile( "TofStatusQA.root" ); | |
| vector<bool> tray_status; | |
| tray_status.push_back( false ); // index starts at 1 | |
| map< string, bool> module_status; | |
| TH1* Trays = (TH1*)f->Get( "Trays" ); | |
| for ( int i = 1; i < 121; i++ ){ | |
| if ( 1 >= Trays->GetBinContent( i+1 ) ){ | |
| cout << i << " 0 " << endl; | |
| tray_status.push_back( false ); | |
| } else { | |
| tray_status.push_back( true ); | |
| } | |
| } | |
| for ( int i = 1; i < 121; i++ ){ | |
| TH1 * modules = (TH1*)f->Get( ("modules/Module_" + ts(i)).c_str() ); | |
| if ( nullptr == modules ) continue; | |
| if ( false == tray_status[ i ] ) continue; | |
| for ( int j = 1; j <= 32; j++ ){ | |
| if ( 1 >= modules->GetBinContent( j+1 ) ){ | |
| cout << i << " " << j << " 0" << endl; | |
| module_status[ ts(i) + "_" + ts(j) ] = false; | |
| } else { | |
| module_status[ ts(i) + "_" + ts(j) ] = true; | |
| } | |
| } | |
| } | |
| for ( int i = 1; i < 121; i++ ){ | |
| if ( false == tray_status[ i ] ) continue; | |
| for ( int j = 1; j <= 32; j++ ){ | |
| TH1 * cells = (TH1*)f->Get( ("cells/Cell_" + ts(i) + "_" + ts(j) ).c_str() ); | |
| if ( nullptr == cells ) continue; | |
| if ( false == module_status[ ts(i) + "_" + ts(j) ] ) continue; | |
| for ( int k = 1; k <= 6; k++ ){ | |
| if ( 1 >= cells->GetBinContent( k ) ) | |
| cout << i << " " << j << " " << k << endl; | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| Logger::setGlobalLogLevel( "info" ); | |
| XmlConfig c( "TofStatusQA.xml" ); | |
| HistoBook b( "TofStatusQA.root", c ); | |
| b.makeAll( "histograms" ); | |
| INFO( "", "# of histograms = " << b.size() ); | |
| TChain * tof = new TChain( "tof" ); | |
| tof->Add( c.getString( "glob:url" ).c_str() ); | |
| tof->Draw( "tray>>Trays" ); | |
| b.cd("modules"); | |
| for ( int iTray = 1; iTray < 121; iTray ++ ){ | |
| b.clone( "", "Module", "Module_" + ts(iTray) ); | |
| INFO( "", "Modules for Tray " << iTray ); | |
| tof->Draw( ("module>>Module_" + ts(iTray)).c_str(), ("tray==" + ts(iTray)).c_str() ); | |
| } | |
| b.cd("cells"); | |
| for ( int iTray = 1; iTray < 121; iTray ++ ){ | |
| for ( int iMod = 1; iMod <= 32; iMod ++ ){ | |
| INFO( "", "Cells for Tray " << iTray << ", Module " << iMod ); | |
| string name = "Cell_" + ts(iTray) + "_" + ts(iMod); | |
| b.clone( "", "Cell", name ); | |
| tof->Draw( ("cell>>" + name ).c_str(), ("tray==" + ts(iTray) + " && module==" + ts(iMod) ).c_str() ); | |
| } | |
| } | |
| b.save(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <config> | |
| <glob url="D31373E7B3B902EB259468B9A70492C7_10*.ntuple.root" /> | |
| <!-- histograms to auto-make --> | |
| <histograms> | |
| <Histo name="Trays" title="Trays" min="0" max="121" width="1" /> | |
| <Histo name="Module" title="Module" min="0" max="33" width="1" /> | |
| <Histo name="Cell" title="Cell" min="1" max="7" width="1" /> | |
| </histograms> | |
| </config> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment