本文整理汇总了C++中StIOMaker::SetFile方法的典型用法代码示例。如果您正苦于以下问题:C++ StIOMaker::SetFile方法的具体用法?C++ StIOMaker::SetFile怎么用?C++ StIOMaker::SetFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StIOMaker
的用法示例。
在下文中一共展示了StIOMaker::SetFile方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doEvents
// ------------------ 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;
}
//.........这里部分代码省略.........
示例2: rdSt2print
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();
//.........这里部分代码省略.........
示例3: 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;
}
示例4: 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
//.........这里部分代码省略.........
示例5: 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;
//.........这里部分代码省略.........
示例6: runEEmcMcPi0
void runEEmcMcPi0( Int_t nevents = 1000,
Char_t *name = "dipi0_10000evts.MuDst.root",
//Char_t *name = "/star/data05/scratch/hew/JanSample/pi0_set2.MuDst.root",
Char_t *ofile= "test.root",
Char_t *path = "/star/u/hew/pi0finder/ezGames/backyard/multiphoton/",
//Char_t *path = "",///star/data13/reco/pp200/pythia6_205/25_35gev/cdf_a/y2004y/gheisha_on/p05ih/",
Int_t nfiles = 100)
{
TString pathname = path;
pathname += name;
TString fileG=name;
fileG.ReplaceAll("MuDst","geant");
fileG=path+fileG;
//--
//-- Load shared libraries
//--
LoadLibs();
gSystem->Load("StMcEvent");
gSystem->Load("StMcEventMaker");
//assert(!gSystem->Load("StEEmcMcReadMaker"));
//--
//-- Create the analysis chain
//--
mChain = new StChain("eemcAnalysisChain");
StIOMaker* ioMaker = new StIOMaker();
printf("%s\n",fileG.Data());
ioMaker->SetFile(fileG);
ioMaker->SetIOMode("r");
ioMaker->SetBranch("*",0,"1"); //deactivate all branches
ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
ioMaker->SetBranch("minimcBranch",0,"r"); //activate geant Branch
//--
//-- MuDst maker for reading input
//--
mMuDstMaker = new StMuDstMaker(0,0,path,name,"MuDst",nfiles);
mMuDstMaker->SetStatus("*",0);
mMuDstMaker->SetStatus("MuEvent",1);
mMuDstMaker->SetStatus("EmcAll",1);
StMcEventMaker *mcEventMaker = new StMcEventMaker();
mcEventMaker->doPrintEventInfo = false;
mcEventMaker->doPrintMemoryInfo = false;
//--
//-- Connect to the STAR databse
//--
mStarDatabase = new St_db_Maker("StarDb", "MySQL:StarDb");
#ifdef MONTE_CARLO
//--
//-- Setup ideal gains for processing MC data
//--
mStarDatabase->SetFlavor("sim","eemcPMTcal");
mStarDatabase->SetFlavor("sim","eemcPIXcal");
mStarDatabase->SetFlavor("sim","eemcPMTped");
mStarDatabase->SetFlavor("sim","eemcPMTstat");
mStarDatabase->SetFlavor("sim","eemcPMTname");
mStarDatabase->SetFlavor("sim","eemcADCconf");
mStarDatabase->SetDateTime(20050101,0);
#endif
//--
//-- Initialize EEMC database
//--
new StEEmcDbMaker("eemcDb");
gMessMgr -> SwitchOff("D");
gMessMgr -> SwitchOn("I");
mSpinDb = new StSpinDbMaker("mSpinDb");
#ifdef MONTE_CARLO
//--
//-- Initialize slow simulator
//--
StEEmcSlowMaker *slowSim = new StEEmcSlowMaker("slowSim");
slowSim->setDropBad(0); // 0=no action, 1=drop chn marked bad in db
slowSim->setAddPed(0); // 0=no action, 1=ped offset from db
slowSim->setSmearPed(0); // 0=no action, 1=gaussian ped, width from db
slowSim->setOverwrite(1); // 0=no action, 1=overwrite muDst values
slowSim->setNpePerMipSmd(1.0);
#endif
//--
//-- Energy to ADC maker
//.........这里部分代码省略.........
示例7: 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;
}
示例8: 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);
}
//.........这里部分代码省略.........
示例9: 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;
}
示例10: 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();
}
示例11: 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;
//.........这里部分代码省略.........