CMS 3D CMS Logo

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