// ------------------------------------------------------------------------- // ----- PndLmdStripClusterTask source file ----- // ----- modified for Lmd by M. Michel & A.Karavdina ----- // ------------------------------------------------------------------------- //LUMI #include "PndLmdStripClusterTask.h" #include "PndLmdContFact.h" //PANDA #include "PndSdsTotChargeConversion.h" #include "PndSdsIdealChargeConversion.h" #include "PndSdsChargeWeightingAlgorithms.h" #include "PndSdsSimpleStripClusterFinder.h" #include "PndSdsStripAdvClusterFinder.h" #include "PndSdsTotDigiPar.h" //FAIR #include "FairRun.h" #include "FairRuntimeDb.h" #include "FairBaseParSet.h" //ROOT #include "TList.h" #include "TDatabasePDG.h" #include "TLorentzVector.h" // ----- Default constructor ------------------------------------------- PndLmdStripClusterTask::PndLmdStripClusterTask() : PndSdsStripClusterTask("LMD Strip Clusterisation Task") { fGeoH = PndGeoHandling::Instance(); } // ----- Public method Init -------------------------------------------- InitStatus PndLmdStripClusterTask::Init() { SetBranchNames(); FairRootManager* ioman = FairRootManager::Instance(); if ( ! ioman ) { std::cout << "-E- PndSdsStripClusterTask::Init: " << "RootManager not instantiated!" << std::endl; return kFATAL; } // Get input array fDigiArray = (TClonesArray*) ioman->GetObject(fInBranchName); if ( ! fDigiArray ) { std::cout << "-W- PndSdsStripClusterTask::Init: " << "No SDSDigi array!" << std::endl; return kERROR; } // set output arrays fClusterArray = new TClonesArray("PndSdsClusterStrip"); ioman->Register(fClustBranchName, fFolderName, fClusterArray, fPersistance); fHitArray = new TClonesArray("PndSdsHit"); ioman->Register(fOutBranchName, fFolderName, fHitArray, fPersistance); SetInBranchId(); SetCalculators(); // FairRun* ana = FairRun::Instance(); // FairRuntimeDb* rtdb = ana->GetRuntimeDb(); FairBaseParSet* par=(FairBaseParSet*) (rtdb->findContainer("FairBaseParSet")); // cout<<"par = "<GetBeamMom(); // cout<<"PndLmdStripClusterTask::Init() fPbeam = "<GetRuntimeDb(); PndLmdContFact* themvdcontfact = (PndLmdContFact*)rtdb->getContFactory("PndLmdContFact"); TList* theContNames = themvdcontfact->GetDigiParNames(); Info("SetParContainers()","The container names list contains %i entries",theContNames->GetEntries()); TIter cfIter(theContNames); while (TObjString* contname = (TObjString*)cfIter()) { TString parsetname = contname->String(); Info("SetParContainers()",parsetname.Data()); if(parsetname.BeginsWith("SDSStripDigiPar")){ PndSdsStripDigiPar* digipar = (PndSdsStripDigiPar*)(rtdb->getContainer(parsetname.Data())); if ( ! digipar ) Fatal("SetParContainers","No DIGI parameter found: %s",parsetname.Data()); fDigiParameterList->Add(digipar); } if(parsetname.BeginsWith("SDSStripTotDigiPar")){ PndSdsTotDigiPar* totdigipar = (PndSdsTotDigiPar*)(rtdb->getContainer(parsetname.Data())); if ( ! totdigipar ) Fatal("SetParContainers","No TOT parameter found: %s",parsetname.Data()); fChargeDigiParameterList->Add(totdigipar); } }//while PndSdsStripClusterTask::SetParContainers(); } void PndLmdStripClusterTask::SetCalculators() { Info("SetCalculators","lmd"); PndSdsStripClusterTask::SetCalculators(); TIter params(fDigiParameterList); TIter totparams(fChargeDigiParameterList); while( PndSdsStripDigiPar* digipar = (PndSdsStripDigiPar*)params() ){ PndSdsTotDigiPar* totdigipar = (PndSdsTotDigiPar*) totparams(); if ( 0==digipar ) continue; const char* senstype = digipar->GetSensType(); if ( digipar->GetChargeConvMethod() == 1 ){ if(fVerbose>0) Info("SetCalculators()","Use Tot charge conversion for %s sensors",senstype); fChargeConverter[senstype] = new PndSdsTotChargeConversion( totdigipar->GetChargingTime(), totdigipar->GetConstCurrent(), digipar->GetThreshold(), totdigipar->GetClockFrequency(), fVerbose); } else{ if(fVerbose>0) Info("SetCalculators()","Use Ideal charge conversion for %s sensors",senstype); fChargeConverter[senstype] = new PndSdsIdealChargeConversion(); } //fChargeAlgos[senstype] = new PndSdsChargeWeightingAlgorithms(fDigiArray, digipar->GetRaisingTime(),digipar->GetFallingRatio(),digipar->GetThreshold()); Int_t ClusterMod = digipar->GetClusterMod(); Int_t RadChannel = digipar->GetRadChannel(); Int_t RadTime = digipar->GetRadTime(); if(0==ClusterMod) { fClusterFinderList[senstype] = new PndSdsSimpleStripClusterFinder(fInBranchId, RadChannel ); //search radius in channel no. } else if(1==ClusterMod) { fClusterFinderList[senstype] = new PndSdsStripAdvClusterFinder(fInBranchId, RadChannel, RadTime); } } } TVector3 PndLmdStripClusterTask::AddMSErr(TVector3 hpos, TVector3 hposerr){ if(fVerbose>0) Info("AddMSErr","calculation additional errors due to multiple scaterring"); //Calculation of ThetaMS ------------------------------------- //Charge & mass of particle Int_t PDGCode = -2212; TDatabasePDG *fdbPDG = TDatabasePDG::Instance(); TParticlePDG *fParticle = fdbPDG->GetParticle(PDGCode); // Double_t fCharge = fParticle->Charge(); Double_t fMass = fParticle->Mass(); Double_t Ebeam = TMath::Hypot(fPbeam,fMass); TLorentzVector LorMom(0, 0, fPbeam, Ebeam); Double_t beta = LorMom.Beta(); // cout<<"beta = "<GetSensorDimensionsShortId(sensorID).Z() = "<GetSensorDimensionsShortId(sensorID).Z()<GetSensorDimensionsShortId(sensorID).Z()/TMath::Sqrt(12.0);//TEST!!! // cout<<"errZ = "<GetStripDirection(), meanbotPoint, fCurrentStripCalcBot->GetStripDirection() ); // here we assume the sensor system to be in the _Middle_ of the volume localpos.SetXYZ( onsensorPoint.X(), onsensorPoint.Y(), 0.); //double zloc = fGeoH->GetSensorDimensionsShortId(sensorID).Z()+onsensorPoint.X()*tan(2.326*TMath::Pi()/180.);//TEST //double zloc = (-1)*fGeoH->GetSensorDimensionsShortId(sensorID).Z();//TEST // localpos.SetXYZ( onsensorPoint.X(), onsensorPoint.Y(), zloc);//TEST // cout<<"onsensorPoint.X()*tan(2.326*TMath::Pi()/180.) = "<GetOrient()="<GetOrient()<<" fCurrentDigiPar->GetSkew()="<GetSkew()<