CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaObject.cc

Go to the documentation of this file.
00001 //---------Author's Name: B.Fabbro DSM/IRFU/SPP CEA-Saclay
00002 //----------Copyright: Those valid for CEA sofware
00003 //----------Modified: 24/03/2011
00004 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaObject.h"
00005 
00006 //--------------------------------------
00007 //  TEcnaObject.cc
00008 //  Class creation: 15 October 2010
00009 //  Documentation: see TEcnaObject.h
00010 //--------------------------------------
00011 
00012 ClassImp(TEcnaObject)
00013 //______________________________________________________________________________
00014 //
00015 
00016   TEcnaObject::~TEcnaObject()
00017 {
00018 //destructor
00019 
00020  // cout << "[Info Management] CLASS: TEcnaObject.      DESTROY OBJECT: this = " << this << endl;
00021 }
00022 
00023 //===================================================================
00024 //
00025 //                   Constructors
00026 //
00027 //===================================================================
00028 TEcnaObject::TEcnaObject()
00029 {
00030 // Constructor without argument
00031 
00032  // cout << "[Info Management] CLASS: TEcnaObject.      CREATE OBJECT: this = " << this << endl;
00033 
00034   Long_t PointerValue = (Long_t)this;
00035   Int_t un = 1;
00036   NumberCreateObjectMessage("TEcnaObject", PointerValue, un);
00037 
00038   Init();
00039 
00040 }
00041 
00042 void  TEcnaObject::Init()
00043 {
00044   fgMaxCar = 512;
00045   fTTBELL = '\007';
00046 
00047   //................ Init pointers to TEcna Objects
00048   fObjectTEcnaGui        = 0;
00049   fObjectTEcnaHeader     = 0;
00050   fObjectTEcnaHistos     = 0;
00051   fObjectTEcnaNArrayD    = 0;
00052   fObjectTEcnaNumbering  = 0;
00053   fObjectTEcnaParCout    = 0;
00054   fObjectTEcnaParEcal    = 0;
00055   fObjectTEcnaParHistos  = 0;
00056   fObjectTEcnaRead       = 0;
00057   fObjectTEcnaResultType = 0;
00058   fObjectTEcnaRootFile   = 0;
00059   fObjectTEcnaRun        = 0;
00060   fObjectTEcnaWrite      = 0;
00061 
00062   //................ Init counters of TEcna Object creation
00063   fCounterCreateTEcnaGui        = 0;
00064   fCounterCreateTEcnaHeader     = 0;
00065   fCounterCreateTEcnaHistos     = 0;
00066   fCounterCreateTEcnaNArrayD    = 0;
00067   fCounterCreateTEcnaNumbering  = 0;
00068   fCounterCreateTEcnaParCout    = 0;
00069   fCounterCreateTEcnaParEcal    = 0;
00070   fCounterCreateTEcnaParHistos  = 0;
00071   fCounterCreateTEcnaRead       = 0;
00072   fCounterCreateTEcnaResultType = 0;
00073   fCounterCreateTEcnaRootFile   = 0;
00074   fCounterCreateTEcnaRun        = 0;
00075   fCounterCreateTEcnaWrite      = 0;
00076 
00077   //................ Init counters of TEcna Object re-using
00078   fCounterReusingTEcnaGui        = 0;
00079   fCounterReusingTEcnaHeader     = 0;
00080   fCounterReusingTEcnaHistos     = 0;
00081   fCounterReusingTEcnaNArrayD    = 0;
00082   fCounterReusingTEcnaNumbering  = 0;
00083   fCounterReusingTEcnaParCout    = 0;
00084   fCounterReusingTEcnaParEcal    = 0;
00085   fCounterReusingTEcnaParHistos  = 0;
00086   fCounterReusingTEcnaRead       = 0;
00087   fCounterReusingTEcnaResultType = 0;
00088   fCounterReusingTEcnaRootFile   = 0;
00089   fCounterReusingTEcnaRun        = 0;
00090   fCounterReusingTEcnaWrite      = 0;
00091 
00092 }// end of Init()
00093 
00094 
00095 //=======================================================================================
00096 //
00097 //              P O I N T E R /  O B J E C T   M A N A G E M E N T 
00098 //
00099 //              TEcnaObject not in list because it is the manager
00100 //
00101 //=======================================================================================
00102 Bool_t TEcnaObject::RegisterPointer(const TString ClassName, const Long_t& PointerValue)
00103 {
00104   Bool_t ClassFound = kFALSE;
00105 
00106   if( ClassName == "TEcnaGui"        )
00107     {
00108       ClassFound = kTRUE;
00109       fObjectTEcnaGui = PointerValue;
00110       fCounterCreateTEcnaGui++;
00111       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaGui);
00112     }
00113 
00114   if( ClassName == "TEcnaHeader"     )
00115     {
00116       ClassFound = kTRUE;
00117       fObjectTEcnaHeader = PointerValue;
00118       fCounterCreateTEcnaHeader++;
00119       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaHeader);
00120     }
00121 
00122   if( ClassName == "TEcnaHistos"     )
00123     {
00124       ClassFound = kTRUE;
00125       fObjectTEcnaHistos = PointerValue;
00126       fCounterCreateTEcnaHistos++;
00127       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaHistos);
00128     }
00129 
00130   if( ClassName == "TEcnaNArrayD"    )
00131     {
00132       ClassFound = kTRUE;
00133       fObjectTEcnaNArrayD = PointerValue;
00134       fCounterCreateTEcnaNArrayD++;
00135       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaNArrayD);
00136     }
00137 
00138   if( ClassName == "TEcnaNumbering"  )
00139     {
00140       ClassFound = kTRUE;
00141       fObjectTEcnaNumbering = PointerValue;
00142       fCounterCreateTEcnaNumbering++;
00143       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaNumbering);
00144     }
00145 
00146   if( ClassName == "TEcnaParCout"    )
00147     {
00148       ClassFound = kTRUE;
00149       fObjectTEcnaParCout = PointerValue;
00150       fCounterCreateTEcnaParCout++;
00151       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParCout);
00152     }
00153 
00154   if( ClassName == "TEcnaParEcal"    )
00155     {
00156       ClassFound = kTRUE;
00157       fObjectTEcnaParEcal = PointerValue;
00158       fCounterCreateTEcnaParEcal++;
00159       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParEcal);
00160     }
00161 
00162   if( ClassName == "TEcnaParHistos"  )
00163     {
00164       ClassFound = kTRUE;
00165       fObjectTEcnaParHistos = PointerValue;
00166       fCounterCreateTEcnaParHistos++;
00167       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParHistos);
00168     }
00169 
00170   if( ClassName == "TEcnaParPaths"   )
00171     {
00172       ClassFound = kTRUE;
00173       fObjectTEcnaParPaths = PointerValue;
00174       fCounterCreateTEcnaParPaths++;
00175       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaParPaths);
00176     }
00177 
00178   if( ClassName == "TEcnaRead"       )
00179     {
00180       ClassFound = kTRUE;
00181       fObjectTEcnaRead = PointerValue;
00182       fCounterCreateTEcnaRead++;
00183       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaRead);
00184     }
00185 
00186   if( ClassName == "TEcnaResultType" )
00187     {
00188       ClassFound = kTRUE;
00189       fObjectTEcnaResultType = PointerValue;
00190       fCounterCreateTEcnaResultType++;
00191       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaResultType);
00192     }
00193 
00194   if( ClassName == "TEcnaRootFile"   )
00195     {
00196       ClassFound = kTRUE;
00197       fObjectTEcnaRootFile = PointerValue;
00198       fCounterCreateTEcnaRootFile++;
00199       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaRootFile);
00200     }
00201 
00202   if( ClassName == "TEcnaRun"        )
00203     {
00204       ClassFound = kTRUE;
00205       fObjectTEcnaRun = PointerValue;
00206       fCounterCreateTEcnaRun++;
00207       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaRun);
00208     }
00209 
00210   if( ClassName == "TEcnaWrite"      )
00211     {
00212       ClassFound = kTRUE;
00213       fObjectTEcnaWrite = PointerValue;
00214       fCounterCreateTEcnaWrite++;
00215       NumberCreateObjectMessage(ClassName.Data(), PointerValue, fCounterCreateTEcnaWrite);
00216     }
00217 
00218   //.........................................................................................
00219   if( ClassFound == kFALSE )
00220     {
00221       cout << "!TEcnaObject::RegisterPointer(...)> Class " << ClassName
00222            << " not found." << fTTBELL << endl;
00223     }
00224 
00225   return ClassFound;
00226 } // end of RegisterPointer(...)
00227 
00228 
00229 Long_t TEcnaObject::GetPointerValue(const TString ClassName)
00230 {
00231   Long_t PointerValue = 0;
00232 
00233   if( ClassName == "TEcnaGui" )
00234     {
00235       PointerValue = fObjectTEcnaGui;
00236       fCounterReusingTEcnaGui++;
00237       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaGui);
00238     }
00239 
00240   if( ClassName == "TEcnaHeader" )
00241     {
00242       PointerValue = fObjectTEcnaHeader;
00243       fCounterReusingTEcnaHeader++;
00244       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaHeader);
00245     }
00246 
00247   if( ClassName == "TEcnaHistos" )
00248     {
00249       PointerValue = fObjectTEcnaHistos;
00250       fCounterReusingTEcnaHistos++;
00251       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaHistos);
00252     }
00253 
00254   if( ClassName == "TEcnaNArrayD" )
00255     {
00256       PointerValue = fObjectTEcnaNArrayD;
00257       fCounterReusingTEcnaNArrayD++;
00258       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaNArrayD);
00259     }
00260 
00261   if( ClassName == "TEcnaNumbering" )
00262     {
00263       PointerValue = fObjectTEcnaNumbering;
00264       fCounterReusingTEcnaNumbering++;
00265       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaNumbering);
00266     }
00267 
00268   if( ClassName == "TEcnaParCout" )
00269     {
00270       PointerValue = fObjectTEcnaParCout;
00271       fCounterReusingTEcnaParCout++;
00272       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParCout);
00273     }
00274 
00275   if( ClassName == "TEcnaParEcal" )
00276     {
00277       PointerValue = fObjectTEcnaParEcal;
00278       fCounterReusingTEcnaParEcal++;
00279       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParEcal);
00280     }
00281 
00282   if( ClassName == "TEcnaParHistos" )
00283     {
00284       PointerValue = fObjectTEcnaParHistos;
00285       fCounterReusingTEcnaParHistos++;
00286       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParHistos);
00287     }
00288 
00289   if( ClassName == "TEcnaParPaths" )
00290     {
00291       PointerValue = fObjectTEcnaParPaths;
00292       fCounterReusingTEcnaParPaths++;
00293       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaParPaths);
00294     }
00295 
00296   if( ClassName == "TEcnaRead" )
00297     {
00298       PointerValue = fObjectTEcnaRead;
00299       fCounterReusingTEcnaRead++;
00300       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaRead);
00301     }
00302 
00303   if( ClassName == "TEcnaResultType" )
00304     {
00305       PointerValue = fObjectTEcnaResultType;
00306       fCounterReusingTEcnaResultType++;
00307       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaResultType);
00308     }
00309 
00310   if( ClassName == "TEcnaRootFile" )
00311     {
00312       PointerValue = fObjectTEcnaRootFile;
00313       fCounterReusingTEcnaRootFile++;
00314       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaRootFile);
00315     }
00316 
00317   if( ClassName == "TEcnaRun" )
00318     {
00319       PointerValue = fObjectTEcnaRun;
00320       fCounterReusingTEcnaRun++;
00321       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaRun);
00322     }
00323 
00324   if( ClassName == "TEcnaWrite" )
00325     {
00326       PointerValue = fObjectTEcnaWrite;
00327       fCounterReusingTEcnaWrite++;
00328       NumberReuseObjectMessage(ClassName.Data(), PointerValue, fCounterReusingTEcnaWrite);
00329     }
00330 
00331   return PointerValue;
00332 }
00333 
00334 void TEcnaObject::NumberCreateObjectMessage(const TString ClassName, const Long_t& PointerValue, const Int_t& NbOfObjects)
00335 {
00336 #define NOCM
00337 #ifndef NOCM
00338   cout << "*TEcnaObject::NumberCreateObjectMessage(...)> New ECNA object (pointer = "
00339        << PointerValue << ") from TEcnaObject " << this 
00340        << ". Object# = " << setw(8) << NbOfObjects
00341        << ", Class: " << ClassName;
00342   if( NbOfObjects > 1 ){cout << " (INFO: more than 1 object)";}
00343   cout << endl;
00344 #endif // NOCM
00345 }
00346 
00347 void TEcnaObject::NumberReuseObjectMessage(const TString ClassName, const Long_t& PointerValue, const Int_t& NbOfObjects)
00348 {
00349 #define NOCR
00350 #ifndef NOCR
00351   if( PointerValue != 0 )
00352     {
00353       cout << "*TEcnaObject::GetPointerValue(...)> INFO: pointer " << PointerValue
00354            << " used again from TEcnaObject " << this
00355            << ". " << setw(8) << NbOfObjects << " times, class: " << ClassName;
00356     }
00357   cout << endl;
00358 #endif // NOCR
00359 }