#define Tree1_cxx // The class definition in Tree1.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 everytime 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("Tree1.C") // Root > T->Process("Tree1.C","some options") // Root > T->Process("Tree1.C+") // #include "Tree1.h" #include #include // new #include #include "TCanvas.h" #include "TROOT.h" //#include "Tree2.h" //#include "Tree3.h" // create new object //Tree2 bis; //Tree3 bis2; ClassImp(Tree1) void Tree1::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). // load dictionary gROOT->ProcessLine("#include "); TString option = GetOption(); printf("Starting the main code (Tree1) with process option: %s\n",option.Data()); } void Tree1::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). // Tree2 //TFile *f = new TFile("/direct/usatlas+groups+higgs/tarrade/Samples/HiggsToTauTau-00-00-44/user.TARRADEFabien.misal1_mc12.005334.HerwigVBFH120tautaulh.A12.0.6.7.NewTest_atlfast.AAN.AANT1._00001.root"); //TTree *fast = (TTree*)f->Get("FastSim0"); //printf("new tree Tree2\n"); // bis.Init(fast); // Tree3 //TFile *f1 = new TFile("/direct/usatlas+groups+higgs/tarrade/Samples/HiggsToTauTau-00-00-44/user.TARRADEFabien.misal1_mc12.005334.HerwigVBFH120tautaulh.A12.0.6.7.NewTest_atlfast.AAN.AANT1._00001.root"); //TTree *truth = (TTree*)f1->Get("Truth0"); //printf("new tree Tree3 \n"); //bis2.Init(truth); //initialize the Tree branch addresses(""); Init(tree); TString option = GetOption(); //new printf("Starting Init(multi tree) with process option: %s\n",option.Data()); hhiggsmass = new TH1F("hhiggsmass","higgs mass",40,0,200000); hhiggsmass_fast = new TH1F("hhiggsmass_fast","higgs mass fast sim",40,0,200000); hhiggsmass_truth = new TH1F("hhiggsmass_truth","higgs mass fast sim",40,0,200000); fOutput->Add(hhiggsmass); fOutput->Add(hhiggsmass_fast); fOutput->Add(hhiggsmass_truth); } Bool_t Tree1::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 Tree1::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. //new //fChain->GetTree()->GetEntry(entry); b_Higgs_N->GetEntry(entry); b_Higgs_m->GetEntry(entry); //fill some histograms if(Higgs_N>0){ hhiggsmass->Fill( (*Higgs_m)[0] ); } //new //bis.fChain->GetTree()->GetEntry(entry); //bis.b_Higgs_N->GetEntry(entry); //bis.b_Higgs_m->GetEntry(entry); //fill some histograms //if(bis.Higgs_N>0){ //hhiggsmass_fast->Fill( (*bis.Higgs_m)[0] ); //} //bis2.fChain->GetTree()->GetEntry(entry); //bis2.b_Higgs_N->GetEntry(entry); //bis2.b_Higgs_m->GetEntry(entry); //fill some histograms //if(bis2.Higgs_N>0){ //hhiggsmass_truth->Fill( (*bis2.Higgs_m)[0] ); //} return kTRUE; } void Tree1::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 Tree1::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. // new hhiggsmass = dynamic_cast(fOutput->FindObject("hhiggsmass")); hhiggsmass_fast = dynamic_cast(fOutput->FindObject("hhiggsmass_fast")); hhiggsmass_truth = dynamic_cast(fOutput->FindObject("hhiggsmass_truth")); //create the canvas for the h1analysis fit gStyle->SetOptFit(); TCanvas *c1 = new TCanvas("c1","example",10,10,800,600); c1->SetBottomMargin(0.15); //hhiggsmass_fast->SetLineColor(4); //hhiggsmass_truth->SetLineColor(2); hhiggsmass->GetXaxis()->SetTitle("Higgs mass"); hhiggsmass->GetXaxis()->SetTitleOffset(1.4); //hhiggsmass_truth->Draw(""); //hhiggsmass_fast->Draw("SAME"); //hhiggsmass->Draw("SAME"); hhiggsmass->Draw(); }