CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/SimCalorimetry/HcalSimAlgos/interface/HPDNoiseLibraryReader.h

Go to the documentation of this file.
00001 
00002 // --------------------------------------------------------
00003 // A class to read HPD noise from the library.
00004 // The deliverable of the class is the collection of
00005 // noisy HcalDetIds with associated noise in units of fC for
00006 // 10 time samples. During the library production a higher
00007 // theshold is used to find a noisy HPD. A lower threshold is
00008 // used to eliminate adding unnecessary quite channels to HPD 
00009 // noise event collection. Therefore user may not see whole 18 
00010 // channels for noisy HPD.
00011 //
00012 // Project: HPD noise library reader
00013 // Author: T.Yetkin University of Iowa, Feb. 7, 2008
00014 // $Id: HPDNoiseLibraryReader.h,v 1.3 2008/09/19 17:03:50 tyetkin Exp $
00015 // --------------------------------------------------------
00016 
00017 #ifndef HcalSimAlgos_HPDNoiseLibraryReader_h
00018 #define HcalSimAlgos_HPDNoiseLibraryReader_h
00019 
00020 #include <memory>
00021 #include <utility>
00022 #include <iostream>
00023 #include <vector>
00024 #include <string>
00025 
00026 #include "FWCore/ParameterSet/interface/FileInPath.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00029 #include "FWCore/ServiceRegistry/interface/Service.h"
00030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00031 #include "FWCore/PluginManager/interface/PluginManager.h"
00032 #include "FWCore/PluginManager/interface/standard.h"
00033 #include "FWCore/Utilities/interface/Exception.h"
00034 // Hcal Geometry
00035 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00036 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00037 // HPD Noise Data Frame
00038 #include "SimCalorimetry/HcalSimAlgos/interface/HPDNoiseReader.h"
00039 #include "SimCalorimetry/HcalSimAlgos/interface/HPDNoiseData.h"
00040 // CLHEP Random numbers
00041 #include "CLHEP/Random/RandFlat.h"
00042 #include "CLHEP/Random/RandGaussQ.h"
00043 #include "TMath.h"
00044 
00045 class HPDNoiseLibraryReader{
00046   
00047   public:
00048     HPDNoiseLibraryReader(const edm::ParameterSet&);
00049     ~HPDNoiseLibraryReader();
00050     // collection of noisy detIds 
00051     std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds();
00052     // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
00053     std::vector<std::pair <HcalDetId, const float* > > getBiasedNoisyHcalDetIds();
00054 
00055 
00056     std::vector<std::pair <HcalDetId, const float* > > getNoisyHcalDetIds(int timeSliceId);
00057     // collection of noisy detIds. At least one HcalDetId is alwasy noiosy
00058     std::vector < std::pair < HcalDetId, const float *> >getBiasedNoisyHcalDetIds(int timeSliceId);
00065     double getIonFeedbackNoise(HcalDetId id, double energy, double bias);
00066     // to be used for standalone tests (from R. Wilkinson)
00067     // taken from SimGeneral/NoiseGenerators/interface/CorrelatedNoisifier.h
00068     static void initializeServices();
00069   protected:
00070     void setRandomEngine();
00071     void setRandomEngine(CLHEP::HepRandomEngine & engine);
00072   private:
00073     HPDNoiseData* getNoiseData(int iphi);
00074     // reads external file provided by the user in /data directrory
00075     // and fill rate for each HPD.
00076     void fillRates();
00077     // compares noise rates for each HPD with randomly thrown numbers
00078     // and returns the collection of Phis.
00079     void getNoisyPhis();
00080     // same as above. The only difference is that at least one phi is
00081     // always noisy
00082     void getBiasedNoisyPhis();
00083     // check if noise is applicable the the HPD
00084     bool IsNoiseApplicable(int iphi);
00085     
00086     //normal random number
00087     void Rannor(double &a, double &b);
00088     
00089     // clear phi vector
00090     void clearPhi();
00091     // use int iphi to create HPD names
00092     std::string itos(int i);    // convert int to string
00093     
00094     void shuffleData(int timeSliceId, float* &data);
00095   
00096   public: 
00097     HcalTopology  theTopology;
00098     
00099     //members
00100     std::vector<float> theDischargeNoiseRate;
00101     std::vector<float> theIonFeedbackFirstPeakRate;
00102     std::vector<float> theIonFeedbackSecondPeakRate;
00103     std::vector<int>   theNoisyPhi;
00104     CLHEP::RandFlat *     theRandFlat;
00105     CLHEP::RandGaussQ*    theRandGaussQ; 
00106     HPDNoiseReader* theReader;
00107     std::vector <std::string> theNames;
00108     std::string theHPDName;
00109     
00110 };
00111 #endif