void runDummyElecSim(const char* file, int events=10, const char* options="") { // This is an dummyElecSim of a root macro to run a selector that is // intended as a dummyElecSim for user code. To write your own user // code (assume you are writing a pizero analysis), copy // "IDummyDetRespSelector.h" to "pizeroSelector.h", // "IDummyDetRespSelector.C" to "pizeroSelector.C, and "runDummyElecSim.C" // to "runPizero.C". Then so a global search and replace of // "dummyElecSim" with "pizero" in all of the new files. Add your // analysis code to pizeroSelector::Process() in // pizeroSelector.C. // // You can run your code with the following command: // // root -b -q runPizero.C // // One minor warning: ROOT has *extremely* slow print functions, // so don't print a lot of stuff in your analysis. printf("\nrun dummyElecSim Selector\n"); // Add include paths for any other libraries that you use here. gSystem->AddIncludePath("-I$OAEVENTROOT/src"); gSystem->AddIncludePath("-I$SIMDETECTORRESPONSEROOT/src"); // Load any other libraries that you use here. gSystem->Load("liboaEvent"); gSystem->Load("libSimDetectorResponse"); // Attach to the file. TFile f(file); // Read the detector geometry into memory. TGeoManager *g = dynamic_cast(f.Get("COMETGeometry")); // Build the node cache. g->GetCache()->BuildIdArray(); /// Get the tree of events. TTree *t = dynamic_cast(f.Get("COMETEvents")); // Run the dummyElecSim selector. t->Process("IDummyDetRespSelector.C+",options,events); }