#include "R3BGfiDigitizer.h" #include "TClonesArray.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" // includes for modeling #include "TGeoManager.h" #include "TParticle.h" #include "TVirtualMC.h" #include "TGeoMatrix.h" #include "TGeoMaterial.h" #include "TGeoMedium.h" #include "TGeoBBox.h" #include "TGeoCompositeShape.h" #include "TGeoShapeAssembly.h" #include "TVector3.h" #include "TMath.h" #include "TRandom.h" #include "TH1F.h" #include "TH2F.h" #include #include #include "R3BGfiPoint.h" #include "R3BMCTrack.h" using std::cout; using std::endl; R3BGfiDigitizer::R3BGfiDigitizer() : FairTask("R3B Gfi Digitization scheme ") { } R3BGfiDigitizer::~R3BGfiDigitizer() { } void R3BGfiDigitizer::SetParContainers() { // Get run and runtime database FairRunAna* run = FairRunAna::Instance(); if ( ! run ) Fatal("SetParContainers", "No analysis run"); FairRuntimeDb* rtdb = run->GetRuntimeDb(); if ( ! rtdb ) Fatal("SetParContainers", "No runtime database"); fGfiDigiPar = (R3BGfiDigiPar*)(rtdb->getContainer("R3BGfiDigiPar")); if ( fGfiDigiPar ) { cout << "-I- R3BGfiDigitizer::SetParContainers() "<< endl; cout << "-I- Container R3BGfiDigiPar loaded " << endl; } } InitStatus R3BGfiDigitizer::Init() { // cout<<"Init "<GetObject("GFIPoint"); fGfiMCTrack = (TClonesArray*) ioman->GetObject("MCTrack"); // Register output array GfiDigi fGfiDigi = new TClonesArray("R3BGfiDigi",1000); ioman->Register("GfiDigi", "Digital response in Gfi", fGfiDigi, kTRUE); eventNoGfi=0; // Initialise control histograms return kSUCCESS; } void R3BGfiDigitizer::Exec(Option_t* opt) { Reset(); eventNoGfi+=1; // if(eventNoGfi/1000. == (int)eventNoGfi/1000.) cout<<"Event #: "<GetEntries(); Int_t TrackIdGfi=0; Int_t gf1mul; Int_t gf2mul; Double_t gf1_01x; Double_t gf2_01x; //******************** GFI **************************// gf1mul=0; gf2mul=0; for (Int_t l=0;lAt(l); // Int_t DetID = Gfi_obj->GetDetectorID(); Double_t fX_In = Gfi_obj->GetXIn(); Double_t fX_Out = Gfi_obj->GetXOut(); Double_t fZ_In = Gfi_obj->GetZIn(); Double_t fZ_Out = Gfi_obj->GetZOut(); TrackIdGfi = Gfi_obj->GetTrackID(); R3BMCTrack *aTrack = (R3BMCTrack*) fGfiMCTrack->At(TrackIdGfi); Int_t PID = aTrack->GetPdgCode(); Int_t mother = aTrack->GetMotherId(); Double_t fX = ((fX_In + fX_Out)/2); Double_t fZ = ((fZ_In + fZ_Out)/2); // offset - position of GFI1 detector x: -71.97331; z: +513.967775 // offset - position of GFI2 detector x: -145.270039; z: +730.318956 // angle = -16.7 degrees // cos(angle) = 0.957822495 //sin(angle) = -0.28736052 if(PID==1000080150 && mother<0){ // if(PID==1000170310 && mother<0){ //Christoph 1p // if(PID==1000160300 && mother<0){ //Christoph 2p if (fZ<600) //no DetectorID for GFIs this is GFI1 { gf1_01x=(-(((fX+72.164874) * 0.957822495) - ((fZ- 513.910302) * (-0.28736052))));//x position swop (with -) - requirement for tracker //justyna new //gf1_01x=(-(((fX+71.97331) * 0.957822495) - ((fZ- 513.967775) * (-0.28736052))));//x position swop (with -) - requirement for tracker // gf1_01x=(-(((fX+88.55368) * 0.957822495) - ((fZ- 515.015418) * (-0.28736052)))); //Christoph // cout<<"GFI1 - fragment detector "<600) //GFI2 { gf2_01x=(-(((fX+145.212570) * 0.957822495) - ((fZ - 730.336197) * (-0.28736052))));//x position swop (with -) - requirement for tracker //justyna new //gf2_01x=(-(((fX+145.270039) * 0.957822495) - ((fZ - 730.318956) * (-0.28736052))));//x position swop (with -) - requirement for tracker // gf2_01x=(-(((fX+149.791168) * 0.957822495) - ((fZ - 744.623074) * (-0.28736052)))); //Christoph // cout<<"GFI2 - fragment detector "<Clear(); } void R3BGfiDigitizer::Finish() { // Write control histograms } R3BGfiDigi* R3BGfiDigitizer::AddHit(Int_t gf1mul,Double_t gf1_01x,Int_t gf2mul,Double_t gf2_01x){ TClonesArray& clref = *fGfiDigi; Int_t size = clref.GetEntriesFast(); return new(clref[size]) R3BGfiDigi(gf1mul,gf1_01x,gf2mul,gf2_01x); } //R3BGfiDigi* R3BGfiDigitizer::AddHit( // return new(clref[size]) R3BGfiDigi(); //} ClassImp(R3BGfiDigitizer)