Skip to content

Commit 72ffbfd

Browse files
authored
Merge pull request #48594 from tvami/UpCosmics_master
Add new functionality for upward going case in the Cosmics generator
2 parents 8f9120d + 1b04eca commit 72ffbfd

File tree

7 files changed

+35
-7
lines changed

7 files changed

+35
-7
lines changed

Configuration/Generator/python/UndergroundCosmicMu_cfi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
MultiMuonFileName = cms.string("CORSIKAmultiMuon.root"),
3939
MultiMuonFileFirstEvent = cms.int32(1),
4040
MultiMuonNmin = cms.int32(2),
41+
SurfaceDepth = cms.double(0.0)
4142
)
4243

4344

Configuration/Generator/python/UndergroundCosmicSPLooseMu_cfi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
MaxEnu = cms.double(10000.),
1919
NuProdAlt = cms.double(7.5e6),
2020
AcptAllMu = cms.bool(False),
21+
SurfaceDepth = cms.double(0.0),
2122
ElossScaleFactor = cms.double(1.0),
2223
RadiusOfTarget = cms.double(8000.0),
2324
ZDistOfTarget = cms.double(15000.0),

GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ namespace edm {
7777

7878
bool AllMu; //Accepting All Muons regardeless of direction
7979

80+
/// depth of the surface where upgoing muon is generated relative to bottom of CMS
81+
double SurfaceDepthToCMS;
82+
8083
// external cross section and filter efficiency
8184
double extCrossSect;
8285
double extFilterEff;

GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonGenerator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ class CosmicMuonGenerator {
220220

221221
bool AcptAllMu; //Accepting All Muons regardeless of direction
222222

223+
/// depth of the surface where upgoing muon is generated relative to bottom of CMS
224+
double SurfaceDepth;
225+
223226
// random number generator
224227
CLHEP::HepRandomEngine* RanGen;
225228
bool delRanGen;
@@ -270,6 +273,7 @@ class CosmicMuonGenerator {
270273
void setMaxEnu(double MaxEn);
271274
void setNuProdAlt(double NuPrdAlt);
272275
void setAcptAllMu(bool AllMu);
276+
void setSurfaceDepth(double SurfaceDepthToCMS);
273277

274278
// initialize the generator
275279
void setRandomEngine(CLHEP::HepRandomEngine* v);

GeneratorInterface/CosmicMuonGenerator/python/CMSCGENproducer_cfi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
MaxEnu = cms.double(10000.),
4242
NuProdAlt = cms.double(7.5e6),
4343
AcptAllMu = cms.bool(False),
44+
SurfaceDepth = cms.double(0.0),
4445
Verbosity = cms.bool(False)
4546
)

GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ edm::CosMuoGenProducer::CosMuoGenProducer(const ParameterSet& pset)
4343
MaxEn(pset.getParameter<double>("MaxEnu")),
4444
NuPrdAlt(pset.getParameter<double>("NuProdAlt")),
4545
AllMu(pset.getParameter<bool>("AcptAllMu")),
46+
SurfaceDepthToCMS(pset.getParameter<double>("SurfaceDepth")),
4647
extCrossSect(pset.getUntrackedParameter<double>("crossSection", -1.)),
4748
extFilterEff(pset.getUntrackedParameter<double>("filterEfficiency", -1.)),
4849
cmVerbosity_(pset.getParameter<bool>("Verbosity")),
@@ -91,6 +92,7 @@ edm::CosMuoGenProducer::CosMuoGenProducer(const ParameterSet& pset)
9192
CosMuoGen->setMaxEnu(MaxEn);
9293
CosMuoGen->setNuProdAlt(NuPrdAlt);
9394
CosMuoGen->setAcptAllMu(AllMu);
95+
CosMuoGen->setSurfaceDepth(SurfaceDepthToCMS);
9496
produces<HepMCProduct>("unsmeared");
9597
produces<GenEventInfoProduct>();
9698
produces<GenRunInfoProduct, edm::Transition::EndRun>();
@@ -142,17 +144,21 @@ void edm::CosMuoGenProducer::produce(Event& e, const edm::EventSetup& es) {
142144
std::cout << "CosMuoGen->Id_at=" << CosMuoGen->Id_at << " CosMuoGen->Vx_at=" << CosMuoGen->Vx_at
143145
<< " CosMuoGen->Vy_at=" << CosMuoGen->Vy_at << " CosMuoGen->Vz_at=" << CosMuoGen->Vz_at
144146
<< " CosMuoGen->T0_at=" << CosMuoGen->T0_at << std::endl;
145-
std::cout << " Px=" << CosMuoGen->Px_at << " Py=" << CosMuoGen->Py_at << " Pz=" << CosMuoGen->Pz_at << std::endl;
147+
std::cout << " Px=" << CosMuoGen->Px_at << " Py=" << CosMuoGen->Py_at << " Pz=" << CosMuoGen->Pz_at
148+
<< " E_at=" << CosMuoGen->E_at << std::endl;
149+
146150
for (unsigned int i = 0; i < CosMuoGen->Id_sf.size(); ++i) {
147151
std::cout << "Id_sf[" << i << "]=" << CosMuoGen->Id_sf[i] << " Vx_sf[" << i << "]=" << CosMuoGen->Vx_sf[i]
148152
<< " Vy_sf=" << CosMuoGen->Vy_sf[i] << " Vz_sf=" << CosMuoGen->Vz_sf[i]
149153
<< " T0_sf=" << CosMuoGen->T0_sf[i] << " Px_sf=" << CosMuoGen->Px_sf[i]
150-
<< " Py_sf=" << CosMuoGen->Py_sf[i] << " Pz_sf=" << CosMuoGen->Pz_sf[i] << std::endl;
154+
<< " Py_sf=" << CosMuoGen->Py_sf[i] << " Pz_sf=" << CosMuoGen->Pz_sf[i]
155+
<< " E_sf=" << CosMuoGen->E_sf[i] << std::endl;
151156
std::cout << "phi_sf=" << atan2(CosMuoGen->Px_sf[i], CosMuoGen->Pz_sf[i]) << std::endl;
152157
std::cout << "Id_ug[" << i << "]=" << CosMuoGen->Id_ug[i] << " Vx_ug[" << i << "]=" << CosMuoGen->Vx_ug[i]
153158
<< " Vy_ug=" << CosMuoGen->Vy_ug[i] << " Vz_ug=" << CosMuoGen->Vz_ug[i]
154159
<< " T0_ug=" << CosMuoGen->T0_ug[i] << " Px_ug=" << CosMuoGen->Px_ug[i]
155-
<< " Py_ug=" << CosMuoGen->Py_ug[i] << " Pz_ug=" << CosMuoGen->Pz_ug[i] << std::endl;
160+
<< " Py_ug=" << CosMuoGen->Py_ug[i] << " Pz_ug=" << CosMuoGen->Pz_ug[i]
161+
<< " E_ug=" << CosMuoGen->E_ug[i] << std::endl;
156162
std::cout << "phi_ug=" << atan2(CosMuoGen->Px_ug[i], CosMuoGen->Pz_ug[i]) << std::endl;
157163
;
158164
}

GeneratorInterface/CosmicMuonGenerator/src/CosmicMuonGenerator.cc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void CosmicMuonGenerator::initialize(CLHEP::HepRandomEngine* rng) {
4949
std::cout << " radius of sphere around target = " << Target3dRadius << " mm" << std::endl;
5050

5151
if (MinTheta > 90. * Deg2Rad) //upgoing muons from neutrinos
52-
SurfaceRadius = (RadiusCMS) * (-tan(MinTheta)) + MinStepSize;
52+
SurfaceRadius = (RadiusCMS + SurfaceDepth) * (-tan(MinTheta)) + MinStepSize;
5353
else
5454
SurfaceRadius = (SurfaceOfEarth + PlugWidth + RadiusTargetEff) * tan(MaxTheta) + Target3dRadius;
5555
if (Debug)
@@ -174,7 +174,7 @@ void CosmicMuonGenerator::nextEvent() {
174174

175175
double Vy;
176176
if (MinTheta > 90. * Deg2Rad) //upgoing muons from neutrinos
177-
Vy = -RadiusCMS;
177+
Vy = -(RadiusCMS + SurfaceDepth);
178178
else
179179
Vy = SurfaceOfEarth + PlugWidth; // [mm]
180180

@@ -195,7 +195,7 @@ void CosmicMuonGenerator::nextEvent() {
195195
// if angles are ok, propagate to target
196196
if (goodOrientation()) {
197197
if (MinTheta > 90. * Deg2Rad) //upgoing muons from neutrinos
198-
OneMuoEvt.propagate(0., RadiusOfTarget, ZDistOfTarget, ZCentrOfTarget, TrackerOnly, MTCCHalf);
198+
OneMuoEvt.propagate(ElossScaleFactor, RadiusOfTarget, ZDistOfTarget, ZCentrOfTarget, TrackerOnly, MTCCHalf);
199199
else
200200
OneMuoEvt.propagate(ElossScaleFactor, RadiusOfTarget, ZDistOfTarget, ZCentrOfTarget, TrackerOnly, MTCCHalf);
201201
}
@@ -990,7 +990,7 @@ bool CosmicMuonGenerator::goodOrientation() {
990990

991991
double rVY;
992992
if (MinTheta > 90. * Deg2Rad) //upgoing muons from neutrinos
993-
rVY = -sqrt(RxzV * RxzV + RadiusCMS * RadiusCMS);
993+
rVY = -sqrt(RxzV * RxzV + (RadiusCMS + SurfaceDepth) * (RadiusCMS + SurfaceDepth));
994994
else
995995
rVY = sqrt(RxzV * RxzV + (SurfaceOfEarth + PlugWidth) * (SurfaceOfEarth + PlugWidth));
996996

@@ -1011,6 +1011,13 @@ bool CosmicMuonGenerator::goodOrientation() {
10111011
double dTheta = Pi;
10121012
if (std::fabs(rVY) > Target3dRadius)
10131013
dTheta = asin(Target3dRadius / std::fabs(rVY));
1014+
1015+
if (MinTheta > 90. * Deg2Rad) {
1016+
// upgoing muon's vertex could be outside the target sphere
1017+
ThetaV = -ThetaV;
1018+
Theta = Pi - Theta;
1019+
}
1020+
10141021
//std::cout << " dPhi = " << dPhi << " (" << Phi << " <p|V> " << PhiV << ")" << std::endl;
10151022
//std::cout << " dTheta = " << dTheta << " (" << Theta << " <p|V> " << ThetaV << ")" << std::endl;
10161023

@@ -1278,3 +1285,8 @@ void CosmicMuonGenerator::setAcptAllMu(bool AllMu) {
12781285
if (NotInitialized)
12791286
AcptAllMu = AllMu;
12801287
}
1288+
1289+
void CosmicMuonGenerator::setSurfaceDepth(double SurfaceDepthToCMS) {
1290+
if (NotInitialized)
1291+
SurfaceDepth = SurfaceDepthToCMS;
1292+
}

0 commit comments

Comments
 (0)