33 #include "NovaDatabase/Table.h" 39 #include "RunHistory/RunHistory.h" 145 fNSlices = f->
make<TH1F>(
"fNSlices",
";NSlices;Events",100,0.0,100.0);
148 fSliceLength = f->
make<TH1F>(
"fSliceLength",
";Slice Duration; NSlices", 550,0.0, 5500);
150 fNHitsPerEvent = f->
make<TH1F>(
"fNHitsPerEvent",
";NHits/NGoodChannels;Events",100,0.0,0.5);
151 fPlaneVCell = f->
make<TH2F>(
"fPlaneVCell",
";Plane Number;Cell Number", NPlanes,-0.5,NPlanes-0.5, NCells,-0.5,NCells -0.5);
152 fPlaneVCellRaw = f->
make<TH2F>(
"fPlaneVCellRaw",
";Plane Number;Cell Number",NPlanes,-0.5,NPlanes-0.5, NCells,-0.5,NCells -0.5);
153 fChannelMap = f->
make<TH2F>(
"fChannelMap",
"Channel Map;Plane Number;Cell Number",NPlanes,-0.5,NPlanes-0.5, NCells,-0.5,NCells -0.5);
155 fBlocDcmFeb = f->
make<TH3F>(
"fBlockDcmFeb",
"Channel Map;Diblock; DCM;FEB",14,-0.5, 13.5, 12,-0.5,11.5 ,64,-0.5,63.5);
157 fOccupancy = f->
make<TH1F>(
"fOccupancy",
";log of Occupancy;Channels",200,-3.0,0.0);
158 fEmptyEvents = f->
make<TH1F>(
"fEmptyEvents",
";;Number of empty events",2,0,2);
159 fNoiseEvents = f->
make<TH1F>(
"fNoiseEvents",
";;Number of events with noise only slice",2,0,2);
160 fNEvents = f->
make<TH1F>(
"fNEvents",
";;Number of events",2,0,2);
163 for(
int ndiblock=0;ndiblock<4;ndiblock++){
164 for(
int ndcm=0;ndcm<3;ndcm++){
165 for(
int nfeb=0;nfeb<64;nfeb++){
194 float nFEB = (
float)tempDiBlock.
dcm[0].feb.size();
197 for (
unsigned int i=0;
i<nDB; ++
i) {
199 for(
unsigned int j=0;
j<db.
dcm.size();
j++, ++ic ){
202 strcpy(histname, dcmName.c_str());
204 vDCMs.at(ic) = f->
make<TH2F>(histname,
";Event;FEB",100,0.0,38000.0,nFEB,0,nFEB);
219 double detid = geom->
DetId();
255 if(slicecol->empty()){
264 for(
unsigned int iSlice = 0; iSlice < slicecol->size(); ++iSlice){
275 if(slice.
NCell() != 0){
294 for(
unsigned int i = 0;
i < hitcol->size(); ++
i){
301 for(
unsigned int iHit = 0; iHit < hitlist.
size(); iHit++){
303 cell = hitlist[iHit]->Cell();
304 plane = hitlist[iHit]->Plane();
320 for(
unsigned int i = 0;
i < rawhitcol->size(); ++
i){
328 uint32_t daq_channel = 0;
332 uint32_t rawplane = 0;
333 uint32_t rawcell = 0;
335 for(
unsigned int iRawHit = 0; iRawHit < rawhitlist.
size(); iRawHit++){
337 daq_channel = rawhitlist[iRawHit]->DaqChannel();
361 if(diblock<2 && dcm <12)
fDCM_FEB[diblock-1][dcm-1][
feb]++;
375 if(hitlist.
size()==0) {
379 else if (slicecol->size()==1) {
400 for (
int xbin = 1; xbin <=
fPlaneVCell->GetNbinsX(); xbin++) {
401 for (
int ybin = 1; ybin <=
fPlaneVCell->GetNbinsY(); ybin++) {
403 double cellcontent =
fPlaneVCell->GetBinContent(xbin,ybin);
404 double logcontent = -6;
406 if (cellcontent > 0.0) {
407 logcontent =
log10(cellcontent);
425 if (cellcontent > 0.0) {
433 TF1 *
f1=
new TF1(
"f1",
"landau");
438 for(
unsigned int i = 0;
i <
fNHits.size();
i++){
446 for(
int nx=1;nx<=14;nx++){
447 for(
int ny=1;ny<=12;ny++){
448 for(
int nz=1;nz<=64;nz++){
461 unsigned int stat = 0;
468 if(femptyp < 1.0 && fnoisep < 0.1 && fhits < 0.06 && fhits > 0.0) stat=1;
472 if(femptyp < 1.0 && fnoisep < 0.25 && fhits < 0.06 && fhits > 0.0) stat=1;
495 for(
int ndiblock=0;ndiblock<4;ndiblock++){
496 for(
int ndcm=0;ndcm<3;ndcm++){
501 char fFirstEventTimeStampStr[256];
502 char fFirstNonEmptyEventTimeStampStr[256];
503 char fLastNonEmptyEventTimeStampStr[256];
504 char fLastEventTimeStampStr[256];
506 struct tm * fFirstEventTimeStampinfo;
507 struct tm * fFirstNonEmptyEventTimeStampinfo;
508 struct tm * fLastNonEmptyEventTimeStampinfo;
509 struct tm * fLastEventTimeStampinfo;
512 strftime(fFirstEventTimeStampStr,256,
"%Y-%m-%d %H:%M:%S", fFirstEventTimeStampinfo);
517 strftime(fFirstNonEmptyEventTimeStampStr,256,
"%Y-%m-%d %H:%M:%S", fFirstNonEmptyEventTimeStampinfo);
519 std::cout<<
"Time of First Non Empty Event= " <<fFirstNonEmptyEventTimeStampStr<<
std::endl;
522 strftime(fLastNonEmptyEventTimeStampStr,256,
"%Y-%m-%d %H:%M:%S", fLastNonEmptyEventTimeStampinfo);
524 std::cout<<
"Time of Last Non Empty Event= " <<fLastNonEmptyEventTimeStampStr<<
std::endl;
527 strftime(fLastEventTimeStampStr,256,
"%Y-%m-%d %H:%M:%S", fLastEventTimeStampinfo);
556 r->
Set(
"nevents", fNevents);
561 r->
Set(
"firsteventtime", fFirstEventTimeStampStr);
562 r->
Set(
"firstnonemptyeventtime", fFirstNonEmptyEventTimeStampStr);
563 r->
Set(
"lastnonemptyeventtime", fLastNonEmptyEventTimeStampStr);
564 r->
Set(
"lasteventtime", fLastEventTimeStampStr);
570 r->
Set(
"occupancympv" , f1->GetParameter(1));
571 r->
Set(
"occupancysigma" , f1->GetParameter(2));
573 r->
Set(
"status", stat);
616 r->
Set(
"nevents", fNevents);
621 r->
Set(
"firsteventtime", fFirstEventTimeStampStr);
622 r->
Set(
"firstnonemptyeventtime", fFirstNonEmptyEventTimeStampStr);
623 r->
Set(
"lastnonemptyeventtime", fLastNonEmptyEventTimeStampStr);
624 r->
Set(
"lasteventtime", fLastEventTimeStampStr);
630 r->
Set(
"occupancympv" , f1->GetParameter(1));
631 r->
Set(
"occupancysigma" , f1->GetParameter(2));
633 r->
Set(
"status", stat);
659 std::ostringstream oss;
665 int nbinx =
vDCMs.at(1)->GetNbinsX();
666 int nbiny =
vDCMs.at(1)->GetNbinsY();
667 double width =
vDCMs.at(1)->GetBinWidth(1);
668 nbinx = (
int)(fNevents/width);
673 for (
int i=0;
i<nDiBlocks; ++
i) {
675 for (
unsigned int idcm=0; idcm<db.
dcm.size(); ++idcm, ++ic) {
677 for(
int j=0;
j<nbiny;
j++ ){
678 bool biscool = db.
dcm[idcm].feb[
j].isCooled;
681 if( biscool ) strcool =
"is cool";
682 else strcool =
"is not cool";
685 for(
int k=0;k<nbinx;k++ ){
686 if( ( (
vDCMs.at(ic))->GetBinContent(k+1,
j+1))!=0.0 ) curr = 1;
688 if( (k!=0) & (prev>
curr) ){
690 fout <<
"FEB" <<
j <<
" in " << dcmname <<
" shutoff in subrun" << fSubRun <<
". This feb is " << strcool <<
std::endl;
693 else if( (k!=0) & (prev<
curr) ){
695 fout <<
"FEB" <<
j <<
" in " << dcmname <<
" came back in subrun" << fSubRun <<
". This feb is " << strcool <<
std::endl;
static std::string GetName(int id)
bool Set(std::string cname, T value)
SubRunNumber_t subRun() const
int NDiBlocks()
gives number of active diblocks only, may be less than 14
diblock
print "ROW IS " print row
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
std::string fRawDigitModule
Label of the raw digit module; set to default.
unsigned int fTriggerType
void reconfigure(const fhicl::ParameterSet &p)
std::string fSlicerModule
Label of the slicer module in the fcl file used.
constexpr std::uint32_t timeHigh() const
DiBlock GetDiBlock(int i, bool loadAll=true)
get ith diblock is RH list (which only includes diblocks with activity), starting with i=0...
A collection of associated CellHits.
const daqchannelmap::DAQChannelMap * Map() const
std::string fCalHitModule
Label of the calhit module in the fcl file used.
DEFINE_ART_MODULE(TestTMapFile)
cell_t getCell(lchan logicalchan) const
Decode the cell number from an lchan.
time_t fLastNonEmptyEventTimeStamp
DataCheck(fhicl::ParameterSet const &pset)
unsigned int fNRawChannels
std::string fSoftwareRelease
bool SetValidityRange(std::string cname, T start, T end)
uint8_t fTriggerMask_TriggerType
void analyze(art::Event const &evt)
bool WriteToDB(bool commit=true)
use commit=false if just testing
void push_back(Ptr< U > const &p)
Make a linear fit to a collection of raw hits.
unsigned int fNGoodChannels
std::string fRawDataLabel
std::string getenv(std::string const &name)
Commissioning files to look at the quality of our data.
T get(std::string const &key) const
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
virtual void endSubRun(art::SubRun const &sr)
EDAnalyzer(Table< Config > const &config)
TH1F * fNHitsPerSliceNoNoise
void AddRow(const Row *row)
std::vector< float > fNHits
bool SetDetector(std::string det)
virtual void beginSubRun(art::SubRun const &sr)
time_t fFirstNonEmptyEventTimeStamp
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< TH2F * > vDCMs
plane_t getPlane(lchan logicalchan) const
Decode the plane number from an lchan.
time_t fFirstEventTimeStamp
dcm_id_t getDCM(dchan daqchan) const
Decode the dcm ID from a dchan.
time_t fLastEventTimeStamp
bool IsNoise() const
Is the noise flag set?
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
Encapsulate the geometry of one entire detector (near, far, ndos)
feb_t getFEB(dchan daqchan) const
Decode the feb id from a dchan.