diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.cxx index a0c8b855850771a57a339a4d60b7c2a4f01044d5..29570d905851b50f1a4d6464d2d5235ed6f85322 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.cxx @@ -20,7 +20,7 @@ void ConfVtxAnalysis::initialise() { m_initialised = true; - std::cout << "ConfVtxAnalysis::initialise() " << name() << std::endl; + // std::cout << "ConfVtxAnalysis::initialise() " << name() << std::endl; mdir = new TIDDirectory(name()); @@ -47,11 +47,7 @@ void ConfVtxAnalysis::initialise() { eff_nvtx = new Efficiency( hnvtx, "nvtx_eff" ); // eff_mu = new Efficiency( hmu, "mu_eff" ); - double ntrax[10] = { 0, 2, 5, 10, 15, 20, 30, 15, 100 }; - - eff_zed_vs_ntrax = new Contour<Efficiency>( "eff_zed_vs_ntrax"); - - eff_zed_vs_ntrax->ranges( ntrax, 9, eff_zed ); + // double ntrax[10] = { 0, 2, 5, 10, 15, 20, 30, 15, 100 }; mdir->pop(); @@ -67,7 +63,7 @@ void ConfVtxAnalysis::execute( const std::vector<TIDA::Vertex*>& vtx0, // if ( vtx1.size()<2 ) return; -#if 1 +#if 0 std::cout << "ConfVtxAnalysis::execute() " << name() << "\tvtx0.size() " << vtx0.size() << "\tvtx1.size() " << vtx1.size() @@ -86,16 +82,14 @@ void ConfVtxAnalysis::execute( const std::vector<TIDA::Vertex*>& vtx0, if ( i>0 ) continue; - std::cout << i << "\tref z " << vtx0[i]->z(); + // std::cout << i << "\tref z " << vtx0[i]->z(); hzed->Fill( vtx0[i]->z() ); hntrax->Fill( vtx0[i]->Ntracks() ); - Efficiency* eff = eff_zed_vs_ntrax->find( vtx0[i]->Ntracks() ); - const TIDA::Vertex* mv = m.matched( vtx0[i] ); if ( mv ) { - std::cout << "\ttest z " << mv->z() << " : delta z " << (mv->z()-vtx0[i]->z()) << std::endl; + // std::cout << "\ttest z " << mv->z() << " : delta z " << (mv->z()-vtx0[i]->z()) << std::endl; /// ah ha ! can fill some silly old histograms here /// ... @@ -114,16 +108,14 @@ void ConfVtxAnalysis::execute( const std::vector<TIDA::Vertex*>& vtx0, eff_ntrax->Fill( vtx0[i]->Ntracks() ); eff_nvtx->Fill( vtx0.size() ); - if ( eff ) eff->Fill( vtx0[i]->z() ); } else { - std::cout << "\t" << "------" << std::endl; + // std::cout << "\t" << "------" << std::endl; eff_zed->FillDenom( vtx0[i]->z() ); eff_ntrax->FillDenom( vtx0[i]->Ntracks() ); eff_nvtx->FillDenom( vtx0.size() ); - if ( eff ) eff->FillDenom( vtx0[i]->z() ); } } @@ -135,12 +127,16 @@ void ConfVtxAnalysis::execute( const std::vector<TIDA::Vertex*>& vtx0, void ConfVtxAnalysis::finalise() { - if ( !m_initialised ) return;; - std::cout << "ConfVtxAnalysis::finalise() " << name() << std::endl; + + if ( !m_initialised ) return;; mdir->push(); + std::cout << "ConfVtxAnalysis::finalise() " << name() << std::endl; + + gDirectory->pwd(); + hnvtx->Write(); hzed->Write(); hntrax->Write(); @@ -159,24 +155,6 @@ void ConfVtxAnalysis::finalise() { eff_ntrax->finalise(); eff_ntrax->Bayes()->Write( (eff_ntrax->name()+"_tg").c_str() ); eff_nvtx->finalise(); eff_nvtx->Bayes()->Write( (eff_nvtx->name()+"_tg").c_str() ); - - eff_zed_vs_ntrax->dir()->push(); - - for ( int i=eff_zed_vs_ntrax->size()-1 ; i-- ; ) { - - Efficiency* eff = eff_zed_vs_ntrax->at(i).second; - - if ( eff ) { - eff->finalise(); - eff->Bayes()->Write( (eff->name()+"_tg").c_str() ); - } - - } - - eff_zed_vs_ntrax->dir()->pop(); - - eff_zed_vs_ntrax->Write(); - mdir->pop(); } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.h index 7631483705c315e674ba623d3a98c472761c18b7..edcbc6e31edc7284dfa2e6c7484567eccbf0fad4 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfVtxAnalysis.h @@ -21,7 +21,7 @@ #include "Resplot.h" #include "Resplot.h" -#include "Contour.h" +// #include "Contour.h" class ConfVtxAnalysis : public VertexAnalysis { @@ -65,7 +65,7 @@ private: Efficiency* eff_nvtx; Efficiency* eff_mu; - Contour<Efficiency>* eff_zed_vs_ntrax; + // Contour<Efficiency>* eff_zed_vs_ntrax; }; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx index c10c384d06e04121920b1fe13c7e8fe1e26e271b..152d8ad510de4e3f55a60aa2239dcabfd9b12abc 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx @@ -760,7 +760,16 @@ int main(int argc, char** argv) { else { htest = (TH1F*)ftest.Get((chains[j]+"/"+histos[i]).c_str()) ; href = (TH1F*)fref.Get((chains[j]+"/"+histos[i]).c_str()) ; + + if ( htest==0 || href==0 ) continue; + savedhistos.push_back( chains[j]+"/"+histos[i] ); + + if ( yinfo.normset() ) { + Norm( htest ); + Norm( href ); + } + } if ( make_ref_efficiencies ) { @@ -907,8 +916,8 @@ int main(int argc, char** argv) { double _max = int( (h->GetMaximum() + 20)*0.1 )*0.1*scale_eff; double _min = int( (h->GetMinimum() - 10)*0.1 )*0.1*scale_eff; - if ( _max>1.0*scale_eff ) _max = 1.02*scale_eff; - if ( _min<0 ) _min = 0; + if ( _max>1*scale_eff ) _max = 1.02*scale_eff; + if ( _min<0 ) _min = 0; h->SetMinimum(_min); h->SetMaximum(_max); @@ -1270,4 +1279,3 @@ int main(int argc, char** argv) { return 0; } - diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.cxx index 9c652eccded4415047a40c32f03de34e7e69452d..0ff740ae4dc4d9d858c15d668577b0765209cd6e 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.cxx @@ -37,6 +37,20 @@ bool Plots::watermark = true; +void Norm( TH1* h ) { + double n = 0; + for ( int i=h->GetNbinsX()+1 ; --i ; ) n += h->GetBinContent(i); + if ( n!=0 ) { + double in=1/n; + for ( int i=h->GetNbinsX()+1 ; --i ; ) { + h->SetBinContent(i, h->GetBinContent(i)*in ); + h->SetBinError(i, h->GetBinError(i)*in ); + } + } + +} + + void ATLASFORAPP_LABEL( double x, double y, int color, double size ) { @@ -370,4 +384,3 @@ void xrangeuser(TH1* h, bool symmetric ) { std::vector<double> limits = findxrangeuser( h, symmetric ); h->GetXaxis()->SetRangeUser( limits[0], limits[1] ); } - diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h index 9bbd3de884c9f2294b753bdcbc21e5d93a77afe4..0f8396c89949d994e5c47d6690f535d79931e05a 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/computils.h @@ -39,7 +39,7 @@ void myText( Double_t x, Double_t y, Color_t color, const std::string& text, Dou std::string stime(); static std::string release; - +void Norm( TH1* h); /// does a string contain the substring bool contains( const std::string& s, const std::string& p); @@ -100,7 +100,8 @@ public: m_symmetric(false), m_rangeset(false), m_lo(0), - m_hi(0) + m_hi(0), + m_norm(false) { // std::cout << "AxisInfo::info" << m_info << std::endl; @@ -118,6 +119,10 @@ public: if ( keys[i]=="lin" ) m_log = false; else if ( keys[i]=="log" ) m_log = true; else if ( keys[i]=="auto" ) m_autoset = true; + else if ( keys[i]=="auton" ) { + m_autoset = true; + m_norm = true; + } else if ( keys[i]=="autosym" ) { m_autoset = true; m_symmetric = true; @@ -153,6 +158,8 @@ public: bool log() const { return m_log; } bool autoset() const { return m_autoset; } + + bool normset() const { return m_norm; } bool symmetric() const { return m_symmetric; } @@ -195,6 +202,8 @@ public: double m_lo; double m_hi; + bool m_norm; + }; @@ -337,9 +346,6 @@ public: // } } else { - - if ( htest() ) htest()->GetXaxis()->SetMoreLogLabels(true); - if ( tgtest() ) { zeroErrors(htest()); htest()->GetXaxis()->SetMoreLogLabels(true); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx index 5fb2cf181f3930f4f00beb53a884ac17530ae73c..1140ac63b7fda01acded15bab1c70848442011d2 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx @@ -443,17 +443,10 @@ int main(int argc, char** argv) } } - if ( testChains.size()==0 ) { - if ( inputdata.isTagDefined("testChains") ) { - /// a whole list of chains - testChains = inputdata.GetStringVector("testChains"); - } - else { - if ( inputdata.isTagDefined("testChain") ) { - /// a single chain - testChains.push_back( inputdata.GetString("testChain") ); - } - } + /// get the test chains + if ( testChains.size()==0 ) { ///NB: don't override command line args + if ( inputdata.isTagDefined("testChains") ) testChains = inputdata.GetStringVector("testChains"); + else if ( inputdata.isTagDefined("testChain") ) testChains.push_back( inputdata.GetString("testChain") ); } /// new code - can extract vtx name, pt, any extra options that we want, diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Doc/README b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Doc/README new file mode 100644 index 0000000000000000000000000000000000000000..c42458e8658cfd07478df7ce5416ab0cd5fefb0c --- /dev/null +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Doc/README @@ -0,0 +1,85 @@ + +Detailed introductory documentation can be found for the mini workshop +to discuss the TrigInDetAnalysis framework. Slides can be found here + +https://indico.cern.ch/event/278837/sessions/143651/#20131106 + +The slides from the "Overview of the TrigInDetAnaysis packages" +gives the best overview. + +There are some operational instruction in + +https://twiki.cern.ch/twiki/bin/viewauth/Atlas/InnerDetectorTriggerRTT + +Basically the structure of a task is: + +1. run an athena job with some jo which run the TIDA analysis code ntple + building stage + This reads through the events, looking at events that have passed the + specified triggers and extracts the tracks and the relevant offline + objects, and creates a custom ntple using our own classes. +2. run a post processing job (TIDArdict.exe) on these ntples. This runs + our own standalone ntple reading code and fills histograms. It has + it's own style of config file. The executable is so named, since it + reads in and decodes usin our own dictionaries for the code (it stores + proper classes in the TTree file, rather than flattened structures) +3. run a histogram plotting job, (TIDAcomparitor.exe) to make plots from + the hitograms filled in step 2. + This also uses it's own config file, using the same format as the file + for step 2, to specify which histograms, bin ranges, axis titles, wherether + histograms dhould be normalised, etc + + +The comparitor has many options that can be seen with + + TIDAcomparitor.exe --help + +Versions of many of the .dat files that you might find about are in + +Trigger/TrigAnalysis/TrigInDetAnalysisUser/share + +All the code in TrigInDetAnalysisUser is completely athena-free, +like our own version of rootcore, but more straightforward to +use, and can be compiled by itself, just linking against root +if required. + + +There are many utilities in TIDAUser, for instance, one of the most important +is the reader; + + TIDAreader.exe + +which reads in and decodes the ntples, since they use proper classes, and are not +flat structures. + +Also, + + TIDAchains.exe + +will list the chains that are in the output histogram file from the + + TIDArdict.exe + +run, ie ... + +% TIDAchains.exe data-output-el.root +HLT_e26_lhtight_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig +HLT_e26_lhtight_idperf_InDetTrigTrackingxAODCnv_Electron_FTF +HLT_e24_lhmedium_idperf_L1EM20VH_InDetTrigTrackingxAODCnv_Electron_IDTrig +HLT_e24_medium_idperf_L1EM20VH_InDetTrigTrackingxAODCnv_Electron_IDTrig +HLT_e24_lhmedium_idperf_L1EM20VH_InDetTrigTrackingxAODCnv_Electron_FTF +HLT_e24_medium_idperf_L1EM20VH_InDetTrigTrackingxAODCnv_Electron_FTF + +In the dat file for The TIDArdict.exe job there is a list of "test" chains, +and also a specification of which chain to use as the "reference" chain. + +Parameters generally are for reference selection eg + + pT = 1000; + +means only reference tracks with pT > 1000 MeV. cuts on "test" (trigger) +quantities, generally are appended with _rec, eg + + pT_rec = 1000; + +The dat files are free formatted and take c++ style comments. diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx index a26ca3340e7c1ea887084b8108ad0128751d219a..1c464e892e6824dfb8364b0054b952a257cbe2d5 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx @@ -39,8 +39,7 @@ bool Resplot::mAddDirectoryStatus = true; bool Resplot::interpolate_flag = true; /// use the new error estimates -bool Resplot::oldrms95 = true; -// bool Resplot::oldrms95 = false; +bool Resplot::oldrms95 = false; bool Resplot::scalerms95 = true; Resplot::ERROR Resplot::ErrorSet = Resplot::OK; @@ -386,6 +385,8 @@ double NCounter(TH1D* h) { // Get the offsets and resolutions overall and for each slice int Resplot::Finalise(double a, double b, TF1* (*func)(TH1D* s, double a, double b)) { + // gDirectory->pwd(); + ErrorSet = OK; // std::cout << "Resplot::Finalise() Name " << Name() << "\tn_primary " << n_primary << std::endl;