/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \------------- arXiv:0903.2225v1 ------------/ ** ** ** ** ** ** This package uses: ** ** ------------------ ** ** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 ** ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] ** ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] ** ** FROG: [hep-ex/0901.2718v1] ** ** HepMC: Comput. Phys. Commun.134 (2001) 41 ** ** ** ** ------------------------------------------------------------------ ** ** ** ** Main authors: ** ** ------------- ** ** ** ** Severine Ovyn Xavier Rouby ** ** severine.ovyn@uclouvain.be xavier.rouby@cern ** ** ** ** Center for Particle Physics and Phenomenology (CP3) ** ** Universite catholique de Louvain (UCL) ** ** Louvain-la-Neuve, Belgium ** ** ** ** Copyright (C) 2008-2009, ** ** All rights reserved. ** ** ** ***********************************************************************/ #include #include "TROOT.h" #include "TApplication.h" #include "TStyle.h" #include "TChain.h" #include "TClonesArray.h" #include "BlockClasses.h" #include "ExRootTreeReader.h" #include "FrogUtil.h" using namespace std; const float twopi = 6.283185307179586476925286766559; inline float EtaToTheta(float Eta){return 2*atan(exp(-Eta));} FrogDisplay::FrogDisplay() { //Smearing information DET = new RESOLution(); nEntryFrog = DET->NEvents_Frog; } FrogDisplay::FrogDisplay(const string& DetDatacard) { //Smearing information DET = new RESOLution(); DET->ReadDataCard(DetDatacard); nEntryFrog = DET->NEvents_Frog; } FrogDisplay::FrogDisplay(const RESOLution* DetDatacard) { //Smearing information DET = new RESOLution(*DetDatacard); nEntryFrog = DET->NEvents_Frog; } FrogDisplay::FrogDisplay(const FrogDisplay& frog) { DET = new RESOLution(*(frog.DET)); nEntryFrog = DET->NEvents_Frog; } FrogDisplay& FrogDisplay::operator=(const FrogDisplay& frog) { if (this==&frog) return *this; DET = new RESOLution(*(frog.DET)); nEntryFrog = DET->NEvents_Frog; return *this; } void FrogDisplay::BuildEvents(const string& outputfilename) { const Font_t kExRootFont = 42; const Float_t kExRootFontSize = 0.07; gROOT->SetStyle("Plain"); gROOT->cd(); gStyle->SetCanvasColor(10); gStyle->SetPadColor(10); gStyle->SetFillColor(-1); gStyle->SetPaperSize(20, 24); gStyle->SetStatFont(kExRootFont); gStyle->SetTextFont(kExRootFont); gStyle->SetTextSize(kExRootFontSize); gStyle->SetLegendBorderSize(0); gStyle->SetOptStat(0); TChain* chain = new TChain("Analysis"); TChain* chainGen = new TChain("GEN"); chain ->Add(outputfilename.c_str()); chainGen->Add(outputfilename.c_str()); ExRootTreeReader *treeReader = new ExRootTreeReader(chain); ExRootTreeReader *treeReaderGen = new ExRootTreeReader(chainGen); const TClonesArray* branchElectron = treeReader ->UseBranch("Electron"); const TClonesArray* branchMuon = treeReader ->UseBranch("Muon"); const TClonesArray* branchTau = treeReader ->UseBranch("TauJet"); const TClonesArray* branchPhoton = treeReader ->UseBranch("Photon"); const TClonesArray* branchJet = treeReader ->UseBranch("Jet"); const TClonesArray* branchMET = treeReader ->UseBranch("ETmis"); TRootElectron* elec; TRootMuon* muon; TRootTauJet* tau; TRootPhoton* photon; TRootJet* jet; TRootETmis* met; unsigned int allEntries=treeReader->GetEntries(); BaseColl* frog_events = new BaseColl(); if(nEntryFrog > allEntries) { cerr <<"** ERROR: number of entries to display > available events **"<< endl; nEntryFrog = allEntries; } for(unsigned int entry = 0; entry < nEntryFrog; ++entry){ //cout<<"Event n° "<ReadEntry(entry); treeReaderGen->ReadEntry(entry); //Create a new event Event* frog_event = new Event(1,entry); frog_events->addDaughter(frog_event); //Create a new branch in the event with name SIM and ID = EVTID_SIM BaseColl_Name* frog_branchSIM = new BaseColl_Name(EVTID_SIM,"SIM"); frog_event->addDaughter(frog_branchSIM); //SIM ELEC //Create a new sub-branch in the SIM branch with name Electrons: this sub branch will contais all the electrons BaseColl_Name* frog_branchElectrons = new BaseColl_Name(EVTID_SIM+1000,"Electrons"); frog_branchSIM->addDaughter(frog_branchElectrons); for(int p=0;pGetEntriesFast();p++){ elec = (TRootElectron*) branchElectron->At(p); // cout<<"Elec nO "<PT<<" Eta "<Eta<<" Phi"<Phi<E,elec->Eta,elec->Phi); frog_branchElectrons->addDaughter(frog_elec); } //SIM MUONS //Create a new sub-branch in the SIM branch with name Muons: this sub branch will contais all the muons BaseColl_Name* frog_branchMuons = new BaseColl_Name(EVTID_SIM+2000,"Muons"); frog_branchSIM->addDaughter(frog_branchMuons); for(int p=0;pGetEntriesFast();p++){ muon = (TRootMuon*) branchMuon->At(p); // cout<<"Muon nO"<PT<<"Eta "<Eta<<" Phi"<Phi<E,muon->Eta,muon->Phi); frog_branchMuons->addDaughter(frog_muon); } //SIM TAUS //Create a new sub-branch in the SIM branch with name Taus: this sub branch will contais all the Taus BaseColl_Name* frog_branchTaus = new BaseColl_Name(EVTID_SIM+3000,"Taus"); frog_branchSIM->addDaughter(frog_branchTaus); for(int p=0;pGetEntriesFast();p++){ tau = (TRootTauJet*) branchTau->At(p); // cout<<"Tau nO"<PT<<"Eta "<Eta<<" Phi"<Phi<E,tau->Eta,tau->Phi); frog_branchTaus->addDaughter(frog_tau); } //SIM PHOTONS //Create a new sub-branch in the SIM branch with name Photons: this sub branch will contais all the Photons BaseColl_Name* frog_branchPhotons = new BaseColl_Name(EVTID_SIM+4000,"Photons"); frog_branchSIM->addDaughter(frog_branchPhotons); for(int p=0;pGetEntriesFast();p++){ photon = (TRootPhoton*) branchPhoton->At(p); // cout<<"Photon nO"<PT<<"Eta "<Eta<<" Phi"<Phi<E,photon->Eta,photon->Phi); frog_branchPhotons->addDaughter(frog_photon); } //SIM JETS //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets BaseColl_Name* frog_branchJets = new BaseColl_Name(EVTID_SIM+5000,"Jets"); frog_branchSIM->addDaughter(frog_branchJets); for(int p=0;pGetEntriesFast();p++){ jet = (TRootJet*) branchJet->At(p); // cout<<"Jet nO"<PT<<"Eta "<Eta<<" Phi"<Phi<E,jet->Eta,jet->Phi); frog_branchJets->addDaughter(frog_jet); } //SIM MET //Create a new sub-branch in the SIM branch with name MET: this sub branch will contais all the METs BaseColl_Name* frog_branchMET = new BaseColl_Name(EVTID_SIM+6000,"MET"); frog_branchSIM->addDaughter(frog_branchMET); for(int p=0;pGetEntriesFast();p++){ met = (TRootETmis*) branchMET->At(p); // cout<<"MET nO"<ET<<"Eta "<<0<<" Phi"<Phi<ET,0,met->Phi, met->ET); frog_branchMET->addDaughter(frog_met); } } //Save events in the .vis file frog_events->save("DelphesToFrog.vis"); /* Pointer hierachy frog_events -frog_event -frog_branchSIM -frog_branchElectrons -frog_elec -frog_branchMuons -frog_muon -frog_branchTaus -frog_tau -frog_branchPhotons -frog_photon -frog_photon -frog_jet -frog_branchMET -frog_met */ delete treeReader; delete treeReaderGen; delete frog_events; delete chain; delete chainGen; } void FrogDisplay::BuildGeom() { // This element is the root of the "file" tree. (don't change this line) BaseColl* prim = new BaseColl(); BaseColl* mygeom = new BaseColl(); prim->addDaughter(mygeom); BaseColl_Name* detector = new BaseColl_Name(900000000,"Delphes"); mygeom->addDaughter(detector); double Rayon_Tracker=40; double Rayon_Calo = Rayon_Tracker*1.5; double Rayon_Muon = Rayon_Tracker*2; double Lenght_Tracker=100; double Lenght_Calo=Lenght_Tracker+Lenght_Tracker/2.5; double Lenght_Muon=Lenght_Calo+Lenght_Calo/2.5; double Lenght_CaloFwd=Lenght_Muon+Lenght_Muon/2.5; int NumPhi=100; float frac=1; //************************************************Tracker************************************************* //******************************************************************************************************** BaseColl_Name* Tracker = new BaseColl_Name(910000000,"Tracker"); detector->addDaughter(Tracker); unsigned int DetIdCountTracker = 1; double ray=Rayon_Tracker; double rayCone = tan(EtaToTheta(DET->CEN_max_tracker))*Lenght_Tracker/2; if(ray < rayCone)ray=rayCone; double dphi = twopi /NumPhi; for(double phi=0; phi<=twopi/frac;phi+=dphi){ Prim_CustomSurface* trackerCone1 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, rayCone*sin(phi) ,rayCone*cos(phi) ,-Lenght_Tracker/2, rayCone*sin(phi+dphi) ,rayCone*cos(phi+dphi) ,-Lenght_Tracker/2, 0 , 0 , 0, 0 , 0 , 0); Tracker->addDaughter(trackerCone1); DetIdCountTracker++; Prim_CustomSurface* trackerCone2 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, 0 , 0 ,0, 0 , 0 ,0, rayCone*sin(phi) , rayCone*cos(phi) , Lenght_Tracker/2, rayCone*sin(phi+dphi) , rayCone*sin(phi+dphi) , Lenght_Tracker/2); Tracker->addDaughter(trackerCone2); DetIdCountTracker++; Prim_CustomSurface* trackerB = new Prim_CustomSurface(9100000+DetIdCountTracker*10, ray*sin(phi) ,ray*cos(phi) ,-Lenght_Tracker*0.5, ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Tracker*0.5, ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Tracker*0.5, ray*sin(phi) ,ray*cos(phi) , Lenght_Tracker*0.5); Tracker->addDaughter(trackerB); DetIdCountTracker++; Prim_CustomSurface* trackerEndCap1 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, rayCone*sin(phi) , rayCone*cos(phi) , -(Lenght_Tracker)/2, rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , -(Lenght_Tracker)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Tracker)/2, ray*sin(phi) , ray*cos(phi) , -(Lenght_Tracker)/2); Tracker->addDaughter(trackerEndCap1); DetIdCountTracker++; Prim_CustomSurface* trackerEndCap2 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, rayCone*sin(phi) , rayCone*cos(phi) , (Lenght_Tracker)/2, rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , (Lenght_Tracker)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Tracker)/2, ray*sin(phi) , ray*cos(phi) , (Lenght_Tracker)/2); Tracker->addDaughter(trackerEndCap2); DetIdCountTracker++; } Rayon_Calo = ray*1.5; //******************************************Central calorimeters****************************************** //******************************************************************************************************** BaseColl_Name* CALO = new BaseColl_Name(920000000,"Calo"); detector->addDaughter(CALO); unsigned int DetIdCountCalo = 1; //float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Tracker/2; //float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Calo/2; float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_Tracker/2; float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_Calo/2; ray=Rayon_Calo; if(rayaddDaughter(caloB); DetIdCountCalo++; //Partial cone + side Prim_CustomSurface* caloEndCap1a = new Prim_CustomSurface(9200000+DetIdCountCalo*10, rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Tracker)/2, rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Tracker)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2, rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2); CALO->addDaughter(caloEndCap1a); DetIdCountCalo++; //Close Endcap + side Prim_CustomSurface* caloEndCap1b = new Prim_CustomSurface(9200000+DetIdCountTracker*10, rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Calo)/2, ray*sin(phi) , ray*cos(phi) , (Lenght_Calo)/2); CALO->addDaughter(caloEndCap1b); DetIdCountCalo++; //Partial cone - side Prim_CustomSurface* caloEndCap2a = new Prim_CustomSurface(9200000+DetIdCountCalo*10, rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Tracker)/2, rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Tracker)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2, rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2); CALO->addDaughter(caloEndCap2a); DetIdCountCalo++; //Close Endcap - side Prim_CustomSurface* caloEndCap2b = new Prim_CustomSurface(9200000+DetIdCountTracker*10, rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Calo)/2, ray*sin(phi) , ray*cos(phi) , -(Lenght_Calo)/2); CALO->addDaughter(caloEndCap2b); DetIdCountCalo++; } Rayon_Muon = ray*1.2; //***********************************************Muon chambers******************************************** //******************************************************************************************************** BaseColl_Name* MUON = new BaseColl_Name(930000000,"Muon"); detector->addDaughter(MUON); unsigned int DetIdCountMuon = 1; rayConeD = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Calo/2; rayConeF = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Muon/2; ray=Rayon_Muon; if(rayaddDaughter(muonB); DetIdCountMuon++; //Partial cone + side Prim_CustomSurface* muonEndCap1a = new Prim_CustomSurface(9300000+DetIdCountMuon*10, rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Calo)/2, rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Calo)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2, rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2); MUON->addDaughter(muonEndCap1a); DetIdCountMuon++; //Close Endcap + side Prim_CustomSurface* muonEndCap1b = new Prim_CustomSurface(9300000+DetIdCountMuon*10, rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Muon)/2, ray*sin(phi) , ray*cos(phi) , (Lenght_Muon)/2); MUON->addDaughter(muonEndCap1b); DetIdCountMuon++; //Partial cone - side Prim_CustomSurface* muonEndCap2a = new Prim_CustomSurface(9300000+DetIdCountMuon*10, rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Calo)/2, rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Calo)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2, rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2); MUON->addDaughter(muonEndCap2a); DetIdCountMuon++; //Close Endcap - side Prim_CustomSurface* muonEndCap2b = new Prim_CustomSurface(9300000+DetIdCountMuon*10, rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Muon)/2, ray*sin(phi) , ray*cos(phi) , -(Lenght_Muon)/2); MUON->addDaughter(muonEndCap2b); DetIdCountMuon++; } //******************************************Forward calorimeters****************************************** //******************************************************************************************************** BaseColl_Name* CALOFWD = new BaseColl_Name(940000000,"CaloFwd"); detector->addDaughter(CALOFWD); unsigned int DetIdCountCaloFwd = 1; rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon; rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd; //ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd; ray=tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_CaloFwd; for(double phi=0; phi<=twopi/frac;phi+=dphi){ //Partial cone + side Prim_CustomSurface* caloFWDEndCap1a = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Muon)/2, rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Muon)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2, rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2); CALOFWD->addDaughter(caloFWDEndCap1a); DetIdCountCaloFwd++; //Close Endcap + side Prim_CustomSurface* caloFWDEndCap1b = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_CaloFwd)/2, ray*sin(phi) , ray*cos(phi) , (Lenght_CaloFwd)/2); CALOFWD->addDaughter(caloFWDEndCap1b); DetIdCountCaloFwd++; //BARREL Prim_CustomSurface* caloFWDB1 = new Prim_CustomSurface(9400000+DetIdCountMuon*10, ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5, ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5, ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_CaloFwd*0.5, ray*sin(phi) ,ray*cos(phi) , Lenght_CaloFwd*0.5); CALOFWD->addDaughter(caloFWDB1); DetIdCountCaloFwd++; //Partial cone - side Prim_CustomSurface* caloFWDEndCap2a = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Muon)/2, rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Muon)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2, rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2); CALOFWD->addDaughter(caloFWDEndCap2a); DetIdCountCaloFwd++; //Close Endcap - side Prim_CustomSurface* caloFWDEndCap2b = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2, rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2, ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_CaloFwd)/2, ray*sin(phi) , ray*cos(phi) , -(Lenght_CaloFwd)/2); CALOFWD->addDaughter(caloFWDEndCap2b); DetIdCountCaloFwd++; //BARREL Prim_CustomSurface* caloFWDB2 = new Prim_CustomSurface(9400000+DetIdCountMuon*10, ray*sin(phi) ,ray*cos(phi) , -Lenght_Muon*0.5, ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_Muon*0.5, ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_CaloFwd*0.5, ray*sin(phi) ,ray*cos(phi) , -Lenght_CaloFwd*0.5); CALOFWD->addDaughter(caloFWDB2); DetIdCountCaloFwd++; } prim->save("DelphesToFrog.geom"); delete prim; /* pointer hierarchy prim -> mygeom -> detector -> Tracker -> CALO -> MUON -> CALOFWD pointers that have been added into others will be properly deleted by the destructor of their "mother" */ return; }