diff --git a/core/detectors/mvd/CbmMvdDetector.cxx b/core/detectors/mvd/CbmMvdDetector.cxx index a247600eeaa0bbf89b6ff32c60ca65706d10c84c..d14ba5978737195900597f1a1dbbe33e8a67995d 100644 --- a/core/detectors/mvd/CbmMvdDetector.cxx +++ b/core/detectors/mvd/CbmMvdDetector.cxx @@ -20,11 +20,11 @@ #include <Rtypes.h> // for TGenericClassInfo #include <TClonesArray.h> // for TClonesArray +#include <TH1.h> // for Histograms (only base class is used) #include <TNamed.h> // for TNamed #include <TObjArray.h> // for TObjArray #include <TRandom.h> // for TRandom, gRandom #include <TString.h> // for TString, operator==, operator<< -#include <TH1.h> // for Histograms (only base class is used) //_____________________________________________________________________________ CbmMvdDetector* CbmMvdDetector::fInstance = 0; @@ -359,42 +359,46 @@ void CbmMvdDetector::GetMatchArray(Int_t nPlugin, TClonesArray* matchArray) //----------------------------------------------------------------------- -UInt_t CbmMvdDetector::GetMaxHistoNumber(UInt_t nPlugin){ +UInt_t CbmMvdDetector::GetMaxHistoNumber(UInt_t nPlugin) +{ if (!fSensorArray) return -1; - CbmMvdSensor* sensor= (CbmMvdSensor*)fSensorArray->At(0); + CbmMvdSensor* sensor = (CbmMvdSensor*) fSensorArray->At(0); if (sensor->GetPluginArraySize() < nPlugin) return -1; //CbmMvdSensorPlugin* plugin= (CbmMvdSensorPlugin*)sensor->GetPluginArray()->At(nPlugin); - return sensor-> GetNumberOfHistograms(nPlugin); - - + return sensor->GetNumberOfHistograms(nPlugin); }; //----------------------------------------------------------------------- -TH1* CbmMvdDetector::GetHistogram(UInt_t nPlugin, UInt_t nHistogram){ +TH1* CbmMvdDetector::GetHistogram(UInt_t nPlugin, UInt_t nHistogram) +{ if (!fSensorArray) return 0; - CbmMvdSensor* sensor= (CbmMvdSensor*)fSensorArray->At(0); + CbmMvdSensor* sensor = (CbmMvdSensor*) fSensorArray->At(0); if (sensor->GetPluginArraySize() < nPlugin) return 0; - if (nHistogram>=sensor->GetNumberOfHistograms(nPlugin)) return 0; + if (nHistogram >= sensor->GetNumberOfHistograms(nPlugin)) return 0; - TH1* mySummedHistogram = (TH1*)((sensor->GetHistogram(nPlugin, nHistogram))->Clone()); + TH1* mySummedHistogram = (TH1*) ((sensor->GetHistogram(nPlugin, nHistogram))->Clone()); - for (Int_t i=1; i<fSensorArray->GetEntriesFast(); i++) { // Read histograms from all sensors and add them up. - sensor=(CbmMvdSensor*)fSensorArray->At(i); - mySummedHistogram->Add((TH1*)sensor->GetHistogram(nPlugin, nHistogram)); + for (Int_t i = 1; i < fSensorArray->GetEntriesFast(); i++) { // Read histograms from all sensors and add them up. + sensor = (CbmMvdSensor*) fSensorArray->At(i); + mySummedHistogram->Add((TH1*) sensor->GetHistogram(nPlugin, nHistogram)); } - return mySummedHistogram;} + return mySummedHistogram; +} //----------------------------------------------------------------------- -TH1* CbmMvdDetector::GetHistogram(UInt_t nLevel, UInt_t nHistogramNumber, UInt_t sensorInSensorArrayNumber) {return 0;} +TH1* CbmMvdDetector::GetHistogram(UInt_t nLevel, UInt_t nHistogramNumber, UInt_t sensorInSensorArrayNumber) +{ + return 0; +} //----------------------------------------------------------------------- void CbmMvdDetector::Finish() diff --git a/core/detectors/mvd/CbmMvdDetector.h b/core/detectors/mvd/CbmMvdDetector.h index ca5052b6d39d12e8a1ce6d2c4cd3fb8d1888c5df..ceb2fafff0e5e281275812e4538ffbb649331948 100644 --- a/core/detectors/mvd/CbmMvdDetector.h +++ b/core/detectors/mvd/CbmMvdDetector.h @@ -26,8 +26,8 @@ #include <RtypesCore.h> // for Int_t, UInt_t, Bool_t, Float_t, Double_t #include <TClonesArray.h> // for TClonesArray #include <TNamed.h> // for TNamed -#include <TString.h> // for TString #include <TObject.h> +#include <TString.h> // for TString #include <map> // for map @@ -89,7 +89,7 @@ public: void ShowDebugHistos(); TH1* GetHistogram(UInt_t nPlugin, UInt_t nHistogramNumber); TH1* GetHistogram(UInt_t nPlugin, UInt_t nHistogramNumber, UInt_t sensorInSensorArrayNumber); - UInt_t GetMaxHistoNumber(UInt_t nPlugin); + UInt_t GetMaxHistoNumber(UInt_t nPlugin); /** Data Processing */ @@ -105,7 +105,7 @@ public: CbmMvdStationPar* GetParameterFile() { return fParameter; }; void PrintParameter() { fParameter->Print(); }; -/* + /* static void SetSensorTyp(CbmMvdSensorTyp typ) { fSensorTyp = typ; }; void SetSensorArrayFilled(Bool_t value = kTRUE) {fSensorArrayFilled=value;} diff --git a/core/detectors/mvd/CbmMvdSensor.cxx b/core/detectors/mvd/CbmMvdSensor.cxx index 37dcf6b1215d6ae934909d1863883305bf36e87d..338ddbbe2295b90ca0e37440dbcbf6a2b84f7e79 100644 --- a/core/detectors/mvd/CbmMvdSensor.cxx +++ b/core/detectors/mvd/CbmMvdSensor.cxx @@ -385,17 +385,19 @@ TClonesArray* CbmMvdSensor::GetOutputBuffer() const } // ------------------------------------------------------------------------- -TH1* CbmMvdSensor::GetHistogram(UInt_t nPlugin, UInt_t nHisto){ - if(!fPluginArray) return 0; - if(nPlugin>=(UInt_t)fPluginArray->GetEntriesFast()) return 0; - CbmMvdSensorPlugin* myPlugin= (CbmMvdSensorPlugin*)fPluginArray->At(nPlugin); +TH1* CbmMvdSensor::GetHistogram(UInt_t nPlugin, UInt_t nHisto) +{ + if (!fPluginArray) return 0; + if (nPlugin >= (UInt_t) fPluginArray->GetEntriesFast()) return 0; + CbmMvdSensorPlugin* myPlugin = (CbmMvdSensorPlugin*) fPluginArray->At(nPlugin); return myPlugin->GetHistogram(nHisto); } -UInt_t CbmMvdSensor::GetNumberOfHistograms(UInt_t nPlugin){ - if(!fPluginArray) return -1; - if(nPlugin>=(UInt_t)fPluginArray->GetEntriesFast()) return -1; - return ((CbmMvdSensorPlugin*)fPluginArray->At(nPlugin))->GetMaxHistoNumber(); +UInt_t CbmMvdSensor::GetNumberOfHistograms(UInt_t nPlugin) +{ + if (!fPluginArray) return -1; + if (nPlugin >= (UInt_t) fPluginArray->GetEntriesFast()) return -1; + return ((CbmMvdSensorPlugin*) fPluginArray->At(nPlugin))->GetMaxHistoNumber(); } @@ -496,31 +498,33 @@ Int_t CbmMvdSensor::GetFrameNumber(Double_t absoluteTime, Int_t pixelNumberY) co } // ------------------------------------------------------------------------- -Double_t CbmMvdSensor::ComputeIndecatedAnalogTime(Double_t hitMCTime, Float_t diodeCharge){ +Double_t CbmMvdSensor::ComputeIndecatedAnalogTime(Double_t hitMCTime, Float_t diodeCharge) +{ - Double_t delay = fSensorData->ComputeHitDelay(diodeCharge); - Double_t jitter= fSensorData->ComputeHitJitter(diodeCharge); + Double_t delay = fSensorData->ComputeHitDelay(diodeCharge); + Double_t jitter = fSensorData->ComputeHitJitter(diodeCharge); - return hitMCTime + delay+jitter; + return hitMCTime + delay + jitter; } -Double_t CbmMvdSensor::ComputeEndOfBusyTime(Double_t hitMCTime, Float_t diodeCharge, Int_t pixelNumberY) { +Double_t CbmMvdSensor::ComputeEndOfBusyTime(Double_t hitMCTime, Float_t diodeCharge, Int_t pixelNumberY) +{ - Double_t endOfAnalogChannelDeadTime= hitMCTime + fSensorData->ComputeHitDeadTime(diodeCharge); - Int_t frameNumberAtEndOfDeadTime= GetFrameNumber(endOfAnalogChannelDeadTime,pixelNumberY); - Double_t endOfDeadTime = GetFrameEndTime (frameNumberAtEndOfDeadTime); + Double_t endOfAnalogChannelDeadTime = hitMCTime + fSensorData->ComputeHitDeadTime(diodeCharge); + Int_t frameNumberAtEndOfDeadTime = GetFrameNumber(endOfAnalogChannelDeadTime, pixelNumberY); + Double_t endOfDeadTime = GetFrameEndTime(frameNumberAtEndOfDeadTime); /* Anticipated condition for end of deadtime: * Analog electronics must be below threshold AND HEREAFTER a new frame must have started. * Neglected: Tail of the falling edge of the analog pulse is artificially cut. */ - return endOfDeadTime; + return endOfDeadTime; } // ------------------------------------------------------------------------- -Double_t CbmMvdSensor::GetFrameStartTime(Int_t frameNumber) { +Double_t CbmMvdSensor::GetFrameStartTime(Int_t frameNumber) +{ return fSensorStartTime + frameNumber * fSensorData->GetIntegrationTime(); - } // ------------------------------------------------------------------------- @@ -541,9 +545,6 @@ Double_t CbmMvdSensor::GetReadoutTime(Double_t absoluteTime) const // ------------------------------------------------------------------------- - - - void CbmMvdSensor::Print(Option_t* /*opt*/) const { LOG(info) << ToString(); } // ----- Public method Print ------------------------------------------- diff --git a/core/detectors/mvd/CbmMvdSensor.h b/core/detectors/mvd/CbmMvdSensor.h index 5d0aef889b4611be09e3922d0fe6247e0bbfe0e2..7d287ec82f8bf51129c17435bf20c17a61749a2a 100644 --- a/core/detectors/mvd/CbmMvdSensor.h +++ b/core/detectors/mvd/CbmMvdSensor.h @@ -76,7 +76,7 @@ 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); @@ -86,8 +86,6 @@ public: void SendInputToPlugin(Int_t nPlugin, TObject* input); - - /** Coordinate transformations **/ void LocalToTop(Double_t* local, Double_t* lab); void TopToLocal(Double_t* lab, Double_t* local); @@ -95,14 +93,19 @@ public: void PixelToLocal(Int_t pixelNumberX, Int_t pixelNumberY, Double_t* local); void PixelToTop(Int_t pixelNumberX, Int_t pixelNumberY, Double_t* lab); void TopToPixel(Double_t* lab, Int_t& pixelNumberX, Int_t& pixelNumberY); - Int_t GetFrameNumber(Double_t absoluteTime, Int_t pixelNumberY =0) const; + Int_t GetFrameNumber(Double_t absoluteTime, Int_t pixelNumberY = 0) const; Double_t GetFrameStartTime(Int_t frameNumber); - Double_t GetFrameEndTime(Int_t frameNumber) {return GetFrameStartTime (frameNumber+1);} + Double_t GetFrameEndTime(Int_t frameNumber) { return GetFrameStartTime(frameNumber + 1); } Int_t GetDigiPlugin() const { return fDigiPlugin; }; Int_t GetHitPlugin() const { return fHitPlugin; }; Int_t GetClusterPlugin() const { return fClusterPlugin; } TObjArray* GetPluginArray() { return fPluginArray; } - UInt_t GetPluginArraySize() {if (fPluginArray) {return fPluginArray->GetEntriesFast();} else return 0;} + UInt_t GetPluginArraySize() + { + if (fPluginArray) { return fPluginArray->GetEntriesFast(); } + else + return 0; + } Double_t ComputeIndecatedAnalogTime(Double_t hitMCTime, Float_t diodeCharge); Double_t ComputeEndOfBusyTime(Double_t hitMCTime, Float_t diodeCharge, Int_t pixelNumberY); @@ -156,7 +159,7 @@ public: TClonesArray* GetOutputArray(Int_t nPlugin) const; TClonesArray* GetMatchArray(Int_t nPlugin) const; Int_t GetOutputArrayLen(Int_t nPlugin) const; - TH1* GetHistogram(UInt_t nPlugin, UInt_t nHisto); + TH1* GetHistogram(UInt_t nPlugin, UInt_t nHisto); UInt_t GetNumberOfHistograms(UInt_t nPlugin); protected: diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx index 4edd0b58b7ce8f167d8d7ae1830c6a4ce6e00dfa..a93da962b6696a04c5fe74a1e0cb722ade081af4 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx @@ -29,7 +29,7 @@ CbmMvdMimosis::CbmMvdMimosis() // the lower corner, else at upper corner fShutterSign = 1; fIntegrationTime = 5.0e3; // Integration time of the pixels in ns - fEpiTh = 25e-4; // Thickness of the epitaxial layer + fEpiTh = 25e-4; // Thickness of the epitaxial layer fChargeThreshold = 1.; fAnalogThreshold = 90; //Threshold in electrons, must not be below 90e @@ -55,9 +55,9 @@ CbmMvdMimosis::CbmMvdMimosis() fStatesPerFrame = 570; fPixelsPerBank = 64; - fSignalRiseTime = 0.1; // to be updated. - fSignalFallTime = 1e6; // to be updated. - fShaperNormalisationFactor=1.; // to be updated + fSignalRiseTime = 0.1; // to be updated. + fSignalFallTime = 1e6; // to be updated. + fShaperNormalisationFactor = 1.; // to be updated /** Self-organizsation **/ @@ -66,27 +66,27 @@ CbmMvdMimosis::CbmMvdMimosis() } +Double_t CbmMvdMimosis::ComputeHitDeadTime(Float_t charge) +{ + return 2519.5443 * std::pow(charge, 0.035720252); +} //Fast settings, AC -1V -Double_t CbmMvdMimosis::ComputeHitDeadTime(Float_t charge) {return 2519.5443 * std::pow(charge,0.035720252);} //Fast settings, AC -1V - -Double_t CbmMvdMimosis::ComputeHitDelay(Float_t charge){ - - Double_t delay=47591.8471 * std::pow(charge,-0.9990384691); - Double_t delaySigma=11909.5799315438 * std::pow(charge,-1.0784955428); - return delay + fRandom->Gaus(delay,delaySigma); //models the pixel-to-pixel variation in terms of delay +Double_t CbmMvdMimosis::ComputeHitDelay(Float_t charge) +{ + Double_t delay = 47591.8471 * std::pow(charge, -0.9990384691); + Double_t delaySigma = 11909.5799315438 * std::pow(charge, -1.0784955428); + return delay + fRandom->Gaus(delay, delaySigma); //models the pixel-to-pixel variation in terms of delay } -Double_t CbmMvdMimosis::ComputeHitJitter (Float_t charge){ - - Double_t jitter = 194945.6385 * std::pow(charge,-1.6138338012); // Full width of jitter as function of charge - return fRandom->Uniform(-(jitter / 2.), jitter / 2.); +Double_t CbmMvdMimosis::ComputeHitJitter(Float_t charge) +{ + Double_t jitter = 194945.6385 * std::pow(charge, -1.6138338012); // Full width of jitter as function of charge + return fRandom->Uniform(-(jitter / 2.), jitter / 2.); } - - // ----- Destructor ---------------------------------------------------- CbmMvdMimosis::~CbmMvdMimosis() {} // ------------------------------------------------------------------------- diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.h b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.h index b525ab7f977e9efcf57c48c503e44ae7fb9c26b4..fa62cbc3e64a3fa08aaa5285de719541bf3c0644 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.h +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.h @@ -37,9 +37,9 @@ public: Double_t ComputeHitDeadTime(Float_t charge); Double_t ComputeHitDelay(Float_t charge); - Double_t ComputeHitJitter (Float_t charge); + Double_t ComputeHitJitter(Float_t charge); - TRandom* fRandom=gRandom; + TRandom* fRandom = gRandom; /** Destructor **/ ~CbmMvdMimosis(); diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx index be3780053e171e5e76581a2f8fcbe972f6608550..40980bc7a85c3f2da8d8d019d3177421de813d65 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx @@ -59,7 +59,6 @@ CbmMvdSensorDataSheet::CbmMvdSensorDataSheet() , fValidData(kFALSE) - { } @@ -112,19 +111,20 @@ std::string CbmMvdSensorDataSheet::ToString() const // ----------- Standard implementation for backward compatibility based on Lorentz-Model. // ----------- See PhD Christina Dritsa for scientific details on this model. -Double_t CbmMvdSensorDataSheet::ComputeCCE(Float_t chargePointX, Float_t chargePointY,Float_t chargePointZ,Float_t diodeX,Float_t diodeY,Float_t diodeZ) { +Double_t CbmMvdSensorDataSheet::ComputeCCE(Float_t chargePointX, Float_t chargePointY, Float_t chargePointZ, + Float_t diodeX, Float_t diodeY, Float_t diodeZ) +{ return - (0.5 * fLorentzPar0 * fLorentzPar1 / TMath::Pi() - /TMath::Max(1.e-10, + (0.5 * fLorentzPar0 * fLorentzPar1 / TMath::Pi() + / TMath::Max(1.e-10, - ((chargePointX - diodeX) * (chargePointX - diodeX)/ fPixelPitchX / fPixelPitchX) + - ((chargePointY - diodeY) * (chargePointY - diodeY)/ fPixelPitchY / fPixelPitchY) + - 0.25 * fLorentzPar1 * fLorentzPar1 - ) - + fLorentzPar2); + ((chargePointX - diodeX) * (chargePointX - diodeX) / fPixelPitchX / fPixelPitchX) + + ((chargePointY - diodeY) * (chargePointY - diodeY) / fPixelPitchY / fPixelPitchY) + + 0.25 * fLorentzPar1 * fLorentzPar1) + + fLorentzPar2); // Original Equation // Float_t totCharge = (sPoint->charge * fLorentzNorm * (0.5 * fPar0 * fPar1 / TMath::Pi()) @@ -133,7 +133,6 @@ Double_t CbmMvdSensorDataSheet::ComputeCCE(Float_t chargePointX, Float_t chargeP // / fPixelSize / fPixelSize // + 0.25 * fPar1 * fPar1) // + fPar2); - } diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h index 78a975779940faf42fc66571fba097df83f1a400..08d52fe8be4d5848992cd814a967b6aed4c342d6 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h @@ -53,7 +53,7 @@ protected: // Defined according to pixelNumberX=fPixelSign * const * x Int_t fPixelSignY = 1; // Direction of the pixel count Y. // Defined according to pixelNumberY=fPixelSign * const * y -/* + /* <<<<<<< HEAD Int_t fShutterSign = 0; // Direction of the rolling shutter. // 1 => parallel to y-axis, -1 => anti-parallel @@ -70,7 +70,7 @@ protected: //Double_t fSignalRiseTime; //Double_t fSignalFallTime; Double_t fShaperNormalisationFactor; -//>>>>>>> ddd5fbbb (Time response added) + //>>>>>>> ddd5fbbb (Time response added) Double_t fChargeThreshold = 0.; Double_t fSignalRiseTime = nan("NotSet"); @@ -122,17 +122,17 @@ public: virtual Double_t GetIntegrationTime() { return fIntegrationTime; }; virtual Double_t GetEpiThickness() { return fEpiTh; } virtual Double_t GetNoise() { return fNoise; }; -/* + /* <<<<<<< HEAD virtual Double_t GetSignalRiseTime() { return fSignalRiseTime; }; virtual Double_t GetSignalFallTime() { return fSignalFallTime; }; ======= */ - virtual Double_t GetSignalRiseTime (){ return fSignalRiseTime;}; - virtual Double_t GetSignalFallTime (){ return fSignalFallTime;}; - virtual Float_t GetShaperNormalisationFactor(){return fShaperNormalisationFactor;} + virtual Double_t GetSignalRiseTime() { return fSignalRiseTime; }; + virtual Double_t GetSignalFallTime() { return fSignalFallTime; }; + virtual Float_t GetShaperNormalisationFactor() { return fShaperNormalisationFactor; } -//>>>>>>> ddd5fbbb (Time response added) + //>>>>>>> ddd5fbbb (Time response added) /** Description of the sensor for the digitizer **/ @@ -145,19 +145,23 @@ public: virtual Double_t GetChargeThreshold() { return fChargeThreshold; }; -/* + /* <<<<<<< HEAD virtual Int_t GetAnalogThreshold() { return fAnalogThreshold; }; ======= */ - virtual Int_t GetAnalogThreshold () {return fAnalogThreshold;}; + virtual Int_t GetAnalogThreshold() { return fAnalogThreshold; }; - virtual Double_t ComputeHitDeadTime(Float_t charge){return charge * 0.;}; // Multiplication only to suppress "variable not used" warning. - virtual Double_t ComputeHitDelay(Float_t charge){return charge * 0.;}; - virtual Double_t ComputeHitJitter (Float_t charge){return charge * 0.;}; - virtual Double_t ComputeCCE(Float_t chargePointX, Float_t chargePointY,Float_t chargePointZ,Float_t diodeX,Float_t diodeY,Float_t diodeZ); -//>>>>>>> ddd5fbbb (Time response added) + virtual Double_t ComputeHitDeadTime(Float_t charge) + { + return charge * 0.; + }; // Multiplication only to suppress "variable not used" warning. + virtual Double_t ComputeHitDelay(Float_t charge) { return charge * 0.; }; + virtual Double_t ComputeHitJitter(Float_t charge) { return charge * 0.; }; + virtual Double_t ComputeCCE(Float_t chargePointX, Float_t chargePointY, Float_t chargePointZ, Float_t diodeX, + Float_t diodeY, Float_t diodeZ); + //>>>>>>> ddd5fbbb (Time response added) /** ADC description **/ diff --git a/core/detectors/mvd/plugins/CbmMvdSensorPlugin.cxx b/core/detectors/mvd/plugins/CbmMvdSensorPlugin.cxx index 44359a21fe78d570a3967df8f9a631b63e98e9e2..a4c93fb74a7024f30462249c269eb7b4886d2074 100644 --- a/core/detectors/mvd/plugins/CbmMvdSensorPlugin.cxx +++ b/core/detectors/mvd/plugins/CbmMvdSensorPlugin.cxx @@ -7,6 +7,7 @@ // ----- Created 02.02.2012 by M. Deveaux ----- // ------------------------------------------------------------------------- #include "CbmMvdSensorPlugin.h" + #include "TH1.h" // ----- Default constructor ------------------------------------------- @@ -36,9 +37,10 @@ CbmMvdSensorPlugin::CbmMvdSensorPlugin(const char* name) } // ------------------------------------------------------------------------- -TH1* CbmMvdSensorPlugin::GetHistogram (UInt_t number){ - if (fHistoArray){ - if (number<(UInt_t)fHistoArray->GetEntriesFast()) {return (TH1*)fHistoArray->At(number);} +TH1* CbmMvdSensorPlugin::GetHistogram(UInt_t number) +{ + if (fHistoArray) { + if (number < (UInt_t) fHistoArray->GetEntriesFast()) { return (TH1*) fHistoArray->At(number); } } return 0; } @@ -48,5 +50,4 @@ CbmMvdSensorPlugin::~CbmMvdSensorPlugin() {} // ------------------------------------------------------------------------- - ClassImp(CbmMvdSensorPlugin) diff --git a/core/detectors/mvd/plugins/CbmMvdSensorPlugin.h b/core/detectors/mvd/plugins/CbmMvdSensorPlugin.h index c1fb72aaf1075d62684f57dd4a43a74b0a2b8a87..eca681ba33a4abec26e04f8df341b37b74c9d74e 100644 --- a/core/detectors/mvd/plugins/CbmMvdSensorPlugin.h +++ b/core/detectors/mvd/plugins/CbmMvdSensorPlugin.h @@ -21,8 +21,8 @@ #include <Rtypes.h> // for ClassDef #include <RtypesCore.h> // for Bool_t, Int_t, kTRUE -#include <TObject.h> // for TObject #include <TObjArray.h> // for TObjArray +#include <TObject.h> // for TObject class TBuffer; class TClass; @@ -57,8 +57,13 @@ public: virtual TClonesArray* GetOutputArray() { return 0; } virtual TClonesArray* GetMatchArray() { return 0; } virtual TClonesArray* GetWriteArray() { return 0; } - virtual TH1* GetHistogram (UInt_t number); - virtual UInt_t GetMaxHistoNumber() {if (fHistoArray) {return fHistoArray->GetEntriesFast();} else return -1;} + virtual TH1* GetHistogram(UInt_t number); + virtual UInt_t GetMaxHistoNumber() + { + if (fHistoArray) { return fHistoArray->GetEntriesFast(); } + else + return -1; + } virtual void SetInputArray(TClonesArray*) { ; } virtual void SetInput(TObject*) { LOG(error) << "You are sending input to the base class instead to your plugin!"; } @@ -85,8 +90,8 @@ protected: Bool_t initialized; Bool_t fShowDebugHistos; const char* fName; - Int_t fPluginIDNumber; // Identifier for the Plugin for debugging purposes. Hardcode in implementation please. - TObjArray* fHistoArray; // Array to hold and manage histograms for debugging. + Int_t fPluginIDNumber; // Identifier for the Plugin for debugging purposes. Hardcode in implementation please. + TObjArray* fHistoArray; // Array to hold and manage histograms for debugging. private: CbmMvdSensorPlugin& operator=(const CbmMvdSensorPlugin&); diff --git a/macro/mvd/qa/mvd_qa3_digitize.C b/macro/mvd/qa/mvd_qa3_digitize.C index 7fadc0ffa82259a12a86821cdaec9644390d72ba..9d69a075bd7b9dc38cf54e6474aba361c2dc632a 100644 --- a/macro/mvd/qa/mvd_qa3_digitize.C +++ b/macro/mvd/qa/mvd_qa3_digitize.C @@ -107,7 +107,7 @@ void mvd_qa3_digitize(const char* setup = "sis100_electron") cbm::sim::TimeDist timeDist = cbm::sim::TimeDist::Uniform; run.SetDigitizer(ECbmModuleId::kMvd, digi); - run.AddInput(0,inFile, timeDist, 2e4); + run.AddInput(0, inFile, timeDist, 2e4); run.Run(nEvents); // ------------------------------------------------------------------------ @@ -134,5 +134,4 @@ void mvd_qa3_digitize(const char* setup = "sis100_electron") std::cout << "Received HistoArray with Address " << digiHisto << std::endl; std::cout << "The number of entries is " << digiHisto->GetEntriesFast() << std::endl; ((TH1*)digiHisto->At(0))->Draw();*/ - } diff --git a/reco/detectors/mvd/CbmMvdClusterfinder.cxx b/reco/detectors/mvd/CbmMvdClusterfinder.cxx index 9a819fcda6c0358109feda09a4a64b1a9cf20a94..782bfee5b8b02c34a11f8a853c85e07d678b71be 100644 --- a/reco/detectors/mvd/CbmMvdClusterfinder.cxx +++ b/reco/detectors/mvd/CbmMvdClusterfinder.cxx @@ -25,8 +25,6 @@ #include <map> // for allocator, __map_i... #include <utility> // for pair -#include <TClonesArray.h> // for TClonesArray - using std::endl; using std::fixed; using std::setprecision; @@ -113,8 +111,9 @@ void CbmMvdClusterfinder::Exec(Option_t* /*opt*/) if (fVerbose) LOG(debug) << "Total of " << fCluster->GetEntriesFast() << " Cluster in this Event"; if (fVerbose) LOG(debug) << "//----------------------------------------//"; - LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fCluster->GetEntriesFast() << " cluster in " << fixed -/* + LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fCluster->GetEntriesFast() << " cluster in " + << fixed + /* ======= } diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx index 07a7194f5e499847a3ca22c48a7df32cbaec69b0..31bfd007bb847642686b93404aa7dfb2ad2c326e 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx @@ -23,8 +23,7 @@ CbmMvdSensorClusterfinderTask::CbmMvdSensorClusterfinderTask() : CbmMvdSensorClu { fPluginIDNumber = 200; - fPixelUsed=0; - + fPixelUsed = 0; } // ------------------------------------------------------------------------- @@ -86,9 +85,9 @@ CbmMvdSensorClusterfinderTask::CbmMvdSensorClusterfinderTask(Int_t iMode, Int_t , fAddNoise(kFALSE) { fPluginIDNumber = 200; - fInputFrameBuffer=0; - fOutputFrameBuffer=0; - fPixelUsed=0; + fInputFrameBuffer = 0; + fOutputFrameBuffer = 0; + fPixelUsed = 0; } // ------------------------------------------------------------------------- @@ -118,7 +117,7 @@ void CbmMvdSensorClusterfinderTask::InitTask(CbmMvdSensor* mysensor) if (fShowDebugHistos) { - fHistoArray=new TObjArray(); + fHistoArray = new TObjArray(); fResolutionHistoX = new TH1F("SinglePointResolution_X", "SinglePointResolution_X", 10000, -0.0100, 0.0100); fResolutionHistoY = new TH1F("SinglePointResolution_Y", "SinglePointResolution_Y", 10000, -0.0100, 0.0100); @@ -143,8 +142,6 @@ void CbmMvdSensorClusterfinderTask::InitTask(CbmMvdSensor* mysensor) fHistoArray->AddLast(fFullClusterHisto); - - //} @@ -169,7 +166,6 @@ void CbmMvdSensorClusterfinderTask::InitTask(CbmMvdSensor* mysensor) snprintf(histoTotalChargeName, buf_size - 1, "totalChargeInNPixels%i", i + 1); histoTotalCharge = new TH1F(histoTotalChargeName, histoTotalChargeName, 12000, 0, 12000); fTotalChargeInNpixelsArray->AddLast(histoTotalCharge); - }; delete[] histoTotalChargeName; @@ -198,8 +194,9 @@ void CbmMvdSensorClusterfinderTask::InitTask(CbmMvdSensor* mysensor) //LOG(debug) << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName(); //Copy histograms in fPixelChargeHistos to fHistoArray (the array for external communications) - for (Int_t i=0;i<fPixelChargeHistos->GetEntriesFast(); i++) {fHistoArray->AddLast(fPixelChargeHistos->At(i));} - + for (Int_t i = 0; i < fPixelChargeHistos->GetEntriesFast(); i++) { + fHistoArray->AddLast(fPixelChargeHistos->At(i)); + } } // ------------------------------------------------------------------------- @@ -215,59 +212,58 @@ Bool_t CbmMvdSensorClusterfinderTask::ReInit() void CbmMvdSensorClusterfinderTask::ExecChain() { Exec(); } // ------------------------------------------------------------------------- -void CbmMvdSensorClusterfinderTask::Exec() { +void CbmMvdSensorClusterfinderTask::Exec() +{ - Int_t minFrame=0; //smalles frame number in this time slice - Int_t maxFrame=0; //biggest frame number in this time slice + Int_t minFrame = 0; //smalles frame number in this time slice + Int_t maxFrame = 0; //biggest frame number in this time slice // Detect relevant frame numbers from digis in the input fInputBuffer CbmMvdDigi* digi; - if (!fInputBuffer) {Fatal("CbmMvdSensorClusterfinderTask::Exec - fInputBuffer missing", "CbmMvdSensorClusterfinderTask::Exec - fInputBuffer missing");} - if (fInputBuffer->GetEntriesFast()==0) {return;} + if (!fInputBuffer) { + Fatal("CbmMvdSensorClusterfinderTask::Exec - fInputBuffer missing", + "CbmMvdSensorClusterfinderTask::Exec - fInputBuffer missing"); + } + if (fInputBuffer->GetEntriesFast() == 0) { return; } - digi=(CbmMvdDigi*)fInputBuffer->At(0); - minFrame=digi->GetFrameNumber(); - maxFrame=digi->GetFrameNumber(); + digi = (CbmMvdDigi*) fInputBuffer->At(0); + minFrame = digi->GetFrameNumber(); + maxFrame = digi->GetFrameNumber(); - for (Int_t i=0; i<fInputBuffer->GetEntriesFast(); i++) { + for (Int_t i = 0; i < fInputBuffer->GetEntriesFast(); i++) { - digi=(CbmMvdDigi*)fInputBuffer->At(i); - if(digi->GetFrameNumber()>maxFrame){maxFrame=digi->GetFrameNumber();}; - if(digi->GetFrameNumber()<minFrame){minFrame=digi->GetFrameNumber();}; + digi = (CbmMvdDigi*) fInputBuffer->At(i); + if (digi->GetFrameNumber() > maxFrame) { maxFrame = digi->GetFrameNumber(); }; + if (digi->GetFrameNumber() < minFrame) { minFrame = digi->GetFrameNumber(); }; } //Fill frameBuffer for the first frame of interest - for(Int_t i=0; i<fInputBuffer->GetEntriesFast(); i++) { + for (Int_t i = 0; i < fInputBuffer->GetEntriesFast(); i++) { - digi=(CbmMvdDigi*) fInputBuffer->At(i); - if(digi->GetFrameNumber()==minFrame){fInputFrameBuffer->AbsorbObjects(fInputBuffer,i,i);} + digi = (CbmMvdDigi*) fInputBuffer->At(i); + if (digi->GetFrameNumber() == minFrame) { fInputFrameBuffer->AbsorbObjects(fInputBuffer, i, i); } } - // Continue filling starting from the 2nd frame. Two frames are processed by ExecFrame in order to avoid handle time walk - for(Int_t currentFrame=minFrame; maxFrame-1; currentFrame++){ - - + for (Int_t currentFrame = minFrame; maxFrame - 1; currentFrame++) { // Clean up input buffer from possible digis, which were already associated to a cluster while processing the previous frame if (fPixelUsed) { - for (Int_t i=fPixelUsed->GetSize()-1 ; i>=0; i--) { - - if(fPixelUsed->At(i)){fInputFrameBuffer->RemoveAt(i);} + for (Int_t i = fPixelUsed->GetSize() - 1; i >= 0; i--) { + if (fPixelUsed->At(i)) { fInputFrameBuffer->RemoveAt(i); } } - } - delete fPixelUsed; //Reset pixel used array + delete fPixelUsed; //Reset pixel used array // Clean up input buffer from possible digis of the previous frame, which were not associated to a cluster. // With MIMOSIS, this should not happen. @@ -276,24 +272,20 @@ void CbmMvdSensorClusterfinderTask::Exec() { fInputFrameBuffer->Compress(); - for (Int_t i=0; i<fInputFrameBuffer->GetEntriesFast(); i++) { + for (Int_t i = 0; i < fInputFrameBuffer->GetEntriesFast(); i++) { - digi=(CbmMvdDigi*) fInputFrameBuffer->At(i); + digi = (CbmMvdDigi*) fInputFrameBuffer->At(i); - if(digi->GetFrameNumber()<currentFrame-1){ - fInputFrameBuffer->RemoveAt(i); - - } + if (digi->GetFrameNumber() < currentFrame - 1) { fInputFrameBuffer->RemoveAt(i); } } - fInputFrameBuffer->Compress(); //Eliminate possible empty slots in the TClonesArray + fInputFrameBuffer->Compress(); //Eliminate possible empty slots in the TClonesArray // Add data from the next frame. Note: This is the second of two valid frames. - for (Int_t i=0; i<fInputBuffer->GetEntriesFast(); i++) { - digi=(CbmMvdDigi*) fInputBuffer->At(i); - if(digi->GetFrameNumber()==currentFrame+1){ fInputFrameBuffer->AbsorbObjects(fInputBuffer,i,i); } - + for (Int_t i = 0; i < fInputBuffer->GetEntriesFast(); i++) { + digi = (CbmMvdDigi*) fInputBuffer->At(i); + if (digi->GetFrameNumber() == currentFrame + 1) { fInputFrameBuffer->AbsorbObjects(fInputBuffer, i, i); } } @@ -308,19 +300,12 @@ void CbmMvdSensorClusterfinderTask::Exec() { fOutputBuffer->AbsorbObjects(fOutputFrameBuffer); fOutputFrameBuffer->Clear(); - - } delete fPixelUsed; - } - - - - // ----- Public method Exec -------------- void CbmMvdSensorClusterfinderTask::ExecFrame(Int_t currentFrame) { @@ -363,7 +348,6 @@ void CbmMvdSensorClusterfinderTask::ExecFrame(Int_t currentFrame) //LOG(debug) << "registerde pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY(); - fDigiMap[a] = k; }; @@ -444,7 +428,6 @@ void CbmMvdSensorClusterfinderTask::ExecFrame(Int_t currentFrame) } // loop on digis - clusterArray->clear(); delete clusterArray; @@ -672,7 +655,9 @@ void CbmMvdSensorClusterfinderTask::UpdateDebugHistos(CbmMvdCluster* cluster) void CbmMvdSensorClusterfinderTask::Finish() { - if (kFALSE&&fShowDebugHistos) { //Reaction to ShowHistograms at the finish of the initial FairTask. Obsolete, thus switched off for now + if ( + kFALSE + && fShowDebugHistos) { //Reaction to ShowHistograms at the finish of the initial FairTask. Obsolete, thus switched off for now LOG(info) << "============================================================"; LOG(info) << GetName() << "::Finish: Total events skipped: " << fCounter; LOG(info) << "============================================================"; diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.h b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.h index 97934c7fc89e5eaaf0f98cb7e5d68d6d2a3acadc..634e30ed3dfaa9748b83e5020b1211c1638ba1d2 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.h +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.h @@ -19,7 +19,6 @@ #include "TArrayS.h" #include "TCanvas.h" -#include <TClonesArray.h> #include "TH1.h" #include "TH1F.h" #include "TH2.h" @@ -59,8 +58,8 @@ public: /** Task execution **/ void ExecChain(); - void Exec(); // Processes time slice by organizing data and calling ExecFrame for each hardware frame. - void ExecFrame(Int_t currentFrame); // Processes data of a given frame + consecutive frame (time walk). + void Exec(); // Processes time slice by organizing data and calling ExecFrame for each hardware frame. + void ExecFrame(Int_t currentFrame); // Processes data of a given frame + consecutive frame (time walk). /** Intialisation **/ void InitTask(CbmMvdSensor* mySensor); diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.h b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.h index c33252c826e8bca5b54ad0b336e505b11991444a..af365c9b93454b6927c614060700a4d11c78d042 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.h +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.h @@ -15,14 +15,12 @@ #include "CbmMvdDigi.h" #include "CbmMvdPoint.h" #include "CbmMvdSensor.h" -#include "CbmMvdCluster.h" #include "CbmMvdSensorTask.h" #include "FairTask.h" #include "TArrayS.h" #include "TCanvas.h" -#include <TClonesArray.h> #include "TH1.h" #include "TH1F.h" #include "TH2.h" diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx index aeb00561994cbdfc645043eb5c1a824fd717fdca..00e9c50465b118ed8dbabf94f1b2b8b26cf66bab 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx @@ -268,7 +268,8 @@ void CbmMvdSensorHitfinderTask::CreateHit(CbmMvdCluster* cluster, TVector3& pos, //LOG(debug) << "adding new hit to fHits at X: " << pos.X() << " , Y: "<< pos.Y() << " , Z: " << pos.Z() << " , from cluster nr " << cluster->GetRefId(); Int_t nHits = fOutputBuffer->GetEntriesFast(); - new ((*fOutputBuffer)[nHits]) CbmMvdHit(fSensor->GetStationNr(), pos, dpos, indexX, indexY, cluster->GetRefId(), 0); // Bug - Should be the sensor ID + new ((*fOutputBuffer)[nHits]) CbmMvdHit(fSensor->GetStationNr(), pos, dpos, indexX, indexY, cluster->GetRefId(), + 0); // Bug - Should be the sensor ID CbmMvdHit* currentHit = (CbmMvdHit*) fOutputBuffer->At(nHits); currentHit->SetTime(fSensor->GetCurrentEventTime()); currentHit->SetTimeError(fSensor->GetIntegrationtime() / 2); diff --git a/sim/detectors/mvd/CbmMvdDigitizer.cxx b/sim/detectors/mvd/CbmMvdDigitizer.cxx index cdbecde152a1eca4bfcf8d298871a5327ad1ed3e..3cbb300d9fdfbee332a86f96b3fcb9d7c58dfe3f 100644 --- a/sim/detectors/mvd/CbmMvdDigitizer.cxx +++ b/sim/detectors/mvd/CbmMvdDigitizer.cxx @@ -18,16 +18,16 @@ #include <FairRootManager.h> // for FairRootManager #include <Logger.h> // for Logger, LOG +#include <TCanvas.h> // for TCanvas #include <TClonesArray.h> // for TClonesArray +#include <TFile.h> // for TFile +#include <TH1.h> // for TH1, base class used for general histograms #include <TObjArray.h> // fir TObjArray #include <TObject.h> // for TObject #include <TRandom.h> // for TRandom #include <TRandom3.h> // for gRandom #include <TStopwatch.h> // for TStopwatch #include <TString.h> // for TString -#include <TCanvas.h> // for TCanvas -#include <TH1.h> // for TH1, base class used for general histograms -#include <TFile.h> // for TFile #include <cassert> // for assert #include <iomanip> // for setprecision, setw, __iom_t5 @@ -71,7 +71,7 @@ CbmMvdDigitizer::CbmMvdDigitizer() { fTmpDigi = new TClonesArray("CbmMvdDigi", 1000); fTmpMatch = new TClonesArray("CbmMatch", 1000); - fHistoArray=0; + fHistoArray = 0; } // ------------------------------------------------------------------------- @@ -107,7 +107,7 @@ CbmMvdDigitizer::CbmMvdDigitizer(const char* name, Int_t iMode, Int_t /*iVerbose fTmpDigi = new TClonesArray("CbmMvdDigi", 1000); fTmpMatch = new TClonesArray("CbmMatch", 1000); - fHistoArray=0; + fHistoArray = 0; } // ------------------------------------------------------------------------- @@ -143,7 +143,7 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) CbmMvdPoint* point = 0; fTmpDigi->Clear(); fTmpMatch->Clear(); - cout << fName <<"Debug: 1" << endl; + cout << fName << "Debug: 1" << endl; if (fInputPoints->GetEntriesFast() > 0) { LOG(debug) << "//----------------------------------------//"; @@ -155,14 +155,13 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) // Distribute the points from the input array to the sensors - for (Int_t i = 0; i < nPoints; i++) { point = (CbmMvdPoint*) fInputPoints->At(i); fDetector->SendInputToSensorPlugin(point->GetDetectorID(), nTargetPlugin, static_cast<TObject*>(point)); } - cout << fName <<"Debug: 2" << endl; + cout << fName << "Debug: 2" << endl; // Execute the plugged digitizer plugin for all sensors LOG(debug) << fName << ": Execute DigitizerPlugin Nr. " << fDigiPluginNr; @@ -357,12 +356,13 @@ InitStatus CbmMvdDigitizer::ReInit() { return kSUCCESS; } // ----- Virtual method Finish ----------------------------------------- void CbmMvdDigitizer::Finish() -{ Int_t i = DetectPlugin (100); - LOG(debug) << "CbmMvdDigitizer::Finish() Autodetect: " << i <<" Manual Detect " << fDigiPluginNr; - LOG(debug) << "finishing"; - LOG(debug) << "Trying to show Histograms: " << fShowDebugHistos; +{ + Int_t i = DetectPlugin(100); + LOG(debug) << "CbmMvdDigitizer::Finish() Autodetect: " << i << " Manual Detect " << fDigiPluginNr; + LOG(debug) << "finishing"; + LOG(debug) << "Trying to show Histograms: " << fShowDebugHistos; - if(fShowDebugHistos){ + if (fShowDebugHistos) { CollectHistograms(); //DisplayDebugHistos(); SafeDebugHistosToFile("TestHistoFile.root"); @@ -376,93 +376,89 @@ void CbmMvdDigitizer::Finish() // ------------------------------------------------------------------------- -void CbmMvdDigitizer::CollectHistograms() { +void CbmMvdDigitizer::CollectHistograms() +{ // detect correct plugin in the Task-array - Int_t nTargetPlugin=DetectPlugin(100); + Int_t nTargetPlugin = DetectPlugin(100); LOG(debug) << "CbmMvdDigitizer::CollectHistograms - Targeting nTargetPlugin= " << nTargetPlugin; - if(!fHistoArray) { + if (!fHistoArray) { LOG(debug) << "CbmMvdDigitizer::CollectHistograms - Created new TObjArray"; - fHistoArray=new TObjArray(); - - - + fHistoArray = new TObjArray(); } else { LOG(debug) << "CbmMvdDigitizer::CollectHistograms - Cleared new TObjArray"; fHistoArray->Clear(); - }; //initialize array without deleting histograms by themselves + }; //initialize array without deleting histograms by themselves - for(UInt_t i=0; i<fDetector->GetMaxHistoNumber(nTargetPlugin); i++){ + for (UInt_t i = 0; i < fDetector->GetMaxHistoNumber(nTargetPlugin); i++) { // This all histograms in the sensors - LOG(debug) << "CbmMvdDigitizer::CollectHistograms - Trying to read histogram "<<i; - fHistoArray->AddLast((TObject*)fDetector->GetHistogram(nTargetPlugin,i)); - + LOG(debug) << "CbmMvdDigitizer::CollectHistograms - Trying to read histogram " << i; + fHistoArray->AddLast((TObject*) fDetector->GetHistogram(nTargetPlugin, i)); } - - - - - }; // ------------------------------------------------------------------------- // Function to display histograms at Finish, must call ShowDebugHistograms before. -void CbmMvdDigitizer::DisplayDebugHistos() { - - TCanvas* c = 0; - char myChar=0; - - //c->Divide(3, 3); - if (!fHistoArray) {LOG(info) << "CbmMvdDigitizer::DisplayDebugHistos - Error: fHistoArray not initialized. Disabling histograms."; return;} - for(Int_t i=0; i<9; i++){ - if (i>=fHistoArray->GetEntriesFast()){continue;} - LOG(debug) << "Trying to display histogram" << i; - myChar=48+(char)i; - TString myCanvasName= "DigiCanvas"+myChar; - LOG(debug) << "Trying to generate Canvas with name" << myCanvasName; - c=new TCanvas(myCanvasName, myCanvasName, 150, 10, 800, 600); - - //c-> cd(i); - ((TH1*)fHistoArray->At(i))->Draw(); +void CbmMvdDigitizer::DisplayDebugHistos() +{ + TCanvas* c = 0; + char myChar = 0; - } - //LOG(info) << "CbmMvdDigitizerL::Finish - Fit of the total cluster charge"; - //fTotalChargeHisto->Fit("landau"); + //c->Divide(3, 3); + if (!fHistoArray) { + LOG(info) << "CbmMvdDigitizer::DisplayDebugHistos - Error: fHistoArray not initialized. Disabling histograms."; + return; + } + for (Int_t i = 0; i < 9; i++) { + if (i >= fHistoArray->GetEntriesFast()) { continue; } + LOG(debug) << "Trying to display histogram" << i; + myChar = 48 + (char) i; + TString myCanvasName = "DigiCanvas" + myChar; + LOG(debug) << "Trying to generate Canvas with name" << myCanvasName; + c = new TCanvas(myCanvasName, myCanvasName, 150, 10, 800, 600); + + //c-> cd(i); + ((TH1*) fHistoArray->At(i))->Draw(); + } + //LOG(info) << "CbmMvdDigitizerL::Finish - Fit of the total cluster charge"; + //fTotalChargeHisto->Fit("landau"); - //c->Draw(); + //c->Draw(); }; // ------------------------------------------------------------------------- // Function safes histograms to file, must call ShowDebugHistograms before. -void CbmMvdDigitizer::SafeDebugHistosToFile(TString histoFile) { - - if (!fHistoArray) {LOG(info) << "CbmMvdDigitizerL::SafeDebugHistosToFile - Error: fHistoArray not initialized. Disabling histograms."; return;} - TFile* gFileCopy=gFile; - TFile* myFile=new TFile(histoFile,"Recreate"); - LOG(info) << "CbmMvdDigitizer::SafeDebugHistosToFile - Writing histograms to file: " << histoFile; - - for (Int_t i=0;i<fHistoArray->GetEntriesFast(); i++) { +void CbmMvdDigitizer::SafeDebugHistosToFile(TString histoFile) +{ - LOG(debug) << "CbmMvdDigitizer::SafeDebugHistosToFil - Saving histogram number " << i; - ((TH1*)fHistoArray->At(i))->Write();} - myFile->Close(); - gFile=gFileCopy; + if (!fHistoArray) { + LOG(info) << "CbmMvdDigitizerL::SafeDebugHistosToFile - Error: fHistoArray not initialized. Disabling histograms."; + return; + } + TFile* gFileCopy = gFile; + TFile* myFile = new TFile(histoFile, "Recreate"); + LOG(info) << "CbmMvdDigitizer::SafeDebugHistosToFile - Writing histograms to file: " << histoFile; + for (Int_t i = 0; i < fHistoArray->GetEntriesFast(); i++) { + LOG(debug) << "CbmMvdDigitizer::SafeDebugHistosToFil - Saving histogram number " << i; + ((TH1*) fHistoArray->At(i))->Write(); + } + myFile->Close(); + gFile = gFileCopy; }; - // ----- Private method Reset ------------------------------------------ void CbmMvdDigitizer::Reset() {} // ------------------------------------------------------------------------- diff --git a/sim/detectors/mvd/CbmMvdDigitizer.h b/sim/detectors/mvd/CbmMvdDigitizer.h index b71fe7b704a8291056f0f70ed0c042ec3f1645a1..b75e935a7c822fb0f14e6295d39f22ea97e8ea79 100644 --- a/sim/detectors/mvd/CbmMvdDigitizer.h +++ b/sim/detectors/mvd/CbmMvdDigitizer.h @@ -72,12 +72,19 @@ public: } // set the misalignment in cm void BuildEvent(); - void ShowDebugHistograms() { fShowDebugHistos = kTRUE; } // Requests Task to create the histograms. Call before calling Init() - void DisplayDebugHistos() ; // Function to display histograms at Finish, must call ShowDebugHistograms before. - void SafeDebugHistosToFile(TString histoFile); // Function safes histograms to file, must call ShowDebugHistograms before. - void CollectHistograms(); // Collects histograms from the sensors and safes them in TObjArray* fHistoArray. - // Histos are NOT copied, copy manually if wanted. - TObjArray* GetHistograms(){return fHistoArray;}; // Access to Histos. They are NOT copied, clone manually if wanted. + void ShowDebugHistograms() + { + fShowDebugHistos = kTRUE; + } // Requests Task to create the histograms. Call before calling Init() + void DisplayDebugHistos(); // Function to display histograms at Finish, must call ShowDebugHistograms before. + void + SafeDebugHistosToFile(TString histoFile); // Function safes histograms to file, must call ShowDebugHistograms before. + void CollectHistograms(); // Collects histograms from the sensors and safes them in TObjArray* fHistoArray. + // Histos are NOT copied, copy manually if wanted. + TObjArray* GetHistograms() + { + return fHistoArray; + }; // Access to Histos. They are NOT copied, clone manually if wanted. void SetProduceNoise() { fNoiseSensors = kTRUE; }; Int_t DetectPlugin(Int_t pluginID); diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.cxx b/sim/detectors/mvd/CbmMvdPixelCharge.cxx index 0c9b26fff0fcec1e0ba94cca4ede7f889503342a..75f8b5899067d0453f308daf097bd401e043123a 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.cxx +++ b/sim/detectors/mvd/CbmMvdPixelCharge.cxx @@ -37,9 +37,9 @@ void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t ti { Float_t chargeContr = fTrackCharge; -// for (auto charge : fPointWeight) { -// chargeContr -= charge; -// } + // for (auto charge : fPointWeight) { + // chargeContr -= charge; + // } if (chargeContr > 0.) { fCharge.push_back(fTrackCharge); @@ -56,7 +56,7 @@ void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t ti fDominatorIndex = fPointWeight.size(); fMaxChargeContribution = chargeContr; } - fTrackCharge=0.; + fTrackCharge = 0.; } } diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.h b/sim/detectors/mvd/CbmMvdPixelCharge.h index 5808e750989d2d4ca98c49993f064ff774164d10..3fb14d4c9a2aefb6e3b883b2168ff26a27192307 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.h +++ b/sim/detectors/mvd/CbmMvdPixelCharge.h @@ -35,7 +35,6 @@ public: void AddCharge(Float_t charge) { fTrackCharge = fTrackCharge + charge; }; - Int_t GetX() { return fChannelNrX; }; Int_t GetY() { return fChannelNrY; }; Float_t GetMaxChargeContribution() { return fMaxChargeContribution; }; @@ -46,33 +45,62 @@ public: std::vector<Float_t>& GetPointX() { return fPointX; } std::vector<Float_t>& GetPointY() { return fPointY; } std::vector<Float_t>& GetPointWeight() { return fPointWeight; } -/*<<<<<<< HEAD + /*<<<<<<< HEAD std::vector<Double_t>& GetTime() { return fTime; } Float_t GetPixelTime() { return fPixelTime; } ======= */ - std::vector<Double_t>& GetTime() {return fTime;} + std::vector<Double_t>& GetTime() { return fTime; } std::vector<Float_t>& GetCharge() { return fCharge; }; - Float_t GetPixelTime() { if (GetNContributors()!=0) {return fTime.front();} else {return -1.;};} //kept for backward compatibility - - Float_t GetEarliestHitTime(){if (GetNContributors()!=0) {return fTime.front();} else {return -1.;}}; - Float_t GetLatestHitTime(){if (GetNContributors()!=0) {return fTime.back();} else {return -1.;}}; - - Float_t GetEarliestHitCharge(){if (GetNContributors()!=0) {return fCharge.front();}else {return -1.;}}; - Float_t GetLatestHitCharge() {if (GetNContributors()!=0) {return fCharge.back();}else {return -1.;}}; - - Float_t GetEndOfBusyTime() {return fEndOfBusyTime;} - -//>>>>>>> ddd5fbbb (Time response added) - - void SetEndOfBusyTime(Double_t endOfBusyTime) {fEndOfBusyTime=endOfBusyTime;} + Float_t GetPixelTime() + { + if (GetNContributors() != 0) { return fTime.front(); } + else { + return -1.; + }; + } //kept for backward compatibility + + Float_t GetEarliestHitTime() + { + if (GetNContributors() != 0) { return fTime.front(); } + else { + return -1.; + } + }; + Float_t GetLatestHitTime() + { + if (GetNContributors() != 0) { return fTime.back(); } + else { + return -1.; + } + }; + + Float_t GetEarliestHitCharge() + { + if (GetNContributors() != 0) { return fCharge.front(); } + else { + return -1.; + } + }; + Float_t GetLatestHitCharge() + { + if (GetNContributors() != 0) { return fCharge.back(); } + else { + return -1.; + } + }; + + Float_t GetEndOfBusyTime() { return fEndOfBusyTime; } + + //>>>>>>> ddd5fbbb (Time response added) + + void SetEndOfBusyTime(Double_t endOfBusyTime) { fEndOfBusyTime = endOfBusyTime; } virtual void Clear(Option_t* = "") {}; private: - -/* + /* <<<<<<< HEAD Float_t fCharge = {-1.}; Float_t fMaxChargeContribution = {0.}; @@ -97,27 +125,27 @@ private: */ //Float_t fCharge = {-1.}; Float_t fMaxChargeContribution = {0.}; - Float_t fDominatingPointX = {-1.}; - Float_t fDominatingPointY = {-1.}; - Short_t fContributors = {0}; - Int_t fChannelNrX = {0}; - Int_t fChannelNrY = {0}; - Float_t fTrackCharge = {0.}; - Int_t fDominatorTrackId = {-1}; - Int_t fDominatorPointId = {-1}; - Short_t fDominatorIndex = {0}; - Float_t fPixelTime = {-1.}; - Double_t fEndOfBusyTime=-1.; - - std::vector<Int_t> fTrackId = {}; - std::vector<Int_t> fPointId = {}; - std::vector<Float_t> fPointWeight = {}; - std::vector<Float_t> fPointX = {}; - std::vector<Float_t> fPointY = {}; - std::vector<Double_t> fTime = {}; - std::vector<Float_t> fCharge = {}; - std::vector<CbmLink> fLink = {}; -//>>>>>>> ddd5fbbb (Time response added) + Float_t fDominatingPointX = {-1.}; + Float_t fDominatingPointY = {-1.}; + Short_t fContributors = {0}; + Int_t fChannelNrX = {0}; + Int_t fChannelNrY = {0}; + Float_t fTrackCharge = {0.}; + Int_t fDominatorTrackId = {-1}; + Int_t fDominatorPointId = {-1}; + Short_t fDominatorIndex = {0}; + Float_t fPixelTime = {-1.}; + Double_t fEndOfBusyTime = -1.; + + std::vector<Int_t> fTrackId = {}; + std::vector<Int_t> fPointId = {}; + std::vector<Float_t> fPointWeight = {}; + std::vector<Float_t> fPointX = {}; + std::vector<Float_t> fPointY = {}; + std::vector<Double_t> fTime = {}; + std::vector<Float_t> fCharge = {}; + std::vector<CbmLink> fLink = {}; + //>>>>>>> ddd5fbbb (Time response added) ClassDef(CbmMvdPixelCharge, 1); }; diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx index c0e593234dcb0576efb814ff386cbf20cbbb88b0..7de80248cef588537d3b5d07792c016190cda9b0 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx @@ -346,7 +346,7 @@ InitStatus CbmMvdSensorDigitizerTask::ReadSensorInformation() CbmMvdSensorDataSheet* sensorData; sensorData = fSensor->GetDataSheet(); if (!sensorData) { return kERROR; } - fSensorDataSheet=sensorData; + fSensorDataSheet = sensorData; fPixelSizeX = sensorData->GetPixelPitchX(); fPixelSizeY = sensorData->GetPixelPitchY(); @@ -418,7 +418,6 @@ void CbmMvdSensorDigitizerTask::Exec() fDigiMatch->Clear("C"); - if (fInputPoints->GetEntriesFast() > 0) { for (Int_t iPoint = 0; iPoint < fInputPoints->GetEntriesFast(); iPoint++) { @@ -437,8 +436,8 @@ void CbmMvdSensorDigitizerTask::Exec() //The digitizer acts only on particles, which crossed the station. //Particles generated in the sensor or being absorbed in this sensor are ignored if (TMath::Abs(point->GetZOut() - point->GetZ()) < 0.9 * fEpiTh) { - LOG(debug) << "hit not on chip with thickness " << fEpiTh*10000 << "µm"; - LOG(debug) << "hit not on chip with length " << TMath::Abs(point->GetZOut() - point->GetZ())*10000 << "µm"; + LOG(debug) << "hit not on chip with thickness " << fEpiTh * 10000 << "µm"; + LOG(debug) << "hit not on chip with length " << TMath::Abs(point->GetZOut() - point->GetZ()) * 10000 << "µm"; continue; } // Reject for the time being light nuclei (no digitization modell yet) @@ -462,11 +461,8 @@ void CbmMvdSensorDigitizerTask::Exec() */ - if (fproduceNoise) ProduceNoise(); - - - } + } else { //LOG(debug)<< "No input found on Sensor " << fSensor->GetSensorNr() << " from " << fInputPoints->GetEntriesFast()<< " McPoints"; @@ -482,103 +478,104 @@ void CbmMvdSensorDigitizerTask::Exec() } // end of exec // ------------------------------------------------------------------------- -void CbmMvdSensorDigitizerTask::ProduceDigis(){ - pair<Int_t, Int_t> thispoint; - Int_t nDigis = 0; - CbmMvdPixelCharge* pixel; - - GetEventInfo(fInputNr, fEventNr, fEventTime); - LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge = " << fPixelCharge->GetEntriesFast(); +void CbmMvdSensorDigitizerTask::ProduceDigis() +{ + pair<Int_t, Int_t> thispoint; + Int_t nDigis = 0; + CbmMvdPixelCharge* pixel; + GetEventInfo(fInputNr, fEventNr, fEventTime); + LOG(debug) << "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge = " << fPixelCharge->GetEntriesFast(); - for (Int_t i = 0; i < fPixelCharge->GetEntriesFast(); i++) { - pixel = (CbmMvdPixelCharge*) fPixelCharge->At(i); -// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Length of array : " << fPixelCharge->GetEntriesFast(); -// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i << " Address = " << pixel; -// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelChargeTime = " << pixel->GetEndOfBusyTime(); -// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - EventTime = " << fEventTime; + for (Int_t i = 0; i < fPixelCharge->GetEntriesFast(); i++) { + pixel = (CbmMvdPixelCharge*) fPixelCharge->At(i); + // LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Length of array : " << fPixelCharge->GetEntriesFast(); + // LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i << " Address = " << pixel; + // LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelChargeTime = " << pixel->GetEndOfBusyTime(); + // LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - EventTime = " << fEventTime; - if (pixel->GetEndOfBusyTime()>fEventTime){ //LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - will care for this later"; - continue;} - /* The digi is only generated once the busy-time has passed. This is an easy way to avoid double counting of hits. + if (pixel->GetEndOfBusyTime() + > fEventTime) { //LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - will care for this later"; + continue; + } + /* The digi is only generated once the busy-time has passed. This is an easy way to avoid double counting of hits. * If no digi is formed, the initial hit information remains stored in the CbmMvdPixelCharge */ -// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i << " Address = " << pixel; - Int_t numberOfContributorCausingHit=CheckForHit(pixel); - - LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge >" << pixel->GetEarliestHitCharge() ; - - if (numberOfContributorCausingHit==-1){// pixel did not fire and busy time has expired. Forget about it. - thispoint = std::make_pair(pixel->GetX(), pixel->GetY()); - fChargeMap.erase(thispoint); // Delete entry in the fChargeMap (points from coordinate to the pixel - fPixelCharge->RemoveAt(i); // Delete the pixelCharge object - LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge " << i << " deleted (to few charge)."; + // LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i << " Address = " << pixel; + Int_t numberOfContributorCausingHit = CheckForHit(pixel); + LOG(debug) << " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge >" << pixel->GetEarliestHitCharge(); - continue; - } - -// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Starting to create Digi from PixelCharge " << i; + if (numberOfContributorCausingHit == -1) { // pixel did not fire and busy time has expired. Forget about it. + thispoint = std::make_pair(pixel->GetX(), pixel->GetY()); + fChargeMap.erase(thispoint); // Delete entry in the fChargeMap (points from coordinate to the pixel + fPixelCharge->RemoveAt(i); // Delete the pixelCharge object + LOG(debug) << " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge " << i << " deleted (to few charge)."; - Int_t diodeCharge= pixel->GetCharge()[numberOfContributorCausingHit] + GetPixelCharge(pixel, pixel->GetTime()[numberOfContributorCausingHit]); - // Compute charge causing the hit. Note: GetPixelCharge does not account for the charge caused by the last hit if handed over the time of the last hit as the - // signal in the shaper did not yet build up. Therefore, this charge is added explicitely. - LOG(debug)<< " --- CbmMvdSensorDigitizerTask::ProduceDigis() - DiodeCharge0 = " << pixel->GetCharge()[0]; - LOG(debug)<< " --- CbmMvdSensorDigitizerTask::ProduceDigis() - Full diode charge = " << diodeCharge; + continue; + } - Double_t analogHitTime= fSensor->ComputeIndecatedAnalogTime(pixel->GetTime()[numberOfContributorCausingHit], diodeCharge); + // LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Starting to create Digi from PixelCharge " << i; - // Write Digis + Int_t diodeCharge = pixel->GetCharge()[numberOfContributorCausingHit] + + GetPixelCharge(pixel, pixel->GetTime()[numberOfContributorCausingHit]); + // Compute charge causing the hit. Note: GetPixelCharge does not account for the charge caused by the last hit if handed over the time of the last hit as the + // signal in the shaper did not yet build up. Therefore, this charge is added explicitely. - nDigis = fDigis->GetEntriesFast(); + LOG(debug) << " --- CbmMvdSensorDigitizerTask::ProduceDigis() - DiodeCharge0 = " << pixel->GetCharge()[0]; + LOG(debug) << " --- CbmMvdSensorDigitizerTask::ProduceDigis() - Full diode charge = " << diodeCharge; - new ((*fDigis)[nDigis]) CbmMvdDigi(fSensor->GetSensorNr(), pixel->GetX(), pixel->GetY(), diodeCharge, - fPixelSizeX, fPixelSizeY, fEventTime+analogHitTime, fSensor->GetFrameNumber(fEventTime+analogHitTime, pixel->GetY())); + Double_t analogHitTime = + fSensor->ComputeIndecatedAnalogTime(pixel->GetTime()[numberOfContributorCausingHit], diodeCharge); + // Write Digis - new ((*fOutputBuffer)[nDigis]) - CbmMvdDigi(fSensor->GetSensorNr(), pixel->GetX(), pixel->GetY(), diodeCharge, - fPixelSizeX, fPixelSizeY, fEventTime+analogHitTime, fSensor->GetFrameNumber(fEventTime+analogHitTime, pixel->GetY())); + nDigis = fDigis->GetEntriesFast(); - // To Do: Time and pixel charge are now in an array. Write function testing if the pixel is busy at a given time. - // Write function which computes the status of the pixel at the time of readout and which cell one has to readout. + new ((*fDigis)[nDigis]) + CbmMvdDigi(fSensor->GetSensorNr(), pixel->GetX(), pixel->GetY(), diodeCharge, fPixelSizeX, fPixelSizeY, + fEventTime + analogHitTime, fSensor->GetFrameNumber(fEventTime + analogHitTime, pixel->GetY())); - new ((*fDigiMatch)[nDigis]) CbmMatch(); - CbmMatch* match = (CbmMatch*) fDigiMatch->At(nDigis); - for (Int_t iLink = 0; iLink < pixel->GetNContributors(); iLink++) { - if (pixel->GetTrackID()[iLink] > -2) { - match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink], fEventNr, fInputNr); - std::cout << "CbmMvdSensorDigitizerTask::ProduceDigis() : PointID= " <<pixel->GetPointID()[iLink] << std::endl; - } + new ((*fOutputBuffer)[nDigis]) + CbmMvdDigi(fSensor->GetSensorNr(), pixel->GetX(), pixel->GetY(), diodeCharge, fPixelSizeX, fPixelSizeY, + fEventTime + analogHitTime, fSensor->GetFrameNumber(fEventTime + analogHitTime, pixel->GetY())); - else - match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink]); - } + // To Do: Time and pixel charge are now in an array. Write function testing if the pixel is busy at a given time. + // Write function which computes the status of the pixel at the time of readout and which cell one has to readout. - thispoint = std::make_pair(pixel->GetX(), pixel->GetY()); - fChargeMap.erase(thispoint); // Delete entry in the fChargeMap (points from coordinate to the pixel - fPixelCharge->RemoveAt(i); // Delete the pixelCharge object - LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge " << i << " deleted (digi produced)."; + new ((*fDigiMatch)[nDigis]) CbmMatch(); + CbmMatch* match = (CbmMatch*) fDigiMatch->At(nDigis); + for (Int_t iLink = 0; iLink < pixel->GetNContributors(); iLink++) { + if (pixel->GetTrackID()[iLink] > -2) { + match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink], fEventNr, fInputNr); + std::cout << "CbmMvdSensorDigitizerTask::ProduceDigis() : PointID= " << pixel->GetPointID()[iLink] << std::endl; + } + else + match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink]); } -// LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge before compress = " << fPixelCharge->GetEntriesFast(); + thispoint = std::make_pair(pixel->GetX(), pixel->GetY()); + fChargeMap.erase(thispoint); // Delete entry in the fChargeMap (points from coordinate to the pixel + fPixelCharge->RemoveAt(i); // Delete the pixelCharge object + LOG(debug) << " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge " << i << " deleted (digi produced)."; + } - fPixelCharge->Compress(); + // LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge before compress = " << fPixelCharge->GetEntriesFast(); -// LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge after compress = " << fPixelCharge->GetEntriesFast(); + fPixelCharge->Compress(); + // LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge after compress = " << fPixelCharge->GetEntriesFast(); } - - // ------------------------------------------------------------------------- -void CbmMvdSensorDigitizerTask::CleanPixelChargeList(){ +void CbmMvdSensorDigitizerTask::CleanPixelChargeList() +{ // So far a code fragment @@ -607,41 +604,43 @@ void CbmMvdSensorDigitizerTask::CleanPixelChargeList(){ } */ - } // ------------------------------------------------------------------------- -Int_t CbmMvdSensorDigitizerTask::CheckForHit(CbmMvdPixelCharge* pixel){ +Int_t CbmMvdSensorDigitizerTask::CheckForHit(CbmMvdPixelCharge* pixel) +{ /* Intended to spot the number of contributors to the pixel charge, which fired the pixel. * The number of the contributor is returned */ - if (!fSensorDataSheet) {std::cout << " - E - CbmMvdSensorDigitizerTask::CheckForHit : Missing Datasheet." << std::endl;} + if (!fSensorDataSheet) { + std::cout << " - E - CbmMvdSensorDigitizerTask::CheckForHit : Missing Datasheet." << std::endl; + } -// std::vector<Float_t>& chargeArray=pixel->GetCharge(); -// if(chargeArray.size() != pixel->GetNContributors()) {Fatal("ContributorCrash","ContributorCrash");} -// -// for(Int_t i=0; i<pixel->GetNContributors(); i++){ std::cout << " " << chargeArray[i];} -// std::cout << std::endl; + // std::vector<Float_t>& chargeArray=pixel->GetCharge(); + // if(chargeArray.size() != pixel->GetNContributors()) {Fatal("ContributorCrash","ContributorCrash");} + // + // for(Int_t i=0; i<pixel->GetNContributors(); i++){ std::cout << " " << chargeArray[i];} + // std::cout << std::endl; - if (pixel->GetEarliestHitCharge() > fSensorDataSheet->GetAnalogThreshold()) {return 0;} + if (pixel->GetEarliestHitCharge() > fSensorDataSheet->GetAnalogThreshold()) { return 0; } /* The pixel fired immedeately, easiest case.else ... * Else: Check if a later impact fired the pixel */ - Int_t nContributors=pixel->GetNContributors(); - Int_t charge=0; + Int_t nContributors = pixel->GetNContributors(); + Int_t charge = 0; // Get charge and time arrays from pixel (both stl::vector) - for(Int_t i=1; i<nContributors; i++){ + for (Int_t i = 1; i < nContributors; i++) { // compute charge at the time of the impinging of particle i accounting for pixel history. // pixel->GetCharge[i] stands for the charge of the particle under study, GetPixelCharge wraps up the history. - charge=pixel->GetCharge()[i]+GetPixelCharge(pixel, pixel->GetTime()[i]); - if(charge>fSensorDataSheet->GetAnalogThreshold()){return i;} + charge = pixel->GetCharge()[i] + GetPixelCharge(pixel, pixel->GetTime()[i]); + if (charge > fSensorDataSheet->GetAnalogThreshold()) { return i; } } return -1; @@ -649,28 +648,36 @@ Int_t CbmMvdSensorDigitizerTask::CheckForHit(CbmMvdPixelCharge* pixel){ // ------------------------------------------------------------------------- -Int_t CbmMvdSensorDigitizerTask::GetPixelCharge(CbmMvdPixelCharge* myPixel, Double_t readoutTime) { -/* Adds the accumulated charge of the pixel until readout time. +Int_t CbmMvdSensorDigitizerTask::GetPixelCharge(CbmMvdPixelCharge* myPixel, Double_t readoutTime) +{ + /* Adds the accumulated charge of the pixel until readout time. * Accounts for a signal rise and signal fall time (clearance) of the analog amplifier. */ - Int_t pixelCharge=0; - Double_t pixelSignalRiseTime=fSensorDataSheet->GetSignalRiseTime(); - Double_t pixelSignalFallTime=fSensorDataSheet->GetSignalFallTime(); - Int_t nHits=myPixel->GetNContributors(); + Int_t pixelCharge = 0; + Double_t pixelSignalRiseTime = fSensorDataSheet->GetSignalRiseTime(); + Double_t pixelSignalFallTime = fSensorDataSheet->GetSignalFallTime(); + Int_t nHits = myPixel->GetNContributors(); - for(Int_t hitNr=0; hitNr<nHits; hitNr++){ - Int_t hitTime=myPixel->GetTime()[hitNr]; - if (hitTime>readoutTime){break;} - Int_t hitCharge=myPixel->GetCharge()[hitNr]; + for (Int_t hitNr = 0; hitNr < nHits; hitNr++) { + Int_t hitTime = myPixel->GetTime()[hitNr]; + if (hitTime > readoutTime) { break; } + Int_t hitCharge = myPixel->GetCharge()[hitNr]; //pixelCharge=pixelCharge+hitCharge; //Use ideal charge accumulation in the pixel at this time - pixelCharge=pixelCharge + hitCharge * (1- TMath::Exp(-(readoutTime-hitTime)/pixelSignalRiseTime)); //exponential signal rise of the analog charge - pixelCharge=pixelCharge - hitCharge * (1- TMath::Exp(-(readoutTime-hitTime)/pixelSignalFallTime)); //exponential signal fall of the analog charge - pixelCharge=pixelCharge * fSensorDataSheet->GetShaperNormalisationFactor(); - + pixelCharge = pixelCharge + + hitCharge + * (1 + - TMath::Exp(-(readoutTime - hitTime) + / pixelSignalRiseTime)); //exponential signal rise of the analog charge + pixelCharge = pixelCharge + - hitCharge + * (1 + - TMath::Exp(-(readoutTime - hitTime) + / pixelSignalFallTime)); //exponential signal fall of the analog charge + pixelCharge = pixelCharge * fSensorDataSheet->GetShaperNormalisationFactor(); } return pixelCharge; @@ -695,13 +702,6 @@ Bool_t CbmMvdSensorDigitizerTask::GetPixelIsBusy(CbmMvdPixelCharge* myPixel, Dou */ - - - - - - - // ------------------------------------------------------------------------------ @@ -1049,15 +1049,15 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) fCurrentTotalCharge += sPoint->charge; //compute the charge distributed to this pixel by this segment -// Float_t totCharge = (sPoint->charge * fLorentzNorm * (0.5 * fPar0 * fPar1 / TMath::Pi()) -// / TMath::Max(1.e-10, (((Current[0] - xCentre) * (Current[0] - xCentre)) -// + ((Current[1] - yCentre) * (Current[1] - yCentre))) -// / fPixelSize / fPixelSize -// + 0.25 * fPar1 * fPar1) -// + fPar2); + // Float_t totCharge = (sPoint->charge * fLorentzNorm * (0.5 * fPar0 * fPar1 / TMath::Pi()) + // / TMath::Max(1.e-10, (((Current[0] - xCentre) * (Current[0] - xCentre)) + // + ((Current[1] - yCentre) * (Current[1] - yCentre))) + // / fPixelSize / fPixelSize + // + 0.25 * fPar1 * fPar1) + // + fPar2); - Float_t totCharge= sPoint->charge * fLorentzNorm * - fSensorDataSheet-> ComputeCCE(xCentre, yCentre, 0, Current[0], Current[1],0); + Float_t totCharge = + sPoint->charge * fLorentzNorm * fSensorDataSheet->ComputeCCE(xCentre, yCentre, 0, Current[0], Current[1], 0); if (totCharge < 1) { @@ -1074,8 +1074,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) // LOG(debug) << "Map size is now " << fChargeMap.size(); // Pixel not yet in map -> Add new pixel if (fChargeMapIt == fChargeMap.end()) { - pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) CbmMvdPixelCharge( - totCharge, ix, iy); + pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) CbmMvdPixelCharge(totCharge, ix, iy); //LOG(debug) << "new charched pixel with charge " << totCharge << " at " << ix << " " << iy; // fPixelChargeShort.push_back(pixel); // LOG(debug) << "added pixel to ChargeShort vector "; @@ -1120,19 +1119,19 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) point->GetPointId(), point->GetTrackID()); - // So far, the charge created by this MC-hit in a given pixel was added up in the Pixel charge objects. // Digest charge closes the summing and adds the MC information related to the hit. The MC information will be forwarded to the digi links later. // Digest charge also stores the history of the pixel to process possible dead times of the sensor. - Float_t latestHitCharge=pixelCharge->GetLatestHitCharge(); - Double_t endOfBusyTime= fSensor->ComputeEndOfBusyTime(fEventTime + point->GetTime(), latestHitCharge, pixelCharge->GetY()); - /* LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - latestHitCharge = "<< latestHitCharge; + Float_t latestHitCharge = pixelCharge->GetLatestHitCharge(); + Double_t endOfBusyTime = + fSensor->ComputeEndOfBusyTime(fEventTime + point->GetTime(), latestHitCharge, pixelCharge->GetY()); + /* LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - latestHitCharge = "<< latestHitCharge; LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - MCTime = "<< fEventTime + point->GetTime(); LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - EndOfBusyTime = "<< endOfBusyTime; */ - if (endOfBusyTime > pixelCharge->GetEndOfBusyTime()) {pixelCharge->SetEndOfBusyTime(endOfBusyTime);} + if (endOfBusyTime > pixelCharge->GetEndOfBusyTime()) { pixelCharge->SetEndOfBusyTime(endOfBusyTime); } /* Next, the pixelChargeObject is combined with a time information on the endOfBusyTime of the pixelChargeObject. * This end of busy is reached once the related channel is ready for receiving new hit information. @@ -1140,14 +1139,14 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) * Note: This endOfBusyTime is not equal to the analog dead time of the channel but accounts also for the frame readout. */ - LOG(debug) << "CbmMvdSensorDigitizerTask: Produced pixelCharge with charge " << latestHitCharge; - + LOG(debug) << "CbmMvdSensorDigitizerTask: Produced pixelCharge with charge " << latestHitCharge; } else { LOG(warning) << "Warning working on broken pixel "; } } - LOG(debug) << "CbmMvdSensorDigitizerTask: Produced cluster with " << fPixelChargeShort.size() << " active pixels and with total charge of " << totClusterCharge; + LOG(debug) << "CbmMvdSensorDigitizerTask: Produced cluster with " << fPixelChargeShort.size() + << " active pixels and with total charge of " << totClusterCharge; if (fShowDebugHistos) { //LOG(debug) << "produced " << fPixelChargeShort.size() << " Digis with total charge of " << totClusterCharge; TVector3 momentum, position; @@ -1191,8 +1190,8 @@ void CbmMvdSensorDigitizerTask::ProduceNoise() fChargeMapIt = fChargeMap.find(thispoint); if (fChargeMapIt == fChargeMap.end()) { - pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) - CbmMvdPixelCharge(1000, xPix, yPix); // TODO: Add time + pixel = + new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) CbmMvdPixelCharge(1000, xPix, yPix); // TODO: Add time pixel->DigestCharge(Current[0], Current[1], fEventTime, 0, -4); fChargeMap[thispoint] = pixel; } @@ -1239,7 +1238,7 @@ void CbmMvdSensorDigitizerTask::InitTask(CbmMvdSensor* mySensor) // Initialize histogramms used for debugging if (fShowDebugHistos) { - fHistoArray=new TObjArray(); + fHistoArray = new TObjArray(); LOG(info) << "Show debug histos in this Plugin"; fRandomGeneratorTestHisto = new TH1F("TestHisto", "TestHisto", 1000, 0, 12000); fResolutionHistoX = new TH1F("DigiResolutionX", "DigiResolutionX", 1000, -.005, .005); @@ -1267,8 +1266,6 @@ void CbmMvdSensorDigitizerTask::InitTask(CbmMvdSensor* mySensor) fHistoArray->AddLast(fSegResolutionHistoZ); fHistoArray->AddLast(fTotalChargeHisto); fHistoArray->AddLast(fTotalSegmentChargeHisto); - - } /** Screen output **/ @@ -1300,7 +1297,7 @@ void CbmMvdSensorDigitizerTask::Finish() // PrintParameters(); - if (kFALSE&&fShowDebugHistos) { // Finish code of initial FairTask. Switched off right now. + if (kFALSE && fShowDebugHistos) { // Finish code of initial FairTask. Switched off right now. TCanvas* c = new TCanvas("DigiCanvas", "DigiCanvas", 150, 10, 800, 600); c->Divide(3, 3); c->cd(1);