CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TauValidation.cc
Go to the documentation of this file.
1 /*class TauValidation
2  *
3  * Class to fill dqm monitor elements from existing EDM file
4  *
5  */
7 
8 #include "CLHEP/Units/defs.h"
9 #include "CLHEP/Units/PhysicalConstants.h"
10 
12 
16 
17 using namespace edm;
18 
20  wmanager_(iPSet,consumesCollector())
21  ,hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection"))
22  ,tauEtCut(iPSet.getParameter<double>("tauEtCutForRtau"))
23  ,NJAKID(22)
24  ,zsbins(20)
25  ,zsmin(-0.5)
26  ,zsmax(0.5)
27 {
28  hepmcCollectionToken_=consumes<HepMCProduct>(hepmcCollection_);
29 }
30 
32 
34  c.getData( fPDGTable );
35 }
36 
39  i.setCurrentFolder("Generator/Tau");
40 
41  // Number of analyzed events
42  nTaus = i.book1D("nTaus", "n analyzed Taus", 1, 0., 1.);
43  nPrimeTaus = i.book1D("nPrimeTaus", "n analyzed prime Taus", 1, 0., 1.);
44 
45  //Kinematics
46  TauPt = i.book1D("TauPt","Tau pT", 100 ,0,100);
47  TauEta = i.book1D("TauEta","Tau eta", 100 ,-2.5,2.5);
48  TauPhi = i.book1D("TauPhi","Tau phi", 100 ,-3.14,3.14);
49  TauProngs = i.book1D("TauProngs","Tau n prongs", 7 ,0,7);
50  TauDecayChannels = i.book1D("TauDecayChannels","Tau decay channels", 13 ,0,13);
54  TauDecayChannels->setBinLabel(1+pi,"#pi^{#pm}");
55  TauDecayChannels->setBinLabel(1+rho,"#rho^{#pm}");
56  TauDecayChannels->setBinLabel(1+a1,"a_{1}^{#pm}");
57  TauDecayChannels->setBinLabel(1+pi1pi0,"#pi^{#pm}#pi^{0}");
58  TauDecayChannels->setBinLabel(1+pinpi0,"#pi^{#pm}n#pi^{0}");
59  TauDecayChannels->setBinLabel(1+tripi,"3#pi^{#pm}");
60  TauDecayChannels->setBinLabel(1+tripinpi0,"3#pi^{#pm}n#pi^{0}");
63  TauDecayChannels->setBinLabel(1+stable,"Stable");
64 
65  TauMothers = i.book1D("TauMothers","Tau mother particles", 10 ,0,10);
67  TauMothers->setBinLabel(1+B,"B Decays");
68  TauMothers->setBinLabel(1+D,"D Decays");
69  TauMothers->setBinLabel(1+gamma,"#gamma");
70  TauMothers->setBinLabel(1+Z,"Z");
71  TauMothers->setBinLabel(1+W,"W");
72  TauMothers->setBinLabel(1+HSM,"H_{SM}/h^{0}");
73  TauMothers->setBinLabel(1+H0,"H^{0}");
74  TauMothers->setBinLabel(1+A0,"A^{0}");
75  TauMothers->setBinLabel(1+Hpm,"H^{#pm}");
76 
77  DecayLength = i.book1D("DecayLength","#tau Decay Length", 100 ,-20,20); DecayLength->setAxisTitle("L_{#tau} (mm)");
78  LifeTime = i.book1D("LifeTime","#tau LifeTime ", 500 ,0,1000E-14); LifeTime->setAxisTitle("#tau_{#tau} (s)");
79 
80  TauRtauW = i.book1D("TauRtauW","W->Tau p(leading track)/E(visible tau)", 50 ,0,1); TauRtauW->setAxisTitle("rtau");
81  TauRtauHpm = i.book1D("TauRtauHpm","Hpm->Tau p(leading track)/E(visible tau)", 50 ,0,1); TauRtauHpm->setAxisTitle("rtau");
82 
83  TauSpinEffectsW_X = i.book1D("TauSpinEffectsWX","Pion energy in W rest frame", 50 ,0,1); TauSpinEffectsW_X->setAxisTitle("X");
84  TauSpinEffectsHpm_X = i.book1D("TauSpinEffectsHpmX","Pion energy in Hpm rest frame", 50 ,0,1); TauSpinEffectsHpm_X->setAxisTitle("X");
85 
86  TauSpinEffectsW_eX = i.book1D("TauSpinEffectsWeX","e energy in W rest frame", 50 ,0,1); TauSpinEffectsW_eX->setAxisTitle("X");
87  TauSpinEffectsHpm_eX = i.book1D("TauSpinEffectsHpmeX","e energy in Hpm rest frame", 50 ,0,1); TauSpinEffectsHpm_eX->setAxisTitle("X");
88 
89  TauSpinEffectsW_muX = i.book1D("TauSpinEffectsWmuX","mu energy in W rest frame", 50 ,0,1); TauSpinEffectsW_muX->setAxisTitle("X");
90  TauSpinEffectsHpm_muX = i.book1D("TauSpinEffectsHpmmuX","mu energy in Hpm rest frame", 50 ,0,1); TauSpinEffectsHpm_muX->setAxisTitle("X");
91 
92  TauSpinEffectsW_UpsilonRho = i.book1D("TauSpinEffectsWUpsilonRho","#Upsilon for #rho", 50 ,-1,1); TauSpinEffectsW_UpsilonRho->setAxisTitle("#Upsilon");
93  TauSpinEffectsHpm_UpsilonRho = i.book1D("TauSpinEffectsHpmUpsilonRho","#Upsilon for #rho", 50 ,-1,1); TauSpinEffectsHpm_UpsilonRho->setAxisTitle("#Upsilon");
94 
95  TauSpinEffectsW_UpsilonA1 = i.book1D("TauSpinEffectsWUpsilonA1","#Upsilon for a1", 50 ,-1,1); TauSpinEffectsW_UpsilonA1->setAxisTitle("#Upsilon");
96  TauSpinEffectsHpm_UpsilonA1 = i.book1D("TauSpinEffectsHpmUpsilonA1","#Upsilon for a1", 50 ,-1,1); TauSpinEffectsHpm_UpsilonA1->setAxisTitle("#Upsilon");
97 
98  TauSpinEffectsH_pipiAcoplanarity = i.book1D("TauSpinEffectsH_pipiAcoplanarity","H Acoplanarity for #pi^{-}#pi^{+}", 50 ,0,2*TMath::Pi()); TauSpinEffectsH_pipiAcoplanarity->setAxisTitle("Acoplanarity");
99 
100  TauSpinEffectsH_pipiAcollinearity = i.book1D("TauSpinEffectsH_pipiAcollinearity","H Acollinearity for #pi^{-}#pi^{+}", 50 ,0,TMath::Pi()); TauSpinEffectsH_pipiAcollinearity->setAxisTitle("Acollinearity");
101  TauSpinEffectsH_pipiAcollinearityzoom = i.book1D("TauSpinEffectsH_pipiAcollinearityzoom","H Acollinearity for #pi^{-}#pi^{+}", 50 ,3,TMath::Pi()); TauSpinEffectsH_pipiAcollinearityzoom->setAxisTitle("Acollinearity");
102 
103  TauSpinEffectsZ_MVis = i.book1D("TauSpinEffectsZMVis","Mass of pi+ pi-", 25 ,0,1.1); TauSpinEffectsZ_MVis->setAxisTitle("M_{#pi^{+}#pi^{-}}");
104  TauSpinEffectsH_MVis = i.book1D("TauSpinEffectsHMVis","Mass of pi+ pi-", 25 ,0,1.1); TauSpinEffectsZ_MVis->setAxisTitle("M_{#pi^{+}#pi^{-}}");
105 
106  TauSpinEffectsZ_Zs = i.book1D("TauSpinEffectsZZs","Z_{s}", zsbins ,zsmin,zsmax); TauSpinEffectsZ_Zs->setAxisTitle("Z_{s}");
107  TauSpinEffectsH_Zs = i.book1D("TauSpinEffectsHZs","Z_{s}", zsbins ,zsmin,zsmax); TauSpinEffectsZ_Zs->setAxisTitle("Z_{s}");
108 
109  TauSpinEffectsZ_X= i.book1D("TauSpinEffectsZX","X of #tau^{-}", 25 ,0,1.0); TauSpinEffectsZ_X->setAxisTitle("X");
110  TauSpinEffectsH_X= i.book1D("TauSpinEffectsH_X","X of #tau^{-}", 25 ,0,1.0); TauSpinEffectsH_X->setAxisTitle("X");
111 
112  TauSpinEffectsZ_Xf = i.book1D("TauSpinEffectsZXf","X of forward emitted #tau^{-}", 25 ,0,1.0); TauSpinEffectsZ_Xf->setAxisTitle("X_{f}");
113  TauSpinEffectsH_Xf = i.book1D("TauSpinEffectsHXf","X of forward emitted #tau^{-}", 25 ,0,1.0); TauSpinEffectsZ_Xf->setAxisTitle("X_{f}");
114 
115  TauSpinEffectsZ_Xb = i.book1D("TauSpinEffectsZXb","X of backward emitted #tau^{-}", 25 ,0,1.0); TauSpinEffectsZ_Xb->setAxisTitle("X_{b}");
116  TauSpinEffectsH_Xb = i.book1D("TauSpinEffectsHXb","X of backward emitted #tau^{-}", 25 ,0,1.0); TauSpinEffectsZ_Xb->setAxisTitle("X_{b}");
117 
118  TauSpinEffectsZ_eX = i.book1D("TauSpinEffectsZeX","e energy in Z rest frame", 50 ,0,1); TauSpinEffectsZ_eX->setAxisTitle("X");
119  TauSpinEffectsH_eX = i.book1D("TauSpinEffectsHeX","e energy in H rest frame", 50 ,0,1); TauSpinEffectsH_eX->setAxisTitle("X");
120 
121  TauSpinEffectsZ_muX = i.book1D("TauSpinEffectsZmuX","mu energy in z rest frame", 50 ,0,1); TauSpinEffectsZ_muX->setAxisTitle("X");
122  TauSpinEffectsH_muX = i.book1D("TauSpinEffectsHmuX","mu energy in H rest frame", 50 ,0,1); TauSpinEffectsH_muX->setAxisTitle("X");
123 
124  TauSpinEffectsH_rhorhoAcoplanarityminus = i.book1D("TauSpinEffectsH_rhorhoAcoplanarityminus","#phi^{*-} (acoplanarity) for Higgs #rightarrow #rho-#rho (y_{1}*y_{2}<0)", 32 ,0,2*TMath::Pi()); TauSpinEffectsH_rhorhoAcoplanarityminus->setAxisTitle("#phi^{*-} (Acoplanarity)");
125  TauSpinEffectsH_rhorhoAcoplanarityplus = i.book1D("TauSpinEffectsH_rhorhoAcoplanarityplus","#phi^{*+} (acoplanarity) for Higgs #rightarrow #rho-#rho (y_{1}*y_{2}>0)", 32 ,0,2*TMath::Pi()); TauSpinEffectsH_rhorhoAcoplanarityplus->setAxisTitle("#phi^{*+} (Acoplanarity)");
126 
127  TauFSRPhotonsN=i.book1D("TauFSRPhotonsN","FSR Photons radiating from/with tau (Gauge Boson)", 5 ,-0.5,4.5);
128  TauFSRPhotonsN->setAxisTitle("N FSR Photons radiating from/with tau");
129  TauFSRPhotonsPt=i.book1D("TauFSRPhotonsPt","Pt of FSR Photons radiating from/with tau (Gauge Boson)", 100 ,0,100);
130  TauFSRPhotonsPt->setAxisTitle("P_{t} of FSR Photons radiating from/with tau [per tau]");
131  TauFSRPhotonsPtSum=i.book1D("TauFSRPhotonsPtSum","Pt of FSR Photons radiating from/with tau (Gauge Boson)", 100 ,0,100);
132  TauFSRPhotonsPtSum->setAxisTitle("P_{t} of FSR Photons radiating from/with tau [per tau]");
133 
134  TauBremPhotonsN=i.book1D("TauBremPhotonsN","Brem. Photons radiating in tau decay", 5 ,-0.5,4.5);
135  TauBremPhotonsN->setAxisTitle("N FSR Photons radiating from/with tau");
136  TauBremPhotonsPt=i.book1D("TauBremPhotonsPt","Sum Brem Pt ", 100 ,0,100);
137  TauFSRPhotonsPt->setAxisTitle("P_{t} of Brem. Photons radiating in tau decay");
138  TauBremPhotonsPtSum =i.book1D("TauBremPhotonsPtSum","Sum of Brem Pt ", 100 ,0,100);
139  TauFSRPhotonsPtSum->setAxisTitle("Sum P_{t} of Brem. Photons radiating in tau decay");
140 
141  JAKID =i.book1D("JAKID","JAK ID",NJAKID+1,-0.5,NJAKID+0.5);
142  for(unsigned int j=0; j<NJAKID+1;j++){
143  JAKInvMass.push_back(std::vector<MonitorElement *>());
144  TString tmp="JAKID";
145  tmp+=j;
146  JAKInvMass.at(j).push_back(i.book1D("M"+tmp,"M_{"+tmp+"} (GeV)", 80 ,0,2.0));
147  if(j==TauDecay::JAK_A1_3PI ||
150  JAKInvMass.at(j).push_back(i.book1D("M13"+tmp,"M_{13,"+tmp+"} (GeV)", 80 ,0,2.0));
151  JAKInvMass.at(j).push_back(i.book1D("M23"+tmp,"M_{23,"+tmp+"} (GeV)", 80 ,0,2.0));
152  JAKInvMass.at(j).push_back(i.book1D("M12"+tmp,"M_{12,"+tmp+"} (GeV)", 80 ,0,2.0));
153  }
154  }
155  return;
156 }
157 
158 
160 {
163  iEvent.getByToken(hepmcCollectionToken_, evt);
164 
165  //Get EVENT
166  HepMC::GenEvent *myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
167 
168  double weight = wmanager_.weight(iEvent);
169 
171 
172  // find taus
173  for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); iter++) {
174  if(abs((*iter)->pdg_id())==PdtPdgMini::Z0 || abs((*iter)->pdg_id())==PdtPdgMini::Higgs0){
175  spinEffectsZH(*iter,weight);
176  }
177  if(abs((*iter)->pdg_id())==15){
178  if(isLastTauinChain(*iter)){
179  nTaus->Fill(0.5,weight);
180  int mother = tauMother(*iter,weight);
181  int decaychannel = tauDecayChannel(*iter,weight);
182  tauProngs(*iter, weight);
183  if(mother>-1){ // exclude B, D and other non-signal decay modes
184  nPrimeTaus->Fill(0.5,weight);
185  TauPt->Fill((*iter)->momentum().perp(),weight);
186  TauEta->Fill((*iter)->momentum().eta(),weight);
187  TauPhi->Fill((*iter)->momentum().phi(),weight);
188  rtau(*iter,mother,decaychannel,weight);
189  photons(*iter,weight);
190  }
192  //Adding JAKID and Mass information
193  //
194  TLorentzVector Tau((*iter)->momentum().px(),(*iter)->momentum().py(),(*iter)->momentum().pz(),(*iter)->momentum().e());
195  TauDecay_CMSSW TD;
196  unsigned int jak_id, TauBitMask;
197  if(TD.AnalyzeTau((*iter),jak_id,TauBitMask,false,false)){
198  JAKID->Fill(jak_id,weight);
199  if(jak_id<=NJAKID){
200  int tcharge=(*iter)->pdg_id()/abs((*iter)->pdg_id());
201  std::vector<HepMC::GenParticle*> part=TD.Get_TauDecayProducts();
202  spinEffectsWHpm(*iter,mother,jak_id,part,weight);
203  TLorentzVector LVQ(0,0,0,0);
204  TLorentzVector LVS12(0,0,0,0);
205  TLorentzVector LVS13(0,0,0,0);
206  TLorentzVector LVS23(0,0,0,0);
207  bool haspart1=false;
208  TVector3 PV,SV;
209  bool hasDL(false);
210  for(unsigned int i=0;i<part.size();i++){
211  if(abs(part.at(i)->pdg_id())!=PdtPdgMini::nu_tau && TD.isTauFinalStateParticle(part.at(i)->pdg_id()) && !hasDL){
212  PV=TVector3((*iter)->production_vertex()->point3d().x(),(*iter)->production_vertex()->point3d().y(),(*iter)->production_vertex()->point3d().z());
213  SV=TVector3(part.at(i)->production_vertex()->point3d().x(),part.at(i)->production_vertex()->point3d().y(),part.at(i)->production_vertex()->point3d().z());
214  TVector3 DL=SV-PV;
215  DecayLength->Fill(DL.Dot(Tau.Vect())/Tau.P(),weight);
216  double c(2.99792458E8),Ltau(DL.Mag()/1000),beta((*iter)->momentum().rho()/(*iter)->momentum().m());
217  LifeTime->Fill( Ltau/(c*beta),weight);
218  }
219 
220  if(TD.isTauFinalStateParticle(part.at(i)->pdg_id()) &&
221  abs(part.at(i)->pdg_id())!=PdtPdgMini::nu_e &&
222  abs(part.at(i)->pdg_id())!=PdtPdgMini::nu_mu &&
223  abs(part.at(i)->pdg_id())!=PdtPdgMini::nu_tau ){
224  TLorentzVector LV(part.at(i)->momentum().px(),part.at(i)->momentum().py(),part.at(i)->momentum().pz(),part.at(i)->momentum().e());
225  LVQ+=LV;
226  if(jak_id==TauDecay::JAK_A1_3PI ||
227  jak_id==TauDecay::JAK_KPIK ||
228  jak_id==TauDecay::JAK_KPIPI
229  ){
230  if((tcharge==part.at(i)->pdg_id()/abs(part.at(i)->pdg_id()) && TD.nProng(TauBitMask)==3) || (jak_id==TauDecay::JAK_A1_3PI && TD.nProng(TauBitMask)==1 && abs(part.at(i)->pdg_id())==PdtPdgMini::pi_plus) ){
231  LVS13+=LV;
232  LVS23+=LV;
233  }
234  else{
235  LVS12+=LV;
236  if(!haspart1 && ((jak_id==TauDecay::JAK_A1_3PI) || (jak_id!=TauDecay::JAK_A1_3PI && abs(part.at(i)->pdg_id())==PdtPdgMini::K_plus) )){
237  LVS13+=LV;
238  haspart1=true;
239  }
240  else{
241  LVS23+=LV;
242  }
243  }
244  }
245  }
246  }
247  part.clear();
248  JAKInvMass.at(jak_id).at(0)->Fill(LVQ.M(),weight);
249  if(jak_id==TauDecay::JAK_A1_3PI ||
250  jak_id==TauDecay::JAK_KPIK ||
251  jak_id==TauDecay::JAK_KPIPI
252  ){
253  JAKInvMass.at(jak_id).at(1)->Fill(LVS13.M(),weight);
254  JAKInvMass.at(jak_id).at(2)->Fill(LVS23.M(),weight);
255  JAKInvMass.at(jak_id).at(3)->Fill(LVS12.M(),weight);
256  }
257  }
258  }
259  else{
260  JAKID->Fill(jak_id,weight);
261  }
262  }
263  }
264  }
265  delete myGenEvent;
266 }//analyze
267 
269  if ( tau->production_vertex() ) {
270  HepMC::GenVertex::particle_iterator mother;
271  for (mother = tau->production_vertex()->particles_begin(HepMC::parents); mother!= tau->production_vertex()->particles_end(HepMC::parents); mother++ ) {
272  if((*mother)->pdg_id() == tau->pdg_id()) return GetMother(*mother);
273  return (*mother);
274  }
275  }
276  return tau;
277 }
278 
279 
280 const std::vector<HepMC::GenParticle*> TauValidation::GetMothers(const HepMC::GenParticle* boson){
281  std::vector<HepMC::GenParticle*> mothers;
282  if ( boson->production_vertex() ) {
283  HepMC::GenVertex::particle_iterator mother;
284  for (mother = boson->production_vertex()->particles_begin(HepMC::parents); mother!= boson->production_vertex()->particles_end(HepMC::parents); mother++ ) {
285  if((*mother)->pdg_id() == boson->pdg_id()) return GetMothers(*mother);
286  mothers.push_back(*mother);
287  }
288  }
289  return mothers;
290 }
291 
292 
294  int mother_pid = 0;
295  if ( tau->production_vertex() ) {
296  HepMC::GenVertex::particle_iterator mother;
297  for (mother = tau->production_vertex()->particles_begin(HepMC::parents); mother!= tau->production_vertex()->particles_end(HepMC::parents); mother++ ) {
298  mother_pid = (*mother)->pdg_id();
299  if(mother_pid == tau->pdg_id()) return findMother(*mother); //mother_pid = -1; Make recursive to look for last tau in chain
300  }
301  }
302  return mother_pid;
303 }
304 
305 
307  if ( tau->end_vertex() ) {
308  HepMC::GenVertex::particle_iterator dau;
309  for (dau = tau->end_vertex()->particles_begin(HepMC::children); dau!= tau->end_vertex()->particles_end(HepMC::children); dau++ ) {
310  int dau_pid = (*dau)->pdg_id();
311  if(dau_pid == tau->pdg_id()) return false;
312  }
313  }
314  return true;
315 }
316 
317 
318 void TauValidation::findTauList(const HepMC::GenParticle* tau,std::vector<const HepMC::GenParticle*> &TauList){
319  TauList.insert(TauList.begin(),tau);
320  if ( tau->production_vertex() ) {
321  HepMC::GenVertex::particle_iterator mother;
322  for (mother = tau->production_vertex()->particles_begin(HepMC::parents); mother!= tau->production_vertex()->particles_end(HepMC::parents);mother++) {
323  if((*mother)->pdg_id() == tau->pdg_id()){
324  findTauList(*mother,TauList);
325  }
326  }
327  }
328 }
329 
330 void TauValidation::findFSRandBrem(const HepMC::GenParticle* p, bool doBrem, std::vector<const HepMC::GenParticle*> &ListofFSR,
331  std::vector<const HepMC::GenParticle*> &ListofBrem){
332  // note this code split the FSR and Brem based one if the tau decays into a tau+photon or not with the Fortran Tauola Interface, this is not 100% correct because photos puts the tau with the regular tau decay products.
333  if(abs(p->pdg_id())==15){
334  if(isLastTauinChain(p)){ doBrem=true;}
335  else{ doBrem=false;}
336  }
337  int photo_ID=22;
338  if ( p->end_vertex() ) {
339  HepMC::GenVertex::particle_iterator dau;
340  for (dau = p->end_vertex()->particles_begin(HepMC::children); dau!= p->end_vertex()->particles_end(HepMC::children); dau++ ) {
341  //if(doBrem) std::cout << "true " << (*dau)->pdg_id() << " " << std::endl;
342  //else std::cout << "false " << (*dau)->pdg_id() << " " << std::endl;
343  if(abs((*dau)->pdg_id()) == abs(photo_ID) && !doBrem){ListofFSR.push_back(*dau);}
344  if(abs((*dau)->pdg_id()) == abs(photo_ID) && doBrem){ListofBrem.push_back(*dau);}
345  if((*dau)->end_vertex() && (*dau)->end_vertex()->particles_out_size()>0 && abs((*dau)->pdg_id()) != 111 && abs((*dau)->pdg_id()) != 221/* remove pi0 and eta decays*/){
346  findFSRandBrem(*dau,doBrem,ListofFSR,ListofBrem);
347  }
348  }
349  }
350 }
351 
352 
353 
354 void TauValidation::FindPhotosFSR(const HepMC::GenParticle* p,std::vector<const HepMC::GenParticle*> &ListofFSR,double &BosonScale){
355  BosonScale=0.0;
356  const HepMC::GenParticle* m=GetMother(p);
357  double mother_pid=m->pdg_id();
358  if(m->end_vertex() && mother_pid!=p->pdg_id()){
359  HepMC::GenVertex::particle_iterator dau;
360  for (dau = m->end_vertex()->particles_begin(HepMC::children); dau!= m->end_vertex()->particles_end(HepMC::children); dau++ ) {
361  int dau_pid = (*dau)->pdg_id();
362  if(fabs(dau_pid) == 22) {
363  ListofFSR.push_back(*dau);
364  }
365  }
366  }
367  if(abs(mother_pid) == 24) BosonScale=1.0; // W
368  if(abs(mother_pid) == 23) BosonScale=2.0; // Z;
369  if(abs(mother_pid) == 22) BosonScale=2.0; // gamma;
370  if(abs(mother_pid) == 25) BosonScale=2.0; // HSM;
371  if(abs(mother_pid) == 35) BosonScale=2.0; // H0;
372  if(abs(mother_pid) == 36) BosonScale=2.0; // A0;
373  if(abs(mother_pid) == 37) BosonScale=1.0; //Hpm;
374 }
375 
376 
378 
379  if(abs(tau->pdg_id()) != 15 ) return -3;
380 
381  int mother_pid = findMother(tau);
382  if(mother_pid == -2) return -2;
383 
384  int label = other;
385  if(abs(mother_pid) == 24) label = W;
386  if(abs(mother_pid) == 23) label = Z;
387  if(abs(mother_pid) == 22) label = gamma;
388  if(abs(mother_pid) == 25) label = HSM;
389  if(abs(mother_pid) == 35) label = H0;
390  if(abs(mother_pid) == 36) label = A0;
391  if(abs(mother_pid) == 37) label = Hpm;
392 
393  int mother_shortpid=(abs(mother_pid)%10000);
394  if(mother_shortpid>500 && mother_shortpid<600 )label = B;
395  if(mother_shortpid>400 && mother_shortpid<500)label = D;
396  TauMothers->Fill(label,weight);
397  if(label==B || label == D || label == other) return -1;
398 
399  return mother_pid;
400 }
401 
403  int nProngs = 0;
404  if ( tau->end_vertex() ) {
405  HepMC::GenVertex::particle_iterator des;
406  for(des = tau->end_vertex()->particles_begin(HepMC::descendants);
407  des!= tau->end_vertex()->particles_end(HepMC::descendants);++des ) {
408  int pid = (*des)->pdg_id();
409  if(abs(pid) == 15) return tauProngs(*des, weight);
410  if((*des)->status() != 1) continue; // dont count unstable particles
411 
412  const HepPDT::ParticleData* pd = fPDGTable->particle((*des)->pdg_id ());
413  int charge = (int) pd->charge();
414  if(charge == 0) continue;
415  nProngs++;
416  }
417  }
418  TauProngs->Fill(nProngs,weight);
419  return nProngs;
420 }
421 
423 
424  int channel = undetermined;
425  if(tau->status() == 1) channel = stable;
426  int allCount = 0,
427  eCount = 0,
428  muCount = 0,
429  pi0Count = 0,
430  piCount = 0,
431  rhoCount = 0,
432  a1Count = 0,
433  KCount = 0,
434  KstarCount = 0;
435 
436  if ( tau->end_vertex() ) {
437  HepMC::GenVertex::particle_iterator des;
438  for(des = tau->end_vertex()->particles_begin(HepMC::descendants);
439  des!= tau->end_vertex()->particles_end(HepMC::descendants);++des ) {
440  int pid = (*des)->pdg_id();
441  if(abs(pid) == 15) return tauDecayChannel(*des,weight);
442 
443  allCount++;
444  if(abs(pid) == 11) eCount++;
445  if(abs(pid) == 13) muCount++;
446  if(abs(pid) == 111) pi0Count++;
447  if(abs(pid) == 211) piCount++;
448  if(abs(pid) == 213) rhoCount++;
449  if(abs(pid) == 20213) a1Count++;
450  if(abs(pid) == 321) KCount++;
451  if(abs(pid) == 323) KstarCount++;
452 
453  }
454  }
455  // resonances
456  if(KCount >= 1) channel = K;
457  if(KstarCount >= 1) channel = Kstar;
458  if(a1Count >= 1) channel = a1;
459  if(rhoCount >= 1) channel = rho;
460  if(channel!=undetermined && weight!=0.0) TauDecayChannels->Fill(channel,weight);
461 
462  // final state products
463  if(piCount == 1 && pi0Count == 0) channel = pi;
464  if(piCount == 1 && pi0Count == 1) channel = pi1pi0;
465  if(piCount == 1 && pi0Count > 1) channel = pinpi0;
466  if(piCount == 3 && pi0Count == 0) channel = tripi;
467  if(piCount == 3 && pi0Count > 0) channel = tripinpi0;
468  if(eCount == 1) channel = electron;
469  if(muCount == 1) channel = muon;
470  if(weight!=0.0) TauDecayChannels->Fill(channel,weight);
471  return channel;
472 }
473 
474 
475 void TauValidation::rtau(const HepMC::GenParticle* tau,int mother, int decay, double weight){
476 
477  if(decay != pi1pi0) return; // polarization only for 1-prong hadronic taus with one neutral pion to make a clean case
478 
479  if(tau->momentum().perp() < tauEtCut) return; // rtau visible only for boosted taus
480 
481  double rTau = 0;
482  double ltrack = leadingPionMomentum(tau, weight);
483  double visibleTauE = visibleTauEnergy(tau);
484 
485  if(visibleTauE != 0) rTau = ltrack/visibleTauE;
486 
487  if(abs(mother) == 24) TauRtauW->Fill(rTau,weight);
488  if(abs(mother) == 37) TauRtauHpm->Fill(rTau,weight);
489 }
490 
491  void TauValidation::spinEffectsWHpm(const HepMC::GenParticle* tau,int mother, int decay, std::vector<HepMC::GenParticle*> &part,double weight){
492  if(decay == TauDecay::JAK_PION || decay == TauDecay::JAK_MUON || decay == TauDecay::JAK_ELECTRON){ // polarization only for 1-prong hadronic taus with no neutral pions
493  TLorentzVector momP4 = motherP4(tau);
494  TLorentzVector pionP4 = leadingPionP4(tau);
495  pionP4.Boost(-1*momP4.BoostVector());
496  double energy = pionP4.E()/(momP4.M()/2);
497  if(decay == TauDecay::JAK_PION){
498  if(abs(mother) == 24) TauSpinEffectsW_X->Fill(energy,weight);
499  if(abs(mother) == 37) TauSpinEffectsHpm_X->Fill(energy,weight);
500  }
501  if(decay == TauDecay::JAK_MUON){
502  if(abs(mother) == 24) TauSpinEffectsW_muX->Fill(energy,weight);
503  if(abs(mother) == 37) TauSpinEffectsHpm_muX->Fill(energy,weight);
504  }
505  if(decay == TauDecay::JAK_ELECTRON){
506  if(abs(mother) == 24) TauSpinEffectsW_eX->Fill(energy,weight);
507  if(abs(mother) == 37) TauSpinEffectsHpm_eX->Fill(energy,weight);
508  }
509 
510  }
511  else if(decay==TauDecay::JAK_RHO_PIPI0){
512  TLorentzVector rho(0,0,0,0),pi(0,0,0,0);
513  for(unsigned int i=0;i<part.size();i++){
514  TLorentzVector LV(part.at(i)->momentum().px(),part.at(i)->momentum().py(),part.at(i)->momentum().pz(),part.at(i)->momentum().e());
515  if(abs(part.at(i)->pdg_id())==PdtPdgMini::pi_plus){pi+=LV; rho+=LV;}
516  if(abs(part.at(i)->pdg_id())==PdtPdgMini::pi0){rho+=LV;}
517  }
518  if(abs(mother) == 24) TauSpinEffectsW_UpsilonRho->Fill(2*pi.Pt()/rho.Pt()-1,weight);
519  if(abs(mother) == 37) TauSpinEffectsHpm_UpsilonRho->Fill(2*pi.Pt()/rho.Pt()-1,weight);
520  }
521  else if(decay==TauDecay::JAK_A1_3PI){ // only for pi2pi0 for now
522  TLorentzVector a1(0,0,0,0),pi_p(0,0,0,0),pi_m(0,0,0,0);
523  int nplus(0),nminus(0);
524  for(unsigned int i=0;i<part.size();i++){
525  TLorentzVector LV(part.at(i)->momentum().px(),part.at(i)->momentum().py(),part.at(i)->momentum().pz(),part.at(i)->momentum().e());
526  if(part.at(i)->pdg_id()==PdtPdgMini::pi_plus){ pi_p+=LV; a1+=LV; nplus++;}
527  if(part.at(i)->pdg_id()==PdtPdgMini::pi_minus){pi_m+=LV; a1+=LV; nminus++;}
528  }
529  double gamma=0;
530  if(nplus+nminus==3 && nplus==1) gamma=2*pi_p.Pt()/a1.Pt()-1;
531  if(nplus+nminus==3 && nminus==1) gamma=2*pi_m.Pt()/a1.Pt()-1;
532  else{
533  pi_p+=pi_m; gamma=2*pi_p.Pt()/a1.Pt()-1;
534  }
535  if(abs(mother) == 24) TauSpinEffectsW_UpsilonA1->Fill(gamma,weight);
536  if(abs(mother) == 37) TauSpinEffectsHpm_UpsilonA1->Fill(gamma,weight);
537  }
538 }
539 
541  TLorentzVector tautau(0,0,0,0);
542  TLorentzVector pipi(0,0,0,0);
543  TLorentzVector taum(0,0,0,0);
544  TLorentzVector taup(0,0,0,0);
545  TLorentzVector rho_plus,rho_minus,pi_rhominus,pi0_rhominus,pi_rhoplus,pi0_rhoplus,pi_plus,pi_minus;
546  bool hasrho_minus(false),hasrho_plus(false),haspi_minus(false),haspi_plus(false);
547  int nSinglePionDecays(0),nSingleMuonDecays(0),nSingleElectronDecays(0);
548  double x1(0),x2(0);
549  TLorentzVector Zboson(boson->momentum().px(),boson->momentum().py(),boson->momentum().pz(),boson->momentum().e());
550  if ( boson->end_vertex() ) {
551  HepMC::GenVertex::particle_iterator des;
552  for(des = boson->end_vertex()->particles_begin(HepMC::children); des!= boson->end_vertex()->particles_end(HepMC::children);++des ) {
553  int pid = (*des)->pdg_id();
554  if(abs(findMother(*des)) != 15 && abs(pid) == 15 && (tauDecayChannel(*des) == pi || tauDecayChannel(*des) == muon || tauDecayChannel(*des) == electron )){
555  if(tauDecayChannel(*des) == pi)nSinglePionDecays++;
556  if(tauDecayChannel(*des) == muon)nSingleMuonDecays++;
557  if(tauDecayChannel(*des) == electron)nSingleElectronDecays++;
558  TLorentzVector LVtau((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e());
559  tautau += LVtau;
560  TLorentzVector LVpi=leadingPionP4(*des);
561  pipi+=LVpi;
562  const HepPDT::ParticleData* pd = fPDGTable->particle((*des)->pdg_id ());
563  int charge = (int) pd->charge();
564  LVtau.Boost(-1*Zboson.BoostVector());
565  LVpi.Boost(-1*Zboson.BoostVector());
566  if(tauDecayChannel(*des) == pi){
567  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_X->Fill(LVpi.P()/LVtau.E(),weight);
568  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_X->Fill(LVpi.P()/LVtau.E(),weight);
569  }
570  if(charge<0){x1=LVpi.P()/LVtau.E(); taum=LVtau;}
571  else{ x2=LVpi.P()/LVtau.E();}
572  }
573  if(abs(findMother(*des)) != 15 && abs(pid) == 15 && (tauDecayChannel(*des) == rho || tauDecayChannel(*des) == pi1pi0) ){
574  if ( (*des)->end_vertex() ) {
575  HepMC::GenVertex::particle_iterator tauprod;
576  TLorentzVector LVtau((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e());
577  if(pid == 15)taum=LVtau;
578  if(pid ==-15)taup=LVtau;
579  for(tauprod = (*des)->end_vertex()->particles_begin(HepMC::descendants); tauprod!= (*des)->end_vertex()->particles_end(HepMC::descendants);++tauprod ) {
580  int pid_d = (*tauprod)->pdg_id();
581  if(abs(pid_d)==211 || abs(pid_d)==111){
582  TLorentzVector LV((*tauprod)->momentum().px(),(*tauprod)->momentum().py(),(*tauprod)->momentum().pz(),(*tauprod)->momentum().e());
583  if(pid==15){
584  hasrho_minus=true;
585  if(pid_d==-211 ){ pi_rhominus=LV;}
586  if(abs(pid_d)==111 ){ pi0_rhominus=LV;}
587  }
588  if(pid==-15){
589  hasrho_plus=true;
590  if(pid_d==211 ){pi_rhoplus=LV;}
591  if(abs(pid_d)==111 ){pi0_rhoplus=LV;}
592  }
593  }
594  }
595  }
596  }
597  if(abs(findMother(*des)) != 15 && abs(pid) == 15 && (tauDecayChannel(*des) == pi) ){
598  if ( (*des)->end_vertex() ) {
599  HepMC::GenVertex::particle_iterator tauprod;
600  TLorentzVector LVtau((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e());
601  if(pid == 15)taum=LVtau;
602  if(pid ==-15)taup=LVtau;
603  for(tauprod = (*des)->end_vertex()->particles_begin(HepMC::descendants); tauprod!= (*des)->end_vertex()->particles_end(HepMC::descendants);++tauprod ) {
604  int pid_d = (*tauprod)->pdg_id();
605  if(abs(pid_d)==211 || abs(pid_d)==111){
606  TLorentzVector LV((*tauprod)->momentum().px(),(*tauprod)->momentum().py(),(*tauprod)->momentum().pz(),(*tauprod)->momentum().e());
607  if(pid==15){
608  haspi_minus=true;
609  if(pid_d==-211 ){ pi_minus=LV;}
610  }
611  if(pid==-15){
612  haspi_plus=true;
613  if(pid_d==211 ){pi_plus=LV;}
614  }
615  }
616  }
617  }
618  }
619  }
620  }
621  if(hasrho_minus && hasrho_plus){
622  //compute rhorho
623  rho_minus=pi_rhominus;
624  rho_minus+=pi0_rhominus;
625  rho_plus=pi_rhoplus;
626  rho_plus+=pi0_rhoplus;
627  TLorentzVector rhorho=rho_minus;rhorho+=rho_plus;
628 
629  // boost to rhorho cm
630  TLorentzVector pi_rhoplusb=pi_rhoplus; pi_rhoplusb.Boost(-1*rhorho.BoostVector());
631  TLorentzVector pi0_rhoplusb=pi0_rhoplus; pi0_rhoplusb.Boost(-1*rhorho.BoostVector());
632  TLorentzVector pi_rhominusb=pi_rhominus; pi_rhominusb.Boost(-1*rhorho.BoostVector());
633  TLorentzVector pi0_rhominusb=pi0_rhominus; pi0_rhominusb.Boost(-1*rhorho.BoostVector());
634 
635  // compute n+/-
636  TVector3 n_plus=pi_rhoplusb.Vect().Cross(pi0_rhoplusb.Vect());
637  TVector3 n_minus=pi_rhominusb.Vect().Cross(pi0_rhominusb.Vect());
638 
639  // compute the acoplanarity
640  double Acoplanarity=acos(n_plus.Dot(n_minus)/(n_plus.Mag()*n_minus.Mag()));
641  if(pi_rhominus.Vect().Dot(n_plus)>0){Acoplanarity*=-1;Acoplanarity+=2*TMath::Pi();}
642 
643  // now boost to tau frame
644  pi_rhoplus.Boost(-1*taup.BoostVector());
645  pi0_rhoplus.Boost(-1*taup.BoostVector());
646  pi_rhominus.Boost(-1*taum.BoostVector());
647  pi0_rhominus.Boost(-1*taum.BoostVector());
648 
649  // compute y1 and y2
650  double y1=(pi_rhoplus.E()-pi0_rhoplus.E())/(pi_rhoplus.E()+pi0_rhoplus.E());
651  double y2=(pi_rhominus.E()-pi0_rhominus.E())/(pi_rhominus.E()+pi0_rhominus.E());
652 
653  // fill histograms
654  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0 && y1*y2<0) TauSpinEffectsH_rhorhoAcoplanarityminus->Fill(Acoplanarity,weight);
655  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0 && y1*y2>0) TauSpinEffectsH_rhorhoAcoplanarityplus->Fill(Acoplanarity,weight);
656  }
657  if(haspi_minus && haspi_plus){
658  TLorentzVector tauporig=taup;
659  TLorentzVector taumorig=taum;
660 
661  // now boost to Higgs frame
662  pi_plus.Boost(-1*Zboson.BoostVector());
663  pi_minus.Boost(-1*Zboson.BoostVector());
664 
665  taup.Boost(-1*Zboson.BoostVector());
666  taum.Boost(-1*Zboson.BoostVector());
667 
668  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0){
669  TauSpinEffectsH_pipiAcollinearity->Fill(acos(pi_plus.Vect().Dot(pi_minus.Vect())/(pi_plus.P()*pi_minus.P())));
670  TauSpinEffectsH_pipiAcollinearityzoom->Fill(acos(pi_plus.Vect().Dot(pi_minus.Vect())/(pi_plus.P()*pi_minus.P())));
671  }
672 
673  double proj_m=taum.Vect().Dot(pi_minus.Vect())/(taum.P()*taup.P());
674  double proj_p=taup.Vect().Dot(pi_plus.Vect())/(taup.P()*taup.P());
675  TVector3 Tau_m=taum.Vect();
676  TVector3 Tau_p=taup.Vect();
677  Tau_m*=proj_m;
678  Tau_p*=proj_p;
679  TVector3 Pit_m=pi_minus.Vect()-Tau_m;
680  TVector3 Pit_p=pi_plus.Vect()-Tau_p;
681 
682  double Acoplanarity=acos(Pit_m.Dot(Pit_p)/(Pit_p.Mag()*Pit_m.Mag()));
683  TVector3 n=Pit_p.Cross(Pit_m);
684  if(n.Dot(Tau_m)/Tau_m.Mag()>0){Acoplanarity*=-1; Acoplanarity+=2*TMath::Pi();}
685  // fill histograms
686  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_pipiAcoplanarity->Fill(Acoplanarity,weight);
687  taup=tauporig;
688  taum=taumorig;
689 
690  }
691 
692 
693  if(nSingleMuonDecays==2){
694  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_muX->Fill(x1,weight);
695  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_muX->Fill(x1,weight);
696  }
697  if(nSingleElectronDecays==2){
698  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_eX->Fill(x1,weight);
699  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_eX->Fill(x1,weight);
700  }
701  if(nSinglePionDecays == 2 && tautau.M()!= 0) {
702  for(int i=0;i<zsbins;i++){
703  double zslow=((double)i)*(zsmax-zsmin)/((double)zsbins)+zsmin;
704  double zsup=((double)i+1)*(zsmax-zsmin)/((double)zsbins)+zsmin;
705  double aup=Zstoa(zsup), alow=Zstoa(zslow);
706  if(x2-x1>alow && x2-x1<aup){
707  double zs=(zsup+zslow)/2;
708  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_Zs->Fill(zs,weight);
709  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_Zs->Fill(zs,weight);
710  break;
711  }
712  }
713  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_MVis->Fill(pipi.M()/tautau.M(),weight);
714  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_MVis->Fill(pipi.M()/tautau.M(),weight);
715 
716  if(x1!=0){
717  const std::vector<HepMC::GenParticle*> m=GetMothers(boson);
718  int q(0),qbar(0);
719  TLorentzVector Z(0,0,0,0);
720  for(unsigned int i=0;i<m.size();i++){
721  if(m.at(i)->pdg_id()==PdtPdgMini::d || m.at(i)->pdg_id()==PdtPdgMini::u ){q++;}
722  if(m.at(i)->pdg_id()==PdtPdgMini::anti_d || m.at(i)->pdg_id()==PdtPdgMini::anti_u ){qbar++;}
723  }
724  if(q==1 && qbar==1){// assume q has largest E (valence vs see quarks)
725  if(taum.Vect().Dot(Zboson.Vect())/(Zboson.P()*taum.P())>0){
726  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_Xf->Fill(x1,weight);
727  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_Xf->Fill(x1,weight);
728  }
729  else{
730  if(abs(boson->pdg_id())==PdtPdgMini::Z0) TauSpinEffectsZ_Xb->Fill(x1,weight);
731  if(abs(boson->pdg_id())==PdtPdgMini::Higgs0) TauSpinEffectsH_Xb->Fill(x1,weight);
732  }
733  }
734  }
735  }
736 }
737 
738 double TauValidation::Zstoa(double zs){
739  double a=1-sqrt(fabs(1.0-2*fabs(zs)));
740  if(zs<0){
741  a*=-1.0;
742  }
743  return a;
744 }
745 
746 
748  return leadingPionP4(tau).P();
749 }
750 
752 
753  TLorentzVector p4(0,0,0,0);
754 
755  if ( tau->end_vertex() ) {
756  HepMC::GenVertex::particle_iterator des;
757  for(des = tau->end_vertex()->particles_begin(HepMC::descendants);
758  des!= tau->end_vertex()->particles_end(HepMC::descendants);++des ) {
759  int pid = (*des)->pdg_id();
760 
761  if(abs(pid) == 15) return leadingPionP4(*des);
762 
763  if(!(abs(pid)==211 || abs(pid)==13 || abs(pid)==11)) continue;
764 
765  if((*des)->momentum().rho() > p4.P()) {
766  p4 = TLorentzVector((*des)->momentum().px(),
767  (*des)->momentum().py(),
768  (*des)->momentum().pz(),
769  (*des)->momentum().e());
770  }
771  }
772  }
773 
774  return p4;
775 }
776 
778  const HepMC::GenParticle* m=GetMother(tau);
779  return TLorentzVector(m->momentum().px(),m->momentum().py(),m->momentum().pz(),m->momentum().e());
780 }
781 
783  TLorentzVector p4(tau->momentum().px(),
784  tau->momentum().py(),
785  tau->momentum().pz(),
786  tau->momentum().e());
787 
788  if ( tau->end_vertex() ) {
789  HepMC::GenVertex::particle_iterator des;
790  for(des = tau->end_vertex()->particles_begin(HepMC::descendants);
791  des!= tau->end_vertex()->particles_end(HepMC::descendants);++des ) {
792  int pid = (*des)->pdg_id();
793 
794  if(abs(pid) == 15) return visibleTauEnergy(*des);
795 
796  if(abs(pid) == 12 || abs(pid) == 14 || abs(pid) == 16) {
797  p4 -= TLorentzVector((*des)->momentum().px(),
798  (*des)->momentum().py(),
799  (*des)->momentum().pz(),
800  (*des)->momentum().e());
801  }
802  }
803  }
804 
805  return p4.E();
806 }
807 
809  // Find First tau in chain
810  std::vector<const HepMC::GenParticle*> TauList;
811  findTauList(tau,TauList);
812 
813  // Get List of Gauge Boson to tau(s) FSR and Brem
814  bool passedW=false;
815  std::vector<const HepMC::GenParticle*> ListofFSR; ListofFSR.clear();
816  std::vector<const HepMC::GenParticle*> ListofBrem; ListofBrem.clear();
817  std::vector<const HepMC::GenParticle*> FSR_photos; FSR_photos.clear();
818  double BosonScale(1);
819  if(TauList.size()>0){
820  TauValidation::findFSRandBrem(TauList.at(0),passedW,ListofFSR,ListofBrem);
821  TauValidation::FindPhotosFSR(TauList.at(0),FSR_photos,BosonScale);
822 
823  // Add the Tau Brem. information
824  TauBremPhotonsN->Fill(ListofBrem.size(),weight);
825  double photonPtSum=0;
826  for(unsigned int i=0;i<ListofBrem.size();i++){
827  photonPtSum+=ListofBrem.at(i)->momentum().perp();
828  TauBremPhotonsPt->Fill(ListofBrem.at(i)->momentum().perp(),weight);
829  }
830  TauBremPhotonsPtSum->Fill(photonPtSum,weight);
831 
832  // Now add the Gauge Boson FSR information
833  if(BosonScale!=0){
834  TauFSRPhotonsN->Fill(ListofFSR.size(),weight);
835  photonPtSum=0;
836  for(unsigned int i=0;i<ListofFSR.size();i++){
837  photonPtSum+=ListofFSR.at(i)->momentum().perp();
838  TauFSRPhotonsPt->Fill(ListofFSR.at(i)->momentum().perp(),weight);
839  }
840  double FSR_photosSum(0);
841  for(unsigned int i=0;i<FSR_photos.size();i++){
842  FSR_photosSum+=FSR_photos.at(i)->momentum().perp();
843  TauFSRPhotonsPt->Fill(FSR_photos.at(i)->momentum().perp()/BosonScale,weight*BosonScale);
844  }
845  TauFSRPhotonsPtSum->Fill(photonPtSum+FSR_photosSum/BosonScale,weight);
846  }
847  }
848 }
849 
void findTauList(const HepMC::GenParticle *tau, std::vector< const HepMC::GenParticle * > &TauList)
MonitorElement * TauFSRPhotonsN
const double beta
const double Pi
int i
Definition: DBlmapReader.cc:9
virtual ~TauValidation()
MonitorElement * TauSpinEffectsH_rhorhoAcoplanarityplus
MonitorElement * TauPhi
MonitorElement * TauSpinEffectsW_X
TPRegexp parents
Definition: eve_filter.cc:24
MonitorElement * TauSpinEffectsHpm_UpsilonA1
std::vector< std::vector< MonitorElement * > > JAKInvMass
MonitorElement * TauSpinEffectsZ_Xb
MonitorElement * nTaus
WeightManager wmanager_
Definition: TauValidation.h:71
MonitorElement * DecayLength
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
MonitorElement * TauRtauW
TauValidation(const edm::ParameterSet &)
MonitorElement * TauPt
MonitorElement * TauSpinEffectsH_MVis
void spinEffectsZH(const HepMC::GenParticle *boson, double weight)
MonitorElement * TauMothers
MonitorElement * TauSpinEffectsHpm_eX
MonitorElement * TauSpinEffectsW_muX
MonitorElement * TauBremPhotonsN
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * JAKID
MonitorElement * TauSpinEffectsZ_Xf
int tauProngs(const HepMC::GenParticle *, double weight)
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
MonitorElement * TauBremPhotonsPtSum
MonitorElement * TauSpinEffectsH_pipiAcoplanarity
MonitorElement * TauSpinEffectsHpm_UpsilonRho
double charge(const std::vector< uint8_t > &Ampls)
void getData(T &iHolder) const
Definition: EventSetup.h:67
MonitorElement * TauSpinEffectsZ_eX
int findMother(const HepMC::GenParticle *)
void Fill(long long x)
MonitorElement * TauProngs
int tauMother(const HepMC::GenParticle *, double weight)
int tauDecayChannel(const HepMC::GenParticle *, double weight=0.0)
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * TauSpinEffectsH_pipiAcollinearityzoom
const std::vector< HepMC::GenParticle * > GetMothers(const HepMC::GenParticle *boson)
math::XYZTLorentzVectorD LV
int iEvent
Definition: GenABIO.cc:230
MonitorElement * TauSpinEffectsW_UpsilonRho
void photons(const HepMC::GenParticle *, double weight)
MonitorElement * TauSpinEffectsH_rhorhoAcoplanarityminus
virtual void analyze(edm::Event const &, edm::EventSetup const &) override
T sqrt(T t)
Definition: SSEVec.h:48
double p4[4]
Definition: TauolaWrapper.h:92
double leadingPionMomentum(const HepMC::GenParticle *, double weight)
MonitorElement * TauSpinEffectsH_Xf
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
MonitorElement * TauFSRPhotonsPt
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
MonitorElement * TauSpinEffectsZ_muX
MonitorElement * TauDecayChannels
edm::InputTag hepmcCollection_
Definition: TauValidation.h:94
MonitorElement * TauSpinEffectsH_Zs
MonitorElement * TauFSRPhotonsPtSum
HepPDT::ParticleData ParticleData
double visibleTauEnergy(const HepMC::GenParticle *)
TLorentzVector leadingPionP4(const HepMC::GenParticle *)
bool isLastTauinChain(const HepMC::GenParticle *tau)
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
MonitorElement * TauSpinEffectsZ_MVis
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * TauSpinEffectsH_pipiAcollinearity
TLorentzVector motherP4(const HepMC::GenParticle *)
void rtau(const HepMC::GenParticle *, int, int, double weight)
part
Definition: HCALResponse.h:20
tuple pid
Definition: sysUtil.py:22
void FindPhotosFSR(const HepMC::GenParticle *p, std::vector< const HepMC::GenParticle * > &ListofFSR, double &BosonScale)
MonitorElement * TauSpinEffectsZ_X
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
Definition: TauValidation.h:99
MonitorElement * TauSpinEffectsH_eX
MonitorElement * TauSpinEffectsW_eX
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double Zstoa(double zs)
const HepMC::GenParticle * GetMother(const HepMC::GenParticle *tau)
void spinEffectsWHpm(const HepMC::GenParticle *, int, int, std::vector< HepMC::GenParticle * > &part, double weight)
MonitorElement * LifeTime
MonitorElement * TauSpinEffectsH_muX
MonitorElement * TauSpinEffectsW_UpsilonA1
double a
Definition: hdecay.h:121
MonitorElement * TauEta
void findFSRandBrem(const HepMC::GenParticle *p, bool doBrem, std::vector< const HepMC::GenParticle * > &ListofFSR, std::vector< const HepMC::GenParticle * > &ListofBrem)
unsigned int NJAKID
MonitorElement * TauSpinEffectsZ_Zs
MonitorElement * TauSpinEffectsHpm_X
int weight
Definition: histoStyle.py:50
MonitorElement * TauSpinEffectsHpm_muX
double weight(const edm::Event &)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * TauSpinEffectsH_Xb
MonitorElement * nPrimeTaus
MonitorElement * TauBremPhotonsPt
MonitorElement * TauRtauHpm
Definition: Run.h:41
MonitorElement * TauSpinEffectsH_X