CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimG4CMS/Calo/interface/CaloTrkProcessing.h

Go to the documentation of this file.
00001 #ifndef SimG4CMS_CaloTrkProcessing_H
00002 #define SimG4CMS_CaloTrkProcessing_H
00003 
00004 #include "DetectorDescription/Core/interface/DDsvalues.h"
00005 #include "SimG4Core/Notification/interface/Observer.h"
00006 #include "SimG4Core/SensitiveDetector/interface/SensitiveCaloDetector.h"
00007 
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 
00010 #include "G4VTouchable.hh"
00011 
00012 #include <map>
00013 #include <vector>
00014 #include <string>
00015 #include <iostream>
00016 
00017 class SimTrackManager;
00018 class BeginOfEvent;
00019 class G4LogicalVolume;
00020 class G4Step;
00021 
00022 class CaloTrkProcessing : public SensitiveCaloDetector, 
00023                           public Observer<const BeginOfEvent *>,
00024                           public Observer<const G4Step *> {
00025 
00026 public:
00027 
00028   CaloTrkProcessing(G4String aSDname, const DDCompactView & cpv,
00029                     SensitiveDetectorCatalog & clg, 
00030                     edm::ParameterSet const & p, const SimTrackManager*);
00031   virtual ~CaloTrkProcessing();
00032   virtual void             Initialize(G4HCofThisEvent * ) {}
00033   virtual void             clearHits() {}
00034   virtual bool             ProcessHits(G4Step * , G4TouchableHistory * ) {
00035     return true;
00036   }
00037   virtual uint32_t         setDetUnitId(G4Step * step) {return 0;}
00038   virtual void             EndOfEvent(G4HCofThisEvent * ) {}
00039   void                     fillHits(edm::PCaloHitContainer&, std::string ) {}
00040 
00041 private:
00042 
00043   void                     update(const BeginOfEvent * evt);
00044   void                     update(const G4Step *);
00045   std::vector<std::string> getNames(G4String, const DDsvalues_type&);
00046   std::vector<double>      getNumbers(G4String, const DDsvalues_type&);
00047   int                      isItCalo(const G4VTouchable*);
00048   int                      isItInside(const G4VTouchable*, int, int);
00049 
00050 
00051   struct Detector {
00052     Detector() {}
00053     std::string                   name;
00054     G4LogicalVolume*              lv;
00055     int                           level;
00056     std::vector<std::string>      fromDets; 
00057     std::vector<G4LogicalVolume*> fromDetL;
00058     std::vector<int>              fromLevels;
00059   };
00060   
00061   // Utilities to get detector levels during a step
00062   int                      detLevels(const G4VTouchable*) const;
00063   G4LogicalVolume*         detLV(const G4VTouchable*, int) const;
00064   void                     detectorLevel(const G4VTouchable*, int&, int*,
00065                                          G4String*) const;
00066 
00067   bool                     testBeam, putHistory;
00068   double                   eMin;
00069   int                      lastTrackID;
00070   std::vector<Detector>    detectors;
00071   const SimTrackManager*   m_trackManager;
00072 };
00073 
00074 #endif
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082