CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CosmicGenFilterLowE.cc
Go to the documentation of this file.
1 // daniele.benedetti@cern.ch
2 // Filter to generate from CMSCGEN muon cosmics with Caprice energy spectrum only below 3 GeV
3 
4 
8 
9 
10 #include <map>
11 #include <vector>
12 
13 using namespace std;
14 
16 {
17 }
18 
20 {
21 
22 
24  iEvent.getByLabel("generator","unsmeared",HepMCEvt);
25  const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
26 
27  double Ene = 0;
28 
29  for(HepMC::GenEvent::particle_const_iterator i=MCEvt->particles_begin(); i != MCEvt->particles_end();++i)
30  {
31  Ene = (*i)->momentum().e();
32  }
33 
34  float r1;
35  double prob;
36  prob = RanGen2.Rndm();
37  r1 = float(prob);
38  float fpmax = 2372.;
39  float fp;
40  double ten = 10.0;
41  float fp3gev = 650.; //...needed for the renormalization;
42 
43 
44  if (Ene < 3) {
45 
46  fp = 90.*(1.48*((pow(Ene,-1.5))* pow(ten,(1.189+0.9604*log10(Ene)-1.114*log10(Ene)*log10(Ene) +0.1775*log10(Ene)*log10(Ene)*log10(Ene)))));
47  if (r1 < (fp/fpmax)) return true;
48  else return false;
49  }
50  else {
51  if ( r1 < (fp3gev/fpmax)) {
52  return true;
53  }
54  else return false;
55  }
56 }
57 
int i
Definition: DBlmapReader.cc:9
int iEvent
Definition: GenABIO.cc:230
CosmicGenFilterLowE(const edm::ParameterSet &conf)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
tuple conf
Definition: dbtoconf.py:185
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool filter(edm::Event &iEvent, edm::EventSetup const &c)