#define SelSensitivity_cxx // The class definition in SelSensitivity.h has been generated automatically // by the ROOT utility TTree::MakeSelector(). This class is derived // from the ROOT class TSelector. For more information on the TSelector // framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual. // The following methods are defined in this file: // Begin(): called every time a loop on the tree starts, // a convenient place to create your histograms. // SlaveBegin(): called after Begin(), when on PROOF called only on the // slave servers. // Process(): called for each event, in this function you decide what // to read and fill your histograms. // SlaveTerminate: called at the end of the loop on the tree, when on PROOF // called only on the slave servers. // Terminate(): called at the end of the loop on the tree, // a convenient place to draw/fit your histograms. // // To use this file, try the following session on your Tree T: // // root> T->Process("SelSensitivity.C") // root> T->Process("SelSensitivity.C","some options") // root> T->Process("SelSensitivity.C+") // #include "SelSensitivity.h" #include #include SelSensitivity::SelSensitivity(TTree* tr) : fChain(0),readervalueinitiated(false) { } SelSensitivity :: ~SelSensitivity() { // if(fOutTree) // SafeDelete(fOutTree) ; // if(fFile) // SafeDelete(fFile) ; } void SelSensitivity::Begin(TTree * /*tree*/) { TString option = GetOption(); } void SelSensitivity::SlaveBegin(TTree * /*tree*/) { hist = new TH1F("SENSITIVITY_ITERATION","",30,1.0,4.0) ; fOutput -> Add(hist) ; histT = new TH1F("TestHistTotal","",30,1.0,4.0) ; fOutput -> Add(histT) ; histLVsS = new TH2F("LvsS","",30,1.0,4.0,20,0.0,2.0) ; fOutput -> Add(histLVsS) ; // dummy_sens = new TParameter ("SENSITIVITY_ITERATION",0.0) ; // fOutput -> Add(dummy_sens) ; } Bool_t SelSensitivity::Process(Long64_t entry) { // if(!fOutTree) // return kTRUE ; fReader.SetLocalEntry(entry); Bool_t cutresult = ( (**fSize >= fSizeCut) && ( **fTriggerStatus == 1) ) ; for ( Int_t i = 0, j = 0 ; i < fNcuts && j < fNvars ; ++i ) { if((mcuts[i] -> GetIndVar()).EqualTo("-")) { cutresult = cutresult && (mcuts[i] -> ApplyCut(*(fParameters[j] -> Get()),0.0)) ; // ++i ; ++j ; } else { cutresult = cutresult && (mcuts[i] -> ApplyCut(*(fParameters[j] -> Get()), *( fParameters[j+1] -> Get() ) )) ; // ++i ; j += 2 ; } } if(cutresult) { // hist -> Fill(log10(*fEnergy)) ; hist -> Fill(log10(**fSize)) ; histLVsS -> Fill(log10(**fSize),*(fParameters[1] -> Get())) ; } histT -> Fill(log10(*fEnergy)) ; // dummy_sens -> SetVal(dummy_sens -> GetVal() + 1.0) ; return kTRUE ; } void SelSensitivity::SlaveTerminate() { // The SlaveTerminate() function is called after all entries or objects // have been processed. When running with PROOF SlaveTerminate() is called // on each slave server. } void SelSensitivity::Terminate() { // The Terminate() function is the last function to be called during // a query. It always runs on the client, it can be used to present // the results graphically or save the results to file. if((hist = dynamic_cast (fOutput -> FindObject("SENSITIVITY_ITERATION"))) && (histT = dynamic_cast (fOutput -> FindObject("TestHistTotal"))) && (histLVsS = dynamic_cast (fOutput -> FindObject("LvsS")) ) ){ // hist -> Draw("histe1") ; histLVsS -> Draw("colz") ; // hist -> Divide(histT) ; } }