Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SimDaqPlaneTrigger.cxx

Go to the documentation of this file.
00001 #include "SimDaqTrigMaker.h"
00002 #include "SimDaqPlaneTrigger.h"
00003 #include "MessageService/MsgService.h"
00004 #include <vector>
00005 
00006 CVSID("$Id: SimDaqPlaneTrigger.cxx,v 1.5 2007/03/01 17:22:11 rhatcher Exp $");
00007 
00008 SimDaqTrigMakerProxy<SimDaqPlaneTrigger> gSimDaqPlaneTriggerProxy("PlaneTrigger");
00009 
00010 ClassImp(SimDaqPlaneTrigger)
00011 
00012 
00013 Bool_t SimDaqPlaneTrigger::ApplyTriggerAt(PlexHandle    plex,
00014                                           SimDigitList& sortedDigitList, // Digit list
00015                                           UInt_t         startAt,         // Which digit to start looking at
00016                                           UInt_t         stopAt           // Which digit is the end of the burst
00017                                           )
00018 {
00019   MSG("DetSim",Msg::kDebug) << "Plane Trigger Running." << endl;
00020 
00021   // Quick check: do we have enough hits at all?
00022   if(Int_t(stopAt-startAt) < fN) return false; // Not enough digits total.
00023 
00024   // Add the hits to a plane map.
00025   std::vector<Int_t> planeMap(600);
00026   for(UInt_t i = 0;i<planeMap.size();i++) planeMap[i]=0;
00027 
00028 
00029   Int_t totplanes = 0;
00030   Int_t firstPlane = 9999;
00031   Int_t lastPlane = -9999;
00032 
00033   for(UInt_t idig = startAt; idig<stopAt; idig++) {
00034     // Find the plane.
00035     if(sortedDigitList[idig].GetErrors()) continue;
00036     PlexPixelSpotId psid = sortedDigitList[idig].GetPixelSpotId();
00037     PlexStripEndId  seid = plex.GetStripEndId(psid);
00038     if(!seid.IsValid()) {
00039       psid.SetSpot(1);
00040       seid = plex.GetStripEndId(psid);
00041     }
00042     Int_t plane = seid.GetPlane();
00043 
00044     if(plane > (Int_t)planeMap.size()) continue;
00045 
00046     // Add plane to map.
00047     if(planeMap[plane] ==0){
00048       totplanes++;
00049       if(plane<firstPlane) firstPlane = plane;
00050       if(plane>lastPlane) lastPlane = plane;
00051     }
00052 
00053     planeMap[plane]++;
00054   }
00055   
00056   // Second quick check: enough planes were hit in total.
00057   if(totplanes < fN) return false;
00058 
00059   for(int i = firstPlane; i <= lastPlane; i++) {
00060     Int_t nPlane = 0;
00061 
00062     for (Int_t j=0; (j<fM) && (i+j<=lastPlane); j++) {
00063       if ( planeMap[i+j]>0 ) nPlane++;
00064     }
00065     if (nPlane>=fN) {
00066       return true;
00067     }
00068     if (i+fM>lastPlane) break; // We're done... stop looking.
00069   }
00070   
00071   return false;
00072 }

Generated on Mon Feb 15 11:07:37 2010 for loon by  doxygen 1.3.9.1