| 1 |
#ifndef PAMVMCCUTCONTMGR_H |
| 2 |
#define PAMVMCCUTCONTMGR_H |
| 3 |
#include <iostream> |
| 4 |
|
| 5 |
#include "TString.h" |
| 6 |
#include "TObjString.h" |
| 7 |
#include "TMap.h" |
| 8 |
#include "TVirtualMC.h" |
| 9 |
#include "pCutControl.h" |
| 10 |
|
| 11 |
|
| 12 |
class PamVMCCutContMgr: public TObject { |
| 13 |
|
| 14 |
private: |
| 15 |
|
| 16 |
static PamVMCCutContMgr * fcutcont; |
| 17 |
TMap fcutcontmap; |
| 18 |
|
| 19 |
protected: |
| 20 |
~PamVMCCutContMgr() {fcutcontmap.DeleteAll();}; |
| 21 |
|
| 22 |
public: |
| 23 |
|
| 24 |
static PamVMCCutContMgr * Instance(); |
| 25 |
|
| 26 |
pCutControl * GetCutCont(const char *medname){ |
| 27 |
return (pCutControl*)fcutcontmap(medname); |
| 28 |
} |
| 29 |
|
| 30 |
void SetCutCont(const char *medname, pCutControl * pCC){ |
| 31 |
fcutcontmap.Add(new TObjString(medname),pCC); |
| 32 |
} |
| 33 |
|
| 34 |
void SetCuts(){ |
| 35 |
TMapIter *n= (TMapIter *)fcutcontmap.MakeIterator(); |
| 36 |
TObject *o; while( (o=(TObject *) n->Next())) { |
| 37 |
|
| 38 |
((pCutControl*)fcutcontmap.GetValue(o))->SetCuts(); |
| 39 |
|
| 40 |
} |
| 41 |
delete n; |
| 42 |
} |
| 43 |
|
| 44 |
void Print(const Option_t* ="") const{ |
| 45 |
|
| 46 |
std::cout<<"LIST OF CUTS AND CONTROLS FOR REGISTERED MEDIA"<<std::endl; |
| 47 |
TMapIter *n= (TMapIter *)fcutcontmap.MakeIterator(); |
| 48 |
TObject *o; while( (o=(TObject *) n->Next())) { |
| 49 |
TString medname =(*(TObjString*)o).GetString(); |
| 50 |
std::cout<<"MEDIA: "<<medname<<std::endl; |
| 51 |
((pCutControl*)fcutcontmap.GetValue(o))->Print(); |
| 52 |
} |
| 53 |
delete n; |
| 54 |
} |
| 55 |
|
| 56 |
}; |
| 57 |
#endif |