GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » Fairroot » General Discussion » Creating a new Detector out of 2 or more detectors
Creating a new Detector out of 2 or more detectors [message #13129] Fri, 02 March 2012 19:53 Go to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *physics.sunysb.edu
Hi All

My goal is to create the EIC detector and for it, i have individually created all the required detectors like (Hcal, Ecal, Tpc, etc..) and their geometries. and built them and got the respective libraries (libFairDircDet, etc..)
Now i am having the problem of linking them in the same macro.

My directory structure: ~/Fairroot/examples/ - has the following.
CMakeLists.txt HcalDet TrsDet geometry mcstack
DircDet HtckDet Tutorial1 geometry_eic passive
EmlfDet SitDet Tutorial2 geometry_old rutherford
FgtDet TpcDet gconfig geometry_v2 simpletracker

the macro that i am using is inside simpletracker/macros/run_simpletracker.C

I have also linked the libraries inside the cmakefile in simpletracker/src/CMakeLists.txt

...
set(INCLUDE_DIRECTORIES
${ROOT_INCLUDE_DIR}
#put here all directories where header files are located
${FAIRROOT_SOURCE_DIR}/fairtools
${FAIRROOT_SOURCE_DIR}/base
${FAIRROOT_SOURCE_DIR}/parbase
${FAIRROOT_SOURCE_DIR}/geobase
${FAIRROOT_SOURCE_DIR}/example/mcstack
${FAIRROOT_SOURCE_DIR}/example/simpletracker/src
${FAIRROOT_SOURCE_DIR}/example/DircDet/src
${FAIRROOT_SOURCE_DIR}/example/EmlfDet/src
${FAIRROOT_SOURCE_DIR}/example/FgtDet/src
${FAIRROOT_SOURCE_DIR}/example/HcalDet/src
${FAIRROOT_SOURCE_DIR}/example/HtckDet/src
${FAIRROOT_SOURCE_DIR}/example/SitDet/src
${FAIRROOT_SOURCE_DIR}/example/TpcDet/src
${FAIRROOT_SOURCE_DIR}/example/TrsDet/src
)

include_directories( ${INCLUDE_DIRECTORIES})
...

Even still inside my macro, when i do

FairDetector* Dirc = new FairDircDet("DIRC", kFALSE);
Dirc->SetGeometryFileName("dirc.geo");
run->AddModule(Dirc);

Root tells me that :

Error: Symbol FairDircDet is not defined in current scope run_simpletracker.C:118:
Error: type FairDircDet not defined FILE:/Users/raghav/fairroot/example/simpletracker/macros/./run_simpletra cker.C LINE:118

I cannot find a tutorial or a link on the website telling me how to link 2 detectors.

Any help will be greatly appreciated.
Thanks a lot
Re: Creating a new Detector out of 2 or more detectors [message #13134 is a reply to message #13129] Fri, 02 March 2012 20:40 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hallo Raghav,

If you follow the instruction on the web you create for each detector (directory) a shared library (So it is linked already), now to use these libraries in macro you have to load them first, did you load your libFairDircDet, etc.. libraries in the macro? i.e: do you have something like : gSystem->Load("libFairDircDet") in your macro?

Mohammad



[Updated on: Fri, 02 March 2012 20:40]

Report message to a moderator

Re: Creating a new Detector out of 2 or more detectors [message #13138 is a reply to message #13134] Sat, 03 March 2012 03:32 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *dyn.optonline.net
Hi Mohammad

I do have gSystem->Load("libFairDircDet") amongst all the other libraries in my macro.

Here is part of my CMakeLists.txt file inside the DircDet directory.

set(INCLUDE_DIRECTORIES
${ROOT_INCLUDE_DIR}
#put here all directories where header files are located
${FAIRROOT_SOURCE_DIR}/fairtools
${FAIRROOT_SOURCE_DIR}/base
${FAIRROOT_SOURCE_DIR}/parbase
${FAIRROOT_SOURCE_DIR}/geobase
${FAIRROOT_SOURCE_DIR}/example/mcstack
${FAIRROOT_SOURCE_DIR}/example/simpletracker/src
${FAIRROOT_SOURCE_DIR}/example/DircDet/src
)

include_directories( ${INCLUDE_DIRECTORIES})

set(LINK_DIRECTORIES
${ROOT_LIBRARY_DIR}
...


Rest of the file is built exactly like the instructions on the website.
I think that i did not do the linking properly but i dont understand why because i did it exactly like how the example rutherford was designed.

I have also built all the libraries for the detectors with no errors so they do exist properly.

Another problem that i have is with building the passive components like fairpipe.
I have it built exactly like the FairMagnet (with the appropriate changes for geometry and media, but on doing make, it gives me an error like

[ 61%] Built target FairRutherford
[ 61%] Generating FairPassiveDict.cxx, FairPassiveDict.h
[ 61%] Building CXX object example/passive/CMakeFiles/Passive.dir/FairGeoPipe.o
In file included from /usr/include/c++/4.2.1/typeinfo:39,
from /Users/raghav/fairsoft/tools/root/include/Rtypeinfo.h:32,
from /Users/raghav/fairsoft/tools/root/include/Rtypes.h:30,
from /Users/raghav/fairsoft/tools/root/include/TObject.h:31,
from /Users/raghav/fairroot/geobase/FairGeoVector.h:4,
from /Users/raghav/fairroot/geobase/FairGeoTransform.h:4,
from /Users/raghav/fairroot/geobase/FairGeoSet.h:5,
from /Users/raghav/fairroot/example/passive/FairGeoPipe.h:4,
from /Users/raghav/fairroot/example/passive/FairGeoPipe.cxx:11:
/usr/include/c++/4.2.1/exception:40: error: ‘#pragma’ is not allowed here
make[2]: *** [example/passive/CMakeFiles/Passive.dir/FairGeoPipe.o] Error 1
make[1]: *** [example/passive/CMakeFiles/Passive.dir/all] Error 2
make: *** [all] Error 2


Many thanks for all your help. (it has been awesome)







Re: Creating a new Detector out of 2 or more detectors [message #13139 is a reply to message #13138] Sat, 03 March 2012 03:44 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *dyn.optonline.net
Update:

Now i linked the libraries both ways,

inside CMakeLists.txt in DircDet, i did

set(LINK_DIRECTORIES
${ROOT_LIBRARY_DIR}
${FAIRROOT_SOURCE_DIR}/example/simpletracker/src
)

and inside CMakeLists.txt in Simpletracker (where my macro is) i did

set(LINK_DIRECTORIES
${ROOT_LIBRARY_DIR}
${FAIRROOT_SOURCE_DIR}/example/DircDet/src
${FAIRROOT_SOURCE_DIR}/example/EmlfDet/src
${FAIRROOT_SOURCE_DIR}/example/FgtDet/src
${FAIRROOT_SOURCE_DIR}/example/HcalDet/src
${FAIRROOT_SOURCE_DIR}/example/HtckDet/src
${FAIRROOT_SOURCE_DIR}/example/SitDet/src
${FAIRROOT_SOURCE_DIR}/example/TpcDet/src
${FAIRROOT_SOURCE_DIR}/example/TrsDet/src
)

So now i think that they are linked from both ways, and still root gives me

Processing run_simpletracker.C...
*********************************************************
* The Pluto event generator
* Developed by HADES and all contributing AUTHORS
* www-hades.gsi.de/computing/pluto/html/PlutoIndex.html
* Version: 5.37
* Compiled on 26 January 2012
*********************************************************
[INFO ] Media file used : /Users/raghav/fairroot/example/geometry/media.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/cave.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/magnet.geo
Error: Symbol FairDircDet is not defined in current scope run_simpletracker.C:124:
Error: type FairDircDet not defined FILE:/Users/raghav/fairroot/example/simpletracker/macros/./run_simpletra cker.C LINE:124
*** Interpreter error recovered ***
Re: Creating a new Detector out of 2 or more detectors [message #13140 is a reply to message #13139] Sat, 03 March 2012 19:43 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hi,

Did you add all the classes to the LinkDef file? if yes, can you attach or send me your FairDircDet files (.cxx & .h)

Mohammad
Re: Creating a new Detector out of 2 or more detectors [message #13141 is a reply to message #13140] Sat, 03 March 2012 20:11 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *dyn.optonline.net
Hi Mohammad

Many thanks for your quick reply. I have attached the following files here
1. DircDet.zip, is the directory of the detector.
All the .cxx and .h files are inside /DircDet/src/
2. simpletracker.zip. this is the main "detector" (my EIC). i am just using it as a macro from the rutherford example.
3. CMakeLists.txt this is the main cmake lists inside the fairroot/example directory.
4. passive.zip. I told you that my fairpipe was not building properly last time and this is the folder which has all the passive components.

Again, thanks a bunch.
Raghav
Re: Creating a new Detector out of 2 or more detectors [message #13142 is a reply to message #13141] Sat, 03 March 2012 22:04 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hi Raghav,

In your code there are many small errors, you forget to add some classes in the LinkDef file, and you where missing some includes. I corrected it, change the name of passive to eicpassive and change the structure in a way that you add it simply to the example directory and then add the line. "add_subdirectory (eicroot)" to the CMakeList.txt in the example directory. I could compile and load the libraries but I do not have the geometry files to run it. Please test it and let me know.


Mohammad
Re: Creating a new Detector out of 2 or more detectors [message #13143 is a reply to message #13142] Sat, 03 March 2012 22:41 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *dyn.optonline.net
Hi Mohammad

Thanks for your help, Now the eicpassive components work and i was able to build all the libraries without any problem.
But now when i run my macro, root still tells me that

Processing run_simpletracker.C...
*********************************************************
* The Pluto event generator
* Developed by HADES and all contributing AUTHORS
* www-hades.gsi.de/computing/pluto/html/PlutoIndex.html
* Version: 5.37
* Compiled on 26 January 2012
*********************************************************
[INFO ] Media file used : /Users/raghav/fairroot/example/geometry/media.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/cave.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/pipe.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/magnet.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/dpm.geo
loading detectors
Error: Symbol FairDircDet is not defined in current scope run_simpletracker.C:101:
Error: type FairDircDet not defined FILE:/Users/raghav/fairroot/example/eicroot/simpletracker/macros/./run_s impletracker.C LINE:101
*** Interpreter error recovered ***
root [1]

I have also uploaded the geometry files if you would like to check them.
Cheers

Raghav
  • Attachment: geometry.zip
    (Size: 85.32KB, Downloaded 135 times)

[Updated on: Sat, 03 March 2012 22:42]

Report message to a moderator

Re: Creating a new Detector out of 2 or more detectors [message #13148 is a reply to message #13143] Tue, 06 March 2012 00:46 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *dyn.optonline.net
Update:

Now i also checked the code by creating a macro inside Dircdet/macros/ called run_dircdet.C and it pretty much has the same structure of my other macros. I thought that since this was in the same directory as the src it should recognize my libFairDircDet.

But still root tells me that it cannot find the object FairDircDet, when i define my detector (and i did load the corresponding library).

I really have no idea what i am doing wrong because i keep comparing with rutherford example and i do not see a difference between them (except ofcourse the geometry files).

Many thanks for your continued help.
Raghav
Re: Creating a new Detector out of 2 or more detectors [message #13153 is a reply to message #13148] Tue, 06 March 2012 15:36 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: 140.181.9*
Hallo Raghav,

It took some time but I found it! in your CMakeList.txt in the DircDet you wrote:

Quote:

set(FAIRDIRCDET_LINKDEF FairDircDetLinkDef.h)
set(FAIRDIRCDET_DICTIONARY ${CMAKE_CURRENT_BINARY_DIR}/FairDict.cxx)



So your detector dictionary is called FairDict.cxx and you use FairBase project which also define the FairDict but of course does not have FairDictDet. please change the lines to :

Quote:

set(FAIRDIRCDET_LINKDEF FairDircDetLinkDef.h)
set(FAIRDIRCDET_DICTIONARY ${CMAKE_CURRENT_BINARY_DIR}/FairDircDict.cxx)


This should solve this problem.

regards,

Mohammad
Re: Creating a new Detector out of 2 or more detectors [message #13154 is a reply to message #13153] Tue, 06 March 2012 20:25 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *physics.sunysb.edu
Hi Mohammad

Thanks a lot, Now i think i understand the architecture.

(It looks like it is working but i am having some problems with loading the geometry files, my geometry root file tells me that it only has vacuum and iron so it only builds the magnet - might be some mistake on my part in defining the media file. But i will work it out)
Re: Creating a new Detector out of 2 or more detectors [message #13163 is a reply to message #13153] Thu, 08 March 2012 17:32 Go to previous messageGo to next message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *physics.sunysb.edu
Hi Mohammad

Looks like now it does not load the geometry files when i say

FairDetector* Dirc = new FairDircDet("DIRC", kFALSE);
Dirc->SetGeometryFileName("dircdet.geo");
run->AddModule(Dirc);

Root does not give me any errors but it also does not build the geometry

[INFO ] Media file used : /Users/raghav/fairroot/example/geometry/media_test.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/cave.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/pipe.geo
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/dpm.geo
loading detectors
[INFO ] User path for detector geometry : /Users/raghav/fairroot/example/geometry/dircdet.geo

It found all the necessary files but it only build vacuum from all the lot, which is evident when i look at this.

Info in <TGeoManager::Voxelize>: Voxelizing...
Info in <TGeoManager::CloseGeometry>: Building cache...
Info in <TGeoManager::CloseGeometry>: 1 nodes/ 1 volume UID's in FAIR geometry


I did find a workaround for this by saying

FairDetector* Dirc = new FairRutherford("DIRC", kFALSE);
Dirc->SetGeometryFileName("rutherford.geo");
run->AddModule(Dirc);

but i changed the rutherford.geo to look like dircdet.geo, and then it build rutherford like dircdet. This would be fine if i only had only detector but i have lots of them and i am really at a loss as to where the error is, because i compared FairRutherford classes with FairDircDet classes and cannot find a difference between.

I am having the same problem with the passive components as well. It only build magnet (but it sees all the rest) and i can only build pipe, if i define target (which was defined in the rutherford experiment) like the pipe. (just like i did for dircdet)

Many many thanks for your help.
Raghav
Re: Creating a new Detector out of 2 or more detectors [message #13164 is a reply to message #13163] Thu, 08 March 2012 17:39 Go to previous message
Raghav Kunnawalkam is currently offline  Raghav Kunnawalkam
Messages: 63
Registered: February 2012
Location: Stony Brook, New York
continuous participant
From: *physics.sunysb.edu
Update:

Hi Mohammad

I just solved the problem. It was really simple, inside my FairDircDetGeo.cxx files, i have set the name of the module to be dircdet where as i was defining the module name inside the geometry file as dirc.
So it did not build it.

Now i can go ahead and build them all.
Thanks again for your help
Cheers
Raghav
Previous Topic: Creating geometry for a new detector
Next Topic: FairMCPoint
Goto Forum:
  


Current Time: Fri Dec 03 14:49:15 CET 2021

Total time taken to generate the page: 0.02236 seconds