Changeset 756 for trunk/MagicSoft/Mars
- Timestamp:
- 04/19/01 16:12:03 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r755 r756 5 5 * mbase/MParList.cc: 6 6 - added stripping of the string after last semicolon (classname) 7 7 8 * mbase/MReadTree.cc: 9 - added Veto funtionality to PreProcess 10 - added HasVeto 11 - added fVetoList 12 - added VetoBranch 8 13 9 14 -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r752 r756 43 43 #include <TFile.h> 44 44 #include <TChain.h> 45 #include <TArrayC.h> 45 46 #include <TObjArray.h> 46 47 … … 60 61 *fTitle = title ? title : "Task to loop over all events in one single tree"; 61 62 63 fVetoList = new TArrayC; 62 64 // 63 65 // open the input stream … … 73 75 { 74 76 delete fChain; 77 delete fVetoList; 75 78 } 76 79 … … 129 132 // Get Name of Branch 130 133 // 131 const char *name = branch->GetName(); 134 const char *name = branch->GetName(); 135 136 // 137 // Check if enabeling the branch is allowed 138 // 139 if (HasVeto(name)) 140 continue; 132 141 133 142 // … … 258 267 } 259 268 269 // -------------------------------------------------------------------------- 270 // 271 // This function checks if the Branch Name is part of the Veto List. 272 // This means, that the preprocess doesn't enable the branch. 273 // 274 Bool_t MReadTree::HasVeto(const char *name) const 275 { 276 const size_t nlen = strlen(name)+1; 277 278 char *pos = fVetoList->GetArray(); 279 size_t len = fVetoList->GetSize(); 280 281 // 282 // now we compare the 'strings' in the list word by word 283 // (string or word in this context means a zero terminated 284 // array of chars 285 // 286 287 for (;;) 288 { 289 // 290 // Search for the first byte of the name 291 // 292 char *c = (char*)memchr(pos, name[0], len); 293 294 // 295 // if we don't find the first byte, the list cannot contain 'name' 296 // 297 if (!c) 298 return kFALSE; 299 300 // 301 // calculate and check how many bytes remains in the list 302 // 303 len -= c-pos; 304 305 // 306 // if there are not enough bytes to match the query we are done 307 // 308 if (len<nlen) 309 return kFALSE; 310 311 // 312 // check if the next 'nlen' byte (including the trailing '\0' 313 // are matching 314 // 315 if (!memcmp(c, name, nlen)) 316 return kTRUE; 317 318 // 319 // we didn't find the string, goto the next 'string' 320 // 321 pos = (char*)memchr(c, '\0', len); 322 323 // 324 // check if there is a 'next' string really 325 // 326 if (!pos) 327 return kFALSE; 328 329 // 330 // calculate the remaining length 331 // 332 len -= pos-c; 333 334 // 335 // if there are not enough bytes to match the query we are done 336 // 337 if (len<nlen) 338 return kFALSE; 339 } 340 } 341 342 343 // -------------------------------------------------------------------------- 344 // 345 // If you don't want that a branch is enabled within the PreProcess you 346 // can set a veto for enabeling the branch. (This means also the 347 // corresponding object won't be created automatically) 348 // 349 void MReadTree::VetoBranch(const char *name) 350 { 351 // 352 // Add this file as the last entry of the list 353 // (including the trailing '\0') 354 // 355 const int sz = fVetoList->GetSize(); 356 const int tsz = strlen(name)+1; 357 358 fVetoList->Set(sz+tsz); 359 360 memcpy(fVetoList->GetArray()+sz, name, tsz); 361 }
Note:
See TracChangeset
for help on using the changeset viewer.