CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TEcnaObject.cc
Go to the documentation of this file.
1 //---------Author's Name: B.Fabbro DSM/IRFU/SPP CEA-Saclay
2 //----------Copyright: Those valid for CEA sofware
3 //----------Modified: 24/03/2011
5 using namespace std;
6 
7 //--------------------------------------
8 // TEcnaObject.cc
9 // Class creation: 15 October 2010
10 // Documentation: see TEcnaObject.h
11 //--------------------------------------
12 
13 ClassImp(TEcnaObject)
14 //______________________________________________________________________________
15 //
16 
18 {
19 //destructor
20 
21  // cout << "[Info Management] CLASS: TEcnaObject. DESTROY OBJECT: this = " << this << endl;
22 }
23 
24 //===================================================================
25 //
26 // Constructors
27 //
28 //===================================================================
30 {
31 // Constructor without argument
32 
33  // cout << "[Info Management] CLASS: TEcnaObject. CREATE OBJECT: this = " << this << endl;
34 
35  Long_t PointerValue = (Long_t)this;
36  Int_t un = 1;
37  NumberCreateObjectMessage("TEcnaObject", PointerValue, un);
38 
39  Init();
40 
41 }
42 
44 {
45  fgMaxCar = 512;
46  fTTBELL = '\007';
47 
48  //................ Init pointers to TEcna Objects
49  fObjectTEcnaGui = 0;
50  fObjectTEcnaHeader = 0;
51  fObjectTEcnaHistos = 0;
52  fObjectTEcnaNArrayD = 0;
53  fObjectTEcnaNumbering = 0;
54  fObjectTEcnaParCout = 0;
55  fObjectTEcnaParEcal = 0;
56  fObjectTEcnaParHistos = 0;
57  fObjectTEcnaRead = 0;
58  fObjectTEcnaResultType = 0;
59  fObjectTEcnaRootFile = 0;
60  fObjectTEcnaRun = 0;
61  fObjectTEcnaWrite = 0;
62 
63  //................ Init counters of TEcna Object creation
64  fCounterCreateTEcnaGui = 0;
65  fCounterCreateTEcnaHeader = 0;
66  fCounterCreateTEcnaHistos = 0;
67  fCounterCreateTEcnaNArrayD = 0;
68  fCounterCreateTEcnaNumbering = 0;
69  fCounterCreateTEcnaParCout = 0;
70  fCounterCreateTEcnaParEcal = 0;
71  fCounterCreateTEcnaParHistos = 0;
72  fCounterCreateTEcnaRead = 0;
73  fCounterCreateTEcnaResultType = 0;
74  fCounterCreateTEcnaRootFile = 0;
75  fCounterCreateTEcnaRun = 0;
76  fCounterCreateTEcnaWrite = 0;
77 
78  //................ Init counters of TEcna Object re-using
79  fCounterReusingTEcnaGui = 0;
80  fCounterReusingTEcnaHeader = 0;
81  fCounterReusingTEcnaHistos = 0;
82  fCounterReusingTEcnaNArrayD = 0;
83  fCounterReusingTEcnaNumbering = 0;
84  fCounterReusingTEcnaParCout = 0;
85  fCounterReusingTEcnaParEcal = 0;
86  fCounterReusingTEcnaParHistos = 0;
87  fCounterReusingTEcnaRead = 0;
88  fCounterReusingTEcnaResultType = 0;
89  fCounterReusingTEcnaRootFile = 0;
90  fCounterReusingTEcnaRun = 0;
91  fCounterReusingTEcnaWrite = 0;
92 
93 }// end of Init()
94 
95 
96 //=======================================================================================
97 //
98 // P O I N T E R / O B J E C T M A N A G E M E N T
99 //
100 // TEcnaObject not in list because it is the manager
101 //
102 //=======================================================================================
103 Bool_t TEcnaObject::RegisterPointer(const TString& ClassName, const Long_t& PointerValue)
104 {
105  Bool_t ClassFound = kFALSE;
106 
107  if( ClassName == "TEcnaGui" )
108  {
109  ClassFound = kTRUE;
110  fObjectTEcnaGui = PointerValue;
111  fCounterCreateTEcnaGui++;
112  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaGui);
113  }
114 
115  if( ClassName == "TEcnaHeader" )
116  {
117  ClassFound = kTRUE;
118  fObjectTEcnaHeader = PointerValue;
119  fCounterCreateTEcnaHeader++;
120  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaHeader);
121  }
122 
123  if( ClassName == "TEcnaHistos" )
124  {
125  ClassFound = kTRUE;
126  fObjectTEcnaHistos = PointerValue;
127  fCounterCreateTEcnaHistos++;
128  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaHistos);
129  }
130 
131  if( ClassName == "TEcnaNArrayD" )
132  {
133  ClassFound = kTRUE;
134  fObjectTEcnaNArrayD = PointerValue;
135  fCounterCreateTEcnaNArrayD++;
136  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaNArrayD);
137  }
138 
139  if( ClassName == "TEcnaNumbering" )
140  {
141  ClassFound = kTRUE;
142  fObjectTEcnaNumbering = PointerValue;
143  fCounterCreateTEcnaNumbering++;
144  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaNumbering);
145  }
146 
147  if( ClassName == "TEcnaParCout" )
148  {
149  ClassFound = kTRUE;
150  fObjectTEcnaParCout = PointerValue;
151  fCounterCreateTEcnaParCout++;
152  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParCout);
153  }
154 
155  if( ClassName == "TEcnaParEcal" )
156  {
157  ClassFound = kTRUE;
158  fObjectTEcnaParEcal = PointerValue;
159  fCounterCreateTEcnaParEcal++;
160  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParEcal);
161  }
162 
163  if( ClassName == "TEcnaParHistos" )
164  {
165  ClassFound = kTRUE;
166  fObjectTEcnaParHistos = PointerValue;
167  fCounterCreateTEcnaParHistos++;
168  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParHistos);
169  }
170 
171  if( ClassName == "TEcnaParPaths" )
172  {
173  ClassFound = kTRUE;
174  fObjectTEcnaParPaths = PointerValue;
175  fCounterCreateTEcnaParPaths++;
176  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParPaths);
177  }
178 
179  if( ClassName == "TEcnaRead" )
180  {
181  ClassFound = kTRUE;
182  fObjectTEcnaRead = PointerValue;
183  fCounterCreateTEcnaRead++;
184  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaRead);
185  }
186 
187  if( ClassName == "TEcnaResultType" )
188  {
189  ClassFound = kTRUE;
190  fObjectTEcnaResultType = PointerValue;
191  fCounterCreateTEcnaResultType++;
192  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaResultType);
193  }
194 
195  if( ClassName == "TEcnaRootFile" )
196  {
197  ClassFound = kTRUE;
198  fObjectTEcnaRootFile = PointerValue;
199  fCounterCreateTEcnaRootFile++;
200  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaRootFile);
201  }
202 
203  if( ClassName == "TEcnaRun" )
204  {
205  ClassFound = kTRUE;
206  fObjectTEcnaRun = PointerValue;
207  fCounterCreateTEcnaRun++;
208  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaRun);
209  }
210 
211  if( ClassName == "TEcnaWrite" )
212  {
213  ClassFound = kTRUE;
214  fObjectTEcnaWrite = PointerValue;
215  fCounterCreateTEcnaWrite++;
216  NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaWrite);
217  }
218 
219  //.........................................................................................
220  if( ClassFound == kFALSE )
221  {
222  cout << "!TEcnaObject::RegisterPointer(...)> Class " << ClassName
223  << " not found." << fTTBELL << endl;
224  }
225 
226  return ClassFound;
227 } // end of RegisterPointer(...)
228 
229 
231 {
232  Long_t PointerValue = 0;
233 
234  if( ClassName == "TEcnaGui" )
235  {
236  PointerValue = fObjectTEcnaGui;
237  fCounterReusingTEcnaGui++;
238  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaGui);
239  }
240 
241  if( ClassName == "TEcnaHeader" )
242  {
243  PointerValue = fObjectTEcnaHeader;
244  fCounterReusingTEcnaHeader++;
245  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaHeader);
246  }
247 
248  if( ClassName == "TEcnaHistos" )
249  {
250  PointerValue = fObjectTEcnaHistos;
251  fCounterReusingTEcnaHistos++;
252  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaHistos);
253  }
254 
255  if( ClassName == "TEcnaNArrayD" )
256  {
257  PointerValue = fObjectTEcnaNArrayD;
258  fCounterReusingTEcnaNArrayD++;
259  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaNArrayD);
260  }
261 
262  if( ClassName == "TEcnaNumbering" )
263  {
264  PointerValue = fObjectTEcnaNumbering;
265  fCounterReusingTEcnaNumbering++;
266  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaNumbering);
267  }
268 
269  if( ClassName == "TEcnaParCout" )
270  {
271  PointerValue = fObjectTEcnaParCout;
272  fCounterReusingTEcnaParCout++;
273  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParCout);
274  }
275 
276  if( ClassName == "TEcnaParEcal" )
277  {
278  PointerValue = fObjectTEcnaParEcal;
279  fCounterReusingTEcnaParEcal++;
280  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParEcal);
281  }
282 
283  if( ClassName == "TEcnaParHistos" )
284  {
285  PointerValue = fObjectTEcnaParHistos;
286  fCounterReusingTEcnaParHistos++;
287  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParHistos);
288  }
289 
290  if( ClassName == "TEcnaParPaths" )
291  {
292  PointerValue = fObjectTEcnaParPaths;
293  fCounterReusingTEcnaParPaths++;
294  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParPaths);
295  }
296 
297  if( ClassName == "TEcnaRead" )
298  {
299  PointerValue = fObjectTEcnaRead;
300  fCounterReusingTEcnaRead++;
301  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaRead);
302  }
303 
304  if( ClassName == "TEcnaResultType" )
305  {
306  PointerValue = fObjectTEcnaResultType;
307  fCounterReusingTEcnaResultType++;
308  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaResultType);
309  }
310 
311  if( ClassName == "TEcnaRootFile" )
312  {
313  PointerValue = fObjectTEcnaRootFile;
314  fCounterReusingTEcnaRootFile++;
315  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaRootFile);
316  }
317 
318  if( ClassName == "TEcnaRun" )
319  {
320  PointerValue = fObjectTEcnaRun;
321  fCounterReusingTEcnaRun++;
322  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaRun);
323  }
324 
325  if( ClassName == "TEcnaWrite" )
326  {
327  PointerValue = fObjectTEcnaWrite;
328  fCounterReusingTEcnaWrite++;
329  NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaWrite);
330  }
331 
332  return PointerValue;
333 }
334 
335 void TEcnaObject::NumberCreateObjectMessage(const TString& ClassName, const Long_t& PointerValue, const Int_t& NbOfObjects)
336 {
337 #define NOCM
338 #ifndef NOCM
339  cout << "*TEcnaObject::NumberCreateObjectMessage(...)> New ECNA object (pointer = "
340  << PointerValue << ") from TEcnaObject " << this
341  << ". Object# = " << setw(8) << NbOfObjects
342  << ", Class: " << ClassName;
343  if( NbOfObjects > 1 ){cout << " (INFO: more than 1 object)";}
344  cout << endl;
345 #endif // NOCM
346 }
347 
348 void TEcnaObject::NumberReuseObjectMessage(const TString& ClassName, const Long_t& PointerValue, const Int_t& NbOfObjects)
349 {
350 #define NOCR
351 #ifndef NOCR
352  if( PointerValue != 0 )
353  {
354  cout << "*TEcnaObject::GetPointerValue(...)> INFO: pointer " << PointerValue
355  << " used again from TEcnaObject " << this
356  << ". " << setw(8) << NbOfObjects << " times, class: " << ClassName;
357  }
358  cout << endl;
359 #endif // NOCR
360 }
Bool_t RegisterPointer(const TString &, const Long_t &)
Definition: TEcnaObject.cc:103
void NumberCreateObjectMessage(const TString &, const Long_t &, const Int_t &)
Definition: TEcnaObject.cc:335
tuple cout
Definition: gather_cfg.py:121
void NumberReuseObjectMessage(const TString &, const Long_t &, const Int_t &)
Definition: TEcnaObject.cc:348
void Init()
Definition: TEcnaObject.cc:43
Long_t GetPointerValue(const TString &)
Definition: TEcnaObject.cc:230