emanca / wproperties-analysis

Git repo gathering all submodules in the w properties analysis in CMS
0 stars 6 forks source link

Gen particle selection and vtype assignment #124

Open sroychow opened 3 years ago

sroychow commented 3 years ago

In the genLepton selection module, after the 2 gen leptons are selected - the index of the +ve pdg-id lepton is stored as the first index. Then in the Vtype selection - thet sign of the odd-pdgid lepton is checked and multiplied by -1 to get the charge of the boson. Following is the event dump from 2 events :-

**********************NEW EVENT****************
idx:abs(mompdgId):pdgId:status:pt>>>>8:24:13:1:29.6875
idx:abs(mompdgId):pdgId:status:pt>>>>9:24:-14:1:24.75
In Vtype 2-lepton part
Vcharge=-1
*****Vtype computation(pdg[idx1], pdg[idx2], Vtype):13  -14     -13
**********************NEW EVENT****************
idx:abs(mompdgId):pdgId:status:pt>>>>8:24:-13:1:40.25
idx:abs(mompdgId):pdgId:status:pt>>>>9:24:14:1:36.125
*******Computed ptsorted indices(idx1,idx2):8   9
*******Computed chsorted indices(idx1,idx2):9   8
In Vtype 2-lepton part
Vcharge=1
*****Vtype computation(pdg[idx1], pdg[idx2], Vtype):14  -13     14

As it can be seen -

For DY, this effect is not important. However for W events this can cause confusion in the logic downstream.

sroychow commented 3 years ago

The proposed solution is like this:-

    if(idx1 != -1 && idx2 == -1) {//only 1 lepton                                                                                                      
      vtype=pdg[idx1];
    }
    else if(std::abs(pdg[idx1]) == std::abs(pdg[idx2])) {
      int vcharge = pdg[idx1]%2 ? -1*pdg[idx1]/std::abs(pdg[idx1]) : -1*pdg[idx2]/std::abs(pdg[idx2]);
      vtype = vcharge*int((abs(pdg[idx1])+abs(pdg[idx1]))/2.);
    } else {//Wcase                                                                                                                                    
      vtype = (pdg[idx1]%2 == 0) ? -1*pdg[idx2] : -1*pdg[idx1];
    }

Here I am forcing a check if the event is dilepton event or not and then for lepton, neutrino event - the vtype is assigned according to the logic of whether the lepton is at index 1 or 2.

Here is the dump of the same 2 events:-

**********************NEW EVENT****************
idx:abs(mompdgId):pdgId:status:pt>>>>8:24:13:1:29.6875
idx:abs(mompdgId):pdgId:status:pt>>>>9:24:-14:1:24.75
*******Computed ptsorted indices(idx1,idx2):8   9
*******Computed chsorted indices(idx1,idx2):8   9
*****Vtype computation(pdg[idx1], pdg[idx2], Vtype):13  -14     -13
**********************NEW EVENT****************
idx:abs(mompdgId):pdgId:status:pt>>>>8:24:-13:1:40.25
idx:abs(mompdgId):pdgId:status:pt>>>>9:24:14:1:36.125
*******Computed ptsorted indices(idx1,idx2):8   9
*******Computed chsorted indices(idx1,idx2):9   8
*****Vtype computation(pdg[idx1], pdg[idx2], Vtype):14  -13     13

Now the