本文整理汇总了C++中TDatime::GetTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TDatime::GetTime方法的具体用法?C++ TDatime::GetTime怎么用?C++ TDatime::GetTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDatime
的用法示例。
在下文中一共展示了TDatime::GetTime方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xrootdTestVanderbilt
void xrootdTestVanderbilt(const int iOption=0) {
TDatime *dateTime = new TDatime;
int iDate = dateTime->GetDate();
int iTime = dateTime->GetTime();
cout << " Begin Vanderbilt access testing " << iDate << " at " << iTime << endl;
if(iOption == 0 || iOption == 1) {
TFile *f = TFile::Open("root://cmsxrootd.fnal.gov//store/test/xrootd/T2_US_Vanderbilt//store/mc/SAM/GenericTTbar/GEN-SIM-RECO/CMSSW_5_3_1_START53_V5-v1/0013/CE4D66EB-5AAE-E111-96D6-003048D37524.root");
if(f) {
cout << "\n cmsxrootd.fnal.gov successful access to Vanderbilt" << endl;
f->ls();
f->Close();
}
else {
cout << "\n cmsxrootd.fnal.gov unsuccessful access to Vanderbilt" << endl;
}
dateTime->Set(); // set to system date/time
iDate = dateTime->GetDate();
iTime = dateTime->GetTime();
cout << " Completed Vanderbilt access test from FNAL on " << iDate << " at " << iTime << endl;
} // check on iOption = 0 or iOption = 1
if(iOption == 0 || iOption == 2) {
TFile *g = TFile::Open("root://cms-xrd-global.cern.ch//store/test/xrootd/T2_US_Vanderbilt//store/mc/SAM/GenericTTbar/GEN-SIM-RECO/CMSSW_5_3_1_START53_V5-v1/0013/CE4D66EB-5AAE-E111-96D6-003048D37524.root");
if(g) {
cout << "\n cms-xrd-global.cern.ch successful access to Vanderbilt" << endl;
g->ls();
g->Close();
}
else {
cout << "\n cms-xrd-global.cern.ch unsuccessful access to Vanderbilt" << endl;
}
dateTime->Set(); // set to system date/time
iDate = dateTime->GetDate();
iTime = dateTime->GetTime();
cout << " Completed Vanderbilt access test from CERN on " << iDate << " at " << iTime << endl;
} // check on iOption = 0 or iOption = 2
dateTime->Set(); // set to system date/time
cout << "\n Completed Vanderbilt access testing " << iDate << " at " << iTime << endl;
return;
}
示例2: toyMC_Cent
//================================================
void toyMC_Cent()
{
gStyle->SetOptStat(0);
gStyle->SetOptFit(1);
gStyle->SetStatY(0.9);
gStyle->SetStatX(0.9);
gStyle->SetStatW(0.2);
gStyle->SetStatH(0.2);
myRandom = new TRandom3();
TDatime *clock = new TDatime();
myRandom->SetSeed(clock->GetTime());
// Get true refMult vs Ncoll distribution
TH2F *hRefMultVsNcoll = 0x0;
// Get different efficiency curve vs. refMult
const int nEff = 2;
const int nMult = 2;
TF1 *funcEff[nEff];
funcEff[0] = new TF1("funcEff_0", "pol1",0,1000);
funcEff[0]->SetParameters(0.9, -2e-4);
funcEff[1] = new TF1("funcEff_1", "pol0",0,1000);
funcEff[1]->SetParameter(0,0.6);
TCanvas *c = new TCanvas("cEff","cEff",800,600);
TH1F *hplot = new TH1F("hplot",";Mult;",100,0,1000);
hplot->SetYTitle("Efficiency");
hplot->DrawCopy();
for(int i=0; i<2; i++)
{
funcEff[i]->SetLineColor(i+1);
funcEff[i]->SetLineWidth(1.5);
funcEff[i]->Draw("sames");
}
TPaveText *title = GetTitleText("TPC tracking efficiency");
title->Draw();
TLegend *leg = new TLegend(0.4,0.2,0.7,0.4);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.04);
leg->AddEntry(funcEff[0], "Efficiency 1", "L");
leg->AddEntry(funcEff[1], "Efficiency 2", "L");
leg->Draw();
// Get ngTrack distribution to mimic efficiency distribution
TH1F *hMcMult[nMult];
}
示例3: EmbeddingReco
//.........这里部分代码省略.........
#if 0
// Turn on debugging of DB maker
St_db_Maker *db = (St_db_Maker *)chain1->GetMaker("db");
db->SetDebug(2);
#endif
//--------------------------------------------------------------------------
TString trgfile = gSystem->BaseName(fzdFile.c_str());
trgfile.ReplaceAll(".fzd", ".trig.root");
TFile *ofile = TFile::Open(trgfile, "recreate");
assert(ofile);
TH2F *hBarrelHighTowerSimu = new TH2F("hBarrelHighTowerSimu", "BEMC high tower simu;trigger patch;high tower", 300, 0, 300, 64, 0, 64);
TH2F *hBarrelPatchSumSimu = new TH2F("hBarrelPatchSumSimu", "BEMC patch sum simu;trigger patch;patch sum", 300, 0, 300, 64, 0, 64);
TH2F *hEndcapHighTowerSimu = new TH2F("hEndcapHighTowerSimu", "EEMC high tower simu;trigger patch;high tower", 90, 0, 90, 64, 0, 64);
TH2F *hEndcapPatchSumSimu = new TH2F("hEndcapPatchSumSimu", "EEMC patch sum simu;trigger patch;patch sum", 90, 0, 90, 64, 0, 64);
TH2F *hBarrelJetPatchSimu = new TH2F("hBarrelJetPatchSimu", "BEMC jet patch;jet patch;adc", 18, 0, 18, 160, 0, 160);
TH2F *hEndcapJetPatchSimu = new TH2F("hEndcapJetPatchSimu", "EEMC jet patch;jet patch;adc", 6, 0, 6, 160, 0, 160);
TH2F *hOverlapJetPatchSimu = new TH2F("hOverlapJetPatchSimu", "BEMC-EEMC-overlap;jet patch;adc", 6, 0, 6, 160, 0, 160);
}
//--------------------------------------------------------------------------
// Initialize chain
Chain->Init();
PrintTimer(Chain);
puts("Order of makers in BFCMIXER:");
StMaker::lsMakers(Chain);
// Event loop
int mNTotal = 0;
int mNFailed = 0;
TBenchmark evnt;
StIOMaker *inputStream = (StIOMaker *)chain1->GetMaker("inputStream");
for (int iEvent = 1; iEvent <= nEvents; ++iEvent) {
evnt.Reset();
evnt.Start("QAInfo:");
Chain->Clear();
int iMake = Chain->Make(iEvent);
if (iMake == kStErr) ++mNFailed;
if (inputStream->GetMakeReturn() % 10 == kStEOF) {
inputStream->Rewind();
--iEvent;
continue;
}
//if (iMake == kStSkip) continue;
if (iMake % 10 == kStEOF || iMake % 10 == kStFatal) break;
++mNTotal;
PrintTimer(Chain);
//--------------------------------------------------------------------------
if (flag == "Jet") {
// BEMC high towers and trigger patches
for (int triggerpatch = 0; triggerpatch < 300; ++triggerpatch) {
hBarrelHighTowerSimu->Fill(triggerpatch, trgsim->bemc->getBEMC_FEE_HT_ADC()[triggerpatch]);
hBarrelPatchSumSimu->Fill(triggerpatch, trgsim->bemc->getBEMC_FEE_TP_ADC()[triggerpatch]);
} // for triggerpatch
// BEMC jet patches
for (int jetpatch = 0; jetpatch < 18; ++jetpatch) {
hBarrelJetPatchSimu->Fill(jetpatch, trgsim->bemc->barrelJetPatchAdc(jetpatch));
} // for jetpatch
// EEMC high towers and trigger patches
for (int triggerpatch = 0; triggerpatch < 90; ++triggerpatch) {
hEndcapHighTowerSimu->Fill(triggerpatch, trgsim->eemc->getEndcapHighTower(triggerpatch));
hEndcapPatchSumSimu->Fill(triggerpatch, trgsim->eemc->getEndcapPatchSum(triggerpatch));
} // for triggerpatch
// EEMC jet patches
for (int jetpatch = 0; jetpatch < 6; ++jetpatch) {
hEndcapJetPatchSimu->Fill(jetpatch, trgsim->eemc->endcapJetPatchAdc(jetpatch));
} // for jetpatch
// BEMC-EEMC-overlap jet patches
for (int i = 0; i < 2; ++i) {
int jetpatch, adc;
trgsim->emc->getOverlapJetPatchAdc(i, jetpatch, adc);
hOverlapJetPatchSimu->Fill(jetpatch, adc);
} // for i
} //end of if("jet")
//--------------------------------------------------------------------------
evnt.Stop("QAInfo:");
printf("QAInfo: Done with Event [no. %d/run %d/evt. %d/Date.Time %d.%d/sta %d] Real Time = %10.2f seconds Cpu Time = %10.2f seconds\n", iEvent, Chain->GetRunNumber(), Chain->GetEventNumber(), Chain->GetDate(), Chain->GetTime(), chain3->GetMakeReturn(), evnt.GetRealTime("QAInfo:"), evnt.GetCpuTime("QAInfo:"));
} // End event loop
printf("QAInfo:EventLoop completed code %d\n", iMake);
gSystem->Exec("date");
TDatime t;
printf("QAInfo:Run is finished at Date/Time %i/%i; Total events processed: %i and not completed: %i\n", t.GetDate(), t.GetTime(), mNTotal, mNFailed);
//--------------------------------------------------------------------------
if (flag == "Jet") {
ofile->Write();
ofile->Close();
}
}
示例4: bfcMixer_Ftpc
//.........这里部分代码省略.........
{
mixer->SetInput("Input1","MixerEvent");
}
else
{
mixer->SetInput("Input1","TpxRaw/.data/Event");
}
mixer->SetInput("Input2","Trs/.const/Event");
Chain->cd();
#if 0
//............. begin of EMC embedding makers................
//.............. Add BEmc stuff here ....................
gSystem->Load("StEmcSimulatorMaker");
gSystem->Load("StEmcMixerMaker");
gSystem->Load("StEEmcSimulatorMaker");
StMcEventMaker* mcEventMaker = new StMcEventMaker();
StEmcSimulatorMaker *bemcSim = new StEmcSimulatorMaker();
StEmcMixerMaker *bemcMixer = new StEmcMixerMaker();
chain3->AddAfter("emcRaw",bemcMixer);
chain3->AddAfter("emcRaw",bemcSim);
chain3->AddAfter("emcRaw",mcEventMaker);
bemcMixer->SetDebug(0); // set it to 1 for more printouts
// note, Barrel slow sim is always ON, said Adam
//........... Add EEmc Stuff ( Simu, and Mixer) here ..............
StEEmcFastMaker *eemcFastSim = new StEEmcFastMaker();
StEEmcMixerMaker *eemcMixer = new StEEmcMixerMaker();
/* position B+E EMC makers in the chain
(order is reverse because 'After' is used - looks funny but is right)
*/
chain3->AddAfter("emcRaw",eemcMixer);
chain3->AddAfter("emcRaw",eemcFastSim);
eemcFastSim->SetEmbeddingMode();
// eemcFastSim->SetDebug();
// eemcMixer->SetDebug();
bool useEndcapSlowSim = true;
if(useEndcapSlowSim) { // turn Endcap slow simu On/Off
StEEmcSlowMaker *slowSim=new StEEmcSlowMaker();
chain3->AddAfter("EEmcFastSim",slowSim);
slowSim->setEmbeddingMode();
}
#endif
//________________________________________________________________________________
{
TDatime t;
gMessMgr->QAInfo() << Form("Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
}
gMessMgr->QAInfo() << Form("Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
gMessMgr->QAInfo() << Form("with %s", Chain->GetCVS()) << endm;
// embedded particle set
StPrepEmbedMaker *embMk = (StPrepEmbedMaker *) Chain->Maker("PrepEmbed");
if (! embMk) return;
cout << "bfcMixer: Setting PID: "<<pid<<endl;
embMk->SetTagFile(tagfile);
// pTlow,ptHigh,etaLow,etaHigh,phiLow,phiHigh
embMk->SetOpt( pt_low, pt_high, eta_low, eta_high, 0., 6.283185, type);
// pid, mult
embMk->SetPartOpt( pid,mult);
// Default is no event selections
embMk->SetSkipMode(kTRUE);
// Make trigger and z-vertex cuts (only if SkipMode is true)
// Trigger cut
// Can put multiple trigger id's
if ( !triggers.empty() ) {
for(std::vector<Int_t>::iterator iter = triggers.begin(); iter != triggers.end(); iter++) {
embMk->SetTrgOpt((*iter)) ;
}
}
// z-vertex cuts
embMk->SetZVertexCut(vzlow, vzhigh) ;
TAttr::SetDebug(0);
Chain->SetAttr(".Privilege",0,"*" ); //All makers are NOT priviliged
Chain->SetAttr(".Privilege",1,"StBFChain::*" ); //StBFChain is priviliged
Chain->SetAttr(".Privilege",1,"StIOInterFace::*" ); //All IO makers are priviliged
Chain->SetAttr(".Privilege",1,"St_geant_Maker::*"); //It is also IO maker
Chain->SetAttr(".Privilege",1,"StPrepEmbedMaker::*"); //It is also IO maker
// Chain->SetDEBUG(0);
if (Nevents < 0) return;
Int_t iInit = Chain->Init();
if (iInit >= kStEOF) {
Chain->FatalErr(iInit,"on init");
return;
}
StMaker *treeMk = Chain->GetMaker("outputStream");
Chain->EventLoop(Nevents,treeMk);
gMessMgr->QAInfo() << "Run completed " << endm;
gSystem->Exec("date");
}
示例5: bfcMixer_pp2006
//.........这里部分代码省略.........
chain3->Load();
chain3->Instantiate();
//............. begin of EMC embedding makers................
//.............. Add BEmc stuff here ....................
StMcEventMaker* mcEventMaker = new StMcEventMaker();
StEmcSimulatorMaker *bemcSim = new StEmcSimulatorMaker();
StEmcMixerMaker *bemcMixer = new StEmcMixerMaker();
chain3->AddAfter("emcRaw",bemcMixer);
chain3->AddAfter("emcRaw",bemcSim);
chain3->AddAfter("emcRaw",mcEventMaker);
bemcMixer->SetDebug(0); // set it to 1 for more printouts
// note, Barrel slow sim is always ON, said Adam
//........... Add EEmc Stuff ( Simu, and Mixer) here ..............
StEEmcFastMaker *eemcFastSim = new StEEmcFastMaker();
StEEmcMixerMaker *eemcMixer = new StEEmcMixerMaker();
/* position B+E EMC makers in the chain
(order is reverse because 'After' is used - looks funny but is right)
*/
chain3->AddAfter("emcRaw",eemcMixer);
chain3->AddAfter("emcRaw",eemcFastSim);
eemcFastSim->SetEmbeddingMode();
// eemcFastSim->SetDebug();
// eemcMixer->SetDebug();
if(useEndcapSlowSim) { // turn Endcap slow simu On/Off
StEEmcSlowMaker *slowSim=new StEEmcSlowMaker();
chain3->AddAfter("EEmcFastSim",slowSim);
slowSim->setEmbeddingMode();
}
//............. end of EMC embedding makers................
St_geant_Maker *geantMk = (St_geant_Maker *) chain->GetMaker("geant");
geantMk->SetActive(kTRUE);
StMaker *tpcdaqMk = chain3->GetMaker("tpc_raw");
if(!tpcdaqMk ) {
cout <<" Error: no tpc daq maker. End. "<<endl;
return;
}
tpcdaqMk->SetMode(1); // Trs
tpcdaqMk->SetInput("Event","MixerEvent");
saveMk->cd(); {
TDatime t;
printf ("QAInfo:Run is started at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
}
printf ("QAInfo:Run on %s in %s\n",
gSystem->HostName(),
gSystem->WorkingDirectory());
printf ("QAInfo: with %s\n", chain->GetCVS());
// Init the chain and all its makers
if (Nevents >= 0) {
Int_t iInit = chain->Init();
chain->ls(5); // list the final chain
}
// chain->SetDEBUG();
treeMk = chain->GetMaker("tree");
TBenchmark evnt;
Int_t iMake = 0, i = 1, iBad = 0;
StIOMaker *inpMk = (StIOMaker *)chain1->GetMaker("inputStream");
Int_t ncols, eventnumber, mult, skip=0, oldskip = 0, skiptest=0;
cout <<"BFC - Entering Event Loop"<<endl;
EventLoop: if (i <= Nevents && iMake != kStEOF && iMake != kStFatal) {
evnt.Reset();
evnt.Start("QAInfo:");
chain->Clear();
iMake = chain->Make(i);
if (treeMk && iMake == kStErr) {treeMk->Make(i); iBad++;}
StEvtHddr *fEvtHddr = (StEvtHddr*)chain->GetDataSet("EvtHddr");
StEvtHddr *fEvtHddrDaq = (StEvtHddr*)chain1->GetDataSet("EvtHddr");
*fEvtHddr = *fEvtHddrDaq;
// gSystem->Exec("ps ux");
evnt.Stop("QAInfo:");
// evnt->Show("QAInfo:");
printf ("QAInfo: Done with Event [no. %d/run %d/evt. %d/Date.Time%d.%d/sta %d] Real Time = %10.2f seconds Cpu Time = %10.2f seconds \n", i,chain->GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
iMake,evnt.GetRealTime("QAInfo:"),evnt.GetCpuTime("QAInfo:"));
i++;
goto EventLoop;
}
fflush(stdout);
printf ("QAInfo:Run completed ");
gSystem->Exec("date");
}
示例6: DoOneProcess
//
// main function
//
void DoOneProcess(TString InputCfAName, TString ProcessName, float weight) {
//
// Get tree
//
TChain * chainA = new TChain("/configurableAnalysis/eventA");
TChain * chainB = new TChain("/configurableAnalysis/eventB");
chainA->Add(InputCfAName);
chainB->Add(InputCfAName);
InitializeA(chainA);
InitializeB(chainB);
//
// histograms
//
TH1F *h1_result = new TH1F("h1_result","h1_result", 1, 0, 1);
//
// main event loop
//
Int_t nentries = (Int_t)chainA->GetEntries();
cout<<"The number of entries is: "<<nentries<<endl;
// Progress tracking
int i_permille_old = 0;
TDatime DTStart;
int StartDate = DTStart.GetDate();
int StartTime = DTStart.GetTime();
cout << "Start time : " << StartTime << endl;
for(int i = 0; i<nentries; i++) {
// Progress tracking begin --------------------------------
int i_permille = (int)floor(1000 * i / float(nentries));
TDatime DTCurrent;
int CurrentDate = DTCurrent.GetDate();
int CurrentTime = DTCurrent.GetTime();
int TimeLaps = (CurrentDate-StartDate)*1000000+(CurrentTime-StartTime);
int TimeToRun = (float)nentries/(float)i*TimeLaps;
if (i_permille != i_permille_old) {
// xterm magic from L. Vacavant and A. Cerri
if (isatty(1)) {
printf("\015\033[32m Processed :: \033[1m\033[31m%4.1f %%"
"\033[0m\033[32m Expected processing time :: \033[1m\033[31m%i:%i:%i \033[0m\015",
i_permille/10., (TimeToRun/10000)%100<60 ? (TimeToRun/10000)%100 : (TimeToRun/10000)%100-40,
(TimeToRun/100)%100<60 ? (TimeToRun/100)%100 : (TimeToRun/100)%100-40,
(TimeToRun%100)<60 ? (TimeToRun)%100 : (TimeToRun)%100-40 );
fflush(stdout);
}
i_permille_old = i_permille;
}
// Progress tracking end ----------------------------------
// get an entry of an event
chainA->GetEntry(i);
chainB->GetEntry(i);
//
// Core analysis
//
// Getting good muons
vector<int> RA4MuonVeto; RA4MuonVeto.clear();
vector<int> RA4Muon = GetRA4Muon(RA4MuonVeto);
// Getting good electrons
vector<int> RA4ElecVeto; RA4ElecVeto.clear();
vector<int> RA4Elec = GetRA4Elec(RA4ElecVeto, "", 0, true);
// Containers for B-tagged jets
vector<int> LooseBJet;
vector<int> MediumBJet;
// HT
double HT=-999.;
// MJ
vector<float> Vector_mj; // mj
double MJ=-999.;
// Getting good skinny jets
vector<int> GoodJets_AK5PFclean = GetJets(RA4Muon,RA4Elec,RA4MuonVeto,RA4ElecVeto,
HT,LooseBJet,MediumBJet,
2.4, 30, 0.3);
for(int i=0; i<GoodJets_AK5PFclean.size(); i++) cout << event << " :: " << GoodJets_AK5PFclean.at(i) << endl;
h1_result->Fill(0.5);
/*
// variables
vector<float> Vector_mj; // mj
float MJ=0;
int Nfastjets=0;
for(int ifastjet=0; ifastjet<(int)fastjets_AK5PF_px_->size(); ifastjet++) {
// Number of jets
float pT = TMath::Sqrt( fastjets_AK5PF_px_->at(ifastjet)*fastjets_AK5PF_px_->at(ifastjet)
+fastjets_AK5PF_py_->at(ifastjet)*fastjets_AK5PF_py_->at(ifastjet));
float temp_mj = Getmj(fastjets_AK5PF_px_->at(ifastjet), fastjets_AK5PF_py_->at(ifastjet),
//.........这里部分代码省略.........
示例7: TGraphErrors
//gStyle->SetTitleFontSize(0.2);
//gStyle->SetTitleSize(0.8,"t");
gStyle->SetTitleH(0.22);
gStyle->SetTitleW(0.4);
gStyle->SetTitleX(0.25);
gStyle->SetTitleY(1.020);
gStyle->SetPadLeftMargin(0.2);
gStyle->SetPadRightMargin(0.15);
gStyle->SetPadTopMargin(0.18);
gStyle->SetPadBottomMargin(0.2);
//gStyle->SetLabelOffset(0.025,"Y");
//gStyle->SetStripDecimals(kFALSE);
Int_t nn=20;
TDatime tt;
Int_t time=tt.GetTime();
Double_t xx[nn],yy[nn],ex[nn],ey[nn];
for(Int_t i=0;i<nn;i++){
xx[i]=10000.+i*10;
yy[i]=time+i*60;
//yy[i]=i*60;
ex[i]=xx[i]/10.;
ey[i]=0;
}
Int_t ncd=1, i=1;
Int_t NCD=7;
TGraphErrors *f1= new TGraphErrors(nn,xx,yy,ex,ey);
f1->GetXaxis()->SetLabelSize(0.1);
f1->GetYaxis()->SetLabelSize(0.1);
f1->GetXaxis()->SetNdivisions(401,kFALSE);
f1->GetYaxis()->SetNdivisions(-410,kFALSE);
示例8: bfcMixer_TpcSvtSsd2005
//_____________________________________________________________________
void bfcMixer_TpcSvtSsd2005(const Int_t Nevents=100,Int_t isSvtIn=1, Int_t isSsdIn=1,
const Char_t *daqfile="/star/rcf/test/daq/2005/051/st_physics_adc_6051006_raw_1050001.daq",
const Char_t *tagfile="/star/rcf/test/embedding/cuProductionMinBias/FullField/P07ic/2005/051/st_physics_adc_6051006_raw_1050001.tags.root",
const Double_t pt_low=0.1,
const Double_t pt_high=5.0,
const Double_t eta_low=-1.0,
const Double_t eta_high=1.0,
const Int_t pid=9,
const Double_t mult = 0.1) {
// production chain for P07ib
TString prodP07ib("P2005b DbV20070518 MakeEvent ITTF Iana ToF spt SsdIt SvtIt pmdRaw SCEbyE OGridLeak OShortR OSpaceZ2 ssd_daq");// KeepSvtHit hitfilt skip1row");
TString geomP07ib("ry2005f");
TString chain1Opt("in magF tpcDb NoDefault -ittf NoOutput");
TString chain2Opt("NoInput PrepEmbed gen_T geomT sim_T trs -ittf -tpc_daq nodefault");
chain2Opt += " "; chain2Opt += geomP07ib;
TString chain3Opt = prodP07ib;
chain3Opt += " TpcMixer Embedding onlraw GeantOut MiniMcMk McAna IdTruth -in NoInput,useInTracker EmbeddingShortCut";
if (isSvtIn) chain3Opt += " SvtEmbed";
if (isSsdIn) {
chain1Opt += ",ssddat";
chain2Opt += ",ssd,McEvent,-spt";
chain3Opt += ",SsdEmbed";
}
chain3Opt += " "; chain3Opt += geomP07ib;
// Dynamically link some shared libs
gROOT->LoadMacro("bfc.C");
if (gClassTable->GetID("StBFChain") < 0) Load();
//______________Create the main chain object______________________________________
Chain = new StChain("Embedding");
//________________________________________________________________________________
bfc(-1,chain1Opt,daqfile);
chain1 = chain;
chain1->SetName("One");
Chain->cd();
//________________________________________________________________________________
bfc(-1,chain2Opt);
chain2 = chain;
chain2->SetName("Two");
Chain->cd();
if (chain2->GetOption("TRS")){
StTrsMaker *trsMk = (StTrsMaker *) chain2->GetMaker("Trs");
if (! trsMk) {
cout << "Cannot find Trs in chain2" << endl;
return;
}
trsMk->setNormalFactor(2.67);
}
//________________________________________________________________________________
// gSystem->Load("StFtpcMixerMaker");
// StFtpcMixerMaker *ftpcmixer = new StFtpcMixerMaker("FtpcMixer","daq","trs");
//________________________________________________________________________________
TString OutputFileName(gSystem->BaseName(daqfile));
OutputFileName.ReplaceAll("*","");
OutputFileName.ReplaceAll(".daq","");
// OutputFileName.Append("_emb.root");
OutputFileName.Append(".root");
bfc(-1,chain3Opt,0,OutputFileName);
chain3 = chain;
chain3->SetName("Three");
Chain->cd();
Chain->cd();
//________________________________________________________________________________
{
TDatime t;
gMessMgr->QAInfo() << Form("Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
}
gMessMgr->QAInfo() << Form("Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
gMessMgr->QAInfo() << Form("with %s", Chain->GetCVS()) << endm;
// embedded particle set
StPrepEmbedMaker *embMk = (StPrepEmbedMaker *) Chain->Maker("PrepEmbed");
if (! embMk) return;
embMk->SetTagFile(tagfile);
// pTlow,ptHigh,etaLow,etaHigh,phiLow,phiHigh
embMk->SetOpt( pt_low, pt_high, eta_low, eta_high, 0., 6.283185);
// pid, mult
embMk->SetPartOpt( pid,mult);
TAttr::SetDebug(0);
Chain->SetAttr(".Privilege",0,"*" ); //All makers are NOT priviliged
Chain->SetAttr(".Privilege",1,"StBFChain::*" ); //StBFChain is priviliged
Chain->SetAttr(".Privilege",1,"StIOInterFace::*" ); //All IO makers are priviliged
Chain->SetAttr(".Privilege",1,"St_geant_Maker::*"); //It is also IO maker
Chain->SetAttr(".Privilege",1,"StPrepEmbedMaker::*"); //It is also IO maker
StMaker *SsdEmbed = Chain->Maker("SsdEmbed");
if (SsdEmbed) {
cout << "SsdEmbed has been found ----------------------------------------" << endl;
SsdEmbed->SetInput("SsdRealData","One/.make/SpaStrip/.data/spa_strip");
SsdEmbed->SetInput("SsdSimuData","Two/.make/SpaStrip/.data/spa_strip");
StMaker *SsdPoint = Chain->Maker("SsdPoint");
if (SsdPoint) {
cout << "SsdPoint has been found----------------------------------------" << endl;
SsdPoint->SetInput("SpaStrip","SsdEmbed");
}
}
// Chain->SetDEBUG(0);
if (Nevents < 0) return;
Int_t iInit = Chain->Init();
if (iInit >= kStEOF) {Chain->FatalErr(iInit,"on init"); return;}
StMaker *treeMk = Chain->GetMaker("outputStream");
Chain->EventLoop(Nevents,treeMk);
//.........这里部分代码省略.........
示例9: root_file_cmp
bool Exact_comparator::root_file_cmp (char *fn1, char *fn2)
{
TFile f1(fn1), f2(fn2);
TIter next_1(f1.GetListOfKeys()),
next_2(f2.GetListOfKeys());
TKey *k_1, *k_2;
bool is_equal = true;
char *obj_buf_1 = NULL, *obj_buf_2 = NULL;
while (true) {
k_1=(TKey*)next_1();
k_2=(TKey*)next_2();
// If there is no more keys
if(!k_1 && !k_2) {
break;
}
// If the size of two lists are not equal
// then two root files are not equal
if((k_1 && !k_2) || (!k_1 && k_2)) {
is_equal = false;
break;
}
if (!logic_compare(k_1, k_2)) {
is_equal = false;
break;
}
// compare buffer byte by byte
Int_t obj_len = k_1->GetObjlen();
obj_buf_1 = read_obj_buf(&f1, k_1, obj_len);
obj_buf_2 = read_obj_buf(&f2, k_2, obj_len);
if (!cmp_obj_buf(obj_buf_1, obj_buf_2, obj_len)) {
is_equal = false;
break;
}
// compare the timestamp of two object
const TDatime time_1 = k_1->GetDatime(),
time_2 = k_2->GetDatime();
if((time_1.GetDate() != time_2.GetDate())
|| (time_1.GetTime() != time_2.GetTime())) {
is_equal = false;
break;
}
}
if(obj_buf_1 != NULL) {
delete obj_buf_1;
}
if(obj_buf_2 != NULL) {
delete obj_buf_2;
}
return is_equal;
}
示例10: bfcZ
//_____________________________________________________________________
void bfcZ(const Int_t First,
const Int_t Last,
const Char_t *Chain="gstar Cy2b tfs -NoHits TpcHitFilter",
const Char_t *infile=0,
const Double_t zmin=-200, const Double_t zmax=-100,
const Char_t *outfile=0,
const Char_t *TreeFile=0){
gROOT->LoadMacro("bfc.C");
bfc(-1,Chain,infile,outfile,TreeFile);
if (chain->GetOption("TpcHitFilter")) {
StTpcHitFilterMaker *filtMk = (StTpcHitFilterMaker *) chain->GetMaker("tpc_hit_filter");
if (filtMk) {
// St_tcl_Maker *tclMk= (St_tcl_Maker *) chain->GetMaker("tpc_hits");
if (zmin < 0 && zmax < 0) filtMk->WestOff();
if (zmin > 0 && zmax > 0) filtMk->EastOff();
filtMk->SetZrange(zmin,zmax);
}
}
{
TDatime t;
printf ("QAInfo:Run is started at Date/Time %i/%i\n",t.GetDate(),t.GetTime());
printf ("QAInfo:Run on %s in %s\n",
gSystem->HostName(),
gSystem->WorkingDirectory());
printf ("QAInfo: with %s\n", chain->GetCVS());
}
// Init the chain and all its makers
Int_t iTotal = 0, iBad = 0;
St_XDFFile *xdf_out = 0;
TBenchmark evnt;
Int_t iMake = 0, i = First;
if (Last >= 0) {
Int_t iInit = chain->Init();
if (iInit >= kStEOF) {
chain->Fatal(iInit,"on init");
goto END;
}
StEvtHddr *hd = (StEvtHddr*)chain->GetDataSet("EvtHddr");
if (hd) hd->SetRunNumber(-2); // to be sure that InitRun calls at least once
// skip if any
if (First > 1) {
if (chain->GetOption("fzin")) {
geant = (St_geant_Maker *) chain->GetMaker("geant");
if (geant) {
if (geant->IsActive()) geant->Skip(First-1);
}
}
else {
StIOMaker *inpMk = (StIOMaker *) chain->GetMaker("inputStream");
if (inpMk) {printf ("Skip %i Events\n",First-1);inpMk->Skip(First-1);}
}
}
}
xdf_out = chain->GetXdfOut();
if (chain->GetOption("Event")) evMk = (StEventMaker *) chain->GetMaker("StEventMaker");
treeMk = chain->GetMaker("OutputStream");
EventLoop: if (i <= Last && iMake != kStEOF && iMake != kStFatal) {
evnt.Reset();
evnt.Start("QAInfo:");
chain->Clear();
iMake = chain->Make(i);
if (iMake <kStEOF) {
if (xdf_out){
St_DataSet *dstSet = chain->GetInputDS("dst");
if (dstSet) xdf_out->NextEventPut(dstSet); // xdf output
}
iTotal++;
if (treeMk && iMake == kStErr) {treeMk->Make(i); iBad++;}
// gSystem->Exec("ps ux");
evnt.Stop("QAInfo:");
// evnt.Show("QAInfo:");
printf ("QAInfo: Done with Event [no. %d/run %d/evt. %d/Date.Time %d.%d/sta %d] Real Time = %10.2f seconds Cpu Time = %10.2f seconds \n",
i,chain->GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
iMake,evnt.GetRealTime("QAInfo:"),evnt.GetCpuTime("QAInfo:"));
}
i++; goto EventLoop;
}
END:
fflush(stdout);
printf ("QAInfo:Run completed ");
gSystem->Exec("date");
if (evMk) Event = (StEvent *) chain->GetInputDS("StEvent");
{
TDatime t;
printf ("\nQAInfo:Run is finished at Date/Time %i/%i; Total events processed :%i and not completed: %i\n",
t.GetDate(),t.GetTime(),iTotal,iBad);
}
}
示例11: fitPtOverMCJLST
//.........这里部分代码省略.........
if (correctErrors) {
// Tsallis errors not reliable, use toy MC
TH1F* mHist = new TH1F("mHist","m",21,-0.5*mVal,0.5*mVal);
TH1F* nHist = new TH1F("nHist","n",21,-0.2*nVal,0.2*nVal);
TH1F* n2Hist = new TH1F("n2Hist","n2",21,-0.2*n2Val,0.2*n2Val);
TH1F* bbHist = new TH1F("bbHist","bb",21,-0.2*bbVal,0.2*bbVal);
TH1F* bb2Hist = new TH1F("bb2Hist","bb2",21,-0.2*bb2Val,0.2*bb2Val);
TH1F* fexpHist = new TH1F("fexpHist","fexp",21,-0.2*fexpVal-0.000001,0.2*fexpVal+0.000001);
TH1F* THist = new TH1F("THist","T",21,-0.5*TVal,0.5*TVal);
mHist->GetXaxis()->SetTitle("m-m_{gen}");
nHist->GetXaxis()->SetTitle("n-n_{gen}");
n2Hist->GetXaxis()->SetTitle("n2-n2_{gen}");
bbHist->GetXaxis()->SetTitle("bb-bb_{gen}");
bb2Hist->GetXaxis()->SetTitle("bb2-bb2_{gen}");
THist->GetXaxis()->SetTitle("T-T_{gen}");
fexpHist->GetXaxis()->SetTitle("fexp-fexp_{gen}");
for (unsigned int iToy = 0; iToy < 200; iToy++) {
cout << endl << "####" << endl;
cout << "Generating toy experiment n. " << iToy+1 << endl;
m.setVal(mVal);
n.setVal(nVal);
n2.setVal(n2Val);
bb.setVal(bbVal);
bb2.setVal(bb2Val);
fexp.setVal(fexpVal);
T.setVal(TVal);
TDatime *now = new TDatime();
Int_t seed = now->GetDate() + now->GetTime();
cout << "RooFit Generation Seed = " << seed+iToy << endl;
RooRandom::randomGenerator()->SetSeed(seed+iToy);
cout << "####" << endl << endl;
RooDataSet *dataToy = rt3->generate(RooArgSet(*ptoverm),ptovermH->GetEntries());
RooDataHist *dataToyH = new RooDataHist("dataToyH","toy",RooArgSet(*ptoverm),*dataToy);
rt3->fitTo(*dataToyH,Minos(0),SumW2Error(kTRUE),NumCPU(1));
if (fit->floatParsFinal().find("m")) mHist->Fill(m.getVal()-mVal);
if (fit->floatParsFinal().find("n")) nHist->Fill(n.getVal()-nVal);
if (fit->floatParsFinal().find("n2")) n2Hist->Fill(n2.getVal()-n2Val);
if (fit->floatParsFinal().find("bb")) bbHist->Fill(bb.getVal()-bbVal);
if (fit->floatParsFinal().find("bb2")) bb2Hist->Fill(bb2.getVal()-bb2Val);
if (fit->floatParsFinal().find("fexp")) fexpHist->Fill(fexp.getVal()-fexpVal);
if (fit->floatParsFinal().find("T")) THist->Fill(T.getVal()-TVal);
}
TCanvas cant("cant","Test canvas",5.,5.,900.,500.);
cant.Divide(4,2);
cant.cd(1); mHist->Draw();
cant.cd(2); nHist->Draw();
cant.cd(3); n2Hist->Draw();
cant.cd(4); bbHist->Draw();
cant.cd(5); bb2Hist->Draw();
cant.cd(6); fexpHist->Draw();
cant.cd(7); THist->Draw();
// cant.SaveAs("figs/testToys.pdf");
cant.SaveAs("newfigs/testToys.pdf");
if (fit->floatParsFinal().find("m")) m.setError(mHist->GetRMS());
if (fit->floatParsFinal().find("n")) n.setError(nHist->GetRMS());