//#include "honlinemonhist.h" //#include "honlinehistarray.h" //#include "honlinetrendhist.h" #include "hemcdetector.h" #include "htrb3unpacker.h" #include "hemctrb3lookup.h" #include "hemcraw.h" #include "TH1.h" #include "DabcHydra.h" TH1* emcHits = 0; int debug_cnt = 0; Bool_t createHistEmc(){ emcHits = new TH1I("emcHits", "Found hits per EMC TDC", 4, 0, 4); emcHits->SetDirectory(0); DabcHydra::Register("emc", emcHits); return kTRUE; } Bool_t fillHistEmc(Int_t evid) { // HEmcDetector* emcDet = (HEmcDetector*)gHades->getSetup()->getDetector("Emc"); // if (evid < 5) { printf("IGNORE\n"); return kTRUE; } // return kTRUE; HCategory* emcRawCat = gHades->getCurrentEvent()->getCategory(catEmcRaw); if (emcRawCat == 0) { printf ("Did not found Emc Raw Category\n"); return kFALSE; } HEmcTrb3Lookup* lookup = (HEmcTrb3Lookup*)(gHades->getRuntimeDb()->getContainer("EmcTrb3Lookup")); if (lookup == 0) { printf ("Did not found EmcTrb3Lookup\n"); return kFALSE; } HLocation loc; loc.set(2, 0, 0); unsigned tdcids[4] = { 0x50f0, 0x50f1, 0x50f2, 0x50f3 }; bool isany = false; for (unsigned cnt=0;cnt<4;cnt++) { HEmcTrb3LookupBoard *board = lookup->getBoard(tdcids[cnt] - tdcids[0] + 0x8a00); if (board == 0) { printf ("Did not found HEmcTrb3LookupBoard %u \n", tdcids[cnt]); return kFALSE; } // printf("PROCESS BOARD ID %04X size %d\n", tdcids[cnt], board->getSize()); emcHits->Fill(cnt); for (Int_t ch=1; ch < board->getSize(); ch++) { HEmcTrb3LookupChan* channel = board->getChannel(ch); if (channel==0) { // printf("Not found channel %d\n", ch); continue; } channel->getAddress(loc[0], loc[1]); if (loc[0] < 0) continue; // from here we got access to TDC channel and should map it to EMC channel // printf("Extract RAW for channel %d\n", ch); HEmcRaw* pRaw = (HEmcRaw*) emcRawCat->getObject(loc); // printf("Not found RAW for channel %d\n", ch); if (pRaw==0) continue; // no hits in the channel if (pRaw->getTotMultiplicity() < 1) continue; isany = true; // this is hit time in the channel, one can do everything Float_t hittm = pRaw->getTime(1); if (hittm==0) continue; } // for ch } // for boards if (!isany) { emcHits->Fill(debug_cnt); debug_cnt = (debug_cnt+1) % 4; } return kTRUE; }