当前位置: 首页>>代码示例>>C++>>正文


C++ TDatime::GetDate方法代码示例

本文整理汇总了C++中TDatime::GetDate方法的典型用法代码示例。如果您正苦于以下问题:C++ TDatime::GetDate方法的具体用法?C++ TDatime::GetDate怎么用?C++ TDatime::GetDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TDatime的用法示例。


在下文中一共展示了TDatime::GetDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawDist

void drawDist(const char* infilename, const char* system, Int_t rWrite, Int_t rPerformance) {

        myOptions(0);

        gROOT->ForceStyle();
        gStyle->SetPalette(1.0);

        TDatime now;
        int iDate = now.GetDate();
        int iYear=iDate/10000;
        int iMonth=(iDate%10000)/100;
        int iDay=iDate%100;
        char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun",
                          "Jul","Aug","Sep","Oct","Nov","Dec"};
        char cStamp1[25],cStamp2[25];
        sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear);
        sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear);

        TFile *f = new TFile(infilename, "read");
        // TList *list = (TList*)f->Get("femtolist");

        // pseudorapidity vs pt
        TH2D* ypt =(TH2D*)f->Get(Form("EtaPtcutPass1%stpcM%i",system,0));

        int minMultBin = 0;
        int maxMultBin = 6;
        double EvMultall = 0;

        for(int i = minMultBin; i < maxMultBin; i++) {
                TH1D* yptN =(TH1D*)f->Get(Form("EtaPtcutPass1%stpcM%i",system,i));
                ypt->Add(yptN);
                //delete hEvMult;
        }

        TCanvas *c2 = new TCanvas("pseudorapidity vs pt", "pseudorapidity vs pt");
        c2->SetGridx();
        c2->SetGridy();
        c2->SetFillColor(10);
        ypt->GetXaxis()->SetTitle("#eta");
        ypt->GetYaxis()->SetTitle("p_{T}");
        ypt->GetXaxis()->SetTitleOffset(1.3);
        ypt->GetYaxis()->SetTitleOffset(1.3);
        ypt->GetXaxis()->SetRangeUser(-0.8,0.8);
        ypt->GetYaxis()->SetRangeUser(0.1,8.);
        ypt->Draw("colz");

        // https://wiki.bnl.gov/eic/index.php/ROOT#Moving_and_resizing_the_palette_axis_of_a_2D_histogram
        gPad->SetRightMargin( 0.12 ); // The default right margin is 0.1 i.e. 10% of the image width
//   TPaletteAxis* palette
//       = dynamic_cast<TPaletteAxis*>( myHistogram.GetListOfFunctions()->FindObject( "palette" ) );
//   if( palette ) {
//     palette->SetX1NDC( 0.86 ); // Start the palette 86 % of the way across the image
//     palette->SetX1NDC( 0.91 ); // End the palette 91% of the way across the image
//     gPad->Modified(); // Update with the new position
//   } // if

        postprocess(c2,Form("ypt%s",system),rWrite,rPerformance);

}
开发者ID:maszyman,项目名称:PlotMacros,代码行数:59,代码来源:drawDist.C

示例2: Init

Int_t THaScaler::Init( const TDatime& time ) 
{
  // Initialize scalers for given date/time.
  // Accuracy is 1 day. Only date is used, time is ignored.

  Int_t i = time.GetDate();
  char date[11];
  sprintf( date, "%2.2d-%2.2d-%4.4d",i%100,(i%10000-i%100)/100,i/10000 );
  return Init( date );
};
开发者ID:JeffersonLab,项目名称:d2n_analyzer,代码行数:10,代码来源:THaScaler.C

示例3: 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;
}
开发者ID:ravijanjam,项目名称:LegacyCMSSW,代码行数:41,代码来源:xrootdTestVanderbilt.C

示例4: ALICEWorkInProgress

void ALICEWorkInProgress(TCanvas *c,TString today){
 //date must be in the form: 04/05/2010
 if(today=="today"){
   TDatime startt;                                                                                                                                                        
   int date=startt.GetDate();

   int y=date/10000;
   int m=(date%10000)/100;
   int d=date%100;


   today="";
   today+=d;
   if(m<10)
     today.Append("/0");
   else today.Append("/");
   today+=m;
   today.Append("/");
   today+=y;  

 }
 TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",0.67,0.65,0.82,0.89);
 //  myPadLogo->SetFillColor(2); 
 myPadLogo->SetBorderMode(0);
 myPadLogo->SetBorderSize(2);
 myPadLogo->SetFrameBorderMode(0);
 myPadLogo->SetLeftMargin(0.0);
 myPadLogo->SetTopMargin(0.0);
 myPadLogo->SetBottomMargin(0.0);
 myPadLogo->SetRightMargin(0.0);
 myPadLogo->Draw();
 myPadLogo->cd();
 TASImage *myAliceLogo = new TASImage("/u/mfasel/work/electron/Spectrum/alice_logo.png");
 myAliceLogo->Draw();
 c->cd();
 TPaveText* t1=new TPaveText(0.59,0.59,0.89,0.66,"NDC");
 t1->SetFillStyle(0);
 t1->SetBorderSize(0);
 t1->AddText(0.,0.,"ALICE Performance");
 t1->SetTextColor(kRed);
 t1->SetTextFont(42);
 t1->Draw();
 TPaveText* t2=new TPaveText(0.59,0.54,0.89,0.60,"NDC");
 t2->SetFillStyle(0);
 t2->SetBorderSize(0);
 t2->SetTextColor(kRed);
 t2->SetTextFont(52);
 t2->AddText(0.,0.,today.Data());
 t2->Draw();
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:50,代码来源:PerformanceSpectrumUncorr.C

示例5: prepareAll

void prepareAll() {
        myOptions(0);

        gROOT->ForceStyle();
        gStyle->SetPalette(1.0);

        TDatime now;
        int iDate = now.GetDate();
        int iYear=iDate/10000;
        int iMonth=(iDate%10000)/100;
        int iDay=iDate%100;
        char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun",
                          "Jul","Aug","Sep","Oct","Nov","Dec"};
        char cStamp1[25],cStamp2[25];
        sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear);
        sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear);
}
开发者ID:maszyman,项目名称:PlotMacros,代码行数:17,代码来源:drawMultiplicity.C

示例6: 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");
}
开发者ID:star-bnl,项目名称:star-macros,代码行数:101,代码来源:bfcMixer_Ftpc.C

示例7: SaveCanvas

void SaveCanvas(TCanvas* c, TString dir, TString filename)
{
   TDatime* date = new TDatime();
   c->Print(Form("/net/hisrv0001/home/davidlw/pic/%s/%s_%d.eps",dir.Data(),filename.Data(),date->GetDate()));
   c->Print(Form("/net/hisrv0001/home/davidlw/pic/%s/%s_%d.gif",dir.Data(),filename.Data(),date->GetDate()));
   c->Print(Form("/net/hisrv0001/home/davidlw/pic/%s/%s_%d.pdf",dir.Data(),filename.Data(),date->GetDate()));
   c->Print(Form("/net/hisrv0001/home/davidlw/pic/%s/%s_%d.C",dir.Data(),filename.Data(),date->GetDate()));
}
开发者ID:velicanu,项目名称:gammajettrack,代码行数:8,代码来源:MITStyle.C

示例8: gammaTrkHistProducer

void gammaTrkHistProducer(sampleType collision = kPPDATA, float photonPtThr=20, float photonPtThrUp=9999, int icent =7){
  TH1::SetDefaultSumw2();
  
  TString stringSampleType = getSampleName(collision); "";
  
  TDatime* date = new TDatime();
  TString  outName=  Form("photonTrackCorr_%s_output_photonPtThr%d_to_%d_%d.root",stringSampleType.Data(),(int)photonPtThr, (int)photonPtThrUp,  date->GetDate());
  delete date;
  
 
  int lowerCent(0),  upperCent(0); 
  TCut centCut  = "";
  if ( (collision ==kHIDATA) || (collision ==kHIMC) ) {
     lowerCent = ((icent/100)%100) *2 ;
     upperCent =  (icent%100)*2 -1 ; 
     centCut = Form("cBin >= %d && cBin<= %d",lowerCent,upperCent);
  }
  else if (  (collision ==kPPDATA) || (collision==kPPMC)  ){  // if it's pp 
    centCut = "(1==1)";
    //    icent = 7;   // for pp, centrality is set as the smearing 
  }
  else { // pPb
    centCut = Form( "hf4Sum > %f && hf4Sum <= %f", (float)centBinPa[icent-1], (float)centBinPa[icent]);
  }
  
  cout <<" centrality : " << centCut.GetTitle() << endl;
      
  ///////// Photon cut //////////////////////////////////////////////////////////////////////////////
  
  cout <<" photon pt >" << photonPtThr << " GeV" << endl;
  TCut ptPhoCut  = Form("photonEt>%.1f && photonEt<%.1f", (float)photonPtThr, (float)photonPtThrUp  );
  TCut caloIso;
  
  if ( (collision==kPPMC) || (collision==kPPDATA) ) 
    caloIso = "(ecalIso < 4.2  &&  hcalIso < 2.2  &&  trackIso < 2) && hovere<0.1";
  else if ( (collision==kHIMC) || (collision==kHIDATA) )
    caloIso = "(sumIso<5) && hovere<0.1";
  else {
    caloIso = "ecalIso < 4.2  &&  hcalIso < 2.2  &&  trackIso < 2 && hovere<0.1";
  }
  
  TCut sbIso   = "(sumIso>5) && (sumIso<20) && hovere<0.1";
  //  if ( (collision==kPPMC) || (collision==kPPDATA) || (collision==kPAMC) || (collision==kPADATA)  )
  //  sbIso   = "ecalIso < 4.2  &&  hcalIso < 2.2 && trackIso > 2 && trackIso < 5 && hovere<0.1";

  TCut basicPhoCut = centCut && ptPhoCut && caloIso ;
  TCut sbPhoCut    = centCut && ptPhoCut && sbIso   ;
  TCut evtSeltCut = basicPhoCut;
  TCut sbSeltCut  = sbPhoCut;

  TCut phoCandCut   = "sigmaIetaIeta<0.010";
  TCut phoDecayCut  = "(sigmaIetaIeta>0.011) && (sigmaIetaIeta<0.017)";
  if  ( ( collision == kHIMC ) || (collision == kPPMC) || (collision == kPAMC))  
    phoCandCut = phoCandCut && "genIso<5 && abs(genMomId)<=22";
  
  
  TString fname = "";
  if ( collision == kHIDATA)      fname = fnameHIDATA; //
  else if ( collision == kPADATA) fname = fnamePADATA;
  else if ( collision == kPPDATA) {
    if  ( icent == 7 ) fname = fnamePPDATA;
    else if ( icent == 10010 ) fname = fnamePPDATA0010;
    else if ( icent == 11030 ) fname = fnamePPDATA1030;
    else if ( icent == 13050 ) fname = fnamePPDATA3050;
    else if ( icent == 15099 ) fname = fnamePPDATA5099;
    else if ( icent == 10030 ) fname = fnamePPDATA0030;
    else if ( icent == 13099 ) fname = fnamePPDATA30100;
  }  
  else fname = "";
  
  multiTreeUtil* tgj = new multiTreeUtil();
  tgj->addFile(fname,  "tgj",  evtSeltCut,  1);
  tgj->AddFriend("yTrk");
 
  float purity(0);
  
  TString canvasName = Form("gifs/purity_%s_output_icent%d_photonPtThr%d-%d", stringSampleType.Data(),  (int)icent, (int)photonPtThr, (int)photonPtThrUp);
  
  if ( collision == kPPDATA) {  
    purity = 0.85;
  }
  else {
    fitResult fitr = getPurity(fname, collision, evtSeltCut, sbSeltCut, canvasName, photonPtThr, photonPtThrUp);
    purity = fitr.purity010;
  }
  GjSpectra* gSpec = new GjSpectra();
  gSpec->init(Form("icent%d",(int)icent) );
  tgj->Draw2(gSpec->hPtPhoCand,  "photonEt", phoCandCut, "");
  tgj->Draw2(gSpec->hPtPhoDecay, "photonEt", phoDecayCut, "");
  
  // Obtain background subtracted spectra
  
  float candInt = gSpec->hPtPhoCand->Integral();
  float decayInt = gSpec->hPtPhoDecay->Integral();
  gSpec->hPtPhoSig->Reset();
  gSpec->hPtPhoSig->Add(gSpec->hPtPhoCand);
  gSpec->hPtPhoSig->Add(gSpec->hPtPhoDecay, -(1. - purity) * candInt / decayInt);
  gSpec->hPtPhoSig->Scale(1./purity ) ;
  
  TFile outf = TFile(Form("ffFiles/%s",outName.Data()),"update");
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:photonHadron2014,代码行数:101,代码来源:gammaTrkHistProducer.C

示例9: drawExpensesTab

void TExpenser::drawExpensesTab() {

    fExpensesTab = fTab->AddTab("Expenses");
    fExpensesTab -> SetLayoutManager(new TGHorizontalLayout(fExpensesTab));

    // Create the table
    createExpensesTableInterface();
    fTable = new TGTable(fExpensesTab, 999, fTableInterface, NROWSTABLE, fTableInterface->GetNColumns());
    fExpensesTab -> AddFrame(fTable, new TGLayoutHints(kLHintsCenterY,2,2,2,2));

    // create a frame holding all widgets on the right of the table
    TGVerticalFrame *hframe = new TGVerticalFrame(fExpensesTab, 500, 40);
    fExpensesTab -> AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));

    // --------- New expense group --------- //
    TGGroupFrame *frame_new_expense = new TGGroupFrame(hframe, "New expense");
    frame_new_expense->SetTitlePos(TGGroupFrame::kLeft);
    frame_new_expense->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"); // when font too large, collides with group content....
    // frame_new_expense->SetTextColor(kBlue); // doesn't work unfortunately
    hframe->AddFrame(frame_new_expense, new TGLayoutHints(kLHintsExpandX));

    // expense amount entry field
    fAmountEntry = new TGNumberEntryField(frame_new_expense, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber);
    frame_new_expense->AddFrame(fAmountEntry, new TGLayoutHints(kLHintsLeft,5,5,3,4));

    // date entry field
    TDatime time;
    fDateEntry = new TGNumberEntry(frame_new_expense, time.GetDate(), 10, -1, TGNumberFormat::kNESDayMYear, TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, 20090101., 20200101);
    frame_new_expense->AddFrame(fDateEntry, new TGLayoutHints(kLHintsLeft,5,5,3,4));

    // withdrawn or not
    fWithdrawn = new TGComboBox(frame_new_expense,30);
    fWithdrawn->AddEntry("Not Withdrawn", 1);
    fWithdrawn->AddEntry("Withdrawn", 2);
    fWithdrawn->Select(1);
    fWithdrawn->Resize(150, 20);
    frame_new_expense->AddFrame(fWithdrawn, new TGLayoutHints(kLHintsLeft,5,10,5,5));

    // category selector
    fCategoryBox = new TGComboBox(frame_new_expense,100);
    for (unsigned i = 0; i < NCATEGORIES; i++) {
        fCategoryBox->AddEntry(CATEGORIES[i], i+1);
    }
    fCategoryBox->Resize(150, 20);
    fCategoryBox->Select(1);
    frame_new_expense->AddFrame(fCategoryBox, new TGLayoutHints(kLHintsLeft,5,10,5,5));

    // description field
    fDescription = new TGTextEntry(frame_new_expense, "");
    fDescription -> SetToolTipText("Description");
    fDescription -> Resize(200, fDescription->GetDefaultHeight());
    frame_new_expense -> AddFrame(fDescription, new TGLayoutHints(kLHintsLeft, 5,5,5,5));

    // add-button
    TGTextButton * add_button = new TGTextButton(frame_new_expense,"&Add Expense");
    add_button -> Connect("Clicked()", "TExpenser", this, "add()");
    add_button  ->  SetFont("-*-times-bold-r-*-*-28-*-*-*-*-*-*-*");
    frame_new_expense -> AddFrame(add_button, new TGLayoutHints(kLHintsLeft,5,5,3,4));

    // --------- Withdrawing group --------- //
    TGGroupFrame *frame_withdrawn = new TGGroupFrame(hframe, "Withdrawing");
    frame_withdrawn->SetTitlePos(TGGroupFrame::kLeft);
    frame_withdrawn->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"); // when font too large, collides with group content....
    hframe->AddFrame(frame_withdrawn, new TGLayoutHints(kLHintsExpandX));

    // withdrawn id entry field and withdrawn button
    TGHorizontalFrame *hframe1 = new TGHorizontalFrame(frame_withdrawn, 500, 40);
    frame_withdrawn -> AddFrame(hframe1,new TGLayoutHints(kLHintsLeft,5,5,3,4));
    fWithdrawnIdEntry = new TGNumberEntryField(hframe1, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber);
    hframe1->AddFrame(fWithdrawnIdEntry, new TGLayoutHints(kLHintsLeft|kLHintsExpandY,5,5,3,4));
    TGTextButton * withdrawn_button = new TGTextButton(hframe1,"&Withdrawn");
    withdrawn_button ->  SetFont("-*-times-bold-r-*-*-28-*-*-*-*-*-*-*");
    hframe1->AddFrame(withdrawn_button, new TGLayoutHints(kLHintsLeft,5,5,3,4));
    withdrawn_button -> Connect("Clicked()", "TExpenser", this, "set_withdrawn()");

    // commit-button
    TGTextButton * commit_button = new TGTextButton(hframe,"&Commit");
    commit_button -> Connect("Clicked()", "TExpenser", this, "commit()");
    commit_button -> SetFont("-*-times-bold-r-*-*-28-*-*-*-*-*-*-*");
    hframe -> AddFrame(commit_button, new TGLayoutHints(kLHintsLeft,5,5,3,4));

    // --------- Filter group --------- //
    TGGroupFrame *frame_filter = new TGGroupFrame(hframe, "Filter");
    frame_filter->SetTitlePos(TGGroupFrame::kLeft);
    frame_filter->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"); // when font too large, collides with group content....
    hframe->AddFrame(frame_filter, new TGLayoutHints(kLHintsExpandX));

    // filter category selector
    fFilterCategoryBox = new TGComboBox(frame_filter, 100);
    fFilterCategoryBox->AddEntry("Select Category", 1);
    for (unsigned i = 1; i < NCATEGORIES+1; i++) {
        fFilterCategoryBox->AddEntry(CATEGORIES[i], i+1);
    }
    fFilterCategoryBox->Resize(150, 20);
    fFilterCategoryBox->Select(1);
    frame_filter->AddFrame(fFilterCategoryBox, new TGLayoutHints(kLHintsLeft,5,10,5,5));

    // month selector
    fFilterMonthBox = new TGComboBox(frame_filter);
    fFilterMonthBox -> AddEntry("Select Month", 1);
//.........这里部分代码省略.........
开发者ID:libov,项目名称:expenser,代码行数:101,代码来源:TExpenser.C

示例10: 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),
//.........这里部分代码省略.........
开发者ID:RohanBhandari,项目名称:MJ,代码行数:101,代码来源:DoOneProcess.C

示例11: RAA_plot_YenJie_CutfromMinBias


//.........这里部分代码省略.........
    // set all the entries before bin no 15 to be zero.
    for(int j = 1; j<bin_no; ++j){
      hJetTrigComb[i]->SetBinContent(j,0);
      hJetTrigComb[i]->SetBinError(j,0);
      hMinBias[i]->SetBinContent(j,0);
      hMinBias[i]->SetBinError(j,0);
    }

    float scaleweight=hJetTrigComb[i]->GetBinContent(bin_no)/hMinBias[i]->GetBinContent(bin_no);

    cout<<" weight  "<<scaleweight<<endl;
    // normalize the histogram by the jet entries in bin of pT = 15.
    //    hJetTrigComb[i]->Scale(1./hJetTrigComb[i]->GetBinContent(bin_no));
    //    hMinBias[i]->Scale(1./hMinBias[i]->GetBinContent(bin_no));
    hMinBias[i]->Scale(scaleweight);


    hSubtracted[i]  = (TH1F*)hJetTrigComb[i]->Clone(Form("hFakeMinBias_SubtractedFrom_Data_R%d_%s_cent%d",radius, etaWidth, i));
    hSubtracted[i]->Add(hMinBias[i], -1);
    //    hSubtracted[i]->Draw();

    cout<<"working here  i value:   "<<i<<endl;  
  }


  // make the plots: just a 3x2 panel plot showing all the above three curves and write to output.
  TH2F * hBlankSpectra = new TH2F("hBlankSpectra","",400,0,350,100,1e-1,5e6);
   TCanvas * cFakeSub = new TCanvas("cFakeSub","",1000,800);
   makeMultiPanelCanvasWithGap(cFakeSub,3,2,0.01,0.01,0.16,0.2,0.04,0.04);
   //cFakeSub->Divide(3,2);
   

  TLegend * lSub = myLegend(0.5,0.5,0.7,0.7);
 makeHistTitle(hBlankSpectra," ","Jet p_{T} (GeV/c)","Counts normalized to ptbin = 15 GeV");
  // hBlankSpectra->GetYaxis()->SetNdivisions(1000); 
  hBlankSpectra->GetYaxis()->SetMoreLogLabels(kFALSE);
  hBlankSpectra->GetYaxis()->SetTitleOffset(2.5);


  // 
for(int i = 0; i<6; ++i){
  cout<< "    i values "<<i<<endl;

    cFakeSub->cd(6-i);
    cFakeSub->cd(6-i)->SetLogy();
    hBlankSpectra->Draw();
    
    hJetTrigComb[i]->SetMarkerStyle(24);    
    hJetTrigComb[i]->SetMarkerColor(kBlack);
    hJetTrigComb[i]->SetAxisRange(13,299,"X");
//    makeHistTitle(hJetTrigComb[i]," ","Jet p_{T} (GeV/c)","Counts normalized to ptbin = 15 GeV");
    hJetTrigComb[i]->Draw("same");

    hMinBias[i]->SetMarkerStyle(24);    
    hMinBias[i]->SetMarkerColor(kRed);
    hMinBias[i]->Draw("same");

    hSubtracted[i]->SetMarkerStyle(27);    
    hSubtracted[i]->SetMarkerColor(kBlue);
    hSubtracted[i]->Draw("same");
    //cout<<"working here   too"<<endl; 
    drawText(Form("%2.0f-%2.0f%%",2.5*boundaries_cent[i],2.5*boundaries_cent[i+1]),0.7,0.9,20);    
    if(i==4){   drawText(Form("|vz|<15, %s",etaLabel),0.3,0.8,20); }
  }


  cFakeSub->cd(1);
  putCMSPrel(0.2,0.92,0.04);
  drawText(Form("Anti-k_{T} PuPF Jets R=0.%d",radius),0.2,0.8,20);

  
  lSub->AddEntry(hJetTrigComb[0],"Jet Triggered Data","pl");
  lSub->AddEntry(hMinBias[0],"MinBias data","pl");
  lSub->AddEntry(hSubtracted[0],"Jet Triggered - MinBias","pl");
  lSub->SetTextSize(0.04);
  lSub->Draw();
 
  cFakeSub->SaveAs(Form("PbPb_FakeMinBias_SubtractedFrom_Data_R%d_%s_%d.pdf",radius, etaWidth, date.GetDate()),"RECREATE");
  
  //  create output root file to write the output histogram. 
  TFile fout(Form("PbPb_FakeMinBias_SubtractedFrom_Data_R%d_%s_%d.root",radius, etaWidth, date.GetDate()),"RECREATE");
  fout.cd();

  for(int i = 0; i<nbins_cent-1; ++i){

  hSubtracted[i]->Write();
  hJetTrigComb[i]->Write();
  hMinBias[i]->Write();

  }

  fout.Close();

  //macro end. 
  timer.Stop();
  cout<<"Macro finished: "<<endl;
  cout<<"CPU time (min)  = "<<(Float_t)timer.CpuTime()/60<<endl;
  cout<<"Real time (min) = "<<(Float_t)timer.RealTime()/60<<endl;
  
}
开发者ID:mtonjes,项目名称:usercode,代码行数:101,代码来源:RAA_plot_YenJie_CutfromMinBias.C

示例12: Init

void TOnePadDisplay::Init() {
//Initialization and default options
  Int_t day,month,year,date;
  TDatime *td;
//Date
  td = new TDatime();
  date  = td->GetDate();
  day   = date % 100;
  date /= 100;
  month = date % 100;
  date /= 100;
  year  = date;
  delete td;
  fCanDate  = "";
  fCanDate += day;
  fCanDate.Append(" / ");
  fCanDate += month;
  fCanDate.Append(" / ");
  fCanDate += year;
//Pointers to 0
  fCanvas          = 0;
  fTex1            = 0;
  fTex2            = 0;
  fTex3            = 0;
  fPad             = 0;
//initialization for main canvas
  fCanTopX         = 2;
  fCanTopY         = 2;
  fCanWidth        = 1000; //old 1178
  fCanHeigth       = 700;  //old 770
  fCanColor        = 20;
  fCanBsz          = 12; //4
  fCanStyle        = 1000;
//initialization for pad
  fPadXlow         = 0.015;
  fPadXup          = 0.985;
  fPadYlow         = 0.05;
  fPadYup          = 0.95;
  fPadColor        = 11;
  fPadBsz          = 6;
  fPadStyle        = 1000;
  fPadLogX         = 0;
  fPadLogY         = 0;
//initialization for frame in pad
  fFrameColor      = 171;
//initialization for Style
  fStyleStat       = 1111;
  fStyleFont       = 22;
  fStyleColor      = 171;
  fStyleH          = 0.1;
  fStyleW          = 0.65;//0.76
  fStyleHistColor  = 42;
  fStyleTXSize     = 0.035;//0.035
  fStyleTYSize     = 0.035;//0.035
  fStyleTitleH     = 0.04;//0.04
  fStyleTitleW     = 0.95;
  fStyleTitleX     = 0.12;
  fStyleTXOffset   = 1.0;
  fStyleTitleY     = 0.975;
  fStyleTYOffset   = 1.0;
  fStyleTBSize     = 4;
  fStyleTitleFont  = 22;
  fStyleTitleColor = 1;
  fStyleTFColor    = 191;
  fStyleTTextColor = 1;
  fStyleLabelSize  = 0.035;
  fStyleLabelAxis  = "XYZ";
//labels
  fTextT1          = "SplineFit : General Purpose Fit System";
  fXTex1           = 0.04;
  fYTex1           = 0.96;
  fTextT2          = "F.X.Gentit DAPNIA/SPP CEA Saclay";
  fXTex2           = 0.04;
  fYTex2           = 0.025;
  fTextT3          = "TOnePadDisplay   ";
  fTextT3.Append(fCanDate);
  fXTex3           = 0.8;
  fYTex3           = 0.025;
  fFontTex         = 72;
  fSizeTex         = 0.022419;
  fWidthTex        = 2;
  gOneDisplay      = this;
}
开发者ID:jdbrice,项目名称:TofCalibration,代码行数:83,代码来源:TOnePadDisplay.cpp

示例13: Check_PFelecFix

void Check_PFelecFix(int radius = 3,
		     char * algo = (char*)"PF",
		     char * bkgsub = (char*)"Pu"){

  
  TH1::SetDefaultSumw2();
  //gStyle->SetOptStat(0);
  
  TStopwatch timer;
  timer.Start();
  
  TDatime date;

  char * fileType[4][256] = {"badFile","Fix_1","Fix_2","Fix_3"};
  
  // get the input hiForest files, these are going to be in an array 0 - bad fine, 1 - fix_1, 2 - fix_2, 3 - fix_3; 
  TFile * fIn[4];

  // input the filen names
  fIn[0] = TFile::Open("");
  fIn[1] = TFile::Open("");
  fIn[2] = TFile::Open("");
  fIn[3] = TFile::Open("");
  
  // get the jet trees from the necessary files (these events already passed the event quality cuts so only hav to get the jet Tree).
  TTree * jet[4];
   
  // get the histograms from these files for the different centrality bins and the fixes. 
  TH1F * heMax[4][nbins_cent], * heSum[4][nbins_cent];
  TH2F * heMax_vs_jtpt[4][nbins_cent], * heMaxJtpt_vs_jtpt[4][nbins_cent], * heMaxSumcand_vs_jtpt[4][nbins_cent];


  for(int k = 0; k<4; ++k){

    jet[k] = (TTree*)fIn[k]->Get(Form("ak%s%d%sJetAnalyzer/t",bkgsub,radius,algo));

    for(int i = 0; i<nbins_cent; ++i){

      heMax[k][i] = new TH1F(Form("heMax_%s_cent%d",fileType,i),"",200,0,200);
      heMax_vs_jtpt[k][i] = new TH1F(Form("heMax_vs_jtpt_%s_cent0",fileType,i),"",400,0,400,100,0,200);
      heMaxJtpt_vs_jtpt[k][i] = new TH1F(Form("heMaxJtpt_vs_jtpt_%s_cent0",fileType,i),"",400,0,400,100,0,10);
      heMaxSumcand_vs_jtpt[k][i] = new TH1F(Form("heMaxSumcand_vs_jtpt_%s_cent0",fileType,i),"",400,0,400,100,0,10);

      jet[k]->Draw(Form("eMax>>heMax_%s_cent%d",fileType,i),Form("hiBin>=%d && hiBin<%d",5 * boundaries_cent[i], 5 * boundaries_cent[i+1]),"goff");
      jet[k]->Draw(Form("eMax:jtpt>>heMax_vs_jtpt_%s_cent%d",fileType,i),Form("hiBin>=%d && hiBin<%d",5 * boundaries_cent[i], 5 * boundaries_cent[i+1]),"goff");
      jet[k]->Draw(Form("eMax/jtpt:jtpt>>heMaxJtpt_vs_jtpt_%s_cent%d",fileType,i),Form("hiBin>=%d && hiBin<%d",5 * boundaries_cent[i], 5 * boundaries_cent[i+1]),"goff");
      jet[k]->Draw(Form("eMax/(chSum+neSum+muSum+phSum):jtpt>>heMaxSumcand_vs_jtpt_%s_cent%d",fileType,i),Form("hiBin>=%d && hiBin<%d",5 * boundaries_cent[i], 5 * boundaries_cent[i+1]),"goff");
    
    }

  }

  // now that we have the histograms, lets do the plotting part here.
  // we need one canvas for each plotted variable.
  // at the moment im only going to plot the most central events. 0 <= hiBin < 5

  TCanvas * ceMax, *ceMax_vs_jtpt, *ceMaxJtpt_vs_jtpt, *ceMaxSumcand_vs_jtpt;

  ceMax = new TCanvas("ceMax","",1200,1000);
  ceMax->Divide(4,1);
  ceMax_vs_jtpt = new TCanvas("ceMax_vs_jtpt","",1200,1000);
  ceMax_vs_jtpt->Divide(4,1);
  ceMaxJtpt_vs_jtpt = new TCanvas("ceMaxJtpt_vs_jtpt","",1200,1000);
  ceMaxJtpt_vs_jtpt->Divide(4,1);
  ceMaxSumcand_vs_jtpt = new TCanvas("ceMaxSumcand_vs_jtpt","",1200,1000);
  ceMaxSumcand_vs_jtpt->Divide(4,1);

  int cent = 0; // change this to draw other centrality classes 
  
  for(int k = 0; k<4; ++k){

    ceMax->cd(k+1);
    heMax[k][cent]->Draw();
    drawText(Form("%s %2.0f-%2.0f%",fileType,2.5*boundaries_cent[i],2.5*boundaries_cent[i+1]),0.2,0.2,14);

    ceMax_vs_jtpt->cd(k+1);
    heMax_vs_jtpt[k][cent]->Draw("colz");
    drawText(Form("%s %2.0f-%2.0f%",fileType,2.5*boundaries_cent[i],2.5*boundaries_cent[i+1]),0.2,0.2,14);

    ceMaxJtpt_vs_jtpt->cd(k+1);
    heMaxJtpt_vs_jtpt[k][cent]->Draw("colz");
    drawText(Form("%s %2.0f-%2.0f%",fileType,2.5*boundaries_cent[i],2.5*boundaries_cent[i+1]),0.2,0.2,14);

    ceMaxSumcand_vs_jtpt->cd(k+1);
    heMax_vs_jtpt[k][cent]->Draw("colz");
    drawText(Form("%s %2.0f-%2.0f%",fileType,2.5*boundaries_cent[i],2.5*boundaries_cent[i+1]),0.2,0.2,14);

  }

  ceMax->SaveAs(Form("PbPb_eMaxvariable_cent%d_ak%s%d%s_%d.pdf",cent,bkgsub,radius,algo,date.GetDate()),"RECREATE");
  ceMax_vs_jtpt->SaveAs(Form("PbPb_eMax_vs_jtpt_cent%d_ak%s%d%s_%d.pdf",cent,bkgsub,radius,algo,date.GetDate()),"RECREATE");
  ceMaxJtpt_vs_jtpt->SaveAs(Form("PbPb_eMaxOverJtpt_vs_jtpt_cent%d_ak%s%d%s_%d.pdf",cent,bkgsub,radius,algo,date.GetDate()),"RECREATE");
  ceMaxSumcand_vs_jtpt->SaveAs(Form("PbPb_eMaxOver_SumCandidates_without_eMax_vs_jtpt_cent%d_ak%s%d%s_%d.pdf",cent,bkgsub,radius,algo,date.GetDate()),"RECREATE");
  
  timer.Stop();
  cout<<"Macro finished: "<<endl;
  cout<<"CPU time (min)  = "<<(float)timer.CpuTime()/60<<endl;
  cout<<"Real time (min) = "<<(float)timer.RealTime()/60<<endl;


//.........这里部分代码省略.........
开发者ID:rkunnawa,项目名称:RAA,代码行数:101,代码来源:Check_PFelecFix.C

示例14: gammaJetHistProducer_jetEnergyScaledMinus2percent

void gammaJetHistProducer_jetEnergyScaledMinus2percent(sampleType collision = kPADATA, float photonPtThr=60, float photonPtThrUp=9999, float jetPtThr=30, int icent =1) {
  TH1::SetDefaultSumw2();
  
  TString stringSampleType = getSampleName(collision); "";
  
  TDatime* date = new TDatime();
  TString  outName=  Form("photonTrackCorr_%s_output_photonPtThr%d_to_%d_jetPtThr%d_%d.root",stringSampleType.Data(),(int)photonPtThr, (int)photonPtThrUp, (int)jetPtThr,  date->GetDate());
  delete date;
  
  int lowerCent(0),  upperCent(0); 
  TCut centCut  = "";
  if ( (collision ==kHIDATA) || (collision==kHIMC) )   {
    lowerCent = centBin1[icent-1];
    upperCent = centBin1[icent]-1;
    if ( icent > 9999) {
      lowerCent = ((icent/100)%100)/2.5;
      upperCent =  (icent%100)/2.5 -1;
    }   
    centCut = Form("cBin >= %d && cBin<= %d",lowerCent,upperCent);
  }
  else if (  (collision ==kPPDATA) || (collision==kPPMC)  ){  // if it's pp 
    centCut = "(1==1)";
    //    icent = 7;   // for pp, centrality is set as the smearing 
  }
  else { // pPb
    centCut = Form( "hf4Sum > %f && hf4Sum <= %f", (float)centBinPa[icent-1], (float)centBinPa[icent]);
  }
  
  cout <<" centrality : " << centCut.GetTitle() << endl;
      
  ///////// Photon cut //////////////////////////////////////////////////////////////////////////////
  
  cout <<" photon pt >" << photonPtThr << " GeV" << endl;
  TCut ptPhoCut  = Form("photonEt>%.1f && photonEt<%.1f", (float)photonPtThr, (float)photonPtThrUp  );
  TCut caloIso;
  
  if ( (collision==kPPMC) || (collision==kPPDATA) ) 
    caloIso = "(ecalIso < 4.2  &&  hcalIso < 2.2  &&  trackIso < 2) && hovere<0.1";
  else if ( (collision==kHIMC) || (collision==kHIDATA) )
    caloIso = "(sumIso<1) && hovere<0.1";
  else {
    caloIso = "ecalIso < 4.2  &&  hcalIso < 2.2  &&  trackIso < 2 && hovere<0.1";
  }
  
  TCut sbIso   = "(sumIso>10) && (sumIso<20) && hovere<0.1";
  //  if ( (collision==kPPMC) || (collision==kPPDATA) || (collision==kPAMC) || (collision==kPADATA)  )
  //  sbIso   = "ecalIso < 4.2  &&  hcalIso < 2.2 && trackIso > 2 && trackIso < 5 && hovere<0.1";

  TCut basicPhoCut = centCut && ptPhoCut && caloIso ;
  TCut sbPhoCut    = centCut && ptPhoCut && sbIso   ;
  TCut evtSeltCut = basicPhoCut;
  TCut sbSeltCut  = sbPhoCut;

  TCut phoCandCut   = "sigmaIetaIeta<0.010";
  TCut phoDecayCut  = "(sigmaIetaIeta>0.011) && (sigmaIetaIeta<0.017)";
  if  ( ( collision == kHIMC ) || (collision == kPPMC) || (collision == kPAMC))  
    phoCandCut = phoCandCut && "genIso<5 && abs(genMomId)<=22";
  
  
  TString fname = "";
  if ( collision == kHIDATA)      fname = fnameHIDATA_Minus2percentScaled;
  else if ( collision == kPADATA) fname = fnamePADATA_Minus2percentScaled;
  else if ( collision == kPPDATA) {
    if ( icent == 7 ) fname = fnamePPDATA_Minus2percentScaled;
  }  
  else fname = "";
  
  multiTreeUtil* tgj = new multiTreeUtil();
  multiTreeUtil* tgjMC = new multiTreeUtil();
  if (  ( collision == kHIDATA)   || ( collision==kPADATA) || ( collision == kPPDATA) ) {
    tgj->addFile(fname,  "tgj",  evtSeltCut,  1);
  }
  else if ( collision == kPPMC ) {
    tgj->addFile(fnamePPMC_AllQcdPho30to50,    "tgj", evtSeltCut, wPPMC_AllQcdPho30to50 );
    tgj->addFile(fnamePPMC_AllQcdPho50to80,    "tgj", evtSeltCut, wPPMC_AllQcdPho50to80 );
    tgj->addFile(fnamePPMC_AllQcdPho80to120,   "tgj", evtSeltCut, wPPMC_AllQcdPho80to120 );
    tgj->addFile(fnamePPMC_AllQcdPho120to9999, "tgj", evtSeltCut, wPPMC_AllQcdPho120to9999 );
  }
  else if ( collision == kPAMC ) {
    tgj->addFile(fnamePAMC_AllQcdPho30to50,    "tgj", evtSeltCut, wPAMC_AllQcdPho30to50 );
    tgj->addFile(fnamePAMC_AllQcdPho50to80,    "tgj", evtSeltCut, wPAMC_AllQcdPho50to80 );
    tgj->addFile(fnamePAMC_AllQcdPho80to120,   "tgj", evtSeltCut, wPAMC_AllQcdPho80to120 );
    tgj->addFile(fnamePAMC_AllQcdPho120to9999, "tgj", evtSeltCut, wPAMC_AllQcdPho120to9999 );
  }
  else  {    // kHIMC
    tgj->addFile(fnameHIMC_AllQcdPho30to50,    "tgj", evtSeltCut, wHIMC_AllQcdPho30to50 );
    tgj->addFile(fnameHIMC_AllQcdPho50to80,    "tgj", evtSeltCut, wHIMC_AllQcdPho50to80 );
    tgj->addFile(fnameHIMC_AllQcdPho80to9999,  "tgj", evtSeltCut, wHIMC_AllQcdPho80to9999 );
  }
  tgj->AddFriend("yJet");
 
  // get purity with the current jet cut ! 
  float purity(0);
  
  TString canvasName = Form("gifs/purity_%s_output_icent%d_photonPtThr%d-%d_jetPtThr%d", stringSampleType.Data(),  (int)icent, (int)photonPtThr, (int)photonPtThrUp, (int)jetPtThr);
  
  //  if ( (collision==kPPDATA) && (photonPtThr < 50 ) ) {
  //   purity = 0.86 ;   
  //   cout << " !!!!!!!" << endl << endl << " purity is set as  0.86 for this bin because we don't have pp MC low pt sample " << endl;
  //   cout << endl << endl << endl << " !!!!!!" << endl;
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:gammaJetAnalysis,代码行数:101,代码来源:gammaJetHistProducer_jetEnergyScaledMinus2percent.C

示例15: 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);
//.........这里部分代码省略.........
开发者ID:star-bnl,项目名称:star-macros,代码行数:101,代码来源:bfcMixer_TpcSvtSsd2005.C


注:本文中的TDatime::GetDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。