- Timestamp:
- Aug 16, 2013, 4:29:25 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/classes/DelphesLHEFReader.cc
r1189 r1265 41 41 DelphesLHEFReader::DelphesLHEFReader() : 42 42 fInputFile(0), fBuffer(0), fPDG(0), 43 fEvent Counter(-1), fParticleCounter(-1)43 fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1) 44 44 { 45 45 fBuffer = new char[kBufferSize]; … … 66 66 void DelphesLHEFReader::Clear() 67 67 { 68 fEventReady = kFALSE; 68 69 fEventCounter = -1; 69 70 fParticleCounter = -1; 71 fRwgtList.clear(); 70 72 } 71 73 … … 74 76 bool DelphesLHEFReader::EventReady() 75 77 { 76 return (fEventCounter == 0) && (fParticleCounter == 0);78 return fEventReady; 77 79 } 78 80 … … 85 87 { 86 88 int rc; 89 char *pch; 90 double weight; 87 91 88 92 if(!fgets(fBuffer, kBufferSize, fInputFile)) return kFALSE; 89 90 DelphesStream bufferStream(fBuffer);91 93 92 94 if(strstr(fBuffer, "<event>")) … … 97 99 else if(fEventCounter > 0) 98 100 { 101 DelphesStream bufferStream(fBuffer); 102 99 103 rc = bufferStream.ReadInt(fParticleCounter) 100 104 && bufferStream.ReadInt(fProcessID) … … 114 118 else if(fParticleCounter > 0) 115 119 { 120 DelphesStream bufferStream(fBuffer); 121 116 122 rc = bufferStream.ReadInt(fPID) 117 123 && bufferStream.ReadInt(fStatus) … … 137 143 --fParticleCounter; 138 144 } 145 else if(strstr(fBuffer, "<wgt")) 146 { 147 pch = strstr(fBuffer, ">"); 148 if(!pch) 149 { 150 cerr << "** ERROR: " << "invalid weight format" << endl; 151 return kFALSE; 152 } 153 154 DelphesStream bufferStream(pch + 1); 155 rc = bufferStream.ReadDbl(weight); 156 157 if(!rc) 158 { 159 cerr << "** ERROR: " << "invalid weight format" << endl; 160 return kFALSE; 161 } 162 163 fRwgtList.push_back(weight); 164 } 165 else if(strstr(fBuffer, "</event>")) 166 { 167 fEventReady = kTRUE; 168 } 139 169 140 170 return kTRUE; … … 163 193 //--------------------------------------------------------------------------- 164 194 195 void DelphesLHEFReader::AnalyzeRwgt(ExRootTreeBranch *branch) 196 { 197 Weight *element; 198 vector<double>::const_iterator itRwgtList; 199 200 for(itRwgtList = fRwgtList.begin(); itRwgtList != fRwgtList.end(); ++itRwgtList) 201 { 202 element = static_cast<Weight *>(branch->NewEntry()); 203 204 element->Weight = *itRwgtList; 205 } 206 } 207 208 //--------------------------------------------------------------------------- 209 165 210 void DelphesLHEFReader::AnalyzeParticle(DelphesFactory *factory, 166 211 TObjArray *allParticleOutputArray, -
trunk/readers/DelphesLHEF.cpp
r1130 r1265 45 45 TStopwatch readStopWatch, procStopWatch; 46 46 ExRootTreeWriter *treeWriter = 0; 47 ExRootTreeBranch *branchEvent = 0 ;47 ExRootTreeBranch *branchEvent = 0, *branchRwgt = 0; 48 48 ExRootConfReader *confReader = 0; 49 49 Delphes *modularDelphes = 0; … … 85 85 86 86 branchEvent = treeWriter->NewBranch("Event", LHEFEvent::Class()); 87 branchRwgt = treeWriter->NewBranch("Rwgt", Weight::Class()); 87 88 88 89 confReader = new ExRootConfReader; … … 177 178 178 179 reader->AnalyzeEvent(branchEvent, eventCounter, &readStopWatch, &procStopWatch); 180 reader->AnalyzeRwgt(branchRwgt); 179 181 180 182 treeWriter->Fill();
Note:
See TracChangeset
for help on using the changeset viewer.