diff --git a/mvd/CbmMvdClusterfinder.cxx b/mvd/CbmMvdClusterfinder.cxx index f1391f18b781255bece22470b883bb2d4e67253c..6cf8f5fb90a0174350113a7e81a5ec6f8d440f5e 100644 --- a/mvd/CbmMvdClusterfinder.cxx +++ b/mvd/CbmMvdClusterfinder.cxx @@ -107,10 +107,14 @@ void CbmMvdClusterfinder::Exec(Option_t* /*opt*/) //fDetector->SendInputDigis(fDigiMan); if (fVerbose) cout << "Execute ClusterPlugin Nr. " << fClusterPluginNr << endl; - fDetector->Exec(fClusterPluginNr); + fDetector->Exec(nTargetPlugin); if (fVerbose) cout << "End Chain" << endl; if (fVerbose) cout << "Start writing Cluster" << endl; - fCluster->AbsorbObjects(fDetector->GetOutputCluster(), 0, fDetector->GetOutputCluster()->GetEntriesFast() - 1); + + fDetector->GetOutputArray(nTargetPlugin, fCluster); + //fDetector->GetMatchArray (nTargetPlugin, fTmpMatch); + //fCluster->AbsorbObjects(fDetector->GetOutputCluster(), 0, fDetector->GetOutputCluster()->GetEntriesFast() - 1); + if (fVerbose) cout << "Total of " << fCluster->GetEntriesFast() << " Cluster in this Event" << endl; if (fVerbose) cout << "//----------------------------------------//" << endl; LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fCluster->GetEntriesFast() << " cluster in " << fixed diff --git a/mvd/CbmMvdDetector.cxx b/mvd/CbmMvdDetector.cxx index 791660316e9d566187cf02e556998062e1a3a1af..b99d53ee6b35ba6c2a780e0a643ee8751968e723 100644 --- a/mvd/CbmMvdDetector.cxx +++ b/mvd/CbmMvdDetector.cxx @@ -485,8 +485,9 @@ TClonesArray* CbmMvdDetector::GetOutputDigiMatchs() sensor = (CbmMvdSensor*) fSensorArray->At(i); fDigiPlugin = sensor->GetDigiPlugin(); // Int_t length = sensor->GetOutputArrayLen(fDigiPlugin); - foutputDigiMatchs->AbsorbObjects(sensor->GetOutputMatch()); + foutputDigiMatchs->AbsorbObjects(sensor->GetMatchArray(fDigiPlugin)); } + cout << " -W- CbmMvdDetector::GetOutputDigiMatchs - Use of methode depreciated" << endl; return (foutputDigiMatchs); } //----------------------------------------------------------------------- @@ -530,13 +531,57 @@ TClonesArray* CbmMvdDetector::GetOutputArray(Int_t nPlugin) Int_t length = sensor->GetOutputArrayLen(nPlugin); if (length >= 0) { foutputDigis->AbsorbObjects(sensor->GetOutputArray(nPlugin), 0, length); - foutputDigiMatchs->AbsorbObjects(sensor->GetOutputMatch(), 0, length); + foutputDigiMatchs->AbsorbObjects(sensor->GetMatchArray(nPlugin), 0, length); } } return (foutputDigis); } //----------------------------------------------------------------------- +void CbmMvdDetector::GetOutputArray(Int_t nPlugin, TClonesArray* outputArray){ + Int_t nSensors = fSensorArray->GetEntriesFast(); + CbmMvdSensor* sensor; + TClonesArray* tmpArray; + + + for (Int_t i = 0; i < nSensors; i++) { + sensor = (CbmMvdSensor*) fSensorArray->At(i); + tmpArray=sensor->GetOutputArray(nPlugin); + Int_t length = tmpArray->GetEntriesFast(); + //cout<< "CbmMvdDetector::GetOutputArray - Length = " << length << endl; + if (length >= 0) { + outputArray->AbsorbObjects(tmpArray); + } + } +} +//----------------------------------------------------------------------- +void CbmMvdDetector::GetMatchArray(Int_t nPlugin, TClonesArray* matchArray){ + Int_t nSensors = fSensorArray->GetEntriesFast(); + CbmMvdSensor* sensor; + TClonesArray* tmpArray; + + + for (Int_t i = 0; i < nSensors; i++) { + sensor = (CbmMvdSensor*) fSensorArray->At(i); + tmpArray=sensor->GetMatchArray(nPlugin); + Int_t length = tmpArray->GetEntriesFast(); + + if (length >= 0) { + matchArray->AbsorbObjects(tmpArray); + } + } + + /* + CbmMvdSensor* sensor; + for (Int_t i = 0; i < nSensors; i++) { + sensor = (CbmMvdSensor*) fSensorArray->At(i); + Int_t length = sensor->GetOutputArrayLen(nPlugin); + if (length >= 0) { + matchArray->AbsorbObjects(sensor->GetMatchArray(nPlugin), 0, length); + } + } */ +} + //----------------------------------------------------------------------- void CbmMvdDetector::Finish() { diff --git a/mvd/CbmMvdDetector.h b/mvd/CbmMvdDetector.h index f1724da242cb55d14919eef47f24fe8e74e69159..7e4dc3fb57f193511533da33ad5e9fc0068ff4f7 100644 --- a/mvd/CbmMvdDetector.h +++ b/mvd/CbmMvdDetector.h @@ -67,6 +67,9 @@ public: TClonesArray* GetOutputDigiMatchs(); TClonesArray* GetOutputCluster(); //khun TClonesArray* GetOutputArray(Int_t nPlugin); + void GetOutputArray(Int_t nPlugin,TClonesArray* outputArray); + void GetMatchArray(Int_t nPlugin, TClonesArray* matchArray); + TClonesArray* GetSensorArray(){return fSensorArray;}; CbmMvdSensor* GetSensor(Int_t nSensor) {return (CbmMvdSensor*) fSensorArray->At(nSensor);} TClonesArray* GetSensorIDArray(){return fSensorIDArray;}; diff --git a/mvd/CbmMvdDigitizer.cxx b/mvd/CbmMvdDigitizer.cxx index 6531812fccc1b658c717b83d49077e603e7c3e54..66a9bfc4c603400e5710cfa4016b6dbfdd58a2fd 100644 --- a/mvd/CbmMvdDigitizer.cxx +++ b/mvd/CbmMvdDigitizer.cxx @@ -65,6 +65,10 @@ CbmMvdDigitizer::CbmMvdDigitizer() , fPileupManager(nullptr) , fDeltaManager(nullptr) { + fTmpDigi = new TClonesArray("CbmMvdDigi", 1000); + fTmpMatch = new TClonesArray("CbmMatch", 1000); + + } // ------------------------------------------------------------------------- @@ -96,6 +100,9 @@ CbmMvdDigitizer::CbmMvdDigitizer(const char* name, Int_t iMode, Int_t /*iVerbose , fPileupManager(nullptr) , fDeltaManager(nullptr) { + + fTmpDigi = new TClonesArray("CbmMvdDigi", 1000); + fTmpMatch = new TClonesArray("CbmMatch", 1000); } // ------------------------------------------------------------------------- @@ -141,18 +148,30 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) } + //cout << "CbmMvdDigitizer::Exec() - Send data completed" << endl; - //fDetector->SendInput(fInputPoints); LOG(debug) << fName << ": Execute DigitizerPlugin Nr. " << fDigiPluginNr; fDetector->Exec(fDigiPluginNr); LOG(debug) << fName << ": End Chain"; + + //cout << "CbmMvdDigitizer::Exec() - Exec data completed" << endl; + // --- Send produced digis to DAQ - fTmpDigi = fDetector->GetOutputDigis(); - fTmpMatch = fDetector->GetOutputDigiMatchs(); + //fTmpDigi = fDetector->GetOutputDigis(); + //fTmpMatch = fDetector->GetOutputDigiMatchs(); + + fDetector->GetOutputArray(nTargetPlugin, fTmpDigi); + //cout << "CbmMvdDigitizer::Exec() - GetOutputArray completed" << endl; + + fDetector->GetMatchArray (nTargetPlugin, fTmpMatch); + //cout << "CbmMvdDigitizer::Exec() - GetMatchArray data completed" << endl; + + //cout << "Length of Digi Array " << fTmpDigi->GetEntriesFast() << endl; + //cout << "Length of Digi Match Array " << fTmpMatch->GetEntriesFast() << endl; Int_t nEntries = fTmpDigi->GetEntriesFast(); for (Int_t index = 0; index < nEntries; index++) { diff --git a/mvd/CbmMvdHitfinder.cxx b/mvd/CbmMvdHitfinder.cxx index 4e23ee22a7fc3acd392efe3036674af63660b98b..6575309b66d790263289d571bdda7ca3a203d69e 100644 --- a/mvd/CbmMvdHitfinder.cxx +++ b/mvd/CbmMvdHitfinder.cxx @@ -148,8 +148,12 @@ void CbmMvdHitfinder::Exec(Option_t* /*opt*/) fDetector->Exec(fHitfinderPluginNr); if (fVerbose) cout << "End Chain" << endl; if (fVerbose) cout << "Start writing Hits" << endl; - fHits->AbsorbObjects(fDetector->GetOutputHits(), 0, fDetector->GetOutputHits()->GetEntriesFast() - 1); - if (fVerbose) cout << "Total of " << fHits->GetEntriesFast() << " hits found" << endl; + fDetector->GetOutputArray(nTargetPlugin, fHits); + + //fDetector->GetMatchArray (nTargetPlugin, fTmpMatch); + //fHits->AbsorbObjects(fDetector->GetOutputHits(), 0, fDetector->GetOutputHits()->GetEntriesFast() - 1); + + cout << "Total of " << fHits->GetEntriesFast() << " hits found" << endl; if (fVerbose) cout << "Finished writing Hits" << endl; if (fVerbose) cout << "//----------------------------------------//" << endl << endl; LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fHits->GetEntriesFast() << " hits in " << fixed diff --git a/mvd/CbmMvdSensor.cxx b/mvd/CbmMvdSensor.cxx index c2782f658ba24b179716a88c421a553eff91f79f..ae0f732ffc279ee89d20514832d295cf5f3e1354 100644 --- a/mvd/CbmMvdSensor.cxx +++ b/mvd/CbmMvdSensor.cxx @@ -11,9 +11,11 @@ //---Plugins #include "CbmMvdSensorPlugin.h" -#include "plugins/buffers/CbmMvdSensorFrameBuffer.h" // -> Not used -#include "plugins/buffers/CbmMvdSensorTrackingBuffer.h" // -> Not used -#include "plugins/tasks/CbmMvdSensorClusterfinderTask.h" //not needed khun +#include "CbmMvdSensorTask.h" +#include "CbmMvdSensorBuffer.h" +//#include "plugins/buffers/CbmMvdSensorFrameBuffer.h" // -> Not used +//#include "plugins/buffers/CbmMvdSensorTrackingBuffer.h" // -> Not used +//#include "plugins/tasks/CbmMvdSensorClusterfinderTask.h" //not needed khun #include "plugins/tasks/CbmMvdSensorDigiToHitTask.h" //#include "plugins/tasks/CbmMvdSensorDigitizerTBTask.h" @@ -57,12 +59,15 @@ CbmMvdSensor::CbmMvdSensor() , fClusterPlugin(-1) , fVolName("") , fNodeName("") + /* , foutputDigis(NULL) , foutputCluster(NULL) , //not needed khun foutputDigiMatch(NULL) , foutputBuffer(NULL) + , fcurrentPoints(NULL) + */ , fcurrentEventTime(0.) , epsilon() , fShape(NULL) @@ -103,12 +108,15 @@ CbmMvdSensor::CbmMvdSensor(const char* name, CbmMvdSensorDataSheet* dataSheet, T , fClusterPlugin(-1) , fVolName(volName) , fNodeName(nodeName) + /* , foutputDigis(NULL) , foutputCluster(NULL) , //not needed khun foutputDigiMatch(NULL) , foutputBuffer(NULL) + , fcurrentPoints(NULL) + */ , fcurrentEventTime(0.) , epsilon() , fShape(NULL) @@ -202,13 +210,14 @@ void CbmMvdSensor::Init() ReadSensorGeometry(fNodeName); - +/* if (!initialized) { foutputDigis = new TClonesArray("CbmMvdDigi", 1000); foutputDigiMatch = new TClonesArray("CbmMatch", 1000); foutputBuffer = new TClonesArray("CbmMvdHit", 1000); foutputCluster = new TClonesArray("CbmMvdCluster", 1); //not needed khun } + */ Int_t nPlugin = fPluginArray->GetEntriesFast(); @@ -301,36 +310,6 @@ void CbmMvdSensor::SetProduceNoise() // ------------------------------------------------------------------------- -/* -void CbmMvdSensor::SendInput(CbmMvdPoint* point) -{ - - CbmMvdSensorPlugin* pluginFirst; - - CbmMvdSensorTask* digitask; - - pluginFirst = (CbmMvdSensorPlugin*) fPluginArray->At(0); - - if (pluginFirst->GetPluginType() == task) { - TString digitizername = "CbmMvdSensorDigitizerTask"; - TString digitizerTBname = "CbmMvdSensorDigitizerTBTask"; - - if (pluginFirst->ClassName() == digitizername || pluginFirst->ClassName() == digitizerTBname) { - digitask = (CbmMvdSensorTask*) fPluginArray->At(0); - digitask->SetInput(point); - } - - else { - LOG(fatal) << "Invalid input typ"; - } - } - else { - cout << endl << "ERROR!! undefind plugin!" << endl; - } -} -*/ -// ------------------------------------------------------------------------- - void CbmMvdSensor::SendInputToPlugin(Int_t nPlugin, TObject* input) { CbmMvdSensorPlugin* digitask; @@ -340,49 +319,6 @@ void CbmMvdSensor::SendInputToPlugin(Int_t nPlugin, TObject* input) -// ------------------------------------------------------------------------- -void CbmMvdSensor::SendInputDigi(CbmMvdDigi* digi) //for old CF -{ - if (fHitPlugin != -1) { - CbmMvdSensorClusterfinderTask* clustertask = (CbmMvdSensorClusterfinderTask*) fPluginArray->At(fClusterPlugin); - clustertask->SetInputDigi(digi); - } - else { - cout << endl << "Somthing seems fishy here" << endl; - } -} -// ------------------------------------------------------------------------- - - -// ------------------------------------------------------------------------- -void CbmMvdSensor::SendInputDigiToHit(CbmMvdDigi* digi) //for DigiToHit -{ - if (fHitPlugin != -1) { - CbmMvdSensorDigiToHitTask* digitohittask = (CbmMvdSensorDigiToHitTask*) fPluginArray->At(fHitPlugin); - digitohittask->SetInputDigi(digi); - } - else { - cout << endl << "Somthing seems fishy here" << endl; - } -} -// ------------------------------------------------------------------------- - - -//not needed khun/* -// ------------------------------------------------------------------------- -void CbmMvdSensor::SendInputCluster(CbmMvdCluster* cluster) -{ - if (fHitPlugin != -1) { - CbmMvdSensorHitfinderTask* findertask = (CbmMvdSensorHitfinderTask*) fPluginArray->At(fHitPlugin); - findertask->SetInputCluster(cluster); - } - else { - cout << endl << "Somthing seems fishy in SendInputCluster" << endl; - } -} -// ------------------------------------------------------------------------- -//not needed khun */ - // ------------------------------------------------------------------------- @@ -399,11 +335,12 @@ void CbmMvdSensor::ExecChain() FairEventHeader* event = ana->GetEventHeader(); fcurrentEventTime = event->GetEventTime(); } + /* foutputDigis->Clear("C"); foutputDigiMatch->Clear("C"); foutputCluster->Clear("C"); //not needed khun foutputBuffer->Clear("C"); - + */ CbmMvdSensorPlugin* plugin; Int_t nPlugin = fPluginArray->GetEntriesFast(); @@ -425,10 +362,11 @@ void CbmMvdSensor::ExecChain() void CbmMvdSensor::Exec(UInt_t nPlugin) { - foutputDigis->Clear("C"); + /*foutputDigis->Clear("C"); foutputDigiMatch->Clear("C"); foutputCluster->Clear("C"); //not needed khun foutputBuffer->Clear("C"); + */ UInt_t nPluginMax = fPluginArray->GetEntriesFast(); if (nPlugin > nPluginMax) { Fatal(GetName(), " Error - Called non-existing plugin"); } CbmMvdSensorPlugin* plugin = (CbmMvdSensorPlugin*) fPluginArray->At(nPlugin); @@ -441,10 +379,12 @@ void CbmMvdSensor::ExecTo(UInt_t nPlugin) FairPrimaryGenerator* gen = run->GetPrimaryGenerator(); FairMCEventHeader* event = gen->GetEvent(); + /* foutputDigis->Delete(); foutputCluster->Delete(); //not needed khun foutputDigiMatch->Clear("C"); foutputBuffer->Clear("C"); + */ fcurrentEventTime = event->GetT(); @@ -501,6 +441,8 @@ void CbmMvdSensor::ExecFrom(UInt_t nPlugin) } // ------------------------------------------------------------------------- + +/* TClonesArray* CbmMvdSensor::GetOutputArray(Int_t nPlugin) const { @@ -527,15 +469,59 @@ TClonesArray* CbmMvdSensor::GetOutputArray(Int_t nPlugin) const } return NULL; } +*/ + +TClonesArray* CbmMvdSensor::GetOutputArray(Int_t nPlugin) const +{ + + CbmMvdSensorPlugin* plugin=(CbmMvdSensorPlugin*)fPluginArray->At(nPlugin); + return plugin->GetOutputArray(); +} + +/* + if (nPlugin == fHitPlugin) GetOutputBuffer(); + else if (nPlugin == fDigiPlugin) { + CbmMvdSensorDigitizerTask* digiplugin = (CbmMvdSensorDigitizerTask*) fPluginArray->At(nPlugin); + Int_t ArrayLength = digiplugin->GetOutputArray()->GetEntriesFast() - 1; + if (ArrayLength >= 0) { + foutputDigis->AbsorbObjects(digiplugin->GetOutputArray()); + foutputDigiMatch->AbsorbObjects(digiplugin->GetMatchArray()); + //cout << endl << "got digis " << foutputDigis->GetEntriesFast() << " and matches " << foutputDigiMatch->GetEntriesFast() << endl; + } + return (foutputDigis); + } + else if (nPlugin == fClusterPlugin) //khun not needed + { + CbmMvdSensorClusterfinderTask* clusterplugin = (CbmMvdSensorClusterfinderTask*) fPluginArray->At(nPlugin); + Int_t ArrayLength = clusterplugin->GetOutputArray()->GetEntriesFast() - 1; + if (ArrayLength >= 0) foutputCluster->AbsorbObjects(clusterplugin->GetOutputArray(), 0, ArrayLength); + return (foutputCluster); + } + else { + LOG(fatal) << "undefined plugin: " << nPlugin << " called"; + } + return NULL; +} +*/ + // ------------------------------------------------------------------------- +TClonesArray* CbmMvdSensor::GetMatchArray(Int_t nPlugin) const +{ + CbmMvdSensorPlugin* plugin = (CbmMvdSensorPlugin*)fPluginArray-> At (nPlugin); + return plugin->GetMatchArray(); +} // ------------------------------------------------------------------------- Int_t CbmMvdSensor::GetOutputArrayLen(Int_t nPlugin) const { + TClonesArray* tempArray= GetOutputArray(nPlugin); // make sure that the arrays are filled + if (tempArray){return tempArray->GetEntriesFast()-1;} + else { + LOG(fatal) << "undefined plugin called"; + return -1; + } - GetOutputArray(nPlugin); // make sure that the arrays are filled - - if (nPlugin == fDigiPlugin) { return (foutputDigis->GetEntriesFast() - 1); } + /* //not needed khun else if (nPlugin == fClusterPlugin) // && (noCluster==kFALSE)) { @@ -548,14 +534,15 @@ Int_t CbmMvdSensor::GetOutputArrayLen(Int_t nPlugin) const else { LOG(fatal) << "undefined plugin called"; return -1; - } + } */ } // ------------------------------------------------------------------------- +/* // ------------------------------------------------------------------------- TClonesArray* CbmMvdSensor::GetOutputMatch() const { return (foutputDigiMatch); } // ------------------------------------------------------------------------- - +*/ // ------------------------------------------------------------------------- TClonesArray* CbmMvdSensor::GetOutputBuffer() const @@ -563,8 +550,8 @@ TClonesArray* CbmMvdSensor::GetOutputBuffer() const CbmMvdSensorPlugin* plugin = (CbmMvdSensorPlugin*) fPluginArray->At(fPluginArray->GetLast()); - foutputBuffer->AbsorbObjects(plugin->GetOutputArray()); - return (foutputBuffer); + cout << "-W- CbmMvdSensor::GetOutputBuffer: Warning - Use of method depreciated." << endl; + return (plugin->GetOutputArray()); } // ------------------------------------------------------------------------- diff --git a/mvd/CbmMvdSensor.h b/mvd/CbmMvdSensor.h index fd521ef166b184b133796afea362f52a47faf4d4..37ab20480ce6fae541296f8d36a07085fcbd889c 100644 --- a/mvd/CbmMvdSensor.h +++ b/mvd/CbmMvdSensor.h @@ -74,10 +74,6 @@ public: CbmMvdSensorDataSheet* GetDataSheet() { return fSensorData; } void SetDataSheet(CbmMvdSensorDataSheet* sheet) { fSensorData = sheet; } void SetMap(std::map<Int_t, Int_t> SensorMap) { fSensorMap = SensorMap; } // Get Sensor Map to identify every Sensor - //void SendInput(CbmMvdPoint* point); - void SendInputDigi(CbmMvdDigi* digi); - void SendInputDigiToHit(CbmMvdDigi* digi); - void SendInputCluster(CbmMvdCluster* cluster); void SetStation(Int_t StationNumber) { fStationNr = StationNumber; } void SendInputToPlugin(Int_t nPlugin, TObject* input); @@ -142,7 +138,8 @@ public: TClonesArray* GetOutputBuffer() const; TClonesArray* GetOutputArray(Int_t nPlugin) const; - TClonesArray* GetOutputMatch() const; + TClonesArray* GetMatchArray(Int_t nPlugin) const; + //TClonesArray* GetOutputMatch() const; Int_t GetOutputArrayLen(Int_t nPlugin) const; void SetProduceNoise(); @@ -159,11 +156,12 @@ protected: Int_t fClusterPlugin; TString fVolName; // Name of the volume attached to this sensor TString fNodeName; // full name of the volume (including path) of the volume - TClonesArray* foutputDigis; + /*TClonesArray* foutputDigis; TClonesArray* foutputCluster; TClonesArray* foutputDigiMatch; TClonesArray* foutputBuffer; TClonesArray* fcurrentPoints; + */ Double_t fcurrentEventTime; Float_t epsilon[3];