Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:06

0001 #ifndef _EcalSimHitsValidProducer_h
0002 #define _EcalSimHitsValidProducer_h
0003 #include <map>
0004 #include <string>
0005 #include <vector>
0006 
0007 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0008 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0009 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "SimG4Core/Notification/interface/Observer.h"
0012 #include "SimG4Core/Watcher/interface/SimProducer.h"
0013 
0014 #include "DataFormats/Math/interface/LorentzVector.h"
0015 
0016 class BeginOfEvent;
0017 class G4Step;
0018 class EndOfEvent;
0019 class PEcalValidInfo;
0020 
0021 namespace edm {
0022   class ParameterSet;
0023 }
0024 
0025 class EcalSimHitsValidProducer : public SimProducer,
0026                                  public Observer<const BeginOfEvent *>,
0027                                  public Observer<const G4Step *>,
0028                                  public Observer<const EndOfEvent *> {
0029   typedef std::vector<float> FloatVector;
0030   typedef std::map<uint32_t, float, std::less<uint32_t>> MapType;
0031 
0032 public:
0033   EcalSimHitsValidProducer(const edm::ParameterSet &);
0034   EcalSimHitsValidProducer(const EcalSimHitsValidProducer &) = delete;                   // stop default
0035   const EcalSimHitsValidProducer &operator=(const EcalSimHitsValidProducer &) = delete;  // stop default
0036   ~EcalSimHitsValidProducer() override;
0037 
0038   void produce(edm::Event &, const edm::EventSetup &) override;
0039 
0040 private:
0041   void update(const BeginOfEvent *) override;
0042   void update(const G4Step *) override;
0043   void update(const EndOfEvent *) override;
0044 
0045   void fillEventInfo(PEcalValidInfo &);
0046 
0047 private:
0048   uint32_t getUnitWithMaxEnergy(MapType &themap);
0049 
0050   float energyInEEMatrix(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap);
0051   float energyInEBMatrix(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap);
0052 
0053   bool fillEEMatrix(
0054       int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap);
0055 
0056   bool fillEBMatrix(
0057       int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap);
0058 
0059   float eCluster2x2(MapType &themap);
0060   float eCluster4x4(float e33, MapType &themap);
0061 
0062 private:
0063   float ee1;
0064   float ee4;
0065   float ee9;
0066   float ee16;
0067   float ee25;
0068 
0069   float eb1;
0070   float eb4;
0071   float eb9;
0072   float eb16;
0073   float eb25;
0074 
0075   float totalEInEE;
0076   float totalEInEB;
0077   float totalEInES;
0078 
0079   float totalEInEEzp;
0080   float totalEInEEzm;
0081   float totalEInESzp;
0082   float totalEInESzm;
0083 
0084   int totalHits;
0085   int nHitsInEE;
0086   int nHitsInEB;
0087   int nHitsInES;
0088   int nHitsIn1ES;
0089   int nHitsIn2ES;
0090   int nCrystalInEB;
0091   int nCrystalInEEzp;
0092   int nCrystalInEEzm;
0093 
0094   int nHitsIn1ESzp;
0095   int nHitsIn1ESzm;
0096   int nHitsIn2ESzp;
0097   int nHitsIn2ESzm;
0098 
0099   float eBX0[26];
0100   float eEX0[26];
0101 
0102   FloatVector eOf1ES;
0103   FloatVector eOf2ES;
0104   FloatVector eOf1ESzp;
0105   FloatVector eOf1ESzm;
0106   FloatVector eOf2ESzp;
0107   FloatVector eOf2ESzm;
0108 
0109   FloatVector zOfES;
0110   FloatVector phiOfEECaloG4Hit;
0111   FloatVector etaOfEECaloG4Hit;
0112   FloatVector tOfEECaloG4Hit;
0113   FloatVector eOfEECaloG4Hit;
0114   FloatVector eOfEEPlusCaloG4Hit;
0115   FloatVector eOfEEMinusCaloG4Hit;
0116 
0117   FloatVector phiOfEBCaloG4Hit;
0118   FloatVector etaOfEBCaloG4Hit;
0119   FloatVector tOfEBCaloG4Hit;
0120   FloatVector eOfEBCaloG4Hit;
0121 
0122   FloatVector phiOfESCaloG4Hit;
0123   FloatVector etaOfESCaloG4Hit;
0124   FloatVector tOfESCaloG4Hit;
0125   FloatVector eOfESCaloG4Hit;
0126 
0127   math::XYZTLorentzVector theMomentum;
0128   math::XYZTLorentzVector theVertex;
0129 
0130   int thePID;
0131   std::string label;
0132 };
0133 
0134 #endif