// ---------------------------------------------------------------------------- // $Id: sio_GoJets.C,v 1.4 2001/06/19 16:52:13 toshi Exp $ // ---------------------------------------------------------------------------- // $Log: sio_GoJets.C,v $ // Revision 1.4 2001/06/19 16:52:13 toshi // Use gSystem->Getenv() to get Parfiles directory. // // Revision 1.3 2001/05/11 21:52:50 toshi // Remove .so suffix from gSystem->Load("...") in order to call macros from // Windows system. // // Revision 1.2 2001/05/09 22:07:18 toshi // Add libSIO2root.so. // Add $Id: sio_GoJets.C,v 1.4 2001/06/19 16:52:13 toshi Exp $. // // // Read the output root file from FullRecon (SIO format). // // Sample program using JetFinder 04/26/2001 Toshi // // :: How to run :: // // 1) to call the root, type // // root // // 2) // root [0] .x sio_GoJets.C // // .. that's it. // // For example, if you like to run 20 events, type like // root [0] .x sio_GoJets.C(20) Int_t sio_GoJets(Int_t nEvent=100) { gROOT->Reset(); TString parfile_dir; parfile_dir += gSystem->Getenv("LCDROOT") ;parfile_dir += "/"; parfile_dir += gSystem->Getenv("LCDVERSION");parfile_dir += "/"; parfile_dir += "ParFiles/"; // In order to refer to shareable libraries in this simple form, // include their paths in a .rootrc file. gSystem->Load("libLCDEvent"); gSystem->Load("libLCDRootAppsUtil"); gSystem->Load("libLCDFastMC"); gSystem->Load("libLCDFullRecon"); gSystem->Load("libLCDPhUtil"); gSystem->Load("libSIO2root"); gSystem->Load("libLCDSIOUtil"); LCDEvent event; // Input Gismo full simulation file Char_t* sioFile = "test_L2_pi0.sio"; LCDreadSIOFile source(sioFile,&event); // Must use the same detector name as Full simulation Char_t* geomFile = "Silicon.par"; //Silicon //"Large.par"; // Large //"Small.par"; // Small TString s_geomFile(parfile_dir); s_geomFile += geomFile; FILE* m_geomfile = fopen(s_geomFile.Data(),"r"); LCDGetParameters gp(m_geomfile); fclose(m_geomfile); Char_t* smearFile = "lookup_silicon.nobmcon"; //"lookup_large.nobmcon"; //"lookup_small.nobmcon"; TString s_smearFile(parfile_dir); s_smearFile += smearFile; // Setup FullRecon LCDFullRecon frec(&gp, s_smearFile.Data(), &event); // Define histograms TH1F *nJets = new TH1F("nJets","# of Jets per Event (y=0.004)",20,0.,20); TH1F *nJets_1 = new TH1F("nJets_1","# of Jets per Event(y=0.006)",20,0.,20); TH1F *nJets_2 = new TH1F("nJets_2","# of Jets per Event(y=0.006, JADE)",20,0.,20); TH1F *JetP = new TH1F("JetP","Jet momentum",100,0.,200); TH1F *JetPhi = new TH1F("JetPhi","JetPhi Angle",100,0.,3.14); TH1F *JetCosTh= new TH1F("JetCosTh","Jet Cos Theta",50,-1.0,1.0); // Setup of JetFinder LCDJetFinder jetfind(0.004); // Default.. DURHAM algorithm TClonesArray veclist("TLorentzVector",100); // Event loop Int_t iEvent; for (iEvent = 0; iEvent < nEvent; iEvent++) { if (!source.GetEvent()) break; //read Gismo full sim. data frec.Doit(); //do full recon. // Look at tracks. Can access them by the [] operator. Int_t nTracks = event.Tracks()->GetEntries(); // Event cut # track >= 2 if (nTracks < 2) continue; veclist.Delete(); // Clean up veclist // Track loop for (Int_t itrk=0 ; itr k At(itrk); TVector3 tP3(trk->GetMomentumVector(0.0)); Double_t E_trk = TMath::Sqrt(tP3.Mag2() + 0.1396*0.1396); // Assume pion mass new(veclist[itrk]) TLorentzVector(); TLorentzVector* tP4=(TLorentzVector*)veclist[itrk]; tP4->SetXYZT(tP3.X(),tP3.Y(),tP3.Z(),E_trk); } // Do Jet Finding jetfind.SetPartList(&veclist); // Input particle 4-vector list jetfind.SetDURHAM(); // Use DURHAM algorithm jetfind.SetYCut(0.004); // Set YCut value jetfind.doFindJets(); // JetFindig Int_t numjets = jetfind.njets(); nJets->Fill(numjets); for(Int_t j = 0; j < numjets; j++){ TLorentzVector* Jet_vec = jetfind.jet4vec(j); TVector3 Pjet = Jet_vec->Vect(); // Jet 3 vector Double_t Jet_mom = Pjet->Mag(); Double_t Jet_cos = (Pjet->Z())/Jet_mom; Double_t Jet_phi = Pjet->Phi(); JetP ->Fill(Jet_mom); JetPhi ->Fill(Jet_phi); JetCosTh->Fill(Jet_cos); } // Example 1 ... Do JetFindong with different Y-cut jetfind.SetYCut(0.0060); // Set different YCut value jetfind.doFindJets(); // JetFinding Int_t numjets_1 = jetfind->njets(); nJets_1->Fill(numjets_1); // Example 2 ... Do JetFindong with different Algorithm jetfind.SetJADE(); // Use JADE algorithm jetfind.doFindJets(); // JetFinding Int_t numjets_2 = jetfind->njets(); nJets_2->Fill(numjets_2); } veclist.Delete(); nJets ->SetFillColor(4); nJets_1 ->SetFillColor(4); nJets_2 ->SetFillColor(4); JetP ->SetFillColor(4); JetPhi ->SetFillColor(4); JetCosTh->SetFillColor(4); TCanvas *c1 = new TCanvas("c1", "c1", 600,600); c1->Divide(2,3); c1->cd(1); nJets->Draw("B"); c1->cd(2); nJets_1->Draw("B"); c1->cd(3); nJets_2->Draw("B"); c1->cd(4); JetP->Draw("B"); c1->cd(5); JetPhi->Draw("B"); c1->cd(6); JetCosTh->Draw("B"); return iEvent; }