#define ntp1_cxx // The class definition in ntp1.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("ntp1.C") // Root > T->Process("ntp1.C","some options") // Root > T->Process("ntp1.C+") // #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using std::cout; using std::endl; using std::vector; #include #include #include #include #include #include #include //include "AnalysisTool.h" using namespace std; #include "ntp1.h" #include #include TH1F* h1_pt_AK5PFPUcorrJet; TH1F* h1_pt_jets_no_scaled; TFile* output_root; void ntp1::Begin(TTree * /*tree*/) { // The Begin() function is called at the start of the query. // When running with PROOF Begin() is only called on the client. // The tree argument is deprecated (on PROOF 0 is passed). TString option = GetOption(); // output_root = new TFile("dai_cazzo.root","RECREATE"); } void ntp1::SlaveBegin(TTree * /*tree*/) { // The SlaveBegin() function is called after the Begin() function. // When running with PROOF SlaveBegin() is called on each slave server. // The tree argument is deprecated (on PROOF 0 is passed). TString option = GetOption(); // output_root = new TFile("dai_cazzo.root","RECREATE"); // ofstream out; // output_root = new TFile("dai_cazzo.root","RECREATE"); h1_pt_AK5PFPUcorrJet = new TH1F("pt_AK5PFPUcorrJet","Pt Jets distribution",200,0.,200); h1_pt_jets_no_scaled = new TH1F ("pt_jets_no_scaled","Pt Jets no scaled distribution",200,0.,200); fOutput->Add(h1_pt_AK5PFPUcorrJet); fOutput->Add(h1_pt_jets_no_scaled); // Book all objects defined in current TDirectory /* TList* obj_list = (TList*) gDirectory->GetList() ; TIter next_object((TList*) obj_list) ; TObject* obj ; cout << "-- Booking objects:" << endl; while ((obj = next_object())) { TString objname = obj->GetName() ; cout << " " << objname << endl ; fOutput->Add(obj) ; } */ } Bool_t ntp1::Process(Long64_t entry) { // The Process() function is called for each entry in the tree (or possibly // keyed object in the case of PROOF) to be processed. The entry argument // specifies which entry in the currently loaded tree is to be processed. // It can be passed to either ntp1::GetEntry() or TBranch::GetEntry() // to read either all or the required parts of the data. When processing // keyed objects with PROOF, the object is already loaded and is available // via the fObject pointer. // // This function should contain the "body" of the analysis. It can contain // simple or elaborate selection criteria, run algorithms on the data // of the event and typically fill histograms. // // The processing can be stopped by calling Abort(). // // Use fStatus to set the return value of TTree::Process(). // // The return value is currently not used. int i; float dR, dRmin; float energySignalPho; float vertexXSignalPho, vertexYSignalPho, vertexZSignalPho; float hOverESignalPho; float dr03TkSumPtSignalPho,dr03HollowTkSumPtSignalPho,dr03EcalRecHitSumEtSignalPho,dr03HcalTowerSumEtSignalPho; float dr04TkSumPtSignalPho,dr04HollowTkSumPtSignalPho,dr04EcalRecHitSumEtSignalPho,dr04HcalTowerSumEtSignalPho; float chargedHadronIsoSignalPho, neutralHadronIsoSignalPho, photonIsoSignalPho; float hasPixelSeedSignalPho, hasMatchedConversionSignalPho; float fiducialFlagsSignalPho, recoFlagsSignalPho, superClusterIndexSignalPho,PFsuperClusterIndexSignalPho; float covIetaIetaSC_brlSignalPho, covIetaIetaSC_endSignalPho, covIphiIphiSCSignalPho, covIetaIphiSCSignalPho; float hOverE_brl_sgl_pho, hOverE_end_sgl_pho, IsoTrk_brl_sgl_pho, IsoTrk_end_sgl_pho, IsoEcal_brl_sgl_pho, IsoEcal_end_sgl_pho, IsoHcal_brl_sgl_pho, IsoHcal_end_sgl_pho; float R9_brl_sgl_pho, R9_end_sgl_pho, sum_Iso_brl_sgl_pho, sum_Iso_end_sgl_pho, nPV_pre_cut, nPV_post_cut, corr_sum_Iso_brl_sgl_pho, corr_sum_Iso_end_sgl_pho, nPV_post_corr_cut; float bestE=0, bestR9=0, bestIso=5000; int true_ind=100; int E_ind=999, R9_ind=999, Iso_ind=999; for(i=0;iFill(1); //sta cagata nn c`era if(p_corrJet1.Pt()>25){ h1_pt_AK5PFPUcorrJet->Fill(p_corrJet1.Pt()); h1_pt_jets_no_scaled->Fill(p_corrJet1.Pt()); } } // float scale; // cout<<"mi preparo a scale i plot"<Integral(); // h1_pt_AK5PFPUcorrJet->Scale(scale); // h1_pt_jets_no_scaled->Scale(scale); //li scalo cmq all'unita' ma non moltiplico per la sezione d'urto, dovrebbero venire i bozzi return kTRUE; } void ntp1::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. /* // Define output file TFile* output_file = new TFile("output.root", "recreate") ; // Retrieve objects TList* list = proof->GetOutputList() ; TIter next_object((TList*) list); TObject* obj ; cout << "-- Retrieved objects:" << endl ; output_file->cd() ; while ((obj = next_object())) { TString objname = obj->GetName() ; cout << " " << objname << endl ; obj->Write() ; } // Write output file output_file->Write() ; */ // h1_pt_jets_no_scaled->Write(); // h1_pt_AK5PFPUcorrJet->Write(); // output_root->Close(); // fOutput->Add(h1_pt_AK5PFPUcorrJet); // fOutput->Add(h1_pt_jets_no_scaled); } void ntp1::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. // h1_pt_jets_no_scaled->Write(); // h1_pt_AK5PFPUcorrJet->Write(); // output_root->Close(); }