CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/FastSimulation/CaloRecHitsProducer/interface/EcalEndcapRecHitsMaker.h

Go to the documentation of this file.
00001 #ifndef FastSimulation__EcalEndcapRecHitsMaker__h
00002 #define FastSimulation__EcalEndcapRecHitsMaker__h
00003 
00004 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00005 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00006 #include "FWCore/Utilities/interface/InputTag.h"
00007 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00008 //#include <boost/cstdint.hpp>
00009 
00010 class RandomEngine;
00011 class EcalTrigTowerConstituentsMap;
00012 class GaussianTail;
00013 
00014 namespace edm { 
00015   class ParameterSet;
00016   class Event;
00017   class EventSetup;
00018 }
00019 
00020 class EcalEndcapRecHitsMaker
00021 {
00022  public:
00023   EcalEndcapRecHitsMaker(edm::ParameterSet const & p,const RandomEngine* random);
00024   ~EcalEndcapRecHitsMaker();
00025 
00026   void loadEcalEndcapRecHits(edm::Event &iEvent, EERecHitCollection & ecalHits,EEDigiCollection & ecalDigis);
00027   void init(const edm::EventSetup &es,bool dodigis,bool domiscalib);
00028 
00029  private:
00030   void clean();
00031   void loadPCaloHits(const edm::Event & iEvent);
00032   void geVtoGainAdc(float e,unsigned & gain, unsigned &adc) const;
00033   // there are 2448 TT in the barrel. 
00034   inline int TThashedIndexforEE(int originalhi) const {return originalhi-2448;}
00035   inline int TThashedIndexforEE(const EcalTrigTowerDetId &detid) const {return detid.hashedIndex()-2448;}
00036   // the number of the SuperCrystals goes from 1 to 316 (with some holes) in each EE
00037   // z should -1 or 1 
00038   inline  int SChashedIndex(int SC,int z) const {return SC+(z+1)*158;}
00039   inline int SChashedIndex(const EEDetId& detid) const {
00040     //    std::cout << "In SC hashedIndex " <<  detid.isc() << " " << detid.zside() << " " << detid.isc()+(detid.zside()+1)*158 << std::endl;
00041     return detid.isc()+(detid.zside()+1)*158;}
00042   inline int towerOf(const EEDetId& detid) const {return towerOf_[detid.hashedIndex()];}
00043   inline int towerOf(int hid) const {return towerOf_[hid];}
00044   void noisifyTriggerTowers();
00045   void noisifySuperCrystals(int tthi);
00046   void randomNoisifier();
00047   bool isHighInterest(const EEDetId & icell);
00048 
00049  private:
00050   edm::InputTag inputCol_;
00051   bool doDigis_;
00052   bool doMisCalib_;
00053   double refactor_;
00054   double refactor_mean_;
00055   // poor-man Selective Readout
00056   double threshold_;
00057   double noise_;
00058   double calibfactor_;
00059   double EEHotFraction_ ;
00060   const RandomEngine* random_;
00061   const GaussianTail * myGaussianTailGenerator_;
00062   bool noisified_;
00063 
00064   // array (size = 20000) of the energy in the barrel
00065   std::vector<float> theCalorimeterHits_;
00066   // array of the hashedindices in the previous array of the cells that received a hit
00067   std::vector<int> theFiredCells_;
00068   // array of the hashedindices in the previous array of the cells that received a hit
00069   std::vector<int> applyZSCells_;
00070 
00071   // equivalent of the EcalIntercalibConstants from RecoLocalCalo/EcalRecProducers/src/EcalRecHitProduer.cc
00072   std::vector<float> theCalibConstants_;
00073 
00074   //array conversion hashedIndex rawId
00075   std::vector<uint32_t> endcapRawId_;
00076 
00077   
00078   // digitization
00079   float adcToGeV_;
00080   float geVToAdc1_,geVToAdc2_,geVToAdc3_;
00081   unsigned minAdc_;
00082   unsigned maxAdc_;
00083   float t1_,t2_,sat_;
00084 
00085   const EcalTrigTowerConstituentsMap* eTTmap_;  
00086 
00087   // arraws for the selective readout emulation
00088   // fast EEDetId -> TT hashedindex conversion
00089   std::vector<int>  towerOf_;
00090   // vector of the original DetId if needed
00091   std::vector<EcalTrigTowerDetId> theTTDetIds_;
00092   // list of SC "contained" in a TT.
00093   std::vector<std::vector<int> > SCofTT_;
00094   // list of TT of a given sc
00095   std::vector<std::vector<int> > TTofSC_;
00096   // status of each SC 
00097   std::vector<bool> treatedSC_;
00098   std::vector<int> SCHighInterest_;
00099   // list of fired SC
00100   std::vector<int> theFiredSC_;
00101   // the list of fired TT
00102   std::vector<int> theFiredTTs_;
00103   // the energy in the TT
00104   std::vector<float> TTTEnergy_;
00105   // the cells in each SC
00106   std::vector<std::vector<int> > CrystalsinSC_;
00107   // the sin(theta) of the cell
00108   std::vector<float> sinTheta_;
00109 
00110   // the cell-dependant noise sigma 
00111   std::vector<float> noisesigma_;
00112   double meanNoiseSigmaEt_ ;
00113   // noise in ADC counts
00114   double noiseADC_;
00115   // selective readout threshold
00116   float SRThreshold_;
00117   // need to keep the address of ICMC
00118   const std::vector<float> * ICMC_;
00119   // vector of parameter for custom noise simulation (size =4 : 0 & 1 define the gaussian shape 
00120   // of the noise ; 2 & 3 define the sigma and threshold in ADC counts of the *OFFLINE* amplitude
00121 
00122   std::vector<double> highNoiseParameters_ ; 
00123   bool doCustomHighNoise_;
00124 };
00125 
00126 #endif