// ---------------------------------------------------------------------------- // $Id: root_EventDisp.C,v 1.8 2001/06/19 19:45:38 masako Exp $ // ---------------------------------------------------------------------------- // $Log: root_EventDisp.C,v $ // Revision 1.8 2001/06/19 19:45:38 masako // Remove cross section. // // Revision 1.7 2001/06/19 16:52:01 toshi // Use gSystem->Getenv() to get Parfiles directory. // // Revision 1.6 2001/05/16 17:48:47 masako // Show the unit of cross section (fb) // // Revision 1.5 2001/05/11 21:52:30 toshi // Remove .so suffix from gSystem->Load("...") in order to call macros from // Windows system. // // Revision 1.4 2001/05/09 21:57:19 toshi // Add CVS tag $Id: root_EventDisp.C,v 1.8 2001/06/19 19:45:38 masako Exp $. // // Revision 1.3 2001/05/04 23:31:48 masako // Show LCDBeam/LCDEventHeader information for example. // // Revision 1.2 2001/05/01 20:29:07 masako // Bug fix. // Correct typo miss. // // // Example file to run Event Display interactively with Root. // // In this file, 1) read generated event (root file) // 2) through Fast MC // 3) make event display // // Apr. 2001 M. Iwasaki // // :: How to run :: // // 1) to call the root, type // // root // // 2) // root [0] .x root_EventDisp.C // // .. that's it. // // For example, if you like to run 3 events, type like // root [0] .x root_EventDisp.C(3) // #include int root_EventDisp(int nEvent=5) { 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"); LCDEvent event; // Open a root file (generator output) Char_t* inputFile = "test.root"; LCDreadRootFile source(inputFile,&event); // Call detector parameter file char* detectorGeomFile = "Silicon.par"; // Silicon //"Large.par"; // Large //"Small.par"; // Small TString s_geomFile(parfile_dir); s_geomFile += detectorGeomFile; 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..) // Call Tracker smearing parameter char* trkSmearFile = "lookup_silicon.nobmcon"; //"lookup_large.nobmcon"; //"lookup_small.nobmcon"; TString s_smearFile(parfile_dir); s_smearFile += trkSmearFile; // Initialize FastMC LCDFastMC fmc(&gp, s_smearFile.Data(), &event); // If you don't want the Cluster merging //fmc.SetNoClusterMerge(); // Setup Event Display LCDEventDisplay evdisp(&gp); //Select Black-White option, if you like //evdisp->SetBlackWhite(); //evdisp.SetNoMUCAL(); // Do not display MUCAL part //evdisp.SetNoHADCAL(); // Do not display HADCAL part //evdisp.SetNoCOIL(); // Do not display COIL part //evdisp.SetTheta(90.); //evdisp.SetPhi(30.); // Event loop Int_t iEvent; for (iEvent = 0; iEvent < nEvent; iEvent++) { if (!source.GetEvent()) break; // Read an event from the ROOT file. fmc.Doit(); // Through Fast simulation. if (iEvent == 0){ // List Event Header information, for example LCDEventHeader* header = (LCDEventHeader*)event.EventHeader(); printf("\n"); printf("Process:: %s\n",header->GetProcessName()); // List beam parameters LCDBeam* beam = (LCDBeam*)event.BEAM(); printf("Ecm = %f\n",beam->GetEcm()); printf("electron polarization : %f positron polarization : %f\n", beam->GetPolElec(), beam->GetPolPosi()); printf("==> effective polarization for electron : %f \n\n", beam->GetEffectivePol()); } evdisp.Draw(&event); // Event Display Int_t a; printf("To get the next event, enter any number (<0 Exit Event loop)\n"); scanf("%d",&a); if (a < 0) break; } return iEvent; }