Problem with remainder operator in root

Dear All,
I was applying one condition in root by using remainder operator(aB0Mode%100000==1877) but it was filling up the histogram. But If I draw it interactively (aB0Mode) then it is showing correct plot. Am I missing something when I am defining it in macro ? Do I need to define something for remainder operator while I am writing macro ?

{
TChain ch1("track");
ch1.Add("/home/souvik/tracking/root/root/mixed/recon_mixed*.root");
int aB0Mode;
ch1.SetBranchAddress("B0Mode",&aB0Mode);

TH1F *hist1 = new TH1F("hist1","",100, 0,2000);
  for(Int_t i=0; i < ch1.GetEntries(); ++i){
    ch1.GetEntry(i);
    if(aB0Mode%100000==1877){
        hist1->Fill(aB0Mode);
    }                                                                                                                                                                                                
  }
hist1->GetYaxis()->SetRangeUser(0,1200);
hist1->GetXaxis()->SetTitle("M_{bc} in GeV/C^{2}");
hist1->SetLineColor(kRed);
hist1->SetLineWidth(2);
hist1->SetFillColor(kRed);
hist1->Draw();

}

Thanks in Advance

__
Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Try to remove the condition in your macro and see if your histogram gets filled.

Yes, If I remove the condition histogram is getting filled.

So inside of this condition add std::cout << i << " : " << aB0Mode << std::endl;

After the If comment. if I add the print out statement it is not printing anything but before it it printing 0 values of it. But there was values stored in it.

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.