@@ -30,6 +30,7 @@ namespace fastsim
3030
3131void FastTracker::AddLayer (TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
3232{
33+ LOG (debug) << " Adding layer " << name << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type;
3334 DetLayer newLayer (name, r, z, x0, xrho, resRPhi, resZ, eff, type);
3435 // Check that efficient layers are not inert layers
3536 if (newLayer.getEfficiency () > 0 .0f && newLayer.isInert ()) {
@@ -144,27 +145,42 @@ void FastTracker::AddSiliconALICE3v2(std::vector<float> pixelResolution)
144145 AddLayer (" B10" , 80 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
145146}
146147
147- void FastTracker::AddSiliconALICE3 (std::vector<float > pixelResolution)
148+ void FastTracker::AddSiliconALICE3 (float scaleX0VD, std::vector<float > pixelResolution)
148149{
149- float x0IT = 0.001 ; // 0.1%
150+ float x0Pipe0 = 0.001592 ; // 200 um AlBe
151+ float x0VDL0 = 0.00076 ; // 30 um Si + 50 um glue + carbon foam 0.03%
152+ float x0VDL1 = 0.00096 ; // 30 um Si + 50 um glue + carbon foam 0.05%
153+ float x0VDL2 = 0.00167 ; // 30 um Si + 50 um glue + carbon foam 0.05% + 0.07% Be case
154+ float x0Coldplate = 0 .02f ; // (1.5 mm Al2O3 2%)
155+ float x0Pipe1 = 0 .0023f ; // 800 um Be
150156 float x0OT = 0.01 ; // 1.0%
151- float xrhoIB = 2.3292e-02 ; // 100 mum Si
152- float xrhoOT = 2.3292e-01 ; // 1000 mum Si
153- float eff = 1.00 ;
157+ float x0iTOF = x0OT * 3 .;
154158
155- float resRPhiIT = pixelResolution[0 ];
156- float resZIT = pixelResolution[1 ];
159+ float resRPhiVD = pixelResolution[0 ];
160+ float resZVD = pixelResolution[1 ];
157161 float resRPhiOT = pixelResolution[2 ];
158162 float resZOT = pixelResolution[3 ];
159163
160- AddLayer (" bpipe0" , 0.48 , 250 , 0.00042 , 2.772e-02 , 0 .0f , 0 .0f , 0 .0f , 0 ); // 150 mum Be
161- AddLayer (" B00" , 0.5 , 250 , x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1 );
162- AddLayer (" B01" , 1.2 , 250 , x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1 );
163- AddLayer (" B02" , 2.5 , 250 , x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1 );
164- AddLayer (" bpipe1" , 3.7 , 250 , 0.0014 , 9.24e-02 , 0 .0f , 0 .0f , 0 .0f , 0 ); // 500 mum Be
164+ float xrhoPipe0 = 0 ;
165+ float xrhoVDL0 = 0 ;
166+ float xrhoVDL1 = 0 ;
167+ float xrhoVDL2 = 0 ;
168+ float xrhoColdplate = 0 ;
169+ float xrhoPipe1 = 0 ;
170+ float xrhoOT = 2.3292e-01 ;
171+ float xrhoiTOF = 0.03 ;
172+ float eff = 1.00 ;
173+
174+ AddLayer (" bpipe0" , 0.48 , 250 , x0Pipe0, xrhoPipe0, 0 .0f , 0 .0f , 0 .0f , 0 );
175+ AddLayer (" B00" , 0.5 , 250 , x0VDL0 * scaleX0VD, xrhoVDL0, resRPhiVD, resZVD, eff, 1 );
176+ AddLayer (" B01" , 1.2 , 250 , x0VDL1 * scaleX0VD, xrhoVDL1, resRPhiVD, resZVD, eff, 1 );
177+ AddLayer (" B02" , 2.5 , 250 , x0VDL2 * scaleX0VD, xrhoVDL2, resRPhiVD, resZVD, eff, 1 );
178+ AddLayer (" coldplate" , 2.6 , 250 , x0Coldplate, xrhoColdplate, 0 .0f , 0 .0f , 0 .0f , 0 );
179+ AddLayer (" bpipe1" , 5.7 , 250 , x0Pipe1, xrhoPipe1, 0 .0f , 0 .0f , 0 .0f , 0 );
165180 AddLayer (" B03" , 7 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
166181 AddLayer (" B04" , 9 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
167182 AddLayer (" B05" , 12 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
183+ AddLayer (" iTOF" , 19 , 250 , x0iTOF, xrhoiTOF, resRPhiOT, resZOT, eff, 0 );
168184 AddLayer (" B06" , 20 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
169185 AddLayer (" B07" , 30 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
170186 AddLayer (" B08" , 45 ., 250 , x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1 );
@@ -217,6 +233,56 @@ void FastTracker::AddTPC(float phiResMean, float zResMean)
217233 }
218234}
219235
236+ void FastTracker::AddGenericDetector (std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager)
237+ {
238+ LOG (info) << " Adding generic detector from file " << filename;
239+ // If the filename starts with ccdb: then take the file from the ccdb
240+ if (filename.rfind (" ccdb:" , 0 ) == 0 ) {
241+ std::string ccdbPath = filename.substr (5 ); // remove "ccdb:" prefix
242+ if (ccdbManager == nullptr ) {
243+ LOG (fatal) << " CCDB manager is null, cannot retrieve file " << ccdbPath;
244+ return ;
245+ }
246+ const std::string outPath = " /tmp/DetGeo/" ;
247+ filename = Form (" %s/%s/snapshot.root" , outPath.c_str (), ccdbPath.c_str ());
248+ std::ifstream checkFile (filename); // Check if file already exists
249+ if (!checkFile.is_open ()) { // File does not exist, retrieve from CCDB
250+ LOG (info) << " --- CCDB source detected for detector geometry " << filename;
251+ std::map<std::string, std::string> metadata;
252+ ccdbManager->getCCDBAccessor ().retrieveBlob (ccdbPath, outPath, metadata, 1 );
253+ // Add CCDB handling logic here if needed
254+ LOG (info) << " --- Now retrieving geometry configuration from CCDB to: " << filename;
255+ } else { // File exists, proceed to load
256+ LOG (info) << " --- Geometry configuration file already exists: " << filename << " . Skipping download." ;
257+ checkFile.close ();
258+ }
259+ AddGenericDetector (filename, nullptr );
260+ return ;
261+ }
262+
263+ std::ifstream infile (filename);
264+ if (!infile.is_open ()) {
265+ LOG (fatal) << " Could not open detector configuration file: " << filename;
266+ return ;
267+ }
268+
269+ std::string line;
270+ while (std::getline (infile, line)) {
271+ if (line.empty () || line[0 ] == ' #' )
272+ continue ; // skip comments and empty lines
273+ std::istringstream iss (line);
274+ std::string name;
275+ float r, z, x0, xrho, resRPhi, resZ, eff;
276+ int type;
277+ if (!(iss >> name >> r >> z >> x0 >> xrho >> resRPhi >> resZ >> eff >> type)) {
278+ LOG (error) << " Malformed line in detector config: " << line;
279+ continue ;
280+ }
281+ AddLayer (name.c_str (), r, z, x0, xrho, resRPhi, resZ, eff, type);
282+ }
283+ infile.close ();
284+ }
285+
220286float FastTracker::Dist (float z, float r)
221287{
222288 // porting of DetektorK::Dist
0 commit comments