void luis() { TFile *f = new TFile("DVNtuplesWithLogAccuracy.root"); TTree *DecayChainNTuple = (TTree*)f->Get("DecayChainNTuple"); static const Long_t nentries = DecayChainNTuple->GetEntries(); Long_t ncandidates = 0; Long_t nevents = 0; Float_t taufit_lab0[5]; Float_t taufitnarrow_lab0[5]; //Long_t VeLoHits_lab1[5]; Float_t pt_lab1[5]; Int_t nCand; //Float_t vchitwo_lab0[5]; //Float_t Residual_lab1[5]; //Float_t VeloAccuracy_lab1[5]; Float_t FirstHitZ_lab1[5]; Float_t taufit_velohitsbin1[5]; TH1F *propertimeVeLohisto = new TH1F("taufit_veloaccuracy_Bin1","taufit_veloaccuracy_Bin1",600,-7.5,7.5); TBranch *b_taufit_lab0; TBranch *b_taufitnarrow_lab0; TBranch *b_nCand; //TBranch *b_VeLoHits_lab1; TBranch *b_pt_lab1; //TBranch *b_vchitwo_lab0; //TBranch *b_Residual_lab1; //TBranch *b_VeloAccuracy_lab1; TBranch *b_FirstHitZ_lab1; b_taufit_lab0 = DecayChainNTuple->GetBranch("taufit_lab0"); b_taufitnarrow_lab0 = DecayChainNTuple->GetBranch("taufitnarrow_lab0"); b_nCand = DecayChainNTuple->GetBranch("nCand"); //b_VeLoHits_lab0 = DecayChainNTuple->GetBranch("VeLoHits_lab1"); b_pt_lab1 = DecayChainNTuple->GetBranch("pt_lab1"); //b_vchitwo_lab0 = DecayChainNTuple->GetBranch("vchitwo_lab0"); //b_Residual_lab1 = DecayChainNTuple->GetBranch("Residual_lab1"); //b_VeloAccuracy_lab1 = DecayChainNTuple->GetBranch("VeloAccuracy_lab1"); b_FirstHitZ_lab1 = DecayChainNTuple->GetBranch("FirstHitZ_lab1"); DecayChainNTuple->SetBranchAddress("taufit_lab0",taufit_lab0); DecayChainNTuple->SetBranchAddress("taufitnarrow_lab0",taufitnarrow_lab0); DecayChainNTuple->SetBranchAddress("nCand",&nCand); //DecayChainNTuple->SetBranchAddress("VeLoHits_lab1",VeLoHits_lab1); DecayChainNTuple->SetBranchAddress("pt_lab1",&pt_lab1); //DecayChainNTuple->SetBranchAddress("vchitwo_lab0",&vchitwo_lab0); //DecayChainNTuple->SetBranchAddress("Residual_lab1",&Residual_lab1); //DecayChainNTuple->SetBranchAddress("VeloAccuracy_lab1",&VeloAccuracy_lab1); DecayChainNTuple->SetBranchAddress("FirstHitZ_lab1",&FirstHitZ_lab1); //std::vector numberofcands(nentries,0.); // TBranch *numberofcands = DecayChainNTuple->GetBranch("N_lab0"); // TBranch *propertime = DecayChainNTuple->GetBranch("taufit_lab0"); // Loop over events for(Long_t ievt = 0; ievt < nentries; ++ievt){ DecayChainNTuple->GetEvent(ievt); // read complete event in memory // std::cout << "ievt is " << ievt << std::endl; // Loop over candidates for(Long_t jcand = 0; jcand < nCand; ++jcand){ // Count candidates ncandidates++; /* if(taufit_lab0[jcand]>-400) { std::cout << "This candidate has lifetime [ps] = " << taufit_lab0[jcand] << std::endl; } std::cout << "This candidate's MuMinus has " << VeLoHits_lab1[jcand] << " hits in the VeLo." << std::endl; // std::cout << "This candidate's MuMinus has Pt " << pt_lab1[jcand] << std::endl; std::cout << "ncandidates is " << ncandidates << std::endl; */ // std::cout << "nevents is " << nevents << std::endl; static_cast(FirstHitZ_lab1[jcand]); //Code to assign value to new variable taufit_velohitsbin1 if(FirstHitZ_lab1[jcand]>= 0.0 && FirstHitZ_lab1[jcand]<200.0) { taufit_velohitsbin1[jcand] = taufitnarrow_lab0[jcand]; } else{ taufit_velohitsbin1[jcand] = -7; } propertimeVeLohisto->Fill(taufit_velohitsbin1[jcand]); }//end of candidate loop nevents++; }//end of events loop TCanvas *c3; c3 = new TCanvas("c3","",10,10,500,500); propertimeVeLohisto->Draw(); }//end of function luis()