void
dissect_payload_0006(doip_header *header, proto_item *pitem, packet_info *pinfo)
{
    tvbuff_t *tvb;
    proto_tree *doip_tree;
    guint32 payloadLength;
    guint8 response_code;

    tvb = retrieve_tvbuff(header);
    /* attach a new tree to proto_item pitem */
    doip_tree = proto_item_add_subtree(pitem, ett_routing_activation_response);

    /* set info column to description */
    if(get_guint8_from_message(header, &response_code, 4))
    {
        col_add_fstr(pinfo->cinfo, COL_INFO, description_format, response_code);
    }
    else
    {
        col_set_str(pinfo->cinfo, COL_INFO, description);
    }

    payloadLength = header->payload.length;

    /* check for a valid tvbuff_t */
    if(doip_tree && tvb)
    {
        fill_tree(doip_tree, tvb, payloadLength);
    }
}
Exemple #2
0
int		fill_tree(t_shell *shell, char *command_line)
{
  t_tree	*up;
  char		**commands;
  int		i;

  if ((commands = my_str_to_wordtab(command_line, " \t")) == NULL)
    return (nothing_more(shell));
  i = -1;
  while (commands != NULL && commands[++i] != NULL)
    {
      if ((is_token(shell->tokens, commands[i]) >= 0) &&
	  ((shell->tree->right = malloc(sizeof(t_tree))) != NULL))
	{
	  shell->tree->token = is_token(shell->tokens, commands[i]);
	  if ((shell->tree->left = get_left(commands, i)) == NULL)
	    return (-1);
	  up = shell->tree;
	  shell->tree = shell->tree->right;
	  shell->tree->up = up;
	  return (fill_tree(shell, new_command(commands, i)));
	}
    }
  return (last_command(shell, commands, i));
}
Exemple #3
0
void		op_pipe3(t_ast *tree, t_token *token, int pfd[2], int *pid)
{
	if (token)
		fill_tree(token, &tree->right);
	if (tree->right && tree->right->tk->prio > 0)
		resolve_tree(tree->right, pfd);
	else
		op_pipe2(tree, pfd, pid);
}
//---------------------------------------------------------------------------
bool __fastcall TForm1::get_dbs(void)
{
 MYSQL_RES *res;

 if (!is_server_started)
  return false;

 if (!(res=mysql_list_dbs(MySQL,"%")))
  return false;

 deque<string> rows = fill_rows(res);

 mysql_free_result(res);
 fill_tree(rows,MySQLDbs,db_root,DBView,1);
 info_server->Text = mysql_get_server_info(MySQL);

 return true;
}
void fill_tree(Tree *instance, int childcount, int depth, int value) {
    instance->node.data = value;

    if ( depth == 0 )  {
        return;
    }

    if ( instance->children == NULL ) {
        instance->children = (struct TreeSeq *)malloc(sizeof(struct TreeSeq));
        TreeSeq_initialize(instance->children);
    }

    TreeSeq_ensure_length(instance->children, childcount, childcount);
    for (int i=0; i< childcount; ++i) {
        Tree *child = TreeSeq_get_reference(instance->children, i);
        fill_tree(child, childcount, depth-1, value);
    }
}
Exemple #6
0
void tdf004_cutFlowReport()
{

   // We prepare an input tree to run on
   auto fileName = "tdf004_cutFlowReport.root";
   auto treeName = "myTree";
   fill_tree(fileName, treeName);

   // We read the tree from the file and create a TDataFrame
   ROOT::Experimental::TDataFrame d(treeName, fileName, {"b1", "b2"});

   // ## Define cuts and create the report
   // Here we define two simple cuts
   auto cut1 = [](double b1) { return b1 > 25.; };
   auto cut2 = [](int b2) { return 0 == b2 % 2; };

   // An optional string parameter name can be passed to the Filter method to create a named filter.
   // Named filters work as usual, but also keep track of how many entries they accept and reject.
   auto filtered1 = d.Filter(cut1, {"b1"}, "Cut1");
   auto filtered2 = d.Filter(cut2, {"b2"}, "Cut2");

   auto augmented1 = filtered2.Define("b3", [](double b1, int b2) { return b1 / b2; });
   auto cut3 = [](double x) { return x < .5; };
   auto filtered3 = augmented1.Filter(cut3, {"b3"}, "Cut3");

   // Statistics are retrieved through a call to the Report method:
   // when Report is called on the main TDataFrame object, it prints stats for all named filters declared up to that
   // point
   // when called on a stored chain state (i.e. a chain/graph node), it prints stats for all named filters in the
   // section
   // of the chain between the main TDataFrame and that node (included).
   // Stats are printed in the same order as named filters have been added to the graph, and refer to the latest
   // event-loop that has been run using the relevant TDataFrame.
   std::cout << "Cut3 stats:" << std::endl;
   filtered3.Report();
   std::cout << "All stats:" << std::endl;
   d.Report();
}
//---------------------------------------------------------------------------
bool __fastcall TForm1::get_tables(String db_name)
{
  MYSQL_RES *res;
  AnsiString s_cmd;

  TableView->Items->Clear();
  s_cmd = "use ";
  s_cmd+= db_name.c_str();

  if (mysql_query(MySQL, s_cmd.c_str()) ||
      !(res=mysql_list_tables(MySQL,"%")))
   return false;

  tables_node = TableView->Items->Add(NULL, db_name.c_str());
  tables_node->ImageIndex = 1;
  tables_node->SelectedIndex = 1;

  deque<string> rows = fill_rows(res);

  mysql_free_result(res);
  fill_tree(rows,tables_tree,tables_node,TableView,2);

  return true;
}
Exemple #8
0
int main(int argc,char **argv)
{
  unsigned int outstrlen=0;
  int i,j,k,n;
  unsigned int offset,wdim=1,alldim;
  unsigned int has_future,*future,**useries,h;
  unsigned long count;
  long *segment;
  char *outstring,*infile,*wcol,*use_array;
  double **series,*sermin,*serinter,**dfuture;
  ptree *root;
  FILE *fout;

  if (scan_help(argc,argv))
    show_options(argv[0]);

  for (i=0;i<argc;i++) {
    outstrlen += strlen(argv[i]);
    outstrlen++;
  }
  check_alloc(outstring=(char*)malloc(sizeof(char)*(outstrlen+8)));
  sprintf(outstring,"#Prog: ");
  offset=7;
  for (i=0;i<argc;i++) {
    sprintf(outstring+offset,"%s ",argv[i]);
    offset += (strlen(argv[i])+1);
  }

  scan_options(argc,argv);
 
  if (!compdimset) 
    compdim=pars.DIM;
  else
    if (compdim > pars.DIM) {
      fprintf(stderr,"-C value larger -m Value.\n");
      exit(LANGEVIN_MAIN_C_TOO_LARGE);
    }

  infile=search_datafile(argc,argv,NULL,VERBOSITY);
  if (infile == NULL) {
    fprintf(stderr,"No input datafile found.\n");
    exit(LANGEVIN_MAIN_NO_INPUTFILE);
  }
  
  if (OUTFILE == NULL) {
    check_alloc(OUTFILE=(char*)calloc(strlen(infile)+5,(size_t)1));
    sprintf(OUTFILE,"%s.pru",infile);
  }
  OUTFILE=test_outfile(OUTFILE);

  if (COLUMN == NULL)
    series=(double**)get_multi_series(infile,&(pars.LENGTH),EXCLUDE,
				      &(pars.DIM),"",dimset,VERBOSITY);
  else
    series=(double**)get_multi_series(infile,&(pars.LENGTH),EXCLUDE,
				      &(pars.DIM),COLUMN,dimset,VERBOSITY);

  check_alloc(sermin=malloc(sizeof(double)*pars.DIM));
  check_alloc(serinter=malloc(sizeof(double)*pars.DIM));
  rescale_data(series,pars,sermin,serinter);

  alldim=pars.DIM;
  pars.DIM=compdim;

  check_alloc(useries=(unsigned int**)malloc(sizeof(int*)*pars.DIM));
  check_alloc(PART=(unsigned int*)malloc(sizeof(int)*pars.DIM));
  if (SPART == NULL)
    for (i=0;i<pars.DIM;i++)
      PART[i]=2;
  else
    set_part(PART,SPART,pars);

  for (i=0;i<pars.DIM;i++) {
    check_alloc(useries[i]=(unsigned int*)malloc(sizeof(int)*pars.LENGTH));
    for (j=0;j<pars.LENGTH;j++) {
      h=(unsigned int)((series[i][j]*(double)PART[i])/serinter[i]);
      useries[i][j]=((h<PART[i])?h:(PART[i]-1));
    }
  }

  check_alloc(future=(unsigned int*)malloc(sizeof(int)*pars.LENGTH));
  if (WHICHFUTURE>0) {
    check_alloc(wcol=(char*)calloc((size_t)10,(size_t)1));
    sprintf(wcol,"%u",WHICHFUTURE);
    dfuture=(double**)get_multi_series(infile,&(pars.LENGTH),EXCLUDE,
				       &wdim,wcol,1,0L);
    for (i=0;i<pars.LENGTH-1;i++) {
      future[i] = (dfuture[0][i]>0.0);
    }
    future[pars.LENGTH-1]=1;
    free(dfuture);
  }
  else {
    for (i=0;i<pars.LENGTH;i++)
      future[i]=1;
  }
  root=make_ptree(PART[0]);

  count=0;
  check_alloc(segment=(long*)malloc(sizeof(long)*pars.LENGTH));
  for (i=0;i<pars.LENGTH;i += ODEPTH) {
    has_future=1;
    for (j=0;j<ODEPTH;j++)
      has_future &= future[i+j];
    if (has_future) {
      fill_tree(root,useries,pars,i,0,DEPTH,PART);
    }
    segment[count++]=i;
  }

  if (scrambleset)
    lscramble(segment,count);

  check_alloc(use_array=(char*)malloc(sizeof(char)*pars.LENGTH));
  for (i=0;i<count;i++) {
    n=segment[i];
    has_future=1;
    for (j=0;j<ODEPTH;j++)
      has_future &= future[n+j];
    if (has_future) {
      h=read_tree(root,useries,pars,n,0,DEPTH);
      if (h <= MAXOUT)
	use_array[i]=1;
      else 
	use_array[i]=0;
    }
    else 
      use_array[i]=2;
  }
  pars.DIM=alldim;

  fout=fopen(OUTFILE,"w");
  fprintf(fout,"%s\n",outstring);
  fprintf(fout,"#Content: ");
  for (i=0;i<pars.DIM;i++)
    fprintf(fout,"x%d ",i+1);
  fprintf(fout,"future time_index\n");
  fflush(fout);

  for (i=0;i<count;i++) {
    n=segment[i];
    if (use_array[i] == 1) {
      for (j=0;j<(ODEPTH-1);j++) {
	for (k=0;k<pars.DIM;k++)
	  fprintf(fout,"%f ",series[k][n+j]+sermin[k]);
	fprintf(fout,"1 %u\n",n+j);
      }
      for (k=0;k<pars.DIM;k++)
	fprintf(fout,"%f ",series[k][n+ODEPTH-1]+sermin[k]);
      if (i<(count-1)) {
	if (segment[i+1] == (n+ODEPTH) && use_array[i+1])
	  fprintf(fout,"1 %u\n",n+ODEPTH-1);
	else 
	  fprintf(fout,"0 %u\n",n+ODEPTH-1);
      }
      else 
	fprintf(fout,"0 %u\n",n+ODEPTH-1);
    }
  }

  fclose(fout);
}
static int publisher_main(int domainId, int sample_count)
{
    DDS_DomainParticipant *participant = NULL;
    DDS_Publisher *publisher = NULL;
    DDS_Topic *topic = NULL;
    DDS_DataWriter *writer = NULL;
    TreeDataWriter *Tree_writer = NULL;
    Tree *instance = NULL;
    DDS_ReturnCode_t retcode;
    DDS_InstanceHandle_t instance_handle = DDS_HANDLE_NIL;
    const char *type_name = NULL;
    int count = 0;  
    struct DDS_Duration_t send_period = {4,0};

    /* To customize participant QoS, use 
    the configuration file USER_QOS_PROFILES.xml */
    participant = DDS_DomainParticipantFactory_create_participant(
        DDS_TheParticipantFactory, domainId, &DDS_PARTICIPANT_QOS_DEFAULT,
        NULL /* listener */, DDS_STATUS_MASK_NONE);
    if (participant == NULL) {
        printf("create_participant error\n");
        publisher_shutdown(participant);
        return -1;
    }

    /* To customize publisher QoS, use 
    the configuration file USER_QOS_PROFILES.xml */
    publisher = DDS_DomainParticipant_create_publisher(
        participant, &DDS_PUBLISHER_QOS_DEFAULT, NULL /* listener */,
        DDS_STATUS_MASK_NONE);
    if (publisher == NULL) {
        printf("create_publisher error\n");
        publisher_shutdown(participant);
        return -1;
    }

    /* Register type before creating topic */
    type_name = TreeTypeSupport_get_type_name();
    retcode = TreeTypeSupport_register_type(
        participant, type_name);
    if (retcode != DDS_RETCODE_OK) {
        printf("register_type error %d\n", retcode);
        publisher_shutdown(participant);
        return -1;
    }

    /* To customize topic QoS, use 
    the configuration file USER_QOS_PROFILES.xml */
    topic = DDS_DomainParticipant_create_topic(
        participant, "Example Tree",
        type_name, &DDS_TOPIC_QOS_DEFAULT, NULL /* listener */,
        DDS_STATUS_MASK_NONE);
    if (topic == NULL) {
        printf("create_topic error\n");
        publisher_shutdown(participant);
        return -1;
    }

    /* To customize data writer QoS, use 
    the configuration file USER_QOS_PROFILES.xml */
    writer = DDS_Publisher_create_datawriter(
        publisher, topic,
        &DDS_DATAWRITER_QOS_DEFAULT, NULL /* listener */, DDS_STATUS_MASK_NONE);
    if (writer == NULL) {
        printf("create_datawriter error\n");
        publisher_shutdown(participant);
        return -1;
    }
    Tree_writer = TreeDataWriter_narrow(writer);
    if (Tree_writer == NULL) {
        printf("DataWriter narrow error\n");
        publisher_shutdown(participant);
        return -1;
    }

    /* Create data sample for writing */
    instance = TreeTypeSupport_create_data_ex(DDS_BOOLEAN_TRUE);
    if (instance == NULL) {
        printf("TreeTypeSupport_create_data error\n");
        publisher_shutdown(participant);
        return -1;
    }

    /* For a data type that has a key, if the same instance is going to be
    written multiple times, initialize the key here
    and register the keyed instance prior to writing */
    /*
    instance_handle = TreeDataWriter_register_instance(
        Tree_writer, instance);
    */

    /* Main loop */
    for (count=0; (sample_count == 0) || (count < sample_count); ++count) {

        printf("Writing Tree, count %d\n", count);

        /* Modify the data to be written here */
        fill_tree(instance, 1, count, count);

        /* Write data */
        retcode = TreeDataWriter_write(
            Tree_writer, instance, &instance_handle);
        if (retcode != DDS_RETCODE_OK) {
            printf("write error %d\n", retcode);
        }

        NDDS_Utility_sleep(&send_period);
    }

    /*
    retcode = TreeDataWriter_unregister_instance(
        Tree_writer, instance, &instance_handle);
    if (retcode != DDS_RETCODE_OK) {
        printf("unregister instance error %d\n", retcode);
    }
    */

    /* Delete data sample */
    retcode = TreeTypeSupport_delete_data_ex(instance, DDS_BOOLEAN_TRUE);
    if (retcode != DDS_RETCODE_OK) {
        printf("TreeTypeSupport_delete_data error %d\n", retcode);
    }

    /* Cleanup and delete delete all entities */         
    return publisher_shutdown(participant);
}
Exemple #10
0
int dirp (int argc, char *argv[])
{
	fill_tree(argv[1]);
	return 0;
}
Exemple #11
0
void loop(){

//	TFile *F=new TFile("TTree_SingleMu_Onia2MuMu_v20_PromptReco_AB.root","READ"); 
//	TTree *tree = (TTree*)F->FindObjectAny("data"); 
	chain();
	Long64_t entries = tree->GetEntries(); 
	set_branches(tree);
	
	float pt_bins[]={10,20,30,40,50,60,70,100};
	
	
	TEfficiency *rho = new TEfficiency("TEff_rho_pt","#rho; p_{T}(#mu#mu) [GeV]; #rho",25,10,100);

	
	TEfficiency *seagull = new TEfficiency("TEff_sg_pt","#epsilon_{sg} ; p_{T}(#mu#mu) [GeV]; #epsilon_{sg}",25,10,100); 
	TEfficiency *VP_eff = new TEfficiency("TEff_VP","#epsilon_{vp} ; p_{T}(#mu#mu) [GeV]; #epsilon_{vp}",25,10,100); 
	
	TEfficiency *MuQualP = new TEfficiency("MuQualP","#epsilon_{#mu+} ; p_{T}(#mu) [GeV]; #epsilon_{#mu+}",100,0,100); 
	TEfficiency *MuQualN = new TEfficiency("MuQualN","#epsilon_{#mu- ; p_{T}(#mu) [GeV]; #epsilon_{#mu-}",100,0,100); 

	
	TH1D *hpt_lead = new TH1D("hpt_lead","p_{T} of leading Muon;p_{T} [GeV]",100,0,100); 
	TH1D *hpt_trail = new TH1D("hpt_trail","p_{T} of trailing Muon;p_{T} [GeV]",100,0,100); 

	TH1D *hpt_den = new TH1D("pt_den","p_{T}",50,10,100); 
	TH1D *hpt_num_uW = new TH1D("hpt_num_uW",";p_{T}",50,10,100);
	TH1D *hpt_num = new TH1D("pt_num",";p_{T}",50,10,100); 
	
	TH1D *hdR_num = new TH1D("dR_num",";p_{T}",50,0,3); 
	TH1D *hdR_den = new TH1D("dR_den",";p_{T}",50,0,3); 

	
	
	TH1D *mass = new TH1D("mass","M_{#mu#mu}",100, 8.5,11.5); 
	TH2D *mass_pt = new TH2D("mass_pt",";M_{#mu#mu};p_{T}(#mu#mu)", 100,8.5,11.5,9,10,100);
	TH2D *mass_pt_num = new TH2D("mass_pt_num",";M_{#mu#mu};p_{T}(#mu#mu)", 100,8.5,11.5,9,10,100);
	
	TH1F *h_vp=new TH1F("h_vp","Vertex Probability", 1000,0,100); 

	cout << "Entries: " << entries << endl;
	entries=1000000;
	for(Long64_t i=0; i<entries;i++){
		if(i%100000==0) {
			cout << "Event: " << i << endl;
			cout << "Run Nb: " << runNb << endl; 
		}
		tree->GetEntry(i); 

		if(D0_v1==1 || D0_v2==1 || D0_v3==1 || D0_v5==1 || D0_v6==1 || D0_v9==1 || DMu3_v1==1 || DUM0_v1==1 || DUM0_v2==1 || DUM0_v3==1 || DUM0_v4==1 || DUM0_v6==1) continue;
		//if(runNb<165088 || runNb>179889) continue;
		if(Mu1_P->X()>900 || Mu2_P->X()>900) continue;

		
		fill_tree();
		if(!select_upsilons()) continue; 
		
		MuQualP->Fill((muPos_qual==-9),Mu1_P->Perp()); 
		MuQualN->Fill((muNeg_qual==-9),Mu2_P->Perp()); 
		
		if(muPos_qual==-9 || muNeg_qual==-9) continue;
		
		bool Trig=false; 
		if(D5_v1==1 || D5_v2==1 || D5_v3==1 || D5_v5==1 || D7_v1==1 || D7_v4==1 || D9_v1==1 || D9_v4==1) Trig=true; 
		bool SG=false; 
		if(Mu1_P->DeltaPhi(*Mu2_P)<0) SG=true; 
		
		if(Trig)seagull->Fill(SG,Ups_P->Perp());
		
		if(!SG) continue;
		bool good_vertex=false; 
		if(vProb>0.005) good_vertex=true; 
		VP_eff->Fill(good_vertex,Ups_P->Perp());
		h_vp->Fill(vProb*100);
		
		if(vProb<0.005) continue;
		
		mass->Fill(Ups_P->M()); 
		mass_pt->Fill(Ups_P->M(),Ups_P->Perp()); 
		if(Ups_P->M()>9.26 && Ups_P->M()<9.66){ 	
			hpt_den->Fill(Ups_P->Perp());
			hdR_den->Fill(Mu1_P->DeltaR(*Mu2_P));
		}

		double ptmin=TMath::Min(Mu1_P->Perp(),Mu2_P->Perp());
		double ptmax=TMath::Max(Mu1_P->Perp(),Mu2_P->Perp()); 
		
		hpt_lead->Fill(ptmax);
		hpt_trail->Fill(ptmin); 

		
		double dimuon_eff=muonEff(Mu1_P->Perp(),Mu1_P->Eta(),"nom")*muonEff(Mu2_P->Perp(),Mu2_P->Eta(),"nom");
		bool Mu_qual = false;
		if(muPos_qual && muNeg_qual) Mu_qual=true; 
		
		if(Trig && Mu_qual && Ups_P->M()>9.26 && Ups_P->M()<9.66) {
			hpt_num_uW->Fill(Ups_P->Perp()); 
			hdR_num->Fill(Mu1_P->DeltaR(*Mu2_P),1.0/dimuon_eff); 
			hpt_num->Fill(Ups_P->Perp(),1.0/dimuon_eff);
		}
		
		
		if(Trig) mass_pt_num->Fill(Ups_P->M(),Ups_P->Perp(),1./dimuon_eff);
		
		rho->Fill((Trig && Mu_qual),Ups_P->Perp());
		
		
	//	rho->SetWeight(0.97/dimuon_eff);
		
		//if(HLT_Dimuon7_Upsilon_Barrel_v1) hpt_num->Fill(Ups_P->Perp(),1./dimuon_eff); 
		
	}
	
	cout << "Vertex Prob: " << Form("%.2f",h_vp->Integral(h_vp->FindBin(1),h_vp->GetNbinsX())/h_vp->Integral())<< endl;
	cout << "Rho stat uncert: " << rho->GetEfficiencyErrorLow(25) << endl;
	
	
	TCanvas *tmp = new TCanvas();
	hpt_num->SetStats(kFALSE); 
	fOut->cd();
	hpt_den->Write();
	hpt_num->Write();
	hpt_lead->Write();
	hpt_trail->Write();
	hpt_num_uW->Write();
	hdR_num->Write();
	hdR_den->Write();
	seagull->Write();
	VP_eff->Write();
	
	hpt_num->Divide(hpt_den);
	hdR_num->Divide(hdR_den);
	hpt_num->SetLineColor(kRed);
	
	TCanvas *Efficiency_plots = new TCanvas("Efficiency_plots");
	Efficiency_plots->Divide(2,2);
	Efficiency_plots->cd(1);
	seagull->Draw();
	Efficiency_plots->cd(2);
	VP_eff->Draw();
	Efficiency_plots->cd(3);
	//rho->Draw();
	hpt_num->Draw();
	
	Efficiency_plots->cd(4);
	hdR_num->Draw();
	
	
	
	//MuQualP->Draw();
	//MuQualN->Draw("same");
	
	
	
	Efficiency_plots->Write();
	rho->Write();
	mass->Write();
	
	MuQualN->Write();
	MuQualP->Write();
	mass_pt->Write();
	h_vp->Write();
	mass_pt_num->Write();
	hpt_num->SetName("rho_pt"); 
	hpt_num->Divide(hpt_den); 
	hpt_num->Draw(); 
	tmp->Print("rho_factor.png");
	
	TCanvas *M = new TCanvas();
	mass->Draw();
	M->Print("dimuon_mass.png");
	
}
Exemple #12
0
void loop(){

	TFile *F=new TFile("TTree_SingleMu_Onia2MuMu_v20_PromptReco_AB.root","READ"); 
	TTree *tree = (TTree*)F->FindObjectAny("data"); 
	int entries = tree->GetEntries(); 
	set_branches(tree);
	
	double pt_bins[]={10,20,30,40,50,60,70,100};
	double dR_bins[]={0,0.25,0.3,0.35,0.4,0.8,1,1.5};
	int ndR=sizeof(dR_bins)/sizeof(double)-1; 
	int npT=sizeof(pt_bins)/sizeof(double)-1;
	//TEfficiency *rho = new TEfficiency("TEff_rho_pt","#rho p_{T}; p_{T}(#mu#mu) [GeV]; #rho",7,pt_bins); 
	
	CreateHistogram("hpt_lead","p_{T}(#mu) of higher p_{T} muon","p_{T}(#mu) [GeV]","#rho",100,0,100); 
	CreateHistogram("hpt_trail","p_{T}(#mu) of lower p_{T} muon","p_{T}(#mu) [GeV]","#rho",100,0,100); 

	CreateHistogram("h_mass_pt0","M_{#mu#mu}, p_{T}<35","M_{#mu#mu}","Events",100,8.5,11.5); 
	CreateHistogram("h_mass_pt1","M_{#mu#mu}, p_{T}>35","M_{#mu#mu}","Events",100,8.5,11.5); 

	CreateHistogram("h_massTrig_pt0","M_{#mu#mu}, p_{T}<35","M_{#mu#mu}","Events",100,8.5,11.5); 
	CreateHistogram("h_massTrig_pt1","M_{#mu#mu}, p_{T}>35","M_{#mu#mu}","Events",100,8.5,11.5); 
	
	CreateHistogram("DeltaRPtE_num","#DeltaR_p_{T}^{ellpictic}","#DeltaR_p_{T}^{ellpictic}","",100,0,3); 
	CreateHistogram("DeltaRPtE_num_uW","#DeltaR_p_{T}^{ellpictic}","#DeltaR_p_{T}^{ellpictic}","",100,0,3); 
	CreateHistogram("DeltaRPtE_den","#DeltaR_p_{T}^{ellpictic}","#DeltaR_p_{T}^{ellpictic}","",100,0,3); 

	
	CreateHistogram("hpt_den","#rho denominator","p_{T} [GeV]","",9,10,100); 
	CreateHistogram("hpt_num_uW","#rho numerator","p_{T} [GeV]","",9,10,100); 
	CreateHistogram("hpt_num","#rho numerator","p_{T} [GeV]","",9,10,100); 

	CreateHistogram("mass","mass","M_{#mu#mu}","",100,8.5,11.5); 
	
	CreateHistogram("mass_DeltaRPtE_num","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,100,0,3);
	CreateHistogram("mass_DeltaRPtE_den","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,100,0,3);

	
	CreateHistogram("mass_y0_DeltaRPtE_numBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y0_DeltaRPtE_numBin_uW","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y0_DeltaRPtE_denBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);

	CreateHistogram("mass_y1_DeltaRPtE_numBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y1_DeltaRPtE_numBin_uW","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y1_DeltaRPtE_denBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);


	CreateHistogram("mass_pt","M_{#mu#mu}","p_{T} [GeV]","",100,8.5,11.5,npT,pt_bins);
	CreateHistogram("mass_pt_num","M_{#mu#mu}","p_{T} [GeV]","",100,8.5,11.5,npT,pt_bins);
	CreateHistogram("mass_pt_num_uW","M_{#mu#mu}","p_{T} [GeV]","",100,8.5,11.5,npT,pt_bins);

	CreateHistogram("DeltaRPtE_pt","#DeltaR_p_{T}^{ellpictic} vs p_{T}","p_{T} [GeV]", "#DeltaR_p_{T}^{ellpictic}",9,10,100,20,0,3); 
	CreateHistogram("DeltaRPtE_pt_Trig","#DeltaR_p_{T}^{ellpictic} vs p_{T}","p_{T} [GeV]", "#DeltaR_p_{T}^{ellpictic}",9,10,100,20,0,3); 


	cout << "Entries: " << entries << endl;
	//entries=1000;
	for(int i=0; i<entries;i++){
		if(i%100000==0) {
			cout << "Event: " << i << endl;
			cout << "Run Nb: " << runNb << endl; 
		}
		tree->GetEntry(i); 

		if(D0_v1==1 || D0_v2==1 || D0_v3==1 || D0_v5==1 || D0_v6==1 || D0_v9==1 || DMu3_v1==1 || DUM0_v1==1 || DUM0_v2==1 || DUM0_v3==1 || DUM0_v4==1 || DUM0_v6==1) continue;
		if(runNb<165088 || runNb>179889) continue;
		if(Mu1_P->X()>900 || Mu2_P->X()>900) continue;
		fill_tree();
		if(!select_upsilons()) continue; 
//		if(!select_jpsi()) continue; 

		double DeltaPhi=TMath::Abs(Mu1_P->DeltaPhi(*Mu2_P)); 
		double DeltaEta=TMath::Abs(Mu1_P->Eta()-Mu2_P->Eta());
		double DeltaR=Mu1_P->DeltaR(*Mu2_P);
		double DeltaPt=TMath::Abs(Mu1_P->Perp()-Mu2_P->Perp());
		double DeltaRPtE=TMath::Sqrt(TMath::Power(0.00157*DeltaPt,2)+TMath::Power(1.2*DeltaPhi,2)+TMath::Power(DeltaEta,2));//deltaR elliptic_deltaPt

		if(Ups_P->Perp()<35)hName["h_mass_pt0"]->Fill(Ups_P->M()); 
		else hName["h_mass_pt1"]->Fill(Ups_P->M()); 
		
		hName["mass"]->Fill(Ups_P->M()); 
		hName2D["DeltaRPtE_pt"]->Fill(Ups_P->Perp(),DeltaRPtE); 
		
		hName2D["mass_pt"]->Fill(Ups_P->M(),Ups_P->Perp()); 
		int iy=-1;
		if(fabs(Ups_P->Rapidity()<0.6)) iy=0; 
		else iy=1; 
		hName2D["mass_DeltaRPtE_den"]->Fill(Ups_P->M(),DeltaRPtE); 
		hName2D[Form("mass_y%d_DeltaRPtE_denBin",iy)]->Fill(Ups_P->M(),DeltaRPtE); 
		if(Ups_P->M()>9.26 && Ups_P->M()<9.66){
			hName["hpt_den"]->Fill(Ups_P->Perp());
			hName["DeltaRPtE_den"]->Fill(DeltaRPtE);
		}


		double ptmin=TMath::Min(Mu1_P->Perp(),Mu2_P->Perp());
		double ptmax=TMath::Max(Mu1_P->Perp(),Mu2_P->Perp()); 
		
		hName["hpt_lead"]->Fill(ptmax);
		hName["hpt_trail"]->Fill(ptmin); 

		double etamin=0; 
		
		if(ptmin<Mu1_P->Perp()) etamin=Mu2_P->Eta();
		else etamin=Mu1_P->Eta();
		
		double dimuon_eff=muonEff(ptmin,etamin,"nom");
		bool Trig=false; 
		if(D5_v1==1 || D5_v2==1 || D5_v3==1 || D5_v5==1 || D7_v1==1 || D7_v4==1 || D9_v1==1 || D9_v4==1) Trig=true; 
		if(Trig && Ups_P->M()>9.26 && Ups_P->M()<9.66){
			hName["hpt_num_uW"]->Fill(Ups_P->Perp()); 
			hName["hpt_num"]->Fill(Ups_P->Perp(),1./dimuon_eff);
			hName["DeltaRPtE_num"]->Fill(DeltaRPtE,1./dimuon_eff);
			hName["DeltaRPtE_num_uW"]->Fill(DeltaRPtE); 
		}
		if(Trig){
			if(Ups_P->Perp()<35)hName["h_massTrig_pt0"]->Fill(Ups_P->M()); 
			else hName["h_massTrig_pt1"]->Fill(Ups_P->M()); 

			hName2D["mass_pt_num"]->Fill(Ups_P->M(),Ups_P->Perp(),1.0/dimuon_eff);
			hName2D["mass_pt_num_uW"]->Fill(Ups_P->M(),Ups_P->Perp());
			hName2D["mass_DeltaRPtE_num"]->Fill(Ups_P->M(),DeltaRPtE,1.0/dimuon_eff); 
			hName2D[Form("mass_y%d_DeltaRPtE_numBin",iy)]->Fill(Ups_P->M(), DeltaRPtE,1.0/dimuon_eff);
			hName2D[Form("mass_y%d_DeltaRPtE_numBin_uW",iy)]->Fill(Ups_P->M(), DeltaRPtE);
			hName2D["DeltaRPtE_pt_Trig"]->Fill(Ups_P->Perp(),DeltaRPtE);

		}

		//if(Ups_P->M()>9.26 && Ups_P->M()<9.66)rho->Fill(Trig,Ups_P->Perp());
	//	rho->SetWeight(0.97/dimuon_eff);
		
		//if(HLT_Dimuon7_Upsilon_Barrel_v1) hpt_num->Fill(Ups_P->Perp(),1./dimuon_eff); 
		
	}
		
}