Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:36

0001 #define MinBias_cxx
0002 #include "MinBias.h"
0003 #include <TH2.h>
0004 #include <TStyle.h>
0005 #include <TCanvas.h>
0006 
0007 void MinBias::Loop()
0008 {
0009 //   In a ROOT session, you can do:
0010 //      Root > .L MinBias.C
0011 //      Root > MinBias t
0012 //      Root > t.GetEntry(12); // Fill t data members with entry number 12
0013 //      Root > t.Show();       // Show values of entry 12
0014 //      Root > t.Show(16);     // Read and show values of entry 16
0015 //      Root > t.Loop();       // Loop on all entries
0016 //
0017 
0018 //     This is the loop skeleton where:
0019 //    jentry is the global entry number in the chain
0020 //    ientry is the entry number in the current Tree
0021 //  Note that the argument to GetEntry must be:
0022 //    jentry for TChain::GetEntry
0023 //    ientry for TTree::GetEntry and TBranch::GetEntry
0024 //
0025 //       To read only selected branches, Insert statements like:
0026 // METHOD1:
0027 //    fChain->SetBranchStatus("*",0);  // disable all branches
0028 //    fChain->SetBranchStatus("branchname",1);  // activate branchname
0029 // METHOD2: replace line
0030 //    fChain->GetEntry(jentry);       //read all branches
0031 //by  b_branchname->GetEntry(ientry); //read only this branch
0032    if (fChain == 0) return;
0033 
0034    Long64_t nentries = fChain->GetEntriesFast();
0035    TH1F  *hCalo1[110][50];
0036    TH1F  *hCalo2[110][50];
0037    
0038     for(int i=0;i<100;i++){
0039     char str0[6];
0040     char str1[6];
0041     for(int j=0;j<50;j++){
0042     
0043     int k = i*10000+j;
0044     sprintf(str0,"enpl%d",k);
0045     sprintf(str1,"enmin%d",k);
0046    
0047     hCalo1[i][j] = new TH1F(str0, "enpl", 300, 0.1665, 100.1665); 
0048     hCalo2[i][j] = new TH1F(str1, "enmin", 300, 0.1665, 100.1665);
0049     }
0050     }
0051 
0052    Long64_t nbytes = 0, nb = 0;
0053    for (Long64_t jentry=0; jentry<nentries;jentry++) {
0054       Long64_t ientry = LoadTree(jentry);
0055       if (ientry < 0) break;
0056       nb = fChain->GetEntry(jentry);   nbytes += nb;
0057       // if (Cut(ientry) < 0) continue;
0058 //      if (fabs(eta)<0.5) continue;
0059 //      cout<<" mom1 "<<iphi<<" "<<ieta<<endl;
0060       if(ieta<0) hCalo1[iphi][abs(ieta)]->Fill(mom1);
0061       if(ieta>=0) hCalo2[iphi][ieta]->Fill(mom1);
0062       if ( ieta == -2 && iphi == 35 ) cout<<" "<<mom1<<endl;
0063       if ( ieta == 2 && iphi == 35 ) cout<<" "<<mom1<<endl;
0064       if ( mom1 > 1. ) cout<<mom1<<endl;
0065       
0066    }
0067    hCalo1[35][2]->Draw();
0068 }