#define DataVal_cxx # #include "DataVal.h" #include "TH2.h" #include "TF1.h" #include "TStyle.h" #include "TCanvas.h" //----------------------------------------------------------------------------- // run 102319: reference channels 4 and 54 (account for 0.5 round-off) //----------------------------------------------------------------------------- float const CLC_T0_RUN[96] = { 0.0 , 0.0 , -4.418, -0.379, 0.5 , -6.165, -1.541, -7.821, 1.076, 0.957, -2.346, -0.841, -3.050, -1.362, -1.458, -6.129, -0.532, -8.513, -1.345, -2.064, -1.534, -4.552, -6.588, -3.915, 0.833, -2.030, -1.243, -8.463, 1.271, -2.706, -5.921, -3.960,-15.491, -6.556, -4.449, -7.645, -4.343, -5.509, -3.444, -3.607, -2.404, -2.404, -1.633, -2.043, -2.265, -6.694, -7.530, -6.048, 0.0 , 0.0 , 0.0 , 0.0 , -4.013, -0.939, 0.5 , 0.690, 0.056, -2.202, 2.740, -1.695, 2.355, -0.256, -2.432, 0.849, -4.121, -0.942, -7.174, -5.570, -3.054, -0.610, 4.590, -3.018, -0.471, -4.202, -2.789, -4.479, -2.188, -4.898, -3.770, -2.881, -2.004, -6.556, -5.544, -4.466, 0.407, -0.171, -1.267, 0.746, -2.088, -1.313, -1.781, -3.227, 2.115, -1.653, -1.790, 0.421, }; int const CLC_BAD_RUN[96] = { // west module 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, // east module 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //----------------------------------------------------------------------------- // CMU //----------------------------------------------------------------------------- void DataVal::Cmu(int nev){ // In a Root session, you can do: // Root > .L DataVal.C // Root > DataVal t // Root > t.GetEntry(12); // Fill t data members with entry number 12 // Root > t.Show(); // Show values of entry 12 // Root > t.Show(16); // Read and show values of entry 16 // Root > t.Loop(); // Loop on all entries // // This is the loop skeleton // To read only selected branches, Insert statements like: // METHOD1: // fTree->SetBranchStatus("*",0); // disable all branches TH1F* h_nd = new TH1F("h_nd", "N hits in CMUD",200,0,200); TH1F* h_ne = new TH1F("h_ne", "N hits in CMUE",200,0,200); TH1F* h_nstubs = new TH1F("h_nstubs", "N(stubs) reconstructed in CMU",50,0,50); TH1F* h_time = new TH1F("h_time", "CMUD: pulse leading edge",420,0,2100); TH1F* h_width = new TH1F("h_width", "CMUD: pulse width",420,0,2100); TH1F* h_wedge = new TH1F("h_wedge", "CMUD wedge number",30,0,30); TH1F* h_layer = new TH1F("h_layer", "CMUD layer number",5,0,5); TH1F* h_side = new TH1F("h_side", "CMUD side : 0=west/1=east",5,0,5); TH1F* h_stack = new TH1F("h_stack", "CMUD: stack number",20,0,20); TH1F* h_l2accept = new TH1F("h_l2accept", "CMUD: L2 accept",5,0,5); TH1F *h_side_profile [2]; // east and west TH1F *h_wedge_profile[2][24]; // hit profiles for each wedge h_side_profile[0] = new TH1F("h_cmu_west", "CMU west: wedge profile",30,0,30); h_side_profile[1] = new TH1F("h_cmu_east", "CMU east: wedge profile",30,0,30); char name[200], title[200]; char* text_side[2] = { "WEST","EAST"}; for (int side=0; side<2; side++) { for (int wedge=0; wedge<24; wedge++) { sprintf(name,"cmu_%i_%02i",side,wedge); sprintf(title,"CMU %4s WEDGE %2i",text_side[side],wedge); h_wedge_profile[side][wedge] = new TH1F(name,title,48,0,48); } } //----------------------------------------------------------------------------- // histograms for E-hits //----------------------------------------------------------------------------- TH2F* h_adc = new TH2F("h_adc", "CMUE: ADC(0) vs ADC(1)",125,0,250,125,0,250); TH1F* h_z = new TH1F("h_z", "CMUE: Z coordinate of the hit",250,0,250); TH1F* h_dist = new TH1F("h_dist", "CMUE: drift distance of the hit",250,0,250); if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); if (nev > 0) nentries = nev; Int_t nbytes = 0, nb = 0; for (Int_t j=0; jGetEntry(j); nbytes += nb; int nd = fCmuData->NDHits(); int ne = fCmuData->NEHits(); // fill histograms for the number of hits h_nd->Fill(nd); h_ne->Fill(ne); h_nstubs->Fill(fCmuData->NStubs()); for (int ihit=0; ihitDHit(ihit); h_time->Fill(dhit->LeadingEdge()); h_width->Fill(dhit->Width()); h_wedge->Fill(dhit->WedgeNumber()); int side = dhit->SideNumber(); int wedge = dhit->WedgeNumber(); h_side_profile[side]->Fill(wedge); h_wedge_profile[side][wedge]->Fill(4*dhit->StackNumber()+dhit->LayerNumber()); h_layer->Fill(dhit->LayerNumber()); h_side->Fill(dhit->SideNumber()); h_stack->Fill(dhit->StackNumber()); h_l2accept->Fill(dhit->L2Accept()); } for (int ihit=0; ihitEHit(ihit); h_adc->Fill(ehit->Adc(0),ehit->Adc(1)); h_z->Fill(ehit->Z()); h_dist->Fill(ehit->DriftDistance()); } } } //----------------------------------------------------------------------------- // CMX //----------------------------------------------------------------------------- void DataVal::Cmx(int nev) { char name[200]; char title[200]; TH1F* h_cmx_nd = new TH1F("h_cmx_nd", "CMXD: N(hits)",200,0,200); TH1F *h_cmx_side_profile [2]; // east and west TH2F *h_cmx_wedge_profile[2][24]; // hit profiles for each wedge TH1F* h_cmx_time = new TH1F("h_cmx_time", "CMXD: pulse leading edge",420,0,2100); TH1F* h_cmx_width = new TH1F("h_cmx_width", "CMXD: pulse width",420,0,2100); TH1F* h_cmx_wedge = new TH1F("h_cmx_wedge", "CMXD wedge number",30,0,30); TH1F* h_cmx_layer = new TH1F("h_cmx_layer", "CMXD layer number",10,0,10); TH1F* h_cmx_side = new TH1F("h_cmx_side", "CMXD side : 0=west/1=east",5,0,5); h_cmx_side_profile[0] = new TH1F("h_cmx_west", "CMX west: wedge profile",30,0,30); h_cmx_side_profile[1] = new TH1F("h_cmx_east", "CMX east: wedge profile",30,0,30); for (int side=0; side<2; side++) { for (int wedge=0; wedge<24; wedge++) { sprintf(name,"h_cmx_wedge_%1i_%02i",side,wedge); sprintf(title,"CMX: side %i wedge %02i layer vs wire",side,wedge); h_cmx_wedge_profile[side][wedge] = new TH2F(name,title,10,0,10,10,0,10); } } if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); if (nev > 0) nentries = nev; Int_t nbytes = 0, nb = 0; for (Int_t j=0; jGetEntry(j); nbytes += nb; int cmx_nd = fCmxData->NDHits(); h_cmx_nd->Fill(cmx_nd); for (int ihit=0; ihitDHit(ihit); int side = dhit->SideNumber(); int wedge = dhit->WedgeNumber(); h_cmx_side_profile[side]->Fill(wedge); h_cmx_side->Fill(side); h_cmx_time->Fill(dhit->LeadingEdge()); h_cmx_width->Fill(dhit->Width()); h_cmx_wedge->Fill(dhit->WedgeNumber()); h_cmx_layer->Fill(dhit->LayerNumber()); h_cmx_wedge_profile[side][wedge]->Fill((float) dhit->WireNumber(), (float) dhit->LayerNumber()); } } } //----------------------------------------------------------------------------- // Calorimeter //----------------------------------------------------------------------------- void DataVal::Cal(int nev, int adc_threshold) { // char name[200]; char title[200]; if (fHCal.fNTowers) { // delete all the histograms delete fHCal.fNTowers; delete fHCal.fNTow1; delete fHCal.fEmPmt; delete fHCal.fHadPmt; delete fHCal.fEmEtaPhi[0]; delete fHCal.fEmEtaPhi[1]; delete fHCal.fHadEtaPhi[0]; delete fHCal.fHadEtaPhi[1]; delete fHCal.fSumEt; delete fHCal.fTowerEt; delete fHCal.fMyronVsSumEt; } // book histograms sprintf(title,"CAL: Sum(Et)"); fHCal.fSumEt = new TH1F("h_cal_sum_et", title, 400,0,200); sprintf(title,"CAL: Myron Flag vs Sum(Et)"); fHCal.fMyronVsSumEt = new TH2F("h_cal_myron_vs_sumet", title, 400,0,200,4,0,4); sprintf(title,"CAL: Tower Et"); fHCal.fTowerEt = new TH1F("h_cal_tower_et", title, 200,0,20); sprintf(title,"CAL: N towers total"); fHCal.fNTowers = new TH1F("h_cal_ntowers", title, 200,0,200); sprintf(title,"N(cal) towers, thr=%i",adc_threshold); fHCal.fNTow1 = new TH1F("h_cal_ntowers", title, 200,0,200); sprintf(title,"EM ADC counts, thr=%i",adc_threshold); fHCal.fEmPmt = new TH1F("h_em_pmt", title, 250,0,2500); sprintf(title,"HAD ADC counts, thr=%i",adc_threshold); fHCal.fHadPmt = new TH1F("h_had_pmt", title, 250,0,2500); sprintf(title,"EM0 eta:phi, thr=%i",adc_threshold); fHCal.fEmEtaPhi[0] = new TH2F("h_em_eta_phi_0",title, 60,0,60,50,0,50); sprintf(title,"EM1 eta:phi, thr=%i",adc_threshold); fHCal.fEmEtaPhi[1] = new TH2F("h_em_eta_phi_1",title, 60,0,60,50,0,50); sprintf(title,"HAD0 eta:phi, thr=%i",adc_threshold); fHCal.fHadEtaPhi[0] = new TH2F("h_had_eta_phi_0",title,60,0,60,50,0,50); sprintf(title,"HAD1 eta:phi, thr=%i",adc_threshold); fHCal.fHadEtaPhi[1] = new TH2F("h_had_eta_phi_1",title,60,0,60,50,0,50); if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); if (nev > 0) nentries = nev; for (Int_t jentry=0; jentryGetEntry(jentry); b_CalData->GetEntry(jentry); int ntow1 = 0; int ntowers = fCalData->NTowers(); for (int i=0; iTower(i); int ok = 0; float et = t->Et(); fHCal.fTowerEt->Fill(et); for (int ipmt=0; ipmt<4; ipmt++) { if (t->EmPmt(ipmt) > adc_threshold) { fHCal.fEmEtaPhi[ipmt]->Fill((float) t->IEta(), (float) t->IPhi()); fHCal.fEmPmt->Fill(t->EmPmt(ipmt)); ok = 1; } } for (int ipmt=0; ipmt<4; ipmt++) { if (t->HadPmt(ipmt) > adc_threshold) { if (ipmt < 2) { // for the moment fill only 1st 2 channels fHCal.fHadEtaPhi[ipmt]->Fill((float) t->IEta(), (float) t->IPhi()); fHCal.fHadPmt->Fill(t->HadPmt(ipmt)); } ok = 1; } } ntow1 += ok; } fHCal.fNTowers->Fill(ntowers); fHCal.fNTow1->Fill(ntow1); fHCal.fSumEt->Fill(fCalData->SumEt()); fHCal.fMyronVsSumEt->Fill(fCalData->SumEt(), (float) fTriggerBlock->Tsid()->MyronFlag()); } } //_____________________________________________________________________________ void DataVal::PlotCalEmChannel(int iEta, int iPhi, int iPmt) { // char name[200]; char title[200]; if (fTmpHist1) { delete fTmpHist1; } // book histograms sprintf(title,"EM PMT %i, ieta = %i iphi = %i",iPmt, iEta, iPhi); fTmpHist1 = new TH1F("h_tmp", title, 500,0,2500); if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); printf(" nentries = %i\n",nentries); for (Int_t jentry=0; jentryGetEntry(jentry); int ntowers = fCalData->NTowers(); printf(" -------------------------- ntowers = %i\n",ntowers); for (int i=0; iTower(i); printf(" ieta, iphi = %2i %2i\n",t->IEta(),t->IPhi()); if ( (t->IEta() == iEta) && (t->IPhi() == iPhi) ) { fTmpHist1->Fill(t->EmPmt(iPmt)); } } } fTmpHist1->Draw(); } //_____________________________________________________________________________ void DataVal::PlotCalHadChannel(int iEta, int iPhi, int iPmt) { // char name[200]; char title[200]; if (fTmpHist1) { delete fTmpHist1; } // book histograms sprintf(title,"HAD PMT %i, ieta = %i iphi = %i",iPmt, iEta, iPhi); fTmpHist1 = new TH1F("h_tmp", title, 500,0,2500); if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); for (Int_t jentry=0; jentryGetEntry(jentry); int ntowers = fCalData->NTowers(); for (int i=0; iTower(i); if ( (t->IEta() == iEta) && (t->IPhi() == iPhi) ) { fTmpHist1->Fill(t->HadPmt(iPmt)); } } } fTmpHist1->Draw(); } //----------------------------------------------------------------------------- // L1 trigger //----------------------------------------------------------------------------- void DataVal::Level1(int nev) { // char name[200]; char title[200]; if (fHL1.fUnprescaledBits) { // delete all the histograms delete fHL1.fNBits; delete fHL1.fUnprescaledBits; delete fHL1.fPrescaledBits; delete fHL1.fMyronFlag; delete fHL1.fBunchCounter; delete fHL1.fCalibType; delete fHL1.fAbortMarker; delete fHL1.fB0Marker; delete fHL1.fBCMarker; } // book histograms sprintf(title,"TFRD: N(L1 bits) ON after prescaling"); fHL1.fNBits = new TH1F("h_l1_nbits", title,64 ,0,64); sprintf(title,"TFRD: Unprescaled L1 Trigger bits"); fHL1.fUnprescaledBits = new TH1F("h_l1_unprescaled", title,64 ,0,64); sprintf(title,"TFRD: Prescaled L1 Trigger bits"); fHL1.fPrescaledBits = new TH1F("h_l1_prescaled", title,64 ,0,64); sprintf(title,"TSID: Myron Flag (L2 event buffer)"); fHL1.fMyronFlag = new TH1F("h_myron_flag", title,10 ,0,10); sprintf(title,"TSID: Bunch Counter"); fHL1.fBunchCounter = new TH1F("h_bunch_counter", title,200 ,0,200); sprintf(title,"TSID: Calibration Type"); fHL1.fCalibType = new TH1F("h_calibration_type", title,200 ,0,200); sprintf(title,"TSID: Abort Marker"); fHL1.fAbortMarker = new TH1F("h_abort_marker", title,5 ,0,5); sprintf(title,"TSID: Bunch Zero Marker"); fHL1.fB0Marker = new TH1F("h_b0_marker", title,5 ,0,5); sprintf(title,"TSID: Bunch Crossing Marker"); fHL1.fBCMarker = new TH1F("h_bc_marker", title,5 ,0,5); if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); if (nev > 0) nentries = nev; for (Int_t jentry=0; jentryGetEntry(jentry); TTsid* tsid = fTriggerBlock->Tsid(); fHL1.fMyronFlag->Fill(tsid->MyronFlag()); fHL1.fBunchCounter->Fill(tsid->BunchCounter()); fHL1.fCalibType->Fill(tsid->CalibType()); fHL1.fAbortMarker->Fill(tsid->AbortMarker()); fHL1.fB0Marker->Fill(tsid->B0Marker()); fHL1.fBCMarker->Fill(tsid->BCMarker()); int n_prescaled_bits = 0; TTfrd* tfrd = fTriggerBlock->Tfrd(); for (int i=0; i<64; i++) { if (tfrd->UnprescaledL1Bit(i)) { fHL1.fUnprescaledBits->Fill(i); } if (tfrd->PrescaledL1Bit(i)) { fHL1.fPrescaledBits->Fill(i); n_prescaled_bits++; } } fHL1.fNBits->Fill(n_prescaled_bits); } } //----------------------------------------------------------------------------- // JetClu //----------------------------------------------------------------------------- void DataVal::JetClu(int nev) { // char name[200]; char title[200]; if (fHJetClu.fNJets) { // delete all the histograms delete fHJetClu.fNJets; delete fHJetClu.fJetEt; delete fHJetClu.fSeedEt; delete fHJetClu.fJetEta; delete fHJetClu.fJetPhi; } // book histograms sprintf(title,"JETCLU: N(jets)"); fHJetClu.fNJets = new TH1F("h_jetclu_njets", title,50 ,0,50); sprintf(title,"JETCLU: Jet Et"); fHJetClu.fJetEt = new TH1F("h_jetclu_jet_et", title, 200 ,0,40); sprintf(title,"JETCLU: Jet Eta"); fHJetClu.fJetEta = new TH1F("h_jetclu_jet_eta", title, 125 ,-2.5,2.5); sprintf(title,"JETCLU: Jet Phi"); fHJetClu.fJetPhi = new TH1F("h_jetclu_jet_phi", title, 126,0,6.3); sprintf(title,"JETCLU: Seed tower Et"); fHJetClu.fSeedEt = new TH1F("h_jetclu_seed_et", title,200 ,0,20); if (fTree == 0) return; Int_t nentries = Int_t(fTree->GetEntries()); if (nev > 0) nentries = nev; for (Int_t jentry=0; jentryGetEntry(jentry); b_JetClu->GetEntry(jentry); int njets = fJetClu->NJets(); fHJetClu.fNJets->Fill(njets); for (int i=0; iJet(i); fHJetClu.fJetEt->Fill(jet->fEt); fHJetClu.fJetEta->Fill(jet->Momentum()->Eta()); float phi = TVector2::Phi_0_2pi(jet->Momentum()->Phi()); fHJetClu.fJetPhi->Fill(phi); fHJetClu.fSeedEt->Fill(jet->SeedEt()); } } } //----------------------------------------------------------------------------- // Vertex //----------------------------------------------------------------------------- void DataVal::Vertex(int nev, int myron){ char name[100], title[100]; if (fTree == 0) return; if (fHVertex.fZ) { delete fHVertex.fN; delete fHVertex.fZ; delete fHVertex.fNTracks; delete fHVertex.fCharge; } sprintf(name, "h_vertex_n"); sprintf(title,"VERTEX: N(vertices)"); fHVertex.fNTracks = new TH1F(name,title,10,0,10); sprintf(name, "h_vertex_z"); sprintf(title,"VERTEX: Z coordinate"); fHVertex.fZ = new TH1F(name, title,200 ,-250,250); sprintf(name, "h_vertex_ntrack"); sprintf(title,"VERTEX: N(tracks)"); fHVertex.fN = new TH1F(name,title,50,0,50); sprintf(name, "h_vertex_q"); sprintf(title,"VERTEX: total charge"); fHVertex.fCharge = new TH1F(name,title,50,-25,25); Int_t nentries = Int_t(fTree->GetEntries()); if (nev > 0) nentries = nev; Int_t nbytes = 0, nb = 0; for (Int_t j=0; jGetEntry(j); nbytes += nb; int nv = fVertex->GetEntriesFast(); // fill histograms for the number of hits fHVertex.fN->Fill(nv); for (int iv=0; ivUncheckedAt(iv); fHVertex.fZ->Fill(v->Z()); fHVertex.fNTracks->Fill(v->NTracks()); fHVertex.fCharge->Fill(v->Q()); } } }