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.3 2008/09/19 17:03:50 tyetkin 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
37 // HPD Noise Data Frame
40 // CLHEP Random numbers
41 #include "CLHEP/Random/RandFlat.h"
42 #include "CLHEP/Random/RandGaussQ.h"
43 #include "TMath.h"
44 
46 
47  public:
50  // collection of noisy detIds
51  std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds();
52  // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
53  std::vector<std::pair <HcalDetId, const float* > > getBiasedNoisyHcalDetIds();
54 
55 
56  std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds(int timeSliceId);
57  // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
58  std::vector < std::pair < HcalDetId, const float *> >getBiasedNoisyHcalDetIds(int timeSliceId);
65  double getIonFeedbackNoise(HcalDetId id, double energy, double bias);
66  // to be used for standalone tests (from R. Wilkinson)
67  // taken from SimGeneral/NoiseGenerators/interface/CorrelatedNoisifier.h
68  static void initializeServices();
69  protected:
70  void setRandomEngine();
71  void setRandomEngine(CLHEP::HepRandomEngine & engine);
72  private:
73  HPDNoiseData* getNoiseData(int iphi);
74  // reads external file provided by the user in /data directrory
75  // and fill rate for each HPD.
76  void fillRates();
77  // compares noise rates for each HPD with randomly thrown numbers
78  // and returns the collection of Phis.
79  void getNoisyPhis();
80  // same as above. The only difference is that at least one phi is
81  // always noisy
82  void getBiasedNoisyPhis();
83  // check if noise is applicable the the HPD
84  bool IsNoiseApplicable(int iphi);
85 
86  //normal random number
87  void Rannor(double &a, double &b);
88 
89  // clear phi vector
90  void clearPhi();
91  // use int iphi to create HPD names
92  std::string itos(int i); // convert int to string
93 
94  void shuffleData(int timeSliceId, float* &data);
95 
96  public:
98 
99  //members
100  std::vector<float> theDischargeNoiseRate;
101  std::vector<float> theIonFeedbackFirstPeakRate;
102  std::vector<float> theIonFeedbackSecondPeakRate;
103  std::vector<int> theNoisyPhi;
104  CLHEP::RandFlat * theRandFlat;
105  CLHEP::RandGaussQ* theRandGaussQ;
107  std::vector <std::string> theNames;
108  std::string theHPDName;
109 
110 };
111 #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)