/[PAMELA software]/PamCut/MiscCuts/OBTPktNumCut/OBTPktNumCut.cpp
ViewVC logotype

Contents of /PamCut/MiscCuts/OBTPktNumCut/OBTPktNumCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Jul 8 14:00:11 2010 UTC (14 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: MergedFromV8_1, V9, HEAD
Changes since 1.1: +47 -0 lines
Error occurred while calculating annotation data.
Merged from branch V8 (tag MergedToHEAD_1). Tag before the merge: BeforeMergingFromV8_1.

1 /*
2 * OBTPktNumCut.cpp
3 *
4 * Created on: 18/mar/2010
5 * Author: Nicola Mori
6 */
7
8 #include "OBTPktNumCut.h"
9
10 OBTPktNumCut::OBTPktNumCut(const char *cutName, vector<pair<unsigned int, unsigned int> > &list) :
11 PamCut(cutName), _list(list) {
12 }
13
14 OBTPktNumCut::OBTPktNumCut(const char *cutName, TString listFileName) :
15 PamCut(cutName) {
16 ifstream listFile(listFileName);
17
18 pair<unsigned int, unsigned int> buffer;
19
20 /* File layout:
21 * OBT PktNum */
22 while (listFile >> buffer.first >> buffer.second) {
23 _list.push_back(buffer);
24 }
25
26 listFile.close();
27 }
28
29 int OBTPktNumCut::Check(PamLevel2 *event) {
30
31 if (_list.size() == 0)
32 return 0; // No more couples left in the list
33
34 unsigned int OBT = event->GetOrbitalInfo()->OBT;
35 unsigned int pktNum = event->GetOrbitalInfo()->pkt_num;
36
37 vector<pair<unsigned int, unsigned int> >::iterator currPair = _list.begin();
38 while (currPair->first != OBT && currPair->second != pktNum){
39 currPair++;
40 if (currPair > _list.end())
41 return 0; // Event not found in the list
42 }
43
44 _list.erase(currPair); // Don't search anymore for the current pair (already found)
45
46 return CUTOK;
47 }

  ViewVC Help
Powered by ViewVC 1.1.23