#define jpsi482sel_cxx // The class definition in jpsi482sel.h has been generated automatically // by the ROOT utility TTree::MakeSelector(). // // This class is derived from the ROOT class TSelector. // The following members functions are called by the TTree::Process() functions: // Begin(): called everytime a loop on the tree starts, // a convenient place to create your histograms. // Notify(): this function is called at the first entry of a new Tree // in a chain. // ProcessCut(): called at the beginning of each entry to return a flag, // true if the entry must be analyzed. // ProcessFill(): called in the entry loop for all entries accepted // by Select. // Terminate(): called at the end of a loop on the tree, // a convenient place to draw/fit your histograms. // // To use this file, try the following session on your Tree T // // Root > T->Process("jpsi482sel.C") // Root > T->Process("jpsi482sel.C","some options") // Root > T->Process("jpsi482sel.C+") // #include "jpsi482sel.h" #include "TStyle.h" void jpsi482sel::Begin(TTree *tree) { // Function called before starting the event loop. // Initialize the tree branches. cout << "init called" << endl; Init(tree); npass=0; nptlxyer=0; monHist = new jpsiHist(); monHist->Book(); fout = new TFile("j482.root","RECREATE"); monHist->outNTTree->Branch("j482",&stuff.massit,"FMass/F:Ct:CtErr:PtJpsi"); TString option = GetOption(); printf("Starting analysis with process option: %s\n",option.Data()); } Bool_t jpsi482sel::Process(Int_t entry) { // Processing function. // Entry is the entry number in the current tree. // Read only the necessary branches to select entries. // To read complete event, call fChain->GetTree()->GetEntry(entry). // Return kFALSE as stop processing. return kTRUE; } Bool_t jpsi482sel::ProcessCut(Int_t entry) { // Selection function. // Entry is the entry number in the current tree. // Read only the necessary branches to select entries. // Return kFALSE as soon as a bad entry is detected. // To read complete event, call fChain->GetTree()->GetEntry(entry). // Load items // Fill items upon which cuts are made b_z01f->GetEntry(entry) ; monHist->z01h->Fill(z01f); b_z02f->GetEntry(entry) ; monHist->z02h->Fill(z02f); monHist->dzh->Fill(fabs(z02f-z01f)); b_ptdimuft->GetEntry(entry) ; monHist->PtDiMu->Fill(ptdimuft); monHist->PtDiMuSmall->Fill(ptdimuft); b_lxyerr1->GetEntry(entry) ; monHist->LxyEr->Fill(lxyerr1); monHist->LxyEr1->Fill(lxyerr1); b_d01f->GetEntry(entry) ; monHist->D01->Fill(d01f); b_d02f->GetEntry(entry) ; monHist->D02->Fill(d02f); monHist->D02vsD01->Fill(d01f,d02f); b_ptmu1->GetEntry(entry) ; monHist->PtMu1->Fill(ptmu1); b_ptmu2->GetEntry(entry) ; monHist->PtMu2->Fill(ptmu2); b_mu1type->GetEntry(entry) ; monHist->Mu1Type->Fill(mu1type); b_mu2type->GetEntry(entry) ; monHist->Mu2Type->Fill(mu2type); b_cmu1x2xp->GetEntry(entry) ; monHist->CMu1X->Fill(cmu1x2xp); b_cmu2x2xp->GetEntry(entry) ; monHist->CMu2X->Fill(cmu2x2xp); b_ncthtax1->GetEntry(entry) ; monHist->CThAx1->Fill(ncthtax1); b_ncthtax2->GetEntry(entry) ; monHist->CThAx2->Fill(ncthtax2); b_ncthtst1->GetEntry(entry) ; monHist->CThSt1->Fill(ncthtst1); b_ncthtst2->GetEntry(entry) ; monHist->CThSt2->Fill(ncthtst2); b_nsihit1->GetEntry(entry) ; monHist->Si1->Fill(nsihit1); b_nsihit2->GetEntry(entry) ; monHist->Si2->Fill(nsihit2); b_mass1->GetEntry(entry) ; monHist->M1->Fill(mass1); b_fitprb1->GetEntry(entry) ; monHist->FitPrb1->Fill(fitprb1); b_Beamx->GetEntry(entry); b_Beamy->GetEntry(entry); b_phi01f->GetEntry(entry); b_phi02f->GetEntry(entry); b_silayer1->GetEntry(entry); monHist->SiLayer1->Fill(silayer1[1]); b_silayer2->GetEntry(entry); monHist->SiLayer2->Fill(silayer2[1]); b_Beamtype->GetEntry(entry); b_runnum->GetEntry(entry); // //Correct the D0 for beam line // d0c1=(d01f+Beamx*sin(phi01f)-Beamy*cos(phi01f)); d0c2=(d02f+Beamx*sin(phi02f)-Beamy*cos(phi02f)); monHist->D01c->Fill(d0c1); monHist->D02c->Fill(d0c2); monHist->D02vsD01c->Fill(d0c1,d0c2); monHist->BeamTypeRun->Fill(runnum,Beamtype==3?1:0); monHist->Runs->Fill(runnum); if( Beamtype != 3 ) return kFALSE; //ok if( fitprb1 < 0.001 ) return kFALSE; //ok // if( ptdimuft<1.5 ) return kFALSE; // if( lxyerr1>0.025 ) return kFALSE; // if( fabs(d0c1)>0.5 ) return kFALSE; // if( fabs(d0c2)>0.5 ) return kFALSE; if( fabs(ptmu1)<1.5 ) return kFALSE; //ok if( fabs(ptmu2)<1.5 ) return kFALSE; //ok if( !((mu1type==1)||(mu1type==3)) ) return kFALSE;//ok if( !((mu2type==1)||(mu2type==3)) ) return kFALSE;//ok if( cmu1x2xp>9. ) return kFALSE; if( cmu2x2xp>9. ) return kFALSE; if( ! ( ncthtax1>=36&&ncthtax2>=36 //ok &&ncthtst1>=24&&ncthtst2>=24 //ok &&nsihit1>=3&&nsihit2>=3) //ok ) return kFALSE; if( silayer1[1]<1 ) return kFALSE; //ok if( silayer2[1]<1 ) return kFALSE; //ok return kTRUE; } void jpsi482sel::ProcessFill(Int_t entry) { // Function called for selected entries only. // Entry is the entry number in the current tree. // Read branches not processed in ProcessCut() and fill histograms. // To read complete event, call fChain->GetTree()->GetEntry(entry). Double_t M = 3.09687; Double_t M1D0SigVal,M2D0SigVal; npass++; if(!(npass%1000))cout << npass << " passed" << endl; b_sigd01f->GetEntry(entry); b_sigd02f->GetEntry(entry); b_ptdimu->GetEntry(entry); b_lxy1->GetEntry(entry); b_lxyerr->GetEntry(entry); b_emass1->GetEntry(entry); M1D0SigVal=sigd01f>0.0?d0c1/sigd01f:0.0; M2D0SigVal=sigd02f>0.0?d0c2/sigd02f:0.0; monHist->M1D0Sig->Fill(M1D0SigVal); monHist->M2D0Sig->Fill(M2D0SigVal); monHist->h3->Fill(mass1); monHist->JPsiMassHisto->Fill(mass1); if( (ptdimu!=0) && (lxy1!=0)){ Float_t life = (lxy1*M)/(ptdimu); Float_t erro = life*lxyerr1/lxy1; // cout << mass1 << " " << emass1 // << " " <3.039 &&mass1<3.139){ monHist->h2->Fill(life); }else if((mass1>3.189 && mass1<3.239)|| (mass1>2.939 && mass1<2.989)){ monHist->h1->Fill(life); } stuff.massit=mass1; stuff.slife=life; stuff.slerr=erro; stuff.ptdimu=ptdimu; monHist->outNTTree->Fill(); }else{ nptlxyer++; } return; } void jpsi482sel::Terminate() { // Function called at the end of the event loop. cout << npass << " Passes" << endl; cout << "ERROR: ptdimu or lxy1 =0 " << nptlxyer << endl; monHist->Write(); monHist->Draw(); }