///////////////////////////////////////////////////////////// // FscDetector // // Class for FscDetector // ///////////////////////////////////////////////////////////// #include "iostream.h" #include "TClonesArray.h" #include "TGeoMCGeometry.h" #include "TGeoManager.h" #include "TLorentzVector.h" #include "TParticle.h" #include "TVirtualMC.h" #include "CbmGeoInterface.h" #include "CbmGeoLoader.h" #include "CbmGeoNode.h" #include "CbmGeoRootBuilder.h" #include "CbmStack.h" #include "CbmRootManager.h" #include "CbmVolume.h" #include "FscGeo.h" #include "FscDetector.h" #include "FscPoint.h" #include "CbmGeoG3Builder.h" #include "CbmRuntimeDb.h" #include "FscGeoPar.h" #include "TObjArray.h" #include "CbmRun.h" // ----- Default constructor ------------------------------------------- FscDetector::FscDetector() { fFscPointCollection = new TClonesArray("FscPoint"); fPosIndex = 0; fDetectorID = 0; } // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------ FscDetector::FscDetector(const char* name, Bool_t active) : CbmDetector(name, active) { fFscPointCollection = new TClonesArray("FscPoint"); fPosIndex = 0; fDetectorID = 0; fEventID=-1; SetVerboseLevel(2); } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- FscDetector::~FscDetector() { if (fFscPointCollection) { fFscPointCollection->Delete(); delete fFscPointCollection; } } // ------------------------------------------------------------------------- // ----- Public method ProcessHits -------------------------------------- Bool_t FscDetector::ProcessHits(CbmVolume* vol) { fTrackID = gMC->GetStack()->GetCurrentTrackNumber(); // trk ID fEventID = gMC->CurrentEvent(); Int_t copyNo = -1, lay = -1; Int_t module = 5,row = -1, crys = -1; gMC->CurrentVolID(lay); //std::cout<<"III FscDetector::ProcessHits() : layer = "<CurrentVolOffID(1, crystalCopyNo); crystalName = gMC->CurrentVolOffName(1); //std::cout<<"HHHH "<GetEntriesFast(); cout << "-I- FscDetector: " << nHits << " points registered in this event." << endl; if (fVerboseLevel>1) for (Int_t i=0; iPrint(); } // ---------------------------------------------------------------------------- // ----- Public method Reset ---------------------------------------------- void FscDetector::Reset() { fFscPointCollection->Clear(); fPosIndex = 0; } // ---------------------------------------------------------------------------- // ----- Public method CopyClones ----------------------------------------- // void FscDetector::CopyClones(TClonesArray* cl1, TClonesArray* cl2, Int_t offset ) { // Int_t nEntries = cl1->GetEntriesFast(); // cout << "-I- FscDetector: " << nEntries << " entries to add." << endl; // TClonesArray& clref = *cl2; // FscPoint* oldpoint = NULL; // for (Int_t i=0; iAt(i); // Int_t index = oldpoint->GetTrackID() + offset; // oldpoint->SetTrackID(index); // new (clref[fPosIndex]) FscPoint(*oldpoint); // fPosIndex++; // } // cout << " -I- FscDetector: " << cl2->GetEntriesFast() << " merged entries." // << endl; // } // ---------------------------------------------------------------------------- // ----- Public method ConstructGeometry ---------------------------------- void FscDetector::ConstructGeometry() { std::cout<<" --- Building FSC Geometry ---"<getGeoInterface(); FscGeo* fscGeo = new FscGeo(); fscGeo->setGeomFile(GetGeometryFileName()); std::cout<<"Geometry filename = "<addGeoModule(fscGeo); Bool_t rc = geoIFace->readSet(fscGeo); if (rc) fscGeo->create(geoLoad->getGeoBuilder()); else std::cerr<<"FscDetector:: geometry could not be read!"<getListOfVolumes(); std::cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<GetEntries()<<" volumes"<GetRuntimeDb(); FscGeoPar* par=(FscGeoPar*)(rtdb->getContainer("FscGeoPar")); TObjArray *fSensNodes = par->GetGeoSensitiveNodes(); TObjArray *fPassNodes = par->GetGeoPassiveNodes(); TListIter iter(volList); CbmGeoNode* node = NULL; CbmGeoVolume *aVol=NULL; while( (node = (CbmGeoNode*)iter.Next()) ) { std::cout<<"&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<< node->GetName()< ( node ); if ( node->isSensitive() ) { fSensNodes->AddLast( aVol ); }else{ fPassNodes->AddLast( aVol ); } } par->setChanged(); par->setInputVersion(fRun->GetRunId(),1); // set active/inactive ProcessNodes( volList ); std::cout<<"koniec"<1) cout << "-I- FscDetector: Adding Point at (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") cm, detector " << detID <<", track " << trackID <<" event "<