#define parlcomp_cxx // The class definition in parlcomp.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("parlcomp.C") // Root > T->Process("parlcomp.C","some options") // Root > T->Process("parlcomp.C+") // #include "parlcomp.h" #include #include #include "dec.C" void parlcomp::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(); // fHistFile = new TFile("TH2Doutput.root","recreate"); h_match = new TH2F("h_match","h_match",24,0.5,24.5,8,0.5,8.5); //Objects in the output list are filled in the workers, merged and sent back fOutput->Add(h_match); } void parlcomp::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). // Frameworks call Init by themselves, no // Init(tree); TString option = GetOption(); } Bool_t parlcomp::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 parlcomp::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. //learned from www.slac.stanford.edu/BFROOT/www/doc/workbook_kiwi/root3/histAnalysis-CheckMC.C fChain->GetTree()->GetEntry(entry); for(int i = 0; i < chargeAD_calib.size(); ++i){ h_match->Fill(column.at(i),ring.at(i),chargeAD_calib.at(i)); } return kTRUE; } void parlcomp::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 parlcomp::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. // Either use the 'of="TH2Doutput.root"' as option in Process or TH2F *h_match = 0; if ((h_match = (TH2F *) fOutput->FIndObject("h_match"))) { TFile *fout = new TFile("TH2Doutput.root","recreate"); fout->cd(); h_match->Write(); fout->Close(); } }