Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /GeneratorInterface/CosmicMuonGenerator/test/cos_ug is written in an unsupported language. File is not indexed.

0001 {
0002   cout << "macro cos_ug: generate cosmic muons underground" << endl;
0003   gROOT->Reset();
0004   gROOT->LoadMacro("GeneratorInterface/CosmicMuonGenerator/src/CosmicMuonGenerator.cc");
0005   gROOT->LoadMacro("GeneratorInterface/CosmicMuonGenerator/src/CMSCGEN.cc");
0006   gROOT->LoadMacro("GeneratorInterface/CosmicMuonGenerator/src/CMSCGENnorm.cc");
0007   gROOT->LoadMacro("GeneratorInterface/CosmicMuonGenerator/src/SingleParticleEvent.cc");
0008 
0009 #define ROOT_INTERACTIVE true
0010     //*******************************
0011     //*******************************
0012     // define the generator
0013     CosmicMuonGenerator CosUgGen;
0014     // set up generator
0015     CosUgGen.setNumberOfEvents(100);
0016     CosUgGen.setRanSeed(135799468);
0017     CosUgGen.setMinP(3.);              // could be set higher due to energy loss in earth above CMS  
0018     CosUgGen.setMaxP(3000.);  
0019     CosUgGen.setMaxTheta(80.);         // "default" value for underground       
0020     // run the generator (in this order)
0021     CosUgGen.runCMG();
0022     // rate (cosmic muons per second)
0023     double Rate = CosUgGen.getRate();
0024     //*******************************
0025     //*******************************
0026 
0027 #if ROOT_INTERACTIVE
0028   double Weight = Rate/phi->GetEntries();
0029   ene->Scale(Weight);
0030   the->Scale(Weight);
0031   phi->Scale(Weight);
0032   // plot results
0033   TCanvas *C1 = new TCanvas("cosgen","generated cosmic muons",50,50,1000,400);
0034   C1->SetBottomMargin(0.15);
0035   C1->Divide(3,1);
0036   C1->cd(1); gPad->SetLogy(1);
0037   ene->SetFillStyle(1001);
0038   ene->SetFillColor(1111);
0039   ene->SetLineWidth(1.1);
0040   ene->SetLineColor(8888);
0041   ene->Draw();
0042   ene->GetXaxis()->SetLabelSize(0.04);
0043   ene->GetXaxis()->SetTitleSize(0.044);
0044   ene->GetXaxis()->SetTitleOffset(0.8);
0045   ene->GetXaxis()->SetTitle("E [GeV]");
0046   ene->GetYaxis()->SetLabelSize(0.04);
0047   ene->GetYaxis()->SetLabelOffset(0.004);
0048   ene->GetYaxis()->SetTitleSize(0.044);
0049   ene->GetYaxis()->SetTitleOffset(1.2);
0050   ene->GetYaxis()->SetTitle("rate per 5 GeV [Hz]");
0051   C1->cd(2);
0052   the->SetMinimum(0.);
0053   the->SetFillStyle(1001);
0054   the->SetFillColor(1111);
0055   the->SetLineWidth(1.1);
0056   the->SetLineColor(8888);
0057   the->Draw();
0058   the->GetXaxis()->SetLabelSize(0.04);
0059   the->GetXaxis()->SetTitleSize(0.044);
0060   the->GetXaxis()->SetTitleOffset(0.8);
0061   the->GetXaxis()->SetTitle("#vartheta [#circ]");
0062   the->GetYaxis()->SetLabelSize(0.04);
0063   the->GetYaxis()->SetLabelOffset(0.004);
0064   the->GetYaxis()->SetTitleSize(0.044);
0065   the->GetYaxis()->SetTitleOffset(1.8);
0066   the->GetYaxis()->SetTitle("rate per 1 #circ [Hz]");
0067   C1->cd(3);
0068   phi->SetMinimum(0.);
0069   phi->SetFillStyle(1001);
0070   phi->SetFillColor(1111);
0071   phi->SetLineWidth(1.1);
0072   phi->SetLineColor(8888);
0073   phi->Draw();
0074   phi->GetXaxis()->SetLabelSize(0.04);
0075   phi->GetXaxis()->SetTitleSize(0.044);
0076   phi->GetXaxis()->SetTitleOffset(0.8);
0077   phi->GetXaxis()->SetTitle("#varphi [#circ]");
0078   phi->GetYaxis()->SetLabelSize(0.04);
0079   phi->GetYaxis()->SetLabelOffset(0.004);
0080   phi->GetYaxis()->SetTitleSize(0.044);
0081   phi->GetYaxis()->SetTitleOffset(1.8);
0082   phi->GetYaxis()->SetTitle("rate per 3 #circ [Hz]");
0083 
0084   TCanvas *C2 = new TCanvas("vertex","position of generated vertex",100,200,900,450);
0085   C2->SetBottomMargin(0.15);
0086   C2->Divide(1,1);
0087   C2->cd(1);
0088   ver->SetMarkerColor(3333);
0089   ver->Draw();
0090   ver->GetXaxis()->SetLabelSize(0.05);
0091   ver->GetXaxis()->SetTitleSize(0.06);
0092   ver->GetXaxis()->SetTitle("gen. Z [m]");
0093   ver->GetYaxis()->SetLabelSize(0.04);
0094   ver->GetYaxis()->SetTitleSize(0.05);
0095   ver->GetYaxis()->SetTitleOffset(1.0);
0096   ver->GetYaxis()->SetTitle("gen. X [m]");
0097   ver->GetZaxis()->SetLabelSize(0.05);
0098   ver->GetZaxis()->SetTitleSize(0.06);
0099   ver->GetZaxis()->SetTitleOffset(0.6);
0100   ver->GetZaxis()->SetTitle("gen. Y [m]");
0101 #endif
0102 }