CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
void setRandomEngine (CLHEP::HepRandomEngine &engine)
 
 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...
 
CLHEP::RandFlat * theRandFlat
 
CLHEP::RandPoissonQ * theRandPoisson
 
float theStartTime
 

Detailed Description

Definition at line 17 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, matplotRender::reader, theEndTime, theEventsInWindow, theHitReader, theLuminosity, and theStartTime.

14 : theHitReader(0),
15  theRandFlat(0),
16  theRandPoisson(0),
17  theLuminosity(pset.getParameter<double>("luminosity")), // in units of 10^34
18  theStartTime(pset.getParameter<double>("startTime")),
19  theEndTime(pset.getParameter<double>("endTime")),
20  theEventOccupancy(pset.getParameter<vector<double> >("eventOccupancy")) // TODO make map
21 {
22  // 17.3 collisions per live bx, 79.5% of bx live
23  float collisionsPerCrossing = 13.75 * theLuminosity;
24  int windowSize = (int)((theEndTime-theStartTime)/25.);
25  theEventsInWindow = collisionsPerCrossing * windowSize;
26  string reader = pset.getParameter<string>("reader");
28  if(reader == "ASCII")
29  {
30  theHitReader = new AsciiNeutronReader(input.fullPath());
31  }
32  else if (reader == "ROOT")
33  {
34  theHitReader = new RootNeutronReader(input.fullPath());
35  }
36 }
T getParameter(std::string const &) const
std::vector< double > theEventOccupancy
CLHEP::RandPoissonQ * theRandPoisson
static std::string const input
Definition: EdmProvDump.cc:44
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 39 of file SubsystemNeutronReader.cc.

References theHitReader, theRandFlat, and theRandPoisson.

39  {
40  delete theHitReader;
41  delete theRandFlat;
42  delete theRandPoisson;
43 }
CLHEP::RandPoissonQ * theRandPoisson

Member Function Documentation

void SubsystemNeutronReader::clear ( void  )
inline

Definition at line 32 of file SubsystemNeutronReader.h.

References theChambersDone.

32 {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 
)

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

Definition at line 54 of file SubsystemNeutronReader.cc.

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

Referenced by CSCNeutronReader::addHits().

56 {
57  // make sure this chamber hasn't been done before
58  if(find(theChambersDone.begin(), theChambersDone.end(), chamberIndex)
59  == theChambersDone.end())
60  {
61  float meanNumberOfEvents = theEventOccupancy[chamberType-1]
63  int nEventsToAdd = theRandPoisson->fire(meanNumberOfEvents);
64 // LogDebug("NeutronReader") << "Number of neutron events to add: "
65 //std::cout << "Number of neutron events to add for chamber type " << chamberType << " : "
66 // << nEventsToAdd << " mean " << meanNumberOfEvents << std::endl;
67 // << nEventsToAdd << " mean " << meanNumberOfEvents;
68 
69  for(int i = 0; i < nEventsToAdd; ++i) {
70  // find the time for this event
71  float timeOffset = theRandFlat->fire(theStartTime, theEndTime);
72  vector<PSimHit> neutronHits;
73  theHitReader->readNextEvent(chamberType, neutronHits);
74 
75  for( vector<PSimHit>::const_iterator neutronHitItr = neutronHits.begin();
76  neutronHitItr != neutronHits.end(); ++neutronHitItr)
77  {
78  const PSimHit & rawHit = *neutronHitItr;
79  // do the time offset and local det id
80  int det = detId(chamberIndex, rawHit.detUnitId());
81  PSimHit hit(rawHit.entryPoint(), rawHit.exitPoint(), rawHit.pabs(),
82  rawHit.tof()+timeOffset,
83  rawHit.energyLoss(), rawHit.particleType(),
84  det, rawHit.trackId(),
85  rawHit.thetaAtEntry(), rawHit.phiAtEntry(), rawHit.processType());
86 //std::cout << "NEWHIT " << hit << std::endl;
87  result.push_back(hit);
88  }
89 
90  }
91  theChambersDone.push_back(chamberIndex);
92  }
93 }
std::vector< double > theEventOccupancy
int i
Definition: DBlmapReader.cc:9
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
CLHEP::RandPoissonQ * theRandPoisson
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
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
tuple result
Definition: query.py:137
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
void SubsystemNeutronReader::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 46 of file SubsystemNeutronReader.cc.

References theRandFlat, and theRandPoisson.

Referenced by CSCDigitizer::setRandomEngine().

47 {
48  theRandFlat = new CLHEP::RandFlat(engine);
49  theRandPoisson = new CLHEP::RandPoissonQ(engine);
50 }
CLHEP::RandPoissonQ * theRandPoisson

Member Data Documentation

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

just makes sure chambers aren't done twice

Definition at line 48 of file SubsystemNeutronReader.h.

Referenced by clear(), and generateChamberNoise().

float SubsystemNeutronReader::theEndTime
private

Definition at line 54 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().

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

Definition at line 58 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise().

float SubsystemNeutronReader::theEventsInWindow
private

how many collsions happened between theStartTime and theEndTime

Definition at line 56 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 52 of file SubsystemNeutronReader.h.

Referenced by SubsystemNeutronReader().

CLHEP::RandFlat* SubsystemNeutronReader::theRandFlat
private
CLHEP::RandPoissonQ* SubsystemNeutronReader::theRandPoisson
private
float SubsystemNeutronReader::theStartTime
private

Definition at line 53 of file SubsystemNeutronReader.h.

Referenced by generateChamberNoise(), and SubsystemNeutronReader().