void Macro(int nEvents = 1e5, const char* filelist = "test.list", const char* nametag = "test", int nFiles = 8 ) { gROOT->Macro("LoadLogger.C"); gROOT->Macro("loadMuDst.C"); gSystem->Load("StarMagField.so"); gSystem->Load("StMagF"); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StTpcDb"); gSystem->Load("St_db_Maker"); gSystem->Load("StDbUtilities"); gSystem->Load("StMcEvent"); gSystem->Load("StMcEventMaker"); gSystem->Load("StDaqLib"); gSystem->Load("StEmcRawMaker"); gSystem->Load("StEmcADCtoEMaker"); gSystem->Load("StEpcMaker"); gSystem->Load("StTriggerUtilities"); gSystem->Load("StDbBroker"); gSystem->Load("libgeometry_Tables"); gSystem->Load("StEEmcUtil"); gSystem->Load("StEEmcDbMaker"); gSystem->Load("StPreEclMaker"); gSystem->Load("StEpcMaker"); gSystem->Load("libTStarJetPico.so"); gSystem->Load("JetPicoMaker"); StChain* chain = new StChain("StChain"); // MuDst maker StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",filelist,"",nFiles); // star database St_db_Maker *dbMaker = new St_db_Maker("StarDb","MySQL:StarDb"); // Endcap database StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb"); // Barrel ADC to energy maker StEmcADCtoEMaker *adc = new StEmcADCtoEMaker(); StPreEclMaker *pre_ecl = new StPreEclMaker(); StEpcMaker *epc = new StEpcMaker(); //get control table so we can turn off BPRS zero-suppression and save hits from "bad" caps controlADCtoE_st* control_table = adc->getControlTable(); control_table->CutOff[1] = -1; control_table->CutOffType[1] = 0; control_table->DeductPedestal[1] = 2; adc->saveAllStEvent(kTRUE); StTriggerSimuMaker* trigsim = new StTriggerSimuMaker(); trigsim->setMC(false); trigsim->useBemc(); trigsim->useEemc(); //trigsim->useBbc(); trigsim->useOnlineDB(); trigsim->bemc->setConfig(StBemcTriggerSimu::kOnline); StMuJetAnalysisTreeMaker *ana = new StMuJetAnalysisTreeMaker; ana->SetVerbose(10); ana->setRootFile(Form("pAu15Pico_%s.root",nametag)); ana->SetFlagData(12); //For pAu Y15 ana->GetV0Cuts()->SetStandardCutspp(); ana->SetDoV0s(kFALSE); //TString outfile(name); //StEmcOfflineCalibrationMaker* bemcCalibMaker = new StEmcOfflineCalibrationMaker("bemcCalibMaker",outfile.Data()); StMemStat memory; memory.PrintMem(NULL); chain->Init(); cout<<"chain initialized"<<endl; TStopwatch total; TStopwatch timer; int i=0; while(i<nEvents && chain->Make()==kStOk) { if(i % 100000 == 0){ cout<<"done with event "<<i; cout<<"\tcpu: "<<timer.CpuTime()<<"\treal: "<<timer.RealTime()<<"\tratio: "<<timer.CpuTime()/timer.RealTime();//<<endl; timer.Start(); memory.PrintMem(NULL); } i++; chain->Clear(); } chain->ls(3); chain->Finish(); printf("my macro processed %i events in %s",i,nametag); cout<<"\tcpu: "<<total.CpuTime()<<"\treal: "<<total.RealTime()<<"\tratio: "<<total.CpuTime()/total.RealTime()<<endl; cout << endl; cout << "-------------" << endl; cout << "(-: Done :-) " << endl; cout << "-------------" << endl; cout << endl; }
void SkimPion(const char* fileList, const char* fileId="Skim.root") { int flagMC=0; // 0== off, 1=Alan int useEemc=1; // 0== off int useBemc=1; // 0== off int useL2=1; // 0== off int L2ConfigYear=2006; // possible: 2006, 2008 int bemcConfig=2; // enum: kOnline=1, kOffline, kExpert int playConfig=100; // jan:100_199 int emcEveDump=0; // extrating raw EMC data in a custom format const char *dirIn=""; int nFiles = 100000; // make this big if you want to read all events from a run char *eemcSetupPath="/afs/rhic.bnl.gov/star/users/kocolosk/public/StarTrigSimuSetup/"; TString outDir="./out2/"; gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); loadSharedLibraries(); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StDbUtilities"); gSystem->Load("StDbBroker"); gSystem->Load("St_db_Maker"); gSystem->Load("StEEmcUtil"); gSystem->Load("StEEmcDbMaker"); gSystem->Load("StarMagField"); gSystem->Load("geometry"); gSystem->Load("St_g2t"); gSystem->Load("St_geant_Maker"); gSystem->Load("StDaqLib"); gSystem->Load("StEmcRawMaker"); gSystem->Load("StEmcADCtoEMaker"); gSystem->Load("StTriggerUtilities"); gSystem->Load("StEpcMaker"); gSystem->Load("StSpinDbMaker"); // Renees Trigger Maker //gSystem->Load("StEmcTriggerMaker"); // Mikes relative luminosity interface gSystem->Load("StEsRelLum"); //Load your maker here gSystem->Load("StSkimPionMaker"); gROOT->Macro("LoadLogger.C"); cout << "loading done " << endl; StChain *chain = new StChain("StChain"); StMuDstMaker *mudst_mk = new StMuDstMaker(0,0,"",fileList,"MuDst.root",999); // MuDST reader //StMuDbReader StMuDbReader* db = StMuDbReader::instance(); // Need St_db_Maker for Emc calibration St_db_Maker *db1 = new St_db_Maker("StarDb","$STAR/StarDb","MySQL:StarDb"); //Database interface, needed for prescales StDetectorDbMaker* detDbMk = new StDetectorDbMaker(); // Database for Spin data StSpinDbMaker *spDb=new StSpinDbMaker("spinDb"); //Endcap DB if(useEemc || useL2) new StEEmcDbMaker("eemcDb"); // Maker to apply calibration StEmcADCtoEMaker *adc_to_e=new StEmcADCtoEMaker(); adc_to_e->setPrint(kFALSE); //adc_to_e->saveAllStEvent(true); //Collect all output histograms TObjArray* HList = new TObjArray; //Get TriggerMaker StTriggerSimuMaker *simuTrig = new StTriggerSimuMaker("StarTrigSimu"); simuTrig->setHList(HList); simuTrig->setMC(flagMC); // must be before individual detectors, to be passed simuTrig->useBbc(); if(useEemc) { simuTrig->useEemc(0);//default=0:just process ADC, 1,2:comp w/trgData,see . simuTrig->eemc->setSetupPath(eemcSetupPath); } if(useBemc) { simuTrig->useBemc(); simuTrig->bemc->setConfig(bemcConfig); } if(1) { /* reads all input/setup files from L2setup-yyyymmdd/ writes all output files to L2out-yyyymmdd depending on the DB time stamp both dierectiorie MUST exist, setup must be reasonable */ StGenericL2Emulator* simL2Mk=0; if(L2ConfigYear==2006) simL2Mk= new StL2_2006EmulatorMaker; else if(L2ConfigYear==2008) simL2Mk= new StL2_2008EmulatorMaker; assert(simL2Mk); simL2Mk->setSetupPath(eemcSetupPath); simL2Mk->setOutPath(outDir.Data()); if (flagMC) simL2Mk->setMC(); //simL2Mk->useStEvent(); // default : use muDst simuTrig->useL2(simL2Mk); } // Makers for clusterfinding StPreEclMaker *pre_ecl=new StPreEclMaker(); pre_ecl->setPrint(kFALSE); StEpcMaker *epc=new StEpcMaker(); epc->setPrint(kFALSE); //StEmcTrigger //StEmcTriggerMaker *emcTrig = new StEmcTriggerMaker("StEmcTriggerMaker"); //emcTrig->setDbMaker(db1); // now add your analysis maker StSkimPionMaker* analysis = new StSkimPionMaker("SkimPionMaker", 1, fileId); chain->ls(3); chain->Init(); //Tight cuts (esp. SMD) Int_t sizeMax = 4; Float_t energySeed = 0.4; // default is 0.7, usually 0.35 Float_t energyAdd = 0.05; // default is 0.07, usually 0.035 pre_ecl->SetClusterConditions("bemc", sizeMax, energySeed, energyAdd, 0.02, kFALSE); // defaults for SMDs are ("...", 5, 0.4, 0.001, 0.1, kFALSE) pre_ecl->SetClusterConditions("bsmde", 5, 0.4,0.005, 0.1,kFALSE); // used 5, 0.2, 0.0005, 0.1 pre_ecl->SetClusterConditions("bsmdp", 5, 0.4,0.005, 0.1,kFALSE); pre_ecl->SetClusterConditions("bprs", 1, 500., 500., 501., kFALSE); // TStopwatch totaltime; TStopwatch timer; TMemStat memory; Int_t n_event=100000000; int total =0; cout << "Chain initialized, starting up... " << endl; for(Int_t iev=0;iev<n_event; iev++) { cout << "****************************************** " << endl; cout << "\Processing Event " << iev << " of "<< n_event << endl; cout << "*************************1***************** " << endl; chain->Clear(); if(iev % 500 == 0){ cout<<"done with event "<<iev; cout<<"\tcpu: "<<timer.CpuTime()<<"\treal: "<<timer.RealTime()<<"\tratio: "<<timer.CpuTime()/timer.RealTime()<<endl; timer.Start(); memory.PrintMem(NULL); } int iret = chain->Make(iev); total++; if(iret % 10 == kStEOF || iret % 10 == kStFatal) { cout << "Bad return code!" << endl; break; } } chain->Finish(); cout << "****************************************** " << endl; cout << "total number of events " << total << endl; cout << "****************************************** " << endl; }