// $Id$ // // File: DEventProcessor_fcal_hists.cc // Created: Mon Apr 3 11:38:03 EDT 2006 // Creator: davidl (on Darwin swire-b241.jlab.org 8.4.0 powerpc) // #include using namespace std; #include "DEventProcessor_fcal_hists.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Routine used to create our DEventProcessor extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new DEventProcessor_fcal_hists()); } } // "C" #define FCAL_Z_OFFSET 640.0-65.0 // I don't know what this value is ??? //#define FCAL_Z_OFFSET 170.0 // I don't know what this value is ??? #define PI_ZERO_MASS 0.13497 //------------------ // init //------------------ jerror_t DEventProcessor_fcal_hists::init(void) { app1 = new TApplication("app1",NULL,0); // my_canvas = new TCanvas(" Test ", " Test ",0, 700, 800, 800); // my_canvas_clust = new TCanvas(" Clust ", " Clust ",500, 700, 800, 800); my_canvas_track = new TCanvas(" Track ", " Track ",1000, 700, 800, 800); // my_canvas->Divide(5,4); my_canvas_track->Divide(2,2); cdc_hits = new TH1F("cdc_hits","cdc_hits", 1000,-0.5, 999.5); cdc_hits_ps = new TH1F("cdc_hits_ps","cdc_hits_ps", 1000,-0.5, 999.5); fdc_wire_hits = new TH1F("fdc_wire_hits","fdc_wire_hits", 1000,-0.5, 999.5); fdc_wire_hits_ps = new TH1F("fdc_wire_hits_ps","fdc_wire_hits_ps", 1000,-0.5, 999.5); fdc_cath_hits = new TH1F("fdc_cath_hits","fdc_cath_hits", 2000,-0.5, 1999.5); fdc_cath_hits_ps = new TH1F("fdc_cath_hits_ps","fdc_cath_hits_ps", 2000,-0.5, 1999.5); fcal_hits = new TH1F("fcal_hits","fcal_hits", 1000,-0.5, 999.5); fcal_hits_ps = new TH1F("fcal_hits_ps","fcal_hits_ps", 1000,-0.5, 999.5); bcal_hits = new TH1F("bcal_hits","bcal_hits", 1000,-0.5, 999.5); bcal_hits_ps = new TH1F("bcal_hits_ps","bcal_hits_ps", 1000,-0.5, 999.5); bcal_f1_hits = new TH1F("bcal_f1_hits","bcal_f1_hits", 1000,-0.5, 999.5); bcal_f1_hits_ps = new TH1F("bcal_f1_hits_ps","bcal_f1_hits_ps", 1000,-0.5, 999.5); tagh_hits = new TH1F("tagh_hits","tagh_hits", 1000,-0.5, 999.5); tagh_hits_ps = new TH1F("tagh_hits_ps","tagh_hits_ps", 1000,-0.5, 999.5); tagh_f1_hits = new TH1F("tagh_f1_hits","tagh_f1_hits", 1000,-0.5, 999.5); tagh_f1_hits_ps = new TH1F("tagh_f1_hits_ps","tagh_f1_hits_ps", 1000,-0.5, 999.5); tagm_hits = new TH1F("tagm_hits","tagm_hits", 1000,-0.5, 999.5); tagm_hits_ps = new TH1F("tagm_hits_ps","tagm_hits_ps", 1000,-0.5, 999.5); tagm_f1_hits = new TH1F("tagm_f1_hits","tagm_f1_hits", 1000,-0.5, 999.5); tagm_f1_hits_ps = new TH1F("tagm_f1_hits_ps","tagm_f1_hits_ps", 1000,-0.5, 999.5); st_hits = new TH1F("st_hits","st_hits", 1000,-0.5, 999.5); st_hits_ps = new TH1F("st_hits_ps","st_hits_ps", 1000,-0.5, 999.5); st_f1_hits = new TH1F("st_f1_hits","st_f1_hits", 1000,-0.5, 999.5); st_f1_hits_ps = new TH1F("st_f1_hits_ps","st_f1_hits_ps", 1000,-0.5, 999.5); ps_hits = new TH1F("ps_hits","ps_hits", 1000,-0.5, 999.5); ps_hits_ps = new TH1F("ps_hits_ps","ps_hits_ps", 1000,-0.5, 999.5); psc_hits = new TH1F("psc_hits","psc_hits", 1000,-0.5, 999.5); psc_hits_ps = new TH1F("psc_hits_ps","psc_hits_ps", 1000,-0.5, 999.5); psc_f1_hits = new TH1F("psc_f1_hits","psc_f1_hits", 1000,-0.5, 999.5); psc_f1_hits_ps = new TH1F("psc_f1_hits_ps","psc_f1_hits_ps", 1000,-0.5, 999.5); tof_hits = new TH1F("tof_hits","tof_hits", 1000,-0.5, 999.5); tof_hits_ps = new TH1F("tof_hits_ps","tof_hits_ps", 1000,-0.5, 999.5); tof_tdc_hits = new TH1F("tof_tdc_hits","tof_tdc_hits", 1000,-0.5, 999.5); tof_tdc_hits_ps = new TH1F("tof_tdc_hits_ps","tof_tdc_hits_ps", 1000,-0.5, 999.5); fadc250_occup = new TProfile("fadc250_occup","fadc250_occup",100,0.5,100.5,0.,10000); fadc125_occup = new TProfile("fadc125_occup","fadc125_occup",100,0.5,100.5,0.,10000); f1_occup = new TProfile("f1_occup","f1_occup",100,0.5,100.5,0.,10000); for(Int_t ii = 0; ii < 40; ii++){ char title[30]; sprintf(title,"hit_%d",ii); fadc_raw[ii] = new TProfile(title,title,100,-0.5,99.5,-10.,4096); fadc_raw[ii]->SetMinimum(0); fadc_raw[ii]->SetMaximum(300); // fadc_raw[ii]->SetMaximum(3000); char title1[30]; sprintf(title1,"track_%d",ii); fadc_plot[ii] = new TProfile(title1,title1,100,-0.5,99.5,-10.,4096); fadc_plot[ii]->SetMinimum(0); // fadc_plot[ii]->SetMaximum(200); fadc_plot[ii]->SetMaximum(500); } htrig_bit = new TH1F("trig_bit","trig_bit", 32, 0.5, 32.5); htrig_bit_fp = new TH1F("trig_bit_fp","trig_bit_fp", 32, 0.5, 32.5); tagh_occup = new TH1F("tagh_occup","tagh_occup", 300,-0.5, 299.5); tagh_occup1 = new TH1F("tagh_occup1","tagh_occup1", 300,-0.5, 299.5); tagh_tdc_occup = new TH1F("tagh_tdc", "tagh_tdc", 300,-0.5, 299.5); tagm_occup = new TH1F("tagm_occup","tagm_occup", 300,-0.5, 299.5); trig_time = new TH1F("trig_time","trig_time", 100, 0, 100.); st_check = new TH1F("st_check","st_check", 200, -500, 500.); st_check1 = new TH1F("st_check1","st_check1", 200, -500, 500.); st_check2 = new TH1F("st_check2","st_check2", 200, -500, 500.); st_check10 = new TH1F("st_check10","st_check10", 10, -0.5, 9.5); // bcal_check = new TH1F("bcal_check","bcal_check", 400, -500, 3500.); bcal_check = new TH1F("bcal_check","bcal_check", 200, -300, 300.); bcal_check1 = new TH1F("bcal_check1","bcal_check1", 200, -300, 300.); // bcal_check2 = new TH1F("bcal_check2","bcal_check2", 500, -300, 60000.); bcal_check2 = new TH1F("bcal_check2","bcal_check2", 400, -600., 2000.); hmax_amp = new TH1F("max_amp","max_amp", 200, 0, 2000.); hfcal_sum = new TH1F("fcal_sum","fcal_sum", 200, 0, 2.); hfcal_sum1 = new TH1F("fcal_sum1","fcal_sum1", 600, 0, 6000.); dt_ps_tagh7 = new TH1F("dt_ps_tagh7","dt_ps_tagh7", 2500, -20000, 10000); dt_ps_tagh4 = new TH1F("dt_ps_tagh4","dt_ps_tagh4", 2500, -20000, 10000); tagh_tdc_time1 = new TH1F("tagh_tdc_time1","tagh_tdc_time1", 400, -800., 800.); tagh_pulse_time1 = new TH1F("tagh_pulse_time1","tagh_pulse_time1", 400, -0.5, 399.5); tagh_pulse_time3 = new TH1F("tagh_pulse_time3","tagh_pulse_time3", 400, -0.5, 399.5); tagh_pulse_time4 = new TH1F("tagh_pulse_time4","tagh_pulse_time4", 400, -0.5, 399.5); tagh_pulse_time6 = new TH1F("tagh_pulse_time6","tagh_pulse_time6", 400, -0.5, 399.5); tagh_pulse_time7 = new TH1F("tagh_pulse_time7","tagh_pulse_time7", 400, -0.5, 399.5); tagm_pulse_time1 = new TH1F("tagm_pulse_time1","tagm_pulse_time1", 400, -0.5, 399.5); tagm_pulse_time3 = new TH1F("tagm_pulse_time3","tagm_pulse_time3", 400, -0.5, 399.5); tagm_pulse_time4 = new TH1F("tagm_pulse_time4","tagm_pulse_time4", 400, -0.5, 399.5); tagm_pulse_time6 = new TH1F("tagm_pulse_time6","tagm_pulse_time6", 400, -0.5, 399.5); tagm_pulse_time7 = new TH1F("tagm_pulse_time7","tagm_pulse_time7", 400, -0.5, 399.5); tof_pulse_time1 = new TH1F("tof_pulse_time1","tof_pulse_time1", 400, -0.5, 399.5); tof_pulse_time3 = new TH1F("tof_pulse_time3","tof_pulse_time3", 400, -0.5, 399.5); tof_pulse_time4 = new TH1F("tof_pulse_time4","tof_pulse_time4", 400, -0.5, 399.5); tof_pulse_time6 = new TH1F("tof_pulse_time6","tof_pulse_time6", 400, -0.5, 399.5); tof_pulse_time7 = new TH1F("tof_pulse_time7","tof_pulse_time7", 400, -0.5, 399.5); ps_pulse_time1 = new TH1F("ps_pulse_time1","ps_pulse_time1", 400, -0.5, 399.5); ps_pulse_time3 = new TH1F("ps_pulse_time3","ps_pulse_time3", 400, -0.5, 399.5); ps_pulse_time4 = new TH1F("ps_pulse_time4","ps_pulse_time4", 400, -0.5, 399.5); ps_pulse_time6 = new TH1F("ps_pulse_time6","ps_pulse_time6", 400, -0.5, 399.5); ps_pulse_time7 = new TH1F("ps_pulse_time7","ps_pulse_time7", 400, -0.5, 399.5); psc_pulse_time1 = new TH1F("psc_pulse_time1","psc_pulse_time1", 400, -0.5, 399.5); psc_pulse_time3 = new TH1F("psc_pulse_time3","psc_pulse_time3", 400, -0.5, 399.5); psc_pulse_time4 = new TH1F("psc_pulse_time4","psc_pulse_time4", 400, -0.5, 399.5); psc_pulse_time6 = new TH1F("psc_pulse_time6","psc_pulse_time6", 400, -0.5, 399.5); psc_pulse_time7 = new TH1F("psc_pulse_time7","psc_pulse_time7", 400, -0.5, 399.5); bcal_pulse_time1 = new TH1F("bcal_pulse_time1","bcal_pulse_time1", 400, -0.5, 399.5); bcal_pulse_time3 = new TH1F("bcal_pulse_time3","bcal_pulse_time3", 400, -0.5, 399.5); bcal_pulse_time4 = new TH1F("bcal_pulse_time4","bcal_pulse_time4", 400, -0.5, 399.5); bcal_pulse_time6 = new TH1F("bcal_pulse_time6","bcal_pulse_time6", 400, -0.5, 399.5); bcal_pulse_time7 = new TH1F("bcal_pulse_time7","bcal_pulse_time7", 400, -0.5, 399.5); fcal_pulse_time1 = new TH1F("fcal_pulse_time1","fcal_pulse_time1", 400, -0.5, 399.5); fcal_pulse_time3 = new TH1F("fcal_pulse_time3","fcal_pulse_time3", 400, -0.5, 399.5); fcal_pulse_time4 = new TH1F("fcal_pulse_time4","fcal_pulse_time4", 400, -0.5, 399.5); fcal_pulse_time6 = new TH1F("fcal_pulse_time6","fcal_pulse_time6", 400, -0.5, 399.5); fcal_pulse_time7 = new TH1F("fcal_pulse_time7","fcal_pulse_time7", 400, -0.5, 399.5); st_pulse_time1 = new TH1F("st_pulse_time1","st_pulse_time1", 400, -0.5, 399.5); st_pulse_time3 = new TH1F("st_pulse_time3","st_pulse_time3", 400, -0.5, 399.5); st_pulse_time4 = new TH1F("st_pulse_time4","st_pulse_time4", 400, -0.5, 399.5); st_pulse_time6 = new TH1F("st_pulse_time6","st_pulse_time6", 400, -0.5, 399.5); st_pulse_time7 = new TH1F("st_pulse_time7","st_pulse_time7", 400, -0.5, 399.5); st_double = new TH1F("st_double","st_double", 10, -0.5, 9.5); st_double_sec = new TH1F("st_double_cand","st_double_cand", 40, -0.5, 39.5); st_pulse_peak = new TH1F("st_pulse_peak","st_pulse_peak", 2000, -0.5, 3999.5); hfcal = new TH2D("hfcal","hfcal", 54, -108, 108, 54, -108, 108); e_over_pp = new TH2D("e_over_pp","e_over_pp", 50, 0.0, 4.0, 50, 0., 2.); e_over_pp1 = new TH2D("e_over_pp1","e_over_pp1", 50, 0.0, 4.0, 50, 0., 2.); psc_cnt_time = new TH2D("psc_cnt_time", "psc_cnt_time", 16, 0.5, 16.5, 20, 0., 100.); dE_over_E_vs_E = new TH2D("dE_over_E_vs_E","Smeared-unsmeared energy diff for single FCAL blocks", 50, 0.0, 1.0, 50, -0.1, 0.1); hdiff = new TH1F("diff","diff", 40, 0, 40.); hadc_tdc = new TH2D("adc_tdc","adc_tdc", 200, 0., 200, 200, 0, 200); TDirectory *dir = new TDirectory("MIP","MIP"); dir->cd(); // Go back up to the parent directory dir->cd("../"); tree1 = new TTree("tree1","Reconst ntuple"); tree1->Branch("ntr",&ntr, "ntr/I"); tree1->Branch("x_tr",x_tr,"x_tr[ntr]/F"); tree1->Branch("y_tr",y_tr,"y_tr[ntr]/F"); tree1->Branch("z_tr",z_tr,"z_tr[ntr]/F"); tree1->Branch("r_tr",r_tr,"r_tr[ntr]/F"); tree1->Branch("mom_tr",mom_tr,"mom_tr[ntr]/F"); tree1->Branch("prob_tr",prob_tr,"prob_tr[ntr]/F"); tree1->Branch("ndf_tr",ndf_tr, "ndf[ntr]/I"); tree1->Branch("x_cl", x_cl, "x_cl[ntr]/F"); tree1->Branch("y_cl", y_cl, "y_cl[ntr]/F"); tree1->Branch("z_cl", z_cl, "z_cl[ntr]/F"); tree1->Branch("en_cl",en_cl,"en_cl[ntr]/F"); #if 1 tree1->Branch("nhit", nhit, "nhit[ntr]/I"); tree1->Branch("en", en, "en[ntr]/F"); tree1->Branch("en_min", en_min, "en_min[ntr]/F"); tree1->Branch("en_max", en_max, "en_max[ntr]/F"); tree1->Branch("hit_x", hit_x, "hit_x[ntr]/F"); tree1->Branch("hit_y", hit_y, "hit_y[ntr]/F"); tree1->Branch("nhit1", nhit1, "nhit1[ntr]/I"); tree1->Branch("en1", en1, "en1[ntr]/F"); tree1->Branch("en_min1", en_min1, "en_min1[ntr]/F"); tree1->Branch("en_max1", en_max1, "en_max1[ntr]/F"); tree1->Branch("hit_x1", hit_x1, "hit_x1[ntr]/F"); tree1->Branch("hit_y1", hit_y1, "hit_y1[ntr]/F"); tree1->Branch("nhit2", nhit2, "nhit2[ntr]/I"); tree1->Branch("en2", en2, "en2[ntr]/F"); tree1->Branch("en_min2", en_min2, "en_min2[ntr]/F"); tree1->Branch("en_max2", en_max2, "en_max2[ntr]/F"); tree1->Branch("hit_x2", hit_x2, "hit_x2[ntr]/F"); tree1->Branch("hit_y2", hit_y2, "hit_y2[ntr]/F"); #endif gStyle->SetOptStat(0); return NOERROR; } //------------------ // brun //------------------ jerror_t DEventProcessor_fcal_hists::brun(JEventLoop *eventLoop, int32_t runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t DEventProcessor_fcal_hists::evnt(JEventLoop *loop, uint64_t eventnumber) { // extract the FCAL Geometry (for isBlockActive() and positionOnFace()) vectorpsc_digihits; vectorps_digihits; // TDC vectorpsc_tdc_hits; vector fcalGeomVect; vector hits; vector truthhits; vector fcal_digihits; vectortracks; vectorfcals; vector bcal_digihits; vector bcal_tdc_hits; vector bcal_tdc_digihits; vector bcal_test; vector bcal_uni_hits; vector st_digihits; vector st_tdc_digihits; vector st; vector tof_digihits; vector tof_tdc_digihits; vector tagh_digihits; // vector tagh_hits; vector tagm_digihits; vector tagh_tdc_digihits; vector tagm_tdc_digihits; vector cdc_digi_hits; vector cathodedigihits; vector wiredigihits; vector fdchits; vector pulse_check; vector l1trig; loop->Get(pulse_check); // cout << " Size of the Pulse Integral " << pulse_check.size() << endl; // PSC part loop->Get(psc_digihits); loop->Get(psc_tdc_hits); loop->Get(st_tdc_digihits); // PS part loop->Get(ps_digihits); // loop->Get(fcalGeomVect); loop->Get(fcal_digihits); // loop->Get(fcals); // loop->Get(hits); // loop->Get(truthhits,"TRUTH"); // loop->Get(tracks); loop->Get(bcal_test); loop->Get(bcal_uni_hits); loop->Get(bcal_tdc_hits); loop->Get(bcal_tdc_digihits); loop->Get(tof_digihits); loop->Get(tof_tdc_digihits); loop->Get(tagh_digihits); // loop->Get(tagh_hits,"Calib"); // loop->Get(tagh_hits); // loop->Get(tagm_hits,"Calib"); loop->Get(tagm_digihits); loop->Get(st_digihits); loop->Get(st); // loop->Get(tracks); loop->Get(l1trig); loop->Get(tagh_tdc_digihits); loop->Get(tagm_tdc_digihits); loop->Get(bcal_digihits); loop->Get(cdc_digi_hits); loop->Get(cathodedigihits); loop->Get(wiredigihits); loop->Get(fdchits); // const DFCALGeometry& fcalGeom = *(fcalGeomVect[0]); // if(fcalGeomVect.size()<1)return OBJECT_NOT_AVAILABLE; // cout << eventnumber << endl; int plot = 0; int debug = 0; LockState(); #if 1 // cout << " TRIGGER SIZE = " << l1trig.size() << endl; if( l1trig.size() > 0){ // cout << l1trig[0]->gtp_sc[0] << endl; // for(unsigned int ii = 0; ii < 32; ii++) // cout << "L1 GTP sc = " << l1trig[0]->gtp_sc[ii] << endl; #if 1 for(unsigned int bit = 0; bit < 32; bit++){ trig_bit[bit + 1] = (l1trig[0]->trig_mask & (1 << bit)) ? 1 : 0; if(trig_bit[bit + 1] == 1) htrig_bit->Fill(Float_t(bit+1)); } for(unsigned int bit = 0; bit < 32; bit++){ trig_bit_fp[bit + 1] = (l1trig[0]->fp_trig_mask & (1 << bit)) ? 1 : 0; if(trig_bit_fp[bit + 1] == 1) htrig_bit_fp->Fill(Float_t(bit+1)); } #endif // htrig_type->Fill(Float_t(l1trig[0]->trig_mask)); // htrig_type_fp->Fill(Float_t(l1trig[0]->fp_trig_mask)); // trig_type = l1trig[0]->trig_mask; } #endif // cout << " TRACKS = " << tracks.size() << endl; ntr = 0; int n_plot = 0; int tagger_good_time = 0; int fadc250_hits[100]; int fadc125_hits[100]; int f1_hits[100]; memset(fadc250_hits,0,sizeof(fadc250_hits)); memset(fadc125_hits,0,sizeof(fadc125_hits)); memset(f1_hits,0,sizeof(f1_hits)); // 1. CDC // cout << " Number of CDC hits = " << cdc_digi_hits.size() << endl; if(trig_bit[1] == 1) cdc_hits->Fill(Float_t(cdc_digi_hits.size())); if(trig_bit[4] == 1) cdc_hits_ps->Fill(Float_t(cdc_digi_hits.size())); if(trig_bit[1] == 1){ for(unsigned int kk = 0; kk < cdc_digi_hits.size() ; kk++){ const DCDCDigiHit *cdc_digi_hit = cdc_digi_hits[kk]; const Df125CDCPulse *f125_hit; cdc_digi_hit->GetSingle(f125_hit); fadc125_hits[f125_hit->rocid]++; } } // 2. FDC // cout << " Number of FDC wire hits = " << wiredigihits.size() << endl; // cout << " Number of FDC cathode hits = " << cathodedigihits.size() << endl; if(trig_bit[1] == 1){ fdc_wire_hits->Fill(Float_t(wiredigihits.size())); fdc_cath_hits->Fill(Float_t(cathodedigihits.size())); } if(trig_bit[4] == 1){ fdc_wire_hits_ps->Fill(Float_t(wiredigihits.size())); fdc_cath_hits_ps->Fill(Float_t(cathodedigihits.size())); } if(trig_bit[1] == 1){ for(unsigned int kk = 0; kk < wiredigihits.size(); kk++){ const DFDCWireDigiHit *wiredigihit = wiredigihits[kk]; const DF1TDCHit *f1_hit; wiredigihit->GetSingle(f1_hit); f1_hits[f1_hit->rocid]++; } for(unsigned int kk = 0; kk < cathodedigihits.size() ; kk++){ const DFDCCathodeDigiHit *cathodedigihit = cathodedigihits[kk]; const Df125FDCPulse *f125_hit; cathodedigihit->GetSingle(f125_hit); fadc125_hits[f125_hit->rocid]++; } } // 3. FCAL // cout << " Number of FCAL hits " << fcal_digihits.size() << endl; if(trig_bit[1] == 1) fcal_hits->Fill(Float_t(fcal_digihits.size())); if(trig_bit[4] == 1) fcal_hits_ps->Fill(Float_t(fcal_digihits.size())); for(unsigned int kk = 0; kk < fcal_digihits.size(); kk++){ const DFCALDigiHit *fcal_digihit = fcal_digihits[kk]; const Df250PulseData *pulsedata; // cout << fcal_digihit->row << " " << fcal_digihit->column << " " << // fcal_digihit->pulse_integral << endl; fcal_digihit->GetSingle(pulsedata); // cout << " ROC ID = " << pulsedata->rocid << endl; // const Df250WindowRawData *windorawdata; uint32_t adc_time = (fcal_digihit->pulse_time & 0x7FC0) >> 6; if(trig_bit[1] == 1){ fcal_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) fcal_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) fcal_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) fcal_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) fcal_pulse_time7->Fill(Float_t(adc_time)); } // 4. BCAL // cout << " Number of BCAL hits " << bcal_digihits.size() << endl; if(trig_bit[1] == 1) bcal_hits->Fill(Float_t(bcal_digihits.size())); if(trig_bit[4] == 1) bcal_hits_ps->Fill(Float_t(bcal_digihits.size())); for(unsigned int kk = 0; kk < bcal_digihits.size(); kk++){ const DBCALDigiHit *bcal_digihit = bcal_digihits[kk]; const Df250PulseData *pulsedata; bcal_digihit->GetSingle(pulsedata); // const Df250WindowRawData *windorawdata; // pulseintegral->GetSingle(windorawdata); // if(pulsedata->QF_pedestal > 0){ // cout << " Suspecious pedestal " << endl; // cout << pulsedata->QF_bad_pedestal << " " << pulsedata->QF_pedestal << endl; // cout << pulsedata->pedestal << endl; // } uint32_t adc_time = (bcal_digihit->pulse_time & 0x7FC0) >> 6; if(trig_bit[1] == 1){ bcal_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) bcal_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) bcal_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) bcal_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) bcal_pulse_time7->Fill(Float_t(adc_time)); } // 4. ST // cout << " Number of ST hits " << st_digihits.size() << endl; if(trig_bit[1] == 1) st_hits->Fill(Float_t(st_digihits.size())); if(trig_bit[4] == 1) st_hits_ps->Fill(Float_t(st_digihits.size())); for(unsigned int kk = 0; kk < st_digihits.size(); kk++){ const DSCDigiHit *st_digihit = st_digihits[kk]; const Df250PulseData *pulsedata; st_digihit->GetSingle(pulsedata); uint32_t adc_time = (st_digihit->pulse_time & 0x7FC0) >> 6; int cand = -1; if(trig_bit[1] == 1){ st_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) st_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1){ st_pulse_time4->Fill(Float_t(adc_time)); // break; } if(trig_bit[6] == 1){ st_pulse_time6->Fill(Float_t(adc_time)); if(adc_time > 70 && adc_time > 80){ // cout << " Double hit " << st_digihit->sector << endl; cand = st_digihit->sector; } } // Check double hits int n_double = 0; for(unsigned int ll = 0; ll < st_digihits.size(); ll++){ const DSCDigiHit *st_digihit1 = st_digihits[ll]; if(cand == st_digihit1->sector) n_double++; } if(n_double > 0 ){ st_double->Fill(Float_t(n_double)); if(n_double >= 2 ){ st_double_sec->Fill(Float_t(cand)); } } if(trig_bit[7] == 1) st_pulse_time7->Fill(Float_t(adc_time)); } // 5. TOF if(trig_bit[1] == 1) tof_hits->Fill(Float_t(tof_digihits.size())); if(trig_bit[4] == 1) tof_hits_ps->Fill(Float_t(tof_digihits.size())); for(unsigned int ii = 0; ii < tof_digihits.size(); ii++){ const DTOFDigiHit *tof_digihit = tof_digihits[ii]; const Df250PulseData *pulsedata; tof_digihit->GetSingle(pulsedata); uint32_t adc_time = (tof_digihit->pulse_time & 0x7FC0) >> 6; if(trig_bit[1] == 1){ tof_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) tof_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) tof_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) tof_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) tof_pulse_time7->Fill(Float_t(adc_time)); } // 6. PS // cout << " Number of PS hits " << ps_digihits.size() << endl; if(trig_bit[1] == 1) ps_hits->Fill(Float_t(ps_digihits.size())); if(trig_bit[4] == 1) ps_hits_ps->Fill(Float_t(ps_digihits.size())); for(unsigned int ii = 0; ii < ps_digihits.size(); ii++){ const DPSDigiHit *ps_digihit = ps_digihits[ii]; const Df250PulseData *pulsedata; ps_digihit->GetSingle(pulsedata); uint32_t adc_time = (ps_digihit->pulse_time & 0x7FC0) >> 6; if(trig_bit[1] == 1){ ps_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) ps_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) ps_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) ps_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) ps_pulse_time7->Fill(Float_t(adc_time)); } // 7. PSC // cout << " Number of PSC hits " << psc_digihits.size() << endl; if(trig_bit[1] == 1) psc_hits->Fill(Float_t(psc_digihits.size())); if(trig_bit[4] == 1) psc_hits_ps->Fill(Float_t(psc_digihits.size())); for(unsigned int ii = 0; ii < psc_digihits.size(); ii++){ const DPSCDigiHit *psc_digihit = psc_digihits[ii]; const Df250PulseData *pulsedata; psc_digihit->GetSingle(pulsedata); int counter_id = psc_digihit->counter_id; uint32_t adc_time = (psc_digihit->pulse_time & 0x7FC0) >> 6; psc_cnt_time->Fill(Float_t(counter_id),Float_t(adc_time)); if(trig_bit[1] == 1){ psc_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) psc_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) psc_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) psc_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) psc_pulse_time7->Fill(Float_t(adc_time)); } // 8. TAGM // cout << " Number of TAGM hits " << tagm_digihits.size() << endl; // tagm_hits->Fill(Float_t(tagm_digihits.size())); if(trig_bit[1] == 1) tagm_hits->Fill(Float_t(tagm_digihits.size())); if(trig_bit[4] == 1) tagm_hits_ps->Fill(Float_t(tagm_digihits.size())); for(unsigned int kk = 0; kk < tagm_digihits.size(); kk++){ const DTAGMDigiHit *tagm_digihit = tagm_digihits[kk]; const Df250PulseData *pulsedata; tagm_digihit->GetSingle(pulsedata); int tagm_column = tagm_digihit->column; tagm_occup->Fill(Float_t(tagm_column)); uint32_t adc_time = (tagm_digihit->pulse_time & 0x7FC0) >> 6; if(trig_bit[1] == 1){ tagm_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) tagm_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) tagm_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) tagm_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) tagm_pulse_time7->Fill(Float_t(adc_time)); } // 8. TAGH // cout << " Number of TAGH hits " << tagh_digihits.size() << endl; if(trig_bit[1] == 1) tagh_hits->Fill(Float_t(tagh_digihits.size())); if(trig_bit[4] == 1) tagh_hits_ps->Fill(Float_t(tagh_digihits.size())); for(unsigned int kk = 0; kk < tagh_digihits.size(); kk++){ const DTAGHDigiHit *tagh_digihit = tagh_digihits[kk]; const Df250PulseData *pulsedata; tagh_digihit->GetSingle(pulsedata); int counter_id = tagh_digihit->counter_id; tagh_occup->Fill(Float_t(counter_id)); // cout << counter_id << endl; uint32_t adc_time = (tagh_digihit->pulse_time & 0x7FC0) >> 6; if(trig_bit[1] == 1){ tagh_pulse_time1->Fill(Float_t(adc_time)); fadc250_hits[pulsedata->rocid]++; } if(trig_bit[3] == 1) tagh_pulse_time3->Fill(Float_t(adc_time)); if(trig_bit[4] == 1) tagh_pulse_time4->Fill(Float_t(adc_time)); if(trig_bit[6] == 1) tagh_pulse_time6->Fill(Float_t(adc_time)); if(trig_bit[7] == 1) tagh_pulse_time7->Fill(Float_t(adc_time)); } if(trig_bit[1] == 1){ for(int ii = 0; ii < 100; ii++){ fadc250_occup->Fill(Float_t(ii),Float_t(fadc250_hits[ii])); } } // BCAL TDC HITS if(trig_bit[1] == 1) bcal_f1_hits->Fill(Float_t(bcal_tdc_digihits.size())); if(trig_bit[4] == 1) bcal_f1_hits_ps->Fill(Float_t(bcal_tdc_digihits.size())); for(unsigned int kk = 0; kk < bcal_tdc_digihits.size(); kk++){ const DBCALTDCDigiHit *bcal_tdc_digihit = bcal_tdc_digihits[kk]; const DF1TDCHit *f1_hit; bcal_tdc_digihit->GetSingle(f1_hit); if(trig_bit[1] == 1){ f1_hits[f1_hit->rocid]++; } } // ST TDC HITS if(trig_bit[1] == 1) st_f1_hits->Fill(Float_t(st_tdc_digihits.size())); if(trig_bit[4] == 1) st_f1_hits_ps->Fill(Float_t(st_tdc_digihits.size())); for(unsigned int kk = 0; kk < st_tdc_digihits.size(); kk++){ const DSCTDCDigiHit *st_tdc_digihit = st_tdc_digihits[kk]; const DF1TDCHit *f1_hit; st_tdc_digihit->GetSingle(f1_hit); if(trig_bit[1] == 1){ f1_hits[f1_hit->rocid]++; } } // TAGM/TAGH TDC HITS if(trig_bit[1] == 1) tagm_f1_hits->Fill(Float_t(tagm_tdc_digihits.size())); if(trig_bit[4] == 1) tagm_f1_hits_ps->Fill(Float_t(tagm_tdc_digihits.size())); for(unsigned int kk = 0; kk < tagm_tdc_digihits.size(); kk++){ const DTAGMTDCDigiHit *tagm_tdc_digihit = tagm_tdc_digihits[kk]; const DF1TDCHit *f1_hit; tagm_tdc_digihit->GetSingle(f1_hit); if(trig_bit[1] == 1){ f1_hits[f1_hit->rocid]++; } } if(trig_bit[1] == 1) tagh_f1_hits->Fill(Float_t(tagh_tdc_digihits.size())); if(trig_bit[4] == 1) tagh_f1_hits_ps->Fill(Float_t(tagh_tdc_digihits.size())); for(unsigned int kk = 0; kk < tagh_tdc_digihits.size(); kk++){ const DTAGHTDCDigiHit *tagh_tdc_digihit = tagh_tdc_digihits[kk]; const DF1TDCHit *f1_hit; tagh_tdc_digihit->GetSingle(f1_hit); if(trig_bit[1] == 1){ f1_hits[f1_hit->rocid]++; } } // TOF TDC HITS if(trig_bit[1] == 1) tof_tdc_hits->Fill(Float_t(tof_tdc_digihits.size())); if(trig_bit[4] == 1) tof_tdc_hits_ps->Fill(Float_t(tof_tdc_digihits.size())); for(unsigned int kk = 0; kk < tof_tdc_digihits.size(); kk++){ const DTOFTDCDigiHit *tof_tdc_digihit = tof_tdc_digihits[kk]; const DCAEN1290TDCHit *caen_hit; tof_tdc_digihit->GetSingle(caen_hit); if(trig_bit[1] == 1){ f1_hits[caen_hit->rocid]++; } } if(trig_bit[1] == 1){ for(int ii = 0; ii < 100; ii++){ f1_occup->Fill(Float_t(ii),Float_t(f1_hits[ii])); fadc125_occup->Fill(Float_t(ii),Float_t(fadc125_hits[ii])); } } #if 0 // cout << " Number of TAGH hits = " << tagh_hits.size() << endl; for(unsigned int kk = 0; kk < tagh_hits.size(); kk++){ const DTAGHHit *tagh_hit = tagh_hits[kk]; if(trig_bit[1] == 1) tagh_tdc_time1->Fill(tagh_hit->time_tdc); // tagh_digi_hit->GetSingle(pulseintegral); // const Df250WindowRawData *windorawdata; // pulseintegral->GetSingle(windorawdata); // int counter_id = tagh_hit->counter_id; } #endif const DTTabUtilities* locTTabUtilities = NULL; loop->GetSingle(locTTabUtilities); for(unsigned int kk = 0; kk < bcal_test.size(); kk++){ const DBCALHit *my_bcal = bcal_test[kk]; // cout << my_bcal->t << endl; bcal_check->Fill(my_bcal->t); } for(unsigned int kk = 0; kk < bcal_uni_hits.size(); kk++){ const DBCALUnifiedHit *bcal_uni_hit = bcal_uni_hits[kk]; const DBCALTDCHit * thisTDCHit; bcal_uni_hit->GetSingle(thisTDCHit); // cout << bcal_uni_hit->t_TDC << endl; bcal_check1->Fill(bcal_uni_hit->t_TDC); } for(unsigned int kk = 0; kk < bcal_tdc_hits.size(); kk++){ const DBCALTDCHit *bcal_tdc_hit = bcal_tdc_hits[kk]; // cout << my_bcal->t << endl; bcal_check2->Fill(bcal_tdc_hit->t); } vector dcodarocinfo; // DCODAROCInfo loop->Get(dcodarocinfo); for(UInt_t i=0;irocid; // We can use any roc ID besides 1, // just use 11. if(rocid == 33){ // ULong64_t rocTime = dcodarocinfo[i]->timestamp; // cout << hex << rocTime << dec << endl; // getchar(); break; } } for(unsigned int kk = 0; kk < bcal_tdc_digihits.size(); kk++){ const DBCALTDCDigiHit *bcal_tdc_digihit = bcal_tdc_digihits[kk]; const DF1TDCHit *locF1TDCHit; bcal_tdc_digihit->GetSingle(locF1TDCHit); // locTTabUtilities->dCODAROCInfoMap; // map dCODAROCInfoMap; // dCODAROCInfoMap = locTTabUtilities->dCODAROCInfoMap; uint32_t locROCID = locF1TDCHit->rocid; // Get DF1TDCConfig for this ROC vector locF1TDCConfigs; locF1TDCHit->Get(locF1TDCConfigs); // cout << " Config = " << locF1TDCConfigs.size() << endl; // Get DCODAROCInfo for this ROC // map::const_iterator locROCInfoIterator = dCODAROCInfoMap.find(locROCID); // const DCODAROCInfo* locCODAROCInfo = (locROCInfoIterator != dCODAROCInfoMap.end()) ? locROCInfoIterator->second : NULL; // cout << " 0 = " << locTTabUtilities->Convert_DigiTimeToNs_F1TDC_TriggerReferenceSignal(locF1TDCHit) << endl; // cout << " 1 = " << Convert_DigiTimeToNs_F1TDC_GlobalSystemClock_CCDB(locF1TDCHit, locCODAROCInfo) << endl; // cout << locTTabUtilities->Convert_DigiTimeToNs_F1TDC_GlobalSystemClock_ConfigInfo(locF1TDCHit, locCODAROCInfo, locF1TDCConfigs[0]) << endl; // cout << locF1TDCConfigs[0]->REFCNT << " " << locF1TDCConfigs[0]->REFCLKDIV << endl; // cout << locCODAROCInfo->timestamp << endl; // cout << locCODAROCInfo << endl; // cout << my_bcal->t << endl; // bcal_check2->Fill(bcal_tdc_digihit->time); // cout << locTTabUtilities->Convert_DigiTimeToNs_F1TDC(bcal_tdc_digihit) << endl; // getchar(); } // Check time correlation for(unsigned int kk = 0; kk < st.size(); kk++){ const DSCHit *sthit = st[kk]; // cout << sthit->t << " " << sthit->t_TDC << endl; if(trig_bit[1] == 1){ st_check->Fill(sthit->t); st_check1->Fill(sthit->t_TDC); st_check2->Fill(sthit->t_fADC); } } for(unsigned int kk = 0; kk < st_digihits.size(); kk++){ const DSCDigiHit *st_digihit = st_digihits[kk]; int sector = st_digihit->sector; uint32_t adc_time = (st_digihit->pulse_time & 0x7FC0) >> 6; if(adc_time > 20 && adc_time < 40){ // cout << " Hit " << endl; int both_hits = 0; for(unsigned int ll = 0; ll < st_tdc_digihits.size(); ll++){ const DSCTDCDigiHit *st_tdc_digihit = st_tdc_digihits[ll]; if(st_tdc_digihit->sector == sector){ // cout << " Hit found " << endl; both_hits = 1; break; } } st_check10->Fill(float(both_hits)); } } #if 0 for(unsigned int kk = 0; kk < tagh_tdc_hits.size(); kk++){ const DTAGHTDCDigiHit *tagh_tdc = tagh_tdc_hits[kk]; int counter = tagh_tdc->counter_id; int time = tagh_tdc->time; if(tagger_good_time == 1){ cout << " TDC counter = " << counter << endl; tagh_tdc_occup->Fill(Float_t(counter)); } } #endif // if(tagger_good_time == 0){ // UnlockState(); // return NOERROR; // } #if 0 // Draw waveforms which match with tracks for(int ii = 0; ii < n_plot; ii++){ if(ii < 5){ TFile f("rrr.root","new"); my_canvas_track->cd(ii+1); fadc_plot[ii]->Draw(); fadc_plot[ii]->Write(); } } my_canvas_track->Update(); // getchar(); my_canvas_track->Clear(); my_canvas_track->Divide(2,2); for(Int_t ch = 0; ch < 40; ch++){ fadc_plot[ch]->Reset(); } #endif UnlockState(); return NOERROR; } //------------------ // erun //------------------ jerror_t DEventProcessor_fcal_hists::erun(void) { // Any final calculations on histograms (like dividing them) // should be done here. This may get called more than once. return NOERROR; } //------------------ // fini //------------------ jerror_t DEventProcessor_fcal_hists::fini(void) { return NOERROR; }