Error: invalid operands to binary expression ('vector<int>' and 'int')

I am having problems using an if statement. I only want to keep muons of quality 1, however, I am having problems with if(recomuons_qualiy != 1 ) continue; I am not sure how to solve this problem.

#include "trigReader.C"
//#include "trigReader.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TChain.h>


void Plots(){ //OPENING BRACE

  //##################################
  //        OPEN ROOT FILE
  //##################################


   TFile *file = new TFile ("/afs/cern.ch/work/a/atee/private/qualification_task    /PEB_Work_Part_5/user.hrussell.data17_13TeV.00334443.physics_EnhancedBias.r10013_r10014_p3313.bntup_11_tmpBphys.root/nTuple.root", "READ");

   TTree *tree = (TTree*)file->Get("trig");

  

//##############################
//  VARIABLE DECLARATIONS
//##############################

Int_t HLT_3mu4;
Int_t eventNumber;
vector<int> *recomuons_qualiy;


 trigReader *trig = new trigReader(tree);  //Created an object which will contain the objects






for(int ievent=0; ievent<tree->GetEntries();ievent++){ //Need to loop through the tree to get the number of events.
    trig->GetEntry(ievent);


    
    HLT_3mu4 = trig->HLT_3mu4;
recomuons_qualiy = trig->recomuons_qualiy;
   
    event = trig->eventNumber;  //resets the event number to the current event number. Hence when printing the eventNumber use event!!!!
    

//#####################################
//         RECO MUONS STUFF
//#####################################


Int_t nRecoMuons = trig->recomuons->size();

for (Int_t i=0; i<trig->recomuons->size(); i++){ //Reco Muons are unique


  if (HLT_3mu4 == 0) continue;   //Now make plots for events which pass the HLT_3mu4 trigger

  if(*recomuons_qualiy != 1 ) continue; //Remove all reco muons whose quality is not equal to 1. This leaves only tight muons.

  



}// END OF FOR LOOP FOR RECOMUONS
 

}// CLOSING MAIN FOR LOOP

Try:

if ((!recomuons_qualiy) || (recomuons_qualiy->at(i) != 1)) continue;

This seems to solve it, thank you!

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