11 #include "TClonesArray.h" 12 #include "TParticle.h" 13 #include "TVirtualMC.h" 14 #include "TGeoMatrix.h" 17 #include "FairRootManager.h" 19 #include "FairRunSim.h" 20 #include "FairRuntimeDb.h" 21 #include "FairLogger.h" 23 #include "ERNeuRadGeoPar.h" 24 #include "ERMCEventHeader.h" 25 #include "ERNeuRadPoint.h" 26 #include "ERNeuRadStep.h" 31 fStorePrimarySteps(kFALSE),
32 fStoreAllSteps(kFALSE),
34 fNeuRadFirstStep(NULL),
41 flGeoPar =
new TList();
42 flGeoPar->SetName( GetName());
57 flGeoPar =
new TList();
58 flGeoPar->SetName( GetName());
79 FairDetector::Initialize();
80 FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb();
86 FairRootManager* ioman = FairRootManager::Instance();
88 LOG(FATAL) <<
"IO manager is not set" << FairLogger::endl;
90 ioman->Register(
"NeuRadPoint",
"NeuRad",
fNeuRadPoints, kTRUE);
92 ioman->Register(
"NeuRadStep",
"NeuRad",
fNeuRadSteps, kTRUE);
98 static const Double_t dP = 1.032 ;
99 static const Double_t BirkC1 = 0.013/dP;
100 static const Double_t BirkC2 = 9.6e-6/(dP * dP);
102 gMC->SetMaxStep(
fStep);
107 if (gMC->IsTrackEntering()) {
127 Double_t curLightYield = 0.;
130 if (gMC->TrackCharge()!=0) {
131 Double_t BirkC1Mod = 0;
133 if (TMath::Abs(gMC->TrackCharge())>=2)
134 BirkC1Mod=BirkC1*7.2/12.6;
138 if (gMC->TrackStep()>0){
139 Double_t dedxcm=gMC->Edep()*1000./gMC->TrackStep();
140 curLightYield=gMC->Edep()*1000./(1.+BirkC1Mod*dedxcm+BirkC2*dedxcm*dedxcm);
141 curLightYield /= 1000.;
146 if (gMC->IsTrackExiting() ||
147 gMC->IsTrackStop() ||
148 gMC->IsTrackDisappeared()) {
166 FairRunSim* run = FairRunSim::Instance();
176 for (Int_t i_point = 0; i_point <
fNeuRadPoints->GetEntriesFast(); i_point++) {
193 Int_t nEntries = cl1->GetEntriesFast();
194 LOG(DEBUG) <<
"NeuRad: " << nEntries <<
" entries to add" << FairLogger::endl;
195 TClonesArray& clref = *cl2;
197 for (Int_t i=0; i<nEntries; i++) {
199 Int_t index = oldpoint->GetTrackID() + offset;
200 oldpoint->SetTrackID(index);
203 LOG(DEBUG) <<
"NeuRad: " << cl2->GetEntriesFast() <<
" merged entries" << FairLogger::endl;
208 TString volName = name;
209 if(volName.Contains(
"fiber") ) {
221 gMC->TrackPosition(
fPosIn);
222 gMC->TrackMomentum(
fMomIn);
223 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
224 fTimeIn = gMC->TrackTime() * 1.0e09;
226 fMot0TrackID = gMC->GetStack()->GetCurrentTrack()->GetMother(0);
227 fMass = gMC->ParticleMass(gMC->TrackPid());
228 Int_t curVolId, corOffVolId;
229 if(!(TString(gMC->CurrentVolOffName(1)).Contains(
"dead") &&
230 TString(gMC->CurrentVolOffName(2)).Contains(
"pixel"))) {
231 LOG(FATAL) <<
"Old version of geometry structure is used" << FairLogger::endl;
234 curVolId = gMC->CurrentVolOffID(1,
fFiberNb);
235 corOffVolId = gMC->CurrentVolOffID(2,
fPixelNb);
236 corOffVolId = gMC->CurrentVolOffID(3,
fModuleNb);
239 if (TString(gMC->CurrentVolOffName(3)).Contains(
"submodul")){
240 Int_t pixel_in_submodule_X = 4;
241 Int_t pixel_in_submodule_Y = 4;
242 Int_t submodule_in_module_X = 2;
243 Int_t submodule_in_module_Y = 2;
244 Int_t pixel_row =
fPixelNb/pixel_in_submodule_X;
245 Int_t pixel_col =
fPixelNb%pixel_in_submodule_X;
246 Int_t subm_row =
fModuleNb/submodule_in_module_X;
247 Int_t subm_col =
fModuleNb%submodule_in_module_X;
248 fPixelNb = subm_row*submodule_in_module_X*pixel_in_submodule_X*pixel_in_submodule_Y
249 +pixel_row*submodule_in_module_X*pixel_in_submodule_X
250 +subm_col*pixel_in_submodule_X+pixel_col;
251 corOffVolId = gMC->CurrentVolOffID(4,
fModuleNb);
255 gMC->GetTransformation(gMC->CurrentVolPath(), matrix);
256 Double_t globalPos[3],localPos[3];
257 fPosIn.Vect().GetXYZ(globalPos);
258 matrix.MasterToLocal(globalPos,localPos);
259 fPosInLocal.SetXYZ(localPos[0],localPos[1],localPos[2]);
266 fTimeOut = gMC->TrackTime() * 1.0e09;
278 Int_t size = clref.GetEntriesFast();
305 gMC->TrackTime() * 1.0e09, gMC->TrackStep(), gMC->TrackPid(), gMC->TrackMass(),
fTrackStatus,
311 TLorentzVector posOut;
312 gMC->TrackPosition(posOut);
313 return TMath::Sqrt((posIn.X() - posOut.X())*(posIn.X() - posOut.X()) +
314 (posIn.Y() - posOut.Y())*(posIn.X() - posOut.X()) +
315 (posIn.Z() - posOut.Z())*(posIn.Z() - posOut.Z()));
ExpertTrackingStatus fTrackStatus
curren track stutus (transport, stop, disappeared, ...)
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
Copies the points collection with a given track index offset.
ERNeuRadStep * AddStep()
Adds a NeuRadStep to the Steps Collection.
TLorentzVector fMomOut
point start momentum
Float_t fFullEnergy
Sum Edep in event in sensetive volume.
Double_t fLightYield
light yield
Double_t CurPointLen(TLorentzVector &posIn)
return current point length
void FinishNewPoint()
Finish point creation. Call AddPoint()
Int_t fMot0TrackID
0th mother track index
virtual void Register()
Register output array (NeuRadPoint) to the I/O manager Abstract from FairDetector.
TClonesArray * fNeuRadPoints
The point collection.
Int_t fFiberNb
number of fiber in pixel
virtual void EndOfEvent()
Action at end of event Short status log and Reset(). Virtual from FairDetector.
Int_t fPixelNb
number of pixel in module
TClonesArray * fNeuRadSteps
The steps collection.
virtual Bool_t ProcessHits(FairVolume *vol=0)
Virtual method Defines the action to be taken when a step is inside the active volume. Creates a ERNeuRadPoint and adds it to the collection.
virtual void Print(const Option_t *opt=0) const
TLorentzVector fPosOut
point finish position
virtual Bool_t CheckIfSensitive(std::string name)
Check whether a volume is sensitive.
ERNeuRadStep * AddFirstStep()
Adds a NeuRadStep to the PrimaryStep Collection.
Bool_t fStoreAllSteps
Flag to storing all steps in sensetive volume.
ERNeuRadPoint * AddPoint()
Adds a NeuRadPoint to the Point Collection.
virtual void Print(Option_t *option="") const
Screen log Prints NeuRadPoint information Virtual from TObject.
virtual void Initialize()
Initialisation class method FairDetector::Initialize() is called. NeuRadGeoPar init from RuntimeDB Vi...
Double32_t fTrackLength
track length from his origin
TLorentzVector fMomIn
point start momentum
Double32_t fTimeIn
point start time
virtual TClonesArray * GetCollection(Int_t iColl) const
Get array of ERNeuRadPoint.
virtual ~ERNeuRad()
Destructor.
Double32_t fELoss
energy loss
virtual void Reset()
Clears the point and steps collections Virtual from FairDetector.
Float_t fStep
Step length in sensetive volumes.
ERNeuRad()
Default constructor.
Int_t fStepNb
current step numb in this active volumes
Float_t fFullLY
Sum Light Yield in event in sensetive volume.
Class for the MC transport of the NeuRad.
TLorentzVector fPosIn
point start position
TArrayI fProcessesID
VMC prcess IDs in step.
TLorentzVector fCurMomIn
current step momentum
The data class for storing pieces of charged tracks in sensitive volumes in NeuRad.
TVector3 fPosInLocal
point position in sensetive volume CS
void StartNewPoint()
Start new point creation. Reinit current point data.
Int_t fModuleNb
number of module in NeuRad
TClonesArray * fNeuRadFirstStep
The first step collection.
Bool_t fStorePrimarySteps
Flag to storing firs step in sensetive volume.
Int_t fTrackID
track index
Int_t fEventID
event index
Double32_t fTimeOut
point finish time
The base class for detector simulation in er sim.
Int_t fVerbose
Verbosity level.
TLorentzVector fCurPosIn
current step position