@@ -661,76 +661,9 @@ void FairMCApplication::FinishRunOnWorker()
661661// _____________________________________________________________________________
662662void  FairMCApplication::Stepping ()
663663{
664- //  User actions at each step
665- //  ---
666- 
667-   //  Work around for Fluka VMC, which does not call
668-   //  MCApplication::PreTrack()
669-   static  Int_t TrackId = 0 ;
670-   if  ( fMcVersion  ==2  && fMC ->GetStack ()->GetCurrentTrackNumber () != TrackId ) {
671-     PreTrack ();
672-     TrackId = fMC ->GetStack ()->GetCurrentTrackNumber ();
673-   }
674- 
675-   //  Check if the volume with id is in the volume multimap.
676-   //  If it is not in the map the volume is not a sensitive volume 
677-   //  and we do not call nay of our ProcessHits functions.
678- 
679-   //  If the volume is in the multimap, check in second step if the current 
680-   //  copy is alredy inside the multimap. 
681-   //  If the volume is not in the multimap add the copy of the volume to the 
682-   //  multimap. 
683-   //  In any case call the ProcessHits function for this specific detector.
684-   Int_t copyNo;
685-   Int_t id = fMC ->CurrentVolID (copyNo);
686-   Bool_t InMap =kFALSE ;
687-   fDisVol =0 ;
688-   fDisDet =0 ;
689-   Int_t fCopyNo =0 ;
690-   fVolIter  =fVolMap .find (id);
691- 
692-   if  (fVolIter !=fVolMap .end ()) {
693- 
694-     //  Call Process hits for FairVolume with this id, copyNo
695-     do  {
696-       fDisVol =fVolIter ->second ;
697-       fCopyNo =fDisVol ->getCopyNo ();
698-       if (copyNo==fCopyNo ) {
699-         fDisDet =fDisVol ->GetDetector ();
700-         if  (fDisDet ) {
701-           fDisDet ->ProcessHits (fDisVol );
702-         }
703-         InMap=kTRUE ;
704-         break ;
705-       }
706-       fVolIter ++;
707-     }
708-     while (fVolIter !=fVolMap .upper_bound (id));
709- 
710-     //     if(fDisVol && !InMap) { // fDisVolume is set previously, no check needed
711- 
712-     //  Create new FairVolume with this id, copyNo.
713-     //  Use the FairVolume with the same id found in the map to get
714-     //  the link to the detector.
715-     //  Seems that this never happens (?)
716-     if (!InMap) {
717-       //  cout << "Volume not in map; fDisVol ? " << fDisVol << endl
718-       FairVolume* fNewV =new  FairVolume ( fMC ->CurrentVolName (), id);
719-       fNewV ->setMCid (id);
720-       fNewV ->setModId (fDisVol ->getModId ());
721-       fNewV ->SetModule (fDisVol ->GetModule ());
722-       fNewV ->setCopyNo (copyNo);
723-       fVolMap .insert (pair<Int_t, FairVolume* >(id, fNewV ));
724-       fDisDet =fDisVol ->GetDetector ();
725- 
726-       //  LOG(info) << "FairMCApplication::Stepping: new fair volume"
727-       //     << id << " " << copyNo << " " <<  fDisDet;
728-       if  ( fDisDet ) {
729-         fDisDet ->ProcessHits (fNewV );
730-       }
731-     }
732-   }
733- 
664+     Int_t copyNo = 0 ;
665+     Int_t id = 0 ;
666+     
734667  //  If information about the tracks should be stored the information as to be
735668  //  stored for any step.
736669  //  Information about each single step has also to be stored for the other 
@@ -838,11 +771,6 @@ void FairMCApplication::FinishEvent()
838771    fSaveCurrentEvent  = kTRUE ;
839772  }
840773
841-   for  (auto  detectorPtr : listActiveDetectors)
842-   {
843-     detectorPtr->EndOfEvent ();
844-   }
845-     
846774  fStack ->Reset ();
847775  if (NULL  != fTrajFilter ) {
848776    fTrajFilter ->Reset ();
@@ -1504,4 +1432,21 @@ void  FairMCApplication::UndoGeometryModifications()
15041432
15051433}
15061434
1435+ void  FairMCApplication::ConstructSensitiveDetectors ()
1436+ {
1437+     LOG (info) << " ############ ?????????? Construct sensitive detectors"  ;
1438+     
1439+     for (auto  const & x : fMapSensitiveDetectors )
1440+     {
1441+         LOG (debug) << " FairMCApplication::ConstructSensitiveDetectors " 
1442+         << x.first  << "  "   << x.second ;
1443+         TVirtualMC::GetMC ()->SetSensitiveDetector (x.first , x.second );
1444+     }
1445+ }
1446+ 
1447+ void  FairMCApplication::AddSensitiveModule (std::string volName, FairModule* module )
1448+ {
1449+     fMapSensitiveDetectors [volName] = module ;
1450+ }
1451+ 
15071452ClassImp (FairMCApplication)
0 commit comments