#define event_cxx // The class definition in event.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("event.C") // Root > T->Process("event.C","some options") // Root > T->Process("event.C+") // #include "event.h" #include #include void event::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(); //--------------------------- // My Stuff Nevents = 0; // Efficiency histos. We want to view efficiency as a function of // energy, angle and number of sigmas. The numerator is therefore // stored as a 3-D histo with num. sigmas in E as the z-dimension. The // denominator is only a 2-D histo and is used to normalize projections // of the numerator histo. Int_t Nbins_theta = 100; Double_t theta_min = 10.0; // degrees Double_t theta_max = 110.0; // degrees Int_t Nbins_E = 300; Double_t Emin = 0.0; Double_t Emax = 3.0; Int_t Nbins_sigmas = 100.0; Double_t sigmas_min = 0.0; Double_t sigmas_max = 20.0; eff_numerator = new TH3D("eff_numerator", "Numerator for efficiency calculation", Nbins_theta, theta_min, theta_max, Nbins_E, Emin, Emax, Nbins_sigmas, sigmas_min, sigmas_max); eff_denominator = new TH2D("eff_denominator", "Denominator for efficiency calculation", Nbins_theta, theta_min, theta_max, Nbins_E, Emin, Emax); // Theta resolution histos Int_t Nbins_theta_diff = 500.0; Double_t theta_diff_min = -30.0; // degrees Double_t theta_diff_max = +30.0; // degrees theta_diff = new TH3D("theta_diff", "#theta_{recon} - #theta_{gen}", Nbins_theta, theta_min, theta_max, Nbins_E, Emin, Emax, Nbins_theta_diff, theta_diff_min, theta_diff_max); // Energy resolution histos Int_t Nbins_E_diff = 400.0; Double_t E_diff_min = -1.0; // fraction of total E Double_t E_diff_max = +1.0; // fraction of total E E_diff = new TH3D("E_diff", "(E_{recon} - E_{gen})/E_{gen}", Nbins_theta, theta_min, theta_max, Nbins_E, Emin, Emax, Nbins_E_diff, E_diff_min, E_diff_max); //--------------------------- } void event::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(); } Bool_t event::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 event::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. GetEntry(entry); Nevents++; // Copy values into more useful objects TLorentzVector thrown(thrown_fP_fX, thrown_fP_fY, thrown_fP_fZ, thrown_fE); // Only interested in first reconstructed photon TLorentzVector recon(0.0, 0.0, 0.0, 0.0); Double_t dist = -1.0; Double_t tag = -1.0; Int_t idx = -1; if(recon_>0){ recon.SetXYZT(recon_p_fP_fX[0], recon_p_fP_fY[0], recon_p_fP_fZ[0], recon_p_fE[0]); dist = recon_dist[0]; tag = recon_tag[0]; idx = recon_idx[0]; } // Fill histos double theta_degrees = thrown.Theta()*57.3; double Ethrown = thrown.E(); double sigma = 0.055*sqrt(Ethrown); eff_denominator->Fill(theta_degrees, Ethrown); if(recon_>0){ double deltaE = recon.E() - Ethrown; double deltaTheta = recon.Theta()*57.3 - theta_degrees; eff_numerator->Fill(theta_degrees, Ethrown, fabs(deltaE)/sigma); E_diff->Fill(theta_degrees, Ethrown, deltaE/Ethrown); theta_diff->Fill(theta_degrees, Ethrown, deltaTheta); } if((Nevents%1000) == 0)cout<