/// This is a modified version of the COMET event loop. /// This event loops implements the following features: /// 1) It takes a list of 'control sample' classes which select certain events: /// by default the program will select all control samples. /// But the user can also specify which control sample (and control sample file names) /// from the command line; it is expected that this functionality will be used by IcedustControl. /// Do 'oaControlSample_CreateControlSample.exe -h' to see the list of available control samples. /// 2) For each 'control sample' class a separate ROOT output file is created. /// 3) Each selected event has the recon, hits and digits removed before being /// written to file. #include #include #include #include #include #include #include #include #include #include #include #include "EoaCore.hxx" #include "IDatum.hxx" #include "ICOMETEvent.hxx" #include "IMidasFile.hxx" #include "ICOMETInput.hxx" #include "ICOMETOutput.hxx" #include "IOADatabase.hxx" #include "IHandleHack.hxx" #include "ICOMETLog.hxx" #include "cometEventLoop.hxx" #include "IAlignmentId.hxx" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void controlprogramusage(std::string programName){ std::cout << "usage: " << programName << " [options] [input-file] ..." << std::endl << std::endl; std::cout << " This program will create a number of output ROOT files.\n" << " Each file will contain only events that passed a set of cuts\n" << " specified in the program. Only raw information will be saved; no fits/hits/digits." << std::endl; std::cout << "Options:" << std::endl; std::cout << " -m MIDAS input file" << std::endl; std::cout << " -r COMET ROOT file" << std::endl; std::cout << " -n Only read events"; std::cout << std::endl; std::cout << " -s Skip events" << std::endl; std::cout << " -S Will replace 'ControlSample' with in file name.\n" << " If any control sample are explicitly selected using -O option, then -S is disabled." << std::endl; std::cout << " -O = where can be: " << std::endl; std::cout << " bsksmu : Basket Sand Muon Sample " << std::endl; std::cout << " tpcsmu : TPC Sand Muon Sample " << std::endl; std::cout << " fgdsmu : FGD Sand Muon Sample " << std::endl; std::cout << " p0dsmu : P0D Sand Muon Sample " << std::endl; std::cout << " empspl : Emty Spill Sample "<< std::endl; std::cout << " fgdstp : FGD Stopping Cosmic Sample "<< std::endl; std::cout << " fgdpro : FGD Stopping Proton Sample "<< std::endl; std::cout << " fgdcol : FGD Collinear Cosmic Sample "<< std::endl; std::cout << " dsecel : DsECal Electron Sample "<< std::endl; std::cout << " brecel : Barrel ECal Electron Sample "<< std::endl; std::cout << " dsecpr : DsECal Proton Sample "<< std::endl; std::cout << " ecalpi : ECal Pion Sample "<< std::endl; std::cout << " pairel : ECal Pair Produced Electron Sample "<< std::endl; std::cout << " presca : Prescale sample " << std::endl; std::cout << "\n -k This option will suppress the deletion of hits/reco/digits (which is usually done by default) " << std::endl; std::cout << " -t [bpTPEFecC] Only accept these triggers" << std::endl << " b Beam triggers" << std::endl << " p Pedestal/noise triggers" << std::endl << " T TPC laser triggers" << std::endl << " P P0D light injection triggers" << std::endl << " E ECal LED triggers" << std::endl << " F FGD LED triggers" << std::endl << " e Electronics calib triggers" << std::endl << " c TFB cosmic ray triggers" << std::endl << " C FGD cosmic ray triggers" << std::endl; std::cout << std::endl; } using namespace COMET; int cometEventLoop2(int argc, char** argv) { int readCount = 0; int skipCount = 0; std::string programName = argv[0]; char *configName = NULL; std::vector outputFiles; bool fOutputInitialized = false; std::string outputStem = "ControlSample"; /// Define whether we will erase digits and Reco info. bool eraseHitsReco = true; /// Flag for whether we are specifying control samples /// from command line (for IcedustControl) bool useCommandLineCtrl = false; // This is the list of control samples that we want to save. std::vector list_samples; std::vector::iterator list_iter; // If this is not zero, then only accept triggers matched in this mask. unsigned int validTriggersMask = 0; signal(SIGSEGV, SIG_DFL); // Set up the logging code. ICOMETLog::Configure(configName); ICOMETLog::SetLogLevel(ICOMETLog::LogLevel); ICOMETLog::SetDebugLevel(ICOMETLog::WarnLevel); enum { kRootFile, kMIDASFile } fileType = kRootFile; // Process the options. for (;;) { int c = getopt(argc, argv, "c:dHkmn:O:rs:t:"); if (c<0) break; switch (c) { case 'H': { // Debug the handles. EnableHandleRegistry(true); break; } case 'm': { fileType = kMIDASFile; break; } case 'n': { std::istringstream tmp(optarg); tmp >> readCount; break; } case 'r': { fileType = kRootFile; break; } case 's': { std::istringstream tmp(optarg); tmp >> skipCount; break; } case 'S': { outputStem.clear(); std::stringstream tmp(optarg); tmp >> outputStem; break; } case 'O': { std::string option = optarg; std::string value = ""; // If the option is "