00001 #ifndef SAMPLE_HANDLER_SAMPLE_HH
00002 #define SAMPLE_HANDLER_SAMPLE_HH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <SampleHandler/Global.h>
00015
00016 #include <string>
00017 #include <vector>
00018 #include <TObject.h>
00019 #include <RootCoreUtils/Deprecated.h>
00020 #include <SampleHandler/TagList.h>
00021
00022 class TChain;
00023 class TCollection;
00024 class TDSet;
00025
00026 namespace SH
00027 {
00039 std::string dbg (const Sample& obj, unsigned verbosity = 0);
00040
00041
00042
00050 class Sample : public TObject
00051 {
00052
00053
00054
00055
00060 public:
00061 void testInvariant () const;
00062
00063
00068 public:
00069 virtual ~Sample ();
00070
00071
00076 const std::string& name () const;
00077
00093 public:
00094 void name (std::string val_name);
00095
00096
00101 public:
00102 std::size_t numFiles () const;
00103
00104
00115 public:
00116 std::string fileName (std::size_t index) const;
00117
00118
00130 public:
00131 SamplePtr makeLocal () const;
00132
00133
00138 public:
00139 const TagList& tags () const;
00140
00141
00148 public:
00149 void tags (const TagList& tags);
00150
00151
00158 public:
00159 void addTag (const std::string& tag);
00160
00161
00175 public:
00176 void updateLocation (const std::string& from, const std::string& to);
00177
00178
00184 public:
00185 MetaObject *meta ();
00186
00187
00189 public:
00190 const MetaObject *meta () const;
00191
00192
00200 public:
00201 std::vector<std::string> makeFileList () const;
00202
00203
00212 public:
00213 TChain *makeTChain () const;
00214
00215
00225 public:
00226 TDSet *makeTDSet () const;
00227
00228
00238 public:
00239 TObject *readHist (const std::string& name) const;
00240
00241
00254 public:
00255 bool contains (const std::string& name) const;
00256
00257
00267 public:
00268 void addSamples (SampleHandler& result);
00269
00270
00279 public:
00280 void print () const;
00281
00282
00286 public:
00287 void printContent () const;
00288
00289
00295 public:
00296 Long64_t getNumEntries () const;
00297
00298
00299
00300
00301
00302
00303
00311 public:
00312 RCU_DEPRECATED ("use meta() instead, or (preferably) access of meta-data by name")
00313 TCollection *metaDataList ();
00314
00315
00317 public:
00318 RCU_DEPRECATED ("use meta() instead, or (preferably) access of meta-data by name")
00319 const TCollection *metaDataList () const;
00320
00321
00323 public:
00324 RCU_DEPRECATED ("use meta() instead")
00325 void removeMeta (const std::string& name);
00326
00327
00329 public:
00330 RCU_DEPRECATED ("use meta() instead")
00331 void addReplaceMeta (TNamed *meta_swallow);
00332
00333
00335 public:
00336 RCU_DEPRECATED ("use meta() instead")
00337 TObject *getMeta (const std::string& name);
00338
00339
00341 public:
00342 RCU_DEPRECATED ("use meta() instead")
00343 const TObject *getMeta (const std::string& name) const;
00344
00345
00347 public:
00348 RCU_DEPRECATED ("use meta() instead")
00349 double getMetaDouble (const std::string& name, double def_val = 0) const;
00350
00351
00353 public:
00354 RCU_DEPRECATED ("use meta() instead")
00355 std::string getMetaString (const std::string& name, const std::string& def_val = "") const;
00356
00357
00359 public:
00360 RCU_DEPRECATED ("use meta() instead")
00361 void setMetaDouble (const std::string& name, double value);
00362
00363
00365 public:
00366 RCU_DEPRECATED ("use meta() instead")
00367 void setMetaString (const std::string& name, const std::string& value);
00368
00369
00371 public:
00372 RCU_DEPRECATED ("use meta() instead")
00373 void fetchMeta (const Sample& source);
00374
00375
00376
00377
00378
00379
00380
00387 protected:
00388 Sample (const std::string& name);
00389
00390
00391
00392
00393
00394
00395
00399 protected:
00400 virtual std::size_t getNumFiles () const = 0;
00401
00402
00406 protected:
00407 virtual std::string getFileName (std::size_t index) const = 0;
00408
00409
00413 protected:
00414 virtual SamplePtr doMakeLocal () const = 0;
00415
00416
00420 protected:
00421 virtual std::vector<std::string> doMakeFileList () const = 0;
00422
00423
00427 protected:
00428 virtual void
00429 doUpdateLocation (const std::string& from, const std::string& to);
00430
00431
00435 protected:
00436 virtual TObject *doReadHist (const std::string& name) const;
00437
00438
00442 protected:
00443 virtual bool getContains (const std::string& name) const;
00444
00445
00449 protected:
00450 virtual void doAddSamples (SampleHandler& result);
00451
00452
00453
00454
00455
00456
00457
00458 friend class SamplePtr;
00459 private:
00460
00465 void alloc () const;
00466
00467
00475 void release () const;
00476
00477
00478
00479
00480
00481
00482
00484 private:
00485 std::string m_name;
00486
00488 private:
00489 TagList m_tags;
00490
00492 private:
00493 MetaObject *m_meta;
00494
00496 private:
00497 mutable unsigned m_references;
00498
00501 private:
00502 Sample (const Sample& that);
00503
00506 private:
00507 Sample& operator = (const Sample& that);
00508
00509 ClassDef(Sample, 2);
00510 };
00511 }
00512
00513 #endif