Print

Print


Commit in lcdd/include on MAIN
G4SensitiveDetector.hh+83-201.18 -> 1.19
commit changes for multiple read out

lcdd/include
G4SensitiveDetector.hh 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- G4SensitiveDetector.hh	10 Oct 2007 22:38:09 -0000	1.18
+++ G4SensitiveDetector.hh	11 Dec 2007 20:56:55 -0000	1.19
@@ -37,6 +37,11 @@
 		      G4String hcName,
 		      EType sdType);
 
+  G4SensitiveDetector(G4String sdName,
+		      G4String hcName[],
+                      G4int NrofHC,
+		      EType sdType);
+
   virtual ~G4SensitiveDetector();
 
 public:
@@ -78,9 +83,23 @@
    */
   inline G4int getHCID() const
   {
-    return m_HCID;
+    return      HCID_vector[0];
+  }
+
+ inline G4int getHCID(G4int nHC) const
+  {
+   if (nHC>m_NrofHC+1||nHC<0){
+   G4cout << this->GetName() << "getHCID Nr of HC"<< nHC << "not valid"<<  G4endl;
+   return -1;
+    }  
+    return      HCID_vector[nHC];  
+  }
+ inline G4int getNrofHC() const
+  {
+   return m_NrofHC;
   }
 
+
   /**
    * Check whether the G4LogicalVolume can be readout by this detector. 
    * Base function just returns if the volume was assigned to this detector.
@@ -99,6 +118,11 @@
     return collectionName[0];
   }
 
+  inline const std::string& getHCName(G4int nHC) const
+  { 
+    return collectionName[nHC];
+  }
+
   /**
    * Set the verbosity level of this detector.
    */
@@ -121,7 +145,11 @@
    */
   inline G4double getEcut()
   {
-    return m_ecut;
+    return ecut_vector[0];
+  }
+  inline G4double getEcut(G4int nHC)
+  {
+    return ecut_vector[nHC];
   }
 
   /**
@@ -129,24 +157,50 @@
    */
   inline void setEcut(G4double ec)
   {
-    G4cout << this->GetName() << " - hit energy cut set to " << ec << G4endl;
-    m_ecut = ec;
+    G4cout << this->GetName() << " - hit energy cut for HC 0 set to " << ec << G4endl;
+    ecut_vector[0]=ec; 
+  }
+
+  inline void setEcut(G4double ec,G4int nHC)
+  {
+    if (nHC>m_NrofHC+1||nHC<0){
+   G4cout << this->GetName() << "setEcut Nr of HC"<< nHC << "not valid"<<  G4endl;
+    }   
+    G4cout << this->GetName() << " - hit energy cut for HC:  "<< nHC<<"   set to " << ec << G4endl;
+    ecut_vector[nHC]=ec; 
   }
 
+
   /**
    * Set the identifier specification for this detector.
    */
   inline void setIdSpec(IdSpec* idspec)
   {
-    m_idspec = idspec;
+    idspec_vector[0] = idspec;
   }
 
+  inline void setIdSpec(IdSpec* idspec,G4int nHC)
+  {
+    if (nHC>m_NrofHC+1||nHC<0){
+     G4cout << this->GetName() << " setIdSpec Nr of HC"<< nHC << "not valid"<<  G4endl;
+    }   
+
+    idspec_vector[nHC] = idspec; 
+  }
+
+
+
+
   /**
    * Return the identifier specification for this detector.
    */
   inline IdSpec* getIdSpec() const
   {
-    return m_idspec;
+    return idspec_vector[0];
+  }
+  inline IdSpec* getIdSpec(G4int nHC) const
+  {
+    return idspec_vector[nHC];
   }
 
   /**
@@ -154,7 +208,7 @@
    */
   inline bool hasIdSpec() const
   {
-    return ( m_idspec != 0 );
+    return ( idspec_vector[0] != 0 );
   }
 
   /**
@@ -208,13 +262,14 @@
    * using the hits collection ID (HCID).
    */
   G4VHitsCollection* getHitsCollection() const;
+  G4VHitsCollection* getHitsCollection(G4int) const;
 
   /**
    * Return the number of hits.  The m_nhits variable should
    * be set by a subclass for this value to have any meaning.
    */
-  inline int getNumberOfHits() const { return m_nhits;}
-
+  inline int getNumberOfHits()          const { return nhits_vector[0];}
+  inline int getNumberOfHits(G4int nHC) const { return nhits_vector[nHC];}
   /**
    * Return the total energy deposition from the hits of this detector.
    * Requires access to concrete hit types, so this function must be
@@ -235,25 +290,32 @@
    */
   inline void setHCID(G4int hcid)
   {
-    m_HCID = hcid;
+    HCID_vector[0]=hcid;
   }
 
-protected:
-
-  // hit collection id
-  G4int m_HCID;
-
-  // energy cut
-  G4double m_ecut;
+  inline void setHCID(G4int hcid,G4int nHC)
+  {
+    if (nHC>m_NrofHC+1||nHC<0){
+   G4cout << this->GetName() << "setHCID Nr of HC"<< nHC << "not valid"<<  G4endl;
+    }   
+   HCID_vector[nHC]=hcid; 
+  }
 
+protected:
+  // Number of Hit Collections
+  G4int m_NrofHC;
+  // vector containing Hit Collection ID's
+  std::vector<G4int> HCID_vector;
+  // vector containing ecuts for the various collections
+  std::vector<G4double> ecut_vector;
   // verbosity
   unsigned int m_verbose;
 
   // endcap flag for LCIO's CHBIT_BARREL bit
   bool m_endcap;
 
-  // pointer to IdSpec
-  IdSpec* m_idspec;
+  // vector containing pointer to IdSpec
+  std::vector<IdSpec*> idspec_vector;
 
 private:
 
@@ -265,7 +327,8 @@
 
 protected:
   // Hit counter.
-  int m_nhits;
+  // vector containing Hit Counters
+  std::vector<int> nhits_vector;
 };
 
 #endif
CVSspam 0.2.8