Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions DAQ/fcl/prolog.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ BEGIN_PROLOG
DAQ : {
producers : {
makeSD: { module_type: StrawDigisFromArtdaqFragments
diagLevel : 0 ## not used yet
debugMode : 0 ##
debugBits : [ "bit0:0", "bit1:0" ] ## 100 in total, configure printout details
saveWaveforms : false
missingDTCHeaders: false ## true for runs <= 107246
keyOnMnid : false ##
geography : [] ## for now, a real job should include a real map
diagLevel : 0 ## not used yet
debugMode : 0 ##
debugBits : [ "bit0:0", "bit1:0" ] ## 100 in total, configure printout details
saveWaveforms : false
missingDTCHeaders : false ## true for runs <= 107246
keyOnMnid : false ##
geography : [] ## for now, a real job should include a real map
allowOfflineFallbackWhenPanelMapMissing : false
forceOfflineAddressing : false
}
}

Expand All @@ -37,6 +39,7 @@ DAQ : {
minEDep : 0.0006 ## in MeV
debugMode : false
debugBits : [ "bit0:0" ]
channelsToSkip : [ ] ## by default all channels are good
fillHistograms : false
}
}
Expand Down
2 changes: 2 additions & 0 deletions DAQ/src/CrvDigisFromArtdaqFragmentsFEBII_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ namespace mu2e
if(_produceNZS) event.put(std::move(crvDigisNZS),"NZS");
event.put(std::move(crvDaqErrors));
event.put(std::move(crvStatus));

if(_diagLevel>1) std::cout << std::format("N(CRV digis):{}\n",crvDigis->size());
}

} //namespace mu2e
Expand Down
178 changes: 108 additions & 70 deletions DAQ/src/StrawDigisFromArtdaqFragments_module.cc

Large diffs are not rendered by default.

52 changes: 51 additions & 1 deletion DAQ/src/StrawHitFilter_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include <memory>
#include <map>

#include "Offline/ProditionsService/inc/ProditionsHandle.hh"
#include "Offline/TrackerConditions/inc/TrackerPanelMap.hh"

namespace mu2e {
class StrawHitFilter : public art::EDFilter {
public:
Expand All @@ -40,6 +43,7 @@ namespace mu2e {
fhicl::Atom<float> maxDt {Name("maxDt" ), Comment("max abs(DT)")};
fhicl::Atom<float> minEDep {Name("minEDep" ), Comment("min EDep")};
fhicl::Atom<int> minNGoodHits {Name("minNGoodHits" ), Comment("minNStrawDigis")};
fhicl::Sequence<int> channelsToSkip{Name("channelsToSkip"), Comment("a list of channels to skip")};
fhicl::Atom<bool> fillHistograms{Name("fillHistograms"), Comment("fill histogrms, default:false")};
};

Expand All @@ -50,6 +54,11 @@ namespace mu2e {
TH1F* dt ;
TH1F* edep;
} _hist[2];
// channels disabled from the trigger
struct Channel_t {
int mnid;
int straw;
};

using Parameters = art::EDFilter::Table<Config>;

Expand All @@ -75,14 +84,17 @@ namespace mu2e {
float _maxDt;
float _minEDep;
int _minNGoodHits;
std::vector<Channel_t> _channelsToSkip; // channels not to look at when searching for good hits
int _fillHistograms;

int _nevt;
int _nevp;
int _nsht;
int _nshg;

const mu2e::StrawHitCollection* _shc;
const mu2e::StrawHitCollection* _shc;
ProditionsHandle<TrackerPanelMap> _tpm_h;
const TrackerPanelMap* _trkPanelMap;

const art::Event* _event;
int _rn;
Expand Down Expand Up @@ -112,6 +124,23 @@ namespace mu2e {
sscanf(key,"bit%i:%i",&index,&value);
_debugBit[index] = value;
}
//-----------------------------------------------------------------------------
// parse channels to skip
//-----------------------------------------------------------------------------
int ndat = conf().channelsToSkip().size();
for (int i=0; i<ndat; i+=2) {
Channel_t ch;
ch.mnid = conf().channelsToSkip().at(i);
ch.straw = conf().channelsToSkip().at(i+1);
_channelsToSkip.push_back(ch);
}

int n_disabled_channels = _channelsToSkip.size();
for (int i=0; i<n_disabled_channels; i++) {
Channel_t* ch = & _channelsToSkip[i];
std::cout << std::format("disabled : mnid:MN{:03d} straw:{:02d}\n",ch->mnid, ch->straw);
}

_run_initialized = false;
}

Expand Down Expand Up @@ -194,6 +223,8 @@ namespace mu2e {

_event = &ArtEvent; // should always be the first line

_trkPanelMap = &_tpm_h.get(_event->id());

if (_debugMode) print_("-- START");

++_nevt;
Expand All @@ -216,6 +247,25 @@ namespace mu2e {

for (int i = 0; i<_nsht; ++i) {
const mu2e::StrawHit* sh = &_shc->at(i);

int pln = sh->strawId().plane();
int pnl = sh->strawId().panel();
const TrkPanelMap::Row* tpm = _trkPanelMap->panel_map_by_offline_ind(pln,pnl);
int hit_mnid = tpm->mnid();

bool skip = false;

int n_disabled_channels = _channelsToSkip.size();
for (int i=0; i<n_disabled_channels; i++) {
Channel_t* ch = & _channelsToSkip[i];
if ((hit_mnid == ch->mnid) and (sh->strawId().straw() == ch->straw)) {
skip = true;
break;
}
}

if (skip) continue;

if (fabs(sh->dt()) > _maxDt ) continue;
if (sh->energyDep() < _minEDep) continue;
_nshg++;
Expand Down
17 changes: 14 additions & 3 deletions RecoDataProducts/inc/StrawHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,32 @@ namespace mu2e {
TrkTypes::TDCTimes _time; // (ns)
TrkTypes::TOTTimes _tot; // (ns)
float _energyDep; // (MeV)
float _digital_pmp; // adcs
float _digital_pedestal; // adcs

public:

StrawHit():
_strawId(StrawId(-1)),
_time{0.0,0.0},
_tot{0.0,0.0},
_energyDep(0.){
_energyDep(0.),
_digital_pmp(0.0),
_digital_pedestal(0.0){
}

// Constructor for a hit that came from an unpacked digi, either
// from data or from the full MC chain.
StrawHit( StrawId strawId,
TrkTypes::TDCTimes const& time,
TrkTypes::TOTTimes const& tot,
float energyDep ):
float energyDep ,
float digital_pmp,
float digital_pedestal):
_strawId(strawId),_time(time),_tot(tot),
_energyDep(energyDep) {
_energyDep(energyDep),
_digital_pmp(digital_pmp),
_digital_pedestal(digital_pedestal){
}

// Accessors
Expand All @@ -53,6 +61,9 @@ namespace mu2e {
float TOT(StrawEnd end=StrawEnd::cal) const { return _tot[end];}
float energyDep() const { return _energyDep; }

float digitalPulseHeight() const { return _digital_pmp; }
float digitalPedestal() const { return _digital_pedestal; }

// Accept compiler generated versions of d'tor, copy c'tor, assignment operator.
bool operator==(StrawHit const& other) const {
return (_strawId==other._strawId&&
Expand Down
122 changes: 121 additions & 1 deletion TrackerConditions/data/TrkPanelMap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ TABLE TrkPanelMap 108000-120470
062, 15, 3, 25, 3, 5, 3
055, 15, 0, 25, 3, 3, 3
#------------------------------------------------------------------------------
TABLE TrkPanelMap 120471-200000
TABLE TrkPanelMap 120471-121699
# mnid dtcid link pln ppid pnl zfc
#------------------------------------------------------------------------------
# root [1] print_trk_panel_map(0); // slot 0
Expand Down Expand Up @@ -244,3 +244,123 @@ TABLE TrkPanelMap 120471-200000
063, 14, 4, 25, 3, 1, 3
062, 14, 3, 25, 3, 5, 3
055, 14, 0, 25, 3, 3, 3
#------------------------------------------------------------------------------
TABLE TrkPanelMap 121700-200000
# mnid dtcid link pln ppid pnl zfc
# root [11] print_trk_panel_map(9)
137, 1, 5, 18, 8, 2, 0
045, 1, 2, 18, 8, 0, 0
129, 1, 1, 18, 8, 4, 0
106, 1, 4, 18, 8, 1, 1
098, 1, 3, 18, 8, 5, 1
078, 1, 0, 18, 8, 3, 1
204, 2, 4, 19, 22, 1, 2
208, 2, 1, 19, 22, 3, 2
226, 2, 2, 19, 22, 5, 2
230, 2, 5, 19, 22, 2, 3
223, 2, 0, 19, 22, 4, 3
228, 2, 3, 19, 22, 0, 3
# root [12] print_trk_panel_map(10)
199, 17, 4, 20, 9, 1, 0
080, 17, 1, 20, 9, 3, 0
133, 17, 2, 20, 9, 5, 0
278, 17, 5, 20, 9, 2, 1
122, 17, 0, 20, 9, 4, 1
150, 17, 3, 20, 9, 0, 1
270, 18, 5, 21, 19, 2, 2
202, 18, 2, 21, 19, 0, 2
072, 18, 1, 21, 19, 4, 2
200, 18, 4, 21, 19, 1, 3
193, 18, 3, 21, 19, 5, 3
112, 18, 0, 21, 19, 3, 3
# root [4] print_trk_panel_map(11)
043, 16, 5, 22, 33, 2, 0
169, 16, 2, 22, 33, 0, 0
052, 16, 1, 22, 33, 4, 0
039, 16, 4, 22, 33, 1, 1
035, 16, 3, 22, 33, 5, 1
053, 16, 0, 22, 33, 3, 1
275, 15, 4, 23, 29, 1, 2
254, 15, 1, 23, 29, 3, 2
229, 15, 3, 23, 29, 0, 3
274, 15, 5, 23, 29, 5, 3
151, 15, 0, 23, 29, 4, 3
225, 15, 2, 23, 29, 2, 3
# root [10] print_trk_panel_map(12)
139, 14, 4, 24, 27, 1, 0
145, 14, 1, 24, 27, 3, 0
082, 14, 2, 24, 27, 5, 0
155, 14, 5, 24, 27, 2, 1
132, 14, 0, 24, 27, 4, 1
207, 14, 3, 24, 27, 0, 1
067, 13, 5, 25, 3, 2, 2
064, 13, 2, 25, 3, 0, 2
069, 13, 1, 25, 3, 4, 2
063, 13, 4, 25, 3, 1, 3
062, 13, 3, 25, 3, 5, 3
055, 13, 0, 25, 3, 3, 3
# root [9] print_trk_panel_map(13)
117, 36, 5, 26, 23, 2, 0
233, 36, 2, 26, 23, 0, 0
263, 36, 1, 26, 23, 4, 0
066, 36, 4, 26, 23, 1, 1
264, 36, 3, 26, 23, 5, 1
138, 36, 0, 26, 23, 3, 1
250, 35, 4, 27, 30, 1, 2
280, 35, 1, 27, 30, 3, 2
220, 35, 2, 27, 30, 5, 2
272, 35, 5, 27, 30, 2, 3
153, 35, 0, 27, 30, 4, 3
158, 35, 3, 27, 30, 0, 3
# root [8] print_trk_panel_map(14)
147, 4, 4, 28, 10, 1, 0
258, 4, 1, 28, 10, 3, 2
104, 4, 2, 28, 10, 5, 0
084, 4, 5, 28, 10, 2, 1
203, 4, 0, 28, 10, 4, 1
103, 4, 3, 28, 10, 0, 1
048, 3, 5, 29, 1, 2, 2
057, 3, 2, 29, 1, 0, 2
051, 3, 1, 29, 1, 4, 2
047, 3, 4, 29, 1, 1, 3
105, 3, 3, 29, 1, 5, 3
128, 3, 0, 29, 1, 3, 3
# root [5] print_trk_panel_map(15)
068, 5, 5, 30, 36, 2, 0
251, 5, 2, 30, 36, 0, 0
109, 5, 1, 30, 36, 4, 0
231, 5, 4, 30, 36, 1, 1
182, 5, 3, 30, 36, 5, 1
142, 5, 0, 30, 36, 3, 1
236, 6, 4, 31, 20, 1, 2
206, 6, 0, 31, 20, 3, 2
214, 6, 2, 31, 20, 5, 2
041, 6, 5, 31, 20, 2, 3
164, 6, 1, 31, 20, 4, 3
174, 6, 3, 31, 20, 0, 3
# root [6] print_trk_panel_map(16)
240, 8, 4, 32, 28, 1, 0
271, 8, 1, 32, 28, 3, 0
255, 8, 2, 32, 28, 5, 0
265, 8, 5, 32, 28, 2, 1
190, 8, 0, 32, 28, 4, 1
281, 8, 3, 32, 28, 0, 1
178, 7, 5, 33, 31, 2, 2
241, 7, 3, 33, 31, 0, 2
054, 7, 1, 33, 31, 4, 2
086, 7, 4, 33, 31, 1, 3
266, 7, 2, 33, 31, 5, 3
061, 7, 0, 33, 31, 3, 3
# root [7] print_trk_panel_map(17)
092, 11, 5, 34, 6, 2, 0
097, 11, 2, 34, 6, 0, 0
089, 11, 1, 34, 6, 4, 0
123, 11, 4, 34, 6, 1, 1
125, 11, 3, 34, 6, 5, 1
121, 11, 0, 34, 6, 3, 1
091, 12, 4, 35, 11, 1, 2
107, 12, 1, 35, 11, 3, 2
124, 12, 2, 35, 11, 5, 2
071, 12, 5, 35, 11, 2, 3
149, 12, 0, 35, 11, 4, 3
160, 12, 3, 35, 11, 0, 3
5 changes: 3 additions & 2 deletions TrkHitReco/inc/StrawHitRecoUtils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <vector>
#include <memory>
#include <utility>
#include "Offline/RecoDataProducts/inc/CaloCluster.hh"
#include "Offline/RecoDataProducts/inc/StrawDigi.hh"
#include "Offline/RecoDataProducts/inc/StrawHit.hh"
Expand Down Expand Up @@ -34,10 +35,10 @@ namespace mu2e {
const CaloClusterCollection *caloClusters,
double pbtOffset,
StrawId const& sid, TrkTypes::TDCValues const& tdc, TrkTypes::TOTValues const& tot,
double pmp,
double pmp, double pedestal,
TrackerStatus const& trackerStatus, StrawResponse const& srep, Tracker const& tt) const;

double peakMinusPedWF(TrkTypes::ADCWaveform const& adcData, StrawResponse const& srep, ADCWFIter& maxiter) const;
std::pair<double,double> peakMinusPedWF(TrkTypes::ADCWaveform const& adcData, StrawResponse const& srep, ADCWFIter& maxiter) const;

private:
// algorith parameters
Expand Down
10 changes: 6 additions & 4 deletions TrkHitReco/src/StrawHitRecoUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace mu2e {
}
}

double StrawHitRecoUtils::peakMinusPedWF(TrkTypes::ADCWaveform const& adcData, StrawResponse const& srep, ADCWFIter& maxiter) const {
std::pair<double,double> StrawHitRecoUtils::peakMinusPedWF(TrkTypes::ADCWaveform const& adcData, StrawResponse const& srep, ADCWFIter& maxiter) const {
auto wfstart = adcData.begin() + srep.nADCPreSamples();
auto pedestal = std::accumulate(adcData.begin(), wfstart, 0)/static_cast<float>(srep.nADCPreSamples());
maxiter = wfstart;
Expand All @@ -74,14 +74,16 @@ namespace mu2e {
++nextIter;
}
auto peak = *maxiter;
return (peak-pedestal);
auto pmp = peak - pedestal;
auto rv = std::make_pair(pmp, pedestal);
return rv;
}

bool StrawHitRecoUtils::createComboHit(EventWindowMarker const& ewm, size_t isd, std::unique_ptr<ComboHitCollection> const& chCol,
std::unique_ptr<StrawHitCollection> const& shCol, const CaloClusterCollection* caloClusters,
double pbtOffset,
StrawId const& sid, TrkTypes::TDCValues const& tdc, TrkTypes::TOTValues const& tot,
double pmp,
double pmp, double pedestal,
TrackerStatus const& trackerStatus, StrawResponse const& srep, Tracker const& tt) const {

float minT = _minT;
Expand Down Expand Up @@ -203,7 +205,7 @@ namespace mu2e {
chCol->push_back(std::move(ch));
// optionally create legacy straw hit (for diagnostics and calibration)
if(_writesh){
StrawHit hit(sid,times,tots,energy);
StrawHit hit(sid,times,tots,energy,pmp,pedestal);
shCol->push_back(std::move(hit));
}
return true;
Expand Down
Loading