Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaDetector.cxx
Go to the documentation of this file.
1//*-- Author : Ole Hansen 15-May-00
2
4//
5// THaDetector
6//
8
9#include "THaDetector.h"
10#include "THaApparatus.h"
11
12#include <cassert>
13#include <sstream>
14
15using namespace std;
16
17//_____________________________________________________________________________
18THaDetector::THaDetector( const char* name, const char* description,
19 THaApparatus* apparatus )
20 : THaDetectorBase(name,description), fApparatus(apparatus)
21{
22 // Constructor
23
24 if( !name || !*name ) {
25 Error( "THaDetector()", "Must construct detector with valid name! "
26 "Object construction failed." );
27 MakeZombie();
28 return;
29 }
30}
31
32//_____________________________________________________________________________
33THaDetector::THaDetector() : fApparatus(nullptr)
34{
35 // for ROOT I/O only
36}
37
38//_____________________________________________________________________________
40
41//_____________________________________________________________________________
43{
44 return static_cast<THaApparatus*>(fApparatus.GetObject());
45}
46
47//_____________________________________________________________________________
49{
50 // Associate this detector with the given apparatus.
51 // Only possible before initialization.
52
53 if( IsInit() ) {
54 Warning( Here("SetApparatus()"), "Cannot set apparatus. "
55 "Object already initialized.");
56 return;
57 }
58 fApparatus = apparatus;
59}
60
61//_____________________________________________________________________________
63{
64 // Set up name prefix for global variables. Internal function called
65 // during initialization.
66
68 const char* basename = app ? app->GetName() : nullptr;
70
71}
72
73//_____________________________________________________________________________
75{
76 // Print detector-specific warning message summary
77
78 if( !fMessages.empty() ) {
79 ULong64_t ntot = 0;
80 map<string,UInt_t> chan_count;
81 for( const auto& fMessage : fMessages ) {
82 ntot += fMessage.second;
83 const string& m = fMessage.first;
84 string::size_type pos = m.find("channel");
85 if( pos != string::npos ) {
86 string::size_type pos2 = m.find('.',pos+7), len = string::npos;
87 if( pos > 3 ) pos -= 4;
88 if( pos2 != string::npos ) {
89 assert( pos2 > pos );
90 len = pos2-pos;
91 }
92 ++chan_count[m.substr(pos,len)]; // e.g. substr = "TDC channel 1/2/3"
93 } else {
94 ++chan_count[m];
95 }
96 }
97 ostringstream msg;
98 msg << endl
99 << " Encountered " << fNEventsWithWarnings << " events with "
100 << "warnings, " << ntot << " total warnings"
101 << endl
102 << " affecting " << chan_count.size() << " out of "
103 << fDetMap->GetTotNumChan() << " channels. Check signals for noise!"
104 << endl
105 << " Call Print(\"WARN\") for channel list. "
106 << "Re-run with fDebug>0 for per-event details.";
107 Warning( Here("End"), "%s", msg.str().c_str() );
108 }
109
110 fMessages.clear();
111 return THaDetectorBase::End(run);
112}
113
114//_____________________________________________________________________________
int Int_t
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
char name[80]
virtual Int_t End(THaRunBase *r=nullptr)
virtual const char * Here(const char *) const
std::map< std::string, UInt_t > fMessages
virtual void MakePrefix()
Bool_t IsInit() const
UInt_t GetTotNumChan() const
THaDetMap * fDetMap
virtual Int_t End(THaRunBase *r=0)
virtual void SetApparatus(THaApparatus *)
virtual void MakePrefix()
virtual ~THaDetector()
TRef fApparatus
Definition THaDetector.h:39
THaApparatus * GetApparatus() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
void MakeZombie()
TObject * GetObject() const
unsigned long long ULong64_t
STL namespace.
TMarker m
ClassImp(TPyArg)