kaliveda-dev team mailing list archive
-
kaliveda-dev team
-
Mailing list archive
-
Message #00421
[Merge] lp:~frankland/kaliveda/new-namevaluelist into lp:kaliveda
John Frankland has proposed merging lp:~frankland/kaliveda/new-namevaluelist into lp:kaliveda.
Requested reviews:
KaliVeda Development Team (kaliveda-dev)
For more details, see:
https://code.launchpad.net/~frankland/kaliveda/new-namevaluelist/+merge/84903
implements parameter lists for particles and events
--
https://code.launchpad.net/~frankland/kaliveda/new-namevaluelist/+merge/84903
Your team KaliVeda Development Team is requested to review the proposed merge of lp:~frankland/kaliveda/new-namevaluelist into lp:kaliveda.
=== modified file 'KVIndra/analysis/KVINDRARawDataReconstructor.cpp'
--- KVIndra/analysis/KVINDRARawDataReconstructor.cpp 2011-06-24 10:06:44 +0000
+++ KVIndra/analysis/KVINDRARawDataReconstructor.cpp 2011-12-08 08:55:27 +0000
@@ -40,7 +40,7 @@
KVINDRARawDataReconstructor::~KVINDRARawDataReconstructor()
{
//Destructor
- if(recev) delete recev;
+ SafeDelete(recev);
}
void KVINDRARawDataReconstructor::InitAnalysis()
@@ -53,7 +53,7 @@
// If no value is set for the current dataset (second variable), the value of the
// first variable will be used.
- recev = new KVINDRAReconEvent;
+ if(!recev) recev = new KVINDRAReconEvent;
recev->SetPartSeedCond( gDataSet->GetDataSetEnv("Reconstruction.DataAnalysisTask.ParticleSeedCond") );
}
@@ -189,6 +189,8 @@
void KVINDRARawDataReconstructor::EndRun()
{
+ SafeDelete(recev);
+
cout << endl << " *** Number of reconstructed INDRA events : "
<< nb_recon << " ***" << endl<< endl;
file->cd();
=== modified file 'KVIndra/analysis/KVSelector.cpp'
--- KVIndra/analysis/KVSelector.cpp 2011-07-19 10:06:34 +0000
+++ KVIndra/analysis/KVSelector.cpp 2011-12-08 08:55:27 +0000
@@ -195,7 +195,6 @@
data=0;b_data=0;
fChain->SetBranchAddress( fBranchName.Data() , &data, &b_data);
- b_data->SetAutoDelete(kFALSE);
//
// Builds a TEventList by adding the contents of the lists for each run
@@ -333,9 +332,15 @@
fTreeEntry = entry;
- if (!(totentry % 5000) && totentry)
+ if (!(totentry % 5000) && totentry){
cout << " +++ " << totentry << " events processed +++ " << endl;
-
+ ProcInfo_t pid;
+ if(gSystem->GetProcInfo(&pid)==0){
+ cout << " ------------- Process infos -------------" << endl;
+ printf(" CpuSys = %f s. CpuUser = %f s. ResMem = %f MB VirtMem = %f MB\n",
+ pid.fCpuSys, pid.fCpuUser, pid.fMemResident/1024., pid.fMemVirtual/1024.);
+ }
+ }
fChain->GetTree()->GetEntry(fTreeEntry);
gDataAnalyser->preAnalysis();
=== modified file 'KVIndra/events/KVINDRAReconEvent.cpp'
--- KVIndra/events/KVINDRAReconEvent.cpp 2011-06-27 09:21:04 +0000
+++ KVIndra/events/KVINDRAReconEvent.cpp 2011-12-08 08:55:27 +0000
@@ -88,7 +88,7 @@
//Access to event member with index npart (1<=npart<=fMult)
//
- return (KVINDRAReconNuc *) (KVEvent::GetParticle(npart));
+ return (KVINDRAReconNuc *) (KVReconstructedEvent::GetParticle(npart));
}
/////////////////////////////////////////////////////////////////////////////
@@ -97,7 +97,7 @@
{
//Wrapper for KVEvent::GetNextParticle casting result to KVINDRAReconNuc*
- KVINDRAReconNuc *tmp = (KVINDRAReconNuc *) (KVEvent::AddParticle());
+ KVINDRAReconNuc *tmp = (KVINDRAReconNuc *) (KVReconstructedEvent::AddParticle());
return tmp;
}
=== modified file 'KVMultiDet/analysis/KVEventSelector.cpp'
--- KVMultiDet/analysis/KVEventSelector.cpp 2011-04-05 23:44:40 +0000
+++ KVMultiDet/analysis/KVEventSelector.cpp 2011-12-08 08:55:27 +0000
@@ -2,6 +2,7 @@
#include "KVEventSelector.h"
#include <TStyle.h>
#include "TPluginManager.h"
+#include "TSystem.h"
ClassImp(KVEventSelector)
@@ -50,8 +51,15 @@
fTreeEntry = entry;
- if (!(fEventsRead % fEventsReadInterval) && fEventsRead) Info("Process", " +++ %ld events processed +++ ", fEventsRead);
-
+ if (!(fEventsRead % fEventsReadInterval) && fEventsRead) {
+ Info("Process", " +++ %ld events processed +++ ", fEventsRead);
+ ProcInfo_t pid;
+ if(gSystem->GetProcInfo(&pid)==0){
+ cout << " ------------- Process infos -------------" << endl;
+ printf(" CpuSys = %f s. CpuUser = %f s. ResMem = %f MB VirtMem = %f MB\n",
+ pid.fCpuSys, pid.fCpuUser, pid.fMemResident/1024., pid.fMemVirtual/1024.);
+ }
+ }
GetEntry(entry);
fEventsRead++;
=== modified file 'KVMultiDet/analysis/KVRawDataAnalyser.cpp'
--- KVMultiDet/analysis/KVRawDataAnalyser.cpp 2011-11-23 10:51:51 +0000
+++ KVMultiDet/analysis/KVRawDataAnalyser.cpp 2011-12-08 08:55:27 +0000
@@ -5,6 +5,7 @@
#include "KVMultiDetArray.h"
#include "KVClassFactory.h"
#include "TH1.h"
+#include "TSystem.h"
ClassImp(KVRawDataAnalyser)
@@ -90,7 +91,15 @@
fDetEv->Clear();
- if(!((fEventNumber)%10000)) cout<< " ++++ " << fEventNumber << " events read ++++ " << endl;
+ if(!((fEventNumber)%10000)) {
+ cout<< " ++++ " << fEventNumber << " events read ++++ " << endl;
+ ProcInfo_t pid;
+ if(gSystem->GetProcInfo(&pid)==0){
+ cout << " ------------- Process infos -------------" << endl;
+ printf(" CpuSys = %f s. CpuUser = %f s. ResMem = %f MB VirtMem = %f MB\n",
+ pid.fCpuSys, pid.fCpuUser, pid.fMemResident/1024., pid.fMemVirtual/1024.);
+ }
+ }
fEventNumber+=1;
}
=== modified file 'KVMultiDet/analysis/KVSimReader.cpp'
--- KVMultiDet/analysis/KVSimReader.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader.cpp 2011-12-08 08:55:27 +0000
@@ -36,7 +36,7 @@
{
// Destructor
//Info("~KVSimReader","clear de nv");
- nv->Clear_NVL();
+ nv->Clear();
//Info("~KVSimReader","delete de nv");
delete nv;
=== modified file 'KVMultiDet/analysis/KVSimReader.h'
--- KVMultiDet/analysis/KVSimReader.h 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader.h 2011-12-08 08:55:27 +0000
@@ -68,7 +68,7 @@
CreateInfoList();
nv = new KVNameValueList();
- nv->SetName_NVL("Temporary List");
+ nv->SetName("Temporary List");
}
virtual KVString GetDate(){
@@ -189,19 +189,19 @@
TList* list = GetTree()->GetUserInfo();
//list->Add(new KVNameValueList());
KVNameValueList* ltamp = (KVNameValueList* )list->Last();
- ltamp->SetName_NVL(GetSimuInfo()->GetName_NVL());
+ ltamp->SetName(GetSimuInfo()->GetName());
Int_t ne = GetSimuInfo()->GetNpar();
for (Int_t kk=0;kk<ne;kk+=1) {
ltamp->SetValue(GetSimuInfo()->GetNameAt(ne),GetSimuInfo()->GetStringValue(ne));
//ltamp->Add(GetSimuInfo()->RemoveAt(0));
}
- GetSimuInfo()->Clear_NVL();
+ GetSimuInfo()->Clear();
}
void CreateInfoList(){
linked_info = new KVNameValueList();
- linked_info->SetOwner_NVL(kFALSE);
- linked_info->SetName_NVL("Simulation info");
+ linked_info->SetOwner(kFALSE);
+ linked_info->SetName("Simulation info");
}
=== modified file 'KVMultiDet/analysis/KVSimReader_HIPSE.cpp'
--- KVMultiDet/analysis/KVSimReader_HIPSE.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader_HIPSE.cpp 2011-12-08 08:55:27 +0000
@@ -46,7 +46,7 @@
while (IsOK()){
while (ReadEvent()){
if (nevt%1000==0) Info("ReadFile","%d evts lus",nevt);
- h1->Fill(evt->GetDoubleValue("Bparstore"));
+ h1->Fill(evt->GetParameters()->GetDoubleValue("Bparstore"));
if (HasToFill()) FillTree();
}
}
@@ -122,7 +122,7 @@
evt->SetNumber(nevt);
mult = GetIntReadPar(0); //mul_vrai
mtotal = GetIntReadPar(1);
- evt->SetValue("mult",mtotal);
+ evt->GetParameters()->SetValue("mult",mtotal);
break;
default:
@@ -141,9 +141,9 @@
case 0:
return kFALSE;
case 1:
- evt->SetValue("Esa",GetDoubleReadPar(0));
- evt->SetValue("vcm",GetDoubleReadPar(1));
- evt->SetValue("Bparstore",GetDoubleReadPar(2));
+ evt->GetParameters()->SetValue("Esa",GetDoubleReadPar(0));
+ evt->GetParameters()->SetValue("vcm",GetDoubleReadPar(1));
+ evt->GetParameters()->SetValue("Bparstore",GetDoubleReadPar(2));
break;
default:
@@ -165,8 +165,8 @@
case 0:
return kFALSE;
case 1:
- evt->SetValue("excitat",GetDoubleReadPar(0));
- evt->SetValue("xmassav",GetDoubleReadPar(1));
+ evt->GetParameters()->SetValue("excitat",GetDoubleReadPar(0));
+ evt->GetParameters()->SetValue("xmassav",GetDoubleReadPar(1));
break;
default:
@@ -180,9 +180,9 @@
return kFALSE;
case 1:
- evt->SetValue("ekinav",GetDoubleReadPar(0));
- evt->SetValue("epotav",GetDoubleReadPar(1));
- evt->SetValue("erotav",GetDoubleReadPar(2));
+ evt->GetParameters()->SetValue("ekinav",GetDoubleReadPar(0));
+ evt->GetParameters()->SetValue("epotav",GetDoubleReadPar(1));
+ evt->GetParameters()->SetValue("erotav",GetDoubleReadPar(2));
break;
default:
@@ -217,7 +217,7 @@
*/
nuc->SetZ(GetIntReadPar(1));
nuc->SetA(GetIntReadPar(0));
- nuc->SetValue("proven",GetDoubleReadPar(2));
+ nuc->GetParameters()->SetValue("proven",GetDoubleReadPar(2));
break;
default:
@@ -254,8 +254,8 @@
return kFALSE;
case 1:
- nuc->SetValue("exci",GetDoubleReadPar(0));
- nuc->SetValue("ether",GetDoubleReadPar(1));
+ nuc->GetParameters()->SetValue("exci",GetDoubleReadPar(0));
+ nuc->GetParameters()->SetValue("ether",GetDoubleReadPar(1));
break;
default:
=== modified file 'KVMultiDet/analysis/KVSimReader_HIPSE_asym.cpp'
--- KVMultiDet/analysis/KVSimReader_HIPSE_asym.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader_HIPSE_asym.cpp 2011-12-08 08:55:27 +0000
@@ -48,7 +48,7 @@
evt->SetNumber(nevt);
mult = GetIntReadPar(0);
mtotal = GetIntReadPar(1);
- evt->SetValue("mult",mtotal);
+ evt->GetParameters()->SetValue("mult",mtotal);
break;
default:
@@ -68,9 +68,9 @@
case 0:
return kFALSE;
case 1:
- evt->SetValue("Esa",GetDoubleReadPar(0));
- evt->SetValue("vcm",GetDoubleReadPar(1));
- evt->SetValue("Bparstore",GetDoubleReadPar(2));
+ evt->GetParameters()->SetValue("Esa",GetDoubleReadPar(0));
+ evt->GetParameters()->SetValue("vcm",GetDoubleReadPar(1));
+ evt->GetParameters()->SetValue("Bparstore",GetDoubleReadPar(2));
break;
default:
@@ -119,7 +119,7 @@
nuc->SetZ(GetIntReadPar(1));
nuc->SetA(GetIntReadPar(0));
- nuc->SetValue("proven",GetDoubleReadPar(2));
+ nuc->GetParameters()->SetValue("proven",GetDoubleReadPar(2));
break;
=== modified file 'KVMultiDet/analysis/KVSimReader_MMM.cpp'
--- KVMultiDet/analysis/KVSimReader_MMM.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader_MMM.cpp 2011-12-08 08:55:27 +0000
@@ -66,10 +66,10 @@
Info("ReadEvent","Nombre de parametres (%d) different de celui attendu (%d)",res,natt);
return kFALSE;
}
- evt->SetValue("Eth",GetDoubleReadPar(idx++));
- evt->SetValue("Eclb",GetDoubleReadPar(idx++));
- evt->SetValue("Eexci",GetDoubleReadPar(idx++));
- evt->SetValue("Ebind",GetDoubleReadPar(idx++));
+ evt->GetParameters()->SetValue("Eth",GetDoubleReadPar(idx++));
+ evt->GetParameters()->SetValue("Eclb",GetDoubleReadPar(idx++));
+ evt->GetParameters()->SetValue("Eexci",GetDoubleReadPar(idx++));
+ evt->GetParameters()->SetValue("Ebind",GetDoubleReadPar(idx++));
for (Int_t mm=0; mm<mult; mm+=1){
nuc = (KVSimNucleus* )evt->AddParticle();
=== modified file 'KVMultiDet/analysis/KVSimReader_SMF.cpp'
--- KVMultiDet/analysis/KVSimReader_SMF.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader_SMF.cpp 2011-12-08 08:55:27 +0000
@@ -127,15 +127,15 @@
}
nuc->SetZ(TMath::Nint(GetDoubleReadPar(1)));
nuc->SetA(TMath::Nint(GetDoubleReadPar(0)));
- nuc->SetValue("density",GetDoubleReadPar(2));
+ nuc->GetParameters()->SetValue("density",GetDoubleReadPar(2));
nuc->SetExcitEnergy(GetDoubleReadPar(3));
- nuc->SetValue("spin",GetDoubleReadPar(4));
+ nuc->GetParameters()->SetValue("spin",GetDoubleReadPar(4));
//Axe "faisceau dans SMF z"
nuc->SetPx(GetDoubleReadPar(5));
nuc->SetPy(GetDoubleReadPar(6));
nuc->SetPz(GetDoubleReadPar(7));
nuc->SetPosition(GetDoubleReadPar(8),GetDoubleReadPar(9),GetDoubleReadPar(10));
- nuc->SetValue("avoir",GetDoubleReadPar(11));
+ nuc->GetParameters()->SetValue("avoir",GetDoubleReadPar(11));
return kTRUE;
}
=== modified file 'KVMultiDet/analysis/KVSimReader_SMF_asym.cpp'
--- KVMultiDet/analysis/KVSimReader_SMF_asym.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/analysis/KVSimReader_SMF_asym.cpp 2011-12-08 08:55:27 +0000
@@ -105,7 +105,7 @@
}
evt->SetNumber(nv->GetIntValue("event_number"));
- evt->SetValue("sub_number",ndes);
+ evt->GetParameters()->SetValue("sub_number",ndes);
for (Int_t mm=0; mm<mult; mm+=1){
nuc = (KVSimNucleus* )evt->AddParticle();
if (!ReadNucleus()) return kFALSE;
=== modified file 'KVMultiDet/base/Hexa_t.cpp'
--- KVMultiDet/base/Hexa_t.cpp 2009-01-22 15:03:32 +0000
+++ KVMultiDet/base/Hexa_t.cpp 2011-12-08 08:55:27 +0000
@@ -66,7 +66,7 @@
//This can be changed using SetPrefix.
//use Form's circular Char_t buffer to return pointer
- return (Form("%s%x", fPrefix.Data(), Value()));
+ return (Form("%s%llx", fPrefix.Data(), (ULong64_t)Value()));
}
Hexa_t & Hexa_t::operator=(const Long64_t val)
=== modified file 'KVMultiDet/base/KVBase.cpp'
--- KVMultiDet/base/KVBase.cpp 2011-10-14 12:49:56 +0000
+++ KVMultiDet/base/KVBase.cpp 2011-12-08 08:55:27 +0000
@@ -15,7 +15,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
-
+#include <cassert>
#include "Riostream.h"
#include "TMath.h"
#include "KVBase.h"
@@ -973,3 +973,38 @@
}
#endif
+
+Bool_t KVBase::AreEqual(Double_t A, Double_t B, Long64_t maxdif)
+{
+ // Comparison between two 64-bit floating-point values
+ // Returns kTRUE if the integer representations of the two values are within
+ // maxdif of each other.
+ // By default maxdif=1, which means that we consider that x==y if the
+ // difference between them is no greater than the precision of Double_t
+ // variables, i.e. 4.94065645841246544e-324
+ //
+ // Based on the function AlmostEqual2sComplement(float, float, int)
+ // by Bruce Dawson http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
+
+ union converter {
+ Double_t f;
+ Long64_t i;
+ } val1, val2;
+
+ assert( maxdif > 0 );
+
+ if (A == B) return true;
+
+ val1.f = A;
+ val2.f = B;
+ Long64_t Aint, Bint;
+ Aint = val1.i;
+ Bint = val2.i;
+ if(Aint < 0) Aint = 0x8000000000000000 - Aint;
+ if(Bint < 0) Bint = 0x8000000000000000 - Bint;
+ Long64_t intDiff = abs(val1.i - val2.i);
+
+ if (intDiff <= maxdif) return true;
+
+ return false;
+}
=== modified file 'KVMultiDet/base/KVBase.h'
--- KVMultiDet/base/KVBase.h 2011-10-14 12:49:56 +0000
+++ KVMultiDet/base/KVBase.h 2011-12-08 08:55:27 +0000
@@ -120,6 +120,8 @@
#ifdef WITH_GRULIB
Int_t TestPorts(Int_t port);
#endif
+
+ static Bool_t AreEqual(Double_t x, Double_t y, Long64_t maxdif=1);
ClassDef(KVBase, 3) //Base class for all KaliVeda objects
};
=== modified file 'KVMultiDet/base/KVMultiDetbaseLinkDef.h'
--- KVMultiDet/base/KVMultiDetbaseLinkDef.h 2011-11-29 09:12:57 +0000
+++ KVMultiDet/base/KVMultiDetbaseLinkDef.h 2011-12-08 08:55:27 +0000
@@ -33,7 +33,7 @@
#pragma link C++ class KVParameterList<KVString>+;
#pragma link C++ class KVRungeKutta+;
#pragma link C++ class Hexa_t+;
-#pragma link C++ class KVNameValueList-;//customised streamer
+#pragma link C++ class KVNameValueList+;
#pragma link C++ class KVBase-;//customised streamer
#pragma link C++ class KVClassFactory+;
#pragma link C++ class KVClassMethod+;
@@ -48,6 +48,7 @@
#pragma link C++ class KVPartitionList+;
#pragma link C++ class KVList-;
#pragma link C++ class KVLockfile+;
+#pragma link C++ class KVNamedParameter+;
#pragma link C++ class KVLogReader+;
#pragma link C++ class KVBQSLogReader+;
#pragma link C++ class KVGELogReader+;
=== modified file 'KVMultiDet/base/KVNameValueList.cpp'
--- KVMultiDet/base/KVNameValueList.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/base/KVNameValueList.cpp 2011-12-08 08:55:27 +0000
@@ -2,12 +2,8 @@
//Author: bonnet
#include "KVNameValueList.h"
-
+#include "KVNamedParameter.h"
#include "Riostream.h"
-#include "TDirectory.h"
-#include "TClass.h"
-#include "TMath.h"
-
ClassImp(KVNameValueList)
@@ -15,32 +11,14 @@
// BEGIN_HTML <!--
/* -->
<h2>KVNameValueList</h2>
-<h4>Manage a list of parameters (name and associated value), using TNamed stored in a KVHashList</h4>
+<h4>A general-purpose list of parameters (name and associated value)</h4>
<!-- */
// --> END_HTML
//Cette classe permet de g�r des listes de parametres avec pour chaque une valeur
//associee
-//L'objet contient une liste (KVHashList) rempli de TNamed
-//permettant de faire le lien entre un nom (TNamed::GetName) et une valeur (TNamed::GetTitle)
-//
-//Structure:
-//---------
-//Initialement cette classe h�tait directement de TList,
-//mais pour pouvoir l'utiliser en h�tage multiple
-//avec d'autre classe de KaliVeda (h�tant majoritairement de TObject)
-//il fallait faire une classe "orpheline".
-//Elle est par exemple classe m� de KVSimNucleus et KVSimEvent pour faciliter la gestion
-//des parametres dans ces classes.
-//Pour �ter toute redondance avec des m�odes basiques de TObject (GetName, Print etc ...)
-//On a ajout�n suffiwe au m�odes succeptibles de provoquer une ind�rmination:
-// - Clear_NVL
-// - Print_NVL
-// - SetName_NVL
-// - GetTitle_NVL
-// - SetOwner_NVL
-// - IsOwner_NVL
-// La plupart de ces m�odes appellent directement les m�odes �ivalentes de KVHashList
-// La m�ode Write, permet d'�ire l'objet seul dans un fichier root avec une seul "Key" associ�+//L'objet contient une liste (KVHashList) rempli de KVNamedParameter
+//permettant de faire le lien entre un nom et une valeur
+//Les objets de la liste lui appartiennent par defaut
//
//Fonctionnement:
//--------------
@@ -56,41 +34,37 @@
// - le nom d'un parametre pour un index donn�> GetNameAt()
//Il est possible de retirer un parametre : RemoveParameter()
//
-// Important, precision pour les valeurs Double_t
-//------------------------------------------------
-// - Le traitement des valeurs Double_t passe par une conversion via KVString::Form()
-// pour garantir une pr�sion relative inf�eure �e-15, on effectue cette conversion en �iture scientifique
-// avec 15 chiffres apres la virgule
-// - la methode statique TestConversion, donne la difference entre la valeur double et celle restitu�-// apres conversion
-//
-// A titre de comparaison dans ROOT, la m�ode TMath::Pi() { return 3.14159265358979323846; }
-// retourne en fait la valeur : 3.14159265358979312e+00, seule les 15 premieres decimales sont
-// correctes
-
-//
////////////////////////////////////////////////////////////////////////////////
//______________________________________________
KVNameValueList::KVNameValueList()
+ : fList()
{
// Default constructor
-
-
- //printf("KVNameValueList, Constructeur\n");
- khl = new KVHashList();
- khl->SetOwner(kTRUE);
- //Definition par defaut du format de conversion
- sfmt = "%1.15lfe%d";
-
+ fList.SetOwner(kTRUE);
+}
+
+//______________________________________________
+KVNameValueList::KVNameValueList(const Char_t* name, const Char_t* title)
+ : TNamed(name,title), fList()
+{
+ // Ctor with name & title
+ fList.SetOwner(kTRUE);
+}
+
+//______________________________________________
+KVNameValueList::KVNameValueList(const KVNameValueList& NVL)
+{
+ // Copy constructor
+ NVL.Copy(*this);
+ fList.SetOwner(kTRUE);
}
//______________________________________________
KVNameValueList::~KVNameValueList()
{
// Destructor
- Clear_NVL();
- delete khl;
+ fList.Clear();// will delete objects in list if owner
}
//______________________________________________
@@ -98,232 +72,81 @@
{
//return the pointeur of the KVHashList where
//parameters are stored with their values
- return khl;
-
+ return (KVHashList*)&fList;
}
//______________________________________________
-void KVNameValueList::Copy(KVNameValueList& nvl) const
+void KVNameValueList::Copy(TObject& nvl) const
{
// Copy this to the nvl object.
//Si des parametres sont pr�nts dans nvl, ils seront effac�- //
-
- KVHashList* copy = nvl.khl;
- if (!copy)
- printf("pb de KVHashList ....\n");
- khl->Copy(*copy);
-
- //le nom de la liste n est pas copi�ans KVSeqCollection::Copy()
- copy->SetName(khl->GetName());
-
+
+ TNamed::Copy(nvl);
+ KVNameValueList& _obj = (KVNameValueList&)nvl;
+ fList.Copy(_obj.fList);
}
//______________________________________________
-void KVNameValueList::Clear_NVL(Option_t* opt)
+void KVNameValueList::Clear(Option_t* opt)
{
//Clear all the stored parameters
- khl->Clear(opt);
+ //Deletes the parameter objects if owner & opt!="nodelete"
+ fList.Clear(opt);
}
//______________________________________________
-void KVNameValueList::Print_NVL(Option_t* opt) const
+void KVNameValueList::Print(Option_t* opt) const
{
//Print stored parameters (name, and value)
- printf("%s, %d stored:\n",GetName_NVL(),GetNpar());
- for (Int_t ii=0;ii<GetNpar();ii+=1)
- printf("%d | %s | %s\n",ii,GetNameAt(ii),GetStringValue(ii));
-}
-
-//______________________________________________
-void KVNameValueList::Write(const Char_t* name)
-{
- //Write the KVNameValueList object in the gDirectory
- //Check if the gDirectory is existing and writable
- if (gDirectory)
- gDirectory->WriteObjectAny(this,"KVNameValueList",name);
-}
-
-//______________________________________________
-void KVNameValueList::SetName_NVL(const char* name)
-{
- //return the name
- //note (name and object are the KVHashList object ones)
- khl->SetName(name);
-}
-
-//______________________________________________
-const char* KVNameValueList::GetName_NVL() const
-{
- //set the name
- //note (name and object are the KVHashList object ones)
- return khl->GetName();
-}
-
-//______________________________________________
-const char* KVNameValueList::GetTitle_NVL() const
-{
- //return the title
- //note (name and object are the KVHashList object ones)
- return khl->GetTitle();
-}
-
-//______________________________________________
-void KVNameValueList::SetOwner_NVL(Bool_t enable)
+ cout << GetName()<<" list : " <<GetTitle() <<" ("<< this << ")"<<endl;
+ for (Int_t ii=0;ii<GetNpar();ii+=1){
+ GetParameter(ii)->ls();
+ }
+}
+
+//______________________________________________
+void KVNameValueList::SetOwner(Bool_t enable)
{
//set if the KVNameValueList owns its objects or not
//by default it is owner
- khl->SetOwner(enable);
+ fList.SetOwner(enable);
}
//______________________________________________
-Bool_t KVNameValueList::IsOwner_NVL() const
+Bool_t KVNameValueList::IsOwner() const
{
- //return kTRUE if the object owns its objects
+ //return kTRUE if the list owns its objects
//kFALSE if not
- return khl->IsOwner();
+ return fList.IsOwner();
}
//______________________________________________
-Int_t KVNameValueList::Compare(const KVNameValueList* nvl) const
+Int_t KVNameValueList::Compare(const TObject* obj) const
{
- // Compare the contents of two KVNameValueObject
+ // Compare the contents of two KVNameValueList
// Returns the number of same parameters (name and value)
+ KVNameValueList* nvl = (KVNameValueList*)obj;
Int_t neq=0;
- Int_t np1 = this->GetNpar();
+ Int_t np1 = GetNpar();
Int_t np2 = nvl->GetNpar();
for (Int_t ii=0;ii<np1;ii+=1)
for (Int_t jj=0;jj<np2;jj+=1)
- if ( !strcmp(this->GetNameAt(ii),(nvl->GetNameAt(jj))) &&
- !strcmp(this->GetStringValue(ii),nvl->GetStringValue(jj))
- )
- neq+=1;
+ if ( *(GetParameter(ii)) == *(GetParameter(jj)) ) neq+=1;
return neq;
}
//______________________________________________
-void KVNameValueList::Streamer(TBuffer &R__b)
-{
- if (R__b.IsReading()) {
- //printf("Streamer, Lecture\n");
- KVNameValueList::Class()->ReadBuffer(R__b, this);
- }
- else {
- //printf("Streamer, Ecriture\n");
- KVNameValueList::Class()->WriteBuffer(R__b, this);
- }
-}
-
-//______________________________________________
-void KVNameValueList::TestConversion(Double_t value)
-{
- //test la difference entre une valeur initiale et apres conversion
-
- KVString tostring="";
- KVString format = "%1.15lfe%d";
- if (value==0) return;
-
- Double_t abs_val = TMath::Abs(value);
- Int_t expo = Int_t(TMath::Log10(abs_val));
-
- if (abs_val<1)
- expo-=1;
- tostring.Form(format,value/TMath::Power(10.,expo),expo);
-
- Double_t val2 = tostring.Atof();
-
- cout << "valeur initiale:"<<value<<" valeur convertie:"<<val2;
- cout << " -> difference, abs:"<<val2-value<<"rel:"<<(val2-value)/value <<endl;
-
-
-}
-
-//______________________________________________
-KVString KVNameValueList::DoubleToString(Double_t value)
-{
-
- KVString tostring="";
- if (value==0)
- return "0.0";
-
- Double_t abs_val = TMath::Abs(value);
- Int_t expo = Int_t(TMath::Log10(abs_val));
-
- if (abs_val<1)
- expo-=1;
- tostring.Form(sfmt,value/TMath::Power(10.,expo),expo);
-
- return tostring;
-}
-
-//______________________________________________
-void KVNameValueList::SetStringValue(TNamed *tn, const Char_t* value)
-{
- //protected method
- //change the title (value) of a given object TNamed
- tn->SetTitle(value);
-}
-
-//______________________________________________
-void KVNameValueList::SetIntValue(TNamed *tn, Int_t value)
-{
- //protected method
- //change the title (value) of a given object TNamed
- sconvert.Form("%d",value);
- SetStringValue(tn,sconvert.Data());
-}
-
-//______________________________________________
-void KVNameValueList::SetDoubleValue(TNamed *tn, Double_t value)
-{
- //protected method
- //change the title (value) of a given object TNamed
-
- SetStringValue(tn,DoubleToString(value).Data());
-}
-
-//______________________________________________
-void KVNameValueList::AddStringValue(const Char_t* name,const Char_t* value)
-{
- //protected method
- //make the connection between a name and a title
- //via the object TNamed which will stored in the list
- khl->Add(new TNamed(name,value));
-}
-
-//______________________________________________
-void KVNameValueList::AddIntValue(const Char_t* name,Int_t value)
-{
- //protected method
- //make the connection between a name and a title
- //via the object TNamed which will stored in the list
- sconvert.Form("%d",value);
- AddStringValue(name,sconvert.Data());
-}
-
-//______________________________________________
-void KVNameValueList::AddDoubleValue(const Char_t* name,Double_t value)
-{
- //protected method
- //make the connection between a name and a title
- //via the object TNamed which will stored in the list
-
- AddStringValue(name,DoubleToString(value).Data());
-}
-
-
-//______________________________________________
void KVNameValueList::SetValue(const Char_t* name,const Char_t* value)
{
- //associate a parameter (define by its name) and a value
+ //associate a parameter (defined by its name) and a value
//if the parameter is not in the list, it is added
//if it's in the list replace its value
- TNamed* tn = 0;
- if ( !(tn = FindTNamed(name)) ) AddStringValue(name,value);
- else SetStringValue(tn,value);
+
+ KVNamedParameter* par = FindParameter(name);
+ par ? par->Set(value) : fList.Add(new KVNamedParameter(name,value));
}
//______________________________________________
@@ -332,9 +155,8 @@
//associate a parameter (define by its name) and a value
//if the parameter is not in the list, it is added
//if it's in the list replace its value
- TNamed* tn = 0;
- if ( !(tn = FindTNamed(name)) ) AddIntValue(name,value);
- else SetIntValue(tn,value);
+ KVNamedParameter* par = FindParameter(name);
+ par ? par->Set(value) : fList.Add(new KVNamedParameter(name,value));
}
//______________________________________________
@@ -343,15 +165,20 @@
//associate a parameter (define by its name) and a value
//if the parameter is not in the list, it is added
//if it's in the list replace its value
- TNamed* tn = 0;
- if ( !(tn = FindTNamed(name)) ) AddDoubleValue(name,value);
- else SetDoubleValue(tn,value);
+ KVNamedParameter* par = FindParameter(name);
+ par ? par->Set(value) : fList.Add(new KVNamedParameter(name,value));
}
//______________________________________________
-TNamed* KVNameValueList::FindTNamed(const Char_t* name) const{
- //return the TNamed object with the asking name
- return (TNamed* )khl->FindObject(name);
+KVNamedParameter* KVNameValueList::FindParameter(const Char_t* name) const{
+ //return the parameter object with the asking name
+ return (KVNamedParameter *)fList.FindObject(name);
+}
+
+KVNamedParameter* KVNameValueList::GetParameter(Int_t idx) const
+{
+ //return the parameter object with index idx
+ return (KVNamedParameter *)fList.At(idx);
}
//______________________________________________
@@ -359,7 +186,12 @@
{
//remove parameter from the list,
//Warning the TNamed object associated is deleted
- delete khl->Remove(FindTNamed(name));
+
+ KVNamedParameter* par = FindParameter(name);
+ if(par){
+ fList.Remove(par);
+ delete par;
+ }
}
//______________________________________________
@@ -369,8 +201,7 @@
//in the list
//kTRUE, parameter already present
//kFALSE, if not
- if (FindTNamed(name)) return kTRUE;
- else return kFALSE;
+ return (FindParameter(name)!=NULL);
}
//______________________________________________
@@ -379,12 +210,16 @@
//return the position in the list of a given parameter
//using its name
//return -1 if no parameter with such name are present
- TNamed* named = 0;
- if (!(named = FindTNamed(name))){
- printf("ERROR, GetNameIndex : \"%s\" does not correspond to an existing parameter, default value -1 is returned\n",name);
- return -1;
- }
- return khl->IndexOf(named);
+
+ TObject* par = 0;
+ Int_t idx = 0;
+ TIter next(&fList);
+ while( (par = next()) ){
+ if(!strcmp(par->GetName(),name)) return idx;
+ idx++;
+ }
+ Error("GetNameIndex", "Parameter \"%s\" not found, -1 returned", name);
+ return -1;
}
//______________________________________________
@@ -394,32 +229,34 @@
//in the list
//if the idx is greater than the number of stored parameters
//return empty string
- TNamed* named = 0;
- if (!(named = (TNamed* )khl->At(idx))){
- printf("ERROR, GetNameAt : index has to be less than %d, empty string is returned\n",GetNpar());
+
+ if (idx >= GetNpar()){
+ Error("GetNameAt", "index has to be less than %d, empty string is returned",GetNpar());
return "";
}
- return named->GetName();
+ return fList.At(idx)->GetName();
}
//______________________________________________
-Int_t KVNameValueList::GetIntValue(const Char_t* name)
+Int_t KVNameValueList::GetIntValue(const Char_t* name) const
{
//return the value in integer format
//for a parameter using its name
//return -1 if no parameter with such name are present
- sconvert.Form("%s",GetStringValue(name));
- return sconvert.Atoi();
+
+ KVNamedParameter* par = FindParameter(name);
+ return (par ? par->GetInt() : -1);
}
//______________________________________________
-Double_t KVNameValueList::GetDoubleValue(const Char_t* name)
+Double_t KVNameValueList::GetDoubleValue(const Char_t* name) const
{
//return the value in double format
//for a parameter using its name
//return -1 if no parameter with such name are present
- sconvert.Form("%s",GetStringValue(name));
- return sconvert.Atof();
+
+ KVNamedParameter* par = FindParameter(name);
+ return (par ? par->GetDouble() : -1.0);
}
//______________________________________________
@@ -428,38 +265,39 @@
//return the value in string format
//for a parameter using its name
//return string "-1" if no parameter with such name are present
- TNamed* named = 0;
- if (!(named = FindTNamed(name))){
- printf("ERROR, GetStringValue(const Char_t*) : \"%s\" does not correspond to an existing parameter, default value \"-1\" is returned\n",name);
- return "-1";
+
+ KVNamedParameter* par = FindParameter(name);
+ if (!par){
+ Error("GetStringValue(const Char_t*)", "\"%s\" does not correspond to an existing parameter, default value \"-1\" is returned",name);
+ return Form("%d", -1);
}
- return named->GetTitle();
+ return par->GetString();
}
//______________________________________________
Int_t KVNameValueList::GetNpar() const {
//return the number of stored parameters
- return khl->GetEntries();
+ return fList.GetEntries();
}
//______________________________________________
-Int_t KVNameValueList::GetIntValue(Int_t idx)
+Int_t KVNameValueList::GetIntValue(Int_t idx) const
{
//return the value in integer format
//for a parameter using its position
//return -1 idx is greater than the number of stored parameters
- sconvert.Form("%s",GetStringValue(idx));
- return sconvert.Atoi();
+ KVNamedParameter* par = GetParameter(idx);
+ return (par ? par->GetInt() : -1);
}
//______________________________________________
-Double_t KVNameValueList::GetDoubleValue(Int_t idx)
+Double_t KVNameValueList::GetDoubleValue(Int_t idx) const
{
//return the value in double format
//for a parameter using its position
//return -1 idx is greater than the number of stored parameters
- sconvert.Form("%s",GetStringValue(idx));
- return sconvert.Atof();
+ KVNamedParameter* par = GetParameter(idx);
+ return (par ? par->GetDouble() : -1.0);
}
//______________________________________________
@@ -469,8 +307,8 @@
//for a parameter using its position
//return -1 idx is greater than the number of stored parameters
if (idx>=GetNpar()) {
- printf("ERROR, GetStringValue(Int_t) : index has to be less than %d, \"-1\" is returned\n",GetNpar());
- return "-1";
+ Error("GetStringValue(Int_t)", "index has to be less than %d, \"-1\" is returned\n",GetNpar());
+ return Form("%d", -1);
}
- return khl->At(idx)->GetTitle();
+ return GetParameter(idx)->GetString();
}
=== modified file 'KVMultiDet/base/KVNameValueList.h'
--- KVMultiDet/base/KVNameValueList.h 2011-08-23 09:07:16 +0000
+++ KVMultiDet/base/KVNameValueList.h 2011-12-08 08:55:27 +0000
@@ -6,66 +6,55 @@
#include "KVHashList.h"
#include "TNamed.h"
-#include "KVString.h"
-
-class KVNameValueList
+
+class KVNamedParameter;
+
+class KVNameValueList : public TNamed
{
- protected:
-
- KVString sfmt;//!
- KVString sconvert;//!
- KVHashList* khl;//->
-
- void SetStringValue(TNamed *tn, const Char_t* value);
- void SetIntValue(TNamed *tn, Int_t value);
- void SetDoubleValue(TNamed *tn, Double_t value);
- void AddStringValue(const Char_t* name,const Char_t* value);
- void AddIntValue(const Char_t* name,Int_t value);
- void AddDoubleValue(const Char_t* name,Double_t value);
- KVString DoubleToString(Double_t value);
+ KVHashList fList;//list of KVNamedParameter objects
public:
KVNameValueList();
+ KVNameValueList(const Char_t* name, const Char_t* title="");
+ KVNameValueList(const KVNameValueList&);
virtual ~KVNameValueList();
- static void TestConversion(Double_t val);
-
KVHashList* GetList() const;
- virtual void Clear_NVL(Option_t* opt = "");
- virtual void Print_NVL(Option_t* opt = "") const;
- void Write(const Char_t* name);
- virtual void SetName_NVL(const char* name);
- virtual const char* GetName_NVL() const;
- virtual const char* GetTitle_NVL() const;
- void SetOwner_NVL(Bool_t enable = kTRUE);
- Bool_t IsOwner_NVL() const;
+ virtual void Clear(Option_t* opt = "");
+ virtual void Print(Option_t* opt = "") const;
+ virtual void ls(Option_t* opt = "") const { Print(opt); };
+
+ void SetOwner(Bool_t enable = kTRUE);
+ Bool_t IsOwner() const;
- void Copy(KVNameValueList& nvl) const;
- Int_t Compare(const KVNameValueList* nvl) const;
+ void Copy(TObject& nvl) const;
+ Int_t Compare(const TObject* nvl) const;
void SetValue(const Char_t* name,const Char_t* value);
void SetValue(const Char_t* name,Int_t value);
void SetValue(const Char_t* name,Double_t value);
- TNamed* FindTNamed(const Char_t* name) const;
+ KVNamedParameter* FindParameter(const Char_t* name) const;
+ KVNamedParameter* GetParameter(Int_t idx) const;
void RemoveParameter(const Char_t* name);
Bool_t HasParameter(const Char_t* name);
Int_t GetNameIndex(const Char_t* name);
const Char_t* GetNameAt(Int_t idx) const;
Int_t GetNpar() const;
+ Int_t GetEntries() const { return GetNpar(); };
- Int_t GetIntValue(const Char_t* name);
- Double_t GetDoubleValue(const Char_t* name);
+ Int_t GetIntValue(const Char_t* name) const;
+ Double_t GetDoubleValue(const Char_t* name) const;
const Char_t* GetStringValue(const Char_t* name) const;
- Int_t GetIntValue(Int_t idx);
- Double_t GetDoubleValue(Int_t idx);
+ Int_t GetIntValue(Int_t idx) const;
+ Double_t GetDoubleValue(Int_t idx) const;
const Char_t* GetStringValue(Int_t idx) const;
- ClassDef(KVNameValueList,2)//KVHashList of TNamed
+ ClassDef(KVNameValueList,3)//A general-purpose list of parameters
};
#endif
=== added file 'KVMultiDet/base/KVNamedParameter.cpp'
--- KVMultiDet/base/KVNamedParameter.cpp 1970-01-01 00:00:00 +0000
+++ KVMultiDet/base/KVNamedParameter.cpp 2011-12-08 08:55:27 +0000
@@ -0,0 +1,193 @@
+//Created by KVClassFactory on Wed Nov 30 13:54:07 2011
+//Author: John Frankland,,,
+
+#include "KVNamedParameter.h"
+#include "KVBase.h"
+#include "Riostream.h"
+
+ClassImp(KVNamedParameter)
+
+////////////////////////////////////////////////////////////////////////////////
+// BEGIN_HTML <!--
+/* -->
+<h2>KVNamedParameter</h2>
+<h4>A generic parameter with a name and a value</h4>
+<!-- */
+// --> END_HTML
+////////////////////////////////////////////////////////////////////////////////
+
+KVNamedParameter::KVNamedParameter() : TNamed(), fNumber(0.0)
+{
+ // Default constructor
+ ResetBits();
+}
+
+KVNamedParameter::~KVNamedParameter()
+{
+ // Destructor
+}
+
+KVNamedParameter::KVNamedParameter(const char*nom)
+ : TNamed(nom, ""), fNumber(0.0)
+{
+ ResetBits();
+}
+
+KVNamedParameter::KVNamedParameter(const char*nom, const char*val)
+ : TNamed(nom, val), fNumber(0.0)
+{
+ SetType(kIsString);
+}
+
+void KVNamedParameter::Set(const char*name, const char*val)
+{
+ SetNameTitle(name, val);
+ SetType(kIsString);
+ fNumber = 0.0;
+}
+
+void KVNamedParameter::Set(const char*val)
+{
+ SetTitle(val);
+ SetType(kIsString);
+ fNumber = 0.0;
+}
+
+KVNamedParameter::KVNamedParameter(const char*nom, Double_t val)
+ : TNamed(nom, "Double_t"), fNumber(val)
+{
+ SetType(kIsDouble);
+}
+
+void KVNamedParameter::Set(const char*name, Double_t val)
+{
+ SetNameTitle(name, "Double_t");
+ SetType(kIsDouble);
+ fNumber = val;
+}
+
+void KVNamedParameter::Set(Double_t val)
+{
+ SetTitle("Double_t");
+ SetType(kIsDouble);
+ fNumber = val;
+}
+
+KVNamedParameter::KVNamedParameter(const char*nom, Int_t val)
+ : TNamed(nom, "Int_t"), fNumber(val)
+{
+ SetType(kIsInt);
+}
+
+void KVNamedParameter::Set(const char*name, Int_t val)
+{
+ SetNameTitle(name, "Int_t");
+ SetType(kIsInt);
+ fNumber = val;
+}
+
+void KVNamedParameter::Set(Int_t val)
+{
+ SetTitle("Int_t");
+ SetType(kIsInt);
+ fNumber = val;
+}
+
+void KVNamedParameter::Clear(Option_t*)
+{
+ // Removes the name and any assigned value
+ SetNameTitle("", "");
+ fNumber = 0.0;
+ ResetBits();
+}
+
+const Char_t* KVNamedParameter::GetString() const
+{
+ // returns string if parameter value is of string type
+ // if not, print warning and return empty string
+ if (IsString()) return GetTitle();
+ Warning("GetString", "Parameter is of type %s", GetTitle());
+ return "";
+}
+
+Double_t KVNamedParameter::GetDouble() const
+{
+ // returns double if parameter value is of numerical type
+ // if string, print warning and return zero
+ if (IsString()) {
+ Warning("GetDouble", "Parameter is a string : %s", GetTitle());
+ return 0.0;
+ }
+ return fNumber;
+}
+
+Int_t KVNamedParameter::GetInt() const
+{
+ // returns integer if parameter value is of numerical type
+ // if string, print warning and return zero
+ if (IsString()) {
+ Warning("GetInt", "Parameter is a string : %s", GetTitle());
+ return 0;
+ }
+ return (Int_t)fNumber;
+}
+
+Bool_t KVNamedParameter::IsEqual(const TObject* obj) const
+{
+ // Test for equality between two parameters
+ // Returns kTRUE if both the name, the type, and the value of the parameters are identical
+
+ if (!obj->InheritsFrom("KVNamedParameter")) return kFALSE;
+ KVNamedParameter* _obj = (KVNamedParameter*)obj;
+ return ((*this) == (*_obj));
+}
+
+Bool_t KVNamedParameter::operator== (const KVNamedParameter& other) const
+{
+ // Test for equality between two parameters
+ // Returns kTRUE if both the name, the type, and the value of the parameters are identical
+
+ if ((other.fName != fName) || other.GetType() != GetType()) return kFALSE;
+ switch (GetType()) {
+ case kIsString:
+ if (fTitle == other.fTitle) return kTRUE;
+
+ case kIsInt:
+ if (other.GetInt() == GetInt()) return kTRUE;
+
+ case kIsDouble:
+ return KVBase::AreEqual(other.GetDouble(), GetDouble());
+
+ default:
+ return kFALSE;
+ }
+ return kFALSE;
+}
+
+void KVNamedParameter::Print(Option_t* opt) const
+{
+ if (IsString()) {
+ Info("Print", "Name = %s type = string value = %s", GetName(), GetTitle());
+ } else
+ Info("Print", "Name = %s type = %s value = %f", GetName(), GetTitle(), fNumber);
+}
+
+void KVNamedParameter::ls(Option_t* opt) const
+{
+ if (IsString()) {
+ cout << "<"<<GetName() << "=" << GetTitle() <<">"<< endl;
+ } else {
+ switch (GetType()) {
+ case kIsInt:
+ cout << "<"<<GetName() <<"="<< GetInt() <<">"<< endl;
+ break;
+
+ case kIsDouble:
+ cout << "<"<< GetName() <<"="<< GetDouble() <<">"<< endl;
+ break;
+
+ default:
+ break;
+ }
+ }
+}
=== added file 'KVMultiDet/base/KVNamedParameter.h'
--- KVMultiDet/base/KVNamedParameter.h 1970-01-01 00:00:00 +0000
+++ KVMultiDet/base/KVNamedParameter.h 2011-12-08 08:55:27 +0000
@@ -0,0 +1,75 @@
+//Created by KVClassFactory on Wed Nov 30 13:54:07 2011
+//Author: John Frankland,,,
+
+#ifndef __KVNAMEDPARAMETER_H
+#define __KVNAMEDPARAMETER_H
+
+#include "TNamed.h"
+
+class KVNamedParameter : public TNamed {
+
+ enum {
+ kIsString = BIT(14),
+ kIsDouble = BIT(15),
+ kIsInt = BIT(16)
+ };
+ enum {
+ kBitMask = 0x0001c000
+ };
+ void ResetBits() {
+ ResetBit(kBitMask);
+ };
+
+ Int_t GetType() const {
+ // compare this value with the values kIsString, kIsDouble, etc.
+ return TestBits(kBitMask);
+ };
+
+ void SetType(UInt_t f) {
+ ResetBits();
+ SetBit(f);
+ };
+
+protected:
+ Double_t fNumber;//used to store numerical (integer or floating-point) values
+
+public:
+ KVNamedParameter();
+ KVNamedParameter(const char*);
+ KVNamedParameter(const char*, const char*);
+ KVNamedParameter(const char*, Double_t);
+ KVNamedParameter(const char*, Int_t);
+ virtual ~KVNamedParameter();
+
+ void Set(const char*, const char*);
+ void Set(const char*, Double_t);
+ void Set(const char*, Int_t);
+ void Set(const char*);
+ void Set(Double_t);
+ void Set(Int_t);
+
+ const Char_t* GetString() const;
+ Double_t GetDouble() const;
+ Int_t GetInt() const;
+
+ virtual void Clear(Option_t* = "");
+
+ Bool_t IsString() const {
+ return GetType() == kIsString;
+ };
+ Bool_t IsDouble() const {
+ return GetType() == kIsDouble;
+ };
+ Bool_t IsInt() const {
+ return GetType() == kIsInt;
+ };
+
+ Bool_t IsEqual(const TObject* obj) const;
+ Bool_t operator== (const KVNamedParameter&) const;
+ virtual void Print(Option_t* opt = "") const;
+ virtual void ls(Option_t* opt = "") const;
+
+ ClassDef(KVNamedParameter, 1) //A generic parameter with a name and a value
+};
+
+#endif
=== modified file 'KVMultiDet/base/KVSeqCollection.cpp'
--- KVMultiDet/base/KVSeqCollection.cpp 2011-03-25 14:09:49 +0000
+++ KVMultiDet/base/KVSeqCollection.cpp 2011-12-08 08:55:27 +0000
@@ -157,7 +157,7 @@
void KVSeqCollection::Copy(TObject & obj) const
{
- // Copy a list of objects.
+ // Copy a list of objects, including the name of the list.
// If this list owns its objects, we make new Clones of all objects in the list
// (N.B. the Clone() method must work correctly for the objects in question)
// and put them in the copy list, the copy will own these new objects.
@@ -166,6 +166,7 @@
TSeqCollection::Copy(obj); //in fact this calls TObject::Copy, no Copy method defined for collection classes
KVSeqCollection & copy = (KVSeqCollection&) obj;
+ copy.SetName( GetName() );
//clear any pre-existing objects in copy list
if (copy.IsOwner()) copy.Delete();
@@ -799,13 +800,23 @@
Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
TSeqCollection::Streamer(R__b);
fQObject.Streamer(R__b);
- R__b >> fCollection;
+ if(fCollection) {
+ Bool_t owns = fCollection->IsOwner();
+ fCollection->SetOwner(kFALSE);
+ fCollection->Streamer(R__b);
+ fCollection->SetOwner(owns);
+ }
+ else R__b >> fCollection;
R__b.CheckByteCount(R__s, R__c, KVSeqCollection::IsA());
} else {
R__c = R__b.WriteVersion(KVSeqCollection::IsA(), kTRUE);
TSeqCollection::Streamer(R__b);
fQObject.Streamer(R__b);
- R__b << fCollection;
+ if(fCollection) {
+ fCollection->Streamer(R__b);
+ }
+ else R__b << fCollection;
R__b.SetByteCount(R__c, kTRUE);
}
}
+
=== modified file 'KVMultiDet/base/KVSeqCollection.h'
--- KVMultiDet/base/KVSeqCollection.h 2010-06-10 14:42:02 +0000
+++ KVMultiDet/base/KVSeqCollection.h 2011-12-08 08:55:27 +0000
@@ -231,7 +231,7 @@
return fCollection;
};
- ClassDef(KVSeqCollection,1)//KaliVeda extensions to ROOT collections
+ ClassDef(KVSeqCollection,2)//KaliVeda extensions to ROOT collections
};
#if ROOT_VERSION_CODE < ROOT_VERSION(5,11,2)
=== modified file 'KVMultiDet/base/KVValues.cpp'
--- KVMultiDet/base/KVValues.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/base/KVValues.cpp 2011-12-08 08:55:27 +0000
@@ -86,7 +86,7 @@
//constructor
knbre_val_max = nbre_max; //nbre max de valeurs stockables
kordre_mom_max = ordre_max; //ordre max des moments calcules a chaque iteration
- SetName_NVL(name); //nom correspondant aux valeurs calculees
+ SetName(name); //nom correspondant aux valeurs calculees
init_val_base();
init_val_add();
@@ -104,14 +104,14 @@
KVValues::~KVValues()
{
//destructeur
- Clear_NVL();
+ Clear();
delete [] values; values=0;
kval_tot = kval_base = kdeb = 0;
}
//___________________________________________________________________________________________
-void KVValues::Clear_NVL(Option_t* option)
+void KVValues::Clear(Option_t* option)
{
Reset();
@@ -125,10 +125,10 @@
}
//___________________________________________________________________________________________
-void KVValues::Print_NVL(Option_t* option)
+void KVValues::Print(Option_t* option) const
{
//Info("Print","%s : %d values computed",GetName(),kval_tot);
- printf("KVValues::Print_NVL\n%s : %d values computed",GetName_NVL(),kval_tot);
+ printf("KVValues::Print_NVL\n%s : %d values computed",GetName(),kval_tot);
for (Int_t nn=0; nn<kval_tot; nn+=1){
printf("- %d %s %lf\n",nn,GetNameAt(nn),GetValue(nn));
}
@@ -289,14 +289,14 @@
}
//___________________________________________________________________________________________
-Int_t KVValues::GetOrdreMax()
+Int_t KVValues::GetOrdreMax() const
{
return kordre_mom_max;
}
//___________________________________________________________________________________________
-Int_t KVValues::GetShift()
+Int_t KVValues::GetShift() const
{
return kdeb;
@@ -304,24 +304,24 @@
}
//___________________________________________________________________________________________
-Double_t KVValues::GetValue(Int_t idx)
+Double_t KVValues::GetValue(Int_t idx) const
{
- ComputeAdditionalValues();
- kToBeRecalculated = kFALSE;
+ const_cast<KVValues*>(this)->ComputeAdditionalValues();
+ const_cast<KVValues*>(this)->kToBeRecalculated = kFALSE;
return values[idx];
}
//___________________________________________________________________________________________
-Double_t KVValues::GetValue(const Char_t* name)
+Double_t KVValues::GetValue(const Char_t* name) const
{
return GetValue(GetValuePosition(name));
}
//___________________________________________________________________________________________
-Int_t KVValues::GetValuePosition(const Char_t* name)
+Int_t KVValues::GetValuePosition(const Char_t* name) const
{
return GetIntValue(name);
@@ -329,7 +329,7 @@
}
//___________________________________________________________________________________________
-TString KVValues::GetValueExpression(const Char_t* name)
+TString KVValues::GetValueExpression(const Char_t* name) const
{
Int_t idx = GetValuePosition(name);
@@ -337,7 +337,7 @@
}
//___________________________________________________________________________________________
-TString KVValues::GetValueExpression(Int_t idx)
+TString KVValues::GetValueExpression(Int_t idx) const
{
Int_t new_idx = idx-kval_base;
if (new_idx<0){
@@ -348,7 +348,7 @@
}
//___________________________________________________________________________________________
-Int_t KVValues::GetNValues(KVString opt)
+Int_t KVValues::GetNValues(KVString opt) const
{
if (opt=="base") return kval_base;
else if (opt=="add") return kval_add;
=== modified file 'KVMultiDet/base/KVValues.h'
--- KVMultiDet/base/KVValues.h 2011-08-23 09:07:16 +0000
+++ KVMultiDet/base/KVValues.h 2011-12-08 08:55:27 +0000
@@ -57,24 +57,24 @@
virtual ~KVValues();
void Reset();
- void Clear_NVL(Option_t* option = "");
- void Print_NVL(Option_t* option = "");
+ void Clear(Option_t* option = "");
+ void Print(Option_t* option = "") const;
void FillVar(Double_t val);
void FillVar(Double_t val,Double_t weight);
- Int_t GetOrdreMax();
- Int_t GetShift();
-
- Double_t GetValue(Int_t idx);
-
- Double_t GetValue(const Char_t* name);
- Int_t GetValuePosition(const Char_t* name);
-
- TString GetValueExpression(const Char_t* name);
- TString GetValueExpression(Int_t idx);
+ Int_t GetOrdreMax() const;
+ Int_t GetShift() const;
+
+ Double_t GetValue(Int_t idx) const;
+
+ Double_t GetValue(const Char_t* name) const;
+ Int_t GetValuePosition(const Char_t* name) const;
+
+ TString GetValueExpression(const Char_t* name) const;
+ TString GetValueExpression(Int_t idx) const;
- Int_t GetNValues(KVString opt="base");
+ Int_t GetNValues(KVString opt="base") const;
void DefineAdditionalValue(KVString name,KVString expr);
=== modified file 'KVMultiDet/events/KVElasticScatterEvent.cpp'
--- KVMultiDet/events/KVElasticScatterEvent.cpp 2011-11-29 15:15:59 +0000
+++ KVMultiDet/events/KVElasticScatterEvent.cpp 2011-12-08 08:55:27 +0000
@@ -437,7 +437,7 @@
KVSimNucleus* knuc = 0;
while ( (knuc = (KVSimNucleus* )sim_evt->GetNextParticle()) ){
- knuc->Clear_NVL();
+ knuc->Clear();
knuc->RemoveAllGroups();
}
//-------------------------
@@ -520,7 +520,7 @@
ktarget->DetectParticle(GetNucleus("PROJ"),0);
eLostInTarget -= GetNucleus("PROJ")->GetKE();
- ((KVSimNucleus* )sim_evt->GetParticleWithName("PROJ"))->SetValue("Before Int",eLostInTarget);
+ ((KVSimNucleus* )sim_evt->GetParticleWithName("PROJ"))->GetParameters()->SetValue("Before Int",eLostInTarget);
//On modifie l'energie du projectile dans KV2Body
//pour prendre en compte l energie deposee dans la cible
//avant de faire le calcul de la cinematique
@@ -594,13 +594,13 @@
sim_evt->SetNumber(kTreatedNevts);
- sim_evt->SetValue("XRuth",kXruth_evt);
- sim_evt->SetValue("ThDiff",theta);
- sim_evt->SetValue("EkDiff",ediff1);
- sim_evt->SetValue("IPz",kIPPVector.Z());
+ sim_evt->GetParameters()->SetValue("XRuth",kXruth_evt);
+ sim_evt->GetParameters()->SetValue("ThDiff",theta);
+ sim_evt->GetParameters()->SetValue("EkDiff",ediff1);
+ sim_evt->GetParameters()->SetValue("IPz",kIPPVector.Z());
if (nsol_kin==2)
- sim_evt->SetValue("Sol2",ediff2);
+ sim_evt->GetParameters()->SetValue("Sol2",ediff2);
//L' energie cinetique du projectile est reinitialisee
//pour la prochaine diffusion
=== modified file 'KVMultiDet/events/KVEvent.cpp'
--- KVMultiDet/events/KVEvent.cpp 2011-04-21 14:30:39 +0000
+++ KVMultiDet/events/KVEvent.cpp 2011-12-08 08:55:27 +0000
@@ -25,25 +25,42 @@
ClassImp(KVEvent);
-///////////////////////////////////////////////////////////////////////////////
-//KVEvent
-//
-//Base class for all types of multiparticle event consisting of KVNucleus objects.
-//These particles are stored in a TClonesArray and KVEvent provides some basic
-//functionality for accessing and manipulating the list.
-//
-
-void KVEvent::init()
-{
- //Default initialisations
-
- fOKIter = 0;
-}
-
-//_______________________________________________________________________________
-
-
-KVEvent::KVEvent(Int_t mult, const char *classname)
+////////////////////////////////////////////////////////////////////////////////
+// BEGIN_HTML <!--
+/* -->
+<h2>KVEvent</h2>
+<h4>Base class for all types of multiparticle event consisting of KVNucleus objects</h4>
+<!-- */
+// --> END_HTML
+/*Particles are stored in a TClonesArray and KVEvent provides some basic
+functionality for accessing and manipulating the list.
+
+Events can be built using any class derived from KVNucleus to represent particles.
+These classes can allocate memory in their default ctor: when filling events in a loop,
+the same 'particle' objects are re-used for each new event, the ctor of each object will
+only be called once when the object is first created (e.g. in the first event).
+The particle class Clear() method will be called before each new event.
+Therefore the cycle of use of the particle objects in a loop over many events is:
+
+<particle ctor>
+ Building 1st event
+ <particle Clear()>
+ Building 2nd event
+ <particle Clear()>
+ ...
+ Building last event
+<particle dtor>
+
+When writing events in a TTree, it is very important to call the TBranch::SetAutoDelete(kFALSE)
+method of the branch which is used to store the event object.
+If not, when the events are read back, the KVEvent constructor and destructor will be called
+every time an event is read from the TTRee!! Leading to very slow reading times (& probably
+memory leaks)
+*/
+/////////////////////////////////////////////////////////////////////////////://
+
+
+KVEvent::KVEvent(Int_t mult, const char *classname) : fParameters("EventParameters","Parameters associated with an event")
{
//Initialise KVEvent to hold mult events of "classname" objects
//(the class must inherit from KVNucleus).
@@ -53,14 +70,10 @@
// Default argument :
// classname = "KVNucleus"
//
- //If the class "classname" has a custom streamer, or if for some other reason you
- //wish to force the TClonesArray to use the "classname" streamer, you must use
- // KVEvent::CustomStreamer();
- //before reading/writing the event to/from a file etc.
-
- init();
+
+ fOKIter = 0;
fParticles = new TClonesArray(classname, mult);
- TStreamerInfo::SetCanDelete(kFALSE);
+ CustomStreamer();//force use of KVEvent::Streamer function for reading/writing
}
@@ -70,14 +83,14 @@
{
//Destructor. Destroys all objects stored in TClonesArray and releases
//allocated memory.
- fParticles->Delete();
+
+ fParticles->Delete();
delete fParticles;
fParticles = 0;
if (fOKIter) {
delete fOKIter;
fOKIter = 0;
}
- init();
}
//_______________________________________________________________________________
@@ -90,6 +103,7 @@
{
//Copy this to obj
KVBase::Copy(obj);
+ fParameters.Copy( ((KVEvent&)obj).fParameters );
for (Int_t nn=0;nn<fParticles->GetEntriesFast();nn+=1){
//printf("avant=%s - ",GetParticle(nn+1)->GetName());
GetParticle(nn+1)->Copy( *((KVEvent &) obj).AddParticle() );
@@ -116,17 +130,23 @@
KVNucleus *KVEvent::AddParticle()
{
- //Method used for building an event particle by particle.
- //DO NOT USE FOR READING EVENTS - use GetParticle(Int_t npart)!!
- //This method increases the multiplicity fMult by one and "creates"
- //a new particle with index (fMult-1).
- //The default constructor for the class corresponding to the
- //"new" particle is called.
- //A reference is set in the particle which points to this event.
-
+ // Method used for building an event particle by particle.
+ // DO NOT USE FOR READING EVENTS - use GetParticle(Int_t npart)!!
+ //
+ // This method increases the multiplicity fMult by one and "creates" a new particle with index (fMult-1).
+ // In actual fact a new object is only created if needed i.e. if the new multiplicity is greater
+ // than previously. Particle objects in the array are reused from one event to another.
+ // The default constructor for the class corresponding to the "new" particle will only be called
+ // once during its lifetime (i.e. if N events are generated, the particle ctor will be called only once,
+ // not N times). Once created, in subsequent events we just call the particle's Clear() method
+ // in order to reset its internal variables ready for a new event.
Int_t mult = GetMult();
- KVNucleus *tmp = (KVNucleus *) fParticles->New(mult);
+#ifdef __WITHOUT_TCA_CONSTRUCTED_AT
+ KVNucleus *tmp = (KVNucleus *) ConstructedAt(mult, "C");
+#else
+ KVNucleus *tmp = (KVNucleus *) fParticles->ConstructedAt(mult, "C");
+#endif
if (!tmp) {
Error("AddParticle", "Allocation failure, Mult=%d", mult);
return 0;
@@ -141,7 +161,8 @@
//Reset the event to zero ready for new event.
fParticles->Clear("C");
- init();
+ fParameters.Clear();
+ ResetGetNextParticle();
}
//________________________________________________________________________________
@@ -157,6 +178,7 @@
cout << "\nKVEvent with " << ((KVEvent *) this)->
GetMult(t) << " particles :" << endl;
cout << "------------------------------------" << endl;
+ fParameters.Print();
KVNucleus *frag = 0;
const_cast < KVEvent * >(this)->ResetGetNextParticle();
while ((frag = ((KVEvent *) this)->GetNextParticle(t))) {
@@ -538,3 +560,67 @@
nuc->SetFrame(newframe, oldframe, boost, rot, beta);
}
}
+
+//______________________________________________________________________________
+
+void KVEvent::Streamer(TBuffer &R__b)
+{
+ // Customised Streamer for KVEvent.
+ // This is just the automatic Streamer with the addition of a call to the Clear()
+ // method before reading a new object (avoid memory leaks with lists of parameters).
+
+ if (R__b.IsReading()) {
+ Clear();
+ R__b.ReadClassBuffer(KVEvent::Class(),this);
+ } else {
+ R__b.WriteClassBuffer(KVEvent::Class(),this);
+ }
+}
+
+//______________________________________________________________________________
+
+#ifdef __WITHOUT_TCA_CONSTRUCTED_AT
+TObject* KVEvent::ConstructedAt(Int_t idx)
+{
+ // Get an object at index 'idx' that is guaranteed to have been constructed.
+ // It might be either a freshly allocated object or one that had already been
+ // allocated (and assumingly used). In the later case, it is the callers
+ // responsability to insure that the object is returned to a known state,
+ // usually by calling the Clear method on the TClonesArray.
+ //
+ // Tests to see if the destructor has been called on the object.
+ // If so, or if the object has never been constructed the class constructor is called using
+ // New(). If not, return a pointer to the correct memory location.
+ // This explicitly to deal with TObject classes that allocate memory
+ // which will be reset (but not deallocated) in their Clear()
+ // functions.
+
+ TObject *obj = (*fParticles)[idx];
+ if ( obj && obj->TestBit(TObject::kNotDeleted) ) {
+ return obj;
+ }
+ return (fParticles->GetClass()) ? static_cast<TObject*>(fParticles->GetClass()->New(obj)) : 0;
+}
+//______________________________________________________________________________
+TObject *KVEvent::ConstructedAt(Int_t idx, Option_t *clear_options)
+{
+ // Get an object at index 'idx' that is guaranteed to have been constructed.
+ // It might be either a freshly allocated object or one that had already been
+ // allocated (and assumingly used). In the later case, the function Clear
+ // will be called and passed the value of 'clear_options'
+ //
+ // Tests to see if the destructor has been called on the object.
+ // If so, or if the object has never been constructed the class constructor is called using
+ // New(). If not, return a pointer to the correct memory location.
+ // This explicitly to deal with TObject classes that allocate memory
+ // which will be reset (but not deallocated) in their Clear()
+ // functions.
+
+ TObject *obj = (*fParticles)[idx];
+ if ( obj && obj->TestBit(TObject::kNotDeleted) ) {
+ obj->Clear(clear_options);
+ return obj;
+ }
+ return (fParticles->GetClass()) ? static_cast<TObject*>(fParticles->GetClass()->New(obj)) : 0;
+}
+#endif
=== modified file 'KVMultiDet/events/KVEvent.h'
--- KVMultiDet/events/KVEvent.h 2011-04-21 14:30:39 +0000
+++ KVMultiDet/events/KVEvent.h 2011-12-08 08:55:27 +0000
@@ -29,6 +29,7 @@
#include "TRotation.h"
#include "TLorentzRotation.h"
#include "KVParticleCondition.h"
+#include "KVNameValueList.h"
class KVEvent:public KVBase {
@@ -36,12 +37,17 @@
TClonesArray * fParticles; //->array of particles in event
TIter *fOKIter; //!used for iterating over particles
-
+ KVNameValueList fParameters;//general-purpose list of parameters
+#ifdef __WITHOUT_TCA_CONSTRUCTED_AT
+ TObject* ConstructedAt(Int_t idx);
+ TObject* ConstructedAt(Int_t idx, Option_t* clear_options);
+#endif
public:
+ KVNameValueList* GetParameters() const { return (KVNameValueList*)&fParameters; };
+
KVEvent(Int_t mult = 50, const char *classname = "KVNucleus");
virtual ~ KVEvent();
- void init();
#if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
virtual void Copy(TObject & obj) const;
@@ -55,6 +61,7 @@
virtual void Clear(Option_t * opt = "");
virtual void Print(Option_t * t = "") const;
+ virtual void ls(Option_t * t = "") const { Print(t); };
KVNucleus *GetParticleWithName(const Char_t * name) const;
KVNucleus *GetParticle(const Char_t * group_name) const;
KVNucleus *GetNextParticle(Option_t * opt = "");
@@ -87,7 +94,7 @@
void SetFrame(const Char_t * newframe, const Char_t * oldframe,
const TVector3 & boost, TRotation & rot, Bool_t beta = kFALSE);
- ClassDef(KVEvent, 3) //Base class for all types of multiparticle event
+ ClassDef(KVEvent, 4) //Base class for all types of multiparticle event
};
#endif
=== modified file 'KVMultiDet/events/KVMultiDeteventsLinkDef.h'
--- KVMultiDet/events/KVMultiDeteventsLinkDef.h 2011-11-29 09:12:57 +0000
+++ KVMultiDet/events/KVMultiDeteventsLinkDef.h 2011-12-08 08:55:27 +0000
@@ -5,11 +5,11 @@
#pragma link off all functions;
#pragma link C++ nestedclass;
#pragma link C++ nestedtypedef;
-#pragma link C++ class KVSimEvent-;
+#pragma link C++ class KVSimEvent+;
#pragma link C++ class KVDetectorEvent+;
#pragma link C++ class KVElasticScatter+;
#pragma link C++ class KVElasticScatterEvent+;
-#pragma link C++ class KVEvent+;
+#pragma link C++ class KVEvent-;
#pragma link C++ class KVReconstructedEvent-;//customised streamer
#pragma link C++ class KVTestEvent+;
#pragma link C++ class KV2Body+;
=== modified file 'KVMultiDet/events/KVReconstructedEvent.cpp'
--- KVMultiDet/events/KVReconstructedEvent.cpp 2011-06-24 07:53:34 +0000
+++ KVMultiDet/events/KVReconstructedEvent.cpp 2011-12-08 08:55:27 +0000
@@ -74,15 +74,10 @@
void KVReconstructedEvent::Streamer(TBuffer & R__b)
{
//Stream an object of class KVReconstructedEvent.
- //When reading an event, first Clear() is called (this calls the Clear()
- //method of all the particles in the previous event, in case they have
- //to do some cleaning up i.e. in the multidetector array which detected
- //them).
- //Then we set the particles' angles depending on whether mean or random angles
+ //We set the particles' angles depending on whether mean or random angles
//are wanted (fMeanAngles = kTRUE or kFALSE)
if (R__b.IsReading()) {
- Clear();
R__b.ReadClassBuffer(KVReconstructedEvent::Class(), this);
// if the multidetector object exists, update some informations
// concerning the detectors etc. hit by this particle
=== modified file 'KVMultiDet/events/KVSimEvent.cpp'
--- KVMultiDet/events/KVSimEvent.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/events/KVSimEvent.cpp 2011-12-08 08:55:27 +0000
@@ -12,34 +12,13 @@
<h4>Classe d�v�de KVEvent pour la gestion d'�nements issus de simulations</h4>
<!-- */
// --> END_HTML
-////////////////////////////////////////////////////////////////////////////////
-//La classe d�ve �lement de KVNameValueList pour pouvoir ajouter autant
-// de parametres que possible afin d'enregistrer des propri�s de l '�nement
-// propre �haque simulation
-//
//Cette classe est coupl��VSimNucleus
+////////////////////////////////////////////////////////////////////////////////
//___________________________
KVSimEvent::KVSimEvent(Int_t mult, const char*classname):KVEvent(mult,classname)
{
// Default constructor
- init();
- //CustomStreamer();
-}
-
-//___________________________
-void KVSimEvent::Streamer(TBuffer & R__b)
-{
- //Stream an object of class KVSimEvent.
- //When reading an event, first Clear() is called (this calls the Clear()
- //method of all the particles in the previous event).
-
- if (R__b.IsReading()) {
- Clear();
- R__b.ReadClassBuffer(KVSimEvent::Class(), this);
- } else {
- R__b.WriteClassBuffer(KVSimEvent::Class(), this);
- }
}
//___________________________
@@ -47,46 +26,3 @@
{
//destructeur
}
-
-//___________________________
-void KVSimEvent::init()
-{
- //protected method
- //to initialize variables
-
-}
-
-//___________________________
-void KVSimEvent::Copy(TObject& obj) const
-{
- //Copy l'object "this" vers obj
-
- KVEvent::Copy(obj);
-
- //Appel direct de KVNameValueList::Copy()
- //provoquait un segmentation fault ...
- //on recopie peu ou prou
- //cette methode, pour que ca marche
-
- khl->Copy(*((KVSimEvent &)obj).GetList());
- ((KVSimEvent &)obj).GetList()->SetName(khl->GetName());
-}
-
-//___________________________
-void KVSimEvent::Clear(Option_t * opt)
-{
- //Clear des variables h�t� de KVEvent
- //La liste des parametres est effac�
- KVEvent::Clear(opt);
- Clear_NVL(opt);
-}
-
-//___________________________
-void KVSimEvent::Print(Option_t* opt) const
-{
- //print des informations relatives � objet
-
- KVEvent::Print(opt);
- Print_NVL(opt);
-
-}
=== modified file 'KVMultiDet/events/KVSimEvent.h'
--- KVMultiDet/events/KVSimEvent.h 2011-11-23 10:51:51 +0000
+++ KVMultiDet/events/KVSimEvent.h 2011-12-08 08:55:27 +0000
@@ -5,23 +5,15 @@
#define __KVSIMEVENT_H
#include "KVEvent.h"
-#include "KVNameValueList.h"
-class KVSimEvent : public KVEvent, public KVNameValueList
+class KVSimEvent : public KVEvent
{
- protected:
- void init();
-
public:
KVSimEvent(Int_t mult = 50, const char *classname = "KVSimNucleus");
virtual ~KVSimEvent();
-
- void Copy(TObject& obj) const;
- void Clear(Option_t * opt = "");
- void Print(Option_t* opt = "") const;
-
- ClassDef(KVSimEvent,2)//Events from simulation
+
+ ClassDef(KVSimEvent,3)//Events from simulation
};
#endif
=== modified file 'KVMultiDet/geometry/KVMultiDetArray.cpp'
--- KVMultiDet/geometry/KVMultiDetArray.cpp 2011-11-23 10:51:51 +0000
+++ KVMultiDet/geometry/KVMultiDetArray.cpp 2011-12-08 08:55:27 +0000
@@ -165,11 +165,11 @@
fLayers = new KVList;
fLayers->SetCleanup(kTRUE);
- fDetectors = new KVHashList(20,2);
+ fDetectors = new KVHashList();
fDetectors->SetCleanup(kTRUE);
fGroups = new KVList;
fGroups->SetCleanup(kTRUE);
- fIDTelescopes = new KVHashList(20,2);
+ fIDTelescopes = new KVHashList();
fIDTelescopes->SetOwner(kTRUE); // owns its objects
fIDTelescopes->SetCleanup(kTRUE);
@@ -852,7 +852,7 @@
#endif
part->SetE0();
- det_stat->Clear_NVL();
+ det_stat->Clear();
Double_t eLostInTarget=0;
if (part->GetKE()==0) {
@@ -1019,10 +1019,10 @@
if (part->InheritsFrom("KVSimNucleus")){
//On enregistre l eventuelle perte dans la cible
if (fTarget)
- ((KVSimNucleus* )part)->SetValue("TARGET",eLostInTarget);
+ ((KVSimNucleus* )part)->GetParameters()->SetValue("TARGET",eLostInTarget);
//On enregistre le statut de detection
for (Int_t nds=0;nds<det_stat->GetNpar();nds+=1){
- ((KVSimNucleus* )part)->SetValue(det_stat->GetNameAt(nds),det_stat->GetStringValue(nds));
+ ((KVSimNucleus* )part)->GetParameters()->SetValue(det_stat->GetNameAt(nds),det_stat->GetStringValue(nds));
}
//On enregistre les differentes pertes d'energie dans les detecteurs
if (nvl){
@@ -1030,7 +1030,7 @@
TIter it(nvl->GetList());
TNamed* nam = 0;
while ( (nam = (TNamed* )it.Next()) ){
- ((KVSimNucleus* )part)->SetValue(nam->GetName(),nam->GetTitle());
+ ((KVSimNucleus* )part)->GetParameters()->SetValue(nam->GetName(),nam->GetTitle());
}
delete nvl;
=== modified file 'KVMultiDet/particles/KVNucleus.cpp'
--- KVMultiDet/particles/KVNucleus.cpp 2011-06-07 10:24:52 +0000
+++ KVMultiDet/particles/KVNucleus.cpp 2011-12-08 08:55:27 +0000
@@ -547,6 +547,7 @@
GetKE();
cout << " E*=" << GetExcitEnergy();
cout << " Theta=" << GetTheta() << " Phi=" << GetPhi() << endl;
+ GetParameters()->Print();
}
//___________________________________________________________________________________________
=== modified file 'KVMultiDet/particles/KVParticle.cpp'
--- KVMultiDet/particles/KVParticle.cpp 2011-08-16 12:26:15 +0000
+++ KVMultiDet/particles/KVParticle.cpp 2011-12-08 08:55:27 +0000
@@ -114,7 +114,7 @@
// and par->GetFrame(framename).BelongsToGroup(groupname) = kTRUE
///////////////////////////////////////////////////////////////////////////
-KVParticle::KVParticle()
+KVParticle::KVParticle() : fParameters("ParticleParameters","Parameters associated with a particle in an event")
{
init();
}
@@ -124,9 +124,8 @@
{
//default initialisation
fE0 = 0;
- fGroups = 0;
SetFrameName("");
- fBoosted = 0;
+ fGroups.SetOwner(kTRUE);
}
//_________________________________________________________
@@ -142,7 +141,7 @@
}
//________________________________________________________
-KVParticle::KVParticle(Double_t m, TVector3 & p)
+KVParticle::KVParticle(Double_t m, TVector3 & p) : fParameters("ParticleParameters","Parameters associated with a particle in an event")
{
//create particle with given mass and momentum vector
init();
@@ -151,7 +150,7 @@
}
//________________________________________________________
-KVParticle::KVParticle(Double_t m, Double_t px, Double_t py, Double_t pz)
+KVParticle::KVParticle(Double_t m, Double_t px, Double_t py, Double_t pz) : fParameters("ParticleParameters","Parameters associated with a particle in an event")
{
//create particle with given mass and momentum vector
init();
@@ -162,13 +161,7 @@
//________________________________________________________
KVParticle::~KVParticle()
{
- //dtor
Clear();
- /*
- Mise en commentaire ces deux pointeurs sont deja delete et mis a zero dans Clear
- if (fBoosted) delete fBoosted;
- if (fGroups) delete fGroups;
- */
}
//________________________________________________________
@@ -231,6 +224,7 @@
cout << "KVParticle mass=" << M() <<
" Theta=" << GetTheta() << " Phi=" << GetPhi()
<< " KE=" << GetKE() << endl;
+ GetParameters()->Print();
}
//_________________________________________________________________________________________
@@ -276,6 +270,7 @@
((KVParticle &) obj) = *this;
((KVParticle &) obj).SetGroups(this->GetGroups());
((KVParticle &) obj).SetName(this->GetName());
+ fParameters.Copy( ((KVParticle &) obj).fParameters );
//((KVParticle &) obj).SetFrameName(GetFrameName());
//Info("Copy","je sort");
}
@@ -293,18 +288,9 @@
}
ResetIsOK(); //in case IsOK() status was set "by hand" in previous event
ResetBit(kIsDetected);
-
- if (fGroups) {
- fGroups->Clear();
- delete fGroups;
- fGroups = 0;
- }
-
- if (fBoosted) {
- fBoosted->Clear();
- delete fBoosted;
- fBoosted = 0;
- }
+ fParameters.Clear();
+ fGroups.Clear();
+ fBoosted.Clear();
}
//_________________________________________________________________________________________________________
@@ -399,16 +385,11 @@
TString sgroupname(groupname);
sgroupname.ToUpper();
- //Creation of the list of groups
- //if the method is derive in other class
- //this line has to be included
- if (!fGroups) CreateGroups();
-
if ( BelongsToGroup(sfrom.Data()) && !BelongsToGroup(sgroupname.Data()) ){
- fGroups->Add(new TObjString(sgroupname.Data()));
- if (fBoosted){
+ fGroups.Add(new TObjString(sgroupname.Data()));
+ if (fBoosted.GetEntries()){
TString inst; inst.Form("\"%s\"",sgroupname.Data());
- fBoosted->Execute("AddGroup",inst.Data());
+ fBoosted.Execute("AddGroup",inst.Data());
}
}
}
@@ -440,26 +421,11 @@
}
//___________________________________________________________________________//
-void KVParticle::CreateGroups()
-{
- //Method called to created the pointeur fGroups
- //and defined it has owner of its objects
- //
- fGroups = new KVUniqueNameList();
- fGroups->SetOwner(kTRUE);
-
-}
-
-//___________________________________________________________________________//
void KVParticle::SetGroups(KVUniqueNameList* un)
{
//Define for the particle a new list of groups
//if there is an existing list, it's deleted
- if (fGroups)
- fGroups->Clear();
- else
- CreateGroups();
-
+ fGroups.Clear();
AddGroups(un);
}
@@ -478,16 +444,14 @@
Int_t KVParticle::GetNumberOfDefinedGroups(void)
{
//return the number of defined groups for the particle
- if (fGroups) return fGroups->GetEntries();
- else return 0;
+ return fGroups.GetEntries();
}
//___________________________________________________________________________//
KVUniqueNameList* KVParticle::GetGroups() const
{
//return the KVUniqueNameList pointeur where list of groups are stored
- return fGroups;
-
+ return (KVUniqueNameList*)&fGroups;
}
//___________________________________________________________________________//
@@ -502,8 +466,8 @@
//Important for KVEvent::GetNextParticle()
if (sgroupname.IsNull()) return kTRUE;
//retourne kFALSE si aucun groupe n'est defini
- if (!fGroups) return kFALSE;
- if ( fGroups->FindObject(sgroupname.Data()) ) return kTRUE;
+ if (!fGroups.GetEntries()) return kFALSE;
+ if ( fGroups.FindObject(sgroupname.Data()) ) return kTRUE;
return kFALSE;
}
@@ -512,16 +476,16 @@
{
// Remove group from list of groups
// Apply the method to all particles stored in fBoosted
- if (!fGroups) return;
+ if (!fGroups.GetEntries()) return;
TString sgroupname(groupname);
sgroupname.ToUpper();
TObjString* os = 0;
- if ( (os = (TObjString* )fGroups->FindObject(sgroupname.Data())) ){
- delete fGroups->Remove(os);
- if (fBoosted){
+ if ( (os = (TObjString* )fGroups.FindObject(sgroupname.Data())) ){
+ delete fGroups.Remove(os);
+ if (fBoosted.GetEntries()){
TString inst; inst.Form("\"%s\"",sgroupname.Data());
- fBoosted->Execute("RemoveGroup",inst.Data());
+ fBoosted.Execute("RemoveGroup",inst.Data());
}
}
}
@@ -531,9 +495,8 @@
{
//Remove all groups
// Apply the method to all particles stored in fBoosted
- if (!fGroups) return;
- fGroups->Clear();
- if (fBoosted) fBoosted->Execute("RemoveAllGroups","");
+ fGroups.Clear();
+ if (fBoosted.GetEntries()) fBoosted.Execute("RemoveAllGroups","");
}
//___________________________________________________________________________//
@@ -541,11 +504,7 @@
void KVParticle::ListGroups(void) const
{
//List all stored groups
- if (!fGroups) {
- cout << "Cette particle n appartient a aucun groupe" << endl;
- return;
- }
- if (fGroups->GetEntries()==0) {
+ if (!fGroups.GetEntries()) {
cout << "Cette particle n appartient a aucun groupe" << endl;
return;
}
@@ -578,10 +537,10 @@
//i.e. you will access the particle's "default" frame, which usually corresponds to the
//'laboratory' or 'detector' frame.
- if ( !fBoosted || !strcmp(frame,"") )
+ if ( !fBoosted.GetEntries() || !strcmp(frame,"") )
return this;
- KVParticle* f = (KVParticle *) fBoosted->FindObjectWithMethod(frame,"GetFrameName");
+ KVParticle* f = (KVParticle *) fBoosted.FindObjectWithMethod(frame,"GetFrameName");
if (!f){
//Warning("GetFrame","Frame %s does not defined for this particle",frame);
return this;
@@ -596,10 +555,10 @@
{
//Check if a given frame has been defined
- if (!fBoosted || !strcmp(frame,"") ) {
+ if (!fBoosted.GetEntries() || !strcmp(frame,"") ) {
return kFALSE;
}
- KVParticle* f = (KVParticle *) fBoosted->FindObjectWithMethod(frame,"GetFrameName");
+ KVParticle* f = (KVParticle *) fBoosted.FindObjectWithMethod(frame,"GetFrameName");
return (f ? kTRUE : kFALSE);
}
@@ -659,10 +618,6 @@
if ( !strcmp(frame,"") ) return;
- //create list if not already done
- if (!fBoosted)
- fBoosted = new KVList; //owns its objects
-
KVParticle *tmp = 0;
if ( HasFrame(frame) ){
tmp = GetFrame(frame);
@@ -672,7 +627,7 @@
tmp = (KVParticle* )this->IsA()->New();
tmp->SetFrameName(frame);
tmp->SetBit(kCanDelete);
- fBoosted->Add(tmp);
+ fBoosted.Add(tmp);
}
//copy all information on particle
=== modified file 'KVMultiDet/particles/KVParticle.h'
--- KVMultiDet/particles/KVParticle.h 2011-08-16 12:26:15 +0000
+++ KVMultiDet/particles/KVParticle.h 2011-12-08 08:55:27 +0000
@@ -28,6 +28,7 @@
#include "KVList.h"
#include "KVUniqueNameList.h"
#include "TObjString.h"
+#include "KVNameValueList.h"
class KVEvent;
class KVList;
@@ -37,13 +38,15 @@
TString fName; //!non-persistent name field - Is useful
TString fFrameName; //!non-persistent frame name field, sets when calling SetFrame method
- KVList *fBoosted; //!list of momenta of the particle in different Lorentz-boosted frames
- KVUniqueNameList* fGroups; //!list of TObjString for manage different group name
+ KVList fBoosted; //!list of momenta of the particle in different Lorentz-boosted frames
+ KVUniqueNameList fGroups; //!list of TObjString for manage different group name
static Double_t kSpeedOfLight; //speed of light in cm/ns
protected:
TVector3 * fE0; //the momentum of the particle before it is slowed/stopped by an absorber
+ KVNameValueList fParameters;//a general-purpose list of parameters associated with this particle
+
virtual void AddGroup_Withcondition(const Char_t*, KVParticleCondition*);
virtual void AddGroup_Sanscondition(const Char_t* groupname, const Char_t* from="");
void CreateGroups();
@@ -54,10 +57,8 @@
Bool_t HasFrame(const Char_t* frame);
Int_t GetNumberOfDefinedFrames(void) {
- if (fBoosted) return fBoosted->GetEntries();
- else return 0;
- // return (fBoosted ? fBoosted->GetEntries() : 0);
- }
+ return fBoosted.GetEntries();
+ };
Int_t GetNumberOfDefinedGroups(void);
KVUniqueNameList* GetGroups() const;
@@ -165,7 +166,7 @@
ResetBit(kIsOKSet);
};
- KVList* GetListOfFrames(void) {return fBoosted;}
+ KVList* GetListOfFrames(void) {return (KVList*)&fBoosted;}
void SetE0(TVector3 * e = 0) {
if (!fE0)
@@ -220,8 +221,13 @@
const Char_t *GetFrameName(void) const { return fFrameName; }
void SetFrameName(const Char_t* framename) {fFrameName=framename;}
+
+ KVNameValueList* GetParameters() const
+ {
+ return (KVNameValueList*)&fParameters;
+ };
- ClassDef(KVParticle, 7) //General base class for all massive particles
+ ClassDef(KVParticle, 8) //General base class for all massive particles
};
#endif
=== modified file 'KVMultiDet/particles/KVReconstructedNucleus.cpp'
--- KVMultiDet/particles/KVReconstructedNucleus.cpp 2011-06-24 08:23:41 +0000
+++ KVMultiDet/particles/KVReconstructedNucleus.cpp 2011-12-08 08:55:27 +0000
@@ -49,13 +49,10 @@
ResetBit(kIsIdentified);
ResetBit(kIsCalibrated);
ResetBit(kCoherency);
- for (register int i = 0; i < IDRESULTS_DIM; i++) {
- fIDresults[i].Reset();
- }
}
-KVReconstructedNucleus::KVReconstructedNucleus() : fDetList(0)
+KVReconstructedNucleus::KVReconstructedNucleus()
{
//default ctor.
init();
@@ -63,7 +60,7 @@
KVReconstructedNucleus::
KVReconstructedNucleus(const KVReconstructedNucleus &
- obj) : fDetList(0)
+ obj)
{
//copy ctor
init();
@@ -81,10 +78,6 @@
if (GetGroup()) {
GetGroup()->Reset();
}
- if (fDetList){
- delete fDetList;
- fDetList=0;
- }
init();
}
@@ -108,12 +101,11 @@
// if the multidetector object exists, update some informations
// concerning the detectors etc. hit by this particle
if ( gMultiDetArray ){
- if(!fDetList) fDetList=new KVHashList;
MakeDetectorList();
if (GetGroup()) GetGroup()->AddHit(this);
fIDTelescope = 0;
if(fIDTelName!="") fIDTelescope = gMultiDetArray->GetIDTelescope( fIDTelName.Data() );
- TIter next_det(fDetList);
+ TIter next_det(&fDetList);
KVDetector *det;
while ( (det = (KVDetector*)next_det()) ){
fNSegDet += det->GetSegment();
@@ -149,6 +141,7 @@
if(idr && idr->IDattempted) idr->Print();
}
}
+ GetParameters()->Print();
}
//_______________________________________________________________________________
@@ -179,10 +172,10 @@
KVNucleus::Clear(opt);
if (GetGroup())
GetGroup()->Reset();
- if (fDetList){
- delete fDetList;
- fDetList=0;
- };
+ fDetList.Clear();
+ for (register int i = 0; i < IDRESULTS_DIM; i++) {
+ fIDresults[i].Reset();
+ }
init();
}
@@ -197,8 +190,7 @@
fDetNames += det->GetName();
fDetNames += "/";
// store pointer to detector
- if (!fDetList) fDetList = new KVHashList;
- fDetList->Add(det);
+ fDetList.Add(det);
//add segmentation index of detector to total segmentation index of particle
fNSegDet += det->GetSegment();
//add 1 unidentified particle to the detector
@@ -367,12 +359,12 @@
// the detectors whose names are stored in fDetNames.
// If gMultiDetArray=0x0, fDetList list will be empty.
- fDetList->Clear();
+ fDetList.Clear();
if ( gMultiDetArray ){
fDetNames.Begin("/");
while ( !fDetNames.End() ) {
KVDetector* det = gMultiDetArray->GetDetector( fDetNames.Next(kTRUE) );
- if ( det ) fDetList->Add(det);
+ if ( det ) fDetList.Add(det);
}
}
}
=== modified file 'KVMultiDet/particles/KVReconstructedNucleus.h'
--- KVMultiDet/particles/KVReconstructedNucleus.h 2011-06-24 08:23:41 +0000
+++ KVMultiDet/particles/KVReconstructedNucleus.h 2011-12-08 08:55:27 +0000
@@ -15,7 +15,7 @@
protected:
KVString fDetNames; // list of names of detectors through which particle passed
- KVHashList* fDetList; //! non-persistent list of pointers to detectors
+ KVHashList fDetList; //! non-persistent list of pointers to detectors
KVString fIDTelName; // name of identification telescope which identified this particle (if any)
KVIDTelescope* fIDTelescope; //! non-persistent pointer to identification telescope
@@ -66,11 +66,10 @@
// Return pointer to list of detectors through which particle passed,
// in reverse order (i.e. first detector in list is the one in which particle stopped).
- if (!fDetList) {
- const_cast<KVReconstructedNucleus*>(this)->fDetList = new KVHashList;
+ if (!fDetList.GetEntries()) {
const_cast<KVReconstructedNucleus*>(this)->MakeDetectorList();
}
- return fDetList;
+ return &fDetList;
};
KVDetector *GetDetector(int i) const
{
@@ -106,7 +105,7 @@
// recalculate segmentation index of particle used by Identify() and
// KVGroup::AnalyseParticles
fNSegDet=0;
- KVDetector* det; TIter nxt(fDetList);
+ KVDetector* det; TIter nxt(&fDetList);
while( (det=(KVDetector*)nxt()) ) fNSegDet += det->GetSegment();
};
inline Int_t GetStatus() const
=== modified file 'KVMultiDet/particles/KVSimNucleus.cpp'
--- KVMultiDet/particles/KVSimNucleus.cpp 2011-08-23 09:07:16 +0000
+++ KVMultiDet/particles/KVSimNucleus.cpp 2011-12-08 08:55:27 +0000
@@ -12,9 +12,6 @@
<h4>Classe d�v�de KVNucleus pour g�r des simulations dans KaliVeda</h4>
<!-- */
// --> END_HTML
-//La classe d�ve �lement de KVNameValueList pour pouvoir ajouter autant
-// de parametres que possible afin d'enregistrer des propri�s des noyaux
-// propre �haque simulation
//Deux TVector3 sont ajout�en champs de la classe :
// - le vecteur position
// - le vecteur moment angulaire
@@ -26,24 +23,11 @@
KVSimNucleus::KVSimNucleus()
{
//Constructeur par defaut
- init();
}
//___________________________
-void KVSimNucleus::init()
-{
- //protected method
- //to initialize variables
- IsCleared = kFALSE;
-}
-
-//___________________________
KVSimNucleus::~KVSimNucleus()
{
-
- //Destructeur
- if ( !IsCleared )
- Clear();
}
//___________________________
@@ -52,38 +36,9 @@
//Copy l'object "this" vers obj
- KVNucleus::Copy(obj);
-
+ KVNucleus::Copy(obj);
((KVSimNucleus &)obj).position = position;
((KVSimNucleus &)obj).angmom = angmom;
-
- //Appel direct de KVNameValueList::Copy()
- //provoquait un segmentation fault ...
- //on recopie peu ou prou
- //cette methode, pour que ca marche
-
- khl->Copy(*((KVSimNucleus &)obj).GetList());
- ((KVSimNucleus &)obj).GetList()->SetName(khl->GetName());
-}
-
-//___________________________
-void KVSimNucleus::Print(Option_t* opt) const
-{
- //print des informations relatives � objet
- KVNucleus::Print(opt);
- Print_NVL(opt);
-
-}
-
-//___________________________
-void KVSimNucleus::Clear(Option_t * opt)
-{
- //Clear des variables h�t� de KVNucleus
- //La liste des parametres est effac�
- KVNucleus::Clear(opt);
- Clear_NVL(opt);
-
- IsCleared = kTRUE;
}
//___________________________
=== modified file 'KVMultiDet/particles/KVSimNucleus.h'
--- KVMultiDet/particles/KVSimNucleus.h 2011-08-23 09:07:16 +0000
+++ KVMultiDet/particles/KVSimNucleus.h 2011-12-08 08:55:27 +0000
@@ -9,15 +9,12 @@
class TVector3;
-class KVSimNucleus : public KVNucleus, public KVNameValueList
+class KVSimNucleus : public KVNucleus
{
protected:
TVector3 position; // vector position of the particle in fm
TVector3 angmom; // angular momentum of the particle in ???
- Bool_t IsCleared;
-
- void init();
public:
@@ -25,8 +22,6 @@
virtual ~KVSimNucleus();
void Copy(TObject& obj) const;
- void Print(Option_t* opt = "") const;
- void Clear(Option_t * opt="");
void SetPosition(Double_t rx, Double_t ry, Double_t rz);
const TVector3* GetPosition() const;
@@ -34,7 +29,7 @@
void SetAngMom(Double_t lx, Double_t ly, Double_t lz);
const TVector3* GetAngMom() const;
- ClassDef(KVSimNucleus,2)//essai_sim
+ ClassDef(KVSimNucleus,3)//Nuclear particle in a simulated event
};
=== modified file 'KVMultiDet/vg_energy/KVCalorimetry.cpp'
--- KVMultiDet/vg_energy/KVCalorimetry.cpp 2011-12-07 09:24:30 +0000
+++ KVMultiDet/vg_energy/KVCalorimetry.cpp 2011-12-08 08:55:27 +0000
@@ -239,9 +239,9 @@
//opt==par, print the list of parameters
if (!strcmp(option,"ing"))
- nvl_ing->Print_NVL();
+ nvl_ing->Print();
else if (!strcmp(option,"par"))
- nvl_par->Print_NVL();
+ nvl_par->Print();
else
KVVarGlob::Print();
@@ -336,8 +336,8 @@
//Elles sont remplies au fur et �esure des
//methodes, pas besoin de d�nition a priori des
//noms des ingr�ents / param�es
- nvl_ing = new KVNameValueList(); nvl_ing->SetName_NVL("Ingredients");
- nvl_par = new KVNameValueList(); nvl_par->SetName_NVL("Parameters");
+ nvl_ing = new KVNameValueList(); nvl_ing->SetName("Ingredients");
+ nvl_par = new KVNameValueList(); nvl_par->SetName("Parameters");
//par defaut, aucun mode de calcul/remplissage n est s�ctionn� kfree_neutrons_included = kFALSE;
=== modified file 'MakeDict.mk'
--- MakeDict.mk 2011-11-29 09:12:57 +0000
+++ MakeDict.mk 2011-12-08 08:55:27 +0000
@@ -17,9 +17,9 @@
$(DICT_OBJ): $(DICT_CXX)
@echo "Compiling dictionary $@..."
- $(CXX) $(DICT_COMPILE_FLAGS) -c -o $@ $^
+ @$(CXX) $(DICT_COMPILE_FLAGS) -c -o $@ $^
$(DICT_CXX): $(HEADERS) $(LINKDEF)
@echo "Generating dictionary $@ using $(LINKDEF)..."
- rootcint -v -f $@ -c -p $(INCLUDE) $^
+ @rootcint -v -f $@ -c -p $(INCLUDE) $^
=== modified file 'Makefile.compat'
--- Makefile.compat 2011-04-26 14:37:57 +0000
+++ Makefile.compat 2011-12-08 08:55:27 +0000
@@ -178,5 +178,11 @@
echo '#define __WITHOUT_TPARAMETER 1' >> $@; \
echo '' >> $@
endif
+ifeq ($(shell expr $(ROOT_VERSION_CODE) \< $(ROOT_v5_32_00)),1)
+#------------------TClonesArray::ConstructedAt method from v5.32.00 onwards
+ @echo '//------------------TClonesArray::ConstructedAt method from v5.32.00 onwards' >> $@; \
+ echo '#define __WITHOUT_TCA_CONSTRUCTED_AT 1' >> $@; \
+ echo '' >> $@
+endif
@echo '#endif' >> $@
-cp $@ $(KVINSTALLDIR)/include/
=== modified file 'Makefile.general'
--- Makefile.general 2011-11-29 09:12:57 +0000
+++ Makefile.general 2011-12-08 08:55:27 +0000
@@ -128,14 +128,14 @@
all : .config dictionaries $(LIB_SO) rootlibmap $(EXTRAS) .copyheads
dictionaries:
- for module in $(MODULES); do \
+ @for module in $(MODULES); do \
make -f $(KVPROJ_ROOT)/MakeDict.mk MODULE=$$module LIBNAME=$(PROJ_NAME) INCLUDE="$(KV_INC)" EXCLUDE="$(ALL_NOT_READY_H) $(ALL_NOT_ROOTCINT)" DICT_COMPILE_FLAGS="$(ALL_CXXFLAGS_NOOPT)" ; \
done
rootlibmap :
- cat */*LinkDef.h > tmpLinkDef.h
- rlibmap -f -r $(MY_ROOTMAP) -l $(LIB_SO) -d $(RLIBMAPDEPS) -c tmpLinkDef.h
- -cp $(MY_ROOTMAP) $(KVINSTALLDIR)/lib/
+ @cat */*LinkDef.h > tmpLinkDef.h
+ @rlibmap -f -r $(MY_ROOTMAP) -l $(LIB_SO) -d $(RLIBMAPDEPS) -c tmpLinkDef.h
+ @-cp $(MY_ROOTMAP) $(KVINSTALLDIR)/lib/
$(LIB_SO): $(OBJECTS) $(DICT_OBJECTS)
ifeq ($(PLATFORM),macosx)
@@ -154,7 +154,8 @@
lib -nologo -MACHINE:IX86 $^ -def:lib$(PROJ_NAME).def $(OutPutOpt)$(LIB_LIB)
$(LD) $(SOFLAGS) $(LDFLAGS) $^ lib$(PROJ_NAME).exp $(LIBS) $(GLIBS) $(LINK_LIB) $(OutPutOpt)$@
else
- $(LD) $(SOFLAGS) $(LDFLAGS) $^ $(GLIBS) $(LINK_LIB) $(OutPutOpt) $@ $(EXPLLINKLIBS)
+ @echo "Building library $@"
+ @$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(GLIBS) $(LINK_LIB) $(OutPutOpt) $@ $(EXPLLINKLIBS)
endif
endif
@echo "$@ done"
@@ -163,7 +164,7 @@
-cp $(LIB_SO) $(KVINSTALLDIR)/bin/
-cp $(LIB_LIB) $(KVINSTALLDIR)/lib/
else
- -cp $(LIB_LIB) $(KVINSTALLDIR)/lib/
+ @-cp $(LIB_LIB) $(KVINSTALLDIR)/lib/
endif
.SUFFIXES: .$(SrcSuf)
@@ -171,23 +172,14 @@
###
clean :
- -rm -f $(PREREQ) $(OBJECTS) $(DICT_SOURCES) $(DICT_HEADERS) $(DICT_OBJECTS) lib$(PROJ_NAME)*.*
- -rm -f .copyheads .config .copysource
- -rm -f tmpLinkDef.h
+ @-rm -f $(PREREQ) $(OBJECTS) $(DICT_SOURCES) $(DICT_HEADERS) $(DICT_OBJECTS) lib$(PROJ_NAME)*.*
+ @-rm -f .copyheads .config .copysource
+ @-rm -f tmpLinkDef.h
.copyheads: $(HEADERS)
- -cp $? $(KVINSTALLDIR)/include/
- -touch .copyheads
+ @-cp $? $(KVINSTALLDIR)/include/
+ @-touch .copyheads
-indent:
-#this will apply the kernighan & ritchie indent style to all .h and .cpp files
-#as per ROOT coding conventions.
-#WARNING: only use this if your version of 'indent' has been corrected for
-#the bug which made any 'const' method declaration be doubled, like this:
-#MyClass::MyMethod(int args) const const
- $(foreach cppfile,$(SOURCES),$(shell indent -kr -i3 -nut $(cppfile)))
- $(foreach hfile,$(HEADERS),$(shell indent -kr -i3 -nut $(hfile)))
-
dist :
-mkdir $(DIST_DIR)
-rm -f .copyheads .config .copysource
@@ -219,9 +211,9 @@
-cp -r $(CPOPT) $(ETC_DATA) $(KVINSTALLDIR)/KVFiles/
endif
ifneq ($(PLATFORM),win32)
- -cp $(LIB_LIB) $(KVINSTALLDIR)/lib/$(LIBVERSION)
- -rm -f $(KVINSTALLDIR)/lib/$(LIB_LIB)
- ln -s $(KVINSTALLDIR)/lib/$(LIBVERSION) $(KVINSTALLDIR)/lib/$(LIB_LIB)
+ @-cp $(LIB_LIB) $(KVINSTALLDIR)/lib/$(LIBVERSION)
+ @-rm -f $(KVINSTALLDIR)/lib/$(LIB_LIB)
+ @ln -s $(KVINSTALLDIR)/lib/$(LIBVERSION) $(KVINSTALLDIR)/lib/$(LIB_LIB)
endif
ifeq ($(PLATFORM),macosx)
-cp $(LIB_DY) $(KVINSTALLDIR)/lib/$(LIBDYVERSION)
@@ -241,7 +233,7 @@
$(foreach subdir,$(MODULES),$(shell ln -f -s . $(KVINSTALLDIR)/src/$(subdir)))
.copysource : $(SOURCES)
- touch .copysource
+ @touch .copysource
ifeq ( $(KVINSTALLDIR),)
@echo "KVROOT environment variable doesn't seem to be set."
@echo "You must set it in order to install KaliVeda project files"
@@ -249,7 +241,7 @@
@echo "or 'export KVROOT=install_path' (bash)"
@echo "use 'make install' to perform the installation"
else
- -cp $? $(KVINSTALLDIR)/src/
+ @-cp $? $(KVINSTALLDIR)/src/
endif
removemoduledirs :
@@ -339,11 +331,12 @@
ifneq ($(ARCH),win32)
.$(SrcSuf).$(ObjSuf):
- $(CXX) $(ALL_CXXFLAGS) $(OutPutOpt)$@ -c $<
+ @echo Compiling $<...
+ @$(CXX) $(ALL_CXXFLAGS) $(OutPutOpt)$@ -c $<
%.d : %.cpp
- @echo Making prerequisite $@; \
- set -e; rm -f $@; \
+# @echo Making prerequisite $@;
+ @set -e; rm -f $@; \
$(CXX) -MM -MT $(subst .cpp,.$(ObjSuf),$<) $(ALL_CXXFLAGS) $< > $@
##### Include all the *.o target rules generated by gcc -MM #####
Follow ups