| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a4cc067 commit 0748bbb
16 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,10 +25,10 @@ namespace fdd | |||
| 25 | 25 | ||
| 26 | 26 | struct ChannelData { | |
| 27 | 27 | ||
| 28 | - int mPMNumber = -1; // PhotoMultiplier number (0 to 16) | ||
| 29 | - float mTime = -1024; // Time of Flight | ||
| 30 | - short mChargeADC = -1024; // ADC sample | ||
| 31 | - short mFEEBits = 0; //Bit information from FEE | ||
| 28 | + uint8_t mPMNumber = -1; // PhotoMultiplier number (0 to 16) | ||
| 29 | + int16_t mTime = -1024; // Time of Flight | ||
| 30 | + int16_t mChargeADC = -1024; // ADC sample | ||
| 31 | + uint8_t mFEEBits = 0; //Bit information from FEE | ||
| 32 | 32 | enum Flags { Integrator = 0x1 << 0, | |
| 33 | 33 | DoubleEvent = 0x1 << 1, | |
| 34 | 34 | Event1TimeLost = 0x1 << 2, | |
@@ -40,11 +40,11 @@ struct ChannelData { | |||
| 40 | 40 | TimeLost = 0x1 << 8 }; | |
| 41 | 41 | ||
| 42 | 42 | ChannelData() = default; | |
| 43 | - ChannelData(int channel, float time, short adc, short bits) : mPMNumber(channel), mTime(time), mChargeADC(adc), mFEEBits(bits) {} | ||
| 43 | + ChannelData(uint8_t channel, int time, int adc, uint8_t bits) : mPMNumber(channel), mTime(time), mChargeADC(adc), mFEEBits(bits) {} | ||
| 44 | 44 | ||
| 45 | 45 | void print() const; | |
| 46 | 46 | ||
| 47 | - ClassDefNV(ChannelData, 2); | ||
| 47 | + ClassDefNV(ChannelData, 3); | ||
| 48 | 48 | }; | |
| 49 | 49 | } // namespace fdd | |
| 50 | 50 | } // namespace o2 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,12 +34,12 @@ struct Triggers { | |||
| 34 | 34 | bitCen, | |
| 35 | 35 | bitSCen }; | |
| 36 | 36 | uint8_t triggersignals = 0; // FDD trigger signals | |
| 37 | - int8_t nChanA = -1; // number of fired channels A side | ||
| 38 | - int8_t nChanC = -1; // number of fired channels A side | ||
| 37 | + int8_t nChanA = 0; // number of fired channels A side | ||
| 38 | + int8_t nChanC = 0; // number of fired channels A side | ||
| 39 | 39 | int32_t amplA = -1024; // sum amplitude A side | |
| 40 | 40 | int32_t amplC = -1024; // sum amplitude C side | |
| 41 | - int16_t timeA = -1024; // average time A side | ||
| 42 | - int16_t timeC = -1024; // average time C side | ||
| 41 | + int16_t timeA = 0; // average time A side | ||
| 42 | + int16_t timeC = 0; // average time C side | ||
| 43 | 43 | Triggers() = default; | |
| 44 | 44 | Triggers(uint8_t signals, int8_t chanA, int8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC) | |
| 45 | 45 | { | |
@@ -51,12 +51,19 @@ struct Triggers { | |||
| 51 | 51 | timeA = atimeA; | |
| 52 | 52 | timeC = atimeC; | |
| 53 | 53 | } | |
| 54 | + | ||
| 55 | + bool getOrA() const { return (triggersignals & (1 << bitA)) != 0; } | ||
| 56 | + bool getOrC() const { return (triggersignals & (1 << bitC)) != 0; } | ||
| 57 | + bool getVertex() const { return (triggersignals & (1 << bitVertex)) != 0; } | ||
| 58 | + bool getCen() const { return (triggersignals & (1 << bitCen)) != 0; } | ||
| 59 | + bool getSCen() const { return (triggersignals & (1 << bitSCen)) != 0; } | ||
| 60 | + | ||
| 54 | 61 | void cleanTriggers() | |
| 55 | 62 | { | |
| 56 | 63 | triggersignals = 0; | |
| 57 | - nChanA = nChanC = -1; | ||
| 58 | - amplA = amplC = -1024; | ||
| 59 | - timeA = timeC = -1024; | ||
| 64 | + nChanA = nChanC = 0; | ||
| 65 | + amplA = amplC = 0; | ||
| 66 | + timeA = timeC = 0; | ||
| 60 | 67 | } | |
| 61 | 68 | Triggers getTriggers(); | |
| 62 | 69 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,9 +28,10 @@ constexpr short Ntriggers = 5; | |||
| 28 | 28 | constexpr float IntTimeRes = 0.4; | |
| 29 | 29 | constexpr float PhotoCathodeEfficiency = 0.18; | |
| 30 | 30 | constexpr float ChargePerADC = 0.6e-12; | |
| 31 | - constexpr float PMTransitTime = 6.0; // PM response time (corresponds to 1.9 ns rise time) | ||
| 32 | - constexpr float PMTransparency = 0.25; // Transparency of the first dynode of the PM | ||
| 33 | - constexpr float PMNbOfSecElec = 6.0; // Number of secondary electrons emitted from first dynode (per ph.e.) | ||
| 31 | + constexpr float TimePerTDC = 1. / 0.01302; // time conversion from ns to TDC channels | ||
| 32 | + constexpr float PMTransitTime = 6.0; // PM response time (corresponds to 1.9 ns rise time) | ||
| 33 | + constexpr float PMTransparency = 0.25; // Transparency of the first dynode of the PM | ||
| 34 | + constexpr float PMNbOfSecElec = 6.0; // Number of secondary electrons emitted from first dynode (per ph.e.) | ||
| 34 | 35 | ||
| 35 | 36 | constexpr int NTimeBinsPerBC = 256; // number of samples per BC | |
| 36 | 37 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,24 +81,24 @@ void ReadRaw::readRawData(const LookUpTable& lut) | |||
| 81 | 81 | for (int i = 0; i < eventHeader.nGBTWords; ++i) { | |
| 82 | 82 | mRawFileIn.read(reinterpret_cast<char*>(&eventData[2 * i]), o2::fdd::EventData::PayloadSizeFirstWord); | |
| 83 | 83 | posPayload += o2::fdd::EventData::PayloadSizeFirstWord; | |
| 84 | - chData = {Short_t(lut.getChannel(link, int(eventData[2 * i].channelID))), | ||
| 85 | - Float_t(eventData[2 * i].time), | ||
| 86 | - Short_t(eventData[2 * i].charge), 0}; | ||
| 84 | + chData = {static_cast<uint8_t>(lut.getChannel(link, int(eventData[2 * i].channelID))), | ||
| 85 | + int(eventData[2 * i].time), | ||
| 86 | + int(eventData[2 * i].charge), 0}; | ||
| 87 | 87 | mDigitAccum[intrec].emplace_back(chData); | |
| 88 | 88 | LOG(DEBUG) << " Read 1st half-word: (PMchannel, globalChannel, Q, T, posPayload) = " | |
| 89 | 89 | << std::setw(3) << int(eventData[2 * i].channelID) | |
| 90 | 90 | << std::setw(4) << lut.getChannel(link, int(eventData[2 * i].channelID)) | |
| 91 | 91 | << std::setw(5) << int(eventData[2 * i].charge) | |
| 92 | - << std::setw(5) << float(eventData[2 * i].time) | ||
| 92 | + << std::setw(5) << int(eventData[2 * i].time) | ||
| 93 | 93 | << std::setw(5) << posPayload; | |
| 94 | 94 | ||
| 95 | 95 | Short_t channelIdFirstHalfWord = chData.mPMNumber; | |
| 96 | 96 | ||
| 97 | 97 | mRawFileIn.read(reinterpret_cast<char*>(&eventData[2 * i + 1]), EventData::PayloadSizeSecondWord); | |
| 98 | 98 | posPayload += o2::fdd::EventData::PayloadSizeSecondWord; | |
| 99 | - chData = {Short_t(lut.getChannel(link, (eventData[2 * i + 1].channelID))), | ||
| 100 | - Float_t(eventData[2 * i + 1].time), | ||
| 101 | - Short_t(eventData[2 * i + 1].charge), 0}; | ||
| 99 | + chData = {static_cast<uint8_t>(lut.getChannel(link, int(eventData[2 * i + 1].channelID))), | ||
| 100 | + int(eventData[2 * i + 1].time), | ||
| 101 | + int(eventData[2 * i + 1].charge), 0}; | ||
| 102 | 102 | if (chData.mPMNumber <= channelIdFirstHalfWord) { | |
| 103 | 103 | // Don't save the second half-word if it is only filled with zeroes (empty-data) | |
| 104 | 104 | // TODO: Verify if it works correctly with real data from readout | |
@@ -109,7 +109,7 @@ void ReadRaw::readRawData(const LookUpTable& lut) | |||
| 109 | 109 | << std::setw(3) << int(eventData[2 * i + 1].channelID) | |
| 110 | 110 | << std::setw(4) << lut.getChannel(link, int(eventData[2 * i + 1].channelID)) | |
| 111 | 111 | << std::setw(5) << int(eventData[2 * i + 1].charge) | |
| 112 | - << std::setw(5) << float(eventData[2 * i + 1].time) | ||
| 112 | + << std::setw(5) << int(eventData[2 * i + 1].time) | ||
| 113 | 113 | << std::setw(5) << posPayload; | |
| 114 | 114 | } | |
| 115 | 115 | } | |
@@ -152,7 +152,7 @@ void ReadRaw::writeDigits(const std::string& outputDigitsFilePath) | |||
| 152 | 152 | size_t nStored = 0; | |
| 153 | 153 | size_t first = chDataVecTree.size(); | |
| 154 | 154 | for (auto& sec : digit.second) { | |
| 155 | - chDataVecTree.emplace_back(int(sec.mPMNumber), float(sec.mTime), short(sec.mChargeADC), short(0)); | ||
| 155 | + chDataVecTree.emplace_back(sec.mPMNumber, sec.mTime, sec.mChargeADC, sec.mFEEBits); | ||
| 156 | 156 | nStored++; | |
| 157 | 157 | } | |
| 158 | 158 | chBcVecTree.emplace_back(first, nStored, digit.first, Triggers()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,7 @@ class Digits2Raw | |||
| 60 | 60 | void makeGBTHeader(EventHeader& eventHeader, int link, o2::InteractionRecord const& mIntRecord); | |
| 61 | 61 | void fillSecondHalfWordAndAddData(int iChannelPerLink, int prevPmLink, const o2::InteractionRecord& ir); | |
| 62 | 62 | RawEventData mRawEventData; | |
| 63 | + o2::fdd::Triggers mTriggers; | ||
| 63 | 64 | o2::raw::RawFileWriter mWriter{"FDD"}; | |
| 64 | 65 | bool mOutputPerLink = false; | |
| 65 | 66 | ///////////////////////////////////////////////// | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,7 +44,7 @@ void Digitizer::process(const std::vector<o2::fdd::Hit>& hits, | |||
| 44 | 44 | std::sort(sorted_hits.begin(), sorted_hits.end(), [](o2::fdd::Hit const& a, o2::fdd::Hit const& b) { | |
| 45 | 45 | return a.GetTrackID() < b.GetTrackID(); | |
| 46 | 46 | }); | |
| 47 | - LOG(INFO) << "Pulse"; | ||
| 47 | + //LOG(INFO) << "Pulse"; | ||
| 48 | 48 | //Conversion of hits to the analogue pulse shape | |
| 49 | 49 | for (auto& hit : sorted_hits) { | |
| 50 | 50 | if (hit.GetTime() > 20e3) { | |
@@ -191,18 +191,24 @@ void Digitizer::storeBC(const BCCache& bc, | |||
| 191 | 191 | { | |
| 192 | 192 | //LOG(INFO) << "Storing BC " << bc; | |
| 193 | 193 | ||
| 194 | - int first = digitsCh.size(); | ||
| 194 | + int first = digitsCh.size(), nStored = 0; | ||
| 195 | 195 | for (int ic = 0; ic < Nchannels; ic++) { | |
| 196 | - digitsCh.emplace_back(ic, simulateTimeCFD(bc.pulse[ic]), integrateCharge(bc.pulse[ic]), 0); | ||
| 196 | + float chargeADC = integrateCharge(bc.pulse[ic]); | ||
| 197 | + if (chargeADC != 0) { | ||
| 198 | + digitsCh.emplace_back(ic, int(simulateTimeCFD(bc.pulse[ic])), int(chargeADC), std::rand() % (1 << 8)); | ||
| 199 | + nStored++; | ||
| 200 | + } | ||
| 197 | 201 | } | |
| 198 | 202 | //bc.print(); | |
| 199 | 203 | ||
| 200 | - int nBC = digitsBC.size(); | ||
| 201 | - digitsBC.emplace_back(first, 16, bc, mTriggers); | ||
| 202 | - digitsTrig.emplace_back(bc, 0, 0, 0, 0, 0); | ||
| 204 | + if (nStored != 0) { | ||
| 205 | + int nBC = digitsBC.size(); | ||
| 206 | + digitsBC.emplace_back(first, nStored, bc, mTriggers); | ||
| 207 | + digitsTrig.emplace_back(bc, 0, 0, 0, 0, 0); | ||
| 203 | 208 | ||
| 204 | - for (const auto& lbl : bc.labels) { | ||
| 205 | - labels.addElement(nBC, lbl); | ||
| 209 | + for (const auto& lbl : bc.labels) { | ||
| 210 | + labels.addElement(nBC, lbl); | ||
| 211 | + } | ||
| 206 | 212 | } | |
| 207 | 213 | } | |
| 208 | 214 | ||
@@ -214,7 +220,10 @@ float Digitizer::integrateCharge(const ChannelBCDataF& pulse) | |||
| 214 | 220 | //pulse[iBin] /= ChargePerADC; | |
| 215 | 221 | chargeADC += pulse[iBin]; | |
| 216 | 222 | } | |
| 217 | - //saturation if(chargeADC > )chargeADC = ; | ||
| 223 | + //saturation | ||
| 224 | + if (chargeADC > 4095) { | ||
| 225 | + chargeADC = 4095; | ||
| 226 | + } | ||
| 218 | 227 | ||
| 219 | 228 | //LOG(INFO) <<" Charge " << chargeADC; | |
| 220 | 229 | return std::lround(chargeADC); | |
@@ -241,7 +250,8 @@ float Digitizer::simulateTimeCFD(const ChannelBCDataF& pulse) | |||
| 241 | 250 | } | |
| 242 | 251 | } | |
| 243 | 252 | //LOG(INFO) <<" Time " << timeCFD; | |
| 244 | - return timeCFD; | ||
| 253 | + timeCFD *= TimePerTDC; //ns -> counts | ||
| 254 | + return std::lround(timeCFD); | ||
| 245 | 255 | } | |
| 246 | 256 | //_____________________________________________________________________________ | |
| 247 | 257 | o2::fdd::Digitizer::BCCache& Digitizer::setBCCache(const o2::InteractionRecord& ir) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,15 +101,23 @@ void Digits2Raw::convertDigits(o2::fdd::Digit bcdigits, gsl::span<const ChannelD | |||
| 101 | 101 | iChannelPerLink = 0; | |
| 102 | 102 | prevPmLink = nLinkPm; | |
| 103 | 103 | } | |
| 104 | - if (pmchannels[ich].mChargeADC != 0) { | ||
| 105 | - LOG(DEBUG) << " Store data for channel: " << ich << " PmLink = " << nLinkPm << " "; | ||
| 106 | - auto& newData = mRawEventData.mEventData[iChannelPerLink]; | ||
| 107 | - newData.charge = pmchannels[ich].mChargeADC; | ||
| 108 | - newData.time = pmchannels[ich].mTime; | ||
| 109 | - newData.generateFlags(); | ||
| 110 | - newData.channelID = lut.getModChannel(pmchannels[ich].mPMNumber); | ||
| 111 | - iChannelPerLink++; | ||
| 112 | - } | ||
| 104 | + LOG(DEBUG) << " Store data for channel: " << ich << " PmLink = " << nLinkPm << " "; | ||
| 105 | + auto& newData = mRawEventData.mEventData[iChannelPerLink]; | ||
| 106 | + newData.charge = pmchannels[ich].mChargeADC; | ||
| 107 | + newData.time = pmchannels[ich].mTime; | ||
| 108 | + | ||
| 109 | + newData.numberADC = bool(pmchannels[ich].mFEEBits & ChannelData::Integrator); | ||
| 110 | + newData.isDoubleEvent = bool(pmchannels[ich].mFEEBits & ChannelData::DoubleEvent); | ||
| 111 | + newData.is1TimeLostEvent = bool(pmchannels[ich].mFEEBits & ChannelData::Event1TimeLost); | ||
| 112 | + newData.is2TimeLostEvent = bool(pmchannels[ich].mFEEBits & ChannelData::Event2TimeLost); | ||
| 113 | + newData.isADCinGate = bool(pmchannels[ich].mFEEBits & ChannelData::AdcInGate); | ||
| 114 | + newData.isTimeInfoLate = bool(pmchannels[ich].mFEEBits & ChannelData::TimeTooLate); | ||
| 115 | + newData.isAmpHigh = bool(pmchannels[ich].mFEEBits & ChannelData::AmpTooHigh); | ||
| 116 | + newData.isEventInTVDC = bool(pmchannels[ich].mFEEBits & ChannelData::EventInTrigger); | ||
| 117 | + newData.isTimeInfoLost = bool(pmchannels[ich].mFEEBits & ChannelData::TimeLost); | ||
| 118 | + | ||
| 119 | + newData.channelID = lut.getModChannel(pmchannels[ich].mPMNumber); | ||
| 120 | + iChannelPerLink++; | ||
| 113 | 121 | if (ich == nch - 1) { | |
| 114 | 122 | fillSecondHalfWordAndAddData(iChannelPerLink, prevPmLink, intRecord); | |
| 115 | 123 | } | |
@@ -119,17 +127,41 @@ void Digits2Raw::convertDigits(o2::fdd::Digit bcdigits, gsl::span<const ChannelD | |||
| 119 | 127 | makeGBTHeader(mRawEventData.mEventHeader, sTcmLink, intRecord); | |
| 120 | 128 | mRawEventData.mEventHeader.nGBTWords = 1; | |
| 121 | 129 | auto& tcmdata = mRawEventData.mTCMdata; | |
| 122 | - tcmdata.vertex = 1; | ||
| 123 | - tcmdata.orA = 1; | ||
| 124 | - tcmdata.orC = 0; | ||
| 125 | - tcmdata.sCen = 0; | ||
| 126 | - tcmdata.cen = 0; | ||
| 127 | - tcmdata.nChanA = 0; | ||
| 128 | - tcmdata.nChanC = 0; | ||
| 129 | - tcmdata.amplA = 0; | ||
| 130 | - tcmdata.amplC = 0; | ||
| 131 | - tcmdata.timeA = 0; | ||
| 132 | - tcmdata.timeC = 0; | ||
| 130 | + mTriggers = bcdigits.mTriggers; | ||
| 131 | + | ||
| 132 | + float ampA = mTriggers.amplA; | ||
| 133 | + float ampC = mTriggers.amplC; | ||
| 134 | + if (ampA > 131071) { | ||
| 135 | + ampA = 131071; //2^17 | ||
| 136 | + } | ||
| 137 | + if (ampC > 131071) { | ||
| 138 | + ampC = 131071; //2^17 | ||
| 139 | + } | ||
| 140 | + tcmdata.vertex = mTriggers.getVertex(); | ||
| 141 | + tcmdata.orA = mTriggers.getOrA(); | ||
| 142 | + tcmdata.orC = mTriggers.getOrC(); | ||
| 143 | + tcmdata.sCen = mTriggers.getSCen(); | ||
| 144 | + tcmdata.cen = mTriggers.getCen(); | ||
| 145 | + tcmdata.nChanA = mTriggers.nChanA; | ||
| 146 | + tcmdata.nChanC = mTriggers.nChanC; | ||
| 147 | + tcmdata.amplA = ampA; | ||
| 148 | + tcmdata.amplC = ampC; | ||
| 149 | + tcmdata.timeA = mTriggers.timeA; | ||
| 150 | + tcmdata.timeC = mTriggers.timeC; | ||
| 151 | + LOG(DEBUG) << " TCM triggers read " | ||
| 152 | + << " time A " << mTriggers.timeA << " time C " << mTriggers.timeC | ||
| 153 | + << " amp A " << ampA << " amp C " << ampC | ||
| 154 | + << " N A " << int(mTriggers.nChanA) << " N C " << int(mTriggers.nChanC) | ||
| 155 | + << " trig " | ||
| 156 | + << " ver " << mTriggers.getVertex() << " A " << mTriggers.getOrA() << " C " << mTriggers.getOrC(); | ||
| 157 | + | ||
| 158 | + LOG(DEBUG) << "TCMdata" | ||
| 159 | + << " time A " << tcmdata.timeA << " time C " << tcmdata.timeC | ||
| 160 | + << " amp A " << tcmdata.amplA << " amp C " << tcmdata.amplC | ||
| 161 | + << " N A " << int(tcmdata.nChanA) << " N C " << int(tcmdata.nChanC) | ||
| 162 | + << " trig " | ||
| 163 | + << " ver " << tcmdata.vertex << " A " << tcmdata.orA << " C " << tcmdata.orC | ||
| 164 | + << " size " << sizeof(tcmdata); | ||
| 133 | 165 | ||
| 134 | 166 | auto data = mRawEventData.to_vector(kTRUE); //for tcm module | |
| 135 | 167 | uint32_t linkId = uint32_t(sTcmLink); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | 11 | o2_add_library(FDDWorkflow | |
| 12 | 12 | SOURCES src/DigitReaderSpec.cxx | |
| 13 | - src/DigitWriterSpec.cxx | ||
| 14 | 13 | src/EntropyEncoderSpec.cxx | |
| 15 | 14 | src/EntropyDecoderSpec.cxx | |
| 16 | 15 | src/RecoWorkflow.cxx | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,13 +37,15 @@ class DigitReader : public Task | |||
| 37 | 37 | void run(ProcessingContext& pc) final; | |
| 38 | 38 | ||
| 39 | 39 | private: | |
| 40 | - bool mUseMC = true; // use MC truth | ||
| 40 | + bool mTrigInp = true; // read trigger inputs | ||
| 41 | + bool mUseMC = true; // use MC truth | ||
| 41 | 42 | o2::header::DataOrigin mOrigin = o2::header::gDataOriginFDD; | |
| 42 | 43 | ||
| 43 | 44 | std::string mInputFileName = ""; | |
| 44 | 45 | std::string mDigitTreeName = "o2sim"; | |
| 45 | 46 | std::string mDigitBCBranchName = "FDDDigit"; | |
| 46 | 47 | std::string mDigitChBranchName = "FDDDigitCh"; | |
| 48 | + std::string mTriggerBranchName = "TRIGGERINPUT"; | ||
| 47 | 49 | std::string mDigitMCTruthBranchName = "FDDDigitLabels"; | |
| 48 | 50 | }; | |
| 49 | 51 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments