CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HPDNoiseLibraryReader.h
Go to the documentation of this file.
1 
2 // --------------------------------------------------------
3 // A class to read HPD noise from the library.
4 // The deliverable of the class is the collection of
5 // noisy HcalDetIds with associated noise in units of fC for
6 // 10 time samples. During the library production a higher
7 // theshold is used to find a noisy HPD. A lower threshold is
8 // used to eliminate adding unnecessary quite channels to HPD
9 // noise event collection. Therefore user may not see whole 18
10 // channels for noisy HPD.
11 //
12 // Project: HPD noise library reader
13 // Author: T.Yetkin University of Iowa, Feb. 7, 2008
14 // --------------------------------------------------------
15 
16 #ifndef HcalSimAlgos_HPDNoiseLibraryReader_h
17 #define HcalSimAlgos_HPDNoiseLibraryReader_h
18 
19 #include <memory>
20 #include <utility>
21 #include <iostream>
22 #include <vector>
23 #include <string>
24 
33 // Hcal Geometry
35 // HPD Noise Data Frame
38 // CLHEP Random numbers
39 #include "CLHEP/Random/RandFlat.h"
40 #include "CLHEP/Random/RandGaussQ.h"
41 #include "TMath.h"
42 
44 
45  public:
48  // collection of noisy detIds
49  std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds();
50  // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
51  std::vector<std::pair <HcalDetId, const float* > > getBiasedNoisyHcalDetIds();
52 
53 
54  std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds(int timeSliceId);
55  // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
56  std::vector < std::pair < HcalDetId, const float *> >getBiasedNoisyHcalDetIds(int timeSliceId);
63  double getIonFeedbackNoise(HcalDetId id, double energy, double bias);
64  // to be used for standalone tests (from R. Wilkinson)
65  // taken from SimGeneral/NoiseGenerators/interface/CorrelatedNoisifier.h
66  static void initializeServices();
67  protected:
68  void setRandomEngine();
69  void setRandomEngine(CLHEP::HepRandomEngine & engine);
70  private:
71  HPDNoiseData* getNoiseData(int iphi);
72  // reads external file provided by the user in /data directrory
73  // and fill rate for each HPD.
74  void fillRates();
75  // compares noise rates for each HPD with randomly thrown numbers
76  // and returns the collection of Phis.
77  void getNoisyPhis();
78  // same as above. The only difference is that at least one phi is
79  // always noisy
80  void getBiasedNoisyPhis();
81  // check if noise is applicable the the HPD
82  bool IsNoiseApplicable(int iphi);
83 
84  //normal random number
85  void Rannor(double &a, double &b);
86 
87  // clear phi vector
88  void clearPhi();
89  // use int iphi to create HPD names
90  std::string itos(int i); // convert int to string
91 
92  void shuffleData(int timeSliceId, float* &data);
93 
94  public:
95  //members
96  std::vector<float> theDischargeNoiseRate;
97  std::vector<float> theIonFeedbackFirstPeakRate;
98  std::vector<float> theIonFeedbackSecondPeakRate;
99  std::vector<int> theNoisyPhi;
100  CLHEP::RandFlat * theRandFlat;
101  CLHEP::RandGaussQ* theRandGaussQ;
103  std::vector <std::string> theNames;
105 
106 };
107 #endif
int i
Definition: DBlmapReader.cc:9
std::vector< float > theIonFeedbackFirstPeakRate
CLHEP::RandGaussQ * theRandGaussQ
HPDNoiseLibraryReader(const edm::ParameterSet &)
std::vector< std::pair< HcalDetId, const float * > > getBiasedNoisyHcalDetIds()
double getIonFeedbackNoise(HcalDetId id, double energy, double bias)
std::vector< int > theNoisyPhi
std::vector< float > theIonFeedbackSecondPeakRate
std::vector< std::string > theNames
std::vector< std::pair< HcalDetId, const float * > > getNoisyHcalDetIds()
void Rannor(double &a, double &b)
double b
Definition: hdecay.h:120
std::vector< float > theDischargeNoiseRate
CLHEP::RandFlat * theRandFlat
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double a
Definition: hdecay.h:121
HPDNoiseData * getNoiseData(int iphi)
void shuffleData(int timeSliceId, float *&data)