GeorgeCocks-01 / URSS

0 stars 0 forks source link

Next steps #3

Open mvesteri opened 2 years ago

mvesteri commented 2 years ago

Understanding the composition of the NoMuID data and validating the accuracy of the QCD background simulation

Validating/improving our model of the light-hadron background in the mW fit

Study muon mis-ID in the simulation

Aside this paper reports a measurement of identified charged particle ratios.

GeorgeCocks-01 commented 2 years ago

Hi @mvesteri, I'm still struggling with the maths for this misID decay curve.

From the equations L = gamma*c*t = p/m*c*t and f(t) = e^(-t/tau), I got f(L) = e^[(-L*m)/(p*c*tau)]. I then integrated f(L) from L = 0 to 5 and plotted that for different p values, however, the plot looks as follows

image

I figure that I must have done some of the maths wrong since this graph does make sense for what I'm plotting, with the peak value of the graph equal to the upper integration limit. I'm just not too sure where in the maths I have gone wrong.

I'm also a little confused as to what f actually is, other than it must be somehow related to the decay probability.

Thanks

GeorgeCocks-01 commented 2 years ago

@mvesteri @mramospe or if you want me to start on one of the other tasks then let me know

mvesteri commented 2 years ago

Regarding the graph, I'm a bit confused but perhaps you can draw graphs of f(L) for different p values?

Then what you want is the integral from 0 - 5 metres, divided by the total integral.

From the suggested plot of f(L) graphs you should be able to see roughly what that ratio of integrals will look like as a function of p.

GeorgeCocks-01 commented 2 years ago

Ah, I didn't realise we had to divide by the total integral. I think this looks much better now. Would I have to times the y-axis scale by 100 to compare with the % mislabeled I had in the mis-ID graph? If so it looks as though it will map rather well onto the data we got.

image

mvesteri commented 2 years ago

Looks good. Maybe the easiest comparison to do with the data is to check that indeed the kaon mis-ID rate is higher than pions. Just overlay another graph for the kaons (remember the branching fraction as well as the different mass and lifetime)

GeorgeCocks-01 commented 2 years ago

Yup, the theoretical mis-ID rate for kaons is larger

image

mvesteri commented 2 years ago

Great stuff.

I wonder if you could try to "fit" the points from the simulated pions and kaons with a curve with the same functional form as what you plot above? You could probably write the function in such a way that the detector length is directly one of the parameters of the function, so you can basically "measure" the detector length via the fit.

We may also see that the fit isn't great, because it only accounts for the [pion,kaon] decay component. The fact that there are some mis-identified protons means that there is a significant "punch through" component too.

I'm not 100% sure about the functional form of that, but it is probably a logarithmic scaling with momentum.

GeorgeCocks-01 commented 2 years ago

Great I'll get on that now then. Just a couple of questions, would it make sense to times f(p) by 100 as that would make it match the range of the data (since the data is as a percent)? And I assume you want one fit for pions and another for kaons, so two values for the length which we can average out?

mvesteri commented 2 years ago

Ah yes sure. It's just a stylistic/aesthetic choice whether to convert to percent but it makes sense to make the same choice for similar/related figures 👍

mvesteri commented 2 years ago

Maybe also start the above plot from say 10 or 20 GeV of momentum. Otherwise the plot is dominated by the large values at low momentum where we don't have any simulation to compare to

GeorgeCocks-01 commented 2 years ago

I just realised that I wasn't limiting the PT values of misID to be >20. The graph doesn't look as good now but I think it's because the minimum P value with PT = 20 is higher so you can't see the peaks of the pions or protons.

image

mvesteri commented 2 years ago

What if you plot over a wider range of momentum, up to say 1 TeV, but use a log x axis?

GeorgeCocks-01 commented 2 years ago

image

I get this, with a log axis. Quite messy for large P but reducing the bin count will do so over the whole plot.

GeorgeCocks-01 commented 2 years ago

image

I managed to get this fit of the data, however the kaon fit gave L = 11.35m, while the pion fit gave L = 25.8m.

mvesteri commented 2 years ago

Interesting:

mvesteri commented 2 years ago

Maybe you could see if the graphs could be described by the a composite function that is the sum of a decay part and a punch through part (f(p) ~ log(p), I guess). There are some missing prefactors etc.. for you to fill in...

GeorgeCocks-01 commented 2 years ago

@mvesteri should I do that by fitting the data with a function but on the log scale graph? Or will the composite function fit the data on the regular graph?

GeorgeCocks-01 commented 2 years ago

I'm also not too sure what the prefactors would be. Having played around with variables a little is it the particle's mass among others?

mvesteri commented 2 years ago

Yes the idea would be to fit over the wider range of momentum with a sum of a decay part and a punch-through part.

By prefactors I just mean things like the f in f*decay_part + (1-f)*punch_through_part. Maybe that is it, but I leave it as an exercise for you to figure out the form of the function 😉

GeorgeCocks-01 commented 2 years ago

I tried to fit the prefactor but the graphs and data are quite far off. Can I double-check that the log term should just be added on after the integral of the decay term has been done? Like so: f(p) = integral0-5(decay)/integral0-infinity(decay) + log10(p), with some prefactor terms added

GeorgeCocks-01 commented 2 years ago

When you write f*decay_part + (1-f)*punch_through_part, do you mean that I should be adding some other prefactor to the decay part as well? At the moment the only prefactor on the decay part is the branching_frac.

mvesteri commented 2 years ago

The f is basically a "fraction of decay part".

GeorgeCocks-01 commented 2 years ago

I'm still quite confused as to what f should be. I've tried different combinations of the variables we've been using but none of them seem to give good fits.

mvesteri commented 2 years ago

Maybe just think of the function like A*decay_functional_form(momentum) + B*punch_through_functional_form(momentum), where A and B are just arbitrary normalisation parameters that you float in the fit?

mvesteri commented 2 years ago

The two function components also have their own free parameters in addition

GeorgeCocks-01 commented 2 years ago

image

The fit isn't great, especially for the pions. I used the lengths from the old fit since if I include it as a fit parameter here I get very small and negative lengths.

Below are the A and B fit params I got.

Kaon fit params: [0.21348514 0.35433869]
Pion fit params: [-0.58957287  0.35099777]
mvesteri commented 2 years ago

Hi @GeorgeCocks-01, sorry for the slow response. Did you manage to figure out how to get a better fit to the data? I will be in the department tomorrow so we could discuss in person

GeorgeCocks-01 commented 2 years ago

Hi @mvesteri, no worries. I didn't manage to get much further than what I sent, and Miguel gave me other tasks throughout the week which I've been working on. I'm not sure what the problem could be unless I used the wrong functional type to fit the data. I used the same integral as before, and then simply added B*log10(p) to the end.

GeorgeCocks-01 commented 2 years ago

I've had more of a look through my code but I'm not sure why it isn't fitting well. I tried fitting the length as well for this compound function and while the fit is better, the lengths are 0.35m for both.

image

mvesteri commented 2 years ago

I think the logarithmic term needs to be a bit more flexible. Maybe leave the base floating, like log(p)/log(C) where C is another floating parameter in the curve fit?

GeorgeCocks-01 commented 2 years ago

The fit still gives the same result graphically, and gave lengths of 0.015 and 1m. I also tried using log(cp). This gave a much better kaon fit but a worse pion fit which I can't seem to fix. The lengths f or this fit are -178 and 1 for kaons and pions respectively.

image

GeorgeCocks-01 commented 2 years ago

I also should mention that I'm still using the same A and B parameters as earlier, so I think it makes sense that the 1/log(c) term wouldn't make much difference as it could be absorbed into the B term since it is a constant.

mvesteri commented 2 years ago

OK. Can you write down the precise functional form that you put in the curve fit? (raw python code is probably fine for me to understand)

GeorgeCocks-01 commented 2 years ago

This is my current code (100*prefac1*mass*bfrac*integrate.quad(f, 0, length, args = (p, mass, tau))[0])/(p*c*tau) + prefac2*np.log10(p)/np.log10(prefac3).

where f returns np.exp(-(L*mass)/(p*c*tau))

I used 1/(p*c*tau) since it should give the same value as integrating the function f from 0 to infinity.

GeorgeCocks-01 commented 2 years ago

I should probably also note that the 100* is because we were using percent for the data, however, I could probably remove it and it would just increase the fit params by a factor of 100.

GeorgeCocks-01 commented 2 years ago

@mvesteri is my functional form ok or have I made a mistake?

GeorgeCocks-01 commented 2 years ago

@mvesteri did you manage to figure out what was wrong with my code?

mvesteri commented 2 years ago

Suggest to extend the set of plots like this one with

image
mvesteri commented 2 years ago

For the trigger efficiency, plot the fraction of hadron candidates with mu_L0Global_TOS==true. Suggest to do this as a function of pT, eta,... , as separate 1D plots.

mvesteri commented 2 years ago

Try to read files from /storage/epp2/phshgg/Public/DVTuples__v24g/

GeorgeCocks-01 commented 2 years ago

Here's that first Log(IPCHI2) graph, you can see the addition from the other particles you drew on the whiteboard in the real W data.

image

I'll get to work on the other graphs now.

GeorgeCocks-01 commented 2 years ago

image

image

image

image

image

image

image

Here are the other graphs. The EcanET has that huge peak which makes it hard to see the rest of the data, not too sure why that is or if I should do anything to counteract it.

I'll move onto the trigger efficiency for now though.

GeorgeCocks-01 commented 2 years ago

image

image

image

image

image

image

image

image

Here are the graphs of trigger efficiency for all the same variables as the above graphs. Just wanted to double check, this was meant to be done with the QCD simulation data right?

mvesteri commented 2 years ago

👍 on the recent graphs. Some comments/suggestions:

GeorgeCocks-01 commented 2 years ago

image

image

image

image

image

image

image

image

Here are the trigger efficiencies as errorbar plots. I used the same errors as for misID: sqrt(frac*(1-frac)/withouttrigger), with frac = withtrigger/withouttrigger.

GeorgeCocks-01 commented 2 years ago

@mvesteri if those graphs are good then is there another task I can move onto?

mvesteri commented 2 years ago

Can you try again with this?

git clone ssh://git@gitlab.cern.ch:7999/LHCb-QEE/WmassMeasurement.git WmassMeasurement
cd WmassMeasurement
git submodule init
git submodule update
./run --cmake -- -G Ninja
./run --install -- ninja
GeorgeCocks-01 commented 2 years ago

Still the same access denied. I haven't set the CERN account up fully yet since it said I needed to wait 24hr to get my password. That was at 4pm yesterday.

mvesteri commented 2 years ago

Ah, OK.

In that case, a different problem to think about: do you think the detector would measure a different momentum for pions and kaons that have decayed to muons? Think about the kinematics of the decay, and the way that LHCb basically measures a deflection between two straight-line trajectories, due to the dipole

mvesteri commented 2 years ago

(This detail is currently ignored in our model)