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 // $Id: HPDNoiseLibraryReader.h,v 1.4 2012/08/28 14:50:42 yana Exp $
15 // --------------------------------------------------------
16 
17 #ifndef HcalSimAlgos_HPDNoiseLibraryReader_h
18 #define HcalSimAlgos_HPDNoiseLibraryReader_h
19 
20 #include <memory>
21 #include <utility>
22 #include <iostream>
23 #include <vector>
24 #include <string>
25 
34 // Hcal Geometry
36 // HPD Noise Data Frame
39 // CLHEP Random numbers
40 #include "CLHEP/Random/RandFlat.h"
41 #include "CLHEP/Random/RandGaussQ.h"
42 #include "TMath.h"
43 
45 
46  public:
49  // collection of noisy detIds
50  std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds();
51  // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
52  std::vector<std::pair <HcalDetId, const float* > > getBiasedNoisyHcalDetIds();
53 
54 
55  std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds(int timeSliceId);
56  // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
57  std::vector < std::pair < HcalDetId, const float *> >getBiasedNoisyHcalDetIds(int timeSliceId);
64  double getIonFeedbackNoise(HcalDetId id, double energy, double bias);
65  // to be used for standalone tests (from R. Wilkinson)
66  // taken from SimGeneral/NoiseGenerators/interface/CorrelatedNoisifier.h
67  static void initializeServices();
68  protected:
69  void setRandomEngine();
70  void setRandomEngine(CLHEP::HepRandomEngine & engine);
71  private:
72  HPDNoiseData* getNoiseData(int iphi);
73  // reads external file provided by the user in /data directrory
74  // and fill rate for each HPD.
75  void fillRates();
76  // compares noise rates for each HPD with randomly thrown numbers
77  // and returns the collection of Phis.
78  void getNoisyPhis();
79  // same as above. The only difference is that at least one phi is
80  // always noisy
81  void getBiasedNoisyPhis();
82  // check if noise is applicable the the HPD
83  bool IsNoiseApplicable(int iphi);
84 
85  //normal random number
86  void Rannor(double &a, double &b);
87 
88  // clear phi vector
89  void clearPhi();
90  // use int iphi to create HPD names
91  std::string itos(int i); // convert int to string
92 
93  void shuffleData(int timeSliceId, float* &data);
94 
95  public:
96  //members
97  std::vector<float> theDischargeNoiseRate;
98  std::vector<float> theIonFeedbackFirstPeakRate;
99  std::vector<float> theIonFeedbackSecondPeakRate;
100  std::vector<int> theNoisyPhi;
101  CLHEP::RandFlat * theRandFlat;
102  CLHEP::RandGaussQ* theRandGaussQ;
104  std::vector <std::string> theNames;
106 
107 };
108 #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)