From c8c4c519a90f1020f0b3c448af4e4b0012f7dd0b Mon Sep 17 00:00:00 2001
From: Savannah Rose Shively <savannah.rose.shively@cern.ch>
Date: Fri, 9 Oct 2020 18:49:25 +0200
Subject: [PATCH] add veto and trigger

---
 .../SimHitExample/src/SimHitAlg.cxx           | 43 ++++++++++---------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx b/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx
index 82fec214..9a718022 100644
--- a/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx
+++ b/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx
@@ -18,7 +18,7 @@ StatusCode SimHitAlg::initialize()
     ATH_CHECK(histSvc()->regHist("/HIST/modulesSide1", m_moduleSide1));
     ATH_CHECK(histSvc()->regHist("/HIST/modulesSide2", m_moduleSide2));
 
-    m_plate = new TH2D("plate", "Scint Hit Plate", 3, -1.5, 1.5, 4, -0.5, 3.5 );
+    m_plate = new TH2D("plate", "Scint Hit Plate", 3, -1, 1, 4, 0, 1 );
     ATH_CHECK(histSvc()->regHist("/HIST/plates", m_plate));
 
     // initialize data handle keys
@@ -54,11 +54,11 @@ StatusCode SimHitAlg::execute()
     ATH_MSG_INFO("Read FaserSiHitCollection with " << h_siHits->size() << " hits");
 
     SG::ReadHandle<ScintHitCollection> h_preshowerHits(m_preshowerHitKey);
-    ATH_MSG_INFO("Read ScintHitCollection with " << h_preshowerHits->size() << " hits");
+    ATH_MSG_INFO("Read ScintHitCollection/Preshower with " << h_preshowerHits->size() << " hits");
     SG::ReadHandle<ScintHitCollection> h_triggerHits(m_triggerHitKey);
-    ATH_MSG_INFO("Read ScintHitCollection with " << h_triggerHits->size() << " hits");
+    ATH_MSG_INFO("Read ScintHitCollection/Trigger with " << h_triggerHits->size() << " hits");
     SG::ReadHandle<ScintHitCollection> h_vetoHits(m_vetoHitKey);
-    ATH_MSG_INFO("Read ScintHitCollection with " << h_vetoHits->size() << " hits");
+    ATH_MSG_INFO("Read ScintHitCollectionVeto with " << h_vetoHits->size() << " hits");
     
 
     // Since we have no pile-up, there should always be a single GenEvent in the container
@@ -71,8 +71,9 @@ StatusCode SimHitAlg::execute()
     ATH_MSG_INFO("Event contains " << ev->particles_size() << " truth particles" );
 
     // The hit container might be empty because particles missed the wafers
-    if (h_siHits->size() == 0) return StatusCode::SUCCESS;
-    else{
+    //if (h_siHits->size() == 0) return StatusCode::SUCCESS;
+
+    if (h_siHits->size()!=0){
         // Loop over all hits; print and fill histogram
         for (const FaserSiHit& hit : *h_siHits)
         {
@@ -94,31 +95,33 @@ StatusCode SimHitAlg::execute()
     if (h_preshowerHits->size()!=0){
         for (const ScintHit& hit : *h_preshowerHits)
         {
+            hit.print();
             m_hist->Fill(hit.energyLoss());
             m_plate->Fill(hit.getStation(),hit.getPlate());
 
         }
     }
-    
 
+    if (h_triggerHits->size()!=0){
+        for (const ScintHit& hit : *h_triggerHits)
+        {
+            hit.print();
+            m_hist->Fill(hit.energyLoss());
+            m_plate->Fill(hit.getStation(),hit.getPlate());
 
-    /*if (h_scintHits->size()!=0){
-        for (const ScintHit& hit : *h_scintHits)
+        }
+    }
+
+    if (h_vetoHits->size()!=0){
+        for (const ScintHit& hit : *h_vetoHits)
         {
             hit.print();
-            m_hist->Fill( hit.energyLoss() );
-            m_plate->Fill( hit.getStation(), hit.getPlate() );
-            /*if (hit.getSensor() == 0)
-            {
-                m_moduleSide1->Fill( hit.getModule(), hit.getRow());
-            }
-            else
-            {
-                m_moduleSide2->Fill( hit.getModule(), hit.getRow());
-            }//
+            m_hist->Fill(hit.energyLoss());
+            m_plate->Fill(hit.getStation(),hit.getPlate());
 
         }
-    }*/
+    }
+
 
     return StatusCode::SUCCESS;
 }
-- 
GitLab