/* * PndLmdDigiProducer.cxx * * Created on: Aug 10, 2009 * Author: huagen */ //the implementation of digiproducer #include "PndLmdDigiProducer.h" #include "PndLmdDigiPara.h" #include "PndLmdDigiStrips.h" #include "PndLmdMCPoint.h" #include "PndLmdCalStrip.h" #include "PndLmdStrips.h" #include "PndLmdGeoHandling.h" #include "TGeoManager.h" #include "FairRun.h" #include "FairRuntimeDb.h" #include "FairGeoNode.h" #include "FairGeoVector.h" #include "PndStringVector.h" #include "FairParamList.h" #include "FairRootManager.h" #include "TClonesArray.h" #include "TVector3.h" #include #include using namespace std; PndLmdDigiProducer::PndLmdDigiProducer() : FairTask("Pnd LMD Digi Producer") { fBranchName = "PndLmdMCPoint"; } PndLmdDigiProducer::PndLmdDigiProducer(Int_t k,SensorSegment segment) :FairTask("Pnd LMD Digi Producer") { fBranchName = "PndLmdMCPoint"; // fDigiParTrap = digipar; fSegment = segment; } PndLmdDigiProducer::PndLmdDigiProducer(Double_t k,SensorSide side) :FairTask("Pnd LMD Digi Producer") { fBranchName = "PndLmdMCPoint"; // fDigiParTrap = digipar; fSide = side; } PndLmdDigiProducer :: ~PndLmdDigiProducer() { delete fGeoH; } void PndLmdDigiProducer::SetParContainers() { FairRun* ana = FairRun::Instance(); FairRuntimeDb* rtdb = ana->GetRuntimeDb(); fDigiParTrap = (PndLmdDigiPara*)(rtdb->getContainer("LmdStripDigiParaTrap")); //if(!fDigiParTrap) cout<<"The digi parameters has been set to container!"<print(); } InitStatus PndLmdDigiProducer::ReInit() { SetParContainers(); return kSUCCESS; } //init method for the digiproducer, input/output array, digipar file etc. InitStatus PndLmdDigiProducer::Init() { FairRun* ana = FairRun::Instance(); FairRootManager* ioman = FairRootManager::Instance(); fGeoH = new PndLmdGeoHandling(gGeoManager); if(! ioman) { std::cout<<"-E- PndLmdDigiProducer::Init :" <<" The FariRootManager is not initialized!"<GetObject(fBranchName); if(! fPointArray) { std::cout<<"-E- PndLmdDigiProducer::Init :" <<"No PndLmdMCPoint Array"<Register("LMDStripDigis","LMD",fStripArray,kTRUE); if(! fDigiParTrap) { std::cout<<"-E- PndLmdDigiProducer::DigiParTrap Container doesn't exist!"<print(); fStripCalTrapLeft = new PndLmdCalStrip(fDigiParTrap,kLEFT); cout<<"the digi paras for left segment!"<print(); fStripCalTrapRight = new PndLmdCalStrip(fDigiParTrap,kRIGHT); cout<<"the digi paras for right segment!"<print(); std::cout<<"the PndLmdDigiProcuder initialized successfully!"<Clear(); //define variables PndLmdMCPoint* point = NULL; Int_t nPoint = fPointArray->GetEntriesFast(); if(fVerbose>0){ std::cout<<"the Nr of points is"<At(iPoint); if(! point){ std::cout<<"No point !"<MasterToLocalId(point->GetEntryPoint(),point->GetDetName()); TVector3 posOutL = fGeoH->MasterToLocalId(point->GetExitPoint(),point->GetDetName()); //std::cout<<"the point in global coordinate is "<GetEntryPoint().X()<<","<GetEntryPoint().Y() //<<","<GetEntryPoint().Z()<GetEnergyLoss(); std::cout<<"the eLoss of this point is: "<0) { // std::cout<<"Hits on Left segment"< leftStrips = fCurrentStripCalLeft->DigiStripFromPoint(posInL.X(),posInL.Y(),posInL.Z(), posOutL.X(),posOutL.Y(),posOutL.Z(), eLoss); if(leftStrips.size()!=0){ for(std::vector::const_iterator kit=leftStrips.begin();kit!=leftStrips.end();++kit) {//register the strips fired AddDigi(iStrip,iPoint,kLMDHitsStrip,point->GetDetName(), fCurrentStripCalLeft->CalFeFromStrip(kit->GetIndex()), fCurrentStripCalLeft->CalChannelFromStrip(kit->GetIndex()), kit->GetCharge()); Int_t chan1 = (fCurrentStripCalLeft->CalFeFromStrip(kit->GetIndex()))*(fCurrentDigiPar->GetNrFeChannels()) +( fCurrentStripCalLeft->CalChannelFromStrip(kit->GetIndex())); cout<<"the iPoint is: "<GetDetName()<<","<GetCharge()< rightStrips = fCurrentStripCalRight->DigiStripFromPoint(posInL.X(),posInL.Y(),posInL.Z(), posOutL.X(),posOutL.Y(),posOutL.Z(), eLoss); // cout<<"Call the calStrip class to get digi successfully"<::const_iterator kit=rightStrips.begin(); kit!=rightStrips.end();++kit){ //register the strips fired AddDigi(iStrip,iPoint,kLMDHitsStrip,point->GetDetName(), fCurrentStripCalRight->CalFeFromStrip(kit->GetIndex())+fCurrentDigiPar->GetNrLeftFe(), fCurrentStripCalRight->CalChannelFromStrip(kit->GetIndex()), kit->GetCharge()); Int_t chan2 = (fCurrentStripCalRight->CalFeFromStrip(kit->GetIndex())+fCurrentDigiPar->GetNrLeftFe())*(fCurrentDigiPar->GetNrFeChannels()) +(fCurrentStripCalLeft->CalChannelFromStrip(kit->GetIndex())); /* new((*fStripArray)[iStrip]) PndLmdDigiStrips(iPoint,kLMDHitsStrip,point->GetDetName(), fCurrentStripCalRight->CalFeFromStrip(kit->GetIndex())+fCurrentDigiPar->GetNrLeftFe(), fCurrentStripCalRight->CalChannelFromStrip(kit->GetIndex()), kit->GetCharge()); iStrip++; */ // cout<GetDetName()<<","<GetCharge()<0) std::cout<<"-I- PndLmdDigiProducer: "<At(skr); if(aDigi->GetDetID()==detID, aDigi->GetDetName()==detName, aDigi->GetFe()==fe, aDigi->GetChannel()==channel) { // aDigi->AddCharge(charge); // aDigi->AddIndex(iPoint); found=kTRUE; } } if(found == kFALSE){ new((*fStripArray)[iStrip]) PndLmdDigiStrips(iPoint,detID,detName,fe,channel,charge); iStrip++; } } ClassImp(PndLmdDigiProducer);