コード例 #1
0
ファイル: exampleFix.C プロジェクト: star-bnl/star-muDst
void exampleFix() {

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

  cout << " loading done " << endl;
  
  StMuDebug::setLevel(0);  // switch of some debug output

  int iret=0;
  maker = new StMuDstMaker(0,0,"MuDST/central/ReversedFullField/runs/","","MuDst");   // set up maker in read mode
  for (int i=0; i<100; i++) {
    iret = maker->Make();  // read an event 
    if (iret) break;

    StMuDst* dst = maker->muDst();
    dst->fixTrackIndices();
    int n = maker->muDst()->primaryTracks()->GetEntries();  // get number of primary tracks
    for (int i=0; i<n; i++) {
      StMuTrack* primaryTrack = maker->muDst()->primaryTracks(i);     // get pointer to primary track
      printf("momentumPrimary=%8f ",primaryTrack->p().mag());
      if (primaryTrack->globalTrack()) {
	printf("momentumGlobal=%8f ratio=%8f\n",primaryTrack->globalTrack()->p().mag(),primaryTrack->p().mag()/primaryTrack->globalTrack()->p().mag());
      }
    }
  }
}
コード例 #2
0
ファイル: exampleStEvent.C プロジェクト: star-bnl/star-muDst
void exampleStEvent() {
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  cout << " loading done " << endl;
  
  StMuDebug::setLevel(0);  // switch of some debug output
 
  int iret=0;
  maker = new StMuDstMaker(0,0,"","AuAu200.lis","MuDst.root:st_physics",3);   // set up maker in read mode

  StMuDbReader* db = StMuDbReader::instance();
  db->addDb("/star/u/laue/afsWork/P02g.db");

  StEvent* ev=0;
  int n;
  while ( maker->Make()==0 ) {
    cout << n++ << " ";
    cout.flush();
    StMuDst* mu = maker->muDst();
    if (mu) ev = mu->createStEvent();
    if (ev) delete ev; ev=0;
  }
  cout << endl;

}
コード例 #3
0
void runPicoNpeEventMaker(const Char_t *inputFile="test.list", const Char_t *outputFile="test")
{ 
  //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 = "SL15c";
  string env_SL = getenv ("STAR");
  if(env_SL.find(SL_version)==string::npos)
  {
      cout<<"Environment Star Library does not match the requested library in runPicoNpeEventMaker.C. Exiting..."<<endl;
      exit(1);
  }

  Int_t nEvents = 10000000;
	
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
	loadSharedLibraries();

	gSystem->Load("StPicoDstMaker");
  gSystem->Load("StPicoPrescales");
  gSystem->Load("StPicoNpeEventMaker");

	chain = new StChain();

	StPicoDstMaker* picoDstMaker = new StPicoDstMaker(0,inputFile,"picoDstMaker");
  StPicoNpeEventMaker* picoNpeMaker = new StPicoNpeEventMaker("picoNpeMaker",picoDstMaker,outputFile);

	chain->Init();
	cout<<"chain->Init();"<<endl;
	int total = picoDstMaker->chain()->GetEntries();
  cout << " Total entries = " << total << endl;
  if(nEvents>total) nEvents = total;

	for (Int_t i=0; i<nEvents; i++)
  {
	  if(i%1000==0)
		cout << "Working on eventNumber " << i << endl;
		
	  chain->Clear();
	  int iret = chain->Make(i);
		
	  if (iret) { cout << "Bad return code!" << iret << endl; break;}

	  total++;
	}
	
	cout << "****************************************** " << endl;
	cout << "Work done... now its time to close up shop!"<< endl;
	cout << "****************************************** " << endl;
	chain->Finish();
	cout << "****************************************** " << endl;
	cout << "total number of events  " << nEvents << endl;
	cout << "****************************************** " << endl;
	
	delete chain;
}
コード例 #4
0
ファイル: plDAQ2Ped.C プロジェクト: star-bnl/star-emc
//=================================================
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();
  
}
コード例 #5
0
ファイル: readPicoDst.C プロジェクト: zaglamir/anaTree
void readPicoDst(const Char_t *inputFile="test.list", const Char_t *outputFile="test.root")
{
	Int_t nEvents = 200000000;
	//  Int_t nEvents = 1000;	
	//Load all the System libraries

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

	gSystem->Load("StPicoDstMaker");
	gSystem->Load("StMyAnalysisMaker");
	gSystem->Load("StMyTreeMaker");

	chain = new StChain();

	StPicoDstMaker *picoMaker = new StPicoDstMaker(0,inputFile,"picoDst");
	StPicoAnaTreeMaker *treeMaker = new StPicoAnaTreeMaker(1,inputFile,picoMaker);
	chain->Init();
	cout<<"chain->Init();"<<endl;
	int total = picoMaker->chain()->GetEntries();
	cout << " Total entries = " << total << endl;
	if(nEvents>total) nEvents = total;


	for (Int_t i=0; i<nEvents; i++){
		// if(i%1000==0)
		cout << "Working on eventNumber " << i << endl;

		chain->Clear();
		int iret = chain->Make(i);

		if (iret) { cout << "Bad return code!" << iret << endl; break;}

		total++;

	}

	cout << "****************************************** " << endl;
	cout << "Work done... now its time to close up shop!"<< endl;
	cout << "****************************************** " << endl;
	chain->Finish();
	cout << "****************************************** " << endl;
	cout << "total number of events  " << nEvents << endl;
	cout << "****************************************** " << endl;

	delete chain;


}
コード例 #6
0
ファイル: example.C プロジェクト: star-bnl/star-muDst
void example() {
   if (gClassTable->GetID("TTable") < 0) {
     gSystem->Load("libTable");
     gSystem->Load("libPhysics");
   }     
  gROOT->LoadMacro("StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  cout << " loading done " << endl;
  
  StMuDebug::setLevel(0);  // switch of some debug output

  int iret=0;
  maker = new StMuDstMaker(0,0,"","test.lis","MuDst.root",2);   // set up maker in read mode
  StMuDbReader* db = StMuDbReader::instance();
  //  db->addDb("/star/u/laue/afsWork/P02gc.db");
  //  db->addDb("/star/u/laue/afsWork/P02gd.db");

  iret = maker->Make();  // read an event 
  iret = maker->Make();  


  StMuEvent* e = maker->muDst()->event();
  StL0Trigger t;
  StEventInfo info;
  if (e) {
  t=e->l0Trigger();
  info=e->eventInfo();
  }

  int n = maker->muDst()->primaryTracks()->GetEntries();  // get number of primary tracks
  
  for (int i=0; i<n; i++) {
    StMuTrack* primaryTrack = maker->muDst()->primaryTracks(i);     // get pointer to primary track
    StMuTrack* global = primaryTrack->globalTrack();
    cout << endl;
    StMuTrack*  tt = primaryTrack;
    printf("primary momentum=%8f first-helix=%8f  last-outerHelix=%8f length=%8f lengthMeasured=%8f charge=%d \n",
	   tt->p().mag(), (tt->firstPoint() - tt->helix().origin()).mag(), (tt->lastPoint() - tt->outerHelix().origin()).mag(), tt->length(), tt->lengthMeasured(), tt->charge() );
    StMuTrack*  tt = global;
    printf("global  momentum=%8f first-helix=%8f  last-outerHelix=%8f length=%8f lengthMeasured=%8f  charge=%d \n",
	   tt->p().mag(), (tt->firstPoint() - tt->helix().origin()).mag(), (tt->lastPoint() - tt->outerHelix().origin()).mag(), tt->length(), tt->lengthMeasured(), tt->charge() );
  }
  printf("EVENT id=%d, runId=%d  unix time=%d trigWord=0x%0x bXing=%d spinBits=%d nPrim=%d\n", info.id(), info.runId(), info.time(), t.triggerWord(),t.bunchCrossingId(), t.spinBits(),n);
  

}
コード例 #7
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;

}
コード例 #8
0
ファイル: CgRuntimeLinking.cpp プロジェクト: DerDolch/unrimp
	/**
	*  @brief
	*    Return whether or not Cg is available
	*/
	bool CgRuntimeLinking::isCgAvaiable()
	{
		// Already initialized?
		if (!mInitialized)
		{
			// We're now initialized
			mInitialized = true;

			// Load the shared libraries
			if (loadSharedLibraries())
			{
				// Load the Cg and Cg OpenGL entry points
				mEntryPointsRegistered = (loadCgEntryPoints() && loadCgGLEntryPoints());
			}
		}

		// Entry points successfully registered?
		return mEntryPointsRegistered;
	}
コード例 #9
0
	bool Direct3D9RuntimeLinking::isDirect3D9Avaiable()
	{
		// Already initialized?
		if (!mInitialized)
		{
			// We're now initialized
			mInitialized = true;

			// Load the shared libraries
			if (loadSharedLibraries())
			{
				// Load the D3D9 and D3DX9 entry points
				mEntryPointsRegistered = (loadD3D9EntryPoints() && loadD3DX9EntryPoints());
			}
		}

		// Entry points successfully registered?
		return mEntryPointsRegistered;
	}
コード例 #10
0
Int_t AggregateVtxSeed(char* dir, const char* cuts, const Int_t offset) {
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  gSystem->Load("StDbBroker.so");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StTpcDb");
  gSystem->Load("StDbUtilities");
  gSystem->Load("StdEdxY2Maker");
  gSystem->Load("StPicoEvent");
  gSystem->Load("StPicoDstMaker");
  gSystem->Load("StPass0CalibMaker");

  StVertexSeedMaker vtxSeedMk;
  //vtxSeedMk.UseFillDateTimeFromFile();
  //vtxSeedMk.SetNoClobber(kFALSE);
  Int_t nfiles = vtxSeedMk.Aggregate(dir,cuts,offset);
  return nfiles;
}
コード例 #11
0
ファイル: runEEmcMcPi0.C プロジェクト: star-bnl/star-emc
void LoadLibs()
{
  //-- Load muDst shared libraries --
  gROOT -> LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  gSystem->Load("StDbLib");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StEEmcSimulatorMaker");
  gSystem->Load("StEEmcA2EMaker");
#ifdef NEW
  gSystem->Load("StEEmcIUPi0");
#else
  gSystem->Load("StMaxStripPi0");
#endif 
  gSystem->Load("StSpinDbMaker");

}
コード例 #12
0
ファイル: bfcMixer_pp2006.C プロジェクト: star-bnl/star-emc
//_____________________________________________________________________
void Load(){
  gSystem->Load("St_base");
  gSystem->Load("StChain");
  gSystem->Load("StUtilities");
  gSystem->Load("StBFChain");
  gSystem->Load("StAnalysisUtilities");

  // required by StEEmcSimulatorMaker
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcSimulatorMaker");
  gSystem->Load("StMcEvent");
  gSystem->Load("StMcEventMaker");
  gSystem->Load("StEmcSimulatorMaker");
  gSystem->Load("StEmcMixerMaker");

  // use this powerfull Logger from Valeri
  gROOT->Macro("LoadLogger.C");
  if (chain) delete chain;
}
コード例 #13
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

}
コード例 #14
0
void testPicoD0EventRead(TString filename)
{
	gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
	loadSharedLibraries();

	gSystem->Load("StPicoDstMaker");
	gSystem->Load("StPicoD0Maker");

	TFile* f = new TFile(filename.Data());
	TTree* T = (TTree*)f->Get("T");
	StPicoD0Event* event = new StPicoD0Event();
	T->SetBranchAddress("dEvent",&event);

	TFile ff("read_test.root","RECREATE");
  TNtuple* nt = new TNtuple("nt","","m:pt:eta:phi:theta:"
                                     "decayL:kDca:pDca:dca12:cosThetaStar");

	StKaonPion* kp = 0;

	for(Int_t i=0;i<100000;++i)
	{
		T->GetEntry(i);

		TClonesArray* arrKPi = event->kaonPionArray();

		for(int idx=0;idx<event->nKaonPion();++idx)
		{
			kp = (StKaonPion*)arrKPi->At(idx);

      nt->Fill(kp->m(),kp->pt(),kp->eta(),kp->phi(),kp->pointingAngle(),
              kp->decayLength(),kp->kaonDca(),kp->pionDca(),kp->dcaDaughters(),kp->cosThetaStar());
		}
	}

  nt->Write();
	ff.Close();
}
コード例 #15
0
ファイル: doEvents.C プロジェクト: jdbrice/TofCalibration
// ------------------ Here is the actual method -----------------------------------------
void doEvents(const Char_t *inname, const Char_t *histname,  const Char_t *ntuplename)
{
  Int_t nEvents = 10;
  Int_t nfiles = 100;

  //
  // First load some shared libraries we need
  //
  if (gClassTable->GetID("TTable") < 0) {
    gSystem->Load("libStar");
    gSystem->Load("libPhysics");
  }  
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  gSystem->Load("StarMagField");
  gSystem->Load("StMagF");
  gSystem->Load("StTpcDb");
//  gSystem->Load("StDbUtilities");
  gSystem->Load("StDaqLib");
  gSystem->Load("StDbBroker");
  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StDbUtilities");
  gSystem->Load("St_db_Maker");

  gSystem->Load("StEvent");
  gSystem->Load("StEventMaker");
  gSystem->Load("StarMagField");
  gSystem->Load("StTofUtil");
  gSystem->Load("StTofMaker");
 
  gSystem->Load("libtpc_Tables");
  gSystem->Load("libGeom");
  gSystem->Load("St_g2t");
  gSystem->Load("geometry");
  gSystem->Load("St_geant_Maker");

  gSystem->Load("StTofrMatchMaker");
  //    gSystem->Load("StTofpMatchMaker");
  //    gSystem->Load("StTofCalibMaker");
  //    gSystem->Load("StTofFlowMaker");
  gSystem->Load("StTofrNtupleMaker");

    // Handling depends on whether file is a ROOT file or XDF file
    //
    chain  = new StChain("StChain");
    
    StIOMaker* ioMaker = new StIOMaker();
    ioMaker->SetFile(inname);
    ioMaker->SetIOMode("r");
    ioMaker->SetBranch("*",0,"0");
    ioMaker->SetBranch("eventBranch",0,"r");
    ioMaker->SetDebug(0);
  
    int NwGeant=5000000, IwType=0, NwPaw=0;
    St_geant_Maker *geantMk = new St_geant_Maker("geant",NwGeant,NwPaw,IwType);
    geantMk->LoadGeometry("detp geometry y2008");
    geantMk->SetActive(kFALSE);

   cout<<endl<<"============  Data Base ========="<<endl;
   dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");

   StTofrMatchMaker *matchMaker = new StTofrMatchMaker("tofrMatch");
   matchMaker->SetDebug(0);
   matchMaker->SetMode(1);
   matchMaker->setSaveGeometry(kTRUE);
   matchMaker->setCreateHistoFlag(kTRUE);
   matchMaker->setCreateTreeFlag(kTRUE);
   matchMaker->setHistoFileName(histname);
   //matchMaker->setNtupleFileName("test2.root");
   StTofrNtupleMaker *tofrNtuple = new StTofrNtupleMaker("tofrNtuple", ntuplename);
   tofrNtuple->SetDebug(0); 
   tofrNtuple->setInitGeomFromOther(kTRUE);
    //

    // Initialize chain
    //
    Int_t iInit = chain->Init();
    if (iInit) chain->Fatal(iInit,"on init");
    chain->PrintInfo();
    //
    // Event loop
    //
    int istat = 0, i = 1;
EventLoop: if (i <= nEvents && istat != 2) {
   
   cout << endl << "============================ Event " << i
	<< " start ============================" << endl;
   
   chain->Clear();
   istat = chain->Make(i);
   if (istat == 2) 
     {cout << "Last  event processed. Status = " << istat << endl;}
   if (istat == 3) 
     {cout << "Error event processed. Status = " << istat << endl;}
   
   //   gObjectTable->Print();
   i++;
   goto EventLoop;
 }
    
    i--;
  cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl;

  //
  // Chain Finish
  //
  if (nEvents > 1) {
    chain->Finish();
  }


}
コード例 #16
0
ファイル: rdMu2TrigSimu.C プロジェクト: XiaozhiBai/Run12
void rdMu2TrigSimu(char *file="/star/data47/reco/pp200/pythia6_410/9_11gev/cdf_a/y2006c/gheisha_on/p07ic/rcf1309_*_2000evts.MuDst.root"){
  
  int nevents = 200;
  int flagMC=1;  // 0/1 == Using Real/Simulation data files 
  int useEemc=1; // 0/1 == Exclude/Include EEMC in Trigger Decisions 
  int useBemc=1; // 0/1 == Exclude/Include BEMC in Trigger Decisions 
  int useL2=1;   // 0/1 == Exclude/Include L2 in Trigger Decisions 
  int L2ConfigYear=2006; // possible: 2006, 2008
  int bemcConfig=2; // Online==1, Offline==2, Expert==3
  int playConfig=0; // jan:100_199
  int emcEveDump=0; // extrating raw EMC data in a custom format
  int outputL2Histo=0;//output L2 histos to directory outL2
  TString outDir="./outL2/"; 


  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  assert( !gSystem->Load("StDetectorDbMaker"));
  assert( !gSystem->Load("StDbUtilities"));
  assert( !gSystem->Load("StDbBroker"));
  assert( !gSystem->Load("St_db_Maker"));
  assert( !gSystem->Load("StEEmcUtil")); // needed by eemcDb
  assert( !gSystem->Load("StEEmcDbMaker"));
  assert( !gSystem->Load("StDaqLib")); // needed by bemcDb
  assert( !gSystem->Load("StEmcRawMaker"));
  assert( !gSystem->Load("StEmcADCtoEMaker"));
  if (flagMC) {
    assert( !gSystem->Load("StMcEvent"));
    assert( !gSystem->Load("StMcEventMaker"));
    assert( !gSystem->Load("StEmcSimulatorMaker"));
    assert( !gSystem->Load("StEEmcSimulatorMaker"));
    assert( !gSystem->Load("StEpcMaker"));
  }
  assert( !gSystem->Load("StTriggerUtilities"));

  gROOT->Macro("LoadLogger.C");
  cout << " loading done " << endl;
  
  chain= new StChain("StChain"); 

  if (flagMC){
    TString geantFile;
    geantFile += file;
    geantFile.ReplaceAll("MuDst.root", "geant.root");
    printf("geantFile=%s\n", geantFile.Data());
    StIOMaker* ioMaker = new StIOMaker();
    ioMaker->SetFile(geantFile);
    ioMaker->SetIOMode("r");
    ioMaker->SetBranch("*",0,"0");             //deactivate all branches
    ioMaker->SetBranch("geantBranch",0,"r");   //activate geant Branch
    StMcEventMaker *evtMaker = new StMcEventMaker();
  }

  //Need MuDstMaker to get data
  printf(" Analyzing file=%s\n",file);  
  StMuDstMaker* muDstMaker =new StMuDstMaker(0,0,"",file,"",1000);

  //Database -- get a real calibration from the database
  St_db_Maker* dbMk =0;
  if(useEemc || useL2) // full DB access
    dbMk = new St_db_Maker("StarDb","MySQL:StarDb","MySQL:StarDb","$STAR/StarDb");
  else // only Barrel is uploaded, is faster 
    dbMk  = new St_db_Maker("Calibrations","MySQL:Calibrations_emc");

    
  //If MC then must set database time and date
  //If Endcap fast simu is used tower gains in DB do not matter,JB
  if (flagMC) dbMk->SetDateTime(20060522, 55000);//timestamp R7142018
  
  //Collect all output histograms 
  TObjArray* HList=new TObjArray; 
  
  //Endcap DB
  if(useEemc || useL2) new StEEmcDbMaker("eemcDb");
  

  //Get BEMC adc values
  if (flagMC && useBemc) {
    StEmcSimulatorMaker* emcSim = new StEmcSimulatorMaker(); //use this instead to "redo" converstion from geant->adc
    if (bemcConfig == 1) {
        emcSim->setCheckStatus(kBarrelEmcTowerId,false); //this returns hits regardless of offline tower status
    }
    emcSim->setCalibSpread(kBarrelEmcTowerId,0.15);//spread gains by 15%
  }
  if (flagMC==0 && useBemc){
    StEmcADCtoEMaker *bemcAdc = new StEmcADCtoEMaker();//for real data this sets calibration and status
    if (bemcConfig == 1) {
        bemcAdc->setCheckStatus(kBarrelEmcTowerId,false);
    }
  }

  //must use slow simulator to get pedestals correct for L2
  if (flagMC==1 && useEemc){
    StEEmcSlowMaker *slowSim = new StEEmcSlowMaker("slowSim");
    slowSim->setSamplingFraction(0.0384); // effectively scales all Tower energies with a factor of 1.3 (added by: Ilya Selyuzhenkov; April 11, 2008)
    slowSim->setAddPed(true);
    slowSim->setSmearPed(true);
  }
 
  //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(flagMC && useEemc==2){
    // pass one argument to M-C as generic switch    
    // Endcap specific params -- ok Jan you need to change this to a default "online" setup
    int eemcDsmSetup[20]; // see StEemcTriggerSimu::initRun() for definition
    memset(eemcDsmSetup, 0,sizeof(eemcDsmSetup));// clear all, may be a bad default
    eemcDsmSetup[0]=3;  // HTthr0
    eemcDsmSetup[1]=12; // HTthr1
    eemcDsmSetup[2]=22; // HTthr2
    eemcDsmSetup[3]=1;  // TPthr0
    eemcDsmSetup[4]=17; // TPthr1
    eemcDsmSetup[5]=31; // TPthr2
    eemcDsmSetup[10]=2; //HTTPthrSelc, 2=use_thres_#1
    simuTrig->eemc->setDsmSetup(eemcDsmSetup);    
  }


  if(useL2) {
    /* 
       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();
    simuTrig->useL2(simL2Mk);
  }

  
  //if(emcEveDump) new StJanEventMaker;
    
  StTriggerSimuPlayMaker *playMk= new StTriggerSimuPlayMaker; // to develope user  analysis of trigQA 
  playMk->setConfig(playConfig);
  playMk->setHList(HList);
  
  
  chain->ls(3);
  chain->Init();
 
  for (Int_t iev=0;iev<nevents; iev++) {
    cout << "\n****************************************** " << endl;
    cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<nevents<<endl;
    cout << "****************************************** " << endl;
    chain->Clear();
    int iret = chain->Make(iev);
    total++;   
    if (iret % 10 == kStEOF || iret % 10 == kStFatal)  {
      cout << "Bad return code!" << endl;
      break;
    }

    int trigID[3]={127213,117211,137611};
    StMuDst *muDst = muDstMaker->muDst();
    StMuEvent *muEvent = muDst->event();    
    StMuTriggerIdCollection trig = muEvent -> triggerIdCollection();
    StTriggerId l1trig = trig.nominal();
    if( l1trig.isTrigger(trigID[0])) {
      cout<<" SimuTrigger 127213 ="<<simuTrig->isTrigger(trigID[0])<<" BEMC="<<simuTrig->bemc->triggerDecision(trigID[0])<<" L2="<<simuTrig->lTwo->triggerDecision(trigID[0])<<endl;
     }
    if( l1trig.isTrigger(trigID[1])) {
      cout<<" SimuTrigger 117211 ="<<simuTrig->isTrigger(trigID[1])<<" BEMC="<<simuTrig->bemc->triggerDecision(trigID[1])<<" L2="<<simuTrig->lTwo->triggerDecision(trigID[1])<<endl;
     }
    if( l1trig.isTrigger(trigID[2])) {
      cout<<" SimuTrigger 137611 ="<<simuTrig->isTrigger(trigID[2])<<" BEMC="<<simuTrig->bemc->triggerDecision(trigID[2])<<" L2="<<simuTrig->lTwo->triggerDecision(trigID[2])<<endl;
    }

    
    StTriggerSimuResult trigResult = simuTrig->detailedResult(trigID[2]);
    if (trigResult.bemcDecision()==1){
       vector<short> towerId = trigResult.highTowerIds();
      for (unsigned i=0; i<towerId.size(); i++) {
      	cout<<" LO Trigger BEMC Tower="<<towerId[i]<<" adc="<<trigResult.highTowerAdc(towerId[i])<<endl;
      }
    }


   if (trigResult.l2Decision()==1){
       vector<short> towerId = trigResult.highTowerIds();
      for (unsigned i=0; i<towerId.size(); i++) {
      	cout<<" L2 Trigger BEMC Tower="<<towerId[i]<<" adc="<<trigResult.highTowerAdc(towerId[i])<<endl;
      }
    }
 
  }

 
  chain->Finish();
  cout << "****************************************** " << endl;
  cout << "total number of events  " << total << endl;
  cout << "****************************************** " << endl;


  if (outputL2Histo==1) {
  
    TString fileMu=file;
    printf("=%s=\n",fileMu.Data());
    if(fileMu.Contains(".lis")) fileMu.ReplaceAll(".lis",".trgSim");
    if(fileMu.Contains(".MuDst.root")) fileMu.ReplaceAll(".MuDst.root",".trgSim");
    TString outF=outDir+fileMu;
    outF+=".hist.root";
    printf("=%s=\n",outF.Data());
    hf=new TFile(outF,"recreate");
    if(hf->IsOpen()) {
      HList->Write();
      printf("\n Histo saved -->%s<\n",outF.Data());
    } 
    else {
      printf("\n Failed to open Histo-file -->%s<, continue\n",outF.Data());
    }
  }
  
  //cout <<Form("sorting done %d of   nEve=%d, CPU rate=%.1f Hz, total time %.1f minute(s) \n\n",total,nEntries,rate,tMnt)<<endl;
 
}
コード例 #17
0
void runPicoMixedEvent(const Char_t *inputFile="test.list", const Char_t *outputFile="outputBaseName", 
			 const Char_t *badRunListFileName = "picoList_bad_MB.list") { 
  // -- 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
  StMemStat mem;
  string SL_version = "SL15c";
  string env_SL = getenv ("STAR");
  if (env_SL.find(SL_version)==string::npos) {
      cout<<"Environment Star Library does not match the requested library in runPicoMixedEventMaker.C. Exiting..."<<endl;
      exit(1);
  }
  // ========================================================================================
  //   Testing 
  // ========================================================================================
  Int_t nEvents = 10000000;
	
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  gSystem->Load("StBTofUtil");
  gSystem->Load("StPicoDstMaker");
  gSystem->Load("StPicoPrescales");
  gSystem->Load("StPicoHFMaker");
  gSystem->Load("StPicoMixedEventMaker");
  
  chain = new StChain();

  // ========================================================================================
  // Still bone dry
  // ========================================================================================


  TString sInputFile(inputFile);
  TString sInputListHF("");  

  // ========================================================================================
  StPicoDstMaker* picoDstMaker = new StPicoDstMaker(0, sInputFile, "picoDstMaker");
  StPicoMixedEventMaker* picoMixedEventMaker = new StPicoMixedEventMaker("picoMixedEventMaker", picoDstMaker, outputFile, sInputListHF);

  StHFCuts* hfCuts = new StHFCuts("hfBaseCuts");
  picoMixedEventMaker -> setHFBaseCuts(hfCuts);

  // ---------------------------------------------------
  // -- Set Base cuts for HF analysis

  // -- File name of bad run list
  //hfCuts->setBadRunListFileName(badRunListFileName);

  // -- Event and track cuts  ----------------------------
  hfCuts->setCutVzMax(6.);
  hfCuts->setCutVzVpdVzMax(3.);
  //hfCuts->setCutTriggerWord(0x1F);

  hfCuts->setCutNHitsFitMax(15); 
  hfCuts->setCutRequireHFT(false);
  // hfCuts->setCutNHitsFitnHitsMax(0.52);

  // -- Topological and PID cuts ------------------------
  hfCuts->setCutSecondaryPair(0.75, 1.0, 7.0, 
			      0.9, 0,2.0 );
  //Single track pt
  hfCuts->setCutPtRange(0.6,2.0,StHFCuts::kPion);
  hfCuts->setCutPtRange(0.6,2.0,StHFCuts::kKaon);
  //TPC setters
  hfCuts->setCutTPCNSigmaPion(3.0);
  hfCuts->setCutTPCNSigmaKaon(3.0);
  //TOF setters, need to set pt range as well
  hfCuts->setCutTOFDeltaOneOverBeta(0.05, StHFCuts::kKaon);
  hfCuts->setCutPtotRangeHybridTOF(0.6,2.0,StHFCuts::kKaon);
  hfCuts->setCutTOFDeltaOneOverBeta(0.05, StHFCuts::kPion);
  hfCuts->setCutPtotRangeHybridTOF(0.6,2.0,StHFCuts::kPion);
  // ---------------------------------------------------

  chain->Init();
  cout << "chain->Init();" << endl;
  int total = picoDstMaker->chain()->GetEntries();
  cout << " Total entries = " << total << endl;
  if(nEvents>total) nEvents = total;
  for (Int_t i=0; i<nEvents; i++) {
    if(i%1==0)
      cout << "Working on eventNumber " << i << endl;
    
    chain->Clear();

    int iret = chain->Make(i);

    if (iret) { cout << "Bad return code!" << iret << endl; break;}
    
    total++;
  }
  
  cout << "****************************************** " << endl;
  cout << "Work done... now its time to close up shop!"<< endl;
  cout << "****************************************** " << endl;
  chain->Finish();
  cout << "****************************************** " << endl;
  cout << "total number of events  " << nEvents << endl;
  cout << "****************************************** " << endl;
  
  delete chain;
  
}
コード例 #18
0
ファイル: rdSt2print.C プロジェクト: star-bnl/star-emc
void rdSt2print(Int_t nevents=100){

  char * fname="/star/data09/reco/ppProductionTrans/FullField/dev/2006/129/7129060/st_physics_7129060_raw_1030002.event.root";

  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  cout << " loading done " << endl;
     
  // Load my makers

  // create chain    
  chain = new StChain("bfc"); 
  //chain->SetDebug();
  
  // Now we add Makers to the chain...

  // StIOMaker - to read files ...
  StIOMaker* ioMaker = new StIOMaker();  
  //ioMaker->SetFile("photon_bemc.event.root"); 
  ioMaker->SetFile(fname); 
  //ioMaker->SetDebug();
  ioMaker->SetIOMode("r");
  ioMaker->SetBranch("*",0,"0");             //deactivate all branches
  ioMaker->SetBranch("geantBranch",0,"r");   //activate geant Branch
  ioMaker->SetBranch("eventBranch",0,"r");   //activate Event Branch
  ioMaker->SetIOMode("r"); 
 
  // StMcEventMaker
  // StMcEventMaker *mcEventMaker = new StMcEventMaker();

  // My Makers 
  //  StEmcTrigSimuMaker *myMk2=new StEmcTrigSimuMaker("eemcTrigMaker");

  // Now execute the chain Init functions
  chain->PrintInfo();
  chain->ls(3);
  Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers
  if (initStat) chain->Fatal(initStat, "during Init()");
    
  int istat=0,iev=1;

  // Do the event loop    
  while(iev<=nevents && istat!=2) {
    chain->Clear();
    cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
    istat = chain->Make(iev); // This should call the Make() method in ALL makers
    iev++; 
    if (istat  == kStEOF || istat == kStFatal) break;
    
    StEvent* mEvent = (StEvent*)chain->GetInputDS("StEvent");
    assert(mEvent);// fix your chain or open the right event file
    
    int nV=mEvent->numberOfPrimaryVertices();
    if(nV==0) continue;
    int iv;
    printf("eveID=%d  nPrimVert=%d\n", mEvent->id(),nV);
    for(iv=0;iv<nV;iv++) {
      StPrimaryVertex *V=mEvent->primaryVertex(iv);
      assert(V);
      StThreeVectorF &r=V->position();
      StThreeVectorF &er=V->positionError();
      printf("iv=%d   Vz=%.2f +/-%.2f \n",iv,r.z(),er.z()  );
      printf("  nDaugh=%d , VFid=%d:: ntr=%d nCtb=%d nBemc=%d nEEmc=%d nTpc=%d sumPt=%.1f rank=%g xchi2=%g\n"
	     ,V->numberOfDaughters(), V->vertexFinderId() ,V->numTracksUsedInFinder()  ,V->numMatchesWithCTB()  ,V-> numMatchesWithBEMC() ,V->numMatchesWithEEMC()  ,V->numTracksCrossingCentralMembrane()  ,V->sumOfTrackPt()  ,V->ranking(), V->chiSquared());
    }
    
    
    StEmcCollection* emcC =(StEmcCollection*)mEvent->emcCollection(); assert(emcC);
    
    //................... print Endcap hits in StEvent
    // printETOW(emcC->detector(13));
    //    printEPRE(emcC->detector(14));
    //printESMD(emcC->detector(15));
    //     printESMD(emcC->detector(16));
    
    // printRaw(emcC->eemcRawData());
    
    //................... print Barrel hits in StEvent
    printRawBEMC(emcC->bemcRawData());
    
  } // Event Loop
  chain->Finish();
  //    delete myMk2;
   
    
}
コード例 #19
0
ファイル: rdMu2bbc.C プロジェクト: star-bnl/star-emc
int rdMu2bbc(
 TString fullName="ccX",
 int nEve=10000,
 Int_t nFiles  = 4,
 char* file="inp/R5112017.lis", // min-b
 //char* file="inp/R5118053.lis", // prodPP
 char* inDir   = "./",
 char* outDir   = "outBbc/"
){ 
  
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  cout << " loading done " << endl;
  gSystem->Load("myTest1");  

  // create chain    
  chain = new StChain("StChain"); 

  printf("adding muDst from '%s' ....\n",file);
  // Now we add Makers to the chain...   
  muMk = new StMuDstMaker(0,0,inDir,file,"MuDst.root",nFiles);
  TChain* tree=muMk->chain(); assert(tree); 
  int nEntries=tree->GetEntries();
  printf("total eve in chain =%d\n",nEntries);

  myMk3=new StBbcVertexMaker("bbcVertex","MuDst");
  TObjArray  HList;
  myMk3->SetHList(&HList);
  myMk3->readCalib("outBbc/bbcEcalib2.dat");
  myMk3->readCalib("outBbc/bbcWcalib2.dat");
  myMk3->setTdcCalib(2.0); // cm/tdc ch

  gMessMgr->SwitchOff("D");
  gMessMgr->SwitchOn("I");
 
  chain->Init();
  chain->ls(3);
  //  return;
  int eventCounter=0;
  int stat=0;
  int t1=time(0);
  //---------------------------------------------------
  while ( stat==0 ) {// loop over events
    if(eventCounter>=nEve) break;
    eventCounter++;
    chain->Clear();
    stat = chain->Make();

    if(eventCounter%1000!=0)continue;

    printf("\n\n ====================%d  processing  ==============\n", eventCounter);

  }
  printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
  int t2=time(0);
  float rate=1.*eventCounter/(t2-t1);
  float nMnts=(t2-t1)/60.;
  printf("sorting done %d of   nEve=%d, CPU rate=%.1f Hz, tot %.1f minutes\n",eventCounter,nEntries,rate,nMnts);

   chain->Finish();
   //   HList.ls();
   fullName+=".hist.root";
   TFile f( outDir+fullName,"recreate");
   assert(f.IsOpen());
   printf("%d histos are written  to '%s' ...\n",HList.GetEntries(),fullName.Data());
   HList.Write();
   f.Close();
   assert(!f.IsOpen());

}
コード例 #20
0
void runPicoMixedEvent(const Char_t *inputFile="test.list", const Char_t *outputFile="outputBaseName", 
			 const Char_t *badRunListFileName = "picoList_bad_MB.list") { 
  // -- 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
  TStopwatch*   stopWatch = new TStopwatch();
  stopWatch->Start();
  StMemStat mem;
  string SL_version = "SL15c";
  string env_SL = getenv ("STAR");
  if (env_SL.find(SL_version)==string::npos) {
      cout<<"Environment Star Library does not match the requested library in runPicoMixedEventMaker.C. Exiting..."<<endl;
      exit(1);
  }
  // ========================================================================================
  //   Testing 
  // ========================================================================================
  Int_t nEvents = 10000000;
  //Int_t nEvents = 20000;
	
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  // gSystem->Load("StBTofUtil");
  gSystem->Load("StPicoDstMaker");
  gSystem->Load("StPicoPrescales");
  // gSystem->Load("StPicoCutsBase");
  // gSystem->Load("StPicoHFMaker");
  gSystem->Load("StRefMultCorr");
  gSystem->Load("StEventPlane");
  gSystem->Load("StPicoMixedEventMaker");
  
  
  chain = new StChain();

  // ========================================================================================
  // Still bone dry
  // ========================================================================================


  TString sInputFile(inputFile);
  TString sInputListHF("");  

  // create list of kfVertex files
  TString command = "sed 's/picodsts/hft\\\/kfVertex/g' " + sInputFile + " >correspondingkfVertex.list";
  gSystem->Exec(command.Data());
  command = "sed -i 's/picoDst/kfVertex/g' correspondingkfVertex.list";
  gSystem->Exec(command.Data());

  // ========================================================================================
  StPicoDstMaker* picoDstMaker = new StPicoDstMaker(0, sInputFile, "picoDstMaker");
  StRefMultCorr* grefmultCorrUtil  = CentralityMaker::instance()->getgRefMultCorr();
  cout<<"here"<<endl;
  grefmultCorrUtil->setVzForWeight(6, -6.0, 6.0);
  grefmultCorrUtil->readScaleForWeight("StRoot/StRefMultCorr/macros/weight_grefmult_vpd30_vpd5_Run14.txt");
  for(Int_t i=0;i<6;i++){
    cout << i << " " << grefmultCorrUtil->get(i, 0) << endl;
  }
  StEventPlane*  eventPlaneMaker = new StEventPlane("eventPlaneMaker",picoDstMaker,grefmultCorrUtil);
  StPicoMixedEventMaker* picoMixedEventMaker = new StPicoMixedEventMaker("picoMixedEventMaker", picoDstMaker, grefmultCorrUtil, eventPlaneMaker, outputFile, sInputListHF, "correspondingkfVertex.list");

  // ---------------------------------------------------
  // -- Set Base cuts for HF analysis

  // -- File name of bad run list
  //hfCuts->setBadRunListFileName(badRunListFileName);

  chain->Init();
  cout << "chain->Init();" << endl;

  int total = picoDstMaker->chain()->GetEntries();
  cout << " Total entries = " << total << endl;
  if(nEvents>total) nEvents = total;
  for (Int_t i=0; i<nEvents; i++) {
    if(i%1000==0)
      cout << "Working on eventNumber " << i << endl;
    
    chain->Clear();

    int iret = chain->Make(i);

    if (iret) { cout << "Bad return code!" << iret << endl; break;}
    
    total++;
  }
  
  cout << "****************************************** " << endl;
  cout << "Work done... now its time to close up shop!"<< endl;
  cout << "****************************************** " << endl;
  chain->Finish();
  cout << "****************************************** " << endl;
  cout << "total number of events  " << nEvents << endl;
  cout << "****************************************** " << endl;
  
  delete chain;
  // delete list of kfEvent list
  command = "rm -f correspondingkfVertex.list";
  gSystem->Exec(command.Data());

  stopWatch->Stop(); 
  stopWatch->Print();
}
コード例 #21
0
ファイル: rdSt2print.C プロジェクト: star-bnl/star-fgt
void rdSt2print(char * fname="aa.event.root", Int_t nevents=4){

  fname="m1.event.root";

  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  //  assert( !gSystem->Load("StEEmcUtil.so"));

  cout << " loading done " << endl;
     
  // Load my makers
 
  // create chain    
  chain = new StChain("bfc"); 
  //chain->SetDebug();
  
  // Now we add Makers to the chain...

  // StIOMaker - to read files ...
  StIOMaker* ioMaker = new StIOMaker();  
  ioMaker->SetFile(fname); 
  //ioMaker->SetDebug();
  ioMaker->SetIOMode("r");
  ioMaker->SetBranch("*",0,"0");             //deactivate all branches
  ioMaker->SetBranch("geantBranch",0,"r");   //activate geant Branch
  ioMaker->SetBranch("eventBranch",0,"r");   //activate Event Branch
  ioMaker->SetIOMode("r"); 
 
  // StMcEventMaker
  // StMcEventMaker *mcEventMaker = new StMcEventMaker();

  // My Makers 

  // Now execute the chain Init functions
  chain->PrintInfo();
  chain->ls(3);
  Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers
  if (initStat) chain->Fatal(initStat, "during Init()");
    
  int istat=0,iev=0;

  // Do the event loop    
  while(1) {
    if (iev>=nevents) break;
    chain->Clear();
    istat = chain->Make(); 
    iev++; 
    if(istat) break; 
    cout << "---------------------- Processing Event : " << iev << " ---------------------- " << istat<<endl;

  
    // if(iev<17) continue;
    if (istat  == kStEOF || istat == kStFatal) break;
    
    StEvent* mEvent = (StEvent*)chain->GetInputDS("StEvent");
    assert(mEvent);// fix your chain or open the right event file
    StTriggerIdCollection *tic=mEvent->triggerIdCollection();
    assert(tic); 

    //    if(! isTrig(tic,trigM)) continue;
    int nV=mEvent->numberOfPrimaryVertices();
    int iv;
    if(nV>1) printf("######\n");
    printf("eveID=%d  nPrimVert=%d\n", mEvent->id(),nV);

    // VERTEX INFO ........................
    for(iv=0;iv<nV;iv++) {
      StPrimaryVertex *V=mEvent->primaryVertex(iv);
      assert(V);
      StThreeVectorF &r=V->position();
      StThreeVectorF &er=V->positionError();
      printf("iv=%d   Vz=%.2f +/-%.2f \n",iv,r.z(),er.z()  );
      printf("  nPrimTr=%d , VFid=%d:: ntrVF=%d nCtb=%d nBemc=%d nEEmc=%d nTpc=%d sumPt=%.1f rank=%g\n"
	     ,V->numberOfDaughters(), V->vertexFinderId() ,V->numTracksUsedInFinder()  ,
	     V->numMatchesWithCTB()  ,V-> numMatchesWithBEMC() ,V->numMatchesWithEEMC()  ,
	     V->numTracksCrossingCentralMembrane()  ,V->sumOfTrackPt()  ,V->ranking());
      
      continue;
      // TRACK INFO ..............
      int nPrTr=0;
      //.... access prim tracks for given vertex
      int itr;
      for(itr=0; itr<V->numberOfDaughters(); itr++) {
	StTrack *track=V-> daughter(itr);
	if(track==0)  continue;
	if (track->flag() <0 ) continue;
	printf("itr=%d pT=%.1f eta=%.2f nFitP=%d DCA=%.1f\n",itr,
	       track->geometry()->momentum().mag(),
	       track->geometry()->momentum().pseudoRapidity(),
	       track->fitTraits().numberOfFitPoints(),
	       track->geometry()->helix().distance(V->position()));
	nPrTr++;
      }      
      printf("  counted nPrimTr=%d \n",nPrTr);
    } // end of loop over vertices
    // mEvent->ls(3);
   
    // FGT INFO .......
    StFgtCollection*   fgtColl= mEvent->            fgtCollection();
 
    printFgt(fgtColl);
    //assert(9==0);
    // EMC INFO ............
    StEmcCollection* emcC =(StEmcCollection*)mEvent->emcCollection(); assert(emcC);
    // print Endcap hits in StEvent
    printETOW(emcC->detector(13));
    //    printEPRE(emcC->detector(14));
    //printESMD(emcC->detector(15));
    //     printESMD(emcC->detector(16));    
    // printRaw(emcC->eemcRawData());
    //printRawBEMC(emcC->bemcRawData());
    
    //  if(iev<=2) 
  
  } // Event Loop
  chain->Finish();

 
    
}
コード例 #22
0
void runPicoHFMyAnaMaker(const Char_t *inputFile="test.list", const Char_t *outputFile="outputBaseName",  unsigned int makerMode = 0 /*kAnalyze*/, 
			 const Char_t *badRunListFileName = "picoList_bad_MB.list") { 
  // -- 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 = "SL15c";
  string env_SL = getenv ("STAR");
  if (env_SL.find(SL_version)==string::npos) {
      cout<<"Environment Star Library does not match the requested library in runPicoHFMyAnaMaker.C. Exiting..."<<endl;
      exit(1);
  }

  Int_t nEvents = 10000000;
	
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  gSystem->Load("StBTofUtil");
  gSystem->Load("StPicoDstMaker");
  gSystem->Load("StPicoPrescales");
  gSystem->Load("StPicoHFMaker");
  gSystem->Load("StPicoHFMyAnaMaker");

  chain = new StChain();

  // ========================================================================================
  //makerMode    = StPicoHFMaker::kAnalyze;
  // ========================================================================================
  
  cout << "Maker Mode    " << makerMode << endl;

  TString sInputFile(inputFile);
  TString sInputListHF("");  

  if (makerMode == StPicoHFMaker::kAnalyze) {
    if (!sInputFile.Contains(".list") && !sInputFile.Contains("picoDst.root")) {
      cout << "No input list or picoDst root file provided! Exiting..." << endl;
      exit(1);
    }
  }
  else if (makerMode == StPicoHFMaker::kWrite) {
    if (!sInputFile.Contains("picoDst.root")) {
      cout << "No input picoDst root file provided! Exiting..." << endl;
      exit(1);
    }
  }
  else if (makerMode == StPicoHFMaker::kRead) {
   if (!sInputFile.Contains(".list")) {
      cout << "No input list provided! Exiting..." << endl;
      exit(1);
   }

   // -- prepare filelist for picoDst from hfTrees
   sInputListHF = sInputFile;
   sInputFile = "tmpPico.list";
   TString command = "sed 's|^.*hfTree|/project/projectdirs/starprod/picodsts/Run14/AuAu/200GeV/physics/P15ic|g' "
     + sInputListHF + " > " + sInputFile;
   gSystem->Exec(command.Data());
   command = "sed -i 's|picoHFtree|picoDst|g' " + sInputFile;
   gSystem->Exec(command.Data());
  }
  else {
    cout << "Unknown makerMode! Exiting..." << endl;
    exit(1);
  }
  
  StPicoDstMaker* picoDstMaker = new StPicoDstMaker(0, sInputFile, "picoDstMaker");
  StPicoHFMyAnaMaker* picoHFMyAnaMaker = new StPicoHFMyAnaMaker("picoHFMyAnaMaker", picoDstMaker, outputFile, sInputListHF);
  picoHFMyAnaMaker->setMakerMode(makerMode);

  StHFCuts* hfCuts = new StHFCuts("hfBaseCuts");
  picoHFMyAnaMaker->setHFBaseCuts(hfCuts);

  // ---------------------------------------------------
  // -- Set Base cuts for HF analysis

  // -- File name of bad run list
  hfCuts->setBadRunListFileName(badRunListFileName);

  // -- ADD USER CUTS HERE ----------------------------

  // hfCuts->setCutVzMax(6.);
  // hfCuts->setCutVzVpdVzMax(3.);
  // hfCuts->setCutTriggerWord(0x1F);

  // hfCuts->setCutNHitsFitMax(15); 
  // hfCuts->setCutRequireHFT(true);
  // hfCuts->setCutNHitsFitnHitsMax(0.52);
  // ---------------------------------------------------

  // -- Channel1
  picoHFMyAnaMaker->setDecayMode(StPicoHFEvent::kTwoParticleDecay);
  picoHFMyAnaMaker->setDecayChannel(StPicoHFMyAnaMaker::kChannel1);

  // -- ADD USER CUTS HERE ----------------------------


  // ========================================================================================

  // ========================================================================================

  chain->Init();
  cout << "chain->Init();" << endl;
  int total = picoDstMaker->chain()->GetEntries();
  cout << " Total entries = " << total << endl;
  if(nEvents>total) nEvents = total;

  for (Int_t i=0; i<nEvents; i++) {
    if(i%10000==0)
      cout << "Working on eventNumber " << i << endl;
    
    chain->Clear();
    int iret = chain->Make(i);
    
    if (iret) { cout << "Bad return code!" << iret << endl; break;}
    
    total++;
  }
  
  cout << "****************************************** " << endl;
  cout << "Work done... now its time to close up shop!"<< endl;
  cout << "****************************************** " << endl;
  chain->Finish();
  cout << "****************************************** " << endl;
  cout << "total number of events  " << nEvents << endl;
  cout << "****************************************** " << endl;
  
  delete chain;

  // -- clean up if in read mode
  if (makerMode == StPicoHFMaker::kRead)
    gSystem->Exec(Form("rm -f %s", sInputFile.Data()));
}
コード例 #23
0
ファイル: doEvents.C プロジェクト: star-bnl/star-tof
// ------------------ Here is the actual method -----------------------------------------
void doEvents(const Char_t *fileList, const Char_t *outputname)
{
  Int_t nEvents = 1000;
  Int_t nfiles = 100;

  //
  // First load some shared libraries we need
  //
  if (gClassTable->GetID("TTable") < 0) {
    gSystem->Load("libStar");
    gSystem->Load("libPhysics");
  }  
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  gSystem->Load("StarMagField");
  gSystem->Load("StMagF");
  gSystem->Load("StTpcDb");
//  gSystem->Load("StDbUtilities");
  gSystem->Load("StDaqLib");
  gSystem->Load("StDbBroker");
  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StDbUtilities");
  gSystem->Load("St_db_Maker");

  gSystem->Load("StEvent");
  gSystem->Load("StEventMaker");
  gSystem->Load("StarMagField");
  gSystem->Load("StTofUtil");   
 
  gSystem->Load("StVpdAnalysisMaker");
    //
    // Handling depends on whether file is a ROOT file or XDF file
    //
    chain  = new StChain("StChain");


    delete setFiles; setFiles =0;
    if (fileList) {     //Normal case
      setFiles= new StFile();
    } else        {     //
      return;
    }
    ifstream* inputStream = new ifstream;
    inputStream->open(fileList);
    if (!(inputStream)) {
      cout << "can not open list file" << endl;
      return;
    }
    cout<<"Open file list: --- "<<fileList<<endl;

    char line[512];
    for (;inputStream->good();) {
      inputStream->getline(line,512);
      if  ( inputStream->good() ) {
	//cout<<" root file "<<line<<endl;
	TFile *ftmp = new TFile(line);
	 //----------
         if (!(ftmp->IsOpen())) {
           cout<<line<<" open failed ! not chained"<<endl;
           continue;   
         }
         if (ftmp->IsZombie()) {
           cout<<"sth. very wrong with "<<line<<", not chained "<<endl;
           continue;   
         }
         if (ftmp->TestBit(1024)) { 
           cout<<"revocer procedure applied to "<<line<<endl;
           continue;   
         } 
	 //--------------------------           
         if( ftmp && ftmp->IsOpen() && ftmp->GetNkeys()) {
	    cout << "add file " << line << endl;
	    setFiles->AddFile(line);
	 } else {
	     cout << " cannot open file " << line << endl;
    	 }
    	 delete ftmp;
       }
    }


   StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",fileList,"MuDst.root",nfiles);
   muDstMaker->SetStatus("*",0);
   muDstMaker->SetStatus("MuEvent",1);
   muDstMaker->SetStatus("TofRawData",1);

   cout<<endl<<"============  Data Base ========="<<endl;
   dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");

   StVpdAnalysisMaker *vpdAna = new StVpdAnalysisMaker();
   vpdAna->SetDebug();

    //
    // Initialize chain
    //
    Int_t iInit = chain->Init();
    if (iInit) chain->Fatal(iInit,"on init");
    chain->PrintInfo();
    
    //
    // Event loop
    //
    int istat = 0, i = 1;
EventLoop: if (i <= nEvents && istat != 2) {
   
   cout << endl << "============================ Event " << i
	<< " start ============================" << endl;
   
   chain->Clear();
   istat = chain->Make(i);
   if (istat == 2) 
     {cout << "Last  event processed. Status = " << istat << endl;}
   if (istat == 3) 
     {cout << "Error event processed. Status = " << istat << endl;}
   
   //   gObjectTable->Print();
   i++;
   goto EventLoop;
 }
    
    i--;
  cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl;

  //
  // Chain Finish
  //
  if (nEvents > 1) {
    chain->Finish();
  }


}
コード例 #24
0
ファイル: make.C プロジェクト: jdbrice/StVpdPicoDstMaker
void make( const Char_t *fileList = "mtd.lis",
					const Char_t *name = ".root",
					int maxEvents = 200000,
					int maxFiles = 1 )
{
  	

  	// Load libraries
	gROOT->Macro("loadMuDst.C");
	gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
	loadSharedLibraries();
	
	gSystem ->Load("StChain");
	gSystem->Load("StRooBarb");
	gSystem->Load("StVpdPicoMaker");
	
	// Create Chain
	chain = new StChain("StChain");

	// create the StMuDstMaker
	StMuDstMaker *muDstMaker = new StMuDstMaker(  0, 0, "", fileList, "MuDst.root", maxFiles );

	StVpdPicoDstMaker *rcpQA = new StVpdPicoDstMaker("VpdPicoDst", ("ntuple_" + string(name) ).c_str() );
	

	// Initialize chain
	Int_t iInit = chain->Init();
	if (iInit) 
		chain->Fatal(iInit,"on init");
	
	chain->PrintInfo();


	bool good = true;
	int iEvent = 0;
	while ( good ){

		if ( iEvent >= maxEvents )
			break;

		chain->Clear();
		int istat = 0;
		istat = chain->Make(iEvent);
		if (istat == 2) {
			cout << "Last  event processed. Status = " << istat << endl;
			break;
		}
		if (istat == 3) {
			cout << "Error event processed. Status = " << istat << endl;
		}

		if ( iEvent % 1000 == 0 ) {
			cout << " Event " << iEvent << " Complete" << endl;
		}

		iEvent++;
	}

	// Clean up
	if (iEvent >= 1) {
		chain->Finish();
		delete chain;
	}

}
コード例 #25
0
ファイル: rdMu2histoExample.C プロジェクト: star-bnl/star-emc
int rdMu2histoExample( int nEve=5000 ){

  Int_t nFiles  = 1; 
  char* file="st_physics_12108020_raw_1020001.MuDst.root";
  char* inDir   = "/star/data05/scratch/balewski/mu2011/";
  TString fullName=file;

  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  cout << " loading done " << endl;
  gSystem->Load("StDbLib");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");
  gSystem->Load("StEEmcUtil");  
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StEzExample");

  // create chain    
  chain = new StChain("StChain"); 

  printf("adding muDst from run '%s' ....\n",fullName.Data());

  // Now we add Makers to the chain...   
  muMk = new StMuDstMaker(0,0,inDir,fullName,".MuDst.root",nFiles);
  //switch on only ETOW branch I need
  muMk->SetStatus("*",0);
  muMk->SetStatus("MuEvent",1);
  muMk->SetStatus("EmcTow",1);

  TChain* tree=muMk->chain(); assert(tree); 
  int nEntries=tree->GetEntries();
  printf("total eve in chain =%d\n",nEntries);



  St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
  new StEEmcDbMaker("eemcDb");
  gMessMgr->SwitchOff("D");
  gMessMgr->SwitchOff("I");

  TObjArray  HList;

  myMk3=new StEEtowerExampleMaker("eeExample","MuDst");
  myMk3->Set(&HList);

  chain->ls();
  chain->Init();
  //  return;

  // read one event first to init DB, excluded from timing measurement

  chain->Clear();
  stat = chain->Make();

  int eventCounter=0;
  int stat=0;
  int t1=time(0);
  //---------------------------------------------------
  while ( stat==0 ) {// loop over events
    if(eventCounter>=nEve) break;
    eventCounter++;
    chain->Clear();
    stat = chain->Make();
    if(eventCounter%500==0)
      printf("\n ====================%d  processing  ============\n", eventCounter);
    
  }
  printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
  //  return;
  int t2=time(0);
  if(t2==t1) t2=t1+1;
  float rate=1.*nEve/(t2-t1);
  printf("sorting done %d of   nEve=%d, CPU rate=%.1f Hz\n",eventCounter,nEntries,rate);

   chain->Finish();

   // save output histograms

   HList.ls();
   myMk3->saveHisto("aaa");

}
コード例 #26
0
void runPicoD0AnaMaker(TString d0list,TString outFileName)
{
  //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 = "SL15c";
  string env_SL = getenv ("STAR");
  if(env_SL.find(SL_version)==string::npos)
  {
      cout<<"Environment Star Library does not match the requested library in runPicoD0EventMaker.C. Exiting..."<<endl;
      exit(1);
  }

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

	gSystem->Load("StPicoDstMaker");
  gSystem->Load("StPicoPrescales");
	gSystem->Load("StPicoD0EventMaker");
	gSystem->Load("StPicoD0AnaMaker");
	gSystem->Load("StPicoHFMaker");

  chain = new StChain();

  // create list of picoDst files
  TString command = "sed 's/hft\\\/d0tree/picodsts/g' "+d0list+" >correspondingPico.list";
  gSystem->Exec(command.Data());
  command = "sed -i 's/picoD0/picoDst/g' correspondingPico.list";
  gSystem->Exec(command.Data());
	StPicoDstMaker* picoDstMaker = new StPicoDstMaker(0,"correspondingPico.list","picoDstMaker");
	StPicoD0AnaMaker*  picoD0AnaMaker = new StPicoD0AnaMaker("picoD0AnaMaker",d0list,outFileName.Data(),picoDstMaker);
	
	StHFCuts* d0Cuts = new StHFCuts("d0Cuts");
	picoD0AnaMaker->setHFCuts(d0Cuts);

	// -------------- USER variables -------------------------
	// add your cuts here. 

	// tracking
	d0Cuts->setCutNHitsFitMax(20);

	// pions
	d0Cuts->setCutTPCNSigmaPion(3.0);

	// kaons
	d0Cuts->setCutTPCNSigmaKaon(2.0);
   
	// kaonPion pair cuts
	float dcaDaughtersMax = 0.008;  // maximum
	float decayLengthMin  = 0.0030; // minimum
	float decayLengthMax  = 999999; //std::numeric_limits<float>::max();
	float cosThetaMin     = 0.90;   // minimum
	float minMass         = 1.6;
	float maxMass         = 2.1;
	d0Cuts->setCutSecondaryPair(dcaDaughtersMax, decayLengthMin, decayLengthMax, cosThetaMin, minMass, maxMass);
	  
  chain->Init();
  int nEntries = picoD0AnaMaker->getEntries();
  for(int iEvent = 0; iEvent<nEntries; ++iEvent)
  {
    chain->Clear();
    int iret = chain->Make();
	  if (iret) { cout << "Bad return code!" << iret << endl; break;}
  }

  chain->Finish();
  delete chain;

  // delete list of picos
  command = "rm -f correspondingPico.list";
  gSystem->Exec(command.Data());

}
コード例 #27
0
ファイル: rdMuDst2LcpTree.C プロジェクト: star-bnl/star-emc
int rdMuDst2LcpTree(  const char *muDstList="400K.lis", // sample of R3012008+10+12+13
		      int maxList=6,
		      char * wrkDir="./wrkLcpX/",
		      int off48=0, 
		      int maxEve=3000,
		      float maxEta=1.0
		      ){ 

  if (gClassTable->GetID("TTable") < 0) {
    gSystem->Load("libTable");
    gSystem->Load("libPhysics");
  }     
  printf("Use muDst list= '%s'\n",muDstList);
  
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  cout << " loading done " << endl;
  
  // Load my maker
  assert(gSystem->Load("LCP")==0 );
  //assert(gSystem->Load("MikesRejector")==0 );// Mike's rejector
   
  // create chain    
  chain = new StChain("StChain");   
  
  StMuDbReader* db = StMuDbReader::instance();
  muDstMk = new StMuDstMaker(0,0,"",muDstList,"MuDst.root",maxList);  
  
  // Now we add Makers to the chain...   
  
  StMuLcp2TreeMaker *myMk = new StMuLcp2TreeMaker("jasEE","MuDst");
  myMk->SetOutDir(wrkDir);
  myMk->SetOff48(off48);
  
  // avaliable switches
  // myMk->SetMinNFitPoint(nFitP); 
  // myMk->SetMaxDCAxy(maxDCAxy);
  myMk->SetMaxEta(maxEta);
  // myMk->SetMinPt(minPt);
  // myMk->SetMinFitPfrac(FitPfrac);
  // myMk->InitRunFromMake(xRun); // if used turns off TTree, saves only histo, allows to add runs 
   
  chain->Init();
  chain->ls(3);
  // StMuDebug::setLevel(4);  // switch of some debug output
  
  int eventCounter=0;
 
  printf(" requested maxEve=%d\n",maxEve);
  //---------------------------------------------------
  while ( 1) {// loop over events
    eventCounter++;;
    if(eventCounter >maxEve) break;
    chain->Clear();
    int stat = chain->Make();
    if(stat) break;
    if(eventCounter%1000) continue;
    StMuEvent* e = muDstMk->muDst()->event();
    
    int n = muDstMk->muDst()->primaryTracks()->GetEntries();  // get number of primary tracks
    printf(".C: eve=%d Nprim=%d\n",eventCounter,n);
    
  }
  
 
  //  chain->Finish();
  
}
コード例 #28
0
ファイル: show.C プロジェクト: star-bnl/star-emc
void
show
(
 char* inpDir  = "",         // MuDST directory
 char* inpFile = "show.lis", // MuDST file(s);                      
 char* outFile = "show.root",// output tree file
 Int_t nFiles  = 50,         // # of MuDST file(s)
 Int_t nEvents = 100         // # of events
 )
  // remeber to adjust dbase timestamp below !!!! 
  // what a ... design
{ 
  //gErrorIgnoreLevel=1999;

  // load root/root4star libraries
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();

  // load more libraries :)
  gSystem->Load("libmysqlclient");
  gSystem->Load("libGeom");
  gSystem->Load("StDbLib");
  gSystem->Load("StDbBroker");
  gSystem->Load("St_db_Maker");

  // load even more libraries (EEMC stuff) 
  gSystem->Load("StEEmcUtil");
  gSystem->Load("StEEmcDbMaker");
  gSystem->Load("StEEmcPoolTTM");

  // create the chain    
  chain = new StChain("StChain"); 
  //

  now = new TDatime;
  // for display
  TCanvas    *c1   = new TCanvas("eemc","eemc",10,10,1000,1000);
  TPaveLabel *tlab = new TPaveLabel(-0.99,+0.99,+0.99,+0.90,
				    "EEMC TOWERS & TPC TRACKS     Piotr A Zolnierczuk (IU)");

  eventInfo = new TPaveText (-0.99,-0.99,+0.0 ,-0.75);
  dateInfo  = new TPaveLabel(+0.60,-0.99,+0.99,-0.95,now->AsString());

  TGeoManager  *gm    = new TGeoManager("eemc", "eemc tower display");
  TGeoVolume   *top   = gm->MakeBox("star",0, 200., 200., 350.);
  TGeoVolume   *smbox = gm->MakeBox("smbox1",0, 2., 2., 2.);
  smbox->SetLineColor(kRed);
  // eemc 
  eemc  = new EEmcTTDisplay();
  eemc->SetMagneticField(0.5); // in Tesla
  eemc->SetShowExtrapolatedTracks(true);
 
  TGeoTranslation *etra = new TGeoTranslation(0.0,0.0,0.5*(eemc->getZ1()+eemc->getZ2()));
  top->AddNode(smbox, 1,NULL);
  top->AddNode(eemc(),1,etra);
  gm->SetTopVolume(top);
  gm->CloseGeometry();
  gm->SetVisLevel(4);
  gm->SetVisOption(0);

  c1->SetTheta(90);
  c1->SetPhi(0);

  top->Draw();
  tlab->Draw();

  gPad->Update();
  
  // now we add Makers to the chain...  some of that is black magic :) 
  muDstMk  = new StMuDstMaker(0,0,inpDir,inpFile,"",nFiles);       // muDST main chain
  StMuDbReader  *db       = StMuDbReader::instance();              // need the database
  St_db_Maker   *dbMk        = new St_db_Maker("StarDb", "MySQL:StarDb");   // need another db(?) 
  new StEEmcDbMaker("eemcDb");                     // need EEMC database  

  // now comment in/out/change the below if you want it your way
  dbMk->setTimeStampDay(20040331);   // format: yyyymmdd

  // finally after so many lines we arrive at the good stuff

  ttm = new  EEmcTTMMaker ("TTM",muDstMk,eemcDbMk);
  ttm->Summary(cout);    // 

  StMuDebug::setLevel(0);

  chain->Init();

  StEEmcDb *eemcDb = (StEEmcDb*)chain->GetDataSet("StEEmcDb");
  eemcDb->setSectors(1,12);            // request EEMC DB for sectors you need (dafault:1-12)
  eemcDb->setPreferedFlavor("onlped","eemcPMTped"); // request alternative flavor

  chain->ls(3);

  //---------------------------------------------------
  next();
}
コード例 #29
0
ファイル: rdTrg2Panitkin.C プロジェクト: star-bnl/star-emc
int rdTrg2Panitkin(int nEve=1000000,
		   char* file="R7072002",
		   char *pathIn="//star/data05/scratch/balewski/2006-L2algo-events/2006-data/072/",
		   char *pathOut="./wrk/hist/"
		   ){ 
  
  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  cout << " loading done " << endl;
  // assert( !gSystem->Load("StEEmcPoolmuEztPanitkin")); // DEV version
  assert( !gSystem->Load(".sl305_gcc323/obj/StRoot/StEEmcPool/muEztPanitkin/StEEmcPoolmuEztPanitkin.so")); // local version
  assert( !gSystem->Load("StEEmcUtil")); 
  assert( !gSystem->Load("StEEmcPoolHanksTriggerDataReader")); 
  
  // create chain    
  chain = new StChain("StChain"); 
  
  TString iFile=file; iFile+=".dat";
  iFile=pathIn+iFile;

  trgRd = new StTriggerDataReader("TRGRD");
  if (trgRd->OpenFile(iFile.Data())==kStErr){
    printf("Error opening data file %s\n",file);
    return(kStErr);
  }else{
    printf("Opening data file %s\n",iFile.Data());
  }
  
  HList=new  TObjArray;
  myMk3=new StTrigOnlyPanitkinMaker("trig2Panitkin","MuDst");
  myMk3->SetHList(HList);

  chain->Init();
  chain->ls(3);
  
  int eventCounter=0;
  int stat=0;
  int t1=time(0);
  StMuTimer timer;
  timer.start();
  
  while ( 1) {// loop over events
    if(eventCounter>=nEve) break;
    eventCounter++;
    chain->Clear();        
    stat = chain->Make();
    if(stat) break;
    if(eventCounter%2000!=0)continue;
    
    printf("\n\n ====================%d  processing  ==============\n", eventCounter);
    
  }
 
  printf("sorting done, nEve=%d \n",nEve);
  int t2=time(0);
  if(t1==t2) t2++;
  float rate=1.*eventCounter/(t2-t1);
  float nMnts=(t2-t1)/60.;
  printf("sorting done nEve=%d , elapsed rate=%.1f Hz, tot %.1f minutes\n",eventCounter,rate,nMnts);
  
  if (eventCounter) {
    cout << "CPU time/event= " << timer.elapsedTime()/eventCounter << " sec  "
	 << " rate= " << eventCounter/timer.elapsedTime() <<  " Hz" << endl;
  }

  TString hFile=file;
  hFile=pathOut+hFile;
  myMk3->saveHisto(hFile);
  trgRd->CloseFile();
 }
コード例 #30
0
ファイル: readWtree.C プロジェクト: plexoos/vbasym
void readWtree(	const Char_t *fileList="./R10081007.lis", int etaBin=7, int maxEvents=1e8, bool spinSort=true)
{

  if(etaBin==7) isZ=true;

  // load shared libraries
  gROOT -> LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  loadSharedLibraries();
  assert( !gSystem->Load("StDetectorDbMaker")); 
  assert( !gSystem->Load("StTpcDb"));
  assert( !gSystem->Load("StDbUtilities")); 
  assert( !gSystem->Load("StDbBroker"));
  assert( !gSystem->Load("St_db_Maker"));
  assert( !gSystem->Load("StEEmcUtil"));
  assert( !gSystem->Load("StWalgo2011"));
  assert( !gSystem->Load("StSpinDbMaker"));
  assert( !gSystem->Load("StJets"));
    
  // create analysis chain
  chain = new StChain("chain");
  TObjArray* HListZ=new TObjArray;
  TObjArray* HListEta=new TObjArray;;
  
  //define eta ranges
  float etaLow[7] = {-0.9, -0.4, 0.0, 0.4, 0.9, 1.15, -1.};
  float etaHigh[7] = {-0.4, 0.0, 0.4, 0.9, 1.15, 1.35, 1.};

  //initiate W maker
  wTreeMk = new St2011WMaker(Form("Eta%d",etaBin));
  wTreeMk->setJetTreeBranch("ConeJets12_100","ConeJets12_100_noEEMC"); //select jet tree braches used
  //set cuts for barrle and endcap algos
  wTreeMk->setWbosonCuts(25., 0.88, 14., etaLow[etaBin-1], etaHigh[etaBin-1]); //highET, nearTotEtFrac, ptBalance, etaLow, etaHigh
  wTreeMk->setE_WbosonCuts(25., 0.85, 14., etaLow[etaBin-1], etaHigh[etaBin-1]); //highET, nearTotEtFrac, ptBalance, etaLow, etaHigh
  wTreeMk->setHList(HListEta);
  wTreeMk->setMaxDisplayEve(1); // only first N events will get displayed 

  //......... spin sorting
  if(spinSort){
    enum {mxSM=1}; // only one for now
    St2011pubSpinMaker *spinMkA[mxSM];
    for(int kk=0;kk<mxSM;kk++) {
      char ttx[100]; sprintf(ttx,"%cEta%dspin",'A',etaBin);
      printf("add spinMaker %s %d \n",ttx,kk);
      spinMkA[kk]=new St2011pubSpinMaker(ttx,Form("Eta%d",etaBin)); 
      spinMkA[kk]->attachWalgoMaker(wTreeMk);
      spinMkA[kk]->setHList(HListEta);
      //assign eta bin same as W maker
      spinMkA[kk]->setEta(etaLow[etaBin-1],etaHigh[etaBin-1]); 
      
      //possibly add other copies for systematic checks later
      //if(kk==1) spinMkA[kk]->setEta(-1.,0.);
      //if(kk==2) spinMkA[kk]->setEta(0,1.);
      //if(kk==3) spinMkA[kk]->setQPT(-1);// disable Q/PT cut
      //if(kk==4) spinMkA[kk]->setNoEEMC(); 
    }  
  }

  // Z maker
  if (isZ){
    ZMk=new St2011ZMaker("Z"); 
    ZMk->attachWalgoMaker(wTreeMk);
    ZMk->setHList(HListZ); 
    ZMk->setNearEtFrac(0.88);
    ZMk->setClusterMinEt(15);
    ZMk->setPhi12Min(3.1416/2.);
    ZMk->setMinZMass(73.); // Zmass -20%
    ZMk->setMaxZMass(114.);// Zmass +20%
  }

  //chain W and jet trees in W maker
  chainFiles(fileList);
  
  chain->ls(3);
  chain->Init();

  Int_t nevents = wTreeMk->getNumberOfEvents();
  cout<<nevents<<" events in chain"<<endl;
  if(nevents<1) {cout<<"No events in chain, check your list file"<<endl;  return; }

  Int_t stat  = 0;  Int_t event = 0;
  while ( !stat ) 
    {
      if ( nevents>=0 )
	if ( event>=nevents || event > maxEvents) break;
      chain -> Clear();
      stat = chain->Make();
      event++;
    }

  char *file1=fileList;
  printf("file1=%s=%s=\n",file1);
  TString outFile="";  outFile+=file1;
  outFile.ReplaceAll(".lis",Form("_Eta%d.wana.hist.root",etaBin));
  outFile.ReplaceAll("lists/treeReader/","");
  TFile *outF=new TFile(outFile,"RECREATE");
  if(outF->IsOpen()){
    TDirectory *Eta = outF->mkdir(Form("Eta%d",etaBin));
    Eta->cd();
    HListEta->Write();
    if(isZ){
      TDirectory *Z = outF->mkdir("Z");
      Z->cd();
      HListZ->Write();
    }
    cout<<endl<<" Histo saved -->"<<outFile<<endl;
  }
  else
    cout<<endl<<" Couldn't open file "<<outFile<<endl;

  delete outF;
    

}