Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 #include "MuonGeoModel/MuonDetectorTool.h" 
002 #include "MuonGeoModel/MuonDetectorFactory001.h"
003 #include "MuonReadoutGeometry/MuonDetectorManager.h"
004 
005 #include "GeoModelSvc/IGeoModelSvc.h"
006 #include "GeoModelSvc/GeoModelExperiment.h"
007 #include "GeoModelSvc/StoredMaterialManager.h"
008 #include "GeoModelKernel/GeoPhysVol.h"
009 #include "GeoModelKernel/GeoPerfUtils.h"
010 #include "GaudiKernel/IService.h"
011 #include "GaudiKernel/ISvcLocator.h"
012 #include "GaudiKernel/MsgStream.h"
013 #include "GaudiKernel/Bootstrap.h"
014 #include "StoreGate/StoreGateSvc.h"
015 
016 #include "RDBAccessSvc/IRDBAccessSvc.h"
017 #include "RDBAccessSvc/IRDBRecord.h"
018 #include "RDBAccessSvc/IRDBRecordset.h"
019 
020 #include "AthenaPoolUtilities/CondAttrListCollection.h"
021 #include "GaudiKernel/IToolSvc.h"
022 #include "GaudiKernel/IIncidentSvc.h"
023 
024 #include <fstream>
025 #include "CLIDSvc/tools/ClassID_traits.h"
026 #include "SGTools/DataProxy.h"
027 
028 using namespace MuonGM;
029 
030 /**
031  ** Constructor(s)
032  **/
033 MuonDetectorTool::MuonDetectorTool( const std::string& type, const std::string& name, const IInterface* parent )
034     : GeoModelTool( type, name, parent ),  
035       m_layout("P03"),
036       //m_includeInertMaterials(0),
037       //m_idhfromconverters(0),
038       //m_minimalgeo(0),
039       m_accessCondDb(0),
040       m_asciiCondData(0),
041       //m_nova(0),
042       m_includeCutouts(0),
043       m_includeCutoutsBog(0),
044       m_includeCtbBis(0),
045       m_stationSelection(0),
046       m_controlAlines(111111),
047       m_altAsztFile(""),
048       m_cachingFlag(1),
049       m_fillCache_initTime(0),
050       m_enableFineClashFixing(0),
051       m_condDataTool("MuonAlignmentDbTool/MGM_AlignmentDbTool"),
052       m_manager(0)
053 {
054     declareInterface<IGeoModelTool>(this);
055     MsgStream log(msgSvc(), "MGM::MuonDetectorTool::MuonDetectorTool"); 
056     //    std::cout<<" Here is the MuonDetectorTool"<<std::endl;
057     declareProperty("LayoutName", m_layout );
058     //    declareProperty("IncludeInertMaterials", m_includeInertMaterials);
059     //    declareProperty("Id_helpers_from_converters", m_idhfromconverters);
060     //    declareProperty("LightGeometry_only", m_minimalgeo);
061     declareProperty("UseConditionDb",     m_accessCondDb);
062     declareProperty("UseAsciiConditionData", m_asciiCondData);
063     declareProperty("BuildFromNova",m_nova);
064     declareProperty("IncludeCutouts",m_includeCutouts);
065     declareProperty("IncludeCutoutsBog",m_includeCutoutsBog);
066     declareProperty("IncludeCtbBis",m_includeCtbBis);
067     //
068     declareProperty("StationSelection",  m_stationSelection = 0);
069     declareProperty("SelectedStations",  m_selectedStations);
070     declareProperty("SelectedStJzz",     m_selectedStEta);
071     declareProperty("SelectedStJff",     m_selectedStPhi);
072     declareProperty("ControlAlines",     m_controlAlines = 111111);
073     declareProperty("AlternateASZTFile", m_altAsztFile);
074     //declareProperty("CachingFlag",       m_cachingFlag = 1); //m_cachingFlag=0 doesn't make sense 
075     //                                     (->memory continously increading)
076     declareProperty("FillCacheInitTime", m_fillCache_initTime = 0);
077     declareProperty("EnableFineClashFixing",    m_enableFineClashFixing = 0);
078     declareProperty("TheMuonAlignmentTool",     m_condDataTool,      "a Tool to read from the condDB and save in StoreGate" );
079 
080     // THESE ALLOW TO RESET THE MUON SWITCHES IN THE oracle TABLES:
081     // to reset (for example) BUILDBARRELTOROID use ForceSwitchOnOff_BUILDBARRELTOROID = 1001/1000 to have/not have the BARRELTOROID
082     // i.e  you must set 1000 to force resetting + 1/0 (enable/disable)
083     // ForceSwitchOnOff_BUILDBARRELTOROID = XX with XX <1000 will have no effect => muon switches from Oracle will be used
084     declareProperty("ForceSwitchOnOff_BUILDINERTMATERIALS",  m_switchOnOff_BUILDINERTMATERIALS = 0);
085     declareProperty("ForceSwitchOnOff_MINIMALGEO",           m_switchOnOff_MINIMALGEO          = 0);
086     declareProperty("ForceSwitchOnOff_BUILDENDCAP",          m_switchOnOff_BUILDENDCAP         = 0);
087     declareProperty("ForceSwitchOnOff_BUILDCALOSADDLE",      m_switchOnOff_BUILDCALOSADDLE     = 0);
088     declareProperty("ForceSwitchOnOff_BUILDBARRELTOROID",    m_switchOnOff_BUILDBARRELTOROID   = 0);
089     declareProperty("ForceSwitchOnOff_BUILDENDCAPTOROID",    m_switchOnOff_BUILDENDCAPTOROID   = 0);
090     declareProperty("ForceSwitchOnOff_BUILDFEET",            m_switchOnOff_BUILDFEET           = 0);
091     declareProperty("ForceSwitchOnOff_BUILDDISKSHIELD",      m_switchOnOff_BUILDDISKSHIELD     = 0);
092     declareProperty("ForceSwitchOnOff_BUILDTOROIDSHIELD",    m_switchOnOff_BUILDTOROIDSHIELD   = 0);
093     declareProperty("ForceSwitchOnOff_BUILDFORWARDSHIELD",   m_switchOnOff_BUILDFORWARDSHIELD  = 0);
094 
095 }
096 
097 /**
098  ** Destructor
099  **/
100 MuonDetectorTool::~MuonDetectorTool()
101 {
102         // This will need to be modified once we register the Muon DetectorNode in
103         // the Transient Detector Store
104         if ( 0 != m_detector ) {
105                 delete m_detector;
106                 m_detector = 0;
107         }
108 }
109 
110 StatusCode
111 MuonDetectorTool::initialize()
112 {
113     //MsgStream log(msgSvc(), name());
114     //log<<MSG::INFO<<"Initialize"<<endreq;
115     msg(MSG::INFO)<<"Initializing ..."<<endreq;
116     
117     StatusCode sc = m_condDataTool.retrieve();
118     if ( sc.isFailure() )
119     {
120         //log<<MSG::ERROR<<"Could not retrieve MuonAlignmentDbTool"<<endreq;
121         msg(MSG::ERROR) << "Could not retrieve MuonAlignmentDbTool" << endreq;
122     }
123     else
124     {
125         //log<<MSG::INFO<<"MuonAlignmentDbTool retrieved with statusCode = "<<sc<<" pointer = "<<m_condDataTool<<endreq;
126         msg(MSG::INFO)<<"MuonAlignmentDbTool retrieved with statusCode = "<<sc<<" pointer = "<<m_condDataTool<<endreq;
127     }
128 
129     // Incident Svc 
130     ServiceHandle<IIncidentSvc> incidentSvc("IncidentSvc", name());
131     sc = incidentSvc.retrieve();
132     if (sc.isFailure()) {
133         //log << MSG::ERROR << "IncidentSvc not found" << endreq;
134         msg(MSG::ERROR) << "IncidentSvc not found" << endreq;
135         return StatusCode::FAILURE;
136     }  
137     //Cannot remove DE at End of Event (potentially before other components performe some clean-up still using DE) 
138     //incidentSvc->addListener(this, "EndEvent");   
139     //StoreCleared still takes place at each event and as soon as the event store is cleared
140     incidentSvc->addListener(this, "StoreCleared");    
141     
142     return sc;
143 }
144 
145 void MuonDetectorTool::handle(const Incident& inc)
146 {
147     //go to StoreCleared
148     //if (inc.type()=="EndEvent" && m_fillCache_initTime ==0 && m_manager!=0)
149     if (inc.type()=="StoreCleared" && m_fillCache_initTime ==0 && m_manager!=0)
150     {
151         //MsgStream log(msgSvc(), "MGM::MuonDetectorTool::MuonDetectorTool");
152         // Do clear cache built up during the event ...
153         //log<<MSG::DEBUG<<"Clearing cache at end of event "<<endreq;
154         ATH_MSG_DEBUG ("Clearing cache at end of event after EventStore is cleared");
155         m_manager->clearCache();
156     }
157 }
158 
159 
160 /**
161  ** Create the Detector Node corresponding to this tool
162  **/
163 StatusCode
164 MuonDetectorTool::create( StoreGateSvc* detStore )
165 { 
166 
167     std::ofstream geoModelStats("MuonGeoModelStatistics_MuonDetectorTool");
168     int mem  = GeoPerfUtils::getMem();
169     int cpu  = int(GeoPerfUtils::getCpu()/100.);
170     geoModelStats <<"At MuonDetectorTool::create entry point: \t SZ= " <<mem << " Kb \t Time = " << cpu << " seconds " << std::endl; 
171 
172     int umem = GeoPerfUtils::getMem();
173     int ucpu = int(GeoPerfUtils::getCpu()/100.);
174     geoModelStats <<"At MuonDetectorTool::resetting to 0:     \t SZ= " <<umem-mem << " Kb \t Time = " << ucpu-cpu << " seconds " << std::endl;
175     mem = umem;
176     cpu = ucpu;
177     
178 
179     //MsgStream log(msgSvc(), name());
180 
181     if (msgLvl(MSG::VERBOSE))        
182         msg(MSG::VERBOSE)<<" Show properties (user sett.s or default): LayoutName                 "<<m_layout
183                          <<endreq
184                          <<" Show properties (user sett.s or default): IncludeCutouts             "<<m_includeCutouts
185                          <<endreq
186                          <<" Show properties (user sett.s or default): IncludeCutoutsBog          "<<m_includeCutoutsBog
187                          <<endreq
188                          <<" Show properties (user sett.s or default): IncludeCtbBis              "<<m_includeCtbBis
189                          <<endreq;
190   
191     // Get the detector configuration.
192     IGeoModelSvc *geoModel;
193     service ("GeoModelSvc",geoModel);
194   
195     std::string AtlasVersion = geoModel->atlasVersion();
196     std::string MuonVersion  = geoModel->muonVersionOverride();
197 
198     msg(MSG::INFO)<<"create MuonDetectorTool - package version = "<<PACKAGE_VERSION<<endreq;
199     msg(MSG::INFO)<<"(from GeoModelSvc)    AtlasVersion = <"<< AtlasVersion<<">  MuonVersion = <"<<MuonVersion<<">"<<endreq;
200 
201     // Unless we are using custom muons, the switch positions are going to
202     // come from the database:
203 
204     std::string detectorKey  = MuonVersion.empty() ? AtlasVersion : MuonVersion;
205     std::string detectorNode = MuonVersion.empty() ? "ATLAS" : "MuonSpectrometer";
206     msg(MSG::INFO)<<"Keys for Muon Switches are  (key) "  << detectorKey  << " (node) " << detectorNode << endreq;
207 
208     std::map<std::string,std::string>* altAsciiDBMap=0;
209     if ( MuonVersion == "CUSTOM" ) 
210         msg( MSG::WARNING )<< "Detector Information coming from a custom configuration !!" << endreq; 
211     else
212     {
213         msg( MSG::DEBUG )<< "Detector Information coming from the database (job options IGNORED)" << endreq;
214         IRDBAccessSvc *accessSvc;
215         service("RDBAccessSvc",accessSvc);
216         const IRDBRecordset *switchSet = accessSvc->getRecordset("MuonSwitches", detectorKey, detectorNode);
217         if ((*switchSet).size()==0) return StatusCode::FAILURE;
218         const IRDBRecord    *switches   = (*switchSet)[0];
219 
220         m_layout                = switches->getString("LAYOUTNAME");
221         //       m_includeInertMaterials = switches->getInt("BUILDINERTMATERIALS");
222         //       m_minimalgeo            = switches->getInt("MINIMALGEO");
223         if (MuonVersion == "") {
224             MuonVersion = accessSvc->getChildTag("MuonSpectrometer",detectorKey,detectorNode);
225             msg(MSG::INFO)<<"(from GeoModelSvc) in AtlasVersion = <"<< AtlasVersion<<">  default MuonVersion is <"
226                           <<MuonVersion<<">"<<endreq;
227         }
228 
229         msg(MSG::DEBUG)<<" m_altAsztFile: "<<m_altAsztFile<<endreq;
230         // use ascii file to read in ASZT parameters
231         if (m_altAsztFile != "") {
232             altAsciiDBMap=new std::map<std::string,std::string>;
233             altAsciiDBMap->insert(std::make_pair("ASZT",m_altAsztFile));        
234         }
235     }
236   
237   
238     // 
239     // Locate the top level experiment node 
240     // 
241     DataHandle<GeoModelExperiment> theExpt; 
242     if (StatusCode::SUCCESS != detStore->retrieve( theExpt, "ATLAS" ))
243     { 
244         msg(MSG::ERROR) 
245             << "Could not find GeoModelExperiment ATLAS" 
246             << endreq; 
247         return (StatusCode::FAILURE); 
248     }
249 
250     msg(MSG::INFO)<<"Properties have been set as follows: "<<endreq
251                   <<"    LayoutName                     "<< m_layout.substr(0,1)<<endreq
252                   <<"    IncludeCutouts                 "<< m_includeCutouts<<endreq
253                   <<"    IncludeCutoutsBog              "<< m_includeCutoutsBog<<endreq
254                   <<"    IncludeCtbBis                  "<< m_includeCtbBis<<endreq
255                   <<"    ControlAlines                  "<< m_controlAlines<<endreq;
256   
257     if ( m_stationSelection == 1) {
258         if ( (m_selectedStations.size()+ m_selectedStEta.size()+ m_selectedStPhi.size()) < 1){
259             msg(MSG::ERROR) << " **** Badly set Option "<< endreq
260                             << " **** SelectedStations size =" << m_selectedStations.size()<<endreq
261                             << " **** SelectedStJzz    size =" << m_selectedStations.size()<<endreq
262                             << " **** SelectedStJff    size =" << m_selectedStations.size()<<endreq
263                             << " **** while StationSelection = 1"<< endreq;
264             return( StatusCode::FAILURE );
265         }
266         for (unsigned int i=0; i<m_selectedStations.size() ; i++){
267             msg(MSG::INFO) << "          Selected stations      " << m_selectedStations[i] << endreq;
268         }
269   
270         if ( m_selectedStEta.size() > 0 )
271         {
272             for (unsigned int i=0; i<m_selectedStEta.size() ; i++)
273                 msg(MSG::INFO) << "          Selected Jzz locations  " << m_selectedStEta[i] << endreq;
274         }
275         if ( m_selectedStPhi.size() > 0 )
276         {
277             for (unsigned int i=0; i<m_selectedStPhi.size() ; i++)
278                 msg(MSG::INFO) << "          Selected Jff locations  " << m_selectedStPhi[i] << endreq;
279         }
280     }
281   
282       
283     //
284     // Locate the material manager:
285     //
286     DataHandle<StoredMaterialManager> theMaterialManager;
287     if (StatusCode::SUCCESS != detStore->retrieve(theMaterialManager, "MATERIALS")) {
288         msg(MSG::ERROR) 
289             << "Could not find Material Manager MATERIALS" 
290             << endreq; 
291         return (StatusCode::FAILURE); 
292     } 
293 
294 
295     umem = GeoPerfUtils::getMem();
296     ucpu = int(GeoPerfUtils::getCpu()/100.);
297     geoModelStats <<"At MuonDetectorTool::material mgr done   \t SZ= " <<umem << " Kb \t Time = " << ucpu << " seconds  ---- \t DeltaM = "<<umem-mem<<" \t Delta T ="<<ucpu - cpu << std::endl;
298     mem = umem;
299     cpu = ucpu;
300     
301   
302     StatusCode result = StatusCode::SUCCESS;
303   
304     if ( 0 == m_detector ) {
305         IRDBAccessSvc* access = 0;
306         service("RDBAccessSvc",access);
307 
308         MuonDetectorFactory001 theFactory(detStore);
309     
310         theFactory.setDBAtlasVersion(AtlasVersion);
311         theFactory.setDBMuonVersion(MuonVersion);
312         theFactory.setDBkey( detectorKey );
313         theFactory.setDBnode(detectorNode);
314     
315         theFactory.setLayout(m_layout);
316         //theFactory.setIncludeInertMats(m_includeInertMaterials);
317         //theFactory.setIdhFromCnv(m_idhfromconverters);
318         //theFactory.setMinimalGeoFlag(m_minimalgeo);
319         theFactory.setCutoutsFlag(m_includeCutouts);
320         theFactory.setCutoutsBogFlag(m_includeCutoutsBog);
321         theFactory.setCtbBisFlag(m_includeCtbBis);
322         theFactory.setControlAlines(m_controlAlines);
323         theFactory.setCachingFlag(m_cachingFlag);
324         theFactory.setCacheFillingFlag(m_fillCache_initTime);
325         theFactory.setFineClashFixingFlag(m_enableFineClashFixing);
326         if ( m_stationSelection == 1 ) theFactory.setSelection(m_selectedStations, m_selectedStEta, m_selectedStPhi);
327 
328         theFactory.setSwitchOnOff(m_switchOnOff_BUILDINERTMATERIALS , 
329                                   m_switchOnOff_MINIMALGEO          ,
330                                   m_switchOnOff_BUILDENDCAP         ,
331                                   m_switchOnOff_BUILDCALOSADDLE     ,
332                                   m_switchOnOff_BUILDBARRELTOROID   ,
333                                   m_switchOnOff_BUILDENDCAPTOROID   ,
334                                   m_switchOnOff_BUILDFEET           ,
335                                   m_switchOnOff_BUILDDISKSHIELD     ,
336                                   m_switchOnOff_BUILDTOROIDSHIELD   ,
337                                   m_switchOnOff_BUILDFORWARDSHIELD   );
338     
339         //if(!m_nova)
340         //{
341         theFactory.setRDBAccess(access);
342         //theFactory.setUseRDB(1);
343         theFactory.setAltAsciiDBMap(altAsciiDBMap);
344         //}
345     
346         try {   
347             //
348             // This strange way of casting is to avoid an
349             // utterly brain damaged compiler warning.
350             //
351             GeoPhysVol *world=&*theExpt->getPhysVol();
352             theFactory.create(world);
353             //      log << MSG::INFO << "CREATING MuonDetectorNode; MM=" << &*theMaterialManager<< endreq;
354         } catch (std::bad_alloc) {
355             msg(MSG::FATAL)<< "Could not create new MuonDetectorNode!" << endreq;
356             return StatusCode::FAILURE; 
357         }
358 
359         umem = GeoPerfUtils::getMem();
360         ucpu = int(GeoPerfUtils::getCpu()/100.);
361         geoModelStats <<"At MuonDetectorTool::factory created     \t SZ= " <<umem << " Kb \t Time = " << ucpu << " seconds  ---- \t DeltaM = "<<umem-mem<<" \t Delta T ="<<ucpu - cpu << std::endl;
362         mem = umem;
363         cpu = ucpu;
364     
365 
366         // Register the MuonDetectorNode instance with the Transient Detector Store
367         m_manager = theFactory.getDetectorManager();
368         //Init ABline historical container --- will write there A/B lines from ORACLE / ascii file if any
369         m_manager->initABlineContainers();
370         //Recod in StoreGate the ABline historical containers
371         ALineMapContainer * amap = m_manager->ALineContainer();
372         BLineMapContainer * bmap = m_manager->BLineContainer();
373         msg(MSG::INFO)<<"A/BLineMapContainers are @ <"<<(uintptr_t)amap<<"> annd <"<<(uintptr_t)bmap<<">"<<endreq;
374         
375         if ((detStore->record(amap,"MDT_A_LINE_CORR")).isFailure()) return StatusCode::FAILURE;
376         if ((detStore->record(bmap,"MDT_B_LINE_CORR")).isFailure()) return StatusCode::FAILURE;
377         // if we want to fill the whole cache init time
378         if (m_fillCache_initTime) m_manager->fillCache();
379         
380 
381         umem = GeoPerfUtils::getMem();
382         ucpu = int(GeoPerfUtils::getCpu()/100.);
383         geoModelStats <<"At MuonDetectorTool::trk cache done      \t SZ= " <<umem << " Kb \t Time = " << ucpu << " seconds  ---- \t DeltaM = "<<umem-mem<<" \t Delta T ="<<ucpu - cpu << std::endl;
384         mem = umem;
385         cpu = ucpu;
386     
387 
388         result = detStore->record(theFactory.getDetectorManager(),theFactory.getDetectorManager()->getName());
389         if (result != StatusCode::SUCCESS) return result;
390 
391         //if  (m_idhfromconverters == 0)
392         //{
393         // Register the MuonIdHelper instances with the Transient Detector Store
394         // this way any client will ask the DetStore for them will not activate their converters 
395         StatusCode scridh = detStore->record(theFactory.getDetectorManager()->mdtIdHelper(), "MDTIDHELPER");
396         if (scridh != StatusCode::SUCCESS) msg(MSG::ERROR) 
397                                                << "Could not record MDTIDHELPER" << endreq;
398         scridh = detStore->record(theFactory.getDetectorManager()->rpcIdHelper(), "RPCIDHELPER");
399         if (scridh != StatusCode::SUCCESS) msg(MSG::ERROR) 
400                                                << "Could not record RPCIDHELPER" << endreq; 
401         scridh = detStore->record(theFactory.getDetectorManager()->tgcIdHelper(), "TGCIDHELPER");
402         if (scridh != StatusCode::SUCCESS) msg(MSG::ERROR) 
403                                                << "Could not record TGCIDHELPER" << endreq; 
404         scridh = detStore->record(theFactory.getDetectorManager()->cscIdHelper(), "CSCIDHELPER");
405         if (scridh != StatusCode::SUCCESS) msg(MSG::ERROR) 
406                                                << "Could not record CSCIDHELPER" << endreq; 
407         //}
408         theExpt->addManager(theFactory.getDetectorManager());
409 
410         //     log<<MSG::INFO<<"ToolHandle in create - "<<m_condDataTool<<endreq;
411         //     IMuonAlignmentDbTool* pAliTool = &*m_condDataTool;
412         //     //and why not also print out this pAliTool pointer ? The &* is the trick to get the pointer to the real tool.
413         //     log<<MSG::INFO<<"pointer to the concrete tool in create - "<<pAliTool<<endreq;
414         //     std::string afn = m_condDataTool->aLineFolderName();
415         //     log << MSG::INFO << "A-line folder name is "<<afn << endreq;
416 
417         if (altAsciiDBMap) 
418         {
419             delete altAsciiDBMap;
420             altAsciiDBMap = 0;
421         }
422     }
423 
424     umem = GeoPerfUtils::getMem();
425     ucpu = int(GeoPerfUtils::getCpu()/100.);
426     geoModelStats <<"At MuonDetectorTool::everything done     \t SZ= " <<umem << " Kb \t Time = " << ucpu << " seconds  ---- \t DeltaM = "<<umem-mem<<" \t Delta T ="<<ucpu - cpu << std::endl;
427     geoModelStats.close();
428     
429     return result;
430 }
431 
432 StatusCode
433 MuonDetectorTool::clear(StoreGateSvc* detStore)
434 {
435   SG::DataProxy* _proxy = detStore->proxy(ClassID_traits<MuonGM::MuonDetectorManager>::ID(),m_manager->getName());
436   if(_proxy) {
437     _proxy->reset();
438     m_manager = 0;
439   }
440   return StatusCode::SUCCESS;
441 }
442 
443 StatusCode   
444 MuonDetectorTool::registerCallback( StoreGateSvc* detStore)
445 {
446 
447     //MsgStream log(msgSvc(), name());
448 
449     if (m_accessCondDb == 0) 
450     {
451         msg(MSG::INFO)<<"No data will be read from the condition DB"<<endreq;
452         if (m_asciiCondData == 0) return StatusCode::FAILURE;//!< This is OK: We don't want to look at condition data !
453     }
454 
455     // m_accessCondDb == 1, Amdcsimrec will expect A/B line containers from MuonDetectorManager -> fill the starting point 
456     // init A/B line historical container
457     // m_manager->initABlineContainers();
458     // record in SG the A/B line full containers 
459     //if ((detStore->record(m_manager->ALineContainer(),"MDT_A_LINE_CORR")).isFailure()) return StatusCode::FAILURE;
460     //if ((detStore->record(m_manager->BLineContainer(),"MDT_B_LINE_CORR")).isFailure()) return StatusCode::FAILURE;
461 
462     //
463     std::vector<std::string> folderNames = m_condDataTool->abLineFolderNames();
464     std::vector<std::string> foundFolderNames;
465     msg(MSG::INFO)<<"Register call-back  against "<<folderNames.size()<<" folders listed below "<<endreq;
466     int ic=0;
467     bool aFolderFound = false;
468     for (std::vector<std::string>::const_iterator ifld =folderNames.begin(); ifld!=folderNames.end(); ++ifld )
469     {
470         ++ic;
471         msg(MSG::INFO)<<" Folder n. "<<ic<<" <"<<(*ifld)<<">";
472         if (detStore->contains<CondAttrListCollection>(*ifld)) {
473             aFolderFound=true;
474             foundFolderNames.push_back(*ifld);
475             msg(MSG::INFO)<<"     found in the DetStore"<<endreq;
476         }
477         else
478             msg(MSG::INFO)<<" NOT found in the DetStore"<<endreq;
479     }    
480     if (!aFolderFound) 
481     {
482         msg(MSG::INFO)<<"CondAttrListCollection not found in the DetectorStore"<<endreq
483                       <<"Unable to register callback on CondAttrListCollection for any folder in the list "<<endreq
484                       <<"This is OK unless you expect to read alignment and deformations from COOL "<<endreq;
485         if (m_asciiCondData!=0)         
486         {
487             int dummyint;
488             std::list<std::string> dummylist;
489             this->align(dummyint,dummylist);
490             if (m_accessCondDb==0) return StatusCode::FAILURE;
491         }
492         else return StatusCode::FAILURE;//!< This is OK for standard reconstruction until we are running with static MS geometry DB !
493     }
494 
495     //!< register the IGeoModelTool::align interface of this tool for call back after the data
496     for (std::vector<std::string>::const_iterator ifld=foundFolderNames.begin(); ifld!=foundFolderNames.end(); ++ifld)
497     {
498         const DataHandle<CondAttrListCollection> parlineData;
499         StatusCode sc = detStore->regFcn(&IGeoModelTool::align,
500                                          dynamic_cast<IGeoModelTool *>(this),
501                                          parlineData,
502                                          *ifld);
503         if (sc.isFailure())
504         {
505             msg(MSG::WARNING)<<"Unable to register call-back to MuonDetectorTool::align() against folder <"<<*ifld<<">"
506                <<" This is OK unless you expect to read alignment and deformations from COOL "<<endreq;
507         }
508         else msg(MSG::INFO)<<"Call-back to MuonDetectorTool::align() against folder "<<*ifld<<" registered "<<endreq;
509     }
510     
511     return StatusCode::SUCCESS;
512 }
513 
514 StatusCode MuonDetectorTool::align(IOVSVC_CALLBACK_ARGS_P(I,keys))
515 {
516     //MsgStream log(msgSvc(), name());
517     msg(MSG::INFO)<<"In MuonDetectorTool::align"<<endreq;
518     if (m_accessCondDb == 0) 
519     {
520         msg(MSG::INFO)<<"Access to the cond DB not enabled by MuonGeoModel specific job-options (UseConditionDb=0)"<<endreq;
521         if (m_asciiCondData==0) return StatusCode::SUCCESS;
522     }   
523     if (m_asciiCondData==0) msg(MSG::INFO)<<"Access to the cond DB enabled by MuonGeoModel specific job-options (UseConditionDb=1)"<<endreq;
524     
525     msg(MSG::DEBUG)<<"ToolHandle in align - "<<m_condDataTool<<endreq;
526     IMuonAlignmentDbTool* pAliTool = &*m_condDataTool;
527     //and why not also print out this pAliTool pointer ? The &* is the trick to get the pointer to the real tool.
528     msg(MSG::DEBUG)<<"pointer to the concrete tool in align - "<<pAliTool<<endreq;
529     
530     StatusCode sc = m_condDataTool->loadParameters(I, keys);
531     if (sc.isRecoverable())
532     {
533         msg(MSG::WARNING)
534            <<"Recoverable error while loading the Alignment and Deformation parameters"<<endreq
535            <<"part of alignment data requested might be missing"<<endreq;
536     }
537     else if (sc.isFailure())
538     {
539         msg(MSG::ERROR)<<"Unable to load the Alignment and Deformation parameters"<<endreq;
540         return sc;
541     }
542     msg(MSG::INFO)<<"Alignment and Deformation parameters loaded and stored in the DetectorStore"<<endreq;
543 
544 
545     sc = m_manager->updateAlignment(m_condDataTool->ALineContainer());
546     if (sc.isFailure()) msg(MSG::ERROR)<<"Unable to updateAlignment"<<endreq;
547     else msg(MSG::DEBUG)<<"updateAlignment DONE"<<endreq;
548 
549 
550     sc = m_manager->updateDeformations(m_condDataTool->BLineContainer());
551     // this is m_manager->updateBlineMap(); m_manager->updateMdtCachedDeformations();
552     if (sc.isFailure()) msg(MSG::ERROR)<<"Unable to updateDeformations"<<endreq;
553     else msg(MSG::DEBUG)<<"updateDeformations DONE"<<endreq;
554     
555     return sc;
556 }

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!