SimDaqEnergyTrigger Class Reference

#include <SimDaqEnergyTrigger.h>

Inheritance diagram for SimDaqEnergyTrigger:
SimDaqTrigger

List of all members.

Public Member Functions

virtual Bool_t ApplyTriggerAt (PlexHandle plex, SimDigitList &sortedDigitList, UInt_t startAt, UInt_t stopAt)

Private Member Functions

 ClassDef (SimDaqEnergyTrigger, 1)

Detailed Description

Definition at line 3 of file SimDaqEnergyTrigger.h.


Member Function Documentation

Bool_t SimDaqEnergyTrigger::ApplyTriggerAt ( PlexHandle  plex,
SimDigitList sortedDigitList,
UInt_t  startAt,
UInt_t  stopAt 
) [virtual]

Implements SimDaqTrigger.

Definition at line 13 of file SimDaqEnergyTrigger.cxx.

References PlexPlaneId::GetPlane(), PlexStripEndId::IsValid(), Msg::kDebug, MSG, and PlexPixelSpotId::SetSpot().

00018 {
00019   //
00020   // This trigger looks if the energy sum of any M consecutive planes 
00021   // is larger than Threshold.
00022   // It has the further requirement that N planes out of M must be hit,
00023   // and Nhits digits must have occoured.
00024   //
00025   MSG("DetSim",Msg::kDebug) << "Energy Trigger Running: "                          
00026                             << fThreshold << " ADC and " 
00027                             << fNhits << " hits and " 
00028                             << fN << " planes hit in a window of " 
00029                             << fM  << " planes.\n";
00030 
00031   // Quick check: do we have enough hits at all?
00032   if(Int_t(stopAt-startAt) < fN) return false; // Not enough digits total.
00033   
00034   // Quick check: enough digits at all?
00035   if(Int_t(stopAt-startAt) < fNhits) return false; // Not enough digits total.
00036 
00037   // Add the hits to a plane map.
00038   std::vector<Int_t> planeEnergy(600,0);
00039   std::vector<Int_t> planeHits(600,0);
00040 
00041   Int_t totADC = 0;
00042   Int_t firstPlane = 9999;
00043   Int_t lastPlane = -9999;
00044 
00045   for(UInt_t idig = startAt; idig<stopAt; idig++) {
00046     // Find the plane.
00047     if(sortedDigitList[idig].GetErrors()) continue;
00048     PlexPixelSpotId psid = sortedDigitList[idig].GetPixelSpotId();
00049     PlexStripEndId  seid = plex.GetStripEndId(psid);
00050     if(!seid.IsValid()) {
00051       psid.SetSpot(1);
00052       seid = plex.GetStripEndId(psid);
00053     }
00054     Int_t plane = seid.GetPlane();
00055     Int_t adc = sortedDigitList[idig].GetADC();
00056     totADC+=adc;
00057 
00058     if( (UInt_t)plane >= planeEnergy.size()) continue;
00059 
00060     // Add plane to map.
00061     if(planeEnergy[plane] ==0){
00062       if(plane<firstPlane) firstPlane = plane;
00063       if(plane>lastPlane) lastPlane = plane;
00064     }
00065 
00066     planeEnergy[plane]+= adc;
00067     planeHits[plane]+= 1;
00068   }
00069   
00070   // Second quick check: enough ADCs in total to fire trigger
00071   if(totADC < fThreshold) return false;
00072 
00073 
00074 
00075   for(Int_t i = firstPlane; i <= lastPlane; i++) {
00076     Int_t local_energy = 0;
00077     Int_t local_nhit = 0;
00078     Int_t local_planeshit = 0;
00079 
00080     for (Int_t j=0; (j<fM) && (i+j<=lastPlane); j++) {
00081       local_energy += planeEnergy[i+j];
00082       local_nhit   += planeHits[i+j];
00083       if(planeHits[i+j]>0) local_planeshit++;
00084     }
00085     if ((local_energy >= fThreshold) && (local_nhit >=fNhits) && (local_planeshit >= fN)) {
00086       return true;
00087     }
00088 
00089     if (i+fM>lastPlane) break; // We're done... stop looking.
00090   }
00091   
00092   return false;
00093 }

SimDaqEnergyTrigger::ClassDef ( SimDaqEnergyTrigger  ,
 
) [private]

Reimplemented from SimDaqTrigger.


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1