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 ( 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.

References edm::ParameterSet::getParameter(), input, createfilelist::int, matplotRender::reader, theEndTime, theEventsInWindow, theHitReader, theLuminosity, and theStartTime.

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");
26  if(reader == "ASCII")
27  {
28  theHitReader = new AsciiNeutronReader(input.fullPath());
29  }
30  else if (reader == "ROOT")
31  {
32  theHitReader = new RootNeutronReader(input.fullPath());
33  }
34 }
T getParameter(std::string const &) const
std::vector< double > theEventOccupancy
static std::string const input
Definition: EdmProvDump.cc:45
float theEventsInWindow
how many collsions happened between theStartTime and theEndTime
float theLuminosity
in units of 10**34, set by Muon:NeutronLuminosity
SubsystemNeutronReader::~SubsystemNeutronReader ( )
virtual

Definition at line 37 of file SubsystemNeutronReader.cc.

References theHitReader.

37  {
38  delete theHitReader;
39 }

Member Function Documentation

void SubsystemNeutronReader::clear ( void  )
inline

Definition at line 34 of file SubsystemNeutronReader.h.

34 {theChambersDone.clear();}
std::vector< int > theChambersDone
just makes sure chambers aren&#39;t done twice
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().

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 43 of file SubsystemNeutronReader.cc.

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(), theChambersDone, theEndTime, theEventOccupancy, theEventsInWindow, theHitReader, theStartTime, PSimHit::thetaAtEntry(), hgcalLayerClusters_cff::timeOffset, PSimHit::tof(), and PSimHit::trackId().

Referenced by CSCNeutronReader::addHits().

46 {
47  // make sure this chamber hasn't been done before
48  if(find(theChambersDone.begin(), theChambersDone.end(), chamberIndex)
49  == theChambersDone.end())
50  {
51  float meanNumberOfEvents = theEventOccupancy[chamberType-1]
53  CLHEP::RandPoissonQ randPoissonQ(*engine, meanNumberOfEvents);
54  int nEventsToAdd = randPoissonQ.fire();
55 // LogDebug("NeutronReader") << "Number of neutron events to add: "
56 //std::cout << "Number of neutron events to add for chamber type " << chamberType << " : "
57 // << nEventsToAdd << " mean " << meanNumberOfEvents << std::endl;
58 // << nEventsToAdd << " mean " << meanNumberOfEvents;
59 
60  for(int i = 0; i < nEventsToAdd; ++i) {
61  // find the time for this event
62  float timeOffset = CLHEP::RandFlat::shoot(engine, theStartTime, theEndTime);
63  vector<PSimHit> neutronHits;
64  theHitReader->readNextEvent(chamberType, neutronHits);
65 
66  for( vector<PSimHit>::const_iterator neutronHitItr = neutronHits.begin();
67  neutronHitItr != neutronHits.end(); ++neutronHitItr)
68  {
69  const PSimHit & rawHit = *neutronHitItr;
70  // do the time offset and local det id
71  int det = detId(chamberIndex, rawHit.detUnitId());
72  PSimHit hit(rawHit.entryPoint(), rawHit.exitPoint(), rawHit.pabs(),
73  rawHit.tof()+timeOffset,
74  rawHit.energyLoss(), rawHit.particleType(),
75  det, rawHit.trackId(),
76  rawHit.thetaAtEntry(), rawHit.phiAtEntry(), rawHit.processType());
77 //std::cout << "NEWHIT " << hit << std::endl;
78  result.push_back(hit);
79  }
80 
81  }
82  theChambersDone.push_back(chamberIndex);
83  }
84 }
std::vector< double > theEventOccupancy
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
Geom::Theta< float > thetaAtEntry() const
fast and more accurate access to momentumAtEntry().theta()
Definition: PSimHit.h:57
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< int > theChambersDone
just makes sure chambers aren&#39;t done twice
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
virtual int detId(int chamberIndex, int localDetId)=0
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
float theEventsInWindow
how many collsions happened between theStartTime and theEndTime
unsigned short processType() const
Definition: PSimHit.h:118
virtual void readNextEvent(int chamberType, edm::PSimHitContainer &result)=0
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
int particleType() const
Definition: PSimHit.h:85
unsigned int trackId() const
Definition: PSimHit.h:102
Geom::Phi< float > phiAtEntry() const
fast and more accurate access to momentumAtEntry().phi()
Definition: PSimHit.h:60
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
unsigned int detUnitId() const
Definition: PSimHit.h:93

Member Data Documentation

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

just makes sure chambers aren't done twice

Definition at line 47 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise().

float SubsystemNeutronReader::theEndTime
private

Definition at line 53 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().

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

Definition at line 57 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise().

float SubsystemNeutronReader::theEventsInWindow
private

how many collsions happened between theStartTime and theEndTime

Definition at line 55 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().

NeutronReader* SubsystemNeutronReader::theHitReader
private
float SubsystemNeutronReader::theLuminosity
private

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

Definition at line 51 of file SubsystemNeutronReader.h.

Referenced by SubsystemNeutronReader().

float SubsystemNeutronReader::theStartTime
private

Definition at line 52 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().