10 #include "FairRootManager.h"
11 #include "FairVolume.h"
17 #include "TClonesArray.h"
18 #include "TVirtualMC.h"
19 #include "TGeoManager.h"
20 #include "TGeoPhysicalNode.h"
29 class FairGeoInterface;
30 class FairGeoRootBuilder;
36 class TGeoVoxelFinder;
50 if (fVerboseLevel>0) {
51 std::cout<<
"-I- PndGemDetector: fListOfSensitives contains:";
63 : FairDetector(name, active), fUseRadDamOption(false) {
67 if (fVerboseLevel>0) {
68 std::cout<<
"- I - PndGemDetector: fListOfSensitives contains:";
92 std::cout<<
" -I- Initializing PndGemDetector()"<<std::endl;
95 std::cout<<
" -E- No gGeoManager in PndGemDetector::Initialize()!"<<std::endl;
106 if ( gMC->IsTrackEntering() )
110 fTime = gMC->TrackTime() * 1.0e09;
112 gMC->TrackPosition(
fPosIn);
113 gMC->TrackMomentum(
fMomIn);
122 if ( gMC->IsTrackExiting() ||
123 gMC->IsTrackStop() ||
124 gMC->IsTrackDisappeared() ) {
126 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
132 if (fVerboseLevel > 1){
133 std::cout <<
"******* Info from gMC *************" << std::endl;
134 std::cout <<
"Hit in " << gMC->CurrentVolPath() <<
" with MCiD: " << vol->getMCid() <<
" PixelDetectorID: " <<
kGEM << std::endl;
143 if (
fELoss == 0.)
return kFALSE;
146 TString detPath = gMC->CurrentVolPath();
187 FairRootManager::Instance()->Register(
"GEMPoint",
"PndGem",
fPndGemCollection, kTRUE);
211 std::cout <<
"-I- PndGemDetector: " << nHits <<
" points registered in this event." << std::endl;
235 nEntries = cl1->GetEntriesFast();
237 std::cout <<
"-I- PndGemDetector: " << nEntries <<
" entries to add." << std::endl;
239 TClonesArray& clref = *cl2;
243 for (Int_t
i=0;
i<nEntries;
i++)
248 index = oldpoint->GetTrackID() +
offset;
250 oldpoint->SetTrackID(index);
254 std::cout <<
"-I- PndGemDetector: " << cl2->GetEntriesFast() <<
" merged entries."
261 TString fileName=GetGeometryFileName();
265 if(fileName.EndsWith(
".root")){
266 ConstructRootGeometry();
268 std::cout<<
"Geometry format not supported " <<std::endl;
275 std::cout <<
"-----------------------------------" << std::endl;
276 std::cout <<
" M I S A L I G N D E T E C T O R " << std::endl;
299 for ( Int_t ist = 0 ; ist < 3 ; ist++ ) {
300 if ( ist == 2 ) nofSeg = 3;
301 for ( Int_t isg = 0 ; isg < nofSeg ; isg++ ) {
302 for ( Int_t isp = 0 ; isp < 2 ; isp++ ) {
303 TString tName = Form(
"/cave_1/Gem_Disks_0/Gem_Disk%d_Volume_0/Gem_Disk%d_Seg%d_Gem%d_Sensor_GEMmixture_0",ist+1,ist+1,isg+1,isp*5+1);
304 cout << tName.Data() << endl;
305 TGeoPhysicalNode* tgpn =
gGeoManager->MakePhysicalNode(tName.Data());
306 TGeoHMatrix* tghm = (TGeoHMatrix*)tgpn->GetOriginalMatrix();
307 cout <<
" * * * o r i g * * * o r i g * * * o r i g * * * o r i g * * * " << endl;
309 tghm->RotateX(gRandom->Gaus(0.,.1));
310 tghm->RotateY(gRandom->Gaus(0.,.1));
311 tghm->RotateZ(gRandom->Gaus(0.,.1));
313 cout <<
"trans = " << trans[0] <<
" " << trans[1] <<
" " << trans[2] << endl;
314 for ( Int_t ic = 0 ; ic < 3 ; ic++ )
315 trans[0] += gRandom->Gaus(0.,.03);
316 tghm->SetTranslation(trans);
317 cout <<
" * * * m o v e d * * * m o v e d * * * m o v e d * * * m o v e d * * * " << endl;
319 cout <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * " << endl;
325 std::cout <<
"-----------------------------------" << std::endl;
342 detName.Remove(0,detName.Last(
'/')+1);
343 detName.Remove(0,detName.First(
"Disk")+4);
344 Int_t stationNr = detName.Atoi();
345 detName.Remove(0,detName.First(
"Seg")+3);
346 Int_t segmentNr = detName.Atoi();
347 detName.Remove(0,detName.First(
"Gem")+3);
348 Int_t sensorNr = detName.Atoi();
349 if ( sensorNr == 6 ) sensorNr = 2;
352 return stationNr*256+sensorNr*16+segmentNr;
413 std::cout<<
"-I- PndGemDetector: Only active sensor type is set to \""<<sens.Data()<<
"\","<<std::endl;
414 std::cout<<
" this is not a default setting."<<std::endl;
423 TVector3 posIn, TVector3 posOut,TVector3 momIn, TVector3 momOut,
430 size = clref.GetEntriesFast();
432 if (fVerboseLevel >= 2)
433 std::cout <<
"-I- PndGemDetector: Adding Point at (" << posIn.X() <<
", " << posIn.Y()
434 <<
", " << posIn.Z() <<
") cm, (" << posOut.X() <<
", " << posOut.Y()
435 <<
", " << posOut.Z() <<
") cm, sensor " << sensID <<
" " << detID <<
", track "
436 << trackID <<
", energy loss " << eLoss*1e06 <<
" keV" << std::endl;
438 return new(clref[size])
PndGemMCPoint(trackID, detID, sensID, posIn, posOut,
439 momIn, momOut, time, length, eLoss);
virtual TClonesArray * GetCollection(Int_t iColl) const
TLorentzVector fMomIn
exit position in global frame
virtual void Print() const
std::vector< std::string > fListOfSensitives
enables the detection of neutral particles
bool fUseRadDamOption
Hit collection.
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
TGeoManager * gGeoManager
bool CheckIfSensitive(std::string name)
virtual void EndOfEvent()
void AddPoint(DetectorId iDet)
Int_t GetSensorId(TString detName)
virtual void Initialize()
TClonesArray * fPndGemCollection
TLorentzVector fPosIn
Det id.
PndGemMCPoint * AddHit(Int_t trackID, Int_t detID, Int_t sensID, TVector3 posIn, TVector3 posOut, TVector3 momIn, TVector3 momOut, Double_t time, Double_t length, Double_t eLoss)
void SetExclusiveSensorType(const TString sens)
virtual void ConstructGeometry()
TLorentzVector fMomOut
momentum
Int_t fPosIndex
energy loss
virtual ~PndGemDetector()
TLorentzVector fPosOut
entry position in global frame
virtual Bool_t ProcessHits(FairVolume *vol=0)