FairRoot/PandaRoot
PndRich.cxx
Go to the documentation of this file.
1 #include "PndRich.h"
2 
3 #include "PndRichPDPoint.h"
4 #include "PndRichBarPoint.h"
5 #include "PndRichGeo.h"
6 #include "PndRichGeoPar.h"
7 
8 #include "FairVolume.h"
9 #include "FairGeoVolume.h"
10 #include "FairGeoNode.h"
11 #include "FairRootManager.h"
12 #include "FairGeoLoader.h"
13 #include "FairGeoInterface.h"
14 #include "FairRun.h"
15 #include "FairRuntimeDb.h"
16 #include "PndDetectorList.h"
17 #include "PndStack.h"
18 #include "TParticle.h"
19 
20 #include "TClonesArray.h"
21 #include "TVirtualMC.h"
22 #include "PndGeoHandling.h"
23 
24 #include "FairGeoRootBuilder.h"
25 #include "FairGeoMedia.h"
26 #include "FairGeoLoader.h"
27 #include "TGeoCompositeShape.h"
28 
29 #include "G4NistManager.hh"
30 
31 #include <iostream>
32 using std::cout;
33 using std::endl;
34 
36  : FairDetector("PndRich", kTRUE, kRICH),
37  fTrackID(-1),
38  fVolumeID(-1),
39  fPos(),
40  fMom(),
41  fTime(-1.),
42  fLength(-1.),
43  fELoss(-1),
44  fGeo(new PndRichGeo()),
45  fGeoH(NULL),
46  fUseProtection(kFALSE),
47  fRunCherenkov(kFALSE),
48  fPndRichPDPointCollection(new TClonesArray("PndRichPDPoint")),
49  fPndRichBarPointCollection(new TClonesArray("PndRichBarPoint"))
50 {
51  fListOfSensitives.push_back("Sensor");
52  if(fVerboseLevel > 0){
53  std::cout<<"-I- PndRich: fListOfSensitives contains:";
54  for(size_t k=0; k<fListOfSensitives.size(); k++)
55  std::cout<<"\n\t"<<fListOfSensitives[k];
56  std::cout<<std::endl;
57  }
58 
59  if ( fGeoH == NULL )
61  fGeoVersion = 313; //default geometry
62 }
63 
64 PndRich::PndRich(const char* name, Bool_t active)
65  : FairDetector(name, active, kRICH),
66  fTrackID(-1),
67  fVolumeID(-1),
68  fPos(),
69  fMom(),
70  fTime(-1.),
71  fLength(-1.),
72  fELoss(-1),
73  fGeo(new PndRichGeo()),
74  fGeoH(NULL),
75  fUseProtection(kFALSE),
76  fRunCherenkov(kFALSE),
77  fPndRichPDPointCollection(new TClonesArray("PndRichPDPoint")),
78  fPndRichBarPointCollection(new TClonesArray("PndRichBarPoint"))
79 {
80  fListOfSensitives.push_back("Sensor");
81  if(fVerboseLevel > 0){
82  std::cout<<"-I- PndRich: fListOfSensitives contains:";
83  for(size_t k=0; k<fListOfSensitives.size(); k++)
84  std::cout<<"\n\t"<<fListOfSensitives[k];
85  std::cout<<std::endl;
86  }
87 
88  if ( fGeoH == NULL )
90  fGeoVersion = 313; //default geometry
91  std::cout<<"-I- PndRich:"<<std::endl;
92 }
93 
95 {
97  fPndRichPDPointCollection->Delete();
99  }
101  fPndRichBarPointCollection->Delete();
103  }
104 }
105 
107 {
109  FairRun* fRun = FairRun::Instance();
110  FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb();
111  PndRichGeoPar* par=(PndRichGeoPar*)(rtdb->getContainer("PndRichGeoPar"));
112  par->setChanged();
113  par->setInputVersion(fRun->GetRunId(),1);
114 
115  if (0==gGeoManager)
116  cout << "We do not have gGeoManager" << endl;
117  else
118  cout << "there is gGeoManager" << endl;
119 
120  cout << "list of sensitives has " << fListOfSensitives.size() << " entries" << endl;
122  if(fVerboseLevel>0) fGeoH->PrintSensorNames();
123  trackid.clear();
124 
125  if (fRunCherenkov==kFALSE) cout << " -I- PndRich: Switching OFF Cherenkov Propagation" << endl;
126 
127  // define geometry version from name of geometry file
128  DefGeoVersion();
129 
130  // average refractive index of aerogel
132  std::vector<Double_t> nopt = fGeo->nOpt();
133  if (nopt.size()>0) {
134  fnOpt = 0;
135  for(size_t i=0;i<nopt.size();i++)
136  fnOpt += nopt.at(i);
137  fnOpt /= nopt.size();
138  std::cout << "Mid ref. index = " << fnOpt << std::endl;
139  }
140 
141  // aerogel bar entrance z coordinate
142  TVector3 richOffset = fGeo->richOffset();
143  TVector3 aerogelOffset = fGeo->aerogelOffset();
144  TVector3 aerogelSize = fGeo->aerogelSize();
145  fZabar = richOffset.Z() + aerogelOffset.Z();
146 
147  // pde_dpc3200_22.dat
148  std::string workdir(getenv( "VMCWORKDIR" ));
149  std::string effFileName(workdir+"/detectors/rich/pde_dpc3200_22.dat");
150  std::ifstream from( effFileName.c_str() );
151  Double_t wli, pdei;
152  from >> wli >> pdei;
153  while( !from.eof() ) {
154  fWlPhoton.push_back(wli); // nm
155  fPDE.push_back(pdei); // %
156  from >> wli >> pdei;
157  };
158 
159 }
160 
161 Bool_t PndRich::ProcessHits(FairVolume* vol)
162 {
164  TString nam =vol->GetName();
165  //Int_t num = vol->getMCid(); //[R.K. 01/2017] unused variable?
166 
167  //Set parameters at entrance of volume. Reset ELoss.
168  Int_t fEventID = gMC->CurrentEvent();
169  Int_t fPdgCode = gMC->TrackPid();
170  fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
171  fTime = gMC->TrackTime() * 1.0e09;
172  fLength = gMC->TrackLength();
173 
174 /* //Get current material
175  //if ( nam.BeginsWith("RichPhDetSi") ) {
176  if ( nam.BeginsWith("RichProtection") ) {
177  //if ( nam.BeginsWith("RichAerogel") ) {
178  Float_t a, z, dens, radl, absl;
179  Int_t mat = gMC->CurrentMaterial(a,z,dens,radl,absl);
180  cout<< nam << " " << mat << endl;
181  cout<<"a = " << a << " z = " << z << " dens = " << dens << " radl = " << radl << " absl = " << absl << endl;
182 
183  cout<< ">>>>>>>>>>>>>> " <<gGeoManager->GetVolume(vol->getVolumeId())->GetName() <<endl;
184 
185  TGeoMaterial *material = gGeoManager->GetVolume(vol->getVolumeId())->GetMaterial();
186  //TGeoMaterial *material = gGeoManager->GetMaterial(mat);
187  //TGeoMaterial *material = gGeoManager->GetMaterial("RichProtection");
188  //TGeoMaterial *material = gGeoManager->GetMaterial("silicon");
189  //TGeoMaterial *material = gGeoManager->GetMaterial("RichAerogel0");
190  cout<< material->GetName() << endl;
191  Int_t nels = material->GetNelements();
192  for(Int_t i=0; i<nels; i++){
193  TGeoElement *element = material->GetElement(i);
194  cout << element->GetName() << endl;
195  Int_t nis = element->GetNisotopes();
196  cout << "element->GetNisotopes() = " << nis << endl;
197  cout << "element->A() = " << element->A()
198  << " element->Z() = " << element->Z()
199  << " element->N() = " << element->N() << endl;
200  for(Int_t j=0; j<nis; j++){
201  TGeoIsotope *isotope = element->GetIsotope(j);
202  cout << "Isotope: " << j << " " << isotope->GetName()
203  << " a=" << isotope->GetA()
204  << " z=" << isotope->GetZ()
205  << " n=" << isotope->GetN() << endl;
206  }
207  }
208  }
209  if ( nam.BeginsWith("RichAerogel") || nam.BeginsWith("RichPhDetSi")) {
210  TGeoMaterial *material = gGeoManager->GetVolume(vol->getVolumeId()-1)->GetMaterial();
211  //cout << nam << " " << "material->GetName() = " << material->GetName() << endl;
212  if ( strncmp( material->GetName(), "RichAerogel", strlen("RichAerogel") ) == 0 ) {
213  TObject *cherprop = material->GetCerenkovProperties();
214  //cout << material->GetName() << " " << cherprop << endl;
215  //cout << "cherprop->GetName() = " << cherprop->GetName() << endl;
216  }
217 
218  //TList *listOfMedia = gGeoManager->GetListOfMedia();
219  //TListIter iter(listOfMedia);
220  //TGeoMedium* medium = NULL;
221 
222  //while( (medium = (TGeoMedium*)iter.Next()) ) {
223  // cout << "medium->GetName() = " << medium->GetName() << endl;
224  //}
225  }
226  //TGeoVolume *RichProtection = gGeoManager->GetVolume("RichProtectionSensor0");
227  //cout << "RichProtection = " << RichProtection
228  // << " RichProtection->IsActive() = " << RichProtection->IsActive()
229  // << " nam.BeginsWith() = " << nam.BeginsWith("RichProtection") << endl;
230 */
231  gMC->TrackPosition(fPos);
232  gMC->TrackMomentum(fMom);
233 
234  // Create PndRichPoint at exit of active volume
235  if ( fPdgCode == 50000050 ) {
236  // Efficiency of photodetector
237  Double_t eff = fGeo->phDetQEff(2*3.1415927*197.3269602e-9/fMom.Vect().Mag());
238  if (fRunCherenkov==kFALSE ) {
239  if (fVerboseLevel >0) cout<< "Photon killed" << endl;
240  gMC->StopTrack();
241  }
242  else if ( nam.BeginsWith("RichPhDetSi") && (gMC->IsTrackEntering()==1) && (gRandom->Uniform()<eff) ){
243  fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
244  fVolumeID = vol->getMCid();
245  AddPDPoint(fTrackID, fVolumeID, fPos.Vect(), fMom.Vect(),
246  fTime, fLength, fELoss, fEventID);
247 
248  // Increment number of PndRich det points in TParticle
249  PndStack* stack = (PndStack*) gMC->GetStack();
250  stack->AddPoint(kRICH);
251  gMC->StopTrack();
252  }
253  }
254 
255  if( (gMC->TrackCharge() != 0) && (fMom.Beta() > 1.00/fnOpt) &&
256  gMC->IsTrackEntering()==1 && (fPos.Z() < fZabar+0.001) &&
257  (nam.BeginsWith("RichAerogel")) && (trackid[fTrackID] != 1) ){
258 
259  trackid[fTrackID] = 1; // register new track
260 
261  fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
262  fVolumeID = vol->getMCid();
263  Double_t fMass = gMC->TrackMass();
264 
265  Double_t fThetaC = 1/fnOpt/fMom.Beta(); // Cerenkov angle
266  fThetaC = fMom.Beta(); // beta
267 
268  TParticle *particle = gMC->GetStack()->GetCurrentTrack();
269  TVector3 pos0 = TVector3(particle->Vx(),particle->Vy(),particle->Vz());
270  TVector3 mom0 = TVector3(particle->Px(),particle->Py(),particle->Pz());
271 
272  AddBarPoint(fTrackID, fVolumeID, fPos.Vect(), fMom.Vect(),
273  fTime, fLength, fPdgCode, fThetaC, fEventID, fMass,
274  pos0, mom0);
275 
276 // TParticle *particle = gMC->GetStack()->GetCurrentTrack();
277 // cout << "particle: " << particle->Vx() << " "
278 // << particle->Vy() << " " << particle->Vz() << " "
279 // << particle->T() << " "
280 // << particle->Theta() << " " << particle->Phi() << " "
281 // << particle->Px() << " " << particle->Py() << " "
282 // << particle->Pz() << " " << particle->P() <<
283 // endl;
284 
285  }
286 
287 
288  return kTRUE;
289 }
290 
292 {
293 // C->Delete();
294 // H->Delete();
295 // B->Delete();
296 // B10->Delete();
297 // B11->Delete();
298 // matRcihProt->Delete();
299 // med->Delete();
300 }
301 
303 {
304 /* TList *listOfMedia = gGeoManager->GetListOfMedia();
305  TListIter iter(listOfMedia);
306  TGeoMedium* medium = NULL;
307 
308  while( (medium = (TGeoMedium*)iter.Next()) ) {
309  cout << "medium->GetName() = " << medium->GetName() << endl;
310  }
311 
312  TList *listOfMaterials = gGeoManager->GetListOfMaterials();
313  TListIter iter1(listOfMaterials);
314  TGeoMaterial* material = NULL;
315 
316  while( (material = (TGeoMaterial*)iter1.Next()) ) {
317  TObject *obj = material->GetCerenkovProperties();
318  cout << "material->GetName() = " << material->GetName() <<
319  " " << material->GetDensity() <<
320  " " << material->GetFWExtension() << endl;
321  }
322 
323  TObjArray *listOfVolumes = gGeoManager->GetListOfVolumes();
324  TGeoVolume* volume = NULL;
325 
326  cout << "listOfVolumes->GetSize() = " << listOfVolumes->GetSize() << endl;
327  for(Int_t i=0; i<listOfVolumes->GetSize(); i++){
328  volume = (TGeoVolume*)listOfVolumes->At(i);
329  if (volume) {
330  medium = volume->GetMedium();
331  material = volume->GetMaterial();
332  cout << "volume->GetName() = " << volume->GetName() <<
333  " " << medium->GetName() << " " << material->GetName() <<endl;
334  }
335  }
336 
337  size_t nm = G4NistManager::Instance()->GetNumberOfElements();
338  cout << "GetNumberOfElements = " << nm << endl;
339 */
340 }
341 
343 {
344  fPndRichPDPointCollection->Clear();
346  trackid.clear();
347 }
348 
350 {
351  TString fileName = GetGeometryFileName();
352  if( fileName.EndsWith(".root") && (fGeoVersion==313) ){
353  char pat[] = "rich_v";
354  size_t ind = fileName.Index(pat)+strlen(pat);
355  sscanf(fileName(ind,5).Data(),"%d",&fGeoVersion);
356  std::cout << "GetGeometryFileName() = " << fileName << " " << fGeoVersion << std::endl;
357  }
358 }
359 
361 {
362 
369  if (fRunCherenkov==kTRUE)
370  FairRootManager::Instance()->Register("RichPDPoint", "PndRich",
372  FairRootManager::Instance()->Register("RichBarPoint", "PndRich",
374 
375 }
376 
377 
378 TClonesArray* PndRich::GetCollection(Int_t iColl) const
379 {
380  if (iColl == 0) return fPndRichPDPointCollection;
381  if (iColl == 1) return fPndRichBarPointCollection;
382  return NULL;
383 }
384 
386 {
387  fPndRichPDPointCollection->Clear();
389 }
390 
392 {
393  TString fileName = GetGeometryFileName();
394  if(fileName.EndsWith(".root")) {
395  ConstructRootGeometry();
396 
397 //-------------------------------------------------------------
398 /* if (fUseProtection) {
399 
400  Int_t n, z, ncomponents; //number of nucleon in a isotope
401  TString symbol;
402  Double_t abundance, a, density;
403 
404  C = new TGeoElement("Carbon", "C", z=6, n=12, a=12.0107);
405  H = new TGeoElement("Hydrogen", "H", z=1, n=1, a=1.00794);
406 
407  B10 = new TGeoIsotope("B10", z=5,n=10,a=10.0129370);
408  B11 = new TGeoIsotope("B11", z=5,n=11,a=11.0093054);
409 
410  B = new TGeoElement ("Boron",symbol="B",ncomponents=2);
411  B->AddIsotope(B10,19.8);
412  B->AddIsotope(B11,80.2);
413 
414  matRcihProt = (TGeoMaterial*) ( new TGeoMixture ("RichProtectionMaterial", 3, density=0.95) );
415  ((TGeoMixture*)matRcihProt)->AddElement(C,0.813467);
416  ((TGeoMixture*)matRcihProt)->AddElement(H,0.136533);
417  ((TGeoMixture*)matRcihProt)->AddElement(B,0.05);
418 
419  gGeoManager->AddMaterial(matRcihProt);
420 
421  med = new TGeoMedium("RichProtectionMedium",1000,matRcihProt);
422 
423  TGeoVolume *alRichBoxAir = gGeoManager->GetVolume("RichAlBoxAir");
424 
425  // Polyethilene protection
426  std::vector<Double_t> rpWidth;
427  rpWidth.push_back(5);
428  //rpWidth.push_back(1);
429  //rpWidth.push_back(1);
430  //rpWidth.push_back(1);
431  //rpWidth.push_back(1);
432  std::vector<Double_t> rpHoleWidth;
433  rpHoleWidth.push_back(10);
434  //rpHoleWidth.push_back(40);
435  //rpHoleWidth.push_back(30);
436  //rpHoleWidth.push_back(20);
437  //rpHoleWidth.push_back(10);
438  UInt_t numberOfLayers = rpWidth.size();
439  TString rpUnity = Form("( ");
440  std::vector<TGeoBBox*> lRichProtection(numberOfLayers);
441  std::vector<TGeoTranslation*> rpTrans(numberOfLayers);
442  std::vector<TGeoCompositeShape*> richProtectionCS(numberOfLayers);
443  std::vector<TGeoVolume*> richProtection(numberOfLayers);
444  std::vector<TGeoBBox*> lRichProtectionHole(numberOfLayers);
445 
446  DefGeoVersion();
447  fGeo->init(fGeoVersion);
448  TVector3 aerogelOffset = fGeo->aerogelOffset();
449  TVector3 alBoxSize = fGeo->alBoxSize();
450  TVector3 aerogelSize = fGeo->aerogelSize();
451  std::vector<Double_t> phDetY = fGeo->phDetY();
452 
453  Double_t zrp = aerogelOffset.Z()-alBoxSize.Z()/2+70;
454  for(UInt_t ia=0; ia<numberOfLayers; ia++) {
455  Double_t rpThickness = rpWidth[ia];
456  zrp += rpThickness/2;
457 
458  TString rpName = Form("rp%d",ia);
459  TString rpTransName = Form("rpTrans%d",ia);
460  TString rpMedia = Form("RichProtectionMaterial");
461  TString rpCSName = Form("RichProtectionCS%d",ia);
462  TString richProtectionName = Form("RichProtectionSensor%d",ia);
463  TString rpHoleName = Form("richProtectionHole%d",ia);
464 
465  lRichProtectionHole.at(ia) = new TGeoBBox(rpHoleName,
466  rpHoleWidth.at(ia),
467  rpHoleWidth.at(ia),
468  alBoxSize.Z()/2 );
469 
470  rpUnity = "( " + rpName + ":" + rpTransName + " ) - ( " + rpHoleName + " ) ";
471 
472  lRichProtection.at(ia) = new TGeoBBox(rpName,
473  aerogelSize.X()/2,
474  phDetY[1],
475  rpThickness/2 );
476  rpTrans.at(ia) = new TGeoTranslation(rpTransName,
477  aerogelOffset.X(),
478  aerogelOffset.Y(),
479  zrp);
480  rpTrans.at(ia)->RegisterYourself();
481  richProtectionCS.at(ia) = new TGeoCompositeShape(rpCSName,rpUnity);
482  richProtection.at(ia) = new TGeoVolume(richProtectionName,
483  richProtectionCS.at(ia),
484  med);
485  richProtection.at(ia)->SetLineColor(kCyan);
486  richProtection.at(ia)->SetTransparency(40);
487  alRichBoxAir->AddNode(richProtection.at(ia), 1, new TGeoCombiTrans( 0, 0, 0, new TGeoRotation(0) ) );
488  AddSensitiveVolume(richProtection.at(ia));
489 
490  zrp += rpThickness/2;
491  }
492  }
493 */
494 //-------------------------------------------------------------
495 
496  }
497  else {
502  FairGeoLoader* geoLoad = FairGeoLoader::Instance();
503  FairGeoInterface* geoFace = geoLoad->getGeoInterface();
504  PndRichGeo* Geo = new PndRichGeo();
505  Geo->setGeomFile(GetGeometryFileName());
506  geoFace->addGeoModule(Geo);
507 
508  Bool_t rc = geoFace->readSet(Geo);
509  if (rc) { Geo->create(geoLoad->getGeoBuilder()); }
510  TList* volList = Geo->getListOfVolumes();
511 
512  // store geo parameter
513  FairRun* fRun = FairRun::Instance();
514  FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb();
515  PndRichGeoPar* par=(PndRichGeoPar*)(rtdb->getContainer("PndRichGeoPar"));
516  TObjArray* fSensNodes = par->GetGeoSensitiveNodes();
517  TObjArray* fPassNodes = par->GetGeoPassiveNodes();
518 
519  TListIter iter(volList);
520  FairGeoNode* node = NULL;
521  FairGeoVolume* aVol=NULL;
522 
523  while( (node = (FairGeoNode*)iter.Next()) ) {
524  aVol = dynamic_cast<FairGeoVolume*> ( node );
525  if ( node->isSensitive() ) {
526  fSensNodes->AddLast( aVol );
527  } else {
528  fPassNodes->AddLast( aVol );
529  }
530  }
531  par->setChanged();
532  par->setInputVersion(fRun->GetRunId(),1);
533 
534  ProcessNodes ( volList );
535  }
536 }
537 
538 // https://www.slac.stanford.edu/grp/eg/minos/dist/dist_aux4/geant4_vmc/examples/E06/src/Ex06DetectorConstruction.cxx
539 // http://personalpages.to.infn.it/~puccio/htmldoc/src/AliHMPIDv2.cxx.html
541  cout<< " ==================================================== " << endl;
542  cout<< " ======= Rich:: ConstructOpticalGeometry() ======== " << endl;
543 
544  DefGeoVersion();
545  //PndRichGeo *fGeo = new PndRichGeo();
547 
548 
549  // Aerogel optical properties
550 
551  std::vector<Double_t> nOpt = fGeo->nOpt();
552  UInt_t nAerogelLayers = nOpt.size();
553  if (nOpt.size()>0) {
554  fnOpt = 0;
555  for(size_t i=0;i<nOpt.size();i++)
556  fnOpt += nOpt.at(i);
557  fnOpt /= nOpt.size();
558  }
559 
560  Int_t npoints = 10;
561 
562  Double_t ephotonMin = 1.240*1.0e-09; // 1000 nm - maximum of pde_dpc3200
563  Double_t ephotonMax = 4.428*1.0e-09; // 280 nm - minimum of pde_dpc3200
564  Double_t ephoton[npoints]; // Value of photon momentum (in GeV)
565 
566  Double_t absLen[npoints]; // absorption length in cm
567  Double_t qEff[npoints]; // Detection efficiency for UV photons
568  Double_t refInd[nAerogelLayers][npoints]; // Refraction index
569 
570  Double_t k = 2*3.1415927*197.3269602e-9; // coefficient energy to wavelength (hc)
571 
572  for(Int_t i=0; i<npoints; i++ ) {
573 
574  ephoton[i] = ephotonMin + i*(ephotonMax-ephotonMin)/(npoints-1);
575  Double_t wl = k/ephoton[i]; // wavelength in nm
576 
577  for(UInt_t l=0; l<nAerogelLayers; l++ )
578  refInd[l][i] = lhcbaerindex(nOpt[l],wl);
579 
580  absLen[i] = 4.5*std::pow(wl/400,4.0);
581  qEff[i] = 0.;
582  }
583 
584  cout << "fGeoVersion = " << fGeoVersion << endl;
585  cout << "nOpt.size() = " << nOpt.size() << endl;
586  for(size_t i=0;i<nOpt.size();i++) {
587 
588  //Int_t mId = gGeoManager->GetVolume( Form("RichAerogelSensor%d",i) )->GetMedium()->GetId();
589  Int_t mId = gMC->MediumId( Form("RichAerogel%d",(int)i) );
590 
591  gMC->SetCerenkov( mId, npoints, ephoton, absLen, qEff, refInd[i] );
592 
593  }
594 
595  // optical properties of air, photodetector window, mirror surface
596  Int_t npoints_i = 2;
597 
598  Double_t ephoton_i[npoints_i];
599  ephoton_i[0] = 1.240*1.0e-09; // 1 eV
600  ephoton_i[1] = 4.428*1.0e-09; // 10 eV
601 
602  Double_t reflectivity_i[npoints_i];
603  reflectivity_i[0] = 0.9;
604  reflectivity_i[1] = 0.9;
605 
606  Double_t abs_i[npoints_i];
607  abs_i[0] = 1000.;
608  abs_i[1] = 1000.;
609 
610  Double_t pdWindowRefInd[npoints_i];
611  pdWindowRefInd[0] = 1.46;
612  pdWindowRefInd[1] = 1.46;
613 
614  Double_t airRefInd[npoints_i];
615  airRefInd[0] = 1.0;
616  airRefInd[1] = 1.0;
617 
618  Double_t qEff_i[npoints_i];
619  qEff_i[0] = 0.;
620  qEff_i[1] = 0.;
621 
622  gMC->SetCerenkov( gMC->MediumId("RichAir"), npoints_i, ephoton_i, abs_i, qEff_i, airRefInd );
623  gMC->SetCerenkov( gMC->MediumId("RichPDWindow"), npoints_i, ephoton_i, abs_i, qEff_i, pdWindowRefInd );
624 
625  gMC->DefineOpSurface("RichMirrSurface", kGlisur, kDielectric_metal, kPolished, 0.0);
626  gMC->SetMaterialProperty("RichMirrSurface", "REFLECTIVITY", npoints_i, ephoton_i, reflectivity_i);
627  gMC->SetBorderSurface("BarRichMirrorSurface", "RichMirror", 1, "RichAlBoxAir", 1, "RichMirrSurface");
628  gMC->SetSkinSurface("RichAirMirrorSurface", "RichMirror", "RichMirrSurface");
629 
630 // gMC->SetBorderSurface("BarRichMirrorLeftSurface", "RichMirrorLeft", 1, "RichAlBoxAir", 1, "RichMirrSurface");
631 // gMC->SetSkinSurface("RichAirMirrorLeftSurface", "RichMirrorLeft", "RichMirrSurface");
632 // gMC->SetBorderSurface("BarRichMirrorRightSurface", "RichMirrorRight", 1, "RichAlBoxAir", 1, "RichMirrSurface");
633 // gMC->SetSkinSurface("RichAirMirrorRightSurface", "RichMirrorRight", "RichMirrSurface");
634 
635  cout<<" ======= RICH::ConstructOpGeometry -> Finished! ====== "<< endl;
636 
637 }
638 
639 /*Refractive index as function of wavelength
640  * for aerogel of the nominal ref. ind. at 400nm.
641  * Scaled from LHCb data:
642  * T. Bellunato et al., "Refractive index dispersion law of silica aerogel",
643  * Eur. Phys. J. C 52 (2007) 759-764
644  * */
646 {
647  const double LHCb_a0=0.05639, LHCb_wl0sqr = 83.22*83.22;
648  double LHCb_RI2m1ref = LHCb_a0/(1-LHCb_wl0sqr/(400*400)); //(n**2-1) of LHCb aerogel at 400nm
649  double ri2m1_lhcb = LHCb_a0/(1-LHCb_wl0sqr/(wl*wl)); //(n**2-1) of LHCb aerogel at wl
650  return sqrt( 1 + (n400*n400-1)/LHCb_RI2m1ref*ri2m1_lhcb );
651 }
652 
653 
654 // ----- Public method CheckIfSensitive --------------------------------------
655 bool PndRich::CheckIfSensitive(std::string name) {
656  for (size_t i = 0; i < fListOfSensitives.size(); i++){
657  if (name.find(fListOfSensitives[i]) != std::string::npos)
658  return true;
659  }
660  return false;
661 }
662 
663 
664 PndRichPDPoint* PndRich::AddPDPoint(Int_t trackID, Int_t detID,
665  TVector3 pos, TVector3 mom,
666  Double_t time, Double_t length,
667  Double_t eLoss, UInt_t EventId)
668 {
669  TClonesArray& clref = *fPndRichPDPointCollection;
670  Int_t size = clref.GetEntriesFast();
671  return new(clref[size]) PndRichPDPoint(trackID, detID, pos, mom,
672  time, length, eLoss, EventId);
673 }
674 
675 PndRichBarPoint* PndRich::AddBarPoint(Int_t trackID, Int_t detID,
676  TVector3 pos, TVector3 mom,
677  Double_t time, Double_t length,
678  Int_t pdgCode, Double_t thetaC,
679  Int_t eventID, Double_t mass,
680  TVector3 pos0, TVector3 mom0 )
681 {
682  TClonesArray& clref = *fPndRichBarPointCollection;
683  Int_t size = clref.GetEntriesFast();
684  return new(clref[size]) PndRichBarPoint(trackID, detID, pos, mom,
685  time, length, pdgCode,
686  thetaC, eventID, mass,
687  pos0, mom0);
688 }
689 
bool CheckIfSensitive(std::string name)
Definition: PndRich.cxx:655
TVector3 pos
Double_t phDetQEff(Double_t wl)
Definition: PndRichGeo.cxx:531
PndGeoHandling * fGeoH
Definition: PndRich.h:109
virtual void FinishRun()
Definition: PndRich.cxx:291
TLorentzVector fMom
position at entrance
Definition: PndRich.h:103
TVector3 aerogelOffset()
Definition: PndRichGeo.h:129
FairGeoLoader * geoLoad
Int_t i
Definition: run_full.C:25
PndGeoHandling * fGeoH
Definition: anasim.C:34
UInt_t fGeoVersion
Definition: PndRich.h:113
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
TVector3 aerogelSize()
Definition: PndRichGeo.h:126
Double_t fLength
time
Definition: PndRich.h:105
Double_t fTime
momentum at entrance
Definition: PndRich.h:104
void CreateUniqueSensorId(TString startName, std::vector< std::string > listOfSensitives)
Has to be called during simulation to create unique sensor id.
Double_t par[3]
PndRichPDPoint * AddPDPoint(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, UInt_t EventId=0)
Definition: PndRich.cxx:664
Double_t fnOpt
Definition: PndRich.h:130
TLorentzVector fPos
volume id
Definition: PndRich.h:102
virtual void Initialize()
Definition: PndRich.cxx:106
virtual TClonesArray * GetCollection(Int_t iColl) const
Definition: PndRich.cxx:378
Double_t mom
Definition: plot_dirc.C:14
TObjArray * GetGeoSensitiveNodes()
Definition: PndRichGeoPar.h:26
TClonesArray * fPndRichBarPointCollection
Definition: PndRich.h:118
TGeoManager * gGeoManager
std::map< Int_t, Int_t > trackid
Definition: PndRich.h:128
void AddPoint(DetectorId iDet)
Definition: PndStack.cxx:408
virtual void BeginEvent()
Definition: PndRich.cxx:302
const int particle
PndRich()
Definition: PndRich.cxx:35
FairRunAna * fRun
Definition: hit_dirc.C:58
std::vector< Double_t > fWlPhoton
Definition: PndRich.h:125
void ConstructOpGeometry()
Definition: PndRich.cxx:540
Bool_t fRunCherenkov
Definition: PndRich.h:112
void PrintSensorNames()
TObjArray * GetGeoPassiveNodes()
Definition: PndRichGeoPar.h:27
Double_t
Double_t fELoss
length
Definition: PndRich.h:106
std::vector< std::string > fListOfSensitives
Definition: PndRich.h:58
Double_t lhcbaerindex(Double_t n400, Double_t wl)
Definition: PndRich.cxx:645
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void init(size_t ver=0)
Definition: PndRichGeo.cxx:82
Double_t fZabar
Definition: PndRich.h:131
static PndGeoHandling * Instance()
TString name
void ConstructGeometry()
Definition: PndRich.cxx:391
virtual void Reset()
Definition: PndRich.cxx:385
virtual ~PndRich()
Definition: PndRich.cxx:94
PndRichBarPoint * AddBarPoint(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Int_t pdgCode, Double_t thetaC, Int_t eventID, Double_t mass, TVector3 pos0, TVector3 mom0)
Definition: PndRich.cxx:675
TClonesArray * fPndRichPDPointCollection
Definition: PndRich.h:117
virtual void EndOfEvent()
Definition: PndRich.cxx:342
TVector3 richOffset()
Definition: PndRichGeo.h:117
ClassImp(PndAnaContFact)
void DefGeoVersion()
Definition: PndRich.cxx:349
FairGeoInterface * geoFace
Int_t fVolumeID
track index
Definition: PndRich.h:101
Int_t fTrackID
Definition: PndRich.h:100
virtual void Register()
Definition: PndRich.cxx:360
std::vector< Double_t > nOpt()
Definition: PndRichGeo.h:132
TString nam
Definition: sim_hypGe.C:48
Mvd Initialize()
Double_t thetaC
Definition: plot_dirc.C:16
PndRichGeo * fGeo
energy loss
Definition: PndRich.h:108
virtual Bool_t ProcessHits(FairVolume *v=0)
Definition: PndRich.cxx:161
std::vector< Double_t > fPDE
Definition: PndRich.h:126