based on the a class generated with “MakeClass”, I modified the Loop() to print out values for a particular cut. I have a nested loop. When I include the “break” line listed below the break statement breaks out of both loops and ends the script. If I comment out the break statement it seems to work correctly, however it doesn’t fill my array correctly.
Anyone experience problems with this before?
#define getLundIds_cxx
#include "getLundIds.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
void getLundIds::Loop()
{
const int ARRAYENTRIES = 50;
Int_t lundid[ARRAYENTRIES][2] = {0};
int j = 0;
int test =0;
Int_t Ks0LundId_MC;
fChain->SetBranchStatus("*",1);
fChain -> SetBranchAddress("Ks0LundId_MC", &Ks0LundId_MC);
TCut cut = "d0Mass > 1.78 && d0Mass < 1.94 && pi0PCms > 0.96 && KsMass > 0.492 && KsMass < 0.502 && dStarPCms > 2.79 && kstightmassbackground == 1 && Ks1E_MC == pi01E_MC && delMass > 0.1445 && delMass < 0.1463";
fChain -> Draw(">>inEvList", cut);
TEventList *ev = (TEventList *)gDirectory->Get("inEvList");
Int_t nentries = ev -> GetN();
for (Int_t jentry=0; jentry<nentries;jentry++) {
fChain->GetEntry(ev->GetEntry(jentry));
for(Int_t i=0;i<ARRAYENTRIES;i++)
{
if(lundid[i][0] == Ks0LundId_MC)
{
lundid[i][1]++;
// break; //<-------- This Is tHE liNE
}
else if(i == (ARRAYENTRIES-1))
{
lundid[j][0] = Ks0LundId_MC;
j++;
}
}
}
for(int k=0;k<ARRAYENTRIES;k++)
{
cout << k << ": " << lundid[k][0] << ": " << lundid[k][1] << endl;
}
}