8 #include "G4Geantino.hh"
9 #include "G4ChargedGeantino.hh"
19 : G4VSensitiveDetector(
name )
20 , m_MMSimHitCollection( hitCollectionName )
34 G4Track* currentTrack = aStep->GetTrack();
35 int charge=currentTrack->GetDefinition()->GetPDGCharge();
36 bool geantinoHit = (currentTrack->GetDefinition()==G4Geantino::GeantinoDefinition()) ||
37 (currentTrack->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition());
39 if (!
charge && (!geantinoHit))
return false;
41 G4StepPoint* postStep=aStep->GetPostStepPoint();
42 const G4Step* post_Step=aStep->GetTrack()->GetStep();
46 int pdgCode=currentTrack->GetDefinition()->GetPDGEncoding();
48 float globalTime=postStep->GetGlobalTime();
49 float eKin=postStep->GetKineticEnergy();
50 if (eKin<= 0. && (!geantinoHit))
return false;
53 float depositEnergy=post_Step->GetTotalEnergyDeposit();
55 if (depositEnergy<0.0001 && (!geantinoHit))
return false;
57 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
61 int nLayer=touchHist->GetVolume(0)->GetCopyNo();
62 std::string chName=touchHist->GetVolume(1)->GetLogicalVolume()->GetName();
63 std::string subType=chName.substr(chName.find(
'-')+1);
64 if (subType[0]!=
'M') G4cout <<
" something is wrong, this is no Micromegas!" << G4endl;
65 std::string temp(&subType[1]);
66 std::istringstream is(temp);
73 G4ThreeVector posH=postStep->GetPosition();
74 if (subType[2]==
'L') posH.rotateZ(
M_PI/8.);
75 double phiHit=posH.phi();
76 if(phiHit<=0) phiHit+=2.*
M_PI;
79 if (subType[2]==
'L')
iPhi-=1;
82 if (position.z()<0) iSide=-1;
84 int mLayer=
atoi((subType.substr(3,1)).c_str());
85 if (mLayer != 1 && mLayer !=2) G4cout <<
" something is wrong - multilayer index is " << mLayer << G4endl;