Indeed, the long interface was added in order to provide
all particle characteristics needed to define it in Geant4.
We have now to remove the old method as, as you realized,
it is not working properly anymore.
Regards,
Ivana
Andrei Gheata wrote:
> Yes, looks like the interface forces you to use the prototype with more
> parameters. Please try that one.
>
> regards,
> Andrei
>
> Stefano Dusini wrote:
>> But the geant3/TGeant3/TGeant3.cxx implementation is
>>
>> //______________________________________________________________________
>> Bool_t TGeant3::DefineParticle(Int_t pdg,const char*
>> name,TMCParticleType type,
>> Double_t mass, Double_t charge, Double_t lifetime)
>> {
>> // Old function definition, now replaced with more arguments
>>
>> TVirtualMC::DefineParticle(pdg, name, type, mass, charge, lifetime);
>>
>> return false;
>> }
>>
>> and so DefineParticle is undefined...
>>
>> regards, Stefano
>>
>> Andrei Gheata wrote:
>>> Hi Stefano,
>>>
>>> In C++ when a function prototype has ' = 0' it means it is pure
>>> virtual, i.e. it is only an interface that has to be implemented
>>> mandatory by the derived classes. You can never instantiate an object
>>> of the base class type, but only the derived ones. You will find the
>>> method implementation in geant3/TGeant3/TGeant3.cxx for G3 case. Of
>>> course it has to match the base class prototype.
>>>
>>> Cheers,
>>> Andrei
>>>
>>> Stefano Dusini wrote:
>>>> Hi Andrei
>>>>
>>>> but TVirtualMC::DefineParticle(pdg, name, type, mass, charge,
>>>> lifetime);
>>>> dose not exist in ROOT there is only the prototype but the
>>>> implementation, or at least I did not find. At the moment I'm using
>>>> root_v5.23/02
>>>>
>>>> regards, Stefano
>>>>
>>>> Andrei Gheata wrote:
>>>>> Hi Stefano,
>>>>>
>>>>> TVirtualMC is a root class (in vmc library) and defines the 2
>>>>> prototypes for the virtual function DefineParticle() that are
>>>>> implemented in the derived TGeant3 (a class in the G3 library). In
>>>>> your case apparently the TVirtualMC class version is not in sync
>>>>> with the TGeant3 one. Most likely you have to upgrade ROOT to at
>>>>> least 5.23/02 (as specified at
>>>>> http://root.cern.ch/drupal/content/how-use-virtual-monte-carlo#Download)
>>>>>
>>>>>
>>>>> Cheers,
>>>>> Andrei
>>>>>
>>>>> Stefano Dusini wrote:
>>>>>> I have check inside the code of geant3_vmc_1.10 and DefineParticle
>>>>>> has two implementation
>>>>>> //______________________________________________________________________
>>>>>>
>>>>>> Bool_t TGeant3::DefineParticle(Int_t pdg,const char*
>>>>>> name,TMCParticleType type,
>>>>>> Double_t mass, Double_t charge, Double_t
>>>>>> lifetime)
>>>>>> {
>>>>>> // Old function definition, now replaced with more arguments
>>>>>>
>>>>>> TVirtualMC::DefineParticle(pdg, name, type, mass, charge,
>>>>>> lifetime);
>>>>>>
>>>>>> return false;
>>>>>> }
>>>>>>
>>>>>>
>>>>>> //______________________________________________________________________
>>>>>>
>>>>>> Bool_t TGeant3::DefineParticle(Int_t pdg,const char* name,
>>>>>> TMCParticleType mcType,
>>>>>> Double_t mass, Double_t charge, Double_t
>>>>>> lifetime,
>>>>>> const TString& /*pType*/, Double_t /*width*/,
>>>>>> Int_t /*iSpin*/, Int_t /*iParity*/, Int_t
>>>>>> /*iConjugation*/,
>>>>>> Int_t /*iIsospin*/, Int_t /*iIsospinZ*/,
>>>>>> Int_t /*gParity*/,
>>>>>> Int_t /*lepton*/, Int_t /*baryon*/,
>>>>>> Bool_t /*stable*/, Bool_t /*shortlived*/,
>>>>>> const TString& /*subType*/,
>>>>>> Int_t /*antiEncoding*/, Double_t /*magMoment*/,
>>>>>> Double_t /*excitation*/)
>>>>>> {
>>>>>> //
>>>>>> // Set a user defined particle
>>>>>> // Function is ignored if particle with specified pdg
>>>>>> // already exists and error report is printed.
>>>>>> // ---
>>>>>>
>>>>>> // Check if particle with specified pdg already exists
>>>>>> // in TGeant3
>>>>>> if (IdFromPDG(pdg) > 0) {
>>>>>> Error("SetParticle", "Particle already exists.");
>>>>>> return kFALSE;
>>>>>> }
>>>>>>
>>>>>> // Check if particle type is known to Geant3
>>>>>> Int_t itrtyp = TransportMethod(mcType);
>>>>>> if (itrtyp < 0) {
>>>>>> Error("SetParticle", "Unknown particle transport.");
>>>>>> return kFALSE;
>>>>>> }
>>>>>>
>>>>>> // Add particle to Geant3
>>>>>> Gspart(fNG3Particles++, name, itrtyp, mass, charge, lifetime);
>>>>>>
>>>>>> // Add particle to TDatabasePDG
>>>>>> // (if it does not yet exist here)
>>>>>> if (!TDatabasePDG::Instance()->GetParticle(pdg))
>>>>>> TDatabasePDG::Instance()
>>>>>> ->AddParticle(name, name, mass, kTRUE, 0, charge*3,
>>>>>> ParticleClass(mcType).Data(), pdg);
>>>>>>
>>>>>> // Resize fPDGCode table if needed
>>>>>> if ( fNPDGCodes >= fPDGCode.GetSize() )
>>>>>> fPDGCode.Set( fPDGCode.GetSize() + 100);
>>>>>>
>>>>>> fPDGCode[fNPDGCodes++] = pdg;
>>>>>>
>>>>>> return kTRUE;
>>>>>> }
>>>>>>
>>>>>> In my code I use the first implementation.
>>>>>>
>>>>>> To my understanding (sorry but I'm not a c++ expert) the first one
>>>>>> points to ROOT while the second not. I have check inside root src
>>>>>> code but I did not find any implementation of
>>>>>> TVirtualMC::DefineParticle only the definition in TVirtualMC.h.
>>>>>>
>>>>>> Do I have to use in my code the second implementation of
>>>>>> TGeant3::DefineParticle ?
>>>>>>
>>>>>> Thanks
>>>>>> Stefano
>>>>>> Andrei Gheata wrote:
>>>>>>> Stefano, looks like your G3 compilation is inconsistent. Just
>>>>>>> refresh the geant3 directory and recompile it from scratch. Make
>>>>>>> also sure that the library you compile is the first one
>>>>>>> accessible in LD_LIBRARY_PATH in case you have multiple versions.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Andrei
>>>>>>>
>>>>>>> Stefano Dusini wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have recompiled root with
>>>>>>>>
>>>>>>>> --enable-pythia6 --with-pythia-libdir=$KITS_DIR/pythia6
>>>>>>>>
>>>>>>>> recompiled geant3_vmc_1.10
>>>>>>>>
>>>>>>>> but the keep crash with the same error
>>>>>>>>
>>>>>>>> /sps/opera/scratch/dusini/sw/OpRelease/3.1/OpSim/v7r4/Linux/opsim.exe:
>>>>>>>> symbol lookup error:
>>>>>>>> /sps/opera/scratch/dusini/sw/OpRelease_fluka/kits/geant3_vmc_1.10/lib/tgt_linux/libgeant321vmc.so:
>>>>>>>> undefined symbol:
>>>>>>>> _ZN10TVirtualMC14DefineParticleEiPKc15TMCParticleTypeddd
>>>>>>>>
>>>>>>>> This error occur at the point where I define a new particle
>>>>>>>>
>>>>>>>> // DefineParticle(PDGCode, Name, Type, Mass, Charge, Lifetime)
>>>>>>>> gMC->DefineParticle(kOpPDGDPlus, "OPERA D +", kPTMuon,
>>>>>>>> kOpMassDPlus, 1., 1e+12);
>>>>>>>>
>>>>>>>> where gMC is a TGeant3TGeo object.
>>>>>>>>
>>>>>>>> regards,
>>>>>>>> Stefano
>>>>>>>>
>>>>>>>> Rene Brun wrote:
>>>>>>>>> TMCParticle class is in libEGPythia6.
>>>>>>>>> see top right corner of:
>>>>>>>>> http://root.cern.ch/root/html/TMCParticle.html
>>>>>>>>>
>>>>>>>>> Rene Brun
>>>>>>>>>
>>>>>>>>> Stefano Dusini wrote:
>>>>>>>>>> I'm trying to upgrade our (OPERA) detector simulation software
>>>>>>>>>> to use ROOT v5.23 and therefore I have also upgraded the
>>>>>>>>>> geant3_vmc version to v1.10. I have also modify the code to
>>>>>>>>>> use TVirtualMC as the only interface to the MC transportation
>>>>>>>>>> code. But at run time I get this error
>>>>>>>>>>
>>>>>>>>>> /sps/opera/scratch/dusini/sw/OpRelease/3.1/OpSim/v7r4/Linux/opsim.exe:
>>>>>>>>>> symbol lookup error:
>>>>>>>>>> /sps/opera/scratch/dusini/sw/OpRelease_fluka/kits/geant3_vmc_1.10/lib/tgt_linux/libgeant321vmc.so:
>>>>>>>>>> undefined symbol:
>>>>>>>>>> _ZN10TVirtualMC14DefineParticleEiPKc15TMCParticleTypeddd
>>>>>>>>>>
>>>>>>>>>> In fact using
>>>>>>>>>>
>>>>>>>>>> nm -u libgeant321vmc.so
>>>>>>>>>>
>>>>>>>>>> I see that
>>>>>>>>>>
>>>>>>>>>> U _ZN10TVirtualMC14DefineParticleEiPKc15TMCParticleTypeddd
>>>>>>>>>>
>>>>>>>>>> where the U means (from nm man page) that the symbol is
>>>>>>>>>> undefined.
>>>>>>>>>>
>>>>>>>>>> What is wrong?
>>>>>>>>>>
>>>>>>>>>> The geant3_vmc library has been build just with
>>>>>>>>>>
>>>>>>>>>> gmake
>>>>>>>>>>
>>>>>>>>>> and the environmental variable $ROOTSYS pointing to the ROOT
>>>>>>>>>> v5.23 directory and $ROOTSYS/lib added to the $LD_LIBRARY_PATH
>>>>>>>>>> and $ROOTSYS/bin added to $PATH.
>>>>>>>>>>
>>>>>>>>>> Do I have to specify something else when I compile geant3_vmc?
>>>>>>>>>> Do I have to use some special switch when I compile root?
>>>>>>>>>>
>>>>>>>>>> Thanks a lot
>>>>>>>>>> Stefano
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
-- ============================================================== e-mail: Ivana.Hrivnacova_at_cern.ch address: Institut Physique Nucleaire, 91406 Orsay, France phone: (33) 01 69 15 65 94 ==============================================================Received on Thu Apr 23 2009 - 19:57:21 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 23 2009 - 23:25:02 CEST