11 m_bookingStage =
true;
14 cout <<
"ERROR: null tree pointer -- "
15 <<
"check for duplicate final states in configuration"
17 assert( m_Tree != NULL );
24 for (map<string,double>::iterator mapItr = m_doubleMap.begin();
25 mapItr != m_doubleMap.end(); mapItr++){
26 m_ntupleDoubleMap[mapItr->first] = mapItr->second;
29 for (map<string,long>::iterator mapItr = m_longMap.begin();
30 mapItr != m_longMap.end(); mapItr++){
31 m_ntupleLongMap[mapItr->first] = mapItr->second;
34 for (map<string,double*>::iterator mapItr = m_arrayMap.begin();
35 mapItr != m_arrayMap.end(); mapItr++){
36 for(
int i=0; i< 100; i++) {
37 m_ntupleArrayMap[mapItr->first][i] = *(mapItr->second + i);
41 for (map<string,long*>::iterator mapItr = m_arrayLongMap.begin();
42 mapItr != m_arrayLongMap.end(); mapItr++){
43 for(
int i=0; i< 100; i++) {
44 m_ntupleArrayLongMap[mapItr->first][i] = *(mapItr->second + i);
48 for (map<string,int*>::iterator mapItr = m_arrayIntMap.begin();
49 mapItr != m_arrayIntMap.end(); mapItr++){
50 for(
int i=0; i< 100; i++) {
51 m_ntupleArrayIntMap[mapItr->first][i] = *(mapItr->second + i);
57 for (map<string,double*>::iterator mapItr = m_arrayMap.begin();
58 mapItr != m_arrayMap.end(); mapItr++){
59 delete mapItr->second;
61 for (map<string,long*>::iterator mapItr = m_arrayLongMap.begin();
62 mapItr != m_arrayLongMap.end(); mapItr++){
63 delete mapItr->second;
65 for (map<string,int*>::iterator mapItr = m_arrayIntMap.begin();
66 mapItr != m_arrayIntMap.end(); mapItr++){
67 delete mapItr->second;
69 m_bookingStage =
false;
76 if (m_bookingStage && !containsEntry(name)){
77 m_Tree->addItem(name,m_ntupleDoubleMap[name]);
79 if (!m_bookingStage && !containsEntry(name)){
80 cout <<
"NTUPLEHELPER: Variable " << name <<
" has not been booked." << endl;
83 m_doubleMap[name] = value;
87 if (m_bookingStage && !containsEntry(name)){
88 m_Tree->addItem(name,m_ntupleLongMap[name]);
90 if (!m_bookingStage && !containsEntry(name)){
91 cout <<
"NTUPLEHELPER: Variable " << name <<
" has not been booked." << endl;
94 m_longMap[name] = value;
101 if (m_bookingStage && !containsEntry(index_name)){
102 m_Tree->addItem(index_name, m_ntupleLongMap[index_name], 0, 100);
105 m_longMap[index_name]=size;
107 if (m_bookingStage && !containsEntry(name)){
108 m_Tree->addIndexedItem(name, m_ntupleLongMap[index_name], m_ntupleArrayMap[name]);
111 if (!m_bookingStage && !containsEntry(name)){
112 cout <<
"NTUPLEHELPER: Variable " << name <<
" has not been booked." << endl;
116 if (!m_bookingStage && !containsEntry(index_name)){
117 cout <<
"NTUPLEHELPER: Variable " << index_name <<
" has not been booked." << endl;
121 m_arrayMap[name]=
new double[100];
122 for(
int i=0; i<size; i++){
124 m_arrayMap[name][i] = *(value+i);
130 if (m_bookingStage && !containsEntry(index_name)){
131 m_Tree->addItem(index_name, m_ntupleLongMap[index_name], 0, 100);
134 m_longMap[index_name]=size;
136 if (m_bookingStage && !containsEntry(name)){
137 m_Tree->addIndexedItem(name, m_ntupleLongMap[index_name], m_ntupleArrayLongMap[name]);
140 if (!m_bookingStage && !containsEntry(name)){
141 cout <<
"NTUPLEHELPER: Variable " << name <<
" has not been booked." << endl;
145 if (!m_bookingStage && !containsEntry(index_name)){
146 cout <<
"NTUPLEHELPER: Variable " << index_name <<
" has not been booked." << endl;
150 m_arrayLongMap[name]=
new long[100];
151 for(
int i=0; i<size; i++){
153 m_arrayLongMap[name][i] = *(value+i);
159 if (m_bookingStage && !containsEntry(index_name)){
160 m_Tree->addItem(index_name, m_ntupleLongMap[index_name], 0, 100);
163 m_longMap[index_name]=size;
165 if (m_bookingStage && !containsEntry(name)){
166 m_Tree->addIndexedItem(name, m_ntupleLongMap[index_name], m_ntupleArrayIntMap[name]);
169 if (!m_bookingStage && !containsEntry(name)){
170 cout <<
"NTUPLEHELPER: Variable " << name <<
" has not been booked." << endl;
174 if (!m_bookingStage && !containsEntry(index_name)){
175 cout <<
"NTUPLEHELPER: Variable " << index_name <<
" has not been booked." << endl;
179 m_arrayIntMap[name]=
new int[100];
180 for(
int i=0; i<size; i++){
182 m_arrayIntMap[name][i] = *(value+i);
189NTupleHelper::containsEntry(
string name){
191 map<string,double>::iterator mapItr1 = m_doubleMap.find(name);
192 if (mapItr1 != m_doubleMap.end())
return true;
194 map<string,long>::iterator mapItr2 = m_longMap.find(name);
195 if (mapItr2 != m_longMap.end())
return true;
197 map<string,double*>::iterator mapItr3 = m_arrayMap.find(name);
198 if (mapItr3 != m_arrayMap.end())
return true;
200 map<string,long*>::iterator mapItr4 = m_arrayLongMap.find(name);
201 if (mapItr4 != m_arrayLongMap.end())
return true;
203 map<string,int*>::iterator mapItr5 = m_arrayIntMap.find(name);
204 if (mapItr5 != m_arrayIntMap.end())
return true;
210NTupleHelper::concatName(
string tag,
string base,
int index){
220NTupleHelper::concatName(
string tag,
string base){
void fillArrayLong(string name, string index_name, long *value, int size)
void fillLong(string name, long value)
void fillDouble(string name, double value)
void fillArrayInt(string name, string index_name, int *value, int size)
NTupleHelper(NTuple::Tuple *Tree)
void fillArray(string name, string index_name, double *value, int size)