BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
TagParser1 Class Reference

#include <TagParser1.h>

+ Inheritance diagram for TagParser1:

Public Member Functions

 TagParser1 ()
 
 ~TagParser1 ()
 
StatusCode getVEntry (vector< int > &)
 
int getDstDataType ()
 
unsigned int getTagData0 ()
 
unsigned int getTagData1 ()
 
unsigned int getTagData2 ()
 
unsigned int getTagData3 ()
 
unsigned int getTagData4 ()
 
unsigned int getTagData5 ()
 
unsigned int getTagData6 ()
 
unsigned int getTagData7 ()
 
unsigned int getTagData8 ()
 
unsigned int getTagData9 ()
 
void setDstDataType (int t)
 
void setTagData0 (unsigned int t)
 
void setTagData1 (unsigned int t)
 
void setTagData2 (unsigned int t)
 
void setTagData3 (unsigned int t)
 
void setTagData4 (unsigned int t)
 
void setTagData5 (unsigned int t)
 
void setTagData6 (unsigned int t)
 
void setTagData7 (unsigned int t)
 
void setTagData8 (unsigned int t)
 
void setTagData9 (unsigned int t)
 
void setFileName (string name)
 
void setCriteria (vector< string > name)
 
void Tag1ToInt (unsigned int res, int &val1, int &val2, int &val3, int &val4)
 
void Tag2ToInt (unsigned int res, int &val1, int &val2, int &val3, int &val4, int &val5, int &val6)
 
- Public Member Functions inherited from ITagParser
 ITagParser ()
 
 ~ITagParser ()
 

Detailed Description

Definition at line 16 of file TagParser1.h.

Constructor & Destructor Documentation

◆ TagParser1()

TagParser1::TagParser1 ( )

Definition at line 28 of file TagParser1.cxx.

28 {
29}

◆ ~TagParser1()

TagParser1::~TagParser1 ( )

Definition at line 31 of file TagParser1.cxx.

31 {
32}

Member Function Documentation

◆ getDstDataType()

int TagParser1::getDstDataType ( )
inlinevirtual

Implements ITagParser.

Definition at line 25 of file TagParser1.h.

25{ return m_dstDataType; }

◆ getTagData0()

unsigned int TagParser1::getTagData0 ( )
inlinevirtual

Implements ITagParser.

Definition at line 26 of file TagParser1.h.

26{ return m_tagData0; }

◆ getTagData1()

unsigned int TagParser1::getTagData1 ( )
inlinevirtual

Implements ITagParser.

Definition at line 27 of file TagParser1.h.

27{ return m_tagData1; }

◆ getTagData2()

unsigned int TagParser1::getTagData2 ( )
inlinevirtual

Implements ITagParser.

Definition at line 28 of file TagParser1.h.

28{ return m_tagData2; }

◆ getTagData3()

unsigned int TagParser1::getTagData3 ( )
inlinevirtual

Implements ITagParser.

Definition at line 29 of file TagParser1.h.

29{ return m_tagData3; }

◆ getTagData4()

unsigned int TagParser1::getTagData4 ( )
inlinevirtual

Implements ITagParser.

Definition at line 30 of file TagParser1.h.

30{ return m_tagData4; }

◆ getTagData5()

unsigned int TagParser1::getTagData5 ( )
inlinevirtual

Implements ITagParser.

Definition at line 31 of file TagParser1.h.

31{ return m_tagData5; }

◆ getTagData6()

unsigned int TagParser1::getTagData6 ( )
inlinevirtual

Implements ITagParser.

Definition at line 32 of file TagParser1.h.

32{ return m_tagData6; }

◆ getTagData7()

unsigned int TagParser1::getTagData7 ( )
inlinevirtual

Implements ITagParser.

Definition at line 33 of file TagParser1.h.

33{ return m_tagData7; }

◆ getTagData8()

unsigned int TagParser1::getTagData8 ( )
inlinevirtual

Implements ITagParser.

Definition at line 34 of file TagParser1.h.

34{ return m_tagData8; }

◆ getTagData9()

unsigned int TagParser1::getTagData9 ( )
inlinevirtual

Implements ITagParser.

Definition at line 35 of file TagParser1.h.

35{ return m_tagData9; }

◆ getVEntry()

StatusCode TagParser1::getVEntry ( std::vector< int > & ventry)
virtual

Implements ITagParser.

Definition at line 35 of file TagParser1.cxx.

35 {
36
37 int NumCriteria = m_criteria.size();
38 if (NumCriteria>23) {
39 std::cout<<"the number of criterias too much!!"<<std::endl;
40 return StatusCode::SUCCESS;
41 }
42 if(m_criteria[0].find("<NumOfGoodCh<") == std::string::npos){
43 std::cout<<"pls ensure your first criterias is NumOfCharged"<<std::endl;
44 return StatusCode::SUCCESS;
45 }
46 //string criteria="";
47 vector<string> criteria;
48 map<string, int> Cut1;
49 map<string, int> Cut2;
50 for(int i=0;i<NumCriteria;i++){
51 int nPos_1 = m_criteria[i].find_first_of("<");
52 int nPos_2 = m_criteria[i].find_last_of("<");
53 if(nPos_1 == nPos_2 || nPos_1==-1 || nPos_2==-1) {
54 std::cout<<"pls check your criterias"<<std::endl;
55 return StatusCode::SUCCESS;
56 }
57 string name_cut = m_criteria[i].substr(nPos_1+1,nPos_2-nPos_1-1);
58 Cut1[name_cut] = atoi(m_criteria[i].substr(0).c_str());
59 Cut2[name_cut] = atoi(m_criteria[i].substr(nPos_2+1).c_str());
60 criteria.push_back(name_cut);
61 std::cout<<"criteria is "<<criteria[i]<<std::endl;
62 std::cout<<"nCTrkCut1: "<<Cut1[criteria[i]]<<" nCTrkCut2: "<<Cut2[criteria[i]]<<std::endl;
63 }
64
65
66
67
68
69 // if ( criteria.find("<NumOfCharged<") != std::string::npos ) {
70 // nCTrkCut1 = atoi( criteria.substr(0).c_str() );
71 // nCTrkCut2 = atoi( criteria.substr(15).c_str() );
72 // std::cout<<"nCTrkCut1: "<<nCTrkCut1<<" nCTrkCut2: "<<nCTrkCut2<<std::endl;
73 // }
74
75
76 std::vector<int> ventry_temp;
77
78 TFile* file = TFile::Open( m_fileName.c_str() );
79 TTree* t0 = (TTree*)file->Get("Metadata");
80 Int_t mode, begin, end;
81 t0->SetBranchAddress("mode", &mode);
82 t0->SetBranchAddress("begin", &begin);
83 t0->SetBranchAddress("end", &end);
84
85 for ( int i = 0; i < t0->GetEntries(); ++i ) {
86 t0->GetEntry(i);
87 std::cout<<"t0 entry: "<<i<<std::endl;
88 if ( (mode != -1) && (mode>Cut1["NumOfGoodCh"] && mode<Cut2["NumOfGoodCh"]) ) {
89 for ( int i = begin; i < end; ++i ) {
90 ventry_temp.push_back(i);
91 //ventry.push_back(i);
92 //std::cout<<"ventry_temp push back: "<<i<<std::endl;
93 }
94 }
95 }
96
97
98
99
100
101 TTree* t3 = (TTree*)file->Get("Entries");
102 UInt_t tagData0, tagData1, tagData2, tagData3, tagData4;
103 t3->SetBranchAddress("tagData0", &tagData0);
104 t3->SetBranchAddress("tagData1", &tagData1);
105 t3->SetBranchAddress("tagData2", &tagData2);
106 t3->SetBranchAddress("tagData3", &tagData3);
107 t3->SetBranchAddress("tagData4", &tagData4);
108
109 Int_t npip, npim, nkp, nkm, nlambda, nalambda;
110 Int_t npp, npm, nep, nem, nmup, nmum, neta, npi0, ngamma, nks;
111 Int_t nCharged, nGoodChargedp, nGoodChargedm,totCharged,nNeutrk, nTottrk;
112 for (int i=0;i<ventry_temp.size();i++ )
113 {
114 t3->GetEntry(ventry_temp[i]);
115 Tag1ToInt(tagData1, nNeutrk, nTottrk, ngamma, npi0);
116 Tag2ToInt(tagData2, npip, npim, nkp, nkm, npp, npm);
117 Tag2ToInt(tagData3, nlambda, nalambda, nep, nem, nmup, nmum);
118 Tag2ToInt(tagData4, nks, neta, nCharged, nGoodChargedp, nGoodChargedm, totCharged);
119
120 //std::cout<<"npip = "<<npip<<", npim = "<<npim<<std::endl;
121 //std::cout<<"nctk = "<<tagData0<<std::endl;
122
123
124 if( Cut2["NumOfNeutrk"]!=0&& (nNeutrk>=Cut2["NumOfNeutrk"] || nNeutrk<=Cut1["NumOfNeutrk"] )) continue;
125 if( Cut2["NumOfTottrk"]!=0&& (nTottrk>=Cut2["NumOfTottrk"] || nTottrk<=Cut1["NumOfTottrk"] )) continue;
126 if( Cut2["NumOfGamma"]!=0 && (ngamma>=Cut2["NumOfGamma"] || ngamma<=Cut1["NumOfGamma"] )) continue;
127 if( Cut2["NumOfPion0"]!=0 && (npi0>=Cut2["NumOfPion0"] || npi0<=Cut1["NumOfPion0"] )) continue;
128 if( Cut2["NumOfPionp"]!=0 && (npip>=Cut2["NumOfPionp"] || npip<=Cut1["NumOfPionp"] )) continue;
129 if( Cut2["NumOfPionm"]!=0 && (npim>=Cut2["NumOfPionm"] || npim<=Cut1["NumOfPionm"] )) continue;
130 if( Cut2["NumOfKaonp"]!=0 && (nkp>=Cut2["NumOfKaonp"] || nkp<=Cut1["NumOfKaonp"] )) continue;
131 if( Cut2["NumOfKaonm"]!=0 && (nkm>=Cut2["NumOfKaonm"] || nkm<=Cut1["NumOfKaonm"] )) continue;
132 if( Cut2["NumOfProtonp"]!=0 && (npp>=Cut2["NumOfProtonp"] || npp<=Cut1["NumOfProtonp"] )) continue;
133 if( Cut2["NumOfProtonm"]!=0 && (npm>=Cut2["NumOfProtonm"] || npp<=Cut1["NumOfProtonm"] )) continue;
134 if( Cut2["NumOfLambda"]!=0 && (nlambda>=Cut2["NumOfLambda"] || nlambda<=Cut1["NumOfLambda"] )) continue;
135 if( Cut2["NumOfALambda"]!=0 && (nalambda>=Cut2["NumOfALambda"] || nalambda<=Cut1["NumOfALambda"] )) continue;
136 if( Cut2["NumOfElectronp"]!=0 && (nep>=Cut2["NumOfElectronp"] || nep<=Cut1["NumOfElectronp"] )) continue;
137 if( Cut2["NumOfElectronm"]!=0 && (nem>=Cut2["NumOfElectronm"] || nem<=Cut1["NumOfElectronm"] )) continue;
138 if( Cut2["NumOfMuonp"]!=0 && (nmup>=Cut2["NumOfMuonp"] || nmup<=Cut1["NumOfMuonp"] )) continue;
139 if( Cut2["NumOfMuonm"]!=0 && (nmum>=Cut2["NumOfMuonm"] || nmum<=Cut1["NumOfMuonm"] )) continue;
140 if( Cut2["NumOfKs"]!=0 && (nks>=Cut2["NumOfKs"] || nks<=Cut1["NumOfKs"] )) continue;
141 if( Cut2["NumOfEta"]!=0 && (neta>=Cut2["NumOfEta"] || neta<=Cut1["NumOfEta"] )) continue;
142 if( Cut2["NumOfCharged"]!=0 && (nCharged>=Cut2["NumOfCharged"] || nCharged<=Cut1["NumOfCharged"] )) continue;
143 if( Cut2["NumOfGoodChp"]!=0 && (nGoodChargedp>=Cut2["NumOfGoodChp"] || nGoodChargedp<=Cut1["NumOfGoodChp"] )) continue;
144 if( Cut2["NumOfGoodChm"]!=0 && (nGoodChargedm>=Cut2["NumOfGoodChm"] || nGoodChargedm<=Cut1["NumOfGoodChm"] )) continue;
145 if( Cut2["TotCharged"]!=0 && (totCharged>=Cut2["TotCharged"] || totCharged<=Cut1["TotCharged"] )) continue;
146 ventry.push_back(ventry_temp[i]);
147 // std::cout<<"ventry push back: "<<i<<std::endl;
148 }
149 delete file;
150
151
152 return StatusCode::SUCCESS;
153}
char * file
Definition DQA_TO_DB.cxx:15
void Tag2ToInt(unsigned int res, int &val1, int &val2, int &val3, int &val4, int &val5, int &val6)
void Tag1ToInt(unsigned int res, int &val1, int &val2, int &val3, int &val4)
char * c_str(Index i)

◆ setCriteria()

void TagParser1::setCriteria ( vector< string > name)
inlinevirtual

Implements ITagParser.

Definition at line 50 of file TagParser1.h.

50{m_criteria = name;}

◆ setDstDataType()

void TagParser1::setDstDataType ( int t)
inlinevirtual

Implements ITagParser.

Definition at line 37 of file TagParser1.h.

37{ m_dstDataType = t; }
TTree * t
Definition binning.cxx:23

◆ setFileName()

void TagParser1::setFileName ( string name)
inlinevirtual

Implements ITagParser.

Definition at line 49 of file TagParser1.h.

49{m_fileName = name; std::cout<<"filename is "<<m_fileName<<std::endl;}

◆ setTagData0()

void TagParser1::setTagData0 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 38 of file TagParser1.h.

38{ m_tagData0 = t; }

◆ setTagData1()

void TagParser1::setTagData1 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 39 of file TagParser1.h.

39{ m_tagData1 = t; }

◆ setTagData2()

void TagParser1::setTagData2 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 40 of file TagParser1.h.

40{ m_tagData2 = t; }

◆ setTagData3()

void TagParser1::setTagData3 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 41 of file TagParser1.h.

41{ m_tagData3 = t; }

◆ setTagData4()

void TagParser1::setTagData4 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 42 of file TagParser1.h.

42{ m_tagData4 = t; }

◆ setTagData5()

void TagParser1::setTagData5 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 43 of file TagParser1.h.

43{ m_tagData5 = t; }

◆ setTagData6()

void TagParser1::setTagData6 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 44 of file TagParser1.h.

44{ m_tagData6 = t; }

◆ setTagData7()

void TagParser1::setTagData7 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 45 of file TagParser1.h.

45{ m_tagData7 = t; }

◆ setTagData8()

void TagParser1::setTagData8 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 46 of file TagParser1.h.

46{ m_tagData8 = t; }

◆ setTagData9()

void TagParser1::setTagData9 ( unsigned int t)
inlinevirtual

Implements ITagParser.

Definition at line 47 of file TagParser1.h.

47{ m_tagData9 = t; }

◆ Tag1ToInt()

void TagParser1::Tag1ToInt ( unsigned int res,
int & val1,
int & val2,
int & val3,
int & val4 )

Definition at line 154 of file TagParser1.cxx.

155{
156 val1 = (res>>24) & 0xFF;
157 val2 = (res>>16) & 0xFF;
158 val3 = (res>>8) & 0xFF;
159 val4 = res & 0xFF;
160 return;
161}

Referenced by getVEntry().

◆ Tag2ToInt()

void TagParser1::Tag2ToInt ( unsigned int res,
int & val1,
int & val2,
int & val3,
int & val4,
int & val5,
int & val6 )

Definition at line 162 of file TagParser1.cxx.

163{
164 val1=(res>>26) & 0x3F;
165 val2=(res>>20) & 0x3F;
166 val3=(res>>15) & 0x1F;
167 val4=(res>>10) & 0x1F;
168 val5=(res>>5) & 0x1F;
169 val6 =res & 0x1F;
170 return;
171}

Referenced by getVEntry().


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