// ------------------------------------------------------------------------- // ----- PndDrc source file ----- // ----- Created 11/10/06 by Annalisa Cecchi ----- // ----- Modified 2006++ by Carsten Schwarz ----- // ----- Modified 2010++ by Maria Patsyuk ----- // ----- ----- // ------------------------------------------------------------------------- #include "PndGeoDrc.h" #include "PndDrcPDPoint.h" #include "PndDrcBarPoint.h" #include "PndGeoDrcPar.h" #include "PndDetectorList.h" #include "PndDrc.h" #include "TString.h" //#include using std::endl; using std::cout; #include "TClonesArray.h" #include "TVirtualMC.h" #include "TObjArray.h" #include "TGeoMCGeometry.h" #include "TGeoManager.h" #include "TLorentzVector.h" #include "TParticle.h" #include "TVirtualMC.h" #include "TGeoPgon.h" #include "TGeoSphere.h" #include "TGeoBBox.h" #include "TGeoArb8.h" #include "TGeoTrd2.h" #include "TGeoCompositeShape.h" #include "TGeoMatrix.h" #include "TGeoManager.h" #include "TObject.h" #include "TColor.h" #include "FairGeoInterface.h" #include "FairGeoLoader.h" #include "FairGeoNode.h" #include "FairRootManager.h" #include "FairVolume.h" #include "FairGeoMedia.h" #include "FairGeoMedium.h" #include "FairGeoRootBuilder.h" #include "PndStack.h" #include "PndDetectorList.h" // add on for debug //#include "FairGeoG3Builder.h" #include "FairRun.h" //#include "FairRunSim.h" #include "FairRuntimeDb.h" #include // ----- Default constructor ------------------------------------------- PndDrc::PndDrc() { fDrcPDCollection = new TClonesArray("PndDrcPDPoint"); fDrcBarCollection = new TClonesArray("PndDrcBarPoint"); fPosIndex = 0; volDetector = 0; fRunCherenkov = kTRUE; fGeo = new PndGeoDrc(); fStopTime = kFALSE; fTakeDirect = kFALSE; fDetEffAtProduction = kFALSE; fprizm = kFALSE; fListOfSensitives.push_back("Sensor"); if(fVerboseLevel > 0){ std::cout<<"-I- PndBarrelDIRC: fListOfSensitives contains:"; for(Int_t k=0; k 0){ std::cout<<"-I- PndBarrelDIRC: fListOfSensitives contains:"; for(Int_t k=0; kDelete(); delete fDrcPDCollection; } if (fDrcBarCollection) { fDrcBarCollection->Delete(); delete fDrcBarCollection; } if (fGeo) delete fGeo; } // ------------------------------------------------------------------------- // ----- Public method Intialize --------------------------------------- void PndDrc::Initialize() { cout << " -I- PndDrc: Intialization started... " << endl; FairDetector::Initialize(); //FairRun *sim = FairRun::Instance(); //FairRuntimeDb *rtdb = sim->GetRuntimeDb(); //PndGeoDrcPar *par = (PndGeoDrcPar*)(rtdb->getContainer("PndGeoDrcPar")); if (fRunCherenkov==kFALSE) cout << " -I- PndDrc: Switching OFF Cherenkov Propagation" << endl; // print out for debugging all names and pointers stored in manager // manager->Print(); // bar ID number: TGeoVolume *v2 = gGeoManager->GetVolume("DrcAirBox"); TGeoNode *n2 = v2->FindNode("DrcBarSensor_1"); //v2->PrintNodes(); fbarID = n2->GetVolume()->GetNumber(); cout<<"bar id = "<GetVolume()->GetNumber()<<", node id = "<GetNumber()<FindNode("DrcLENS3Sensor_1"); flensID = n5->GetVolume()->GetNumber(); //cout<<"lens1 = "<FindNode("DrcLENS1_1")->GetVolume()->GetNumber()<< // ", lens2 = "<FindNode("DrcLENS2_1")->GetVolume()->GetNumber()<< // ", lens3 = "<FindNode("DrcLENS3Sensor_1")->GetVolume()->GetNumber()<PrintNodes(); TGeoNode *n3 = v3->FindNode("DrcPDSensor_1"); fpdID = n3->GetVolume()->GetNumber(); //cout<<"pd id = "<GetVolume()->GetNumber(); //cout<<"bbox id = "<GetVolume()->GetNumber()<<", node id = "<GetNumber()<0) cout<<" \n\n>>>>>>>>>>>>>>>>>>>>new event in the Barrel DIRC" <GetName(); Int_t num = vol->getMCid(); //Register points in the barrel (PndDrcBarPoints) fEventID = gMC->CurrentEvent(); fPdgCode = gMC->TrackPid(); //TLorentzVector fPos, fMom; gMC->TrackPosition(fPos); if (fPdgCode == 50000050){ if (fRunCherenkov==kFALSE ) { gMC->StopTrack(); if (fVerboseLevel >0) cout<< "Photon killed" << endl; } // apply detector efficiency at the production stage: if(fDetEffAtProduction && fLastTrackID != gMC->GetStack()->GetCurrentTrackNumber()){ gMC->TrackMomentum(fMom1); Double_t Px= fMom1.Px(); Double_t Py= fMom1.Py(); Double_t Pz= fMom1.Pz(); Double_t fP = sqrt(Px*Px + Py*Py +Pz*Pz); Double_t lambda=197.0*2.0*TMath::Pi()/(fP*1.0E9); Double_t ra = frand.Uniform(0., 1.); if(ra > fDetEff->Eval(lambda)){ gMC->StopTrack(); } } /* // check whether function 'ConstructOpGeometry' works: if(gMC->IsTrackExiting()==1){ //if(nam.BeginsWith("DrcBar")){ if(num == fbarID){ if(fPos.Z() > -110. && fPos.Z() < -109. && aaa < 11){ cout<<"track is exiting the bar at z = "<IsTrackExiting()==1 ){ if(nam.BeginsWith(fAtBarEnd)){ //if(num == flensID && fPos.Z() < fSlabEnd + 0.001){ //if(fPos.Z() < fSlabEnd + 0.0001){ //std::cout<<"!!! Track is exiting volume "<StopTrack(); } } } } // kill photons older than fPhoMaxTime: if (fStopTime == kTRUE && gMC->TrackTime()*1.0e09 > fPhoMaxTime){ gMC->StopTrack(); } if (gMC->IsTrackEntering()==1){ if( num == fpdID){ //if (nam.BeginsWith("DrcPD")){ fCopyNo = vol->getCopyNo(); fTrackID = gMC->GetStack()->GetCurrentTrackNumber(); //track ID gMC->TrackPosition(fPos); gMC->TrackMomentum(fMom); // GeV/c fTime=gMC->TrackTime()*1.0e09; // ns AddHit(fTrackID, fCopyNo, TVector3(fPos.X(), fPos.Y(), fPos.Z()), TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength, fPdgCode, fEventID); } PndStack* stack = (PndStack*) gMC->GetStack(); stack->AddPoint(kDRC); } }else if(gMC->TrackCharge()!=0. && gMC->IsTrackEntering()==1 ){ //if (nam.BeginsWith("DrcBar")) { if(num == fbarID){ // Double_t fCharge = gMC->TrackCharge(); fTrackID = gMC->GetStack()->GetCurrentTrackNumber(); fTime = gMC->TrackTime() * 1.0e09; fLength = gMC->TrackLength(); // Int_t copyNo = vol->getCopyNo(); Int_t s=0, b=0; //side and bar fNBar=0; TString path = gMC->CurrentVolPath(); //cout<<"+++++++++++++++++++++++++++++++++"<CurrentVolPath() << endl; //cout<<"+++++++++++++++++++++++++++++++++"<0) cout<< "Volume: " << gMC->CurrentVolPath() << endl; sscanf(path, "/cave_1/BarrelDIRC_0/DrcBarBox_%d/DrcAirBox_0/DrcBarSensor_%d", &s, &b); //cout<<"side no.= "<Register("DrcPDPoint","Drc", fDrcPDCollection, kTRUE); } // ---------------------------------------------------------------------------- // ----- Public method GetCollection -------------------------------------- TClonesArray* PndDrc::GetCollection(Int_t iColl) const { if (iColl == 0) return fDrcPDCollection; if (iColl == 1) return fDrcBarCollection; return NULL; } // ---------------------------------------------------------------------------- // ----- Public method Print ---------------------------------------------- void PndDrc::Print() const { Int_t nPDHits = fDrcPDCollection->GetEntriesFast(); Int_t nbarHits = fDrcBarCollection->GetEntriesFast(); cout << "-I- PndDrc: " << nPDHits << " points registered in the photodetector for this event." << endl; cout << "-I- PndDrc: " << nbarHits << " points registered in the bar for this event." << endl; if (fVerboseLevel>1){ for (Int_t i=0; iPrint(); for (Int_t i=0; iPrint(); } } // ---------------------------------------------------------------------------- // ----- Public method Reset ---------------------------------------------- void PndDrc::Reset() { fDrcPDCollection->Delete(); fDrcBarCollection->Delete(); fPosIndex = 0; } // ---------------------------------------------------------------------------- // guarda in FairRootManager::CopyClones // ----- Public method CopyClones ----------------------------------------- void PndDrc::CopyClones(TClonesArray* clPD1, TClonesArray* clPD2,TClonesArray* clBar1, TClonesArray* clBar2, Int_t offset ) { Int_t nPDEntries = clPD1->GetEntriesFast(); cout << "-I- PndDrc: " << nPDEntries << " entries to add." << endl; TClonesArray& clrefPD = *clPD2; Int_t nBarEntries = clBar1->GetEntriesFast(); cout << "-I- PndDrc: " << nBarEntries << " entries to add." << endl; TClonesArray& clrefBar = *clBar2; PndDrcPDPoint* oldpointPD = NULL; PndDrcBarPoint* oldpointBar = NULL; for (Int_t i=0; iAt(i); Int_t indexPD = oldpointPD->GetTrackID() + offset; oldpointPD->SetTrackID(indexPD); new (clrefPD[fPosIndex]) PndDrcPDPoint(*oldpointPD); fPosIndex++; } for (Int_t i=0; iAt(i); Int_t indexBar = oldpointBar->GetTrackID() + offset; oldpointBar->SetTrackID(indexBar); new (clrefBar[fPosIndex]) PndDrcBarPoint(*oldpointBar); fPosIndex++; } cout << " -I- PndDrc: " << clPD2->GetEntriesFast() << " merged entries." << endl; cout << " -I- PndDrc: " << clBar2->GetEntriesFast() << " merged entries." << endl; } // ---------------------------------------------------------------------------- // ----- Public method ConstructGeometry ----------------------------------- void PndDrc::ConstructGeometry() { cout<< " " << endl; cout<< " ======= DRC:: ConstructGeometry() ======== " << endl; cout<< " ============================================= " << endl; /* TString fileName = GetGeometryFileName(); if(fileName.EndsWith(".root")){ ConstructRootGeometry(); } else{ std::cout<<"Geometry format not supported!"<getGeoInterface(); FairGeoMedia *Media = drcgeoFace->getMedia(); FairGeoBuilder *geobuild = drcgeoLoad->getGeoBuilder(); // Call materials FairGeoMedium *fusedSil = Media->getMedium("FusedSil"); Int_t nFusedSil = geobuild->createMedium(fusedSil); FairGeoMedium *nlak33a = Media->getMedium("NLAK33A"); Int_t nNlak33a = geobuild->createMedium(nlak33a); FairGeoMedium *air = Media->getMedium("DIRCair"); Int_t nAir = geobuild->createMedium(air); FairGeoMedium *airNoSens = Media->getMedium("DIRCairNoSens"); Int_t nAirNoSens = geobuild->createMedium(airNoSens); FairGeoMedium *mirror = Media->getMedium("Mirror"); Int_t nMirror = geobuild->createMedium(mirror); FairGeoMedium *marcol82 = Media->getMedium("Marcol82"); Int_t nMarcol82 = geobuild->createMedium(marcol82); FairGeoMedium *carbonfiber = Media->getMedium("DIRCcarbonFiber"); Int_t nCarbonFiber = geobuild->createMedium(carbonfiber); TGeoVolume *cave = gGeoManager->GetTopVolume(); // Rotations: TGeoRotation rot1; rot1.RotateZ(90.); // units = cm Double_t eps = 0.01; // epsilon Double_t mirr_hthick = 0.01; Double_t bbnum = fGeo->BBoxNum(); //16.; // total number of sides = barboxes Double_t bbGap = fGeo->BBoxGap(); //1.5; // gap btw the neighboring barboxes (at the middle height) Double_t pipehAngle = fGeo->PipehAngle(); //3.6; // [degrees] half of the angular space needed for the target pipe Double_t radius = fGeo->radius(); // radius in middle of the barbox (x and y) Double_t hthick = fGeo->barHalfThick(); // half thickness of the bars Double_t bbox_zdown = fGeo->barBoxZDown(); // bar box z downstream Double_t bbox_zup = fGeo->barBoxZUp(); // bar box z upstream Double_t bbox_hlen = 0.5*(bbox_zdown - bbox_zup); // bar box half length Double_t bbox_shift = bbox_zup + bbox_hlen; // bar box shift Double_t bargap = fGeo->barGap(); // half gap between bars Double_t barnum = fGeo->barNum(); // number of bars per barbox Double_t boxgap = fGeo->boxGap(); // gap between bars and the bar box Double_t boxthick = fGeo->boxThick(); // thickness of the bar box Double_t len = 0.; // length of the lenses block. see further // Expansion Volume: Double_t EVlen = fGeo->EVlen(); // 30. in current version Double_t EVdrop = fGeo->EVdrop();//0.5; // [cm] drop of the EV - inner radius Double_t EVoffset = fGeo->EVoffset();//1.; // [cm] offset of the EV - outer radius Double_t EVangle = fGeo->EVangle();//60.; Double_t EVshift = -bbox_hlen + bbox_shift - EVlen; Double_t EVRout = radius + hthick + EVlen*tan(EVangle/180.*pi)/cos(pi/bbnum/2.); Double_t bbAngle = ( 180. - 2.*pipehAngle - bbGap/radius/pi*180.*(bbnum/2.-1.) )/(bbnum/2.); Double_t bbX = radius*bbAngle/180.*pi; Double_t phi0 = (180.-2.*pipehAngle)/bbnum + pipehAngle; Double_t dphi = (180.-2.*pipehAngle)/bbnum*2.; // prizm: Double_t phlength = fGeo->PrismhLength();//4.5; // half length of the prizm Double_t pangle = fGeo->PrismAngle();//30.; Double_t pdrop = fGeo->PrismDrop();//0.5; // drop of the prizm - inner side Double_t poffset = fGeo->PrismOffset();//1.; // prizm offset - outer side Double_t pheight = 2.*phlength * tan(pangle/180.*pi); // outer radius of the EV in case of the prism: Double_t EVRprizm = radius + hthick + poffset + pheight + EVoffset + (EVlen-2.*phlength)*tan(EVangle/180.*pi); //---------------------------------------------------------- // F O C U S S I N G O P T I O N S: TGeoVolume *block1, *block2; TGeoVolume *lens1, *lens2, *lens3; // 0. NO FOCUSING: if(fFocusingSystem == 0){ cout<<"NO FOCUSING!!!"< bbX Double_t a = r - r*TMath::Cos(alpha); Double_t b = a + 0.5; // box dimension .6 instead of .5 due to strong curvature //cout<<" DIRC a,b = "< bbX Double_t a3 = r3 - r3*TMath::Cos(alpha3); Double_t b3 = a3 + 0.0; // box dimension .6 instead of .5 due to strong curvature // lens1 (b) + lens2 (0.6) + lens3 (b3) + gap (0.5) len = b + 0.2 + b3 + 0.5;//+ a2; // dimension of the box containing both lenses //cout<<"DIRC len= "<bbX TGeoTranslation *tr1 = new TGeoTranslation("tr1", 0.,0., t); tr1->RegisterYourself(); TGeoCompositeShape *cs = new TGeoCompositeShape("cs","S*(B:tr1)"); lens1 = new TGeoVolume("DrcLENS1",cs, gGeoManager->GetMedium("FusedSil")); lens1->SetLineColor(kRed-8); lens1->SetTransparency(40); // position lens within already shifted bar container at -(bbox_hlen-eps)+len, the lens base is -r + b // with -0.01 one can make a gap visible (.1mm) for orientation //barContainer->AddNode(lens1, 1,new TGeoCombiTrans(0., 0., -(bbox_hlen-eps)+len -(-r+b) /*-0.01*/, new TGeoRotation (0))); /* barContainer->AddNode(lens1, 1,new TGeoCombiTrans(0., 0., -(bbox_hlen)+len -(-r+b), new TGeoRotation (0))); */ fdz_lens1 = -(bbox_hlen)+len -(-r+b); //Lens 2 Double_t t2 = -r2;// +b2/2 r2 is the reference point (concave lens) TGeoSphere* logicSphere2 = new TGeoSphere("S2",0 ,r2, 0. ,180.,0.,360.); TGeoBBox* lBox2 = new TGeoBBox("B2", (bbX/barnum)/2.-bargap, hthick, b2/2.); // lside -> bbX TGeoTranslation *tr2 = new TGeoTranslation("tr2", 0.,0., t2); tr2->RegisterYourself(); TGeoCompositeShape *cs2 = new TGeoCompositeShape("cs2","(B2:tr2)-S2"); lens2 = new TGeoVolume("DrcLENS2",cs2, gGeoManager->GetMedium("NLAK33A")); lens2->SetLineColor(kRed+2); lens2->SetTransparency(40); // place the lens exactly on lens1 // position lens within already shifted bar container at -(bbox_hlen-eps)+len, the lens base is -r2 // the tip of lens1 is at b // with -0.02 one can make a gap visible (.1mm due to lens1) for orientation //barContainer->AddNode(lens2, 1,new TGeoCombiTrans(0., 0., -(bbox_hlen-eps)+len -(-r2) -b /*-0.02*/, new TGeoRotation (0))); /* barContainer->AddNode(lens2, 1,new TGeoCombiTrans(0., 0., -(bbox_hlen)+len -(-r2) -b, new TGeoRotation (0))); */ fdz_lens2 = -(bbox_hlen)+len -(-r2) -b; //Lens3 (like lens1, same treatment) Double_t t3 = -r3+b3/2; TGeoSphere* logicSphere3= new TGeoSphere("S3",0.,r3, 0. ,180.,0.,360.); TGeoBBox* lBox3 = new TGeoBBox("B3", (bbX/barnum)/2-bargap, hthick, b3/2.); // lside -> bbX TGeoTranslation *tr3 = new TGeoTranslation("tr3", 0.,0., t3); tr3->RegisterYourself(); TGeoCompositeShape *cs3 = new TGeoCompositeShape("cs3","S3*(B3:tr3)"); lens3 = new TGeoVolume("DrcLENS3Sensor",cs3, gGeoManager->GetMedium("NLAK33A")); lens3->SetLineColor(kRed-6); lens3->SetTransparency(40); // place the lens exactly on lens2 plane side // position lens within already shifted bar container at -(bbox_hlen-eps)+len, the lens base is -r3 + b3 // with -0.03 one can make a gap visible (.1mm due to lens 1&2) for orientation // b2/2 is the thickness of lens2 in the middle //barContainer->AddNode(lens3, 1,new TGeoCombiTrans(0., 0., -(bbox_hlen-eps)+len -(-r3+b3) -b - b2/2 /*-0.03*/, new TGeoRotation (0))); /* barContainer->AddNode(lens3, 1,new TGeoCombiTrans(0., 0., -(bbox_hlen)+len -(-r3+b3) -b - b2/2 , new TGeoRotation (0))); //cout<<" DIRC r,r2,r3 = "< bbX Double_t t = mirror_radius - len1/2; TGeoTranslation *tr1 = new TGeoTranslation("tr1", 0.,0., t); tr1->RegisterYourself(); TGeoCompositeShape *cs = new TGeoCompositeShape("cs","S*(B:tr1)"); block1 = new TGeoVolume("DrcBlock1",cs, gGeoManager->GetMedium("FusedSil")); block1->SetLineColor(kRed); block1->SetTransparency(40); Double_t shift1 = len1-mirror_radius; // Now the start of block1 is at zero shift1 += bbox_hlen-fabs(len)-2*mirr_hthick; /* barContainer->AddNode(block1, 1, new TGeoCombiTrans(0., 0., shift1, new TGeoRotation (0))); */ AddSensitiveVolume(block1); fdz_mirr1 = shift1; Double_t gap = 0; Double_t len2 = fabs(len) - len1 - gap; // no angle for the moment // block TGeoSphere* logicSphere2 = new TGeoSphere("S2",0,mirror_radius, 0. ,180.,0.,360.); TGeoBBox* lBox2 = new TGeoBBox("B2", (bbX/barnum)/2-bargap, hthick, fabs(len2)/2.); // lside -> bbX // make radius part of block Double_t t2 = mirror_radius + len2/2 - 1; TGeoTranslation *tr2 = new TGeoTranslation("tr2", 0.,0., t2); tr2->RegisterYourself(); TGeoCompositeShape *cs2 = new TGeoCompositeShape("cs2","(B2:tr2)-S2"); block2 = new TGeoVolume("DrcBlock2Sensor",cs2, gGeoManager->GetMedium("Mirror")); block2->SetLineColor(kGreen); block2->SetTransparency(40); Double_t shift2 = -mirror_radius; // Now the start of the block is at zero shift2 += bbox_hlen-fabs(len)-2*mirr_hthick; // at end of bar shift2 += len1 + gap; fdz_mirr2 = shift2; /* barContainer->AddNode(block2, 1, new TGeoCombiTrans(0., 0., shift2, // bbox_hlen-mirror_radius-2*mirr_hthick-len2+len1+1, //bbox_hlen-mirror_radius-len2+0.1, new TGeoRotation (0) ) ); */ AddSensitiveVolume(block2); Double_t flen = 0.; // fSlabEnd = -bbox_hlen + bbox_shift + flen; fSlabEnd = -bbox_hlen + bbox_shift; cout<<"bar ends at = "<< fSlabEnd <DefineSection(0, bbox_zdown, 45., 55.); lLocalMother->DefineSection(1, bbox_zup, 45., 55.); lLocalMother->DefineSection(2, bbox_zup - EVlen, 45., EVRout+poffset+pheight+EVoffset); lLocalMother->DefineSection(3, bbox_zup - EVlen - 0.1, 45., EVRout+poffset+pheight+EVoffset); vLocalMother = new TGeoVolume("BarrelDIRC", lLocalMother, gGeoManager->GetMedium("DIRCairNoSens")); cave->AddNode(vLocalMother, 0, 0); // create BarBoxes: TGeoBBox* logicbbL; TGeoVolume *bbox; if(fprizm == kFALSE){ logicbbL = new TGeoBBox("logicbbL", bbX/2.+boxthick, hthick+boxgap+boxthick, bbox_hlen); bbox = new TGeoVolume("DrcBarBox", logicbbL, gGeoManager->GetMedium("DIRCcarbonFiber")); } if(fprizm == kTRUE){ logicbbL = new TGeoBBox("logicbbL", bbX/2.+boxthick, hthick+boxgap+boxthick, bbox_hlen-0.5*(boxgap+boxthick)); TGeoTrap* logicPrizmBox = new TGeoTrap("logicPrizmBox", phlength+0.5*(boxgap+boxthick), pangle/2., 270., hthick+boxgap+boxthick+0.5*(poffset+pdrop+pheight), bbX/2., bbX/2., 0., hthick+boxgap+boxthick+0.5*(poffset+pdrop), bbX/2., bbX/2., 0.); TGeoTranslation* trprb = new TGeoTranslation("trprb", 0., 0.5*(poffset-pdrop)+pheight/4., -bbox_hlen-phlength); trprb->RegisterYourself(); TGeoCompositeShape *cspb = new TGeoCompositeShape("cspb","logicbbL + logicPrizmBox:trprb"); bbox = new TGeoVolume("DrcBarBox", cspb, gGeoManager->GetMedium("DIRCcarbonFiber")); } bbox->SetLineColor(30); // create air boxes: TGeoBBox* logicbbS; TGeoVolume *abox; if(fprizm == kFALSE){ logicbbS = new TGeoBBox("logicbbS", bbX/2., hthick+boxgap, bbox_hlen); abox = new TGeoVolume("DrcAirBox", logicbbS, gGeoManager->GetMedium("DIRCairNoSens")); bbox->AddNode(abox, 0, new TGeoCombiTrans(0., 0., 0., new TGeoRotation(0))); } if(fprizm == kTRUE){ logicbbS = new TGeoBBox("logicbbS", bbX/2., hthick+boxgap, bbox_hlen-0.5*boxgap); TGeoTrap* logicPrizmContainer = new TGeoTrap("logicPrizmContainer", phlength+0.5*boxgap, pangle/2., 270., hthick+boxgap+0.5*(poffset+pdrop+pheight), bbX/2., bbX/2., 0., hthick+boxgap+0.5*(poffset+pdrop), bbX/2., bbX/2., 0.); TGeoTranslation* trprc = new TGeoTranslation("trprc", 0., 0.5*(poffset-pdrop)+pheight/4., -bbox_hlen-phlength); trprc->RegisterYourself(); TGeoCompositeShape *cspc = new TGeoCompositeShape("cspc","logicbbS + logicPrizmContainer:trprc"); abox = new TGeoVolume("DrcAirBox", cspc, gGeoManager->GetMedium("DIRCairNoSens")); bbox->AddNode(abox, 0, new TGeoCombiTrans(0., 0., -0.5*boxthick, new TGeoRotation(0))); } abox->SetLineColor(19); Double_t dx_bbox, dy_bbox, dz_bbox, phi_curr; for(Int_t m = 0; m < bbnum; m ++){ phi_curr = (90. - phi0 - dphi*m)/180.*pi; if(m > bbnum/2-1){ phi_curr = (90. - phi0 - dphi*m - 2.*pipehAngle)/180.*pi; } dx_bbox = radius * cos(phi_curr); dy_bbox = radius * sin(phi_curr); if(fprizm == 0){ dz_bbox = bbox_shift; } if(fprizm == 1){ dz_bbox = bbox_shift + 0.5*(boxgap+boxthick); } TGeoRotation rot_bbox; rot_bbox.RotateZ( -phi0 - m*dphi - (TMath::Floor(2.*m/bbnum))*(2.*pipehAngle)); vLocalMother->AddNode(bbox, m+1, new TGeoCombiTrans(dx_bbox, dy_bbox, dz_bbox, new TGeoRotation(rot_bbox))); } // create logic bar: TGeoBBox* logicBar = new TGeoBBox("logicBar", ((bbX/barnum)/2.)-bargap, hthick, bbox_hlen-fabs(len)/2.-mirr_hthick); TGeoVolume* bar; if(fprizm == kFALSE){ bar = new TGeoVolume("DrcBarSensor",logicBar, gGeoManager->GetMedium("FusedSil")); } if(fprizm == kTRUE){ TGeoTrap* logicPrizm = new TGeoTrap("logicPrizm", phlength, pangle/2., 270., hthick+0.5*(poffset+pdrop+pheight), (bbX/barnum/2.)-bargap, (bbX/barnum/2.)-bargap, 0., hthick+0.5*(poffset+pdrop), (bbX/barnum/2.)-bargap, (bbX/barnum/2.)-bargap, 0.); TGeoTranslation* trpr = new TGeoTranslation("trpr", 0., 0.5*(poffset-pdrop)+pheight/4., -(bbox_hlen-fabs(len)/2.-mirr_hthick)-phlength); trpr->RegisterYourself(); TGeoCompositeShape *csbp = new TGeoCompositeShape("csbp","logicBar + logicPrizm:trpr"); bar = new TGeoVolume("DrcBarSensor",csbp, gGeoManager->GetMedium("FusedSil")); fAtBarEnd = "DrcBarSensor"; fSlabEnd = -bbox_hlen + bbox_shift + 2.*phlength; } bar->SetLineColor(kCyan-9); bar->SetTransparency(50); AddSensitiveVolume(bar); // create logic mirror: TGeoBBox* logicMirror = new TGeoBBox("logicMirror", bbX/barnum/2.-bargap, hthick, mirr_hthick); TGeoVolume *mirr = new TGeoVolume("DrcMirr", logicMirror, gGeoManager->GetMedium("Mirror")); mirr->SetLineColor(5); Double_t dx, dy, dz_bar, dz_mirr; for(Int_t j=0; jAddNode(lens1, 1+j ,new TGeoCombiTrans(dx, dy, fdz_lens1, new TGeoRotation (0))); abox->AddNode(lens2, 1+j ,new TGeoCombiTrans(dx, dy, fdz_lens2, new TGeoRotation (0))); abox->AddNode(lens3, 1+j ,new TGeoCombiTrans(dx, dy, fdz_lens3, new TGeoRotation (0))); } if(fFocusingSystem == 2){ // mirror abox->AddNode(block1, 1+j, new TGeoCombiTrans(dx, dy, fdz_mirr1, new TGeoRotation (0))); abox->AddNode(block2, 1+j, new TGeoCombiTrans(dx, dy, fdz_mirr2, new TGeoRotation (0))); } } if(fprizm == kTRUE){ dz_bar = -mirr_hthick - 0.5*boxgap; dz_mirr = bbox_hlen -0.5*boxgap - mirr_hthick; } abox->AddNode(bar, 1+j, new TGeoCombiTrans(dx, dy, dz_bar, new TGeoRotation(0))); if(fFocusingSystem != 2){ abox->AddNode(mirr, 1+j, new TGeoCombiTrans(dx, dy, dz_mirr, new TGeoRotation(0))); } } // Expansion volume: TGeoPcon* logicEV = new TGeoPcon("logicEV", 0., 360., 2); if(fprizm == kFALSE){ logicEV->DefineSection(0, 0., radius-hthick, EVRout); logicEV->DefineSection(1, EVlen, radius-hthick, (radius+hthick+boxgap+boxthick)/cos(dphi/2./180.*pi)); } if(fprizm == kTRUE){ logicEV->DefineSection(0, 0., radius-hthick-pdrop-EVdrop, EVRprizm); logicEV->DefineSection(1, EVlen-2.*phlength, radius-hthick-pdrop-EVdrop, radius+hthick+poffset+pheight+EVoffset); } TGeoVolume* baseEV = new TGeoVolume("DrcEV", logicEV, gGeoManager->GetMedium("Marcol82")); baseEV->SetLineColor(kMagenta+2); baseEV->SetTransparency(50); vLocalMother->AddNode(baseEV, 1, new TGeoCombiTrans(0.,0.,EVshift, new TGeoRotation(0))); // PhotoDetector: TGeoPcon *logicPD = new TGeoPcon("logicPD", 0., 360., 2); if(fprizm == kFALSE){ logicPD->DefineSection(0, 0.0, radius-hthick, EVRout); logicPD->DefineSection(1, 0.1, radius-hthick, EVRout); } if(fprizm == kTRUE){ logicPD->DefineSection(0, 0.0, radius-hthick, EVRprizm); logicPD->DefineSection(1, 0.1, radius-hthick, EVRprizm); } TGeoVolume *pd = new TGeoVolume("DrcPDSensor", logicPD, gGeoManager->GetMedium("FusedSil")); pd->SetLineColor(kGreen-6); vLocalMother->AddNode(pd, 1,new TGeoCombiTrans(0., 0., EVshift-0.1, new TGeoRotation (rot1))); AddSensitiveVolume(pd); cout<<"bars ends at = "<CloseGeometry(); } // ----- Public Method Construct Optical Geometry --------------------------- void PndDrc::ConstructOpGeometry() { cout<< " ==================================================== " << endl; cout<< " ======= DRC:: ConstructOpticalGeometry() ======== " << endl; Int_t npoints = 2; Double_t ephoton[npoints]; ephoton[0] = 1.0e-09; // 1 eV ephoton[1] = 10.0e-09; // 10 eV Double_t reflectivity[npoints]; reflectivity[0] = 1.; reflectivity[1] = 1.; Double_t efficiency[npoints]; efficiency[0] = 0.5; efficiency[1] = 0.5; gMC->DefineOpSurface("BarMirSurface",kUnified, kDielectric_dielectric, kPolished, 0.1); for(Int_t i=0; ibarNum(); i++){ gMC->SetBorderSurface("BarMirSurface", "DrcBarSensor", i+1, "DrcMirr", i+1, "BarSurface"); } /* gMC->DefineOpSurface("EVSurface", kGlisur, kDielectric_dielectric, kPolished, 0.1); gMC->SetBorderSurface("EVSurface", "DrcEV",1, "BarrelDIRC",0,"EVSurface"); */ gMC->SetMaterialProperty("BarSurface", "REFLECTIVITY", npoints, ephoton, reflectivity); gMC->SetMaterialProperty("BarSurface", "EFFICIENCY", npoints, ephoton, efficiency); /* gMC->SetMaterialProperty("EVSurface", "REFLECTIVITY", npoints, ephoton, reflectivity); gMC->SetMaterialProperty("EVSurface", "EFFICIENCY", npoints, ephoton, efficiency); */ } // ----- Public method CheckIfSensitive -------------------------------------- bool PndDrc::CheckIfSensitive(std::string name) { for (Int_t i = 0; i < fListOfSensitives.size(); i++){ if (name.find(fListOfSensitives[i]) != std::string::npos) return true; } return false; } // ----- Private method AddHit -------------------------------------------- PndDrcPDPoint* PndDrc::AddHit(Int_t trackID, Int_t copyNo, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Int_t pdgCode, Int_t eventID) { TClonesArray& clrefPD = *fDrcPDCollection; Int_t size = clrefPD.GetEntriesFast(); if (fVerboseLevel>1) cout << "-I- PndDrc: Adding Point at (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") cm, detector " << copyNo << ", track " << trackID <<" event "<1) cout << "-I- PndBarDrc: Adding Point at (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") cm, detector " << copyNo << ", track " << trackID <<" event "<