Bool_t myAna::Process(Long64_t entry) { GetEntry(entry); for (size_t p=0; p<7; p++) nEvents[p][0]++; string RUN = Form("%i",runNumber); std::string BEAM = TB_RUNS_DATA.get<std::string>(RUN+".BEAM"); std::string ENERGY = TB_RUNS_DATA.get<std::string>(RUN+".ENERGY"); std::string SENSOR = TB_RUNS_DATA.get<std::string>(RUN+".SENSOR"); std::string HV1 = TB_RUNS_DATA.get<std::string>(RUN+".HV1"); std::string HV2 = TB_RUNS_DATA.get<std::string>(RUN+".HV2"); Char_t set = 0; if (SENSOR=="P120" || SENSOR=="N120") set = 1; else if (SENSOR=="P200" || SENSOR=="N200") set = 2; else if (SENSOR=="P300" || SENSOR=="N300") set = 3; else Abort(Form("Mission Abort! The set does not existe pas. Sensor=%s", SENSOR.c_str())); //cout<<"\t Run number = **"<<RUN<<"** BEAM ="<<BEAM<<endl; //Info("Process loop", "\t Run number = ** %s ** BEAM = %s", RUN.c_str(), BEAM.c_str()); //TString msg = TString::Format("RUN: %s", RUN.c_str()); //if (gProofServ) gProofServ->SendAsynMessage(msg); Float_t wc_dx = wc_recox[0]-wc_recox[1]; Float_t wc_dy = wc_recoy[0]-wc_recoy[1]; hists->fillProfile(runNumber, wc_dx, "WC_dx",";Run Number;Wire chambers x1-x2, mm", runs[1]-runs[0], runs[0], runs[1], -10, 10, 1, "PER-RUN"); hists->fillProfile(runNumber, wc_dy, "WC_dy",";Run Number;Wire chambers y1-y2, mm", runs[1]-runs[0], runs[0], runs[1], 10, 10, 1, "PER-RUN"); UInt_t front = static_cast<UInt_t>(PadsEnum::SiPad1); UInt_t back = static_cast<UInt_t>(PadsEnum::SiPad6); for (size_t tagIndex=0; tagIndex<4; tagIndex++) { string tag = "_"; if (tagIndex==1 && TB==2) continue; // Disable for June's Runs (only one energy is available) if (tagIndex==2) continue; // Disable for now, takes too long to run if (tagIndex==3) continue; // Disable for now, takes too long to run if (tagIndex==0) tag = "_GROUP_0_"+BEAM+"_SENSOR_"+SENSOR+"_irrHV_"+HV2; else if (tagIndex==1) tag = "_GROUP_1_"+BEAM+"_E"+ENERGY+"GEV_SENSOR_"+SENSOR+"_irrHV_"+HV2; else if (tagIndex==2 && BEAM!="NOBEAM") tag = "_GROUP_2_SENSOR_"+SENSOR+"_irrHV_"+HV2; else if (tagIndex==3) tag = "_RUN_"+RUN+"_"+BEAM+"_E"+ENERGY+"GEV_SENSOR_"+SENSOR+"_irrHV_"+HV2; if (tagIndex==1 && BEAM!="ELE") continue; // only do this for ELEctron runs, because of two energies hists->fill1DHist(t_at_threshold[0], "TrigDelay_Scintilator"+tag, ";Time of Trigger (scintilator), ns; Events", 200, 150,180, 1, "Timing"+tag); for (size_t pad = 1; pad<7; pad++){ string suffix = Form("%s_ch%i", PadsMap[pad].c_str(), (int)pad); Float_t aMiPcOr = 1.0; if (TB==1 && HV2=="600" && (pad==1||pad==2||pad==3||pad==6)) aMiPcOr = 0.875; Float_t mipsInPad = wave_max[pad]/ADCperMIP[10*set+pad]/aMiPcOr; // ---- // Pedestals // ---- hists->fill1DHist(pedestal[pad], "Pedestal_"+suffix+tag, ";Pedestal, ADC count; Events", 200, ped_offset,ped_offset+180, 1, "Other"+tag); hists->fill1DHist(pedestalRMS[pad], "PedestalRMS_"+suffix+tag, ";Pedestal RMS (Noise), ADC count;Events", 200, 0,30, 1, "Other"+tag); if (tagIndex==0) { //This one only do once (becasuse it's a plot Per run) hists->fillProfile(runNumber, pedestal[pad], "Pedestal_PerRun_"+suffix, ";Run Number;Pedestal, ADC count", runs[1]-runs[0], runs[0], runs[1], ped_offset-50, ped_offset+300, 1, "PER-RUN"); //and this one hists->fillProfile(runNumber, pedestalRMS[pad], "PedestalRMS_PerRun_"+suffix, ";Run Number;Pedestal RMS, ADC count", runs[1]-runs[0], runs[0], runs[1], 0, 60, 1, "PER-RUN"); } const Float_t Scint = t_at_threshold[0]-trig_offset; // --------------------- // Count events here: //---------------------- FillHistoCounts(0, suffix,tag); if (wave_max[front]/ADCperMIP[10*set+front] < 15){ FillHistoCounts(1, suffix,tag); if (tagIndex==0 && mipsInPad > 5 && mipsInPad < 10){ hists->fill1DHist(runNumber, "Events_PerRun_Cut3_"+suffix, ";Run Number;Events", runs[1]-runs[0], runs[0], runs[1], 1, "PER-RUN"); FillHistoCounts(3, suffix,tag); } if (tagIndex==0 && mipsInPad > 10 && mipsInPad < 15){ hists->fill1DHist(runNumber, "Events_PerRun_Cut4_"+suffix, ";Run Number;Events", runs[1]-runs[0], runs[0], runs[1], 1, "PER-RUN"); FillHistoCounts(4, suffix,tag); } if (tagIndex==0 && mipsInPad > 15){ hists->fill1DHist(runNumber, "Events_PerRun_Cut5_"+suffix, ";Run Number;Events", runs[1]-runs[0], runs[0], runs[1], 1, "PER-RUN"); FillHistoCounts(5, suffix,tag); } } else { FillHistoCounts(2, suffix,tag); if (tagIndex==0 && mipsInPad > 5 && mipsInPad < 10){ hists->fill1DHist(runNumber, "Events_PerRun_Cut6_"+suffix, ";Run Number;Events", runs[1]-runs[0], runs[0], runs[1], 1, "PER-RUN"); FillHistoCounts(6, suffix,tag); } if (tagIndex==0 && mipsInPad > 10 && mipsInPad < 15){ hists->fill1DHist(runNumber, "Events_PerRun_Cut7_"+suffix, ";Run Number;Events", runs[1]-runs[0], runs[0], runs[1], 1, "PER-RUN"); FillHistoCounts(7, suffix,tag); } if (tagIndex==0 && mipsInPad > 15){ hists->fill1DHist(runNumber, "Events_PerRun_Cut8_"+suffix, ";Run Number;Events", runs[1]-runs[0], runs[0], runs[1], 1, "PER-RUN"); FillHistoCounts(8, suffix,tag); } } // All events are accouted for.. // ------------------- // NOW. // --- Only for good signals (#Mips > X) // ---------------------- if (mipsInPad > nMIPs){ // Here let's just plot the time delay from trigger hists->fill1DHist(t_max_frac50[pad]-Scint, "TrigDelay_frac50_"+suffix+tag, ";Frac50 Time from trigger, ns;Events", 200, -2,4, 1,"Timing"+tag); hists->fill1DHist(t_max[pad] - t_max_frac30[pad], "RisingEdge_30toMax_"+suffix+tag, ";Rising edge from 30% to Max, ns;Events", 200, 0.7,1.7, 1,"Timing"+tag); hists->fill1DHist(t_max_frac90[pad] - t_max_frac10[pad], "RisingEdge_10to90_"+suffix+tag, ";Rising edge from 10% to 90%, ns;Events", 200, 0.7,1.7, 1,"Timing"+tag); //hists->fill1DHist(t_max[pad], "TrigDelay_NoCorrection"+suffix, // ";Time from trigger, ns;Events", 200, -20,60, 1,"Timing"); hists->fill1DHist(charge_integ[pad]/1000, "Charge_"+suffix+tag, ";Integral of the pulse (Charge) #times 1000;Events", 200, 0, 15, 1,"Pulse"+tag); if (tagIndex==0 && BEAM!="NOBEAM") { // This stuff only needs to be done once! // Here, let's see how much would the cut on wires change the results: if (fabs(wc_dx-wc_cut_x[set]) < 1 && fabs(wc_dy-wc_cut_y[set]) < 1) nEvents[pad][2]++; hists->fill2DHist(wc_dx, wc_dy, "WC_dx_dy"+tag, ";WC x1-x2, mm;WC y1-y2, mm;", 200, -10,10, 200, -10,10, 1,"Other"+tag); // Do pedestals again, but this time only when there is signal. hists->fillProfile(runNumber, pedestal[pad], "Pedestal_PerRun_WithSig_"+suffix, ";Run Number;Pedestal, ADC count", runs[1]-runs[0], runs[0], runs[1], ped_offset-50, ped_offset+300, 1, "PER-RUN"); hists->fillProfile(runNumber, pedestalRMS[pad], "PedestalRMS_PerRun_WithSig_"+suffix, ";Run Number;Pedestal RMS, ADC count", runs[1]-runs[0], runs[0], runs[1], 0, 60, 1, "PER-RUN"); } } for (size_t step=0; step<4; step++){ // --- // Here let's make a profile of all the waveforms // Do this for four different ranges on nMIPS: // [ 3*pedeatalRMS -- 5 MIPS -- 10 MIPS -- 20 MIPS -- above] // --- // Note: if setps 0,1,2 are 'continued' it means they wont run. // This is to speed up things, they take too long... Comment out those lines to include the plots if (step==0) continue; if (step==1) continue; if (step==2) continue; if (step==0 && (wave_max[pad] < 3*pedestalRMS[pad] || mipsInPad > 5)) continue; if (step==1 && (mipsInPad < 5 || mipsInPad > 10)) continue; if (step==2 && (mipsInPad < 10 || mipsInPad > 20)) continue; if (step==3 && (mipsInPad < 20)) continue; for (size_t w=0; w<50; w++){ hists->fillProfile(time_aroundmax[pad][w]*1E9 - t_max_frac50[pad], wave_aroundmax[pad][w]/wave_max[pad], "Waveform_pulse_MIPrange_"+(string)Form("%zu_",step)+suffix+tag, ";Time (zero at 50%), ns;Pulse shape, normalized at peak", 300, -2,5, -2, 2, 1, "Pulse"+tag); hists->fillProfile(time_aroundmax[pad][w]*1E9 - t_max_frac50[pad], wave_aroundmax[pad][w]/wave_max[pad], "Waveform_full_MIPrange_"+(string)Form("%zu_",step)+suffix+tag, ";Time (zero at 50%), ns;Pulse shape, normalized at peak", 300, -20,30, -2, 2, 1, "Pulse"+tag); // See what's up with the double peak structure /* if (t_max_frac50[pad]-Scint > 1) hists->fillProfile(time_aroundmax[pad][w]*1E9 - t_max_frac50[pad], wave_aroundmax[pad][w]/wave_max[pad], "Waveform_DoublePeak_MIPrange_"+(string)Form("%zu_",step)+suffix+tag, ";Time (zero at 50%), ns;Pulse shape, normalized at peak", 300, -20,30, -2, 2, 1, "Pulse"+tag); */ } } // ------ // Can't rely on the Trigger for good timing study. // Instead let's use the first diod (SiPad1) as a reference ('front'). // ---- const Float_t refPad1 = t_max_frac50[front]; // Only get the timing if both pads have high signals if (mipsInPad > nMIPs && wave_max[front]/ADCperMIP[10*set+front] > nMIPs && pad!=front){ // Only do this for time at 50% threshold for now //hists->fill1DHist(t_at_threshold[pad] - refPad1, "Delay_from_Pad1_threshold_"+suffix+tag, //";At Thresh Time from SiPad1 (frac50), ns;Events", 200, -0.6,0.6, 1,"Timing"+tag); hists->fill1DHist(t_max_frac30[pad] - refPad1, "Delay_from_Pad1_frac30_"+suffix+tag, ";Frac30 Time from SiPad1 (frac50), ns;Events", 200, -0.6,0.6, 1,"Timing"+tag); hists->fill1DHist(t_max_frac50[pad] - refPad1, "Delay_from_Pad1_frac50_"+suffix+tag, ";Frac50 Time from SiPad1 (frac50), ns;Events", 200, -0.6,0.6, 1,"Timing"+tag); hists->fill1DHist(t_max_frac50[pad] - refPad1, "Delay_from_Pad1_frac50_wide_"+suffix+tag, ";Frac50 Time from SiPad1 (frac50), ns;Events", 200, -10,10, 1,"Timing"+tag); hists->fill1DHist(t_max[pad] - refPad1, "Delay_from_Pad1_peak_"+suffix+tag, ";Peak Time from SiPad1 (frac50), ns;Events", 200, 0.3,1.6, 1,"Timing"+tag); } // Select good signal in Pad 1 and make 2D plots in other Pads if (wave_max[front]/ADCperMIP[10*set+front] > nMIPs && pad!=front){ hists->fill1DHist(mipsInPad, "nMIPs_"+suffix+tag, ";Number of MiPs;Events", 400, 0,60, 1,"Other"+tag); hists->fill1DHist(wave_max[pad]/pedestalRMS[pad], "Signal_over_noise_"+suffix+tag, ";Signal/Noise;Events", 400, 2,160, 1,"Other"+tag); hists->fill2DHist(mipsInPad, t_max_frac50[pad] - refPad1, "2D_Delay_from_Pad1_frac50_VS_nMIPs_"+suffix+tag, ";Number of MiPs;T_{padX} - T_{pad1}, ns", 400, 0,60, 200, -0.6,0.6, 1,"Timing"+tag); hists->fill2DHist(wave_max[pad]/pedestalRMS[pad], t_max_frac50[pad] - refPad1, "2D_Delay_from_Pad1_frac50_VS_SigOverNoise_"+suffix+tag, ";Signal/Noise;T_{padX} - T_{pad1}, ns", 400, 2,160, 200, -0.6,0.6, 1,"Timing"+tag); } } // ---- // Compare front vs back Pads // --- hists->fill2DHist(wave_max[front]/ADCperMIP[10*set+front], wave_max[back]/ADCperMIP[10*set+back], "2D_Mips_fron_back"+tag, ";Front sensor apmplitude, MiPs;Back sensor apmplitude, MiPs", 200, 0,100, 200, 0,100, 1,"Other"+tag); if (wave_max[front]/ADCperMIP[10*set+front]>nMIPs && wave_max[back]/ADCperMIP[10*set+back]>nMIPs){ hists->fill1DHist(t_max_frac50[back] - t_max_frac50[front], "FrontToBackPadsDelay"+tag, ";Time delay, (Pad6 - Pad1), ns;Events", 100, -0.5,0.8, 1,"Timing"+tag); // Now, we have high signals in both front and back diodes, // lets look at wire chambers: if (tagIndex==0) { //only do this once hists->fillProfile(runNumber, wc_dx, "WC_dx_sig",";Run Number;Wire chambers x1-x2, mm", runs[1]-runs[0], runs[0], runs[1], -10, 10, 1, "PER-RUN"); hists->fillProfile(runNumber, wc_dy, "WC_dy_sig",";Run Number;Wire chambers y1-y2, mm", runs[1]-runs[0], runs[0], runs[1], -10, 10, 1, "PER-RUN"); } // And this one for all different setups: hists->fill2DHist(wc_dx, wc_dy, "WC_dx_dy_sig"+tag, ";WC x1-x2, mm;WC y1-y2, mm;", 200, -10,10, 200, -10,10, 1,"Other"+tag); } } //if (nEvents[0]<20) //std::cout<<"We are processing ev number "<<nEvents[0]<<endl; return kTRUE; }
Bool_t zgamma::Process(Long64_t entry) { GetEntry(entry); CountEvents(0, "Ntuple events",fcuts); FillHistoCounts(0, 1); if (nEvents[0] % (int)5e4 == 0) cout<<nEvents[4]<<" events passed of "<<nEvents[0]<<" checked!"<<endl; if (nEvents[0] == 1) weighter->SetDataBit(isRealData); //if (nEvents[0]>20) Abort("enough is enosugh!"); ////////////////// //Trigger status// ////////////////// Bool_t triggerPass = 1; Bool_t isFound = 0; Int_t prescale = 99; Float_t eventWeight = 1.0; for (UInt_t i =0; i<ntrig; i++) { triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); if(triggerPass) nEventsTrig[0][i]++; } eventWeight = weighter->PUWeight(nPUVerticesTrue); //cout<<" weight="<<eventWeight<<endl; ObjID->SetEventInfo(isRealData, runNumber, eventNumber, rhoFactor); float phoMvaScore; //cout<<eventNumber<<" ev rho = "<<rhoFactor<<endl; hists->fill1DHist(nPUVerticesTrue, "nPUVerticesTrue",";nPUVerticesTrue", 100, 0,100, 1,"GEN"); hists->fill1DHist(nPUVertices, "nPUVertices",";nPUVertices", 100, 0,100, 1,"GEN"); nVtx = primaryVtx->GetSize(); HM->Reset(rhoFactor, nVtx); // --- Primary vertex ---// if (nVtx<1) return kTRUE; TCPrimaryVtx *mainPrimaryVertex = 0; mainPrimaryVertex = (TCPrimaryVtx*)(primaryVtx->At(0)); TVector3* pvPosition; pvPosition = mainPrimaryVertex; HM->SetVtx(*mainPrimaryVertex); // ----------------------// // Gen level particles --// //-----------------------// vector<TCPhysObject> gen_mu, gen_el; TCPhysObject gen_gamma, gen_l1, gen_l2, gen_lPt1, gen_lPt2; TCPhysObject gen_higgs, gen_gamma_st1; //ZGAnlgles: double gen_co1,gen_co2,gen_phi,gen_co3; Float_t genMll = 0; Float_t gendR = 0; Float_t genMllg = 0; if(!isRealData && makeGen){ //Int_t ZID = 3000001; //made-up particle that decays to l+l- Int_t A = 25; if (sample=="DY") A=23; Int_t fsr_mu_count = 0, fsr_el_count=0; Int_t ph=0, h=0; for (int i = 0; i < genParticles->GetSize(); ++i) { TCGenParticle* thisParticle = (TCGenParticle*) genParticles->At(i); if (thisParticle->GetPDGId()==23) hists->fill1DHist(thisParticle->M(), "gen_Z_mass",";m_{Z}^{gen} (GeV)", 200, 0,200, 1,"GEN"); //Higgs himself: if (thisParticle->GetPDGId()==25 && (thisParticle->GetStatus()==3 || thisParticle->GetStatus()==22)){ hists->fill1DHist(thisParticle->M(), "gen_H_mass",";m_{H}^{gen} (GeV)", 100, 100,200, 1,"GEN"); //ObjID->DiscoverGeneology(thisParticle); gen_higgs = *thisParticle; //h++; } //GEN MUONS if (abs(thisParticle->GetPDGId()) == 13 && thisParticle->GetStatus()==1) { if (ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()==A) { hists->fill1DHist(thisParticle->M(), "gen_mu_mass",";gen mu mass", 200, -1,1, 1,"GEN"); gen_mu.push_back(*thisParticle); //ObjID->DiscoverGeneology(thisParticle); } //this is for the Madgraph case, where there are events with no Higgs in LHE file //(while there are always should be): else if (h==0 && thisParticle->Mother() //good boys should have a mother && ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId() == thisParticle->GetPDGId()) { //cout<<" --- this one --->>>"<<endl; //ObjID->DiscoverGeneology(thisParticle); //cout<<" <<--- this one"<<endl; hists->fill1DHist(thisParticle->M(), "gen_mu_mass",";gen mu mass", 200, -1,1, 1,"GEN"); gen_mu.push_back(*thisParticle); } } //GEN ELECTRONS if (abs(thisParticle->GetPDGId()) == 11 && thisParticle->GetStatus()==1) { if (ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()==A) gen_el.push_back(*thisParticle); else if (h==0 && thisParticle->Mother() && ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId() == thisParticle->GetPDGId()) gen_el.push_back(*thisParticle); } //if (thisParticle->GetPDGId()==22 && thisParticle->Pt()>2) // ObjID->DiscoverGeneology(thisParticle); //PHOTON from the Higgs if (thisParticle->GetPDGId()==22 && (thisParticle->GetStatus()==1 || thisParticle->GetStatus()==23) && thisParticle->Mother() && abs(thisParticle->Mother()->GetPDGId())!=11 && abs(thisParticle->Mother()->GetPDGId())!=13 && abs(thisParticle->Mother()->GetPDGId())!=15) { //cout<<" DBG gen particles. Ancestorr = "<<ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()<<endl; if (ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()==A || thisParticle->Mother()->GetPDGId()==A){ gen_gamma = *thisParticle; ph++; } else if (h==0 && ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId() == thisParticle->GetPDGId()) { gen_gamma = *thisParticle; ph++; } } else if (sample=="DY" && thisParticle->GetPDGId()==22 && thisParticle->GetStatus()==1 && ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()==23) gen_gamma = *thisParticle; // **** Find FSR PHOTONS *** // if (thisParticle->GetPDGId()==22 //&& thisParticle->GetStatus()==1 && thisParticle->Mother() //&& ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()==A && selection=="mugamma" && abs(thisParticle->Mother()->GetPDGId())==13 ) { hists->fill1DHist(thisParticle->Pt(), "gen_fsr_pho_pt",";gen fsr photon pt", 200, 0,30, 1,"GEN"); // if (ObjID->GetPrimaryAncestor(thisParticle)->GetPDGId()!=A) //if (thisParticle->Pt() > 30) //ObjID->DiscoverGeneology(thisParticle); Float_t preFSR_pt = thisParticle->Mother()->Pt(); for (int j = 0; j < genParticles->GetSize(); ++j) { TCGenParticle* fsr = (TCGenParticle*) genParticles->At(j); if(fsr->GetPDGId() == thisParticle->Mother()->GetPDGId() && fsr->Mother() == thisParticle->Mother()){ //cout<<" 0--- this one --->>>"<<endl; //ObjID->DiscoverGeneology(fsr); //cout<<" <<---0 this one"<<endl; hists->fill1DHist((preFSR_pt - fsr->Pt())/preFSR_pt, "gen_fsr_mu_dPt",";gen mu (Pt_preFSR - Pt_afterFSR)/pt", 200, -0.4,1, 1,"GEN"); if(thisParticle->Pt() > 1) hists->fill1DHist((preFSR_pt - fsr->Pt())/preFSR_pt, "gen_fsr_mu_dPt_photonPt1",";gen mu (Pt_preFSR - Pt_afterFSR)/pt", 200, -0.4,1, 1,"GEN"); fsr_mu_count++; } } }//end of fsr photons loop }// end of genparticles loop if (ph!=1 && (sample=="dalitz" || sample =="HZG")) Abort(Form("ev #%i NONONO There has to be exactly one photon from the Higgs! \n \t\t but there is %i", (int)eventNumber, (int)ph)); //if (h!=1 && sample=="dalitz") //return kTRUE; //Abort(Form(" NONONO There has to be exactly one Higgs! \n \t\t but there is %i", h)); sort(gen_el.begin(), gen_el.end(), P4SortCondition); sort(gen_mu.begin(), gen_mu.end(), P4SortCondition); hists->fill1DHist(fsr_mu_count, "gen_mu_fsrcount",";gen mu FSR", 4, 0,4, 1,"GEN"); hists->fill1DHist(fsr_el_count, "gen_el_fsrcount",";gen el FSR", 4, 0,4, 1,"GEN"); if(selection=="mugamma"){ if (gen_mu.size()!=2) return kTRUE; //Abort(Form("ev #%i NONONO There has to be exactly 2 muons from the Higgs! \n \t\t but there are %i", eventNumber, (int)gen_mu.size())); gen_lPt1 = gen_mu[0]; gen_lPt2 = gen_mu[1]; // If there are more muons - it's confusing, so let's just ignore them for now. // (they may come from ZH -> ZZgamma process) if (gen_mu[0].Charge()==1 && gen_mu[1].Charge()==-1){ gen_l1 = gen_mu[0]; gen_l2 = gen_mu[1]; } else if (gen_mu[0].Charge()==-1 && gen_mu[1].Charge()==1){ gen_l1 = gen_mu[1]; gen_l2 = gen_mu[0]; } else Abort("They are the same charge!"); //cout<<"\t\t event = "<<eventNumber<<" "<<endl; //cout<<" charge = "<<gen_l1.Charge()<<" pt = "<<gen_l1.Pt()<<" eta="<<gen_l1.Eta()<<" phi="<<gen_l1.Phi()<<endl; //cout<<" charge = "<<gen_l2.Charge()<<" pt = "<<gen_l2.Pt()<<" eta="<<gen_l2.Eta()<<" phi="<<gen_l2.Phi()<<endl; } if (gen_el.size()!=2 && gen_mu.size()!=2) Abort(Form(" - - WARNING - -\n ev #%i What's up with that?\n There should be exact two leptons from Higgs. Insteat there %i", (int)eventNumber, (int)(gen_el.size() + gen_mu.size()))); if (gen_gamma.E()==0 && sample=="dalitz")// return kTRUE; Abort(Form("%i: No gen gamma in an event? that sounds bad",(int)eventNumber));//return kTRUE; if (sample=="dalitz" || sample=="HZG"){ ang->GetAngles(gen_l1, gen_l2, gen_gamma, gen_co1,gen_co2,gen_phi,gen_co3); //cout<<eventNumber<<" gen Angles: c1= "<<co1<<" c2="<<co2<<" gen_phi="<<gen_phi<<" coTh="<<co3<<endl; hists->fill1DHist(gen_co1, "gen_co1",";gen cos_lp", 100,-1,1, 1,"GEN"); hists->fill1DHist(gen_co2, "gen_co2",";gen cos_lm", 100,-1,1, 1,"GEN"); hists->fill1DHist(gen_co3, "gen_co3",";gen cosTheta",100,-1,1, 1,"GEN"); hists->fill1DHist(gen_phi, "gen_phi",";gen phi lp", 100, -TMath::Pi(), TMath::Pi(), 1,"GEN"); } gendR = gen_l1.DeltaR(gen_l2); genMll = (gen_l1+gen_l2).M(); genMllg = (gen_l1+gen_l2+gen_gamma).M(); hists->fill1DHist(genMll,"gen_Mll_init", ";m_{#mu#mu}",50,0, 20, 1,"GEN"); hists->fill1DHist(genMll,"gen_Mll_init_b40", ";m_{#mu#mu}", 40,0, 20, 1,"GEN"); hists->fill1DHist(genMll,"gen_Mll_low", ";m_{#mu#mu}",100,0, 1, 1,"GEN"); hists->fill1DHist(genMll,"gen_Mll_50", ";m_{#mu#mu}",100,0, 50, 1,"GEN"); hists->fill1DHist(genMll,"gen_Mll_full", ";m_{#mu#mu}",200,0,130, 1,"GEN"); hists->fill1DHist(genMll,"gen_Mll_inter",";m_{#mu#mu}",100,20,80, 1,"GEN"); hists->fill1DHist(genMll,"gen_Mll_0",";gen_Mll",100,0,mllMax, 1,"eff"); hists->fill1DHist(gendR, "gen_dR_0", ";gen_dR", 50,0,0.3,1,"eff"); hists->fillProfile(gendR, genMll, "gen_Mll_vs_dR", ";dR(l1,l2);M(l1,l2)", 100, 0, 0.5, 0, 20, 1,"eff"); //Acceptance study (do not erase!) if (sample =="dalitz" && gen_gamma.Pt()>cut_gammapt && fabs(gen_gamma.Eta())<2.5){ hists->fill1DHist(genMll, "gen_Mll_acc_gamma",";gen_Mll",100,0,mllMax, 1,"eff"); hists->fill1DHist(gendR, "gen_dR_acc_gamma", ";gen_dR", 50,0,0.3,1,"eff"); if(sample=="dalitz" && gen_lPt1.Pt()>cut_l1pt && fabs(gen_lPt1.Eta())<2.4 && gen_lPt2.Pt()>cut_l2pt_low && fabs(gen_lPt2.Eta())<2.4 ){ hists->fill1DHist(genMll, "gen_Mll_acc_lept", ";gen_Mll",100,0,mllMax, 1,"eff"); hists->fill1DHist(gendR, "gen_dR_acc_lept", ";gen_dR", 50,0,0.3,1,"eff"); } else if (accCut) return kTRUE; } else if (accCut) return kTRUE; if (sample == "dalitz" || sample=="HZG"){ hists->fill1DHist(gen_l1.DeltaR(gen_gamma),"gen_l1gamma_deltaR",";#Delta R(#mu_{1}, #gamma)",100,0,5, 1,"GEN"); hists->fill1DHist(gen_l2.DeltaR(gen_gamma),"gen_l2gamma_deltaR",";#Delta R(#mu_{2}, #gamma)",100,0,5, 1,"GEN"); hists->fill1DHist(gen_higgs.Pt(), "gen_higgs_pt", ";p_{T}^{H} (GeV)", 100, 0,150, 1, "GEN"); hists->fill1DHist(gen_higgs.M(), "gen_higgs_mass",";m_{H} (GeV)", 100, 100,180, 1, "GEN"); hists->fill1DHist(gen_gamma.Pt(), "gen_gamma_pt", ";p_{T}^{#gamma}", 50, 0,150, 1, "GEN"); hists->fill1DHist(gen_gamma.Eta(), "gen_gamma_eta", ";#eta^{#gamma}", 50, -3,3, 1, "GEN"); //hists->fill1DHist(gen_gamma_st1.Pt(), "gen_gamma_st1_pt","Pt of gamma", 50, 0,150, 1, ""); //hists->fill1DHist(gen_gamma_st1.Eta(),"gen_gamma_st1_eta","Eta of gamma", 50, -3,3, 1, ""); } FillHistoCounts(1, eventWeight); CountEvents(1,"Pass Gen acceptance",fcuts); //if (genMll<2.9 || genMll>3.3) //return kTRUE; } FillHistoCounts(2, eventWeight); CountEvents(2, "Acceptance, and JPsi selection", fcuts); //CountEvents(2, "Acceptance", fcuts); vector<TCElectron> electrons0, electrons; vector<TCMuon> muons0, muons; vector<TCPhoton> photons0, photonsTight, photonsHZG, photonsMVA, fake_photons; vector<TCJet> jets; TCPhysObject l1,l2, lPt1, lPt2; TCPhoton gamma0, gamma; TCJet jet1, jet2; //------------------------// //--- PHOTON SELECTION ---// //-----------------------// for (Int_t i = 0; i < recoPhotons->GetSize(); ++i) { //cout<<"new photon!!!!!!!"<<endl; TCPhoton* thisPhoton = (TCPhoton*) recoPhotons->At(i); //cout<<"in photon loop event = "<<eventNumber // <<"\n pt="<<thisPhoton->Pt()<<" eta="<<thisPhoton->Eta()<<" phi="<<thisPhoton->Phi()<<" px="<<thisPhoton->Px()<<endl; //if (isRealData || !makeGen || (makeGen &&gen_lPt1.DeltaR(*thisPhoton) < 0.1 && thisPhoton->Pt()>20)) //fake_photons.push_back(*thisPhoton); if (!(fabs(thisPhoton->SCEta()) < 2.5)) continue; if(thisPhoton->Pt() > 15){ //if (isRealData || !makeGen || (sample=="dalitz" && makeGen && gen_gamma.DeltaR(*thisPhoton) < 0.1) ) photons0.push_back(*thisPhoton); if(ObjID->PassPhotonIdAndIso(*thisPhoton, "CutBased-MediumWP", phoMvaScore) //&& (isRealData || !makeGen || (sample=="dalitz" && makeGen && gen_gamma.DeltaR(*thisPhoton) < 0.2) ) ) { Double_t scale = 1; Double_t corrPhoEnSC = correctedPhotonEnergy(thisPhoton->SCEnergy(), thisPhoton->SCEta(), thisPhoton->R9(), runNumber, 0, "Moriond2014", !isRealData, myRandom); Double_t corrPhoEnReco = correctedPhotonEnergy(thisPhoton->E(), thisPhoton->SCEta(), thisPhoton->R9(), runNumber, 0, "Moriond2014", !isRealData, myRandom); HM->MakePhotonEnergyCorrPlots(*thisPhoton, corrPhoEnReco, corrPhoEnSC); Double_t corrReg = correctedPhotonEnergy(thisPhoton->EnergyRegression(), thisPhoton->SCEta(), thisPhoton->R9(), runNumber, 1, "Moriond2013", !isRealData, myRandom); //Double_t Reg2 = thisPhoton->EnergyRegression()-thisPhoton->EnergyRegressionErr(); //Double_t Reg2 = myRandom->Gaus(thisPhoton->EnergyRegression(),thisPhoton->EnergyRegressionErr()); //Double_t corrReg2 = correctedPhotonEnergy(Reg2, thisPhoton->SCEta(), thisPhoton->R9(), runNumber, // 1, "Moriond2013", !isRealData, myRandom); //cout<<runNumber<<" uncor en="<< thisPhoton->E()<<" reg en = "<<thisPhoton->EnergyRegression() // <<" regerr ="<<thisPhoton->EnergyRegressionErr()<<" gaus(Reg,err)="<<Reg2<<endl; //cout<<" corrReg = "<<corrReg<<" corrReg2 = "<<corrReg2<<endl; //scale = corrPhoEnReco/thisPhoton->E(); //Yes - use this one for mumugamma //scale = corrPhoEnSC/thisPhoton->E(); //scale = corrReg2/thisPhoton->E(); scale = corrReg/thisPhoton->E(); thisPhoton->SetXYZM(scale*thisPhoton->Px(), scale*thisPhoton->Py(),scale*thisPhoton->Pz(),0); //cout<<runNumber<<" uncor en="<< thisPhoton->E()<<" cor en = "<<corrPhoEn<<endl; //thisPhoton->SetPtEtaPhiM(corrPhoEnSC/cosh(SCEta())); thisPhoton->SetIdMap("mvaScore", phoMvaScore); photonsHZG.push_back(*thisPhoton); } if(ObjID->PassPhotonIdAndIso(*thisPhoton, "CutBased-TightWP", phoMvaScore)){ thisPhoton->SetIdMap("mvaScore", phoMvaScore); photonsTight.push_back(*thisPhoton); } if(ObjID->PassPhotonIdAndIso(*thisPhoton, "MVA", phoMvaScore)){ thisPhoton->SetIdMap("mvaScore", phoMvaScore); photonsMVA.push_back(*thisPhoton); } } } sort(photons0.begin(), photons0.end(), P4SortCondition); sort(photonsTight.begin(), photonsTight.end(), P4SortCondition); sort(photonsHZG.begin(), photonsHZG.end(), P4SortCondition); sort(photonsMVA.begin(), photonsMVA.end(), P4SortCondition); //sort(fake_photons.begin(), fake_photons.end(), P4SortCondition); //if (fake_photons.size()>1) // Abort("Nah, this is too much."); //if (photonsTight.size()<1) return kTRUE; //gamma = photonsTight[0]; if (photonsHZG.size()<1) return kTRUE; gamma = photonsHZG[0]; //if (photonsMVA.size()<1) return kTRUE; //gamma = photonsMVA[0]; if (!isRealData) eventWeight *= weighter->PhotonSF(gamma); //if (photons0.size()<1) return kTRUE; //gamma0 = photons0[0]; //if (gamma0.Pt() < cut_gammapt) return kTRUE; //------------------------// //--- ELECTRON SELECTION ---// //-----------------------// for (Int_t i = 0; i < recoElectrons->GetSize(); ++i) { TCElectron* thisElec = (TCElectron*) recoElectrons->At(i); if (!(fabs(thisElec->Eta()) < 2.5)) continue; if (thisElec->Pt() > 10.0){ if(isRealData || !makeGen || ( selection=="elgamma" && makeGen && (gen_l1.DeltaR(*thisElec) < 0.1 || gen_l2.DeltaR(*thisElec)<0.1) && thisElec->Pt()>10)) { if (thisElec->MvaID() > -0.50 && thisElec->Pt()>20) electrons.push_back(*thisElec); } if ( //PassElectronIdAndIsoMVA(thisElec) ObjID->PassElectronIdAndIso(*thisElec, pvPosition, "Loose") ) electrons0.push_back(*thisElec); } } sort(electrons0.begin(), electrons0.end(), P4SortCondition); sort(electrons.begin(), electrons.end(), P4SortCondition); if (doZee){ //----------------------// //------ Z->ee STUDY ---// //----------------------// if (electrons.size()<2 || photons0.size()<2) return kTRUE; //cout<<"doing zee. Enough photons and electrons!"<<endl; if (checkTrigger){ triggerSelector->SelectTrigger(myTrigger, triggerStatus, hltPrescale, isFound, triggerPass, prescale); if (!triggerPass) return kTRUE; } //cout<<"passed the trigger"<<endl; Int_t match1 = -1, match2 = -1; for (UInt_t p=0; p<photons0.size(); p++) { if (photons0[p].Pt() < 40 || fabs(photons0[p].SCEta())>1.4442) continue; for (UInt_t e=0; e<electrons.size(); e++) { if (photons0[p].DeltaR(electrons[e]) < 0.2) { //cout<<"matched! photon "<<p<<" to electron "<<e<<endl; if (match1==-1) match1=p; else {match2=p; break;} } } } if (match1!=-1 && match2!=-1) HM->MakeZeePlots(photons0[match1], photons0[match2]); return kTRUE; } //------------------------// //--- MUON SELECTION ---// //-----------------------// for (Int_t i = 0; i < recoMuons->GetSize(); ++ i) { TCMuon* thisMuon = (TCMuon*) recoMuons->At(i); //cout<<"event = "<<eventNumber // <<"\n pt="<<thisMuon->Pt()<<" eta="<<thisMuon->Eta()<<" phi="<<thisMuon->Phi()<<" px="<<thisMuon->Px()<<endl; if (!(fabs(thisMuon->Eta()) < 2.4)) continue; if(thisMuon->Pt() > 4) for(Int_t ev=0; ev<evSize;ev++){ if (eventNumber==hisEVTS[ev]){cout<<" mu>4 cut ---> "<<eventNumber<<" <--- Found an event after cut "<<endl; ObjID->MuonDump(*thisMuon, pvPosition); break;}} if(thisMuon->Pt() > 4 && ObjID->PassMuonId(*thisMuon, pvPosition, "Soft") ) { if (doRochCorr){ Float_t qter = 1; if (isRealData){ roch->momcor_data(*thisMuon, thisMuon->Charge(), 0, qter); if (period=="2012D") roch->momcor_data(*thisMuon, thisMuon->Charge(), 1, qter); } else roch->momcor_mc (*thisMuon, thisMuon->Charge(), 0, qter ); //cout<<"DBG rochcor. qterr = "<<qter<<endl; } muons.push_back(*thisMuon); } } sort(muons.begin(), muons.end(), P4SortCondition); if(!isRealData && makeGen){ hists->fill1DHist(genMll, "gen_Mll_reco_gamma", ";gen_Mll",100,0,mllMax, 1,"eff"); hists->fill1DHist(gendR, "gen_dR_reco_gamma", ";gen_dR", 50, 0,0.3, 1,"eff"); } if (checkTrigger){ triggerSelector->SelectTrigger(myTrigger, triggerStatus, hltPrescale, isFound, triggerPass, prescale); if (!triggerPass) return kTRUE; } if (gamma.Pt() < cut_gammapt) return kTRUE; //if (fabs(gamma.SCEta()) > 1.4442) return kTRUE; if(!isRealData && makeGen){ hists->fill1DHist(genMll, "gen_Mll_reco_gamma_iso", ";gen_Mll",100,0,mllMax, 1,"eff"); hists->fill1DHist(gendR, "gen_dR_reco_gamma_iso", ";gen_dR", 50, 0,0.3, 1,"eff"); } FillHistoCounts(3, eventWeight); CountEvents(3,"Pass Trigger and Photon reco selection",fcuts); HM->MakeNPlots(3,muons.size(), electrons.size(), electrons0.size(), photonsHZG.size(), photonsTight.size(), photonsMVA.size(), jets.size(), eventWeight); if (muons.size()<2) return kTRUE; //------------------------// //------ PICK THE Muons --// //------------------------// Float_t tmpMll = 99999; if (muons.size()==2){ lPt1 = muons[0]; lPt2 = muons[1]; } else for (UInt_t m1=0; m1 < muons.size(); m1++){ for (UInt_t m2=m1; m2 < muons.size(); m2++){ if (muons[m1].Charge()*muons[m2].Charge()==1) continue; //same charge - don't care if( (muons[m1]+muons[m2]).M() < tmpMll) { lPt1 = muons[m1]; lPt2 = muons[m2]; tmpMll = (muons[m1]+muons[m2]).M(); } } } if (lPt1.Charge()==1 && lPt2.Charge()==-1){ l1 = lPt1; l2 = lPt2; } else if (lPt1.Charge()==-1 && lPt2.Charge()==1){ l1 = lPt2; l2 = lPt1; } else{ //cout<<"ch1 = "<<muons[0].Charge()<<" ch2 = "<<muons[1].Charge()<<endl; return kTRUE;//Abort("reco * They are the same charge!"); } //------------------------// //------JET SELECTION ---// //-----------------------// for (Int_t i = 0; i < recoJets->GetSize(); ++i) { TCJet* thisJ = (TCJet*) recoJets->At(i); if (thisJ->Pt() < 30 || fabs(thisJ->Eta())>4.7) continue; if (thisJ->DeltaR(gamma) < 0.4) continue; if (thisJ->DeltaR(lPt1) < 0.3 || thisJ->DeltaR(lPt2) < 0.3) continue; if (ObjID->PassJetID(*thisJ, nVtx)) jets.push_back(*thisJ); } sort(jets.begin(), jets.end(), P4SortCondition); if (jets.size()>=1){ jet1 = jets[0]; HM->SetJet1(jet1); } Bool_t isVBF = 0; if (jets.size()>=2){ jet2 = jets[1]; HM->SetJet2(jet2); //--------------------------// //----- VBF SELECTION ------// //--------------------------// if (fabs(jet1.Eta() - jet2.Eta()) > 3. && (jet1+jet2).M() > 450 && fabs(HM->Zeppenfeld((lPt1+lPt2+gamma),jet1,jet2)) < 4 //&& (jet1+jet2).DeltaPhi(lPt1+lPt2+gamma)) > 0.1 ) isVBF = 1; } //-------------------------// //------MISSING ENERGY ---// //------------------------// HM->SetMet(*recoMET); //cout<<"MET: "<<recoMET->Mod()<<endl; //---------------------------------// //------ KINEMATIC SELECTION ------// //---------------------------------// Double_t Mll = (l1+l2).M(); Double_t Mllg = (l1+l2+gamma).M(); Double_t dR = l1.DeltaR(l2); hists->fill1DHist(Mll, Form("diLep_mass_low_cut%i", 3),";M(ll)", 50, 0,20, 1, ""); hists->fill1DHist(Mll, Form("diLep_mass_high_cut%i", 3),";M(ll)", 50, 0,120, 1, ""); if (ObjID->CalculateMuonIso(muons[0]) > 0.4) return kTRUE; //if (lPt2.Pt() > 20 && ObjID->CalculateMuonIso(&muons[1]) > 0.4) //return kTRUE; HM->MakePhotonPlots(gamma); if (lPt1.Pt() < cut_l1pt || lPt2.Pt() < cut_l2pt_low) return kTRUE; //if (!isfinite(eventWeight)) //cout<<"nan/inf "<<eventWeight<<endl; // if (fabs(eventWeight)>50 || fabs(eventWeight)<0.00001) if (!isRealData){ eventWeight *= weighter->MuonSF(lPt1); eventWeight *= weighter->MuonSF(lPt2); } if (!isfinite(eventWeight)) cout<<"nan after muon sf "<<eventWeight<<endl; if(!isRealData && makeGen){ hists->fill1DHist(genMll, "gen_Mll_two_lep_reco", ";gen_Mll",100,0,mllMax, 1,"eff"); hists->fill1DHist(gendR, "gen_dR_two_lep_reco", ";gen_dR", 50, 0,0.3, 1,"eff"); double co1,co2,phi,co3; if (sample=="dalitz" || sample=="HZG"){ ang->GetAngles(l1, l2, gamma, co1,co2,phi,co3); //cout<<eventNumber<<" gen Angles: c1= "<<co1<<" c2="<<co2<<" phi="<<phi<<" coTh="<<co3<<endl; hists->fill1DHist((gen_co1 - co1)/gen_co1, "res_co1",";Resolution on cos(#vec{l-},#vec{Z})", 100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((gen_co2 - co2)/gen_co2, "res_co2",";Resolution on cos(#vec{l+},#vec{Z})", 100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((gen_co3 - co3)/gen_co3, "res_co3",";Resolution on cos(#Theta)", 100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((gen_phi - phi)/gen_phi, "res_phi",";Resolution on #phi(l+)", 100, -0.2,0.2, 1,"GEN"); } if (fabs(gamma.SCEta()) < 1.4442){ hists->fill1DHist((genMll - Mll)/genMll, "res_EB_Mll", ";(m_{#mu#mu}^{gen} - m_{#mu#mu}^{reco})/m_{#mu#mu}^{gen}", 100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((genMllg - Mllg)/genMllg, "res_EB_Mllg", ";(m_{#mu#mu#gamma}^{gen} - m_{#mu#mu#gamma}^{reco})/m_{#mu#mu#gamma}^{gen}",100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((gendR - dR)/gendR, "res_EB_dR", ";(dR_{#mu#mu}^{gen} - dR_{#mu#mu}^{reco})/dR_{#mu#mu}^{gen}", 100, -0.2,0.2, 1,"GEN"); float mllBins[9] = {0,0.2,0.5,1,2,4,9,20,50}; hists->fill2DHistUnevenBins(genMll,Mll , "res_2D_EB_Mll", ";m_{#mu#mu}^{gen};m_{#mu#mu}^{reco}", 8,mllBins, 8,mllBins, 1,"GEN"); for(int m=1; m<8; m++){ if (Mll > mllBins[m-1] && Mll < mllBins[m]){ hists->fill1DHist((genMll - Mll)/genMll, Form("res_EB_Mll_%.1fto%.1f",mllBins[m-1],mllBins[m]), ";(m_{#mu#mu}^{gen} - m_{#mu#mu}^{reco})/m_{#mu#mu}^{gen}", 100, -0.1,0.1, 1,"GEN"); hists->fill1DHist((genMllg - Mllg)/genMllg, Form("res_EB_Mllg_%.1fto%.1f",mllBins[m-1],mllBins[m]), ";(m_{#mu#mu#gamma}^{gen} - m_{#mu#mu#gamma}^{reco})/m_{#mu#mu#gamma}^{gen}",100, -0.1,0.1, 1,"GEN"); } } } else if (fabs(gamma.SCEta()) > 1.566){ hists->fill1DHist((genMll - Mll)/genMll, "res_EE_Mll", ";(m_{#mu#mu}^{gen} - m_{#mu#mu}^{reco})/m_{#mu#mu}^{gen}", 100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((genMllg - Mllg)/genMllg, "res_EE_Mllg", ";(m_{#mu#mu#gamma}^{gen} - m_{#mu#mu#gamma}^{reco})/m_{#mu#mu#gamma}^{gen}",100, -0.2,0.2, 1,"GEN"); hists->fill1DHist((gendR - dR)/gendR, "res_EE_dR", ";(dR_{#mu#mu}^{gen} - dR_{#mu#mu}^{reco})/dR_{#mu#mu}^{gen}", 100, -0.2,0.2, 1,"GEN"); } } HM->SetLeptons(lPt1, lPt2); HM->SetGamma(gamma); HM->FillHistosFull(4, eventWeight); FillHistoCounts(4, eventWeight); CountEvents(4, "Two muons selected", fcuts); HM->MakeNPlots(4,muons.size(), electrons.size(), electrons0.size(), photonsHZG.size(), photonsTight.size(), photonsMVA.size(), jets.size(), eventWeight); if (sample!="HZG" && Mll > 50) return kTRUE; if (makeApzTree){ apz_w = eventWeight; *apz_lep1 = lPt1; *apz_lep2 = lPt2; *apz_gamma = gamma; *apz_jet1 = jet1; *apz_jet2 = jet2; *apz_met = *recoMET; apz_njets = jets.size(); //cout<<"\t orig = "<<lPt1.Phi()<<endl; //cout<<"\t apz = "<<apz_lep1->Phi()<<endl; //lPt1.SetPhi(0.001); //cout<<"orig = "<<lPt1.Phi()<<endl; //cout<<"apz = "<<apz_lep1->Phi()<<endl; apz_pt1 = lPt1.Pt(); apz_pt2 = lPt2.Pt(); apz_pt3 = gamma.Pt(); apz_pt4 = -1; apz_pt12 = (lPt1+lPt2).Pt(); apz_pt34 = gamma.Pt(); apz_dr1234 = (lPt1+lPt2).DeltaR(gamma); apz_dr12 = lPt1.DeltaR(lPt2); apz_dr13 = lPt1.DeltaR(gamma); apz_dr23 = lPt2.DeltaR(gamma); apz_dr34 = -1; apz_eta1 = lPt1.Eta(); apz_eta2 = lPt2.Eta(); apz_eta3 = gamma.SCEta(); apz_eta4 = -999; apz_eta12 = (lPt1+lPt2).Eta(); apz_eta34 = gamma.SCEta(); apz_eta1234 = (lPt1+lPt2+gamma).Eta(); apz_m12 = (lPt1+lPt2).M(); apz_m34 = gamma.M(); apz_m123 = (lPt1+lPt2+gamma).M(); apz_m4l = 0; apz_vbf = isVBF; triggerSelector->SelectTrigger("HLT_Mu22_Photon22_CaloIdL_v", triggerStatus, hltPrescale, isFound, triggerPass, prescale); apz_trig1 = triggerPass; triggerSelector->SelectTrigger("HLT_IsoMu24_v", triggerStatus, hltPrescale, isFound, triggerPass, prescale); apz_trig2 = triggerPass; triggerSelector->SelectTrigger("HLT_IsoMu24_eta2p1_v", triggerStatus, hltPrescale, isFound, triggerPass, prescale); apz_trig3 = triggerPass; triggerSelector->SelectTrigger("HLT_Mu13_Mu8_v", triggerStatus, hltPrescale, isFound, triggerPass, prescale); apz_trig4 = triggerPass; triggerSelector->SelectTrigger("HLT_Mu17_Mu8_v", triggerStatus, hltPrescale, isFound, triggerPass, prescale); apz_trig5 = triggerPass; _apzTree->Fill(); apz_lep1->Clear(); apz_lep2->Clear(); apz_gamma->Clear(); apz_jet1->Clear(); apz_jet2->Clear(); apz_met->Clear(); } //for(Int_t ev=0; ev<evSize;ev++){ //if (eventNumber==hisEVTS[ev]){cout<<eventNumber<<" Found an event after lept selection "<<endl; // cout<<"Mll = "<<Mll<<endl; // break;} //} //if (Mllg<60 || Mllg>120) if (sample!="HZG" &&(Mllg<110 || Mllg>170)) return kTRUE; HM->FillHistosFull(5, eventWeight); FillHistoCounts(5, eventWeight); //CountEvents(5, "76 < m(llg) < 106; m(ll) < 50", fcuts); CountEvents(5, "110 < m(llg) < 170; m(ll) < 50", fcuts); if (lPt1.DeltaR(gamma)<1.0 || lPt2.DeltaR(gamma)<1.0) return kTRUE; if ( (Mll>2.9 && Mll<3.3) || (Mll>9.3 && Mll<9.7)) return kTRUE; //jpsi and upsilon removeal //CountEvents(6, "dR(l,g) > 1", fcuts); CountEvents(6, "dR(l,g) > 1; removed J/Psi, Ups", fcuts); HM->FillHistosFull(6, eventWeight); FillHistoCounts(6, eventWeight); HM->MakeNPlots(6,muons.size(), electrons.size(), electrons0.size(), photonsHZG.size(), photonsTight.size(), photonsMVA.size(), jets.size(), eventWeight); if (Mll < 20) { HM->FillHistosFull(7, eventWeight); FillHistoCounts(7, eventWeight); CountEvents(7, "m(ll) < 20 GeV", fcuts); HM->MakeNPlots(7,muons.size(), electrons.size(), electrons0.size(), photonsHZG.size(), photonsTight.size(), photonsMVA.size(), jets.size(), eventWeight); HM->MakeMuonPlots(muons[0]); HM->MakeMuonPlots(muons[1]); if (fabs(gamma.SCEta()) < 1.4442){ HM->FillHistosFull(8, eventWeight); FillHistoCounts(8, eventWeight); CountEvents(8, "gamma eta < 1.4442", fcuts); if ((l1+l2).Pt()/Mllg > 0.30 && gamma.Pt()/Mllg > 0.30) { HM->FillHistosFull(9, eventWeight); FillHistoCounts(9, eventWeight); CountEvents(9, "pT/m(llg) > 0.3", fcuts); HM->MakeNPlots(9,muons.size(), electrons.size(), electrons0.size(), photonsHZG.size(), photonsTight.size(), photonsMVA.size(), jets.size(), eventWeight); HM->MakePhotonPlots(gamma, "Pho-after"); HM->MakeMuonPlots(muons[0],"Mu-after"); HM->MakeMuonPlots(muons[1],"Mu-after"); if (Mllg>122 && Mllg<128){ HM->FillHistosFull(10, eventWeight); FillHistoCounts(10, eventWeight); CountEvents(10, "122 < m(llg) < 128 GeV", fcuts); } if (isVBF){ HM->FillHistosFull(11, eventWeight); FillHistoCounts(11, eventWeight); CountEvents(11, "VBF ID", fcuts); if (Mllg>122 && Mllg<128){ HM->FillHistosFull(12, eventWeight); FillHistoCounts(12, eventWeight); CountEvents(12, "VBF in [122, 128]", fcuts); } } } } else if (fabs(gamma.SCEta()) > 1.566) { HM->FillHistosFull(15, eventWeight); FillHistoCounts(15, eventWeight); CountEvents(15, "gamma eta > 1.566", fcuts); if ((l1+l2).Pt()/Mllg > 0.30 && gamma.Pt()/Mllg > 0.30) { HM->FillHistosFull(16, eventWeight); FillHistoCounts(16, eventWeight); CountEvents(16, "pT/m(llg) > 0.3", fcuts); if (Mllg>122 && Mllg<128){ HM->FillHistosFull(17, eventWeight); FillHistoCounts(17, eventWeight); CountEvents(17, "122 GeV < m(llg) < 128 GeV", fcuts); } } } } else if (Mll < 50 && fabs(gamma.SCEta()) < 1.4442){ HM->FillHistosFull(18, eventWeight); FillHistoCounts(18, eventWeight); CountEvents(18, "20 GeV < m(ll) < 50 GeV; EB only", fcuts); if ((l1+l2).Pt()/Mllg > 0.30 && gamma.Pt()/Mllg > 0.30) { HM->FillHistosFull(19, eventWeight); FillHistoCounts(19, eventWeight); CountEvents(19, "pT/m(llg) > 0.3", fcuts); if (Mllg>122 && Mllg<128){ HM->FillHistosFull(20, eventWeight); FillHistoCounts(20, eventWeight); CountEvents(20, "122 GeV < m(llg) < 128 GeV", fcuts); } } } else if(Mll > 50){ HM->FillHistosFull(21, eventWeight); FillHistoCounts(21, eventWeight); CountEvents(21, "m(ll) > 50 GeV", fcuts); } for (UInt_t i=0; i<ntrig; i++){ triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); if(triggerPass) nEventsTrig[6][i]++; if (!isFound) cout<<"TRG **** Warning ***\n The trigger name "<<myTriggers[i]<<" is not in the list of trigger names"<<endl; } if(!isRealData && makeGen && sample=="dalitz"){ hists->fill1DHist(gen_l1.DeltaR(l1),"reco_gen_l1_deltaR","reco_gen_l1_deltaR",100,0,5, 1,""); hists->fill1DHist(gen_l2.DeltaR(l2),"reco_gen_l2_deltaR","reco_gen_l2_deltaR",100,0,5, 1,""); hists->fill2DHist(gen_l1.DeltaR(l1), gen_l2.DeltaR(l2), "reco_gen_2D_ll_deltaR", "reco_gen_2D_ll_deltaR", 100,0,5, 100,0,5, 1,""); hists->fill2DHist(gen_l1.DeltaR(l1), gen_gamma.DeltaR(gamma),"reco_gen_2D_l1gamma_deltaR","reco_gen_2D_l1gamma_deltaR",100,0,5, 100,0,5, 1,""); hists->fill1DHist(gen_gamma.DeltaR(gamma),"reco_gen_gamma_deltaR","reco_gen_gamma_deltaR",100,0,5, 1,""); } if(!isRealData && makeGen){ for (Int_t i = 1; i<=6; i++){ if ((l1+l2).Pt()>20+i*5) hists->fill1DHist(genMll, Form("gen_Mll_%i",i),";gen_Mll", 100,0,mllMax, 1,"eff"); if (gamma.Pt()>20+i*5) hists->fill1DHist(genMll, Form("gen_Mll_%i",6+i),";gen_Mll", 100,0,mllMax, 1,"eff"); if (gamma.Pt()/Mllg> 0.15+0.05*i) hists->fill1DHist(genMll, Form("gen_Mll_%i",12+i),";gen_Mll", 100,0,mllMax, 1,"eff"); if ((l1+l2).Pt()/Mllg> 0.15+0.05*i) hists->fill1DHist(genMll, Form("gen_Mll_%i",18+i),";gen_Mll", 100,0,mllMax, 1,"eff"); if ((l1+l2).Pt()/Mllg> 0.15+0.05*i && gamma.Pt()/Mllg> 0.15+0.05*i) hists->fill1DHist(genMll, Form("gen_Mll_%i",24+i),";gen_Mll", 100,0,mllMax, 1,"eff"); } } //if (checkTrigger){ //triggerSelector->SelectTrigger(myTrigger, triggerStatus, hltPrescale, isFound, triggerPass, prescale); //if (!triggerPass) return kTRUE; //// else Abort("Event trigger should mu or el"); //} if (NoiseFilters_isScraping || NoiseFilters_isNoiseHcalHBHE || NoiseFilters_isNoiseHcalLaser ) return kTRUE; if (NoiseFilters_isNoiseEcalTP || NoiseFilters_isNoiseEcalBE || NoiseFilters_isNoiseEEBadSc ) return kTRUE; if (NoiseFilters_isCSCTightHalo// || NoiseFilters_isCSCLooseHalo ) return kTRUE; if (NoiseFilters_isNoiseTracking || !NoiseFilters_isNoisetrkPOG1 || !NoiseFilters_isNoisetrkPOG2 || !NoiseFilters_isNoisetrkPOG3 ) return kTRUE; FillHistoCounts(22, eventWeight); CountEvents(22, "noise filters, after cuts #6",fcuts); /* if (lPt1.Phi() > -1.8 && lPt1.Phi() < -1.6){ HM->FillHistosFull(18, eventWeight); fout<<" nEvt = "<<nEvents[0]<<" : Run/lumi/event = "<<runNumber<<"/"<<lumiSection<<"/"<<eventNumber<<endl; fout<<"lPt1: "<<&lPt1<<endl; fout<<"dilep phi = "<<(lPt1+lPt2).Phi()<<endl; } */ /* for (UInt_t i =0; i<ntrig; i++){ triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); if(triggerPass) nEventsTrig[3][i]++; } if (Mll < 20){ for (UInt_t i=0; i<ntrig; i++){ triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); if(triggerPass) nEventsTrig[4][i]++; } } for (UInt_t i =0; i<ntrig; i++){ triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); if(triggerPass) nEventsTrig[5][i]++; Bool_t pa = 1; Bool_t fo = 0; Int_t pr = 99; triggerSelector->SelectTrigger("HLT_Mu22_Photon22_CaloIdL_v", triggerStatus, hltPrescale, fo, pa, pr); if(triggerPass || pa) nEventsTrig[6][i]++; } */ /* single ele trigger study for (UInt_t i =0; i<ntrig; i++) { triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); Bool_t pa = 1; Bool_t fo = 0; Int_t pr = 99; triggerSelector->SelectTrigger("HLT_Ele27_WP80_v", triggerStatus, hltPrescale, fo, pa, pr); //if(nEvents[0]==0) //cout<<i<<" "<<myTriggers[i]<<" is Found = "<<isFound<<" ispassed = "<<triggerPass<<" prescale = "<<prescale<<endl; if(triggerPass) nEventsTrig[2][i]++; if(triggerPass || pa) nEventsTrig[5][i]++; } */ /* for (UInt_t i =0; i<ntrig; i++) { triggerSelector->SelectTrigger(myTriggers[i], triggerStatus, hltPrescale, isFound, triggerPass, prescale); if(triggerPass) nEventsTrig[3][i]++; } */ return kTRUE; }