Skip to content

Instantly share code, notes, and snippets.

@jdbrice
Created February 7, 2016 12:30
Show Gist options
  • Select an option

  • Save jdbrice/eb22f54dbd612a15d077 to your computer and use it in GitHub Desktop.

Select an option

Save jdbrice/eb22f54dbd612a15d077 to your computer and use it in GitHub Desktop.
Toy MC for VPD Trigger window resolution
{
int totalEvents = 50000;
double sigmaVz = 15;
double sigmaVpdVz = 4.5;
double triggerWindow = 5;
TH1D * vz = new TH1D( "vz", "vz", 200, -50, 50 );
TH1D * bvz = new TH1D( "bvz", "bvz", 200, -50, 50 );
TRandom3 rnd;
TF1 * fz = new TF1( "gz", "gaus" );
fz->SetParameters( 1000, 30, 30 );
TF1 * f = new TF1( "g1", "gaus" );
int nEvents = 0;
while ( nEvents < totalEvents ){
double z = rnd.Gaus( 0, sigmaVz );
if ( fabs( z ) > triggerWindow ) continue;
double blurred_z = rnd.Gaus( 0, sigmaVpdVz ) + z;
vz->Fill( z );
bvz->Fill( blurred_z );
nEvents ++;
}
vz->Draw();
bvz->SetLineColor( kRed );
bvz->Draw( "same" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment