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


C++ TString类代码示例

本文整理汇总了C++中TString的典型用法代码示例。如果您正苦于以下问题:C++ TString类的具体用法?C++ TString怎么用?C++ TString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TCanvas

TCanvas *plot_adc_fit(Int_t pmt=1, Int_t tdc_min=750, Int_t tdc_width=400, Int_t adc_neighbor_cut=10, Int_t adc_cut=50){

        TString cut, draw, draw1, title, grtitle;
        title.Form("run_%d_ADC_Fit",run);
        TCanvas *cADCFit = new TCanvas("cADCFit",title,xcanvas,ycanvas);
	title.Form("run_%d_ADC_Mean_Fit",run);
	TCanvas *cADCMeanFit= new TCanvas("cADCMeanFit",title,xcanvas,ycanvas);

	// Setting up different arrays and objects used to create the two canvases.

	TH1D *htmp[NUMPIXEL];
	TF1 *function;
	TF1 *function1;
	Int_t histmax_cut[16], gaus_cut_plus[16];
	Float_t gaus_cut_minus[16];

	Double_t upixel[NUMPIXEL]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
	Double_t epixel[NUMPIXEL]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
	Double_t errors[NUMPIXEL]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

	Double_t constants[16], means[16], sigmas[16];

	TString tmpentry;
	MyStyle->SetStatX(0.9);
        MyStyle->SetStatY(0.6);
        MyStyle->SetStatY(0.4);

	setPaddleIndices(); //Setting the geometric paddle locations

	Int_t nbin=90;
	Int_t min=-100, max=800; // change max to 1500 for PMT 9

	for(Int_t i = 1; i <= NUMPIXEL; i++)
	  {
	    tmpentry.Form("htmp%d",i);
	    htmp[i-1] = new TH1D(tmpentry,tmpentry,nbin,min,max);
	    htmp[i-1]->SetLineColor(kRed);
	    title.Form("Run %d ADC Fit pmt %d, paddle %d: %d < tdc < %d",run,pmt,i,tdc_min,tdc_min+tdc_width);
	    htmp[i-1]->SetTitle(title);
	  }

	// Filling the histograms using only adc data with good tdc and good adc neighbor cut.

	Int_t nentries=n_events_to_analyze;

	for (Int_t id=1;id<=nentries;id++)
	  {
	    T->GetEntry(id);
	    Int_t ipaddle = (pmt)*NUMPADDLE+1;
	    for (Int_t pixel=0; pixel < NUMPIXEL; pixel++)
	    {
		Int_t index = (pmt-1)*NUMPIXEL+pixel;
		if (pixel!=pixel1[pmt-1]-1 && pixel!=pixel2[pmt-1]-1)
		{
		  ipaddle--;
		  // if(tdcl[index] > tdc_min && tdcl[index] < tdc_min+tdc_width)
		  //  {
		    if (ipaddle < 2) 
		    {
			if (adc_c[paddleindex[ipaddle+1]] < adc_neighbor_cut)
			{
			  htmp[pixel]->Fill(adc_c[index]);
			}
		    }
		    else if (ipaddle > NUMPMT*NUMPADDLE) // should this be > or = ?
		    {
			if (adc_c[paddleindex[ipaddle-1]] < adc_neighbor_cut)
			{
			    htmp[pixel]->Fill(adc_c[index]);
			}
		    }
		    else
		    {
			if (adc_c[paddleindex[ipaddle-1]] < adc_neighbor_cut && adc_c[paddleindex[ipaddle+1]] < adc_neighbor_cut)
			{
			  htmp[pixel]->Fill(adc_c[index]);
			}
		        }
		    // }
		}
	    }
	  }


	// Creating the canvas of adc data with good tdc and fitting the adc with a gaussian or "landau" function.

	cADCFit->Clear();
	cADCMeanFit->Clear();
	cADCFit->Divide(4,4);

        Int_t count = 0;
        for (Int_t i=0; i<NUMPIXEL; i++)
	  {
	    if(i != pixel1[pmt-1]-1 && i != pixel2[pmt-1]-1) 
	      {
         //       means[i]=0.0;
	//	int check = 0;
		cADCFit->cd(count+1);
		 gPad->SetLogy();
		cADCFit->Update();
//.........这里部分代码省略.........
开发者ID:brash99,项目名称:analyzer,代码行数:101,代码来源:plot.C

示例2: DeadXtal

//Usage: .x DeadXtal.C+("root://eoscms//eos/cms/store/group/alca_ecalcalib/lpernie/ALL_2012C_pi0_NewTag_01/iter_0/2012C_epsilonPlots.root","plots/")
void DeadXtal( TString Path, TString OutDir ){

  //Starting
  cout<<"Starting with: DeadXtal.C"<<endl;
  TFile* fin = TFile::Open( Path.Data() );
  if(!fin) { cout << "Invalid file: " << Path.Data() << " .. try again" << endl; return; }
  std::string calibMapFileName = string(Path.Data());
  std::string strToReplace = "epsilonPlots";
  calibMapFileName.replace(calibMapFileName.find(strToReplace.c_str()),strToReplace.size(),"calibMap");

  TFile* MapFile = TFile::Open( calibMapFileName.c_str() );
  TTree *calibEB = (TTree*) MapFile->Get("calibEB");
  TTree *calibEE = (TTree*) MapFile->Get("calibEE");
  if(!MapFile) { cout << "Invalid file: MapFile .. try again" << endl; return; }
  system( (string("mkdir -p ") + OutDir.Data() ).c_str() );
  TString nameFile = OutDir + "/h_DeadXtal.root";
  TFile* output = new TFile( nameFile.Data(), "RECREATE" );
  output->cd();
  TH2F* rms_EB  = new TH2F("rms_EB","DeadXtal #phi on x #eta on y",MAX_IPHI, MIN_IPHI, MAX_IPHI, 2*MAX_IETA+1, -MAX_IETA-0.5, MAX_IETA+0.5 );
  TH2F* rms_EB_r= new TH2F("rms_EB_r","DeadXtal #eta on x #phi on y", 2*MAX_IETA+1, -MAX_IETA-0.5, MAX_IETA+0.5, MAX_IPHI, MIN_IPHI, MAX_IPHI);
  TH2F* rms_EEp = new TH2F("rms_EEp","DeadXtal iX on x iY on y (EEp)",100,0.5,100.5,100,0.5,100.5);
  TH2F* rms_EEm = new TH2F("rms_EEm","DeadXtal iY on x iY on y (EEm)",100,0.5,100.5,100,0.5,100.5);

  //EB
  cout<<"Now EB..."<<endl;
  std::vector<int> Xtal_EB; Xtal_EB.clear();
  for(int nEB=0; nEB<61200; nEB++){
    //ostringstream convert; convert << nEB;
    string convert = std::to_string(nEB);
    TString name = "Barrel/epsilon_EB_iR_" + convert;
    TH1F * h1 = (TH1F*) fin->Get( name.Data() );
    if(h1->GetEntries()==0){
	Xtal_EB.push_back( nEB );
    }
  }
  //EE
  cout<<"Now EE..."<<endl;
  std::vector<int> Xtal_EE; Xtal_EE.clear();
  for(int nEE=0; nEE<14648; nEE++){
    //ostringstream convert; convert << nEE;
    string convert = std::to_string(nEE);
    TString name = "Endcap/epsilon_EE_iR_" + convert;
    TH1F * h1 = (TH1F*) fin->Get( name.Data() );
    if(h1->GetEntries()==0){
	Xtal_EE.push_back( nEE );
    }
  }
  //DrawPlots
  cout<<"Drawing EB."<<endl;
  Int_t ieta, iphi, hashedIndex; 
  calibEB->SetBranchAddress( "ieta_", &ieta);
  calibEB->SetBranchAddress( "iphi_", &iphi);
  calibEB->SetBranchAddress( "hashedIndex_", &hashedIndex);
  std::map<int,std::vector<int>> EBMap; EBMap.clear();
  Long64_t nentriesEB = calibEB->GetEntriesFast();
  for(Long64_t iEntry=0; iEntry<nentriesEB; iEntry++){
    calibEB->GetEntry(iEntry);
    std::vector<int> EtaPhi; EtaPhi.clear();
    EtaPhi.push_back( ieta ); EtaPhi.push_back( iphi );
    EBMap[hashedIndex] = EtaPhi;
  }
  for(int i=0; i<int(Xtal_EB.size()); i++){
    int BinEta = EBMap[Xtal_EB[i]][0] + 86;
    int BinPhi = EBMap[Xtal_EB[i]][1] + 1;
    rms_EB->SetBinContent( BinPhi, BinEta, 1 );
    rms_EB_r->SetBinContent( BinEta, BinPhi, 1 );
  }
  cout<<"And finally drawing EE."<<endl;
  Int_t ix, iy, zside, hashedIndex2; 
  calibEE->SetBranchAddress( "ix_", &ix);
  calibEE->SetBranchAddress( "iy_", &iy);
  calibEE->SetBranchAddress( "zside_", &zside);
  calibEE->SetBranchAddress( "hashedIndex_", &hashedIndex2);
  std::map<int,std::vector<int>> EEMap; EEMap.clear();
  Long64_t nentriesEE = calibEE->GetEntriesFast();
  for(Long64_t iEntry=0; iEntry<nentriesEE; iEntry++){
    calibEE->GetEntry(iEntry);
    std::vector<int> XYeZ; XYeZ.clear();
    XYeZ.push_back( ix ); XYeZ.push_back( iy ); XYeZ.push_back( zside );
    EEMap[hashedIndex2] = XYeZ;
  }
  for(int i=0; i<int(Xtal_EE.size()); i++){
    int BinX = EEMap[Xtal_EE[i]][0]+1;
    int BinY = EEMap[Xtal_EE[i]][1]+1;
    if( EEMap[Xtal_EE[i]][2]<0 ) rms_EEm->SetBinContent( BinX, BinY, 1 );
    if( EEMap[Xtal_EE[i]][2]>0 ) rms_EEp->SetBinContent( BinX, BinY, 1 );
  }
  //END
  cout<<"Done!!"<<endl;
  output->cd();
  rms_EB->Write();
  rms_EB_r->Write();
  rms_EEp->Write();
  rms_EEm->Write();
  output->Close();
}
开发者ID:ECALELFS,项目名称:ECALpro,代码行数:97,代码来源:DeadXtal.C

示例3: outputFile

AliAnalysisTaskJetHBOM *AddTaskJetHBOM(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,TString effLoc,Int_t fNHBOM, Int_t constCone, Float_t constConePhi,Float_t constConeEta)
 {
   //if constCone is true, the random Cone positon is set to constConePhi and constConeEta. Else the cone is random set and the parameters constConePhi and constConeEta are irrelevant

 // Creates a jet fider task, configures it and adds it to the analysis manager.
   kPtTrackCutCl = ptTrackCut;
   kTrackEtaWindowCl = etaTrackWindow;
   kVertexWindowCl = vertexWindow;

   TString outputFile(deltaFile);
    // Get the pointer to the existing analysis manager via the static access method.
    //==============================================================================
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
    if (!mgr) {
       ::Error("AddTaskJetHBOM", "No analysis manager to connect to.");
       return NULL;
    }  

    // Check the analysis type using the event handlers connected to the analysis manager.
    //==============================================================================
    if (!mgr->GetInputEventHandler()) {
      ::Error("AddTaskJetHBOM", "This task requires an input event handler");
       return NULL;
    }

    TString type = mgr->GetInputEventHandler()->GetDataType();
    TString typeRec(bRec);
    TString typeGen(bGen);
    if(!typeRec.Contains("AODextra")) {
      typeGen.ToUpper();
      typeRec.ToUpper();
    }
    cout << "typeRec: " << typeRec << endl;
    // Create the task and configure it.
    //===========================================================================


    TString cAdd = "";
    cAdd += Form("%02d_",(int)((radius+0.01)*10.));
    cAdd += Form("B%d",(int)kBackgroundModeCl);
    cAdd += Form("_Filter%05d",filterMask);
    cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl));
    cAdd += Form("_hbom%02d",fNHBOM);
    if(constCone){
      cAdd += Form("_constConePhi%02dEta%02d",constConePhi,constConeEta);
    }
    Printf("%s %E",cAdd.Data(),kPtTrackCutCl);
    AliAnalysisTaskJetHBOM* hbom = new  AliAnalysisTaskJetHBOM(Form("JetHBOM%s_%s%s",bRec,jf,cAdd.Data()));
      
   hbom->SetFilterMask(filterMask); 
   //   hbom->SetUseGlobalSelection(kTRUE); 
   hbom->SetVtxCuts(kVertexWindowCl,1);//sets fVtxZCut and fVtxR2Cut
   if(type == "AOD"){
     // Assume all jet are produced already
     hbom->SetAODTrackInput(kTRUE);
     hbom->SetAODMCInput(kTRUE);
   }

   if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCChargedAcceptance);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODMC2")){
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCCharged);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(5);
   }
   else if (typeRec.Contains("AODMC")){
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCAll);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(5);
   }
   else if (typeRec.Contains("AODextraonly")) {
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextraonly);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODextra")) {
     cout << "AliAnalysisTaskJetHBOM::kTrackAODextra: " << AliAnalysisTaskJetHBOM::kTrackAODextra << endl;
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextra);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AOD")) {
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAOD);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }

   hbom->SetRparam(radius);
   hbom->SetGhostArea(0.005);
   hbom->SetGhostEtamax(kTrackEtaWindowCl);

   switch (jf) {
   case "ANTIKT":
     hbom->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh
     break;
   case "CA":
     hbom->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:AddTaskJetHBOM.C

示例4: runTask

void runTask(Float_t etamax=0.5,const char * incollection = 0, const char * outfile = "dndeta.root", Bool_t skipNorm = kFALSE)
{
  // for running with root only
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");

  // load analysis framework
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");


  TChain * chain = new TChain ("TE");
  if (incollection == 0) {
    chain->Add("galice.root");
  }
  else if (TString(incollection).Contains("xml")){
    TGrid::Connect("alien://");
    TAlienCollection * coll = TAlienCollection::Open (incollection);
    while(coll->Next()){
      chain->Add(TString("alien://")+coll->GetLFN());
    }
  } else {
    ifstream file_collect(incollection);
    TString line;
    while (line.ReadLine(file_collect) ) {
      chain->Add(line.Data());
    }
  }
  chain->GetListOfFiles()->Print();

  // for includes use either global setting in $HOME/.rootrc
  // ACLiC.IncludePaths: -I$(ALICE_ROOT)/include
  // or in each macro
  gSystem->AddIncludePath("-I$ALICE_ROOT/include");

  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("dNdeta");

  AliVEventHandler* esdH = new AliESDInputHandler;
  ((AliESDInputHandler*)esdH)->SetReadFriends(kFALSE);
  mgr->SetInputEventHandler(esdH);

  // Create tasks
  gROOT->LoadMacro("AliAnalysisTaskdNdetaMC.cxx++g");

  AliAnalysisTask *task1 = new AliAnalysisTaskdNdetaMC("TaskdNdeta");
  ((AliAnalysisTaskdNdetaMC*)task1)->SetEtaMax(etamax);
  if (skipNorm) ((AliAnalysisTaskdNdetaMC*)task1)->SkipNormalization();
  // Enable MC event handler

  AliMCEventHandler* handler = new AliMCEventHandler;
  handler->SetReadTR(kFALSE);
  mgr->SetMCtruthEventHandler(handler);

  // Add tasks
  mgr->AddTask(task1);

  // Create containers for input/output
  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("coutput", TList::Class(),    AliAnalysisManager::kOutputContainer, outfile);

  // Connect input/output
  mgr->ConnectInput(task1, 0, cinput);
  mgr->ConnectOutput(task1, 1, coutput1);

  // Enable debug printouts
  mgr->SetDebugLevel(0);

  if (!mgr->InitAnalysis()) return;

  mgr->PrintStatus();

  mgr->StartAnalysis("local", chain);
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:78,代码来源:runTask.C

示例5: MakeCutLog

void MakeCutLog(const char *inputRootFile = "AnalysisResults",const char *path = "./", const char* outputDir="./Output/"){

  fstream outputFile(Form("%sCutSelection.log",outputDir),ios::out);
  if(!outputFile.is_open()){
    cout<<"Problem opening file"<<endl;
    return;
  }

  //  Char_t filename_input1[200] = (Form("%s%s",path,input1));	
  TString filename = Form("%s%s.root",path,inputRootFile);	
  TFile f(filename.Data());  

  TList *directories = f.GetListOfKeys(); // get the list of directories in the file
  
  for(Int_t entFile=0;entFile<directories->GetEntries();entFile++){

    TObject * o = f.Get(directories->At(entFile)->GetName()); // get the object in the base directory

    if(TString(o->IsA()->GetName())=="TDirectoryFile"){ // means that this is a directory (PWGGA......)
      
      TDirectory *pwg4dir =(TDirectory*)o;
 
      TString baseDirName = pwg4dir->GetName();
      
      TString reconstructionFlagString = ""; // this is for new scheme where also the flags are coded in numbers in the PWGGA.... name

      if(baseDirName.Length()>31){
	reconstructionFlagString = baseDirName(baseDirName.Index("GammaConversion_")+16,8);
      }
      
      TList *pwg4list = pwg4dir->GetListOfKeys(); // list of the yeys inside the base directory

      for(Int_t entHist=0;entHist<pwg4list->GetEntries();entHist++){
	TString name = pwg4list->At(entHist)->GetName();

	if(name.Contains("container")==0){ // does not try to read the container (get errors if tried)
	  TObject * oHist = pwg4dir->Get(pwg4list->At(entHist)->GetName()); // get the object 
	  
	  if(TString(oHist->IsA()->GetName())=="TList"){ // check if the object is a TList
	    
	    TString listname = oHist->GetName();
	    cout<<"Reading: "<<listname.Data()<<endl;
	    
	    TString cutString = listname(listname.Index("_")+1,listname.Length()) + "\n";// get the Cut string from the name


	    outputFile << cutString.Data();
	  }
	}
      }
    }
  }
  outputFile.close();
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:54,代码来源:MakeCutLog.C

示例6: Pi0Hist4

void Pi0Hist4( TString hist = "MMiss", UInt_t lo = 308, UInt_t tbin = 0,
		Bool_t save = kFALSE)
{
	UInt_t i, j, rebin;
	Int_t th, dth;
	Double_t eg, deg;
	Double_t x1, x2, x3, left, right;
	Double_t x[2], y[2];
	Double_t q_pi, T_pi;
	Double_t TggCutOffset;
	TString name;

	TggCutOffset = 3;

	gStyle->SetOptStat( 0);

	if ( !gROOT->GetListOfCanvases()->IsEmpty()) {
		delete c1;
	}
	TCanvas *c1 = new TCanvas ( "c1", "Subtraction", 300, 20, 1200, 600);
   c1->SetGrid();
   c1->GetFrame()->SetFillColor( 21);
   c1->GetFrame()->SetBorderSize( 12);
	c1->Divide( 5, 2);

	th = theta[tbin].mid;
	dth = 20;

	j = 1;
	for ( i = lo; i > lo-5; i--)
	{
		eg = tcd[i].energy;
		deg = tcd[i].denergy;

		if ( hist == "MMiss")
		{
			x1 = Linear( 145, 933, 400, 880, eg);
			x2 = Linear( 145, 945, 400, 1000, eg);
			x3 = Linear( 145, 918, 400, 880, eg);

			left = x1 - 30;
			right = x2 + 20;

			rebin = 1;
		}
		else if ( hist == "TGG")
		{
			// Proton Opening Angle
			q_pi = qp_thcm( eg, kMP_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x1 = Tgg_Min( T_pi, kMPI0_MEV)/kD2R - TggCutOffset;

			// 12-C Opening Angle
			q_pi = qp_thcm( eg, kM_C12_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x2 = Tgg_Min( T_pi, kMPI0_MEV)/kD2R;

			x3 = -1;

			left = 0;
			right = 180;

			rebin = 4;
		}
		else if ( hist == "KECM")
		{
			// Proton
			q_pi = qp_thcm( eg, kMP_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x1 = T_pi;

			// 12-C
			q_pi = qp_thcm( eg, kM_C12_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x2 = T_pi;

			x3 = -1;

			left = 0;
			right = x2 + 20;

			rebin = 1;
		}

		l = new TLine( left, 0, right, 0);
		l->SetLineStyle( 2);

		Pi0Hist3D( i, tbin, hist);

		c1->cd( j);
		name = Form( "full%d", i);
		TH1D *h1 = (TH1D*) fhist->Clone( name);
		h1->SetMarkerStyle( 21);
		h1->SetMarkerColor( 2);
		h1->SetLineWidth( 3);
		h1->SetLineColor( 2);
		h1->SetTitle();
		h1->GetXaxis()->SetTitleOffset( 1.1);
		h1->GetXaxis()->SetLabelSize( 0.03);
		h1->GetXaxis()->CenterTitle();
//.........这里部分代码省略.........
开发者ID:collicott,项目名称:old-working-acqu,代码行数:101,代码来源:Pi0Hist.C

示例7: compareThree

void compareThree(TTree* t1, TTree* t2,  TTree* t3, TString var, int nBins, double xMin, double xMax, TCut cut1, TCut cut2,TCut cut3, const string cap)  {
    SetHistTitleStyle();
    SetyjPadStyle();
    gStyle->SetOptStat(0);
    TH1::SetDefaultSumw2();
    static int j = 1;
    TCanvas* c =new TCanvas(Form("c_%s_%d",var.Data(),j),"", 400,400);
    //c->Divide(1,2);
    //c->cd(1);
    gPad->SetLogy();
    double ptbin[] = {60,70,80,90,100,110,120,130,140,150,170,200,250};
    int nptbin = sizeof(ptbin)/sizeof(double) -1;
    TH1D* h[3];
    //if(var=="phoEt") h[0] = new TH1D(Form("h1_%s_%d",var.Data(),j), Form(";%s;",var.Data()),nptbin, ptbin);
    //else h[0] = new TH1D(Form("h1_%s_%d",var.Data(),j), Form(";%s;",var.Data()), nBins,xMin,xMax);
    h[0] = new TH1D(Form("h1_%s_%d",var.Data(),j), Form(";%s;",var.Data()), nBins,xMin,xMax);
    h[1] = (TH1D*)h[0]->Clone(Form("h2_%s_%d",var.Data(),j));
    h[2] = (TH1D*)h[0]->Clone(Form("h3_%s_%d",var.Data(),j));

    for(int i=0;i<3;i++){
        h[i]->Sumw2();
        h[i]->SetMarkerStyle(20);
        h[i]->SetMarkerSize(0.8);
        h[i]->SetMarkerColor(i+1);
        h[i]->SetLineColor(i+1);
    } 
    t1->Draw(Form("%s>>%s",var.Data(),h[0]->GetName()), cut1);
    t2->Draw(Form("%s>>%s",var.Data(),h[1]->GetName()), cut2);	
    t3->Draw(Form("%s>>%s",var.Data(),h[2]->GetName()), cut3);

    for(int i=0;i<3;i++){
        h[i]->Scale( 1. / h[i]->Integral());
        h[i]->SetAxisRange(1e-6,1.0,"Y");
        //h[i]->Scale( 1. / h[i]->Integral(),"width");
        if(var=="pho_ecalClusterIsoR4+pho_hcalRechitIsoR4+pho_trackIsoR4PtCut20") h[i]->SetTitle(Form(";%s;","sumIsoR4"));
        else if(var=="pfpIso4+pfnIso4+pfcIso4") h[i]->SetTitle(Form(";%s;","pfSumIsoR4"));
        else if(var=="pfpVsIso4+pfnVsIso4+pfcVsIso4") h[i]->SetTitle(Form(";%s;","pfVsSumIsoR4"));
        else if(var=="pfpVsIso4th1+pfnVsIso4th1+pfcVsIso4th1") h[i]->SetTitle(Form(";%s;","pfVsSumIsoR4th1"));
        else if(var=="pfpVsIso4th2+pfnVsIso4th2+pfcVsIso4th2") h[i]->SetTitle(Form(";%s;","pfVsSumIsoR4th2"));
    }

    h[0]->DrawCopy("hist e");
    h[1]->DrawCopy("hist e same");
    h[2]->DrawCopy("hist e same");
    TLegend* l1 = new TLegend(0.65,0.75,0.95,0.9);
    legStyle(l1);
    l1->AddEntry(h[0],"DATA","p");
    l1->AddEntry(h[1],"AllQCDPhoton","pl");
    l1->AddEntry(h[2],"EmEnrichedDijet","pl");
    l1->Draw();

    drawText(cap.data(),0.2,0.2);
    c-> SaveAs(Form("pdf/isolationComparison_%s_%s_noHotspot_addMomPID_v2.pdf",var.Data(),cap.data()));
    j++;
    /*
     *
     c->cd(2);
     h1->Divide(h2);
     h1->SetYTitle("DATA / MC");
     double ratioRange = getCleverRange(h1);
     if(ratioRange > 5) h1->SetAxisRange(0,5,"Y");
     else h1->SetAxisRange(0,2,"Y");
     h1->DrawCopy("le1");
     jumSun(xMin,1,xMax,1);
     i++;
     */
}
开发者ID:YeonjuGo,项目名称:PhotonAnalysis2016,代码行数:67,代码来源:temp_noHotspot_isolationComparison.C

示例8:

TreeAndHist::TreeAndHist(TTree *t, TString var, int nBins, double xMin, double xMax, TCut cut)
{
    hist = new TH1D(Form("%s_%s",t->GetName(),var.Data()),"",nBins, xMin, xMax);
    t->Draw(Form("%s>>%s",var.Data(),hist->GetName()),cut);
}
开发者ID:YeonjuGo,项目名称:PhotonAnalysis2016,代码行数:5,代码来源:temp_noHotspot_isolationComparison.C

示例9: getenv

void run_test
(TString dataFile = "ar46_run_0113.txt",TString parameterFile = "ATTPC.e15503b.par",
TString mappath="/data/ar46/run_0085/")
{

  // -----   Timer   --------------------------------------------------------
 TStopwatch timer;
 timer.Start();
 // ------------------------------------------------------------------------

  gSystem->Load("libXMLParser.so");
  // -----------------------------------------------------------------
  // Set file names
  TString scriptfile = "Lookup20150611.xml";
  TString dir = getenv("VMCWORKDIR");
  TString scriptdir = dir + "/scripts/"+ scriptfile;
  TString dataDir = dir + "/macro/data/";
  TString geomDir = dir + "/geometry/";
  gSystem -> Setenv("GEOMPATH", geomDir.Data());

  //TString inputFile   = dataDir + name + ".digi.root";
  //TString outputFile  = dataDir + "output.root";
  TString outputFile  = "output.root";
  //TString mcParFile   = dataDir + name + ".params.root";
  TString loggerFile  = dataDir + "ATTPCLog.log";
  TString digiParFile = dir + "/parameters/" + parameterFile;
  TString geoManFile  = dir + "/geometry/ATTPC_v1.2.root";

  TString inimap   = mappath + "inhib.txt";
  TString lowgmap  = mappath + "lowgain.txt";
  TString xtalkmap = mappath + "beampads_e15503b.txt";

  // -----------------------------------------------------------------
  // Logger
  FairLogger *fLogger = FairLogger::GetLogger();
  fLogger -> SetLogFileName(loggerFile);
  fLogger -> SetLogToScreen(kTRUE);
  fLogger -> SetLogToFile(kTRUE);
  fLogger -> SetLogVerbosityLevel("LOW");

  FairRunAna* run = new FairRunAna();
  run -> SetOutputFile(outputFile);
  //run -> SetGeomFile("../geometry/ATTPC_Proto_v1.0.root");
  run -> SetGeomFile(geoManFile);

  FairRuntimeDb* rtdb = run->GetRuntimeDb();
  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
  parIo1 -> open(digiParFile.Data(), "in");
  //FairParRootFileIo* parIo2 = new FairParRootFileIo();
  //parIo2 -> open("param.dummy_proto.root");
 // rtdb -> setFirstInput(parIo2);
  rtdb -> setSecondInput(parIo1);

  // Settings
  Bool_t fUseDecoder = kTRUE;
  if (dataFile.IsNull() == kTRUE)
    fUseDecoder = kFALSE;

  Bool_t fUseSeparatedData = kFALSE;
    if (dataFile.EndsWith(".txt"))
      fUseSeparatedData = kTRUE;

 /*
  *     Unpacking options:
  *         - SetUseSeparatedData:      To be used with 10 CoBo files without merging. Mainly for the ATTPC. Enabled if the input file is a txt.
  *         - SetPseudoTopologyFrame:   Used to force the graw file to have a Topology frame.
  *         - SetPersistance:           Save the unpacked data into the root file.
  *         - SetMap:                   Chose the lookup table.
  *         - SetMapOpt                 Chose the pad plane geometry. In addition forces the unpacker to use Basic Frames for 1 single file (p-ATTPC case) of Layered
  *                                     Frames for Merged Data (10 Cobos merged data).
  */
  ATDecoder2Task *fDecoderTask = new ATDecoder2Task();
  fDecoderTask -> SetUseSeparatedData(fUseSeparatedData);
  if(fUseSeparatedData) fDecoderTask -> SetPseudoTopologyFrame(kTRUE);//! This calls the method 10 times so for less than 10 CoBos ATCore2 must be modified
  //fDecoderTask -> SetPositivePolarity(kTRUE);
  fDecoderTask -> SetPersistence(kFALSE);
  fDecoderTask -> SetMap(scriptdir.Data());
  fDecoderTask -> SetInhibitMaps(inimap,lowgmap,xtalkmap); // TODO: Only implemented for fUseSeparatedData!!!!!!!!!!!!!!!!!!!1
  fDecoderTask -> SetMapOpt(0); // ATTPC : 0  - Prototype: 1 |||| Default value = 0


  /*if (!fUseSeparatedData)
    fDecoderTask -> AddData(dataFile);
  else {
    std::ifstream listFile(dataFile.Data());
    TString dataFileWithPath;
    Int_t iCobo = 0;
    while (dataFileWithPath.ReadLine(listFile)) {
        if (dataFileWithPath.Contains(Form("CoBo%i",iCobo)) )
              fDecoderTask -> AddData(dataFileWithPath, iCobo);
        else{
          iCobo++;
          fDecoderTask -> AddData(dataFileWithPath, iCobo);
        }
    }
  }*/

  fDecoderTask -> AddData("/Users/Yassid/Desktop/ATTPC/Data/46Ar/run_0113/CoBo0_run_0113_13-09-15_20h35m58s.graw",0);
  fDecoderTask -> AddData("/Users/Yassid/Desktop/ATTPC/Data/46Ar/run_0113/CoBo1_run_0113_13-09-15_20h35m58s.graw",1);
  fDecoderTask -> AddData("/Users/Yassid/Desktop/ATTPC/Data/46Ar/run_0113/CoBo2_run_0113_13-09-15_20h35m58s.graw",2);
//.........这里部分代码省略.........
开发者ID:ATTPC,项目名称:ATTPCROOTv2,代码行数:101,代码来源:run_test.C

示例10: Draweff

void Draweff(){
	int sth=0, Gth=0;
	TFile *f = TFile::Open(outG);
	if(sth==0){TString dirname = "std";}
        else if(sth==1){TString dirname ="Gri055";}
        else {TString dirname ="Gri101";}
	gStyle->SetErrorX(0);
	TString name;
        TObjString* dataname = (TObjString*)f->Get(Form("dataname"));
        TObjString* histoname = (TObjString*)f->Get(Form("histoname"));
        if(Gth==0)
                name = "G0";
        else if(Gth<nGlau)
                name = Form("Glau_%d",Gth);
        else
                name = Form("bin_%d",Gth-nGlau+1);
        TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data()));
        TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data()));
        TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data()));
        TVectorD* mubest = (TVectorD*)f->Get(Form("%s/%s/mubest",dirname.Data(),name.Data()));
        TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data()));
        TVectorD* Ndf = (TVectorD*)f->Get(Form("%s/%s/Ndf",dirname.Data(),name.Data()));
        TVectorD* chis = (TVectorD*)f->Get(Form("%s/%s/chis",dirname.Data(),name.Data()));
	TVectorD *kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data()));
	TFile *fdata = TFile::Open(dataname->GetString());
	TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetString());
	histo_obs->Sumw2();
	TFile *fGlauber = TFile::Open(Glaubername->GetString());
        int binnum = histo_obs->GetNbinsX();
        double Minx = histo_obs->GetXaxis()->GetXmin();
        double Maxx = histo_obs->GetXaxis()->GetXmax();
	double binsize = (Double_t)(Maxx-Minx)/binnum;
        int xbinmin=(int)(((*xmin)[0]-Minx)/binsize);
        int xbinmax=(int)(((*xmax)[0]-Minx)/binsize);
	TH1D *histo_exp = new TH1D("histo_exp","Simulated distribution;Multiplicity;Event Fraction",binnum,Minx,Maxx);
	histo_exp->Sumw2();
	Int_t ibin;
		
	TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone();
        histo_obs_norm->Scale(1/histo_obs->Integral(xbinmin,xbinmax));

	TF1 *NBD_fun = new 
	TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
	NBD_fun->SetParameter(0,1);	//[0]: Normalized constant
	NBD_fun->SetParameter(1,(*kbest)[0]);	//[1]: k value
	NBD_fun->SetParameter(2,(*mubest)[0]);	//[2]: mu value
		
	TTree *t = (TTree*) fGlauber->Get("nt_Pb_Pb");
	Long_t Nevent;

	Nevent = (Long_t) t->GetEntries();

	Long_t Ev;	Int_t Bino;	Double_t Para, Bi_Para, Mult;
	Float_t Ncoll;
	t->SetBranchAddress("Ncoll",&Ncoll);

	for(Ev=0; Ev<Nevent; Ev++){
		if(Ev%100000==0)	 cout<<"Have run "<<Ev<<" events"<<endl;
		t->GetEntry(Ev);
		Para = 0; //make sure that Para doesn't accumulate through loops
		for(Bino=0; Bino<Ncoll; Bino++){
                         Bi_Para = NBD_fun->GetRandom();
                         Para += Bi_Para;
		}	
		histo_exp->Fill(Para);
	}
	Double_t SumEvent, scale;
	SumEvent = histo_exp->Integral(xbinmin,xbinmax);
	scale = 1/SumEvent;
	TH1D *histo_exp_norm = (TH1D*) histo_exp->Clone();
	histo_exp_norm->Scale(scale);

	TCanvas *c1 = new TCanvas();
        gStyle->SetOptStat(kFALSE);

	double hfbin[]={0,1,2,3,4,6,8,10,13,16,20,25,30,40,55,70,90};
	int nhfbin = 16;
	rehisto_obs_norm = (TH1D*)histo_obs_norm->Rebin(nhfbin,"rehisto_obs_norm",hfbin);
	normalizeByBinWidth(rehisto_obs_norm);
	rehisto_exp_norm = (TH1D*)histo_exp_norm->Rebin(nhfbin,"rehisto_exp_norm",hfbin);
	normalizeByBinWidth(rehisto_exp_norm);
	TH1D* ratio = (TH1D*)rehisto_obs_norm->Clone("ratio");
	ratio->Divide(rehisto_exp_norm);
        ratio->SetMaximum(1.2);
        ratio->SetMinimum(0);
        ratio->GetXaxis()->SetTitle("HF #Sigma E_{T}");
       	ratio->GetYaxis()->SetTitle("ratio");
/*
开发者ID:XuQiao,项目名称:HI,代码行数:88,代码来源:Draweff.C

示例11: plotLimits

plotLimits(string filename, TString name, TString channel, TString lepton){



TGraph * limit_obs = new TGraph();
  TGraph * limit_exp = new TGraph();
  TGraphAsymmErrors * band_exp1 = new TGraphAsymmErrors();
  TGraphAsymmErrors * band_exp2 = new TGraphAsymmErrors();

TGraph *theory = new TGraph();
theory->SetPoint(0, 1000, 1.3*3.02095);
theory->SetPoint(1, 1500, 1.3*0.58069);
theory->SetPoint(2, 2000, 1.3*0.14501);
theory->SetPoint(3, 2500, 1.3*0.04234);
theory->SetPoint(4, 3000, 1.3*0.01384);
theory->SetPoint(5, 4000, 1.3*0.00184);

ifstream infile(filename.c_str());

gROOT->LoadMacro("CMS_lumi.C");

double mass, exp, obs, up1, up2, dn1, dn2;
int point = 0;

while (!infile.eof()){

	infile >> mass >> obs >> exp >>  dn2 >> up2 >> dn1 >> up1;


        cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl;


	limit_obs->SetPoint(point, mass, obs);
    limit_exp->SetPoint(point, mass, exp);
    band_exp1->SetPoint(point, mass, exp);
    band_exp2->SetPoint(point, mass, exp);

    band_exp1->SetPointEYhigh(point, up1 - exp);
    band_exp1->SetPointEYlow(point, exp - dn1);
    band_exp2->SetPointEYhigh(point, up2 - exp);
    band_exp2->SetPointEYlow(point, exp - dn2);
    point++;

}

double max = 200000.0; //band_exp2->GetHistogram()->GetMaximum()*50;

  TCanvas *canvas = new TCanvas(Form("limit set %s",name.Data()),Form("limit set %s",name.Data()), 500,500);

  limit_exp->SetMinimum(0.01);
  limit_exp->Draw("AL");
  limit_exp->GetXaxis()->SetTitle("M_{Z'} [GeV]");
  limit_exp->GetYaxis()->SetTitle("95 % CL limit on #sigma(Z') [pb]");
  limit_exp->GetYaxis()->SetRangeUser(0.01,2000);

  band_exp2->SetFillColor(5);
  band_exp2->SetLineColor(0);
  //band_exp2->SetFillStyle(4000);
  band_exp2->Draw("3same");

  band_exp1->SetFillColor(3);
  band_exp1->SetLineColor(0);
  //band_exp1->SetFillStyle(4000);
  band_exp1->Draw("3same");

  limit_obs->Draw("Lsame");
  limit_obs->SetLineWidth(2);
  limit_obs->SetMarkerSize(1.0);
  limit_obs->SetMarkerStyle(20);
   
  limit_exp->Draw("Lsame");
  limit_exp->SetLineStyle(2);
  limit_exp->SetLineWidth(2);
  limit_exp->SetMarkerSize(1.0);
  limit_exp->SetMaximum(max);
  limit_exp->SetMinimum(0.001);
  limit_exp->SetMarkerStyle(20);

  double x1 = 595; 
  double y1 = 1.0;
  double x2 = 905;
  double y2 = 1.0;
  TLine * line = new TLine(x1, y1, x2, y2);
  theory->SetLineColor(2);
  theory->SetLineWidth(2);
  theory->Draw("same");

  



  //Legend
  TLegend *l = new TLegend(0.57,0.62,0.88,0.88);
  l->AddEntry(limit_obs,"Observed", "L");
  l->AddEntry(limit_exp,"Expected", "L");
  l->AddEntry(band_exp1,"#pm1 #sigma Exp.", "F");
  l->AddEntry(band_exp2,"#pm2 #sigma Exp.", "F");
  l->AddEntry(theory, " Z', 1% Width", "L");
  l->SetFillColor(0);
  l->SetLineColor(0);
//.........这里部分代码省略.........
开发者ID:UBParker,项目名称:B2GTTbar,代码行数:101,代码来源:plotLimit.C

示例12: temp_noHotspot_isolationComparison

void temp_noHotspot_isolationComparison(TString coll="pbpb"){

    const int nFile =3;
    const char* fname[nFile];
    if(coll=="pp"){ 
        fname[0]="/home/goyeonju/CMS/Files/photon2016/2015-Data-promptRECO-photonSkims_pp-photonHLTFilter-v0-HiForest.root";
        fname[1]="/home/goyeonju/CMS/Files/photon2016/gsfs-Pythia8_Photon_pp_RECO_forest_v28/gsfs-Pythia8_Photon15_30_50_80_120_pp_RECO_forest_v28_with_pthatWeight.root";
        fname[2]="/home/goyeonju/CMS/Files/photon2016/2015-PP-MC_Pythia8_EmEnrDijet30_pp502_TuneCUETP8M1.root";
    } else if(coll=="pbpb"){
        fname[0]="/home/goyeonju/CMS/Files/photon2016/forestSkimed_photonSkim_pbpb_2015data.root";
        fname[1]="/home/goyeonju/CMS/Files/photon2016/Pythia8_Photon_Hydjet_RECO_20160306_forest_v28_2/Pythia8_Photon15_30_50_80_120_Hydjet_RECO_20160306_forest_v28_2_with_pthatWeight.root";
        fname[2]="/home/goyeonju/CMS/Files/photon2016/2015-PbPb-MC_Pythia8_EmEnrichedDijet/2015-PbPb-MC_Pythia8_EmEnrichedDijet30_50_80_120_170_with_pthatWeight.root";
    }
    TFile* f[nFile];
    TTree* t[nFile];
    TTree* t_hi[nFile];
    TTree* t_skim[nFile];
    for(int i=0;i<nFile;i++){
        f[i] = new TFile(fname[i]);
        if(coll=="pp" && (i==0 || i==2)) {
            t[i] = (TTree*) f[i] -> Get("ggHiNtuplizerGED/EventTree");
            if(i==1) t_skim[i] = (TTree*) f[i] -> Get("HltTree");
            else t_skim[i] = (TTree*) f[i] -> Get("skimanalysis/HltTree");
            t_hi[i] = (TTree*) f[i] -> Get("hiEvtAnalyzer/HiTree");
        } else{ 
            t[i] = (TTree*) f[i] -> Get("EventTree");
            t_skim[i] = (TTree*) f[i] -> Get("HltTree");
            t_hi[i] = (TTree*) f[i] -> Get("HiTree");
        }
        t[i]->AddFriend(t_hi[i]);
        t[i]->AddFriend(t_skim[i]);
    }

    for(Int_t i = 0; i < 1; ++i) {
        //for(Int_t i = 0; i < nPtBin; ++i) {}
        //TCut ptCut = Form("(phoEt >= %f) && (phoEt < %f)", ptBins[i], ptBins[i+1]);
        TCut ptCut = Form("(phoEt >= %f) && (phoEt < %f)",50.0,9999.0);
        TCut etaCut = Form("(abs(phoEta) >= %f) && (abs(phoEta) < %f)", etaBins[0], etaBins[1]);
        TCut filterCut = evtSelFilterCut;
        if(coll=="pp") filterCut = evtSelFilterCut_pp;
        TCut dataTotCut = filterCut && spikeRejection && hotspotCut && ptCut && etaCut;
        TCut mcTotCut_bkg = mcBkgIsolation && ptCut && etaCut;
        TCut mcTotCut_sig = mcIsolation && ptCut && etaCut;

        cout << dataTotCut.GetTitle() << endl;
        cout << mcTotCut_bkg.GetTitle() << endl;
        cout << mcTotCut_sig.GetTitle() << endl;

        const int nBins = 50;
        const string cap_ = Form("%s_pt%dto%d_barrel",coll.Data(),50,9999);
        //const char* cap_ = Form("%s_pt%dto%d",coll.Data(),(int)ptBins[i],(int)ptBins[i+1]);
        if(coll=="pp") {
            compareThree(t[0], t[1], t[2], "phoSigmaIEtaIEta_2012",nBins, 0, 0.025, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_ecalClusterIsoR4",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_hcalRechitIsoR4",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_trackIsoR4PtCut20",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_ecalClusterIsoR4+pho_hcalRechitIsoR4+pho_trackIsoR4PtCut20",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(%s)",mcTotCut_bkg.GetTitle()), cap_);

        } else if(coll=="pbpb") {
            compareThree(t[0], t[1], t[2], "phoEt",nBins, 0, 300, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoEta",nBins, -3, 3, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoPhi",nBins, -3.14, 3.14, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
           
            compareThree(t[0], t[1], t[2], "phoSCE",nBins, 0, 1500, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoSCEtaWidth",nBins, 0, 0.1, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoSCPhiWidth",nBins, 0, 0.3, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoSCBrem",nBins, 0, 50, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoR9",nBins, 0, 1, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoHoverE",nBins, 0, 3., dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoHadTowerOverEm",nBins, 0, 3., dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoMaxEnergyXtal",nBins, 0, 1400, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoSigmaIEtaIEta",nBins, 0, 0.03, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoSigmaIEtaIEta_2012",nBins, 0, 0.03, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            
            compareThree(t[0], t[1], t[2], "pho_ecalClusterIsoR4",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_hcalRechitIsoR4",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_trackIsoR4PtCut20",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_ecalClusterIsoR4+pho_hcalRechitIsoR4+pho_trackIsoR4PtCut20",nBins, -10, 120, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);

            compareThree(t[0], t[1], t[2], "phoE1x5",nBins, 0, 1200, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoE2x5",nBins, 0, 1200, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoE5x5",nBins, 0, 1200, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoE3x3",nBins, 0, 1200, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoE3x3_2012",nBins, 0, 1200, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);

            compareThree(t[0], t[1], t[2], "phoSigmaEtaEta",nBins, 0, 0.12, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoR1x5",nBins, 0, 1, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "phoR2x5",nBins, 0, 1, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_swissCrx",nBins, -3, 1, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pho_seedTime",nBins, -4, 4, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);

            compareThree(t[0], t[1], t[2], "pfcIso4",nBins, 0, 400, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pfcVsIso4",nBins, -200, 600, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pfcVsIso4th1",nBins, -100, 600, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pfcVsIso4th2",nBins, -100, 600, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            
            compareThree(t[0], t[1], t[2], "pfnIso4",nBins, 0, 400, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pfnVsIso4",nBins, -100, 300, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pfnVsIso4th1",nBins, -100, 300, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
            compareThree(t[0], t[1], t[2], "pfnVsIso4th2",nBins, -100, 300, dataTotCut, Form("(pthatWeight)*(%s)",mcTotCut_sig.GetTitle()), Form("(pthatWeight)*(%s)",mcTotCut_bkg.GetTitle()), cap_);
//.........这里部分代码省略.........
开发者ID:YeonjuGo,项目名称:PhotonAnalysis2016,代码行数:101,代码来源:temp_noHotspot_isolationComparison.C

示例13: setCell

void CTable::setCell(const TString& entryTS, size_t r, size_t c){
  setCell(std::string(entryTS.Data()),r,c);
}
开发者ID:rafaellopesdesa,项目名称:WWAnalysis,代码行数:3,代码来源:CTable.cpp

示例14: RunALICE

Bool_t RunALICE(TString anSrc = "grid",
                TString anMode = "terminate",
                TString input="aod" /*or "esd"*/,
                TString inputMC="" /*or "mc"*/,
                Long64_t nEvents = 1e10,
                Long64_t nSkip = 0,
                TString dsName="",
                TString alirsnliteManagers ="AddAMRsn",
                Bool_t useMultiHandler=kFALSE,
                TString alirsnlitesrc ="$ALICE_PHYSICS",
                TString alirsnlitetasks =""
               ) {

   // some init work
   anSrc.ToLower(); anMode.ToLower(); input.ToLower(); inputMC.ToLower();

//   TGrid::Connect("alien://");
   // loads libs and setup include paths
   if (LoadLibsBase(alirsnlitesrc)) return kFALSE;

   // reset manager if already exists
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (mgr) delete mgr;
   mgr = new AliAnalysisManager("AliRsnLiteAM","AliRsnLite Analysis Manager");

   Bool_t useAODOut = kFALSE;
   CreateInputHandlers(input,inputMC,useAODOut,useMultiHandler);

   // add default grid handler
   gROOT->LoadMacro("SetupAnalysisPlugin.C");
   AliAnalysisGrid *analysisPlugin = SetupAnalysisPlugin(anMode.Data());
   if (!analysisPlugin) { Printf("Error : analysisPlugin is null !!!"); return kFALSE; }
   mgr->SetGridHandler(analysisPlugin);
   if (!dsName.IsNull()) {
      if (!anSrc.CompareTo("proof") && !anMode.CompareTo("full")) {
         analysisPlugin->SetProofDataSet(dsName.Data());
         Printf(Form("Using DataSet %s ...",dsName.Data()));
      } else {
         analysisPlugin->SetFileForTestMode(dsName.Data());
         Printf(Form("Using Test file %s ...",dsName.Data()));
      }
   }

   TList *listManagers = CreateListOfManagersFromDir(alirsnliteManagers,alirsnlitetasks);
   if (!listManagers) { Printf("Error : CreateListOfManagersFromDir failed !!!"); return kFALSE;}

   // adds all tasks
   if (!AddAllManagers(listManagers, anSrc, anMode,input,inputMC)) { Printf("Error : AddAllManagers failed !!!"); return kFALSE;}

   TStopwatch timer;
   timer.Start();
   // runs analysis
   if (!RunAnalysisManager(anSrc, anMode.Data(), nEvents, nSkip)) { Printf("Error : RunAnalysisManager failed !!!"); return kFALSE;}

   timer.Stop();
   timer.Print();
   Printf("Working directory is %s ...", gSystem->WorkingDirectory());
   TString outputDir =  gSystem->WorkingDirectory();
   outputDir.ReplaceAll("alirsnlite","alirsnlite-out");
   gSystem->Exec(TString::Format("mkdir -p %s",outputDir.Data()).Data());
   gSystem->Exec(TString::Format("mv *.root %s/ > /dev/null 2>&1",outputDir.Data()).Data());
//   gSystem->cd(outputDir.Data());
   Printf("Done OK");
   return kTRUE;

}
开发者ID:ktf,项目名称:AliPhysics,代码行数:66,代码来源:RunALICE.C

示例15: wxT

bool wxPtrButtonEditor::OnEvent( wxPropertyGrid* propGrid,
                                wxPGProperty* property,
                                wxWindow* ctrl,
                                wxEvent& event ) const
{
    if ( event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
    {
        wxPGMultiButton* buttons = (wxPGMultiButton*) propGrid->GetEditorControlSecondary();
        CWxwidgetsPropertyBase* pPropertyDescription = static_cast<CWxwidgetsPropertyBase*>(property->GetClientData());
        CEnginePropertyGirdManager* pManager = static_cast<CEnginePropertyGirdManager*>(static_cast<CEnginePropertyGrid*>(propGrid)->GetManager());
        const wxWindow* pButton = NULL;
        for (size_t i = 0; i < buttons->GetCount(); ++i)
        {
            if (event.GetId() == buttons->GetButtonId(i))
            {
                pButton = buttons->GetButton(i);
                break;
            }
        }
        if (pButton != NULL)
        {
            if (pPropertyDescription->GetType() == eRPT_Ptr)
            {
                CPtrPropertyDescription* pPtrPropertyDescription = static_cast<CPtrPropertyDescription*>(pPropertyDescription);
                wxString valueStr = property->GetValueAsString();
                bool bValueChanged = false;
                if (pButton->GetLabel().CmpNoCase(_T("+")) == 0)
                {
                    size_t ptrGuid = pPtrPropertyDescription->GetPtrGuid();
                    std::vector<size_t> derivedClassGuid;
                    CComponentProxyManager::GetInstance()->QueryDerivedClass(ptrGuid, derivedClassGuid, true);
                    CComponentBase* pBase = CComponentProxyManager::GetInstance()->GetComponentTemplate(ptrGuid);
                    bValueChanged = derivedClassGuid.size() == 0;
                    if (!bValueChanged)
                    {
                        wxPGChoices choice;
                        if (pBase != NULL)
                        {
                            choice.Add(pBase->GetClassStr(), pBase->GetGuid());
                        }
                        for (auto i : derivedClassGuid)
                        {
                            pBase = CComponentManager::GetInstance()->GetComponentTemplate(i);
                            choice.Add(pBase->GetClassStr(), pBase->GetGuid());
                        }
                        wxString strSelectItem = ::wxGetSingleChoice(wxT("TypeChoice"), wxT("Caption"), choice.GetLabels(),
                            NULL, wxDefaultCoord, wxDefaultCoord, false, wxCHOICE_WIDTH, wxCHOICE_HEIGHT);
                        if ( !strSelectItem.empty() )
                        {
                            int nSelectIndex = choice.Index(strSelectItem);
                            size_t uDerivedGuid = choice.GetValue(nSelectIndex);
                            pPtrPropertyDescription->SetDerivedGuid(uDerivedGuid);
                            bValueChanged = true;
                        }
                    }
                    if (bValueChanged)
                    {
                        bool bCreateInstance = pPtrPropertyDescription->CreateInstance();
                        bCreateInstance;
                        BEATS_ASSERT(bCreateInstance);
                        CComponentEditorProxy* pCompBase = static_cast<CComponentEditorProxy*>(pPtrPropertyDescription->GetInstanceComponent());
                        BEATS_ASSERT(pCompBase != NULL);
                        BEATS_ASSERT(pManager != NULL);
                        TString* pStrValue = (TString*)pPtrPropertyDescription->GetValue(eVT_CurrentValue);
                        property->SetValueFromString(pStrValue->c_str());
                        pManager->RefreshProperty(property);
                        pManager->InsertComponentsInPropertyGrid(pCompBase, property);
                        buttons->GetButton(0)->SetLabel(_T("-"));
                        valueStr.insert(0, _T("+"));
                    }
                }
                else if (pButton->GetLabel().CmpNoCase(_T("-")) == 0)
                {
                    property->DeleteChildren();
                    bool bDeleteInstance = pPtrPropertyDescription->DestroyInstance();
                    bDeleteInstance;
                    BEATS_ASSERT(bDeleteInstance);
                    // Destroy instance may cause the value changed, so we fetch it again.
                    char szTmp[MAX_PATH];
                    pPtrPropertyDescription->GetValueAsChar(eVT_CurrentValue, szTmp);
                    valueStr = szTmp;
                    pPtrPropertyDescription->GetChildren().clear();
                    buttons->GetButton(0)->SetLabel(_T("+"));
                    valueStr.Remove(0, 1); // Remove the "+" prefix
                    bValueChanged = true;
                }
                if (bValueChanged)
                {
                    wxVariant newValue(valueStr);
                    pPtrPropertyDescription->SetValue(newValue, false);
                    property->SetValue(newValue);
                    propGrid->Refresh();
                }
            }
            if (pPropertyDescription->IsContainerProperty())
            {
                if (pButton->GetLabel().CmpNoCase(_T("+")) == 0)
                {
                    CPropertyDescriptionBase* pNewChild = pPropertyDescription->AddChild(NULL);
                    if (pNewChild != NULL)
//.........这里部分代码省略.........
开发者ID:nobitalwm,项目名称:FCEngine,代码行数:101,代码来源:wxPtrButtonEditor.cpp


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