CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
SubsystemNeutronReader Class Referenceabstract

#include <SubsystemNeutronReader.h>

Inheritance diagram for SubsystemNeutronReader:
CSCNeutronReader

Public Member Functions

void clear ()
 
void generateChamberNoise (int chamberType, int chamberIndex, edm::PSimHitContainer &result, CLHEP::HepRandomEngine *)
 
 SubsystemNeutronReader (const edm::ParameterSet &pset)
 
virtual ~SubsystemNeutronReader ()
 

Protected Member Functions

virtual int detId (int chamberIndex, int localDetId)=0
 

Private Attributes

std::vector< int > theChambersDone
 just makes sure chambers aren't done twice More...
 
float theEndTime
 
std::vector< double > theEventOccupancy
 
float theEventsInWindow
 how many collsions happened between theStartTime and theEndTime More...
 
NeutronReadertheHitReader
 
float theLuminosity
 in units of 10**34, set by Muon:NeutronLuminosity More...
 
float theStartTime
 

Detailed Description

Definition at line 20 of file SubsystemNeutronReader.h.

Constructor & Destructor Documentation

◆ SubsystemNeutronReader()

SubsystemNeutronReader::SubsystemNeutronReader ( const edm::ParameterSet pset)

the hits will be distributed flat in time between startTime and endTime eventOccupancy is the expected chamber occupancy from a single min bias event for each chamber type

Definition at line 13 of file SubsystemNeutronReader.cc.

14  : theHitReader(nullptr),
15  theLuminosity(pset.getParameter<double>("luminosity")), // in units of 10^34
16  theStartTime(pset.getParameter<double>("startTime")),
17  theEndTime(pset.getParameter<double>("endTime")),
18  theEventOccupancy(pset.getParameter<vector<double> >("eventOccupancy")) // TODO make map
19 {
20  // 17.3 collisions per live bx, 79.5% of bx live
21  float collisionsPerCrossing = 13.75 * theLuminosity;
22  int windowSize = (int)((theEndTime - theStartTime) / 25.);
23  theEventsInWindow = collisionsPerCrossing * windowSize;
24  string reader = pset.getParameter<string>("reader");
25  edm::FileInPath input = pset.getParameter<edm::FileInPath>("input");
26  if (reader == "ASCII") {
27  theHitReader = new AsciiNeutronReader(input.fullPath());
28  } else if (reader == "ROOT") {
29  theHitReader = new RootNeutronReader(input.fullPath());
30  }
31 }

References input, createfilelist::int, muonDTDigis_cfi::pset, DQM::reader, theEndTime, theEventsInWindow, theHitReader, theLuminosity, and theStartTime.

◆ ~SubsystemNeutronReader()

SubsystemNeutronReader::~SubsystemNeutronReader ( )
virtual

Definition at line 33 of file SubsystemNeutronReader.cc.

33 { delete theHitReader; }

References theHitReader.

Member Function Documentation

◆ clear()

void SubsystemNeutronReader::clear ( void  )
inline

Definition at line 32 of file SubsystemNeutronReader.h.

32 { theChambersDone.clear(); }

References theChambersDone.

◆ detId()

virtual int SubsystemNeutronReader::detId ( int  chamberIndex,
int  localDetId 
)
protectedpure virtual

detector-specific way to get the global detector ID, given the local one.

Implemented in CSCNeutronReader.

Referenced by generateChamberNoise().

◆ generateChamberNoise()

void SubsystemNeutronReader::generateChamberNoise ( int  chamberType,
int  chamberIndex,
edm::PSimHitContainer result,
CLHEP::HepRandomEngine *  engine 
)

this class makes sure the same chamberIndex isn't called twice for an event

Definition at line 35 of file SubsystemNeutronReader.cc.

38  {
39  // make sure this chamber hasn't been done before
40  if (find(theChambersDone.begin(), theChambersDone.end(), chamberIndex) == theChambersDone.end()) {
41  float meanNumberOfEvents = theEventOccupancy[chamberType - 1] * theEventsInWindow;
42  CLHEP::RandPoissonQ randPoissonQ(*engine, meanNumberOfEvents);
43  int nEventsToAdd = randPoissonQ.fire();
44  // LogDebug("NeutronReader") << "Number of neutron events to add: "
45  //std::cout << "Number of neutron events to add for chamber type " << chamberType << " : "
46  // << nEventsToAdd << " mean " << meanNumberOfEvents << std::endl;
47  // << nEventsToAdd << " mean " << meanNumberOfEvents;
48 
49  for (int i = 0; i < nEventsToAdd; ++i) {
50  // find the time for this event
51  float timeOffset = CLHEP::RandFlat::shoot(engine, theStartTime, theEndTime);
52  vector<PSimHit> neutronHits;
53  theHitReader->readNextEvent(chamberType, neutronHits);
54 
55  for (vector<PSimHit>::const_iterator neutronHitItr = neutronHits.begin(); neutronHitItr != neutronHits.end();
56  ++neutronHitItr) {
57  const PSimHit& rawHit = *neutronHitItr;
58  // do the time offset and local det id
59  int det = detId(chamberIndex, rawHit.detUnitId());
60  PSimHit hit(rawHit.entryPoint(),
61  rawHit.exitPoint(),
62  rawHit.pabs(),
63  rawHit.tof() + timeOffset,
64  rawHit.energyLoss(),
65  rawHit.particleType(),
66  det,
67  rawHit.trackId(),
68  rawHit.thetaAtEntry(),
69  rawHit.phiAtEntry(),
70  rawHit.processType());
71  //std::cout << "NEWHIT " << hit << std::endl;
72  result.push_back(hit);
73  }
74  }
75  theChambersDone.push_back(chamberIndex);
76  }
77 }

References detId(), PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), spr::find(), mps_fire::i, PSimHit::pabs(), PSimHit::particleType(), PSimHit::phiAtEntry(), PSimHit::processType(), NeutronReader::readNextEvent(), mps_fire::result, theChambersDone, theEndTime, theEventOccupancy, theEventsInWindow, theHitReader, theStartTime, PSimHit::thetaAtEntry(), hgcalLayerClusters_cfi::timeOffset, PSimHit::tof(), and PSimHit::trackId().

Referenced by CSCNeutronReader::addHits().

Member Data Documentation

◆ theChambersDone

std::vector<int> SubsystemNeutronReader::theChambersDone
private

just makes sure chambers aren't done twice

Definition at line 43 of file SubsystemNeutronReader.h.

Referenced by clear(), and generateChamberNoise().

◆ theEndTime

float SubsystemNeutronReader::theEndTime
private

Definition at line 48 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().

◆ theEventOccupancy

std::vector<double> SubsystemNeutronReader::theEventOccupancy
private

Definition at line 52 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise().

◆ theEventsInWindow

float SubsystemNeutronReader::theEventsInWindow
private

how many collsions happened between theStartTime and theEndTime

Definition at line 50 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().

◆ theHitReader

NeutronReader* SubsystemNeutronReader::theHitReader
private

◆ theLuminosity

float SubsystemNeutronReader::theLuminosity
private

in units of 10**34, set by Muon:NeutronLuminosity

Definition at line 46 of file SubsystemNeutronReader.h.

Referenced by SubsystemNeutronReader().

◆ theStartTime

float SubsystemNeutronReader::theStartTime
private

Definition at line 47 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().

mps_fire.i
i
Definition: mps_fire.py:355
SubsystemNeutronReader::theHitReader
NeutronReader * theHitReader
Definition: SubsystemNeutronReader.h:40
input
static const std::string input
Definition: EdmProvDump.cc:48
RootNeutronReader
Definition: RootNeutronReader.h:15
SubsystemNeutronReader::detId
virtual int detId(int chamberIndex, int localDetId)=0
PSimHit::tof
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:76
AsciiNeutronReader
Definition: AsciiNeutronReader.h:17
SubsystemNeutronReader::theEventsInWindow
float theEventsInWindow
how many collsions happened between theStartTime and theEndTime
Definition: SubsystemNeutronReader.h:50
hgcalLayerClusters_cfi.timeOffset
timeOffset
Definition: hgcalLayerClusters_cfi.py:56
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
PSimHit::entryPoint
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
PSimHit::detUnitId
unsigned int detUnitId() const
Definition: PSimHit.h:97
edm::FileInPath
Definition: FileInPath.h:64
PSimHit::pabs
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:67
PSimHit::processType
unsigned short processType() const
Definition: PSimHit.h:120
PSimHit::exitPoint
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
DQM.reader
reader
Definition: DQM.py:105
SubsystemNeutronReader::theLuminosity
float theLuminosity
in units of 10**34, set by Muon:NeutronLuminosity
Definition: SubsystemNeutronReader.h:46
createfilelist.int
int
Definition: createfilelist.py:10
PSimHit::phiAtEntry
Geom::Phi< float > phiAtEntry() const
fast and more accurate access to momentumAtEntry().phi()
Definition: PSimHit.h:64
SubsystemNeutronReader::theEventOccupancy
std::vector< double > theEventOccupancy
Definition: SubsystemNeutronReader.h:52
SubsystemNeutronReader::theChambersDone
std::vector< int > theChambersDone
just makes sure chambers aren't done twice
Definition: SubsystemNeutronReader.h:43
SubsystemNeutronReader::theEndTime
float theEndTime
Definition: SubsystemNeutronReader.h:48
PSimHit::energyLoss
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
SubsystemNeutronReader::theStartTime
float theStartTime
Definition: SubsystemNeutronReader.h:47
PSimHit::particleType
int particleType() const
Definition: PSimHit.h:89
PSimHit::trackId
unsigned int trackId() const
Definition: PSimHit.h:106
mps_fire.result
result
Definition: mps_fire.py:303
PSimHit::thetaAtEntry
Geom::Theta< float > thetaAtEntry() const
fast and more accurate access to momentumAtEntry().theta()
Definition: PSimHit.h:61
PSimHit
Definition: PSimHit.h:15
NeutronReader::readNextEvent
virtual void readNextEvent(int chamberType, edm::PSimHitContainer &result)=0
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27