FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndEmcApd Class Reference

#include <PndEmcApd.h>

Inheritance diagram for PndEmcApd:

Public Member Functions

 PndEmcApd ()
 
 PndEmcApd (const char *name, Bool_t active)
 
virtual ~PndEmcApd ()
 
virtual void Initialize ()
 
virtual Bool_t ProcessHits (FairVolume *vol=0)
 
virtual void EndOfEvent ()
 
virtual void BeginEvent ()
 
virtual void Register ()
 
virtual TClonesArray * GetCollection (Int_t iColl) const
 
virtual void Print () const
 
virtual void Reset ()
 
virtual void CopyClones (TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
 
virtual void ConstructGeometry ()
 
void ConstructASCIIGeometry ()
 
PndEmcApdPointAddHit (Int_t trackID, Int_t detID, Int_t evtID, TVector3 pos, TVector3 mom, Double_t tof, Double_t length, Double_t eLoss, Short_t mod, Short_t row, Short_t crys, Short_t copy, Short_t flag)
 

Private Member Functions

void ResetParameters ()
 Hit collection. More...
 
 PndEmcApd (const PndEmcApd &L)
 
PndEmcApdoperator= (const PndEmcApd &)
 

Private Attributes

Int_t fTrackID
 
Int_t fVolumeID
 track index More...
 
Int_t fEventID
 volume id More...
 
TLorentzVector fPos
 event id More...
 
TLorentzVector fMom
 position More...
 
Double32_t fTime
 momentum More...
 
Double32_t fLength
 time More...
 
Double32_t fELoss
 length More...
 
Int_t fPosIndex
 energy loss More...
 
TClonesArray * fApdCollection
 

Detailed Description

Definition at line 20 of file PndEmcApd.h.

Constructor & Destructor Documentation

PndEmcApd::PndEmcApd ( )

Default constructor

Definition at line 47 of file PndEmcApd.cxx.

47  :
48  FairDetector(),
49  fTrackID(0),fVolumeID(0),fEventID(-1),fPos(0,0,0,0),fMom(0,0,0,0),fTime(0),fLength(0),fELoss(0),fPosIndex(0),fApdCollection(new TClonesArray("PndEmcApdPoint"))
50 {
51  //fApdCollection = new TClonesArray("PndEmcApdPoint");
52 }
Int_t fTrackID
Definition: PndEmcApd.h:115
Int_t fEventID
volume id
Definition: PndEmcApd.h:117
Double32_t fELoss
length
Definition: PndEmcApd.h:122
TLorentzVector fPos
event id
Definition: PndEmcApd.h:118
Int_t fPosIndex
energy loss
Definition: PndEmcApd.h:123
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
Int_t fVolumeID
track index
Definition: PndEmcApd.h:116
Double32_t fTime
momentum
Definition: PndEmcApd.h:120
TLorentzVector fMom
position
Definition: PndEmcApd.h:119
Double32_t fLength
time
Definition: PndEmcApd.h:121
PndEmcApd::PndEmcApd ( const char *  name,
Bool_t  active 
)

Standard constructor.

Parameters
namedetetcor name
activesensitivity flag

Definition at line 56 of file PndEmcApd.cxx.

56  :
57  FairDetector(name, active),
58  fTrackID(0),fVolumeID(0),fEventID(-1),fPos(0,0,0,0),fMom(0,0,0,0),fTime(0),fLength(0),fELoss(0),fPosIndex(0),fApdCollection(new TClonesArray("PndEmcApdPoint"))
59 {
60  //fApdCollection = new TClonesArray("PndEmcApdPoint");
61 }
Int_t fTrackID
Definition: PndEmcApd.h:115
Int_t fEventID
volume id
Definition: PndEmcApd.h:117
Double32_t fELoss
length
Definition: PndEmcApd.h:122
TLorentzVector fPos
event id
Definition: PndEmcApd.h:118
Int_t fPosIndex
energy loss
Definition: PndEmcApd.h:123
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
Int_t fVolumeID
track index
Definition: PndEmcApd.h:116
TString name
Double32_t fTime
momentum
Definition: PndEmcApd.h:120
TLorentzVector fMom
position
Definition: PndEmcApd.h:119
Double32_t fLength
time
Definition: PndEmcApd.h:121
PndEmcApd::~PndEmcApd ( )
virtual

Destructor

Definition at line 67 of file PndEmcApd.cxx.

References fApdCollection.

67  {
68  if (fApdCollection) {
69  fApdCollection->Delete();
70  delete fApdCollection;
71  }
72 
73 }
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
PndEmcApd::PndEmcApd ( const PndEmcApd L)
private

Member Function Documentation

PndEmcApdPoint * PndEmcApd::AddHit ( Int_t  trackID,
Int_t  detID,
Int_t  evtID,
TVector3  pos,
TVector3  mom,
Double_t  tof,
Double_t  length,
Double_t  eLoss,
Short_t  mod,
Short_t  row,
Short_t  crys,
Short_t  copy,
Short_t  flag 
)

Definition at line 299 of file PndEmcApd.cxx.

References fApdCollection.

Referenced by ProcessHits().

299  {
300  TClonesArray& clref = *fApdCollection;
301  Int_t size = clref.GetEntriesFast();
302  if (fVerboseLevel>1)
303  cout << "-I- PndEmcApd: Adding Point at IN (" << pos.X() << ", " << pos.Y()
304  << ", " << pos.Z() << ") cm, detector " << detID << ", evt " << evtID << ", track "
305  << trackID <<", energy loss " << eLoss*1e06 << " keV, module " << mod << " row " << row << " crystal " << crys << " copy " << copy << endl;
306 
307  return new(clref[size]) PndEmcApdPoint(trackID, detID, evtID, pos, mom, time, length, eLoss,
308  mod, row, crys, copy, flag);
309 }
int row
Definition: anaLmdDigi.C:67
TVector3 pos
Double_t mom
Definition: plot_dirc.C:14
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
void PndEmcApd::BeginEvent ( )
virtual

Definition at line 88 of file PndEmcApd.cxx.

88  {
89  // Begin of the event
90 
91 }
void PndEmcApd::ConstructASCIIGeometry ( )

Definition at line 225 of file PndEmcApd.cxx.

References Bool_t, geobuild, geoFace, geoLoad, PndEmcReader::GetData(), PndEmcReader::GetMaxCrystals(), PndEmcReader::GetMaxModules(), PndEmcReader::GetMaxRows(), PndEmcReader::GetMinCrystals(), PndEmcReader::GetMinModules(), PndEmcReader::GetMinRows(), gGeoManager, Media, DataG4::module, n, DataG4::pAlp1, DataG4::pAlp2, DataG4::pDx1, DataG4::pDx2, DataG4::pDx3, DataG4::pDx4, DataG4::pDy1, DataG4::pDy2, DataG4::pDz, DataG4::phi, DataG4::posX, DataG4::posY, DataG4::posZ, DataG4::pPhi, DataG4::pTheta, rot, rot1, row, DataG4::tau, DataG4::theta, and TString.

Referenced by ConstructGeometry().

225  {
226  // Definition of materials
227 
228  FairGeoLoader*geoLoad = FairGeoLoader::Instance();
229  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
230  FairGeoMedia *Media = geoFace->getMedia();
231  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
232 
233  FairGeoMedium *CbmMediumSi = Media->getMedium("silicon");
234  geobuild->createMedium(CbmMediumSi); //Int_t nmedSi = //[R.K.03/2017] unused variable
235 
236  TGeoVolume *flayer1 = new TGeoVolumeAssembly("ApdLayer1");
237  TGeoVolume *flayer2 = new TGeoVolumeAssembly("ApdLayer2");
238  TGeoVolume *flayer6 = new TGeoVolumeAssembly("ApdLayer6");
239 
240  Bool_t bIsModuleOn[6] = {kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,kFALSE};
241  //Bool_t isFirst = kTRUE; //[R.K. 01/2017] unused variable?
242 
243  PndEmcReader read(GetGeometryFileName() );
244  for(Int_t module=read.GetMinModules(); module<=read.GetMaxModules(); module++) {
245  cout << "Emc APD module = " << module;
246  cout << endl << "******** " << endl;
247 
248  for(Int_t row=read.GetMinRows(module); row<=read.GetMaxRows(module); row++){
249  for(Int_t crystal=read.GetMinCrystals(module,row); crystal<=read.GetMaxCrystals(module,row); crystal++) {
250 
251  Text_t buffer[30];
252  sprintf(buffer,"apd0%dr%dc%d",module, row, crystal);
253  DataG4 data = read.GetData(module,row,crystal);
254 
255  if (data.module==-1) continue; //if the pad is not present, do not create geometry
256 
257  // Construction of target spectrometer geometry
258  TGeoTrap *trap = new TGeoTrap(data.pDz/10., data.pTheta, data.pPhi,
259  data.pDy1/10., data.pDx1/10., data.pDx2/10., data.pAlp1,
260  data.pDy2/10., data.pDx3/10., data.pDx4/10., data.pAlp2);
261  TGeoVolume *volume;
262  volume = new TGeoVolume(buffer, trap, gGeoManager->GetMedium("silicon"));
263 
264  volume->SetLineColor(5);
265  TGeoRotation rot;
266  rot.RotateZ(data.tau);
267  rot.RotateY(data.theta);
268  rot.RotateZ(data.phi);
269 
270  if(module ==1) flayer1->AddNode(volume,0, new TGeoCombiTrans(data.posX/10., data.posY/10., data.posZ/10.+3.7, new TGeoRotation (rot))); // shift of 37 mm with respect to interaction point
271  if(module ==2) flayer2->AddNode(volume,0, new TGeoCombiTrans(data.posX/10., data.posY/10., data.posZ/10.+3.7, new TGeoRotation (rot))); // shift of 37 mm with respect to interaction point
272  if(module ==6) flayer6->AddNode(volume,0, new TGeoCombiTrans(data.posX/10., data.posY/10., data.posZ/10., new TGeoRotation (rot)));
273  bIsModuleOn[module-1] = kTRUE;
274  AddSensitiveVolume(volume);
275 
276  }
277  }
278  }
279 
280  TGeoVolume *flayer12 = new TGeoVolumeAssembly("EmcApd12");
281  if (bIsModuleOn[0]) flayer12->AddNode(flayer1,0, new TGeoCombiTrans(0., 0., 0., new TGeoRotation(0)));
282  if (bIsModuleOn[1]) flayer12->AddNode(flayer2,0, new TGeoCombiTrans(0., 0., 0., new TGeoRotation(0)));
283  TString vname = "cave";
284  vname = vname.Strip();
285  TGeoVolume* vcave = gGeoManager->FindVolumeFast(vname.Data());
286  if (bIsModuleOn[0] || bIsModuleOn[1]) vcave->AddNode(flayer12, 1);
287  if (bIsModuleOn[5]) vcave->AddNode(flayer6, 1);
288 
289  // 15 copies for barrel part of EMC
290  if (bIsModuleOn[0] || bIsModuleOn[1])
291  for (Int_t n=1;n<=15;n++){
292  TGeoRotation rot1;
293  rot1.RotateZ(22.5*n);
294  vcave->AddNode(flayer12, n+1,new TGeoCombiTrans(0., 0., 0., new TGeoRotation (rot1)) );
295  }
296 }
int row
Definition: anaLmdDigi.C:67
double pDx3
Definition: PndEmcReader.h:22
double tau
Definition: PndEmcReader.h:20
FairGeoLoader * geoLoad
FairGeoMedia * Media
double pAlp2
Definition: PndEmcReader.h:22
int n
double pDz
Definition: PndEmcReader.h:22
double pDx2
Definition: PndEmcReader.h:22
TGeoManager * gGeoManager
double phi
Definition: PndEmcReader.h:20
TGeoRotation * rot1
int module
Definition: PndEmcReader.h:19
FairGeoBuilder * geobuild
double pPhi
Definition: PndEmcReader.h:22
double pDx4
Definition: PndEmcReader.h:22
double pDx1
Definition: PndEmcReader.h:22
double posX
Definition: PndEmcReader.h:21
double posZ
Definition: PndEmcReader.h:21
double pDy2
Definition: PndEmcReader.h:22
double pTheta
Definition: PndEmcReader.h:22
double pDy1
Definition: PndEmcReader.h:22
TGeoRotation rot
double posY
Definition: PndEmcReader.h:21
FairGeoInterface * geoFace
double theta
Definition: PndEmcReader.h:20
double pAlp1
Definition: PndEmcReader.h:22
void PndEmcApd::ConstructGeometry ( )
virtual

Virtual method Construct geometry

Definition at line 210 of file PndEmcApd.cxx.

References ConstructASCIIGeometry(), and TString.

210  {
211  TString fileName=GetGeometryFileName();
212 
213  if (fileName.EndsWith(".dat")) {
214  std::cout<< " " <<std::endl;
215  std::cout<< " ====== EMCAPD::ConstructASCIIGeometry()====== " <<std::endl;
216  std::cout<< " ============================================= " <<std::endl;
218  }
219  else
220  {
221  std::cout<< "Geometry format not supported " <<std::endl;
222  }
223 }
void ConstructASCIIGeometry()
Definition: PndEmcApd.cxx:225
void PndEmcApd::CopyClones ( TClonesArray *  cl1,
TClonesArray *  cl2,
Int_t  offset 
)
virtual

Virtual method CopyClones

Copies the hit collection with a given track index offset

Parameters
cl1Origin
cl2Target
offsetIndex offset

Definition at line 189 of file PndEmcApd.cxx.

References fPosIndex, i, and offset().

189  {
190  Int_t nEntries = cl1->GetEntriesFast();
191  //cout << "-I- PndEmcApd: " << nEntries << " entries to add." << endl;
192  TClonesArray& clref = *cl2;
193  PndEmcApdPoint* oldpoint = NULL;
194  for (Int_t i=0; i<nEntries; i++) {
195  oldpoint = (PndEmcApdPoint*) cl1->At(i);
196  Int_t index = oldpoint->GetTrackID() + offset;
197  oldpoint->SetTrackID(index);
198  new (clref[fPosIndex]) PndEmcApdPoint(*oldpoint);
199  fPosIndex++;
200  }
201  // cout << " -I- PndEmcApd: " << cl2->GetEntriesFast() << " merged entries."
202  // << endl;
203 }
Int_t i
Definition: run_full.C:25
Int_t fPosIndex
energy loss
Definition: PndEmcApd.h:123
TVector3 offset(2, 0, 0)
void PndEmcApd::EndOfEvent ( )
virtual

Virtual method EndOfEvent

If verbosity level is set, print hit collection at the end of the event and resets it afterwards.

Definition at line 145 of file PndEmcApd.cxx.

References Print(), and Reset().

145  {
146  if (fVerboseLevel) Print();
147  Reset();
148 }
virtual void Reset()
Definition: PndEmcApd.cxx:179
virtual void Print() const
Definition: PndEmcApd.cxx:166
TClonesArray * PndEmcApd::GetCollection ( Int_t  iColl) const
virtual

Accessor to the hit collection

Definition at line 158 of file PndEmcApd.cxx.

References fApdCollection.

158  {
159  if (iColl == 0) return fApdCollection;
160 
161  return NULL;
162 }
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
void PndEmcApd::Initialize ( )
virtual

Virtual method Initialize Initialises detector.

Definition at line 79 of file PndEmcApd.cxx.

References Initialize().

79  {
80  // Init function
81 
83  //FairRun* sim = FairRun::Instance(); //[R.K. 01/2017] unused variable?
84  //FairRuntimeDb* rtdb=sim->GetRuntimeDb(); //[R.K. 01/2017] unused variable?
85 
86 }
Mvd Initialize()
PndEmcApd& PndEmcApd::operator= ( const PndEmcApd )
inlineprivate

Definition at line 131 of file PndEmcApd.h.

131 {return *this;}
void PndEmcApd::Print ( ) const
virtual

Virtual method Print

Screen output of hit collection.

Definition at line 166 of file PndEmcApd.cxx.

References fApdCollection, i, and nHits.

Referenced by EndOfEvent().

166  {
167  Int_t nHits = fApdCollection->GetEntriesFast();
168  //cout << "-I- PndEmcApd: " << nHits << " points registered in this event."
169  //<< endl;
170 
171  if (fVerboseLevel>1)
172  for (Int_t i=0; i<nHits; i++) (*fApdCollection)[i]->Print();
173 }
Int_t i
Definition: run_full.C:25
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
int nHits
Definition: RiemannTest.C:16
Bool_t PndEmcApd::ProcessHits ( FairVolume *  vol = 0)
virtual

Virtual method ProcessHits

Defines the action to be taken when a step is inside the active volume. Creates PndEmcApdPoints and adds them to the collections.

Parameters
volPointer to the active volume

Definition at line 96 of file PndEmcApd.cxx.

References AddHit(), fELoss, fEventID, fLength, fMom, fPos, fTime, fTrackID, fVolumeID, nam, pos, ResetParameters(), and TString.

96  { // vol //[R.K.03/2017] unused variable(s)
97 
98  TString nam = gMC->CurrentVolName();
99 
100  // ---------------------------------------------------------------------------------
101  // Getting parameters for the ROOT file with geometry for Forward Enc-Cap.
102  // Each of the subvolume name for FwEndCap geometry in the ROOT file contains "Vol".
103  //Int_t copyNoCrys=-1,copyNoBox=-1,copyNoSub=-1,copyNoQuar=-1; //[R.K. 01/2017] unused variable?
104  //Int_t idCrys=-1,idBox=-1,idSub=-1,idQuar=-1; //[R.K. 01/2017] unused variable?
105  Int_t copyNo = -1; //, id = -1; //[R.K.03/2017] unused variable
106  Int_t nMod = -1, nRow = -1, nCrys = -1;
107  Short_t nFlag=0
108  ;
109  if ( gMC->IsTrackEntering() ) {
110  nFlag = -1;
111  }
112  if ( gMC->IsTrackExiting() ||
113  gMC->IsTrackStop() ||
114  gMC->IsTrackDisappeared() ) {
115  nFlag = 1;
116  }
117 
118  fTrackID = gMC->GetStack()->GetCurrentTrackNumber(); // trk ID
119  fEventID = gMC->CurrentEvent();
120  fELoss = gMC->Edep();
121  fLength = gMC->TrackLength();
122  fTime = gMC->TrackTime();
123  gMC->TrackPosition(fPos); // cm
124  gMC->TrackMomentum(fMom); // GeV
125 
126  sscanf(nam,"apd%dr%dc%d", &nMod, &nRow, &nCrys);
127  gMC->CurrentVolOffID(2,copyNo); //id = //[R.K.03/2017] unused variable
128 
129  fVolumeID = nMod*100000000 + nRow*1000000 + copyNo*10000 + nCrys;
130 
131  TVector3 pos(fPos.X(), fPos.Y(), fPos.Z());
132 
134  TVector3(fPos.X(), fPos.Y(), fPos.Z()),
135  TVector3(fMom.Px(), fMom.Py(), fMom.Pz()),
136  fTime, fLength, fELoss, nMod, nRow, nCrys, copyNo, nFlag);
137 
138  ResetParameters();
139 
140  return kTRUE;
141 }
TVector3 pos
Int_t fTrackID
Definition: PndEmcApd.h:115
Int_t fEventID
volume id
Definition: PndEmcApd.h:117
Double32_t fELoss
length
Definition: PndEmcApd.h:122
TLorentzVector fPos
event id
Definition: PndEmcApd.h:118
Int_t fVolumeID
track index
Definition: PndEmcApd.h:116
PndEmcApdPoint * AddHit(Int_t trackID, Int_t detID, Int_t evtID, TVector3 pos, TVector3 mom, Double_t tof, Double_t length, Double_t eLoss, Short_t mod, Short_t row, Short_t crys, Short_t copy, Short_t flag)
Definition: PndEmcApd.cxx:299
Double32_t fTime
momentum
Definition: PndEmcApd.h:120
void ResetParameters()
Hit collection.
Definition: PndEmcApd.cxx:311
TString nam
Definition: sim_hypGe.C:48
TLorentzVector fMom
position
Definition: PndEmcApd.h:119
Double32_t fLength
time
Definition: PndEmcApd.h:121
void PndEmcApd::Register ( )
virtual

Virtual method Register

Registers the hit collection in the ROOT manager.

Definition at line 152 of file PndEmcApd.cxx.

References fApdCollection.

152  {
153  FairRootManager::Instance()->Register("EmcApdPoint","Emc", fApdCollection, kTRUE);
154 }
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
void PndEmcApd::Reset ( )
virtual

Virtual method Reset

Clears the hit collection

Definition at line 179 of file PndEmcApd.cxx.

References fApdCollection, and fPosIndex.

Referenced by EndOfEvent().

179  {
180  fApdCollection->Clear();
181 
182  fPosIndex = 0;
183 }
Int_t fPosIndex
energy loss
Definition: PndEmcApd.h:123
TClonesArray * fApdCollection
Definition: PndEmcApd.h:125
void PndEmcApd::ResetParameters ( )
inlineprivate

Hit collection.

Definition at line 311 of file PndEmcApd.cxx.

References fELoss, fEventID, fLength, fMom, fPos, fTime, fTrackID, and fVolumeID.

Referenced by ProcessHits().

311  {
312  fTrackID = -999;
313  fVolumeID = -999;
314  fEventID = -999;
315  fPos.SetXYZT(0., 0., 0., 0.);
316  fMom.SetXYZT(0., 0., 0., 0.) ;
317  fTime = -999;
318  fLength = -999;
319  fELoss = -999;
320 }
Int_t fTrackID
Definition: PndEmcApd.h:115
Int_t fEventID
volume id
Definition: PndEmcApd.h:117
Double32_t fELoss
length
Definition: PndEmcApd.h:122
TLorentzVector fPos
event id
Definition: PndEmcApd.h:118
Int_t fVolumeID
track index
Definition: PndEmcApd.h:116
Double32_t fTime
momentum
Definition: PndEmcApd.h:120
TLorentzVector fMom
position
Definition: PndEmcApd.h:119
Double32_t fLength
time
Definition: PndEmcApd.h:121

Member Data Documentation

TClonesArray* PndEmcApd::fApdCollection
private

Definition at line 125 of file PndEmcApd.h.

Referenced by AddHit(), GetCollection(), Print(), Register(), Reset(), and ~PndEmcApd().

Double32_t PndEmcApd::fELoss
private

length

Definition at line 122 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndEmcApd::fEventID
private

volume id

Definition at line 117 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

Double32_t PndEmcApd::fLength
private

time

Definition at line 121 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

TLorentzVector PndEmcApd::fMom
private

position

Definition at line 119 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

TLorentzVector PndEmcApd::fPos
private

event id

Definition at line 118 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndEmcApd::fPosIndex
private

energy loss

Definition at line 123 of file PndEmcApd.h.

Referenced by CopyClones(), and Reset().

Double32_t PndEmcApd::fTime
private

momentum

Definition at line 120 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndEmcApd::fTrackID
private

Definition at line 115 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndEmcApd::fVolumeID
private

track index

Definition at line 116 of file PndEmcApd.h.

Referenced by ProcessHits(), and ResetParameters().


The documentation for this class was generated from the following files: