mcEventWeight cut

I’m not actually sure if this is a root issue or poor C++ knowledge, apologies if it’s straight coding that’s the issue. I Tchained together three files and now I’m trying to remove high event bins in some pt histograms. My code to do so isn’t working. I have tried testing an mcEventWeight cut by doing e.g.

         if (jet_pt->at(j)>1450 && jet_pt->at(j)<1485 && mcEventWeight>0) std::cout<<"break"<<endl;

And this ‘if’ statement never seems to be triggered, even though if I get it to print out the mcEventWeight values while running, they are definitely above zero. The whole loop runs like this, with the commented out statements showing where I’ve tried to move the cut around to see if that worked:

    for (Long64_t i = 0; i < N; i++) {
//std::cout<<"mcEventWeight is "<< mcEventWeight <<endl;
//          if (mcEventWeight>0.00001) break;
        for (unsigned long j = 0; j <jet_pt->size(); j++) {
//std::cout<<"do we get into this loop?"<<endl;
//            if (jet_pt->at(j)>120)  break;
          if (jet_pt->at(j)>1450 && jet_pt->at(j)<1485 && mcEventWeight>0.000000003) std::cout<<"break"<<endl; break;
/*          if (jet_pt->at(j)>1345 && jet_pt->at(j)<1380 && mcEventWeight>0.000000003) std::cout<<"break"<<endl; break;
          if (jet_pt->at(j)>1275 && jet_pt->at(j)<1310 && mcEventWeight>0.000000003) std::cout<<"break"<<endl; break; */
            if (abs(jet_eta->at(j))>=2.1 && abs(JZ_weight)>=100) break;
//std::cout<<"mcEventWeight is "<< mcEventWeight <<endl;
            else if(abs(jet_PartonTruthLabelID->at(j))<10){

So uncommenting all the commented out bits removes an amount of events that seems random to me, even though it’s such a harsh cut it should remove them all (based on both printouts of values and plots of values). Sorry, this is probably some kind of syntax error and glaringly obvious, but thank you for any tips or suggestions! :slight_smile:

Please read tips for efficient and successful posting and posting code

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

Maybe when “mcEventWeight > 0”, it never happens that “1450 < jet_pt->at(j) < 1485”.

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