示例#1
0
//=================================================
plDAQ2Ped(char *core0 = "" ) { 
  
  char *path=""; 
  TString fullInpName=path;  fullInpName+=core0;
  fullInpName+=".hist.root";  
  fd=new TFile(fullInpName);
  if(! fd->IsOpen()) {
    printf("ERROR: input histo file not found, quit\n",fullInpName.Data());
    return;
  }
  
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  
  // libraries below are needed for DB interface
  assert( !gSystem->Load("StDbBroker")); 
  assert( !gSystem->Load("St_db_Maker")); 
  assert( !gSystem->Load("StEEmcDbMaker"));
  
  assert( !gSystem->Load("StEEmcUtil"));
  assert( !gSystem->Load("StEEmcDAQ2Ped"));

  StChain* chain = new StChain("StChain");

  stDb = new St_db_Maker("StarDb", "MySQL:StarDb");
  
  // for slope fits need a timestamp for pedestals (set by hand for now)
  stDb->SetDateTime(20090424,0);//time stamp for run 10114001
  
  StEEmcDbMaker *myDb=new StEEmcDbMaker("eemcDb");

  HList=new  TObjArray;
  StEEmcDAQ2Ped* daq2ped=new StEEmcDAQ2Ped("daq2ped",fd);
  daq2ped->SetHList(HList);
  
  daq2ped->ChooseSet(0); //sets marker type for slope histos
  daq2ped->MappingFile("crMap.csv"); //file to store Mapmt mapping (sometimes useful)
  chain->Init();
  chain->Make();
  chain->Finish();

  TString out;
  out+="Rnnn";
  out+="ped.hist.root";
  TFile f( out,"recreate");
  assert(f.IsOpen());
  printf("%d histos are written  to '%s' ...\n",HList->GetEntries(),out.Data());
  HList->Write();
  f.Close();
  
}
示例#2
0
int runqa(Int_t run=16020057,Int_t ped=0,Int_t nevents=0,const Char_t *evpdir = "/evp/a/"){
  int day=run/1000;
  LoadLibs();   
  Int_t ierr = 0;
  
  cout << "Constructing the chain" << endl;
  StChain* analysisChain = new StChain("fpsQAChain");
  
  TString dir0 = "MySQL:StarDb";
  TString dir1 = "$STAR/StarDb";
  St_db_Maker *dbMkr = new St_db_Maker( "dbMkr", dir0, dir1 );  
  
  cout << "Constructing StFmsDbMaker" << endl;
  fgtDbMkr = new StFmsDbMaker();
  

  cout << "Constructing the FPS raw daq reader" << endl;
  char filename[200]; 
  sprintf(filename,"%s/%d",evpdir,run);
  //sprintf(filename,"%s/%d_DELETE",evpdir,run);
  daqRdr = new StFpsRawDaqReader( "daqReader", filename);
  //daqRdr->SetDebug();
  
  cout << "Constructing the FPS QA maker" << endl;
  StFpsQaMaker *qaMkr=new StFpsQaMaker("FpsQa");  
  qaMkr->setRun(run);
  qaMkr->setPed(ped);

  cout << "Initializing" << endl;
  ierr = analysisChain->Init();
  
  if( ierr ){
    cout << "Error initializing" << endl;
    return;
  };
  
  if(nevents<=0) nevents = 1<<30; // a big number
  
  cout << "Max nevents = " << nevents << endl;
  for( int i=0; i<nevents && !ierr; ++i ){
    if( i%100 == 0 ) cout << " Eevent= " << i << endl;
    //cout << " Eevent number " << i << endl;
    ierr = analysisChain->Make();    
    analysisChain->Clear();
  };
  cout << "Finish" << endl;
  analysisChain->Finish();
  return 0;
};
示例#3
0
void treeTest(  const TString fList = "temp.list",
                const TString fOutName = "fOut.root",
                Long64_t nEvents = 9999
                ) 
{

	gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
    gROOT->LoadMacro("makeEventList.C");
	loadSharedLibraries();

    TFile* fOut = new TFile(fOutName.Data(),"RECREATE");

    TH1D* hZdc = new TH1D("hZdc","hZdc", 50, 0.5, 5000.5);

	//----------------- Read data using StMuDstMaker ---------------//
	StChain* muChain = new StChain("StChain");
	StMuDstMaker* muMaker = new StMuDstMaker(0,0,"",fList.Data(),"st:MuDst.root", 100, "MuDst");

    muChain->Init();
    Float_t zdcCut = 1623;

    TEventList* eventList = makeEventList(muMaker->chain(), zdcCut);
    muMaker->SetEventList(eventList);
    Long64_t nList = eventList->GetN();
    if(nList < nEvents) {nEvents = nList;}

    for(Int_t i = 0; i <= (nEvents-1); i++)
    {
        muChain->Make();
        Float_t zdcWest = muMaker->muDst()->event()->zdcTriggerDetector().adc(0);
        Float_t zdcEast = muMaker->muDst()->event()->zdcTriggerDetector().adc(4);

        hZdc->Fill(zdcWest);
        hZdc->Fill(zdcEast);


    }

    muChain->Finish();
    fOut->Write();
    fOut->Close();

    delete muChain;
    delete eventList;

}
void runMuDstAna(TString inputFileList, int nFiles, const char* outName) {
  
  gROOT->Macro("loadMuDst.C");
  gSystem->Load("StTpcDb.so");
  gSystem->Load("StDetectorDbMaker.so");
  gSystem->Load("StDbUtilities");
  gSystem->Load("StDbLib.so");
  gSystem->Load("StDbBroker.so");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StTriggerUtilities");
  gSystem->Load("MuDstAna.so");
  
  // List of member links in the chain
  StChain* chain = new StChain;
  StMuDstMaker* muDstMaker = new StMuDstMaker(0, 0, "", inputFileList.Data(), "MuDst", nFiles);
  
  St_db_Maker* dbMk = 0;
  dbMk = new St_db_Maker("StarDb", "MySQL:StarDb", "MySQL:StarDb", "$STAR/StarDb");
  dbMk->SetDebug(0);
  
  StDetectorDbTriggerID* detdbid = StDetectorDbTriggerID::instance();
  
  // Turn off everything but Primary tracks in order to speed up the analysis and eliminate IO
  muDstMaker-> SetStatus("*", 0); // Turn off all branches
  muDstMaker-> SetStatus("PrimaryVertices", 1);
  muDstMaker-> SetStatus("PrimaryTracks", 1);
  muDstMaker-> SetStatus("MuEvent", 1); //.. turn on the useful branches
  muDstMaker-> SetStatus("DetectorStates", 1);
  
  cout << "input list " << inputFileList << endl;

  MuDstAna* analysisMaker = new MuDstAna(muDstMaker, outName);
  
  // Loop over the links in the chain
  chain->Init();
  chain->EventLoop(1,1000000);
  chain->Finish();
  
  // Cleanup
  delete chain;
}
示例#5
0
void SchedulerExample(const char* fileList, const char* outFile="SchedulerExample.root") {
    gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
    loadSharedLibraries();

  // create the chain"
  StChain * chain = new StChain("StChain"); 
  chain->SetDebug(0);

  // now create StMuDstMaker
  // agruments are:
  // 0  : read mode
  // 0  : name mode (has no effect on read mode) 
  // "" : input directory, ignored when filename or fileList is specified
  // fileList : list of files to read
  // "" : filter 
  // 1e9 : maximum number of files to read
  // MuDstMaker : name of the maker
  //cout << " press any key " << endl; cin.ignore();
  //StMuDebug::setLevel(0);
  //  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",fileList,"",10,"MuDstMaker");


  // now add your analysis maker
  //  SchedulerExample* analysis = new SchedulerExample(outFile);
 
  // Init the chain
  chain->Init(); // This should call the Init() method in ALL makers
  chain->PrintInfo();
  
  int iret = 0;
  int iev =0;
  // now loop over events, makers are call in order of creation
  while ( !iret ) {
    cout << "SchedulerExample.C -- Working on eventNumber " << iev++ << endl;
    chain->Clear();
    iret = chain->Make(iev); // This should call the Make() method in ALL makers    
  } // Event Loop
  chain->Finish(); // This should call the Finish() method in ALL makers

}
void RunFmsTrigOverData(int nevents = 1000, const char* mudstfile = "/star/data27/reco/pp500_production_2011/ReversedFullField/P11id/2011/056/12056013/st_physics_12056013_raw_5020002.MuDst.root")
{
  // Load shared libraries
  gROOT->Macro("loadMuDst.C");
  gROOT->Macro("LoadLogger.C");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StFmsTriggerMaker");

  // Create chain
  StChain* chain = new StChain;

  // Instantiate MuDst maker
  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,".",1000,"MuDst");

  // STAR database
  St_db_Maker* starDb = new St_db_Maker("StarDb","MySQL:StarDb");

  // FMS trigger simulator
  StFmsTriggerMaker* fmstrig = new StFmsTriggerMaker;
  fmstrig->useMuDst();

  // Initialize chain
  chain->Init();

  // Event loop
  for (int iEvent = 1; iEvent <= nevents; ++iEvent) {
    chain->Clear();
    int status = chain->Make(iEvent);
    if (status == kStSkip) continue;
    if (status % 10 == kStEOF || status % 10 == kStFatal) break;

    // Test FMS dijet trigger
    if (fmstrig->FmsDijet()) {
      printf("Run=%d Event=%d - Got FMS dijet trigger\n",chain->GetRunNumber(),chain->GetEventNumber());
    }
  } // Event loop
}
void RunJetFinder2012pro(int nevents = 1000000,
const char* indir = "~zchang/2013-08-trgsimu/MuDst/",
const char* MuDst = "st_physics_13109014_raw_1020001.MuDst.root",
//const char* outdir ="~/data05/Run12Jets/",
const char* Jetfile = "st_physics_13109014_raw_1020001.jets.root",
const char* Uefile = "st_physics_13109014_raw_1020001.ueoc.root",
const char *Uefile_Region = "st_physics_13109014_raw_1020001.uereg.root",
const char* Skimfile = "st_physics_13109014_raw_1020001.skim.root"
//, bool useL2 = false
)
{
  cout<<"MuDst file is "<<MuDst<<endl;
  cout<<"JetTree file is "<<Jetfile<<endl;
  cout<<"SkimTree file is "<<Skimfile<<endl;

  gROOT->Macro("loadMuDst.C");
  gROOT->Macro("LoadLogger.C");

  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StTpcDb");
  gSystem->Load("StDbUtilities");
  gSystem->Load("StMcEvent");
  gSystem->Load("StMcEventMaker");
  gSystem->Load("StDaqLib");
  gSystem->Load("StEmcRawMaker");
  gSystem->Load("StEmcADCtoEMaker");
  gSystem->Load("StEmcSimulatorMaker");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StSpinDbMaker");
  gSystem->Load("StEmcTriggerMaker");
  gSystem->Load("StTriggerUtilities");
  gSystem->Load("StMCAsymMaker");
  gSystem->Load("StRandomSelector");
  gSystem->Load("libfastjet.so");
//  gSystem->Load("libCDFConesPlugin.so");
//  gSystem->Load("libEECambridgePlugin.so");
//  gSystem->Load("libJadePlugin.so");
//  gSystem->Load("libNestedDefsPlugin.so");
//  gSystem->Load("libSISConePlugin.so");
  gSystem->Load("libfastjet.so");
  gSystem->Load("libsiscone.so");
  gSystem->Load("libsiscone_spherical.so");
  gSystem->Load("libfastjetplugins.so");
 
  gSystem->Load("StJetFinder");
  gSystem->Load("StJetSkimEvent");
  gSystem->Load("StJets");
  gSystem->Load("StJetEvent");
  gSystem->Load("StUeEvent");
  gSystem->Load("StJetMaker");
  gSystem->Load("StTriggerFilterMaker");
  
   StChain *chain = new StChain;

   StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,indir, MuDst,"",1000);

   StMuDbReader* muDstDb = StMuDbReader::instance();

   StTriggerFilterMaker* filterMaker = new StTriggerFilterMaker;
   //JP0
   filterMaker->addTrigger(380401);
   //JP1
   filterMaker->addTrigger(380402);
   //JP2
   filterMaker->addTrigger(380403);
   //AJP
   filterMaker->addTrigger(380404);
   
   //JP2*L2JetHigh
   //filterMaker->addTrigger(380405);
   //BHT2*BJP1
   //filterMaker->addTrigger(380205);
   //BHT2*BJP1*L2Bgamma
   //filterMaker->addTrigger(380208);
   //EHT0*EJP1*L2Egamma
   //filterMaker->addTrigger(380304);
   //BHT3*L2BW
   //filterMaker->addTrigger(380209);
   //filterMaker->addTrigger(380219);
   //EHT1*L2EW
   //filterMaker->addTrigger(380305);
   
   St_db_Maker* starDb = new St_db_Maker("StarDb","MySQL:StarDb");

   StEEmcDbMaker* eemcDb = new StEEmcDbMaker;

   StSpinDbMaker* spinDb = new StSpinDbMaker;

   StEmcADCtoEMaker* adc = new StEmcADCtoEMaker;
   adc->saveAllStEvent(true);

   StTriggerSimuMaker* simuTrig = new StTriggerSimuMaker;
   simuTrig->useOnlineDB();
   simuTrig->setMC(false);
   simuTrig->askTrigger("JP0");
   simuTrig->askTrigger("JP1");
   simuTrig->askTrigger("JP2");
   simuTrig->askTrigger("AJP");
//   simuTrig->emc->defineTrigger2012(13,"JP0",380401,0x8000);
//   simuTrig->emc->defineTrigger2012(14,"JP1",380402,0x0040);
//   simuTrig->emc->defineTrigger2012(15,"JP2",380403,0x0080);
//   simuTrig->emc->defineTrigger2012(16,"AJP",380404,0x1000);

   simuTrig->useBbc();
   simuTrig->useBemc();
   simuTrig->useEemc();
   simuTrig->bemc->setConfig(StBemcTriggerSimu::kOffline);

   StJetMaker2012* jetmaker = new StJetMaker2012;
   jetmaker->setJetFile(Jetfile);
   jetmaker->setJetFileUe(Uefile);

   StJetSkimEventMaker* skimEventMaker = new StJetSkimEventMaker("StJetSkimEventMaker", muDstMaker, Skimfile);

   StAnaPars* anapars12 = new StAnaPars;
   anapars12->useTpc = true;
   anapars12->useBemc = true;
   anapars12->useEemc = true;

   // The classes available for correcting tower energy for tracks are:
   // 1. StjTowerEnergyCorrectionForTracksMip
   // 2. StjTowerEnergyCorrectionForTracksFraction
   // 3. StjTowerEnergyCorrectionForTracksNull (default: no correction)
   anapars12->setTowerEnergyCorrection(new StjTowerEnergyCorrectionForTracksFraction(1.00));
   anapars12->addTpcCut(new StjTrackCutFlag(0));
   anapars12->addTpcCut(new StjTrackCutNHits(12));
   anapars12->addTpcCut(new StjTrackCutPossibleHitRatio(0.51));
   anapars12->addTpcCut(new StjTrackCutDca(3));
   //DcaD pT dependent cut for pp200 run9
   //   anapars12->addTpcCut(new StjTrackCutDcaPtDependent);
   //DcaT pT dependent cut for pp500 run11, run12
   anapars12->addTpcCut(new StjTrackCutTdcaPtDependent);
   //Don't Need Chi2 cut for Run12 either 
   //anapars12->addTpcCut(new StjTrackCutChi2(0,4));
   anapars12->addTpcCut(new StjTrackCutPt(0.2,200));
   anapars12->addTpcCut(new StjTrackCutEta(-2.5,2.5));
   anapars12->addTpcCut(new StjTrackCutLastPoint(125));

   // BEMC cuts
   anapars12->addBemcCut(new StjTowerEnergyCutBemcStatus(1));
   anapars12->addBemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
   anapars12->addBemcCut(new StjTowerEnergyCutEt(0.2));

   // EEMC cuts
   anapars12->addEemcCut(new StjTowerEnergyCutBemcStatus(1));
   anapars12->addEemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
   anapars12->addEemcCut(new StjTowerEnergyCutEt(0.2));

   // Jet cuts
   anapars12->addJetCut(new StProtoJetCutPt(5,200));
   anapars12->addJetCut(new StProtoJetCutEta(-100,100));
   // Jet Area
   StFastJetAreaPars *JetAreaPars = new StFastJetAreaPars;
   //Anti-kT R=0.6 for run12 jet finding
   // Set anti-kt R=0.6 parameters
   StFastJetPars* AntiKtR060Pars = new StFastJetPars;
   
   AntiKtR060Pars->setJetAlgorithm(StFastJetPars::antikt_algorithm);
   AntiKtR060Pars->setRparam(0.6);
   AntiKtR060Pars->setRecombinationScheme(StFastJetPars::E_scheme);
   AntiKtR060Pars->setStrategy(StFastJetPars::Best);
   AntiKtR060Pars->setPtMin(5.0);
   AntiKtR060Pars->setJetArea(JetAreaPars);
   //Anti-kT R=0.5 for run12 jet finding
   // Set anti-kt R=0.5 parameters
   StFastJetPars* AntiKtR050Pars = new StFastJetPars;
   AntiKtR050Pars->setJetAlgorithm(StFastJetPars::antikt_algorithm);
   AntiKtR050Pars->setRparam(0.5);
   AntiKtR050Pars->setRecombinationScheme(StFastJetPars::E_scheme);
   AntiKtR050Pars->setStrategy(StFastJetPars::Best);
   AntiKtR050Pars->setPtMin(5.0);
   AntiKtR050Pars->setJetArea(JetAreaPars);

   //  jetmaker->addBranch("CdfMidpointR070NHits12",anapars12,CdfMidpointR070Pars);
   //  jetmaker->addBranch("CdfMidpointR070NHits5",anapars5,CdfMidpointR070Pars);
   //  jetmaker->addBranch("CdfMidpointR070EMC",anaparsEMC,CdfMidpointR070Pars);
   jetmaker->addBranch("AntiKtR060NHits12",anapars12,AntiKtR060Pars);
   //  jetmaker->addBranch("AntiKtR060NHits5",anapars5,AntiKtR060Pars);
   //  jetmaker->addBranch("AntiKtR060EMC",anaparsEMC,AntiKtR060Pars);
   jetmaker->addBranch("AntiKtR050NHits12",anapars12,AntiKtR050Pars);
   //  jetmaker->addBranch("AntiKtR050NHits5",anapars5,AntiKtR050Pars);
   //  jetmaker->addBranch("AntiKtR050EMC",anaparsEMC,AntiKtR050Pars);
   StOffAxisConesPars *off050 = new StOffAxisConesPars(0.5);
   StOffAxisConesPars *off060 = new StOffAxisConesPars(0.6);
   jetmaker->addUeBranch("OffAxisConesR050", off050);
   jetmaker->addUeBranch("OffAxisConesR060", off060);
   
  // Run
   chain->Init();
   chain->EventLoop(nevents);
}
示例#8
0
void TestJpsiTopo(int nevents = 1e6, const char* mudstfile = "/star/data28/reco/ppProductionJPsi/FullField/P06id/2006/139/7139023/st_jpsi_7139023_raw_1130010.MuDst.root")
{
  gROOT->Macro("loadMuDst.C");
  gROOT->Macro("LoadLogger.C");

  // Load shared libraries
  gSystem->Load("StTpcDb");
  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StDbUtilities");
  gSystem->Load("StMcEvent");
  gSystem->Load("StMcEventMaker");
  gSystem->Load("StDaqLib");
  gSystem->Load("StEmcRawMaker");
  gSystem->Load("StEmcADCtoEMaker");
  gSystem->Load("StEpcMaker");
  gSystem->Load("StEmcSimulatorMaker");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StTriggerUtilities");

  // Create chain
  StChain* chain = new StChain; 

  // MuDst reader
  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,"",100000,"MuDst");

  // StMuDbReader...
  StMuDbReader* db = StMuDbReader::instance();

  // star database
  St_db_Maker* starDb = new St_db_Maker("StarDb","MySQL:StarDb");

  // Endcap database
  StEEmcDbMaker* eemcDb = new StEEmcDbMaker;

  // Barrel ADC to energy maker
  StEmcADCtoEMaker* adc2e = new StEmcADCtoEMaker;

  // Trigger simulator
  StTriggerSimuMaker* trigSimu = new StTriggerSimuMaker;
  trigSimu->setMC(false);
  trigSimu->useBemc();
  trigSimu->bemc->setConfig(StBemcTriggerSimu::kOffline);

  // Initialize chain
  chain->Init();

  // Event loop
  for (int iEvent = 1; iEvent <= nevents; ++iEvent) {
    chain->Clear();
    int status = chain->Make(iEvent);
    if (status == kStSkip) continue;
    if (status % 10 == kStEOF || status % 10 == kStFatal) break;

    cout << "Run = " << chain->GetRunNumber() << ", Event = " << chain->GetEventNumber() << endl;

    // Test J/psi topology trigger in Run 6
    if (trigSimu->isTrigger(117705) || trigSimu->isTrigger(137705)) {
      // Print number of J/psi candidate BEMC tower pairs that could have fired the J/psi trigger
      cout << "Number of J/psi candidates = " << trigSimu->bemc->numberOfJpsiCandidates() << endl;
      // Loop over J/psi candidates
      for (int i = 0; i < trigSimu->bemc->numberOfJpsiCandidates(); ++i) {
	cout << "J/psi candidate #" << i
	     << ": towerId1 = " << trigSimu->bemc->jpsiCandidateFirstTowerId(i)
	     << ", towerId2 = " << trigSimu->bemc->jpsiCandidateSecondTowerId(i)
	     << endl;
      }	// End loop over J/psi candidates
    }

  } // End event loop
}
示例#9
0
文件: Macro.C 项目: yistand/PicoCode
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;
}
示例#10
0
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;

}
示例#11
0
void bitcheck(int run=16043074, int file=1, int nEvents=10000, int useDSM=1, int plt=0){
  char name[200]; sprintf(name,"trg/run%d.%d.dat",run,file);
  cout << "Reading up to "<<nEvents<<" events from "<<name<<endl;

  LoadLibs();   
   
  StChain* chain = new StChain;
  StIOMaker* iomaker = new StIOMaker("IO","r", name);
  StTriggerDataMaker* trgmaker = new StTriggerDataMaker(); 
  //trgmaker->setDebug(1);
  StFmsTriggerMaker* fmstrg = new StFmsTriggerMaker(); 
  fmstrg->useTrgData();
  fmstrg->forceRunNumber(run);
  if(useDSM==0) fmstrg->useQTSim();
  if(useDSM==1) fmstrg->useDsmData();
  StFmsBitCheckMaker* bitcheck = new StFmsBitCheckMaker();
  bitcheck->setRun(run);
  bitcheck->setPrint(20);
  StFmsTrgQaMaker* qa = new StFmsTrgQaMaker();
  qa->setRun(run);  

  chain->Init();

  if(plt==1){
    c1=new TCanvas("FMS","FMS",700,800);
    gStyle->SetOptStat(111110);
    gStyle->SetStatW(0.4); gStyle->SetStatH(0.4);
    for(int i=0; i<=NX*2; i++){
      int x=i-NX;  
      char tt[100];
      sprintf(tt,"FMS xing=%d",x);
      HF[i]=new TH1F(tt,tt,50,0,5000); HF[i]->SetFillColor(kRed);
      sprintf(tt,"BBC xing=%d",x);      
      HB[i]=new TH1F(tt,tt,50,0,5000); HB[i]->SetFillColor(kRed);
    }
  }

  unsigned long long bxkeep=0;
  for(int iev=0; iev<nEvents; iev++){
    if(iev%100==0) cout << "****event="<<iev<<endl;
    chain->Clear();
    int ierr=chain->Make();
    if(ierr>1) break;

    if(plt==1){      
      StTriggerData *td = (StTriggerData*)chain->GetDataSet("StTriggerData")->GetObject();
      int npre=td->numberOfPreXing();
      int npost=td->numberOfPostXing();
      for(int i=0; i<=2*NX; i++){
	int x=i-NX;  
	if(-x>npre || x>npost) continue;
	int sumF=0, sumB=0;
	for(int crt=1; crt<=4; crt++){
	  for(int adr=0; adr<16; adr++){
	    for(int ch=0; ch<32; ch++){
	      sumF+=td->fmsADC(crt,adr,ch,x);
	    }
	  }
	}
	for(int ch=0; ch<16; ch++){
	  sumB+=td->bbcADC(0,ch,x);
	  sumB+=td->bbcADC(1,ch,x);
	}
	HF[i]->Fill(sumF);
	HB[i]->Fill(sumB);
      }
    }	    
  }
  chain->Finish();  

  if(plt==1){
    c1->Divide(2,NX*2+1);
    for(int i=0; i<=2*NX; i++){
      TVirtualPad *pad1 = c1->cd(i*2+1); pad1->SetLogy(); HF[i]->Draw();
      TVirtualPad *pad2 = c1->cd(i*2+2); pad2->SetLogy(); HB[i]->Draw();
    }
    c1->Update();
    char fname[100];
    sprintf(fname,"fms_%d.png",run);
    c1->SaveAs(fname);
  }

  delete chain;
}
示例#12
0
void run_StMcAccpMaker(const char* file, const char* outfile) 
{
    //Check STAR Library. Please set SL_version to the original star library used 
    // in the production from http://www.star.bnl.gov/devcgi/dbProdOptionRetrv.pl
    string SL_version = "SL12d_embed";
    string env_SL = getenv("STAR");
    if (env_SL.find(SL_version) == string::npos) {
        cout << "Environment Star Library does not match the requested library in run_st_etree.C. Exiting..." << endl;
        return;
    }
    // Load shared libraries
    Load();

    // Create chain
    StChain* chain = new StChain;

    // I/O maker
    StIOMaker* ioMaker = new StIOMaker;
    ioMaker->SetFile(file);
    ioMaker->SetIOMode("r");
    ioMaker->SetBranch("*", 0, "0");
    //ioMaker->SetBranch("McEventBranch",0,"r"); 
    ioMaker->SetBranch("geantBranch", 0, "r");
    ioMaker->SetBranch("eventBranch", 0, "r");

    TString mudstfile = file;
    mudstfile.ReplaceAll(".event.root",".MuDst.root");
    mudstfile.ReplaceAll(".geant.root",".MuDst.root");
    StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile.Data(),"",100000,"MuDst");

    StMcEventMaker *mcEventMaker = new StMcEventMaker();
    mcEventMaker->doPrintEventInfo = false;
    mcEventMaker->doPrintMemoryInfo = false;

    StAssociationMaker* assoc = new StAssociationMaker;
    assoc->useInTracker();

    //.. see example in CVS: StRoot/macros/mudst/exampleEmc.C
    // Need St_db_Maker for Emc calibration
    St_db_Maker* dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
    //dbMk->SetMaxEntryTime(20100301,0);
    //dbMk->SetDateTime(20080101,000001);

    StEEmcDbMaker* eemcDb = new StEEmcDbMaker;
    StEmcADCtoEMaker *adc_to_e = new StEmcADCtoEMaker();
    adc_to_e->saveAllStEvent(kTRUE);

    StEmcSimulatorMaker* emcSim = new StEmcSimulatorMaker(); //use this instead to "redo" converstion from geant->adc
    // Makers for clusterfinding
    StPreEclMaker *pre_ecl = new StPreEclMaker();
    pre_ecl->setPrint(kFALSE);
    StEpcMaker *epc = new StEpcMaker();
    epc->setPrint(kFALSE);

    StTriggerSimuMaker* simuTrig = new StTriggerSimuMaker();
    simuTrig->useOfflineDB();

    simuTrig->setMC(2); // 0=data, 1=simulation, 2=embedding
    simuTrig->useBemc();
    simuTrig->useEemc();
    simuTrig->bemc->setConfig(2); // Online==1, Offline==2, Expert==3
    //   simuTrig->bemc->setConfig(StBemcTriggerSimu::kOffline); 
    int col_energy = 200; //.. option: 200, 62, 39
    // std::vector<unsigned int> triggers;
    // triggers.push_back(370542); //
    // triggers.push_back(370522); //

    
    // Monte Carlo event maker
    StMcAccpMaker* analysis = new StMcAccpMaker(simuTrig,outfile,col_energy);//,triggers);

    // Initialize chain
    chain->Init();
    chain->EventLoop(1000000);
    chain->Finish();

    //delete chain;
}
示例#13
0
文件: runqa.C 项目: star-bnl/star-fgt
int runqa( Int_t runnumber = 14032027, Int_t ped=0, Int_t nevents = 9999999, int zs=1,
	   const Char_t *evpdir = "/evp/a/",
	   Float_t chargrms=1.0, Float_t thr=4.0, Float_t thr2add=3.0, 
	   Bool_t useSeed5=true, Bool_t cutShortEvents = 0){
  
  int day=runnumber/1000;

  LoadLibs();   
  Int_t ierr = 0;
  
  cout << "Constructing the chain" << endl;
  StChain* analysisChain = new StChain("fgtQAChain");
  
  TString dir0 = "MySQL:StarDb";
  TString dir1 = "$STAR/StarDb";
  St_db_Maker *dbMkr = new St_db_Maker( "dbMkr", dir0, dir1 );  
  
  cout << "Constructing StFgtDbMaker" << endl;
  fgtDbMkr = new StFgtDbMaker();
  //dbMkr->SetDateTime(20120401,000000); //run2012???
  
  cout << "Constructing the FGT raw daq reader" << endl;
  char filename[200]; 
  sprintf(filename,"%s/%d",evpdir,runnumber);
  //sprintf(filename,"%s/%d_DELETE",evpdir,runnumber);
  daqRdr = new StFgtRawDaqReader( "daqReader", filename);
  daqRdr->setIsCosmic( false );
  daqRdr->cutShortEvents( cutShortEvents );
  //daqRdr->setStartTbin(1);
  //daqRdr->setNumTbin(8);
  if(zs>0){daqRdr->setZSdataOnly();}
  
  if(ped==1) {
    daqRdr->setNoneZSdataOnly();
    cout << "Loading and Constructing the StFgtPedMaker" << endl;
    gSystem->Load("StFgtPedMaker");
    StFgtRobustPedMaker* pedMkr  = new StFgtRobustPedMaker();
    pedMkr->setFgtDbMkrName("fgtDb");
    pedMkr->setTimeBinMask(0x0);
    pedMkr->setNumBins(4200);
    pedMkr->setMaxAdc(4200);
    pedMkr->setNumSmooth(0);
    sprintf(filename,"%d/ped/ped.%d.txt",day,runnumber);
    pedMkr->setToSaveToFile(filename);

    cout << "Loading and Constructing the Status Maker" << endl;
    gSystem->Load("StFgtStatusMaker");
    StFgtStatusMaker *statMkr = new StFgtStatusMaker( "FgtStatusMaker", "FgtPedMaker" );
    sprintf(filename,"%d/status/status.%d.txt",day,runnumber);
    statMkr->setToSaveToFile(filename);
    statMkr->setTimeBin(0);
    statMkr->setPedRange(200,1000);
    statMkr->setRmsRange(15,200);
    statMkr->setFracRange(0.0,1.0);
    statMkr->setMaxDeadPerApv(128);
  }else{
    cout << "Loading and Constructing the StFgtA2CMaker" << endl;
    gSystem->Load("StFgtA2CMaker");
    StFgtA2CMaker* a2cMkr  = new StFgtA2CMaker(  "FgtA2CMaker" );
    a2cMkr->setFgtDb(fgtDbMkr->getDbTables());
    a2cMkr ->setAbsThres( -5000 );  // set to below -4096 to skip cut
    //    a2cMkr ->setAbsThres( 300 );  // set to below -4096 to skip cut
    //a2cMkr ->setRelThres( 3.);  // set to zero to skip cut
    a2cMkr ->setRelThres(thr);  // set to zero to skip cut
    //    a2cMkr->doCutBadStatus(true);//parameter is useless from looking at the function
    a2cMkr->doCutBadStatus();
    a2cMkr->acceptLongPulses(true);
    ////you have to set the relative threshold to 3 if you set the cluster threshold to 0.6 (meaning 3)
    //a2cMkr->setClusterThreshold(0.6);  
    a2cMkr->setClusterThreshold(thr/5.0);  
    a2cMkr->setPedSigFactor4Charge(chargrms);
    a2cMkr->useLeastRestrictiveSeed(useSeed5);
    ///this cuts ~10% of the events
    //   a2cMkr->doRemoveNonSignal(false);
    //   a2cMkr->doRemoveNonPulse(false);
    a2cMkr->setPedestalFile("ped.txt");
    a2cMkr->setStatusFile("status.txt");
    
    gSystem->Load("StFgtClusterMaker");
    Char_t *myMaker = "StFgtClusterMaker";
    StFgtClusterMaker* clusterMk =new StFgtClusterMaker("FgtClustMaker"); 
    clusterMk->SetDEBUG();
    //  simpleClusAlgo = new StFgtSimpleClusterAlgo();
    seededClusAlgo = new StFgtSeededClusterAlgo();
    seededClusAlgo->setJumpSingleStrip(true); // if a strip in cluster has no charge 
    seededClusAlgo->setThreshold2AddStrip(thr2add); //threshold to add strips to cluster 
    clusterMk->setClusterAlgo( seededClusAlgo );
    
    gSystem->Load("StFgtPointMaker");
    StFgtPointMaker* pointMk =new StFgtPointMaker();
    StFgtSimplePointAlgo * simplePointAlgo = new StFgtSimplePointAlgo();    
    pointMk->setPointAlgo( simplePointAlgo );
    simplePointAlgo->setMaxChargeAsym(0.2);

    gSystem->Load("StFgtClusterTools");
    fgtGenBase=new StFgtGeneralBase("fgtGenBase");
    fgtGenBase->fillFromEvent();
    fgtStraightTrackMaker =new StFgtStraightTrackMaker("fgtStraightTracker");
    fgtStraightTrackMaker->setMinNumFitPoints(3);
    fgtStraightTrackMaker->setMaxClusters(30);
    //fgtStraightPlotter=new StFgtStraightPlotter("fgtStraightPlotter");
    
    gSystem->Load("libMinuit");
    gSystem->Load("StFgtAlignmentMaker");
    StFgtAlignmentMaker* algMk =new StFgtAlignmentMaker();
    algMk->setTrackType(0);
    algMk->setDataSource(2);
    algMk->setRunNumber(runnumber);
    sprintf(filename,"%d/alignment_trkout.%d.root",day,runnumber);
    algMk->setWriteTree(filename);

    gSystem->Load("StFgtQAMaker");
    StFgtQAMaker* qaMkr =new StFgtQAMaker();
    qaMkr->setRunNumber(runnumber);
  }
   
  cout << "Initializing" << endl;
  ierr = analysisChain->Init();
  
  if( ierr ){
    cout << "Error initializing" << endl;
    return;
  };
  
  if( nevents < 0 )
    nevents = 1<<30; // a big number
  
  cout << "max nevents = " << nevents << endl;
  for( int i=0; i<nevents && !ierr; ++i ){
    if( i+1 % 100 == 1 ) cout << "\t on event number **************" << i << endl;
    //cout << "clear (agv)" << endl;
    analysisChain->Clear();
    //cout << "make" << endl;
    ierr = analysisChain->Make();
    //cout <<" done " <<endl;
  };
  
  //   fgtDbMkr->printFgtDumpCSV("fgtMapDump.csv");
  //
  // Calls the ::Finish() method on all makers
  //
  cout << "finish" << endl;
  analysisChain->Finish();
  
  // Now write a status table
  
  /*
    if( runnumber ){
    std::stringstream ss;
    fout << "Times given in the run log are " << endl;
    ss << "lynx -dump 'http://online.star.bnl.gov/RunLogRun12/index.php?r=" << runnumber << "' | grep GMT";
    FILE *f = gSystem->OpenPipe(ss.str().data(),"r");
    Char_t c;
    while((c=fgetc(f))!=EOF)
    fout << c;
    };
  */
  
  bool doOutputPdf=false;
  // convert ps to pdf
  if( doOutputPdf ){
    cout << "converting ps to pdf" << endl;
    gSystem->Exec(( std::string("ps2pdf -dAutoRotatePages=/None ") + pdfFile ).data());
  };
  
  cout << "\tall done" << endl;
  return;
};
示例#14
0
void makeTrees(string fileList, string jobID){

  bool makePairs = true;
	bool makeTrackQA = false;
	
	
//LOAD LIBRARIES
	cout << "\n";
	gROOT->Macro("/star/u/klandry/ucladisk/2012IFF/StRoot/LoadLibs.C");
	if (makePairs)
	{
	  gSystem->Load("pionPair");
	  cout << " loading of pionPair library done" << endl;
	  gSystem->Load("pionPairTreeMaker");
	  cout << " loading of pionPairTreeMaker library done" << endl;
	}
	if (makeTrackQA)
	{
	  gSystem->Load("trackQAmaker");
	  cout << " loading of trackQAmaker library done" << endl;
	}
	
	cout << "\n";
	cout << "\n";

	
//CHAIN OF MAKERS
  StChain* chain = new StChain; 
	
//MUDST READER
  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",fileList.c_str(),"",100000,"MuDst");

	chain->Make(0);
	StMuEvent* MuEvent = muDstMaker->muDst()->event();
	int runID = MuEvent->runId();

	stringstream ss;
	ss << runID;
	string runNumber = ss.str();
	

//StarDbMaker
	St_db_Maker* dbMaker = new St_db_Maker("db", "MySQL:StarDb", "$STAR/StarDb");

//SPINDBMAKER
	StSpinDbMaker* spinDbMaker = new StSpinDbMaker("StSpinDbMaker");
	
	cout << "\n";
	
//pionPairTreemaker
	if (makePairs)
	{
		pionPairTreeMaker* piTreeMaker = new pionPairTreeMaker(muDstMaker);
		string outFileName;
		outFileName  = "run";
		outFileName += runNumber;
		outFileName += "_";
		outFileName += jobID;
		outFileName += "_pionTree.root";
		
		piTreeMaker->setOutputFile(outFileName.c_str());
    cout << "pionPairTree file name: " << outFileName << endl;	
	}
	
//trackQAmaker
	if (makeTrackQA)
	{
		trackQAmaker* trkQAmaker = new trackQAmaker(muDstMaker);
		string trackOutFileName;
		trackOutFileName  = "run";
		trackOutFileName += runNumber;
		trackOutFileName += "_";
		trackOutFileName += jobID;
		trackOutFileName += "_trackQA.root";
		
		trkQAmaker->setOutputFile(trackOutFileName.c_str());
		cout << "track QA file name: " << trackOutFileName << endl;
	}

	
	int iEvent = 0;
	
	cout << "\n";
	cout << "\n";
	cout << "Init() ......." << endl;
	cout << "\n";
	cout << "\n";

	chain->Init();
		
	cout << "\n";
	cout << "\n";
	cout << "Make() ......." << endl;
	cout << "\n";
	cout << "\n";
	
	//int nEvents = 2;
	//chain->EventLoop(nEvents);

	//*
	while (chain->Make(iEvent) == kStOK)
	{
		iEvent++;
	  if (iEvent%100000 == 0) {cout << "processing event number " << iEvent << endl;}
		//if (iEvent >= 10000){break;}
		
	}//end while
	//*/
	

	chain->Finish();
	
	
	delete chain;
	
	

}
示例#15
0
void RunJetFinder2009pro_ue(int nevents = 1E3,
			 const char* mudstfile = "/star/institutions/uky/gdwebb/UE_histos/st_physics_10103041_raw_8030001.MuDst.root",
			 const char* jetfile = "jets_copy.root",
			 const char* skimfile = "skim_copy.root",
			 const char* uefile = "ueTree_copy.root",
			 int mEmbed = 0,
			 int mPythia = 0,
			 bool useL2 = false)
{
  cout << "nevents = " << nevents << endl;
  cout << "mudstfile = " << mudstfile << endl;
  cout << "jetfile = " << jetfile << endl;
  cout << "skimfile = " << skimfile << endl;
  cout << "uefile = " << uefile << endl;

  gROOT->Macro("loadMuDst.C");
  gROOT->Macro("LoadLogger.C");

  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StTpcDb");
  gSystem->Load("StDbUtilities");
  gSystem->Load("StMcEvent");
  gSystem->Load("StMcEventMaker");
  gSystem->Load("StDaqLib");
  gSystem->Load("StEmcRawMaker");
  gSystem->Load("StEmcADCtoEMaker");
  gSystem->Load("StEpcMaker");
  gSystem->Load("StEmcSimulatorMaker");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StSpinDbMaker");
  gSystem->Load("StEmcTriggerMaker");
  gSystem->Load("StTriggerUtilities");
  gSystem->Load("StMCAsymMaker");
  gSystem->Load("StRandomSelector");

  gSystem->Load("libfastjet.so");
  gSystem->Load("libsiscone.so");
  gSystem->Load("libsiscone_spherical.so");
  gSystem->Load("libfastjetplugins.so");

  // gSystem->Load("libfastjet.so");
  // gSystem->Load("libCDFConesPlugin.so");
  // gSystem->Load("libEECambridgePlugin.so");
  // gSystem->Load("libJadePlugin.so");
  // gSystem->Load("libNestedDefsPlugin.so");
  // gSystem->Load("libSISConePlugin.so");
  gSystem->Load("StJetFinder");
  gSystem->Load("StJetSkimEvent");
  gSystem->Load("StJets");
  gSystem->Load("StJetEvent");
  gSystem->Load("StUeEvent");
  gSystem->Load("StJetMaker");
  gSystem->Load("StTriggerFilterMaker");

  StChain* chain = new StChain; 

  // MuDst reader
  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,"",100000,"MuDst");

  // MuDst DB
  StMuDbReader* muDstDb = StMuDbReader::instance();

  // Trigger filter
  StTriggerFilterMaker* filterMaker = new StTriggerFilterMaker;

  // 2009 pp500
  filterMaker->addTrigger(230410); // JP1
  filterMaker->addTrigger(230411); // JP2
  filterMaker->addTrigger(230420); // AJP
  filterMaker->addTrigger(230531); // BHT3

  // star database
  St_db_Maker* starDb = new St_db_Maker("StarDb","MySQL:StarDb");

  // Endcap database
  StEEmcDbMaker* eemcDb = new StEEmcDbMaker;

  // Spin database
  StSpinDbMaker* spinDb = new StSpinDbMaker;

  // Barrel ADC to energy maker
  StEmcADCtoEMaker* adc = new StEmcADCtoEMaker;
  adc->saveAllStEvent(true);

  // Trigger simulator
  StTriggerSimuMaker* simuTrig = new StTriggerSimuMaker;
  simuTrig->useOnlineDB(); // for trigger definitions and thresholds
  simuTrig->setMC(false); // Must be before individual detectors, to be passed

  simuTrig->useBemc();
  simuTrig->useEemc();
  simuTrig->bemc->setConfig(StBemcTriggerSimu::kOffline);

  // L2 (only L2btowCalib, L2etowCalib, L2ped, L2jet in CVS as of 17 April 2010)
  if (useL2) {
    StL2_2009EmulatorMaker* simL2Mk = new StL2_2009EmulatorMaker;
    assert(simL2Mk);
    simL2Mk->setSetupPath("/star/u/pibero/public/StarTrigSimuSetup/");
    simL2Mk->setOutPath("./");
    simuTrig->useL2(simL2Mk);
  }

  // Skim event maker
  StJetSkimEventMaker* skimEventMaker = new StJetSkimEventMaker("StJetSkimEventMaker",muDstMaker,skimfile);

  // Jet maker
  StJetMaker2009* jetmaker = new StJetMaker2009;
  jetmaker->setJetFile(jetfile);
  // UE maker
  StUEMaker2009* uemaker = new StUEMaker2009;
  uemaker->setUeFile(uefile);
  
  // Set analysis cuts for 12-point branch
  StAnaPars* anapars12 = new StAnaPars;
  anapars12->useTpc  = true;
  anapars12->useBemc = true;
  anapars12->useEemc = false;

  // The classes available for correcting tower energy for tracks are:
  // 1. StjTowerEnergyCorrectionForTracksMip
  // 2. StjTowerEnergyCorrectionForTracksFraction
  // 3. StjTowerEnergyCorrectionForTracksNull (default: no correction)
  anapars12->setTowerEnergyCorrection(new StjTowerEnergyCorrectionForTracksFraction(1.00));
 
  //
  // 1. StjTrackPtFraction
  // 2. StjTowerEnergyFraction
  //    The input parameter is the fraction which you want to increase or decrease the track/tower pT/energy. 
  //    i.e. If you want to decrease the track pT by 5%, you should put in -0.05 as the input parameter for StjTrackPtFraction
  //  anapars12->setTrackShift(new StjTrackPtFraction(-0.05));
  // anapars12->setTowerShift(new StjTowerEnergyFraction(-0.05));
  
  // TPC cuts
  anapars12->addTpcCut(new StjTrackCutFlag(0));
  anapars12->addTpcCut(new StjTrackCutNHits(12));
  anapars12->addTpcCut(new StjTrackCutPossibleHitRatio(0.51));
  anapars12->addTpcCut(new StjTrackCutDca(3));
  anapars12->addTpcCut(new StjTrackCutTdcaPtDependent);
  anapars12->addTpcCut(new StjTrackCutPt(0.2,200));
  anapars12->addTpcCut(new StjTrackCutEta(-2.5,2.5));
  anapars12->addTpcCut(new StjTrackCutLastPoint(125));

  // BEMC cuts
  anapars12->addBemcCut(new StjTowerEnergyCutBemcStatus(1));
  anapars12->addBemcCut(new StjTowerEnergyCutAdc(4,3));	// ADC-ped>4 AND ADC-ped>3*RMS
  anapars12->addBemcCut(new StjTowerEnergyCutEt(0.2));

  // EEMC cuts
  anapars12->addEemcCut(new StjTowerEnergyCutBemcStatus(1));
  anapars12->addEemcCut(new StjTowerEnergyCutAdc(4,3));	// ADC-ped>4 AND ADC-ped>3*RMS
  anapars12->addEemcCut(new StjTowerEnergyCutEt(0.2));

  // Jet cuts
  anapars12->addJetCut(new StProtoJetCutPt(5,200));
  anapars12->addJetCut(new StProtoJetCutEta(-100,100));
 
  //---------Region Criteria---------
  anapars12_toward = anapars12; // Toward Region for Tracks and Towers
  anapars12_toward->setTrackRegion(new StjTrackRegion(60.0,-60.0,1.0));
  anapars12_toward->setTowerRegion(new StjTowerRegion(60.0,-60.0,1.0));

  anapars12_away = anapars12; // Away Region for Tracks and Towers
  anapars12_away->setTrackRegion(new StjTrackRegion(120.0,-120.0,1.0));
  anapars12_away->setTowerRegion(new StjTowerRegion(120.0,-120.0,1.0));

  anapars12_transPlus = anapars12; // Trans Plus for Tracks and Towers
  anapars12_transPlus->setTrackRegion(new StjTrackRegion(120.0,60.0,1.0));
  anapars12_transPlus->setTowerRegion(new StjTowerRegion(120.0,60.0,1.0));

  anapars12_transMinus = anapars12; // Trans Minus for Tracks and Towers
  anapars12_transMinus->setTrackRegion(new StjTrackRegion(-60.0,-120.0,1.0));
  anapars12_transMinus->setTowerRegion(new StjTowerRegion(-60.0,-120.0,1.0));
  //---------------------------------

  //Jet Area 
  StFastJetAreaPars *JetAreaPars = new StFastJetAreaPars;
  JetAreaPars->setGhostArea(0.04);
  // Set anti-kt R=0.6 parameters
  StFastJetPars* AntiKtR060Pars = new StFastJetPars;
  AntiKtR060Pars->setJetAlgorithm(StFastJetPars::antikt_algorithm);
  AntiKtR060Pars->setRparam(0.6);
  AntiKtR060Pars->setRecombinationScheme(StFastJetPars::E_scheme);
  AntiKtR060Pars->setStrategy(StFastJetPars::Best);
  AntiKtR060Pars->setPtMin(5.0);
  AntiKtR060Pars->setJetArea(JetAreaPars);

  // Set anti-kt R=0.4 parameters
  StFastJetPars* AntiKtR040Pars = new StFastJetPars;
  AntiKtR040Pars->setJetAlgorithm(StFastJetPars::antikt_algorithm);
  AntiKtR040Pars->setRparam(0.4);
  AntiKtR040Pars->setRecombinationScheme(StFastJetPars::E_scheme);
  AntiKtR040Pars->setStrategy(StFastJetPars::Best);
  AntiKtR040Pars->setPtMin(5.0);
  AntiKtR040Pars->setJetArea(JetAreaPars);

  // Set anti-kt R=0.5 parameters
  StFastJetPars* AntiKtR050Pars = new StFastJetPars;
  AntiKtR050Pars->setJetAlgorithm(StFastJetPars::antikt_algorithm);
  AntiKtR050Pars->setRparam(0.5);
  AntiKtR050Pars->setRecombinationScheme(StFastJetPars::E_scheme);
  AntiKtR050Pars->setStrategy(StFastJetPars::Best);
  AntiKtR050Pars->setPtMin(5.0);
  AntiKtR050Pars->setJetArea(JetAreaPars);

  jetmaker->addBranch("AntiKtR060NHits12",anapars12,AntiKtR060Pars);
  jetmaker->addBranch("AntiKtR040NHits12",anapars12,AntiKtR040Pars);
  jetmaker->addBranch("AntiKtR050NHits12",anapars12,AntiKtR050Pars); 

  uemaker->addBranch("toward",anapars12_toward,"AntiKtR060NHits12");
  uemaker->addBranch("away",anapars12_away,"AntiKtR060NHits12");
  uemaker->addBranch("transP",anapars12_transPlus,"AntiKtR060NHits12");
  uemaker->addBranch("transM",anapars12_transMinus,"AntiKtR060NHits12");


  // Run
  chain->Init();
  chain->EventLoop(nevents);
}
示例#16
0
void starbase( const char *gy="y2006c", 
	       Float_t etaMin=eta_min, 
	       Float_t etaMax=eta_max,
	       Float_t phiMin=phi_min,
	       Float_t phiMax=phi_max, 
	       const Char_t *path="./" )
{

  // Silence ROOT
//  gErrorIgnoreLevel = 9999;

  // Load shared libraries
  if (!loaded) { Load(); loaded = 1; }

  // Create the chain
  StChain *chain =  new StChain;
  TString tsy(gy);
  gSystem->ExpandPathName(tsy);

  // Create the geometry
  gROOT->LoadMacro   ( TString(path)+tsy+".h" );
  gROOT->ProcessLine ( tsy+"()" );
  // gROOT -> ProcessLine( TString( ".x "+tsy+".h" ) );

  std::cout << "Done creating geometry" << std::endl;


  // Create the baseline maker
  StarBASE *mk = new StarBASE("StarBASE",tsy.Data(), 1);

  // Setup fiducial volume
  mk->SetAttr("eta_min", etaMin);
  mk->SetAttr("eta_max", etaMax);
  mk->SetAttr("deta",    deta   );
  mk->SetAttr("phi_min", phiMin);
  mk->SetAttr("phi_max", phiMax);
  mk->SetAttr("dphi",    dphi);
  mk->SetAttr("sample",  nsample);

  // Initialize the chain
  chain->Init();
  steps = mk->steps();

  // Create histograms for all volumes beneath the "HALL" volume.
  steps->bookVolume("HALL");

  // Print out tracking media for all volumes for debug poirposes
  /*
  TIter next( gGeoManager->GetListOfMedia() );
  TGeoMedium *m;
  while ( (m=(TGeoMedium*)next() ) )
    {
      m->SavePrimitive(std::cout);
    }
  */

  // Run the code now
  chain->EventLoop(1);  /// NOTE THE FUGLY HACK TO 
  chain->Finish();

  // Write histograms to disk
  TFile *file = new TFile(Form("%s/%s.root",path,gy),"recreate");
  file->cd();
  mk->GetHistList()->Print();
      mk->GetHistList()->Write();

  // Write the geometry to disk
  gGeoManager->Write();
   
}
示例#17
0
void RunMipHistogramMaker(Int_t nEntries = 1e8,
			 const Char_t* listname="test.list",
			 const Char_t* outfile="testMipFile.root")

{
  gROOT->Macro("LoadLogger.C");
  gROOT->Macro("loadMuDst.C");
  gSystem->Load("StTpcDb");
  gSystem->Load("StDaqLib");
  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StDbUtilities");
  gSystem->Load("StEmcRawMaker");
  gSystem->Load("StMcEvent");
  gSystem->Load("StMcEventMaker");//***
  gSystem->Load("StEmcSimulatorMaker");//***
  gSystem->Load("StEmcADCtoEMaker");
  gSystem->Load("StEpcMaker");
  gSystem->Load("StDbBroker");
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StAssociationMaker");
  gSystem->Load("StTriggerUtilities");
  gSystem->Load("StEmcOfflineCalibrationMaker");

  //Instantiate StChain
  StChain *chain = new StChain;

  TChain *MipChain = new TChain("calibTree");
  Char_t file[300];
  ifstream filelist(listname,ifstream::in);
  while(1){
    filelist >> file;
    if (!filelist.good()) break;
    cout << file << endl;
    MipChain->Add(file);
  }
  
  StEmcOfflineCalibrationMipAnalysis *mipAnalysis = new StEmcOfflineCalibrationMipAnalysis("StEmcOfflineCalibrationMipAnalysis",outfile,MipChain);
  
  //Initialize chain
  chain->Init();
  cout << "Successful Init" << endl;

  //Loop over all Make() in Chain
  for (Int_t iEntry = 0; iEntry < MipChain->GetEntries(); ++iEntry){
    if (MipChain->GetEvent(iEntry) <= 0)
      break;
    
    if (iEntry%10000 == 0)
      cout << "Working on event: " << iEntry << endl;
    
    chain->Clear();
    Int_t iret = chain->Make(iEntry);
    if(iret){
      cout << "Bad return code" << endl;
      break;
    }
  }
  
  chain->Finish();
}