00001
00012
00013 #include "Trigger/TofHitCount.h"
00014
00015 #include "Identifier/Identifier.h"
00016 #include "Identifier/TofID.h"
00017
00018 #include "RawEvent/RawDataUtil.h"
00019 #include "RawEvent/DigiEvent.h"
00020
00021 #include <map>
00022 using namespace std;
00023
00024 TofHitCount* TofHitCount::tof_Pointer = 0;
00025
00026 TofHitCount* TofHitCount::get_Tof(void) {
00027 if(!tof_Pointer) tof_Pointer = new TofHitCount();
00028 return tof_Pointer;
00029 }
00030
00031 TofHitCount::TofHitCount()
00032 {
00033 }
00034 TofHitCount::~TofHitCount()
00035 {
00036 }
00037 void TofHitCount::setTofDigi(std::vector<int>& vtofHit)
00038 {
00039 barrelHit1.clear();
00040 barrelHit2.clear();
00041 ecapHit.clear();
00042 wcapHit.clear();
00043
00044 for(std::vector<int>::iterator iter = vtofHit.begin(); iter != vtofHit.end(); iter++) {
00045 int tofId = (*iter);
00046 int part, layer, im;
00047 part = int (tofId/10000.);
00048 layer = int ((tofId - part*10000)/1000.);
00049 im = int ((tofId - part*10000 - layer*1000)/10.);
00050 if(part == 0) {
00051
00052 if(find(ecapHit.begin(),ecapHit.end(),im) == ecapHit.end()) {
00053 ecapHit.push_back(im);
00054 }
00055 }
00056 else if (part == 2) {
00057
00058 if(find(wcapHit.begin(),wcapHit.end(),im) == wcapHit.end()) {
00059 wcapHit.push_back(im);
00060 }
00061 }
00062 else {
00063 if(layer == 0) {
00064
00065 if(find(barrelHit1.begin(),barrelHit1.end(),im) == barrelHit1.end()) {
00066 barrelHit1.push_back(im);
00067 }
00068 }
00069 if(layer == 1) {
00070
00071 if(find(barrelHit2.begin(),barrelHit2.end(),im) == barrelHit2.end()) {
00072 barrelHit2.push_back(im);
00073 }
00074 }
00075 }
00076 }
00077 }