本文整理汇总了C++中StIOMaker::SetIOMode方法的典型用法代码示例。如果您正苦于以下问题:C++ StIOMaker::SetIOMode方法的具体用法?C++ StIOMaker::SetIOMode怎么用?C++ StIOMaker::SetIOMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StIOMaker
的用法示例。
在下文中一共展示了StIOMaker::SetIOMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Example_read_dst_print_tables
void Example_read_dst_print_tables(
Int_t nevents=1,
const char *MainFile=
"/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root")
{
//
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("libglobal_Tables");
gSystem->Load("libgen_Tables");
gSystem->Load("libsim_Tables");
gSystem->Load("libtpc_Tables");
gSystem->Load("StIOMaker");
gSystem->Load("StarClassLibrary");
cout << " .. Example_read_dst_print_tables.C, have loaded libraries " << endl;
// Setup top part of chain
chain = new StChain("bfc");
chain->SetDebug();
//
// setup chain with IOMaker - can read in .dst.root, .dst.xdf files
StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
IOMk->SetDebug();
IOMk->SetIOMode("r");
IOMk->SetBranch("*",0,"0"); //deactivate all branches
// IOMk->SetBranch("tpc_tracks",0,"r"); //activate tpc_tracks Branch
// IOMk->SetBranch("geantBranch",0,"r"); //activate geant Branch
IOMk->SetBranch("dstBranch",0,"r"); //activate dst Branch
// --- now execute chain member functions
chain->Init();
for (int iev=0;iev<nevents; iev++)
{
chain->Clear();
int iret = chain->Make();
if (iret) break;
cout << endl << endl <<
" !!! Now print info about event # " << iev << endl;
// ------ List all tables -----------
// GetDataSet is a member function of St_Maker
Event = chain->GetDataSet("dst");
// ls() returns a virtual void, so don't have to set it = to anything
if (Event) Event->ls();
// ---------------------- globtrk table ---------------------
// get dataset for globtrk
TDataSet *ds=chain->GetDataSet("dst/globtrk");
if (ds) {
cout << " Now print info about globtrk table " << endl;
// create iterator for the dataset
TDataSetIter globtrkiter(ds);
// Du,Pwd return things, but we choose not to keep the return value
globtrkiter.Du();
globtrkiter.Pwd();
// find the table
St_dst_track *glob = (St_dst_track *) globtrkiter.Find("globtrk");
// print out info about it
// using ls() from TDataSetIter
glob->ls();
// Print() is a member function of TTable
//glob->Print(9,1);
//glob->Print(8,1);
//glob->Print(8,2);
//glob->Print(1,1);
glob->Print(0,5);
// can't use this method anymore!!! 5June00 Kathy
// get the table header data using member function of TTable
//table_head_st *tdt_h = glob->GetHeader();
// cout << " header name = " << tdt_h->name << endl;
// cout << " header type = " << tdt_h->type << endl;
// cout << " header maxlen = " << tdt_h->maxlen << endl;
// cout << " header nok = " << tdt_h->nok << endl;
// get the table header data using member functions of TTable
cout << " table header info: name = " << glob->GetName() << endl;
cout << " table header info: type = " << glob->GetType() << endl;
cout << " table header info: #rows used = " << glob->GetNRows() << endl;
cout << " table header info: #rows allocated = " << glob->GetTableSize() << endl;
cout << " table header info: row size (bytes) = " << glob->GetRowSize() << endl;
cout << " table header info: #columns = " << glob->GetNumberOfColumns() << endl;
//.........这里部分代码省略.........
示例2: rdSt2print
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;
}
示例3: CorrectResolution
void CorrectResolution(Int_t nevents=100)
{
// Dynamically link needed shared libs
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("St_Tables");
gSystem->Load("StUtilities"); // new addition 22jul99
gSystem->Load("StAnalysisUtilities"); // needed by V0dstMaker
gSystem->Load("StMagF");
gSystem->Load("StIOMaker");
gSystem->Load("StarClassLibrary");
gSystem->Load("StEvent");
gSystem->Load("StEventMaker");
gSystem->Load("StHbtMaker");
cout << "Dynamic loading done" << endl;
chain = new StChain("StChain");
chain->SetDebug();
#ifndef USE_MICRODST
StIOMaker* ioMaker = new StIOMaker("IO","r","/star/rcf/data07/reco/P00hg/2000/07/st_physics_*dst.root","bfcTree");
ioMaker->SetDebug();
ioMaker->SetIOMode("r");
ioMaker->SetDebug();
ioMaker->SetBranch("*",0,"0"); //deactivate all branches
ioMaker->SetBranch("dstBranch",0,"r"); //activate EventBranch
StEventMaker* eventMaker = new StEventMaker("events","title");
cout << "Just instantiated StEventMaker... lets go StHbtMaker!" << endl;
#endif
// Now we add Makers to the chain...
StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
cout << "StHbtMaker instantiated"<<endl;
/* -------------- set up of hbt stuff ----- */
cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl;
StHbtManager* TheManager = hbtMaker->HbtManager();
// here, we instantiate the appropriate StHbtEventReader
#ifdef USE_MICRODST
StHbtBinaryReader* Reader = new StHbtBinaryReader("-","microDst.lis");
#else
StStandardHbtEventReader* Reader = new StStandardHbtEventReader;
Reader->SetTheEventMaker(eventMaker); // gotta tell the reader where it should read from
#endif
// here would be the palce to plug in any "front-loaded" Event or Particle Cuts...
TheManager->SetEventReader(Reader);
StHbtVertexAnalysis* anal;
mikesEventCut* FrontLoadedEvcut;
mikesStarStandardEventCut* evcut;
mikesTrackCut* trkcut;
qualityPairCut* qpc;
ManyPairCuts* MPC;
EntranceSepPairCut* espc;
StHbtCoulomb* cc;
QinvCorrFctn* QinvCF;
BPLCMSFrame3DCorrFctn* BpLcmsCF;
char* QinvCF_name;
char* BP_name;
int MultLo,MultHi;
float pTLo,pTHi;
int charge;
// SPEED IT UP -- FRONT-LOADED EVENT CUT and TRACK CUT
FrontLoadedEvcut = new mikesEventCut;
FrontLoadedEvcut->SetEventMult(30,100000);
FrontLoadedEvcut->SetVertZPos(-75.0,75.0);
Reader->SetEventCut(FrontLoadedEvcut);
// Removed Front-loaded Track cut
cout << "READER SET UP.... " << endl;
/* MOST CENTRAL PIMINUS hi-pT (5) */
//.........这里部分代码省略.........
示例4: makePicoDst
void makePicoDst(const Int_t runnumber=999999,
const Char_t *inputFile="/star/institutions/lbl_prod/mlomnitz/SSD_Simu/StEvent/hijing_**.MuDst.root",
const Char_t *inputGeant="/star/institutions/lbl_prod/mlomnitz/SSD_Simu/StEvent/hijing_**.McEvent.root",
TString outfilename="out",
const bool creatingPhiWgt = kFALSE, const int prodMod = 0, const int emcMode=0,
const bool createMcBranch = kTRUE
){
Int_t nEvents = 10000000;
//Int_t nEvents = 50;
//Load all the System libraries
cout<<inputFile<<endl;
gSystem->Load("libTable");
gSystem->Load("libPhysics");
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("St_Tables");
gSystem->Load("StUtilities"); // new addition 22jul99
gSystem->Load("StTreeMaker");
gSystem->Load("StIOMaker");
gSystem->Load("StarClassLibrary");
gSystem->Load("StTriggerDataMaker"); // new starting from April 2003
gSystem->Load("StBichsel");
gSystem->Load("StEvent");
gSystem->Load("StEventUtilities");
gSystem->Load("StDbLib");
gSystem->Load("StEmcUtil");
gSystem->Load("StTofUtil");
gSystem->Load("StPmdUtil");
gSystem->Load("StPreEclMaker");
gSystem->Load("StStrangeMuDstMaker");
gSystem->Load("StMuDSTMaker");
if( createMcBranch){
gSystem->Load("StMcEvent");
gSystem->Load("StAssociationMaker");
}
if(!creatingPhiWgt&&emcMode) {
gSystem->Load("StTpcDb");
gSystem->Load("StMcEvent");
gSystem->Load("StMcEventMaker");
gSystem->Load("StDaqLib");
gSystem->Load("libgen_Tables");
gSystem->Load("libsim_Tables");
gSystem->Load("libglobal_Tables");
gSystem->Load("StEmcTriggerMaker");
gSystem->Load("StEmcUtil");//mine
gSystem->Load("StEmcRawMaker");
gSystem->Load("StEmcADCtoEMaker");
gSystem->Load("StPreEclMaker");
gSystem->Load("StEpcMaker");
gSystem->Load("StEmcSimulatorMaker");
gSystem->Load("StEmcUtil");
gSystem->Load("StDbBroker");
gSystem->Load("StDetectorDbMaker");
gSystem->Load("StDbUtilities");
gSystem->Load("StEEmcUtil");
gSystem->Load("StEEmcDbMaker");
gSystem->Load("St_db_Maker");
gSystem->Load("StTriggerUtilities");
}
gSystem->Load("StPicoDstMaker");
chain = new StChain();
if( createMcBranch ){
StIOMaker* ioMaker = new StIOMaker("IO","r",inputGeant,"bfcTree");
ioMaker->SetDebug();
ioMaker->SetIOMode("r");
ioMaker->SetBranch("*",0,"0"); //deactivate all branches
//ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
ioMaker->SetBranch("McEventBranch",0,"r"); //activate geant Branch
ioMaker->SetBranch("eventBranch",0,"r"); //activate geant Branch
StAssociationMaker* associator = new StAssociationMaker;
cout<<"created new StAssociationMaker"<<endl;
associator->useInTracker();
}
StMuDstMaker *MuDstMaker = new StMuDstMaker(0,0,"",inputFile,"MuDst",100);
MuDstMaker->SetStatus("*",0);
MuDstMaker->SetStatus("MuEvent",1);
MuDstMaker->SetStatus("PrimaryVertices",1);
MuDstMaker->SetStatus("PrimaryTracks",1);
MuDstMaker->SetStatus("GlobalTracks",1);
MuDstMaker->SetStatus("CovGlobTrack",1);
//MuDstMaker->SetStatus("BTof*",1);
//MuDstMaker->SetStatus("Emc*",1);
if(!creatingPhiWgt&&emcMode) {
St_db_Maker *dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
// Endcap database
StEEmcDbMaker* eemcDb = new StEEmcDbMaker;
StEmcADCtoEMaker *adc2e = new StEmcADCtoEMaker();
adc2e->setPrint(false);
//adc2e->setFillHisto(false);
//adc2e->setDebug(false); //more histograms
//adc2e->setSMDRmsCut(0,0);
adc2e->saveAllStEvent(true);
//adc2e->setRemoveGhostEvent(false);
//.........这里部分代码省略.........
示例5: TestIOMaker
void TestIOMaker(Int_t nevents=3,
//This file points to 30 events of 10 neg muons w/ pt=.9
const char* MainFile="/star/data22/ITTF/data/simple_geant/DEV_10_8_01/*.event.root")
//This file points to 5 muons /event
//const char* MainFile="/star/data22/ITTF/EvalData/MCNtuple/muon_100_neg.event.root")
//This file points to 110 events from mevsim (homebrew had. cocktail)
//const char* MainFile="/star/data22/ITTF/data/mevsim/10_9_01/*.event.root")
//This file points to a nightly low density hadronic cocktail reconstruction.
//const char* MainFile="/star/rcf/test/dev/trs_redhat61/Tue/year_2001/hc_lowdensity/*.event.root")
{
// Dynamically link needed shared libs
cout <<"Loading St_base"<<endl;
gSystem->Load("St_base");
cout <<"Loading StChain"<<endl;
gSystem->Load("StChain");
cout <<"Loading St_Tables"<<endl;
gSystem->Load("St_Tables");
cout <<"Loading StUtilities"<<endl;
gSystem->Load("StUtilities");
cout <<"Loading StIOMaker"<<endl;
gSystem->Load("StIOMaker");
cout <<"Loading StarClassLibrary"<<endl;
gSystem->Load("StarClassLibrary");
cout <<"Loading DataBase"<<endl;
gSystem->Load("StDbUtilities");
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
gSystem->Load("StTpcDb");
cout <<"Loading StEvent"<<endl;
gSystem->Load("StEvent");
cout <<"Loading StEventMaker"<<endl;
gSystem->Load("StEventMaker");
cout <<"Loading StEmcUtil"<<endl;
gSystem->Load("StEmcUtil");
cout <<"Loading StMcEvent"<<endl;
gSystem->Load("StMcEvent");
cout <<"Loading StMcEventMaker"<<endl;
gSystem->Load("StMcEventMaker");
cout <<"Loading AssociationMaker"<<endl;
gSystem->Load("StAssociationMaker");
// create a new instance of the chain
chain = new StChain("StChain");
chain->SetDebug();
// add makers to the chain
StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree");
ioMaker->SetDebug();
ioMaker->SetIOMode("r");
ioMaker->SetBranch("*",0,"0"); //deactivate all branches
ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
ioMaker->SetBranch("dstBranch",0,"r"); //activate Event Branch
ioMaker->SetBranch("runcoBranch",0,"r"); //activate runco Branch
//Calibration Maker (StarDB,not a real Database!)
const char* calibDB = "MySQL:StarDb";
const char* paramsDB = "$STAR/StarDb";
St_db_Maker* calibMk = new St_db_Maker("StarDb",calibDB,paramsDB);
calibMk->SetDateTime("year_2b");
//calibMk->SetDateTime("year_1h");
calibMk->SetDebug();
//Read Tpc Database access
StTpcDbMaker *tpcDbMk = new StTpcDbMaker("tpcDb");
//StEventMaker
StEventMaker* eventReader = new StEventMaker("events","title");
eventReader->doPrintEventInfo = 0;
//StMcEventMaker
StMcEventMaker* mcEventReader = new StMcEventMaker();
//Association
StAssociationMaker* assocMaker = new StAssociationMaker();
cout <<"Calling Init() Methods "<<endl;
chain->Init();
cout <<"Starting Event Loop"<<endl;
int istat=0,iev=1;
EventLoop: if (iev<=nevents && !istat) {
chain->Clear();
//.........这里部分代码省略.........
示例6: bfcread_hist_extract
void bfcread_hist_extract(
const Char_t *MainFile=
"/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root",
const Char_t *MakerHistDir="EventQA",
const Char_t *TopDirTree="bfcTree",
Char_t *OutFile=0,
const Char_t *PrintList="")
{
cout << "bfcread_hist_extract.C, input hist file = "
<< MainFile << endl;
cout << "bfcread_hist_extract.C, directory name for hist = "
<< MakerHistDir << endl;
cout << "bfcread_hist_extract.C, top level directory in hist file = "
<< TopDirTree << endl;
//
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("StIOMaker");
gSystem->Load("StarClassLibrary");
gSystem->Load("StUtilities");
gSystem->Load("StAnalysisUtilities");
gSystem->Load("libglobal_Tables");
// setup chain with IOMaker - can read in .dst.root, .dst.xdf files
StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree);
IOMk->SetDebug();
IOMk->SetIOMode("r");
IOMk->SetBranch("*",0,"0"); //deactivate all branches
IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch
// constructor for other maker (not used in chain)
StHistUtil *HU = new StHistUtil;
// now must set pointer to StMaker so HistUtil can find histograms
// with StHistUtil methods
// -- input any maker pointer but must cast as type StMaker
HU->SetPntrToMaker((StMaker *)IOMk);
// ONLY use StIOMaker in chain
// --- now execute chain member functions - 1 event (histograms) only
IOMk->Init();
IOMk->Clear();
IOMk->Make();
// method to print out list of histograms
// - can do this anytime after they're booked
// - default is to print out QA hist branch
Int_t NoHist=0;
//NoHist = HU->ListHists(MakerHistDir);
TList* dList = HU->FindHists(MakerHistDir);
if (PrintList) HU->SetDefaultPrintList(MakerHistDir,PrintList);
NoHist = HU->CopyHists(dList);
TH1** nh = HU->getNewHist();
TString name = MainFile;
if (!OutFile) {
name.Remove(0,name.Last('/')+1);
TString name2 = MakerHistDir;
name2.Remove(0,name2.Last('/')+1);
name.Insert(name.First('.'),"_");
name.Insert(name.First('.'),name2);
OutFile = name.Data();
}
cout << "Output hist file: " << OutFile << endl;
TFile* ofile = new TFile(OutFile,"RECREATE");
for (int i=0; i<NoHist; i++) {
printf("Extracting: %d. %s : %s\n",
i+1,nh[i]->GetName(),nh[i]->GetTitle());
nh[i]->Write();
}
ofile->Close();
}
示例7: Run2006SimuTriggerMaker
void Run2006SimuTriggerMaker(const char *dir ="",
const char* file="/star/data32/reco/pp200/pythia6_205/above_35gev/cdf_a/y2004y/gheisha_on/p05ih/rcf1230_10_4000evts.MuDst.root",
const char *fname="/star/data32/reco/pp200/pythia6_205/above_35gev/cdf_a/y2004y/gheisha_on/p05ih/rcf1230_10_4000evts.event.root",
const char *filter = "")
{
int nevents = 10;
gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
loadSharedLibraries();
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("StPreEclMaker");
gSystem->Load("StEpcMaker");
gSystem->Load("StEmcSimulatorMaker");
gSystem->Load("StEmcUtil");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
gSystem->Load("StEEmcUtil");
gSystem->Load("StEEmcDbMaker");
gSystem->Load("StEmcTriggerMaker");
double pi = atan(1.0)*4.0;
cout << " loading done " << endl;
chain= new StChain("StChain");
chain->SetDebug(1);
gMessMgr->SwitchOff("D");
gMessMgr->SwitchOff("I");
StIOMaker* ioMaker = new StIOMaker();
ioMaker->SetFile(fname);
ioMaker->SetIOMode("r");
ioMaker->SetBranch("*",0,"0"); //deactivate all branches
ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
class StMcEventMaker *mcEventMaker = new StMcEventMaker();
mcEventMaker->doPrintEventInfo = false;
mcEventMaker->doPrintMemoryInfo = false;
StMuDebug::setLevel(1);
StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1e6,"MuDst");
//Database -- get a real calibration from the database
St_db_Maker* dbMk = new St_db_Maker("StarDb","MySQL:StarDb","MySQL:StarDb","$STAR/StarDb");
dbMk->SetDateTime(20060506,214129 ); // for simulation
//to use ideal ideal gains/status/calib uncommment correct line below
//dbMk->SetFlavor("sim","bemcPed");
//dbMk->SetFlavor("sim","bemcStatus");
//dbMk->SetFlavor("sim","bemcCalib");
//dbMk->SetFlavor("sim","bemcGain");
//dbMk->SetFlavor("sim","eemcPMTcal");
//dbMk->SetFlavor("sim","eemcPIXcal");
chain->ls(3);
//Database interface
StDetectorDbMaker* detDbMk = new StDetectorDbMaker();
//Endcap DB
StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
//StEmcADCtoEMaker *adc = new StEmcADCtoEMaker(); // this will just convert what's in MuDst to ADC, use for data only!
StEmcSimulatorMaker* emcSim = new StEmcSimulatorMaker(); //use this instead to "redo" converstion from geant->adc
emcSim->setCalibSpread(kBarrelEmcTowerId, 0.15);
StPreEclMaker* preEcl = new StPreEclMaker(); //need this to fill new StEvent information
//StEmcTrigger
StEmcTriggerMaker *emcTrig = new StEmcTriggerMaker("bemctrigger");
chain->Init();
chain->PrintInfo();
chain->ls(3);
TChain* fileChain = muDstMaker->chain();
int BL1_ADC[6];
int hold=-1;
for (Int_t iev=0;iev<nevents; iev++) {
cout << "****************************************** " << endl;
cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<nevents<<endl;
cout << "*************************1***************** " << endl;
chain->Clear();
int iret = chain->Make(iev);
total++;
if (iret) {
cout << "Bad return code!" << endl;
break;
}
cout<<" "<<endl;
map<int,int>::iterator iter;
map<int,int> tower;
map<int,int> tpatch;
//.........这里部分代码省略.........
示例8: DoEqualDaq
void DoEqualDaq(char* file="daq/*.daq",int nevents = 500000,char* name = "equal1.root")
{
//
// First load some shared libraries we need
//
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("libgen_Tables");
gSystem->Load("libsim_Tables");
gSystem->Load("libglobal_Tables");
gSystem->Load("StUtilities");
gSystem->Load("StIOMaker");
gSystem->Load("StTreeMaker");
gSystem->Load("StarClassLibrary");
gSystem->Load("StEvent");
gSystem->Load("StMagF");
gSystem->Load("libgeometry_Tables");
gSystem->Load("St_Tables");
gSystem->Load("StEmcUtil");
gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
loadSharedLibraries();
gSystem->Load("StDbUtilities");
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
gSystem->Load("libgeometry_Tables");
gSystem->Load("StDaqLib");
gSystem->Load("StEmcRawMaker");
gSystem->Load("StEmcADCtoEMaker");
gSystem->Load("StPreEclMaker");
gSystem->Load("StEpcMaker");
gSystem->Load("StEmcCalibrationMaker");
chain=new StChain("StChain");
chain->SetDebug();
//
// Setup IO maker
//
StIOMaker *IOMk = new StIOMaker();
IOMk->SetFile(file);
IOMk->SetIOMode("r");
IOMk->SetBranch("*",0,"0"); //deactivate all branches
IOMk->SetBranch("daqBranch",0,"r");
IOMk->SetDebug();
St_db_Maker *db = new St_db_Maker("StarDb","MySQL:StarDb");
m = new StEmcADCtoEMaker();
m->saveAllStEvent(kTRUE);
m->setPrint(kFALSE);
// This process the EMC event and fill the tables
// necessary for calibration
StEmcCalibrationMaker *cal = new StEmcCalibrationMaker();
char outfile[300];
// does equalization
sprintf(outfile,"/home/emc/online/emc/pedestal/equal/%s",name);
StEmcEqualMaker *equal = new StEmcEqualMaker();
equal->setFile(outfile);
//
// Initialize chain
//
Int_t iInit = chain->Init();
if (iInit) chain->Fatal(iInit,"on init");
chain->PrintInfo();
int istat=0,i=1;
EventLoop: if (i <= nevents && istat!=2)
{
cout << endl << "============================ Event " << i<< " start ============================" << endl;
chain->Clear();
istat = chain->Make();
if (istat==2) {cout << "Last event processed. Status = " << istat << endl;}
if (istat==3) {cout << "Error event processed. Status = " << istat << endl;}
i++;
goto EventLoop;
}
i--;
cout << endl << "============================ Event " << i << " finish ============================" << endl;
}
示例9: DoFeeTTreeSimu
void DoFeeTTreeSimu(Int_t nevents=100){
//char *fname="/star/data22/MC/balewski/pp4run3/minb200-10k.event.root";
char *fname="minb200-100.event.root";
char *fileT="myFeeMC-minb200-100.root"; // output TTree
//
// First load some shared libraries we need
//
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("libglobal_Tables");
gSystem->Load("libsim_Tables");
gSystem->Load("libgen_Tables");
gSystem->Load("St_Tables");
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
gSystem->Load("StUtilities");
gSystem->Load("StIOMaker");
gSystem->Load("StMagF");
gSystem->Load("StarClassLibrary");
gSystem->Load("StAnalysisUtilities");
gSystem->Load("StEvent");
gSystem->Load("StTpcDb");
gSystem->Load("StEventMaker");
gSystem->Load("StMcEvent");
gSystem->Load("StMcEventMaker");
gSystem->Load("libgeometry_Tables");
gSystem->Load("StEmcUtil");
if (0){
cout << " StDBLib mode enabled" << endl;
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
}
// Load my makers
gSystem->Load("EEmc");
gSystem->Load("EEfeeRaw");
gSystem->Load("SteemcDb");
// 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 1
SteemcDbMaker *myMk1=new SteemcDbMaker("eemcDBio");
myMk1->setSectors(1,12);
myMk1->setTimeStampDay(20021215); // format: yyyymmdd
St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
// My Makers 2
St2eemcFeeRawMaker * myMk3=new St2eemcFeeRawMaker("St2feeTTree");
// myMk3->setDb(myMk1);
// Output TTree
TFile f(fileT,"RECREATE");
TTree t("fee","A tree with FEE events"); // define branch
myMk3->setOutTTree(&t);
// 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
EventLoop:
if (iev<=nevents && istat!=2)
{
chain->Clear();
cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
istat = chain->Make(iev); // This should call the Make() method in ALL makers
if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; }
if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; }
iev++;
goto EventLoop;
//.........这里部分代码省略.........
示例10: OnlineQaTpcRaw
void OnlineQaTpcRaw(
Int_t nevents=2,
const char *MainFile=
"/afs/rhic.bnl.gov/star/data/samples/june_2000_st_physics_1164058_raw_0001.daq",
Int_t nevHistOut=0)
{
//
cout << " OnlineQaTpcRaw.C: #events to process = " << nevents << endl;
cout << " OnlineQaTpcRaw.C: input file name = " << MainFile << endl;
cout << " OnlineQaTpcRaw.C: #events to write to hist file (0=all) = " <<
nevHistOut << endl;
// Generate a name for an outHistFile using input file name
//
fInFile = new TString(MainFile);
fFileOut = new TString(gSystem->BaseName(fInFile->Data()));
fFileOut->ReplaceAll(".daq",""); // remove old file extension
const char *histoDir = "./"; // directory for histos
fFileOut->Prepend(histoDir);
const Char_t *outHistFile= fFileOut->Data(); // done
// define other values needed:
const Char_t *topTree="OnlQaTpcTree";
const Char_t *makerName="RawTpcQa";
cout << " OnlineQaTpcRaw.C: output hist file name set to " <<
outHistFile << ".hist.root" << endl;
cout << " OnlineQaTpcRaw.C: top level Tree directory set to " <<
topTree << endl;
cout << " OnlineQaTpcRaw.C: maker name set to " <<
makerName << endl;
// load libraries - basic ones needed
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("StIOMaker");
gSystem->Load("StTreeMaker");
// these 2 are for using the StHistUtil class
gSystem->Load("StUtilities");
gSystem->Load("StAnalysisUtilities");
// for raw tpc qa maker
gSystem->Load("StRawTpcQaMaker");
// Setup top part of chain
chain = new StChain("OnlineQaTpcRawChain");
// chain->SetDebug(0);
// now any Maker that gets constructed will be added to the chain
StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,topTree);
//IOMk->SetDebug();
IOMk->SetIOMode("r");
// histogram utility class (this is not a Maker so not used in chain)
StHistUtil *HU = new StHistUtil;
// now must set pointer to any StMaker so HistUtil can find histograms
// with StHistUtil methods
// -- input any maker pointer but must cast as type StMaker
HU->SetPntrToMaker((StMaker *)IOMk);
StRawTpcQaMaker *RTQa = new StRawTpcQaMaker(makerName);
// output hist.root file:
StTreeMaker* treeMk = new StTreeMaker("tree",outHistFile,topTree);
treeMk->SetIOMode("w");
treeMk->SetBranch("histBranch");
// --- now execute chain member functions
chain->Init();
// method to print out list of histograms -
//can do this anytime after they're booked
Int_t NoHist=0;
NoHist = HU->ListHists(makerName);
cout << " !!! OnlineQaTpcRaw.C, No. of Hist Booked = " << NoHist << endl;
int istat=0;
int iev=0;
int countev=0;
// Event loop
EventLoop: if (iev < nevents && !istat) {
chain->Clear();
istat = chain->Make(iev);
// count # times Make is called
iev++;
cout << " Called Make # " << iev << endl;
cout << " istat value returned from chain Make = " << istat <<
endl;
//.........这里部分代码省略.........
示例11: runTrigTreeMaker
void runTrigTreeMaker( const Char_t *file="rcf10063_2_6000evts.MuDst.root", const Char_t* fileOut = "rcf10063_2_6000evts.TrigTree-A.root", Char_t trigVer = 'g', Int_t nevents = 10000000,
Int_t flagMC = 1, const Char_t *eemcSetupPath="/star/u/sgliske/Share/StarTrigSimuSetup/" ){
//int flagMC=0; // 0/1 == Using Real/Simulation data files
int useEemc=2; // 0/1 == Exclude/Include EEMC in Trigger Decisions
int useBemc=0; // 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=1; // 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=1;//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("StTpcDb"));
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"));
assert( !gSystem->Load("StSpinDbMaker") );
assert( !gSystem->Load("StEEmcPoolEEmcTreeContainers") );
assert( !gSystem->Load("StEEmcTreeMaker") );
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);
// just to make sure StEvent is found for the trig simu
StMuDst2StEventMaker *muDst2StEvent = new StMuDst2StEventMaker();
//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");
dbMk->SetAttr("blacklist", "fgt");
dbMk->SetAttr("blacklist", "svt");
dbMk->SetAttr("blacklist", "tpc");
dbMk->SetAttr("blacklist", "ftpc");
// CORRECTION: do not always need to set date and time for MC
//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);
}
//.........这里部分代码省略.........
示例12: run_StMcAccpMaker
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: ProcessQQ
//==========================================================================================
void ProcessQQ(const Int_t mode, const Int_t fsti, const Int_t nevents,
const Char_t **fileList, const Char_t* dirName)
{
cout << "Loading libraries ..." << endl;
gSystem->Load("St_base");
gSystem->Load("StChain");
gSystem->Load("StDaqLib");
gSystem->Load("St_Tables");
gSystem->Load("StarMagField");
gSystem->Load("StMagF");
gSystem->Load("StUtilities");
gSystem->Load("StTreeMaker");
gSystem->Load("StIOMaker");
gSystem->Load("StarClassLibrary");
gSystem->Load("StDetectorDbMaker");
gSystem->Load("StTpcDb");
gSystem->Load("StDbUtilities");
gSystem->Load("StBichsel");
gSystem->Load("StTriggerDataMaker");
gSystem->Load("StEvent");
gSystem->Load("StEventUtilities");
gSystem->Load("StMcEvent");
gSystem->Load("StMcEventMaker");
gSystem->Load("StAssociationMaker");
//if( mode & 0x2){
// EMC specific
cout << " EMC mode enabled" << endl;
gSystem->Load("StEmcUtil");
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
//}
if( mode & 0x4){
// RICH
cout << " RICH mode enabled" << endl;
gSystem->Load("StRrsMaker");
gSystem->Load("StRchMaker");
gSystem->Load("StRichPIDMaker");
gSystem->Load("StRichSpectraMaker");
}
gSystem->Load("StMcAnalysisMaker");
gSystem->Load("StStrangeMuDstMaker");
gSystem->Load("StMuDSTMaker");
if( mode & 0x2 ){
// EMC specific
gSystem->Load("StEmcADCtoEMaker"); // analysis maker
gSystem->Load("StPreEclMaker"); // analysis maker
gSystem->Load("StEpcMaker"); // analysis maker
}
cout << "Loading done " << endl;
chain = new StChain("StChain");
chain->SetDebug();
StFile *setFiles= new StFile();
for (int ifil=0; fileList[ifil]; ifil++)
setFiles->AddFile(fileList[ifil]);
// ********************************
// Now we add Makers to the chain...
// ********************************
// *************
// file handling
// *************
StIOMaker* ioMaker = new StIOMaker("IOMaker","r",setFiles,"bfcTree");
ioMaker->SetDebug();
ioMaker->SetIOMode("r");
ioMaker->SetDebug();
ioMaker->SetBranch("*",0,"0"); //deactivate all branches
ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch
ioMaker->SetBranch("emcBranch",0,"r"); //activate evt.root Branch
ioMaker->SetBranch("runcoBranch",0,"r"); //activate runcoBranch
// ***********************************************
// MuDstMaker(s) instantiation / chain activation
// ***********************************************
// Common MuDST part
StStrangeMuDstMaker* v0dst = new StStrangeMuDstMaker("strangeMuDst");
v0dst->DoV0(); //Set v0MiniDstMaker to find only v0s
v0dst->DoXi(); //Set v0MiniDstMaker to find only v0s
v0dst->DoKink(); //Set v0MiniDstMaker to find only v0s
v0dst->SetNoKeep();
// RICH part
if( mode & 0x4 ){
StRichSpectraMaker* spectraMaker = new StRichSpectraMaker("spectraMaker");
}
//.........这里部分代码省略.........
示例14: rdSt2spinTest
void rdSt2spinTest( Int_t nevents=10){
char * fname="/star/data03/daq/2005/janMisc/st_physics_6156028_raw_2040010.event.root";
//char * fname="/star/data03/daq/2005/janMisc/st_physics_5135068_raw_2020006.event.root";
initHisto();
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("StSpinDbMaker");
// create chain
chain = new StChain("bfc");
// StIOMaker - to read files ...
StIOMaker* ioMaker = new StIOMaker();
ioMaker->SetFile(fname);
ioMaker->SetIOMode("r");
ioMaker->SetBranch("*",0,"0"); //deactivate all branches
ioMaker->SetBranch("eventBranch",0,"r"); //activate Event Branch
ioMaker->SetIOMode("r");
St_db_Maker *stDb = new St_db_Maker("StarDb", "MySQL:StarDb");
spDb=new StSpinDbMaker("spinDb");
gMessMgr->SwitchOff("D");
gMessMgr->SwitchOn("I");
chain->ls(3);
Int_t initStat = chain->Init();
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==1){// fill pattern acquired for first event
// spDb->print(0);
for(int bx48=0;bx48<120;bx48++){
int bxStar=spDb->BXstarUsingBX48(bx48);
if(spDb->isBXfilledUsingBX48(bx48)) hfb->Fill(bxStar);
//printf("bxStar=%3d bx48=%3d fill=%d\n",bxStar,bx48,spDb->isBXfilledUsingBX48(bx48));
}
}
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);
StTriggerData* trgD= mEvent->triggerData(); assert(trgD);
int bx48=trgD->bunchId48Bit();
int bx7=trgD->bunchId7Bit();
int bxStar48=spDb->BXstarUsingBX48(bx48);
int bxStar7=spDb->BXstarUsingBX7(bx7);
int bxPhase=spDb->offsetBX48minusBX7(bx48,bx7);
int spin8ev=trgD->spinBit();
int spin8db=spDb->spin8usingBX48(bx48);
int spin4db=spDb->spin4usingBX48(bx48);
//.... do histo
hbx->Fill(bxStar48);
hdbx->Fill(bxStar48,bxStar7);
hs8ev->Fill(bxStar48,spin8ev);
if(spDb->isBXfilledUsingBX48(bx48)){
hs8db->Fill(bxStar48,spin8db);
hs4db->Fill(bxStar48,spin4db);
}
int nV=mEvent->numberOfPrimaryVertices();
printf("eveID=%d nPrimVert=%d ", mEvent->id(),nV);
printf("bx48=%3d bx7= %3d bxPhase=%3d spin8: ev=0x%02x : 0x%02x=db bxStar48=%3d \n",bx48,bx7,bxPhase,spin8ev,spin8db,bxStar48);
// assert(spin8ev>10);
} // Event Loop
hf->Write();
}
示例15: rdMu2TrigSimu
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
//.........这里部分代码省略.........