// ---------------------------------------------------------------------------- // $Id: stdhep_GoThrust.C,v 1.5 2001/06/19 16:52:18 toshi Exp $ // ---------------------------------------------------------------------------- // $Log: stdhep_GoThrust.C,v $ // Revision 1.5 2001/06/19 16:52:18 toshi // Use gSystem->Getenv() to get Parfiles directory. // // Revision 1.4 2001/05/11 21:53:01 toshi // Remove .so suffix from gSystem->Load("...") in order to call macros from // Windows system. // // Revision 1.3 2001/05/10 23:04:01 toshi // Add gSystem->Load("libLCDStdHEPUtil.so") according to changes LCDROOT ver3.2. // // Revision 1.2 2001/05/09 22:10:17 toshi // Add $Id: stdhep_GoThrust.C,v 1.5 2001/06/19 16:52:18 toshi Exp $. // // // Run Fast MC interactively with Root // Sample program using EventShape 04/26/2001 Toshi // // // :: How to run :: // // 1) to call the root, type // // root // // 2) // root [0] .x stdhep_GoThrust.C // // .. that's it. // // For example, if you like to run 300 events, type like // root [0] .x stdhep_GoThrust.C(300) // #include Int_t stdhep_GoThrust(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("libLCDPhUtil"); gSystem->Load("libLCDStdHEPUtil"); LCDEvent event; // Input stdhep data Char_t* stdFile = "test.dat"; LCDreadStdFile source(stdFile,&event); // Open detector parameter file 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); // If you want to change some detector parameter(s) for FastMC // do here // For example.. //gp.SetMagneticField(2.); // Change Magnetif field //gp.SetCoilinHAD(); // Set HAD inside the Coil (This case // you need to change some detector size also..) // Tracking smearing parameter file Char_t* smearFile = "lookup_silicon.nobmcon"; //"lookup_large.nobmcon"; //"lookup_small.nobmcon"; TString s_smearFile(parfile_dir); s_smearFile += smearFile; // Initialize FastMC LCDFastMC fmc(&gp,s_smearFile.Data(),&event); // If you don't want the Cluster merging //fmc.SetNoClusterMerge(); // Define histograms TH1F *THRUST = new TH1F("THRUST","Thrust", 50,0.,1.); TH1F *MAJOR = new TH1F("MAJOR ","Major ", 50,0.,1.); TH1F *MINOR = new TH1F("MINOR ","Minor ", 50,0.,1.); TH1F *THRUSTDIRZ = new TH1F("THRUSTDIRZ","Thrust Direction Z", 50,-1.,1.); // Set up Thrust Finder LCDEventShape eshape; TClonesArray veclist("TVector3",100); // Event loop Int_t iEvent; Int_t itrk; LCDTrack* trk; for (iEvent = 0; iEvent < nEvent; iEvent++) { if (!source.GetEvent()) break; // Read an event from the stdhep file. fmc.Doit(); // Through FastMC // 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 (itrk=0; itrk < nTracks; itrk++) { trk = (LCDTrack*)event.Tracks()->At(itrk); new(veclist[itrk]) TVector3(); TVector3* ptrk=(TVector3*)veclist[itrk]; *ptrk=trk->GetMomentumVector(0.0); //Make particle 3-vector list } // Do Thrust Finding eshape.SetPartList(&veclist); // Input particle 3-vector list Double_t thrust = eshape.GetThrust(); Double_t major = eshape.GetMajor(); Double_t minor = eshape.GetMinor(); THRUST->Fill(thrust); MAJOR ->Fill(major); MINOR ->Fill(minor); THRUSTDIRZ->Fill(eshape.GetThrustAxis()->Z()); } veclist.Delete(); THRUST ->SetFillColor(4); MAJOR ->SetFillColor(4); MINOR ->SetFillColor(4); THRUSTDIRZ->SetFillColor(4); TCanvas *c1 = new TCanvas("c1", "c1", 600,600); c1->Divide(2,2); c1->cd(1); THRUST->Draw("B"); c1->cd(2); MAJOR->Draw("B"); c1->cd(3); MINOR->Draw("B"); c1->cd(4); THRUSTDIRZ->Draw("B"); return iEvent; }