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
2,306 changes: 2,306 additions & 0 deletions CRVConditions/data/calibSiPM_extracted_20260816.txt

Large diffs are not rendered by default.

2,306 changes: 2,306 additions & 0 deletions CRVConditions/data/calibTime_extracted_20260816.txt

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions CRVConditions/data/status_extracted_20260816.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
TABLE CRVBadChan
#A channel can have more than one status bit. Add all status bits for the complete status.
#status 1 (bit 0): not connected
#status 2 (bit 1): ignore channel in reconstruction
#status 4 (bit 2): no data
#status 8 (bit 3): no pedestal
#status 16 (bit 4): no calibration constant
#status 32 (bit 5): noisy
#channel,status
213,3
462,3
520,3
552,3
792,3
798,3
863,3
906,3
910,3
954,3
1065,3
1067,3
1069,3
1071,3
1107,3
1119,3
1161,3
1383,3
2160,3
2162,3
2164,3
2166,3
2168,3
2170,3
2172,3
2174,3
2218,3
2222,3
2246,3
10 changes: 10 additions & 0 deletions CRVConditions/inc/CRVOrdinal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ class CRVOrdinal : virtual public ProditionsEntity {
return true;
}

// check, if a channel exists
bool offlineExists(const CRVROC& channel) const {
if(channel.ROC()>=_offMap.size()) return false;
if(channel.FEB()>=_offMap.at(channel.ROC()).size()) return false;
if(channel.FEBchannel()>=_offMap.at(channel.ROC()).at(channel.FEB()).size()) return false;
std::uint16_t offlineChannel = _offMap.at(channel.ROC()).at(channel.FEB()).at(channel.FEBchannel());
if (offlineChannel >= CRVId::nChannels) return false;
return true;
}

// online numbering triplet for an offline channel number
const CRVROC& online(std::uint16_t channel) const {
if (_onMap.at(channel).FEBchannel() >= CRVId::nChanPerFEB) {
Expand Down
3 changes: 2 additions & 1 deletion CRVReco/fcl/prolog_v11.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ BEGIN_PROLOG
histBins : 401
histMin : 1799.5
histMax : 2200.5
maxADCspread : 5 #if firstSampleOnly: false
maxADCspread : 5 #if the entire waveform is used for NZS data
maxADCspreadFirstTwoSamples : 3 #if only the first sample is used for ZS data (in this case, the cut is a check that the first sample is not already part of the pulse)
tmpDBfileName : "pedestals.txt"
}

Expand Down
3 changes: 2 additions & 1 deletion CRVReco/fcl/prolog_v12.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ BEGIN_PROLOG
histBins : 401
histMin : 1799.5
histMax : 2200.5
maxADCspread : 5 #if firstSampleOnly: false
maxADCspread : 5 #if the entire waveform is used for NZS data
maxADCspreadFirstTwoSamples : 3 #if only the first sample is used for ZS data (in this case, the cut is a check that the first sample is not already part of the pulse)
tmpDBfileName : "pedestals.txt"
}

Expand Down
7 changes: 6 additions & 1 deletion CRVReco/src/CrvPedestalFinder_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ namespace mu2e
fhicl::Atom<int> histBins{Name("histBins"), Comment("pedestal histogram bins"), 401};
fhicl::Atom<double> histMin{Name("histMin"), Comment("start range of pedestal histogram"), 1799.5};
fhicl::Atom<double> histMax{Name("histMax"), Comment("end range of pedestal histogram"), 2200.5};
fhicl::Atom<double> maxADCspread{Name("maxADCspread"), Comment("maximum spread of ADC values within a waveform to be considered for the pedestal"), 5}; //if not firstSampleOnly
fhicl::Atom<double> maxADCspread{Name("maxADCspread"), Comment("maximum spread of ADC values within a waveform to be considered for the pedestal"), 20};
fhicl::Atom<double> maxADCspreadFirstTwoSamples{Name("maxADCspreadFirstTwoSamples"), Comment("maximum spread of ADC values within first two samples to be considered for the pedestal"), 3};
fhicl::Atom<std::string> tmpDBfileName{Name("tmpDBfileName"), Comment("name of the tmp. DB file name for the pedestals")};
};

Expand All @@ -61,6 +62,7 @@ namespace mu2e
int _histBins;
double _histMin, _histMax;
double _maxADCspread;
double _maxADCspreadFirstTwoSamples;
std::string _tmpDBfileName;
std::vector<TH1F*> _pedestalHists;
};
Expand All @@ -75,6 +77,7 @@ namespace mu2e
_histMin(conf().histMin()),
_histMax(conf().histMax()),
_maxADCspread(conf().maxADCspread()),
_maxADCspreadFirstTwoSamples(conf().maxADCspreadFirstTwoSamples()),
_tmpDBfileName(conf().tmpDBfileName())
{
}
Expand Down Expand Up @@ -154,6 +157,8 @@ namespace mu2e

if(_firstSampleOnly)
{
if(fabs(iter->GetADCs().at(0)-iter->GetADCs().at(1))>=_maxADCspreadFirstTwoSamples) continue;

hist->Fill(iter->GetADCs().at(0));
continue;
}
Expand Down
49 changes: 32 additions & 17 deletions DAQ/src/CrvDigisFromArtdaqFragmentsFEBII_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,23 @@ namespace mu2e
std::cout << "CRV packet does not have subsystem ID 2." << std::endl;
std::cout << "sub system ID: "<<(uint16_t)header->GetSubsystemID()<<" packet count: "<<header->GetPacketCount() << std::endl;
}
crvDaqErrors->emplace_back(mu2e::CrvDAQerrorCode::wrongSubsystemID,iFragment,iSubEvent,iDataBlock,header->GetPacketCount());
if(header->GetPacketCount()>0) //should only be treated as an error, if there was data content.
//otherwise it is just a header from an unused dtc link, i.e. normal behavior.
{
crvDaqErrors->emplace_back(mu2e::CrvDAQerrorCode::wrongSubsystemID,iFragment,iSubEvent,iDataBlock,header->GetPacketCount());
}
continue;
}

uint16_t dtcID = header->GetID();
if(dtcID<_firstCrvDtcID)
{
std::cerr << std::dec << "Run/Subrun/Event: " << event.run() << "/" << event.subRun() << "/" << eventNumber << std::endl;
std::cerr << "iSubEvent/iDataBlock: " << iSubEvent << "/" << iDataBlock << std::endl;
std::cerr << "CRV ID " << dtcID <<" is below first Crv DTC ID=" << _firstCrvDtcID << std::endl;
crvDaqErrors->emplace_back(mu2e::CrvDAQerrorCode::invalidDtcId,iFragment,iSubEvent,iDataBlock,header->GetPacketCount());
break;
}
auto subeventHeader = dtcSubEvent.GetHeader();
crvStatus->emplace_back(*header, *subeventHeader);

Expand Down Expand Up @@ -216,11 +230,6 @@ namespace mu2e
}
for(auto const& crvHit : crvHits)
{
uint16_t dtcID = header->GetID();
if(dtcID<_firstCrvDtcID)
{
throw cet::exception("CrvDigisFromArtdaqFragmentsFEBII") << "DTC ID " << dtcID << " is below first Crv DTC ID=" << _firstCrvDtcID;
}
uint16_t linkID = header->GetLinkID();
uint16_t rocID = (dtcID-_firstCrvDtcID)*CRVId::nROCPerDTC + linkID + 1; //ROC IDs are between 1 and 18
if(_useROC4asROC2 && rocID==4) rocID=2;
Expand All @@ -230,18 +239,27 @@ namespace mu2e
//e.g. fake pulses
if((crvHit.getFpgaChannel() & 0x10) != 0) continue; //special situation, if the 5th bit of the fpgaChannel is non-zero
//don't decode them, since there is no match to any offline channel.
if(rocPort==0) //corrupted data
if(rocPort==0) //one of the indicators of a "zero-block error". TODO: implement a better check for this error
{
std::cout << std::dec << "Run/Subrun/Event: " << event.run() << "/" << event.subRun() << "/" << eventNumber << std::endl;
std::cerr << std::dec << "Run/Subrun/Event: " << event.run() << "/" << event.subRun() << "/" << eventNumber << std::endl;
std::cerr << "iSubEvent/iDataBlock: " << iSubEvent << "/" << iDataBlock << std::endl;
std::cerr << "ROC-port-0 error!" << std::endl;
decoder.PrintBlockFEBII(iDataBlock);
//TODO: Add to crvDaqErrors
std::cerr << "Zero block error!" << std::endl;
if(_diagLevel>2) decoder.PrintBlockFEBII(iDataBlock);
crvDaqErrors->emplace_back(mu2e::CrvDAQerrorCode::zeroBlockError,iFragment,iSubEvent,iDataBlock,header->GetPacketCount());
continue;
}

mu2e::CRVROC onlineChannel(rocID, rocPort, febChannel);

if(!channelMap.offlineExists(onlineChannel))
{
std::cerr << std::dec << "Run/Subrun/Event: " << event.run() << "/" << event.subRun() << "/" << eventNumber << std::endl;
std::cerr << "iSubEvent/iDataBlock: " << iSubEvent << "/" << iDataBlock << std::endl;
std::cerr << "Invalid channel ROC: " << rocID <<" FEB: " << rocPort << " FEBchannel: "<< febChannel << std::endl;
crvDaqErrors->emplace_back(mu2e::CrvDAQerrorCode::invalidChannel,iFragment,iSubEvent,iDataBlock,header->GetPacketCount());
continue;
}

uint16_t offlineChannel = channelMap.offline(onlineChannel);
int crvBarIndex = offlineChannel / CRVId::nChanPerBar;
int SiPMNumber = offlineChannel % CRVId::nChanPerBar;
Expand Down Expand Up @@ -291,13 +309,8 @@ namespace mu2e
uint16_t febChannel = (crvHit.getFpgaNumber()<<4) + (crvHit.getFpgaChannel() & 0xF); //use only 4 lowest bits of the fpgaChannel
//the 5th bit indicates special situations
//e.g. fake pulses
if(rocPort==0) continue; //corrupted data
if(rocPort==0) continue; //zero-block error - error already reported above

uint16_t dtcID = header->GetID();
if(dtcID<_firstCrvDtcID)
{
throw cet::exception("CrvDigisFromArtdaqFragmentsFEBII") << "DTC ID " << dtcID << " is below first Crv DTC ID=" << _firstCrvDtcID;
}
uint16_t linkID = header->GetLinkID();
uint16_t rocID = (dtcID-_firstCrvDtcID)*CRVId::nROCPerDTC + linkID + 1; //ROC IDs are between 1 and 18
if(_useROC4asROC2 && rocID==4) rocID=2;
Expand All @@ -306,6 +319,8 @@ namespace mu2e
{
mu2e::CRVROC onlineChannel(rocID, rocPort, febChannel);

if(!channelMap.offlineExists(onlineChannel)) continue; //channel doesn't exists - error already reported above

uint16_t offlineChannel = channelMap.offline(onlineChannel);
int crvBarIndex = offlineChannel / CRVId::nChanPerBar;
int SiPMNumber = offlineChannel % CRVId::nChanPerBar;
Expand Down
2 changes: 0 additions & 2 deletions EventDisplay/fcl/EventDisplayExtracted.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ services.ProditionsService.crvCalib.useDb : true
services.ProditionsService.crvStatus.useDb : true
services.DbService.purpose : Sim_best
services.DbService.version : v1_5
#enable this line, if displaying simulated events
#services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260716.txt","Offline/CRVConditions/data/calib_extracted_20260716.txt"]
8 changes: 8 additions & 0 deletions EventDisplay/fcl/EventDisplayExtractedCrvOnly.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "Offline/EventDisplay/fcl/EventDisplayBase.fcl"

physics.analyzers.eventdisplay.extractedCrvOnly : true
services.GeometryService.inputFile : "Offline/Mu2eG4/geom/geom_common_extracted.txt"
services.ProditionsService.crvCalib.useDb : true
services.ProditionsService.crvStatus.useDb : true
services.DbService.purpose : Sim_best
services.DbService.version : v1_5
13 changes: 9 additions & 4 deletions EventDisplay/fcl/EventDisplayExtractedReal.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ physics.analyzers.eventdisplay.extracted : true
services.GeometryService.inputFile : "Offline/Mu2eG4/geom/geom_common_extracted.txt"
services.ProditionsService.crvCalib.useDb : true
services.ProditionsService.crvStatus.useDb : true
services.DbService.purpose : Sim_best
services.DbService.version : v1_5
#comment out this line, if displaying simulated events
services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260716.txt","Offline/CRVConditions/data/calib_extracted_20260716.txt"]
#Real data
services.DbService.purpose : CRV_COMMISSIONING
services.DbService.version : v1_0
services.DbService.nearestMatch : true
services.DbService.verbose : 0
#current status and calibration until we can use the database
#services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260816.txt","Offline/CRVConditions/data/calibSiPM_extracted_20260816.txt","Offline/CRVConditions/data/calibTime_extracted_20260816.txt"]
#older data
#services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260716.txt","Offline/CRVConditions/data/calib_extracted_20260716.txt"]
13 changes: 9 additions & 4 deletions EventDisplay/fcl/EventDisplayExtractedRealCrvOnly.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ physics.analyzers.eventdisplay.extractedCrvOnly : true
services.GeometryService.inputFile : "Offline/Mu2eG4/geom/geom_common_extracted.txt"
services.ProditionsService.crvCalib.useDb : true
services.ProditionsService.crvStatus.useDb : true
services.DbService.purpose : Sim_best
services.DbService.version : v1_5
#comment out this line, if displaying simulated events
services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260716.txt","Offline/CRVConditions/data/calib_extracted_20260716.txt"]
#Real data
services.DbService.purpose : CRV_COMMISSIONING
services.DbService.version : v1_0
services.DbService.nearestMatch : true
services.DbService.verbose : 0
#current status and calibration until we can use the database
#services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260816.txt","Offline/CRVConditions/data/calibSiPM_extracted_20260816.txt","Offline/CRVConditions/data/calibTime_extracted_20260816.txt"]
#older data
#services.DbService.textFile : ["Offline/CRVConditions/data/status_extracted_20260716.txt","Offline/CRVConditions/data/calib_extracted_20260716.txt"]
3 changes: 2 additions & 1 deletion EventDisplay/src/ContentSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void ContentSelector::setAvailableCollections(const art::Event& event)
newEntries.push_back(nothingSelected);
createNewEntries<mu2e::StepPointMCCollection>(_stepPointMCVector, event, "StepPointMC", newEntries, 1);
createNewEntries<mu2e::StrawHitCollection>(_strawHitVector, event, "StrawHit", newEntries, 2);
createNewEntries<mu2e::KalSeedCollection>(_kalSeedHitVector, event, "KalSeed", newEntries, 4);

if(newEntries!=_hitEntries)
{
Expand Down Expand Up @@ -266,7 +267,7 @@ const CollectionType* ContentSelector::getSelectedHitCollection() const
}
template const mu2e::StepPointMCCollection* ContentSelector::getSelectedHitCollection<mu2e::StepPointMCCollection>() const;
template const mu2e::StrawHitCollection* ContentSelector::getSelectedHitCollection<mu2e::StrawHitCollection>() const;
template const mu2e::KalSeedCollection* ContentSelector::getSelectedHitCollection<mu2e::KalSeedCollection>() const;
template const mu2e::KalSeedCollection* ContentSelector::getSelectedHitCollection<mu2e::KalSeedCollection>() const;

template<typename CollectionType>
const CollectionType* ContentSelector::getSelectedCaloHitCollection() const
Expand Down
2 changes: 1 addition & 1 deletion EventDisplay/src/Straw.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Straw: public VirtualShape
double x2=x-halflength*st*sp;
double y2=y+halflength*st*cp;
double z2=z-halflength*ct;
_line->SetLineWidth(1);
_line->SetLineWidth(2);
_line->SetPoint(0,x1,y1,z1);
_line->SetPoint(1,x2,y2,z2);
start();
Expand Down
2 changes: 1 addition & 1 deletion RecoDataProducts/inc/CrvDAQerror.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace mu2e
{
public:

enum enum_type{unknown=0, unableToGetDataBlock=1, invalidPacket=2, wrongSubsystemID=3, errorUnpackingStatusPacket=4, errorUnpackingCrvHits=5, byteCountMismatch=6};
enum enum_type{unknown=0, unableToGetDataBlock=1, invalidPacket=2, wrongSubsystemID=3, errorUnpackingStatusPacket=4, errorUnpackingCrvHits=5, byteCountMismatch=6, invalidChannel=7, invalidDtcId=8, zeroBlockError=9};
static std::string const& typeName();
static std::map<enum_type,std::string> const& names();
};
Expand Down
5 changes: 4 additions & 1 deletion RecoDataProducts/src/CrvDAQerror.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ namespace mu2e
{CrvDAQerrorCodeDetail::wrongSubsystemID , "wrongSubsystemID" },
{CrvDAQerrorCodeDetail::errorUnpackingStatusPacket , "errorUnpackingStatusPacket" },
{CrvDAQerrorCodeDetail::errorUnpackingCrvHits , "errorUnpackingCrvHits" },
{CrvDAQerrorCodeDetail::byteCountMismatch , "byteCountMismatch" }
{CrvDAQerrorCodeDetail::byteCountMismatch , "byteCountMismatch" },
{CrvDAQerrorCodeDetail::invalidChannel , "invalidChannel" },
{CrvDAQerrorCodeDetail::invalidDtcId , "invalidDtcId" },
{CrvDAQerrorCodeDetail::zeroBlockError , "zeroBlockError" }
};

std::map<CrvDAQerrorCodeDetail::enum_type,std::string> const& CrvDAQerrorCodeDetail::names()
Expand Down