Changeset 580 in svn
- Timestamp:
- Feb 1, 2012, 1:38:20 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/FrogUtil.cc
r494 r580 44 44 #include "FrogUtil.h" 45 45 46 #include "FROG_Coord.h"47 #include "FROG_Coord.cpp"48 #include "FROG_Geometry.h"49 #include "FROG_Geometry.cpp"50 #include "FROG_DetId.h"51 #include "FROG_Events.h"52 #include "FROG_Events.cpp"53 #include "FROG_Element_Tools.h"54 #include "FROG_Element_Tools.cpp"55 #include "FROG_Net_Tools.h"56 #include "FROG_Net_Tools.cpp"57 #include "FROG_Path.h"58 #include "FROG_Path.cpp"59 #include "FROG_ReadCards.h"60 #include "FROG_ReadCards.cpp"61 #include "FROG_ZLib.h"62 #include "FROG_ZLib.cpp"63 64 46 using namespace std; 65 using namespace FROG_COORD;66 67 47 const float twopi = 6.283185307179586476925286766559; 48 49 inline float EtaToTheta(float Eta){return 2*atan(exp(-Eta));} 68 50 69 51 FrogDisplay::FrogDisplay() { … … 137 119 unsigned int allEntries=treeReader->GetEntries(); 138 120 139 FROG_Events* frog_events = new FROG_Events();121 BaseColl* frog_events = new BaseColl(); 140 122 if(nEntryFrog > allEntries) { 141 123 cerr <<"** ERROR: number of entries to display > available events **"<< endl; … … 149 131 150 132 //Create a new event 151 FROG_Element_Event* frog_event = new FROG_Element_Event(1,entry);152 frog_events-> AddEvent(frog_event);133 Event* frog_event = new Event(1,entry); 134 frog_events->addDaughter(frog_event); 153 135 154 136 //Create a new branch in the event with name SIM and ID = EVTID_SIM 155 FROG_Element_Base_With_DetId_And_Name* frog_branchSIM = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM,"SIM");137 BaseColl_Name* frog_branchSIM = new BaseColl_Name(EVTID_SIM,"SIM"); 156 138 frog_event->addDaughter(frog_branchSIM); 157 139 … … 159 141 //SIM ELEC 160 142 //Create a new sub-branch in the SIM branch with name Electrons: this sub branch will contais all the electrons 161 FROG_Element_Base_With_DetId_And_Name* frog_branchElectrons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+1000,"Electrons");143 BaseColl_Name* frog_branchElectrons = new BaseColl_Name(EVTID_SIM+1000,"Electrons"); 162 144 frog_branchSIM->addDaughter(frog_branchElectrons); 163 145 … … 165 147 elec = (TRootElectron*) branchElectron->At(p); 166 148 // cout<<"Elec nO "<<p<<" PT: "<<elec->PT<<" Eta "<<elec->Eta<<" Phi"<<elec->Phi<<endl; 167 FROG_Element_Event_Candidate* frog_elec = new FROG_Element_Event_Candidate(11,elec->E,elec->Eta,elec->Phi);149 Event_Candidate* frog_elec = new Event_Candidate(11,elec->E,elec->Eta,elec->Phi); 168 150 frog_branchElectrons->addDaughter(frog_elec); 169 151 } … … 172 154 //SIM MUONS 173 155 //Create a new sub-branch in the SIM branch with name Muons: this sub branch will contais all the muons 174 FROG_Element_Base_With_DetId_And_Name* frog_branchMuons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+2000,"Muons");156 BaseColl_Name* frog_branchMuons = new BaseColl_Name(EVTID_SIM+2000,"Muons"); 175 157 frog_branchSIM->addDaughter(frog_branchMuons); 176 158 for(int p=0;p<branchMuon->GetEntriesFast();p++){ 177 159 muon = (TRootMuon*) branchMuon->At(p); 178 160 // cout<<"Muon nO"<<p<<" PT: "<<muon->PT<<"Eta "<<muon->Eta<<" Phi"<<muon->Phi<<endl; 179 FROG_Element_Event_Candidate* frog_muon = new FROG_Element_Event_Candidate(13,muon->E,muon->Eta,muon->Phi);161 Event_Candidate* frog_muon = new Event_Candidate(13,muon->E,muon->Eta,muon->Phi); 180 162 frog_branchMuons->addDaughter(frog_muon); 181 163 } … … 184 166 //SIM TAUS 185 167 //Create a new sub-branch in the SIM branch with name Taus: this sub branch will contais all the Taus 186 FROG_Element_Base_With_DetId_And_Name* frog_branchTaus = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+3000,"Taus");168 BaseColl_Name* frog_branchTaus = new BaseColl_Name(EVTID_SIM+3000,"Taus"); 187 169 frog_branchSIM->addDaughter(frog_branchTaus); 188 170 for(int p=0;p<branchTau->GetEntriesFast();p++){ 189 171 tau = (TRootTauJet*) branchTau->At(p); 190 172 // cout<<"Tau nO"<<p<<" PT: "<<tau->PT<<"Eta "<<tau->Eta<<" Phi"<<tau->Phi<<endl; 191 FROG_Element_Event_Candidate* frog_tau = new FROG_Element_Event_Candidate(15,tau->E,tau->Eta,tau->Phi);173 Event_Candidate* frog_tau = new Event_Candidate(15,tau->E,tau->Eta,tau->Phi); 192 174 frog_branchTaus->addDaughter(frog_tau); 193 175 } … … 196 178 //SIM PHOTONS 197 179 //Create a new sub-branch in the SIM branch with name Photons: this sub branch will contais all the Photons 198 FROG_Element_Base_With_DetId_And_Name* frog_branchPhotons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+4000,"Photons");180 BaseColl_Name* frog_branchPhotons = new BaseColl_Name(EVTID_SIM+4000,"Photons"); 199 181 frog_branchSIM->addDaughter(frog_branchPhotons); 200 182 for(int p=0;p<branchPhoton->GetEntriesFast();p++){ 201 183 photon = (TRootPhoton*) branchPhoton->At(p); 202 184 // cout<<"Photon nO"<<p<<" PT: "<<photon->PT<<"Eta "<<photon->Eta<<" Phi"<<photon->Phi<<endl; 203 FROG_Element_Event_Candidate* frog_photon = new FROG_Element_Event_Candidate(22,photon->E,photon->Eta,photon->Phi);185 Event_Candidate* frog_photon = new Event_Candidate(22,photon->E,photon->Eta,photon->Phi); 204 186 frog_branchPhotons->addDaughter(frog_photon); 205 187 } … … 208 190 //SIM JETS 209 191 //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets 210 FROG_Element_Base_With_DetId_And_Name* frog_branchJets = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+5000,"Jets");192 BaseColl_Name* frog_branchJets = new BaseColl_Name(EVTID_SIM+5000,"Jets"); 211 193 frog_branchSIM->addDaughter(frog_branchJets); 212 194 for(int p=0;p<branchJet->GetEntriesFast();p++){ 213 195 jet = (TRootJet*) branchJet->At(p); 214 196 // cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl; 215 FROG_Element_Event_Jet* frog_jet = new FROG_Element_Event_Jet(jet->E,jet->Eta,jet->Phi);197 Event_Jet* frog_jet = new Event_Jet(jet->E,jet->Eta,jet->Phi); 216 198 frog_branchJets->addDaughter(frog_jet); 217 199 } … … 220 202 //SIM MET 221 203 //Create a new sub-branch in the SIM branch with name MET: this sub branch will contais all the METs 222 FROG_Element_Base_With_DetId_And_Name* frog_branchMET = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+6000,"MET");204 BaseColl_Name* frog_branchMET = new BaseColl_Name(EVTID_SIM+6000,"MET"); 223 205 frog_branchSIM->addDaughter(frog_branchMET); 224 206 for(int p=0;p<branchMET->GetEntriesFast();p++){ 225 207 met = (TRootETmis*) branchMET->At(p); 226 208 // cout<<"MET nO"<<p<<" ET: "<<met->ET<<"Eta "<<0<<" Phi"<<met->Phi<<endl; 227 FROG_Element_Event_MET* frog_met = new FROG_Element_Event_MET(0,met->ET,0,met->Phi, met->ET);209 Event_MET* frog_met = new Event_MET(0,met->ET,0,met->Phi, met->ET); 228 210 frog_branchMET->addDaughter(frog_met); 229 211 } 230 212 231 //Save the event in the .vis file232 frog_events->SaveInLive("DelphesToFrog.vis",false,false,(unsigned int)-1);233 213 } 214 //Save events in the .vis file 215 frog_events->save("DelphesToFrog.vis"); 216 234 217 235 218 /* Pointer hierachy … … 261 244 262 245 // This element is the root of the "file" tree. (don't change this line) 263 FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);264 265 FROG_Element_Base* mygeom = new FROG_Element_Base(C_GEOMETRY);246 BaseColl* prim = new BaseColl(); 247 248 BaseColl* mygeom = new BaseColl(); 266 249 prim->addDaughter(mygeom); 267 250 268 FROG_Element_Base_With_DetId_And_Name* detector = new FROG_Element_Base_With_DetId_And_Name(900000000,"Delphes");251 BaseColl_Name* detector = new BaseColl_Name(900000000,"Delphes"); 269 252 mygeom->addDaughter(detector); 270 253 … … 283 266 //******************************************************************************************************** 284 267 285 FROG_Element_Base_With_DetId_And_Name* Tracker = new FROG_Element_Base_With_DetId_And_Name(910000000,"Tracker");268 BaseColl_Name* Tracker = new BaseColl_Name(910000000,"Tracker"); 286 269 detector->addDaughter(Tracker); 287 270 unsigned int DetIdCountTracker = 1; … … 294 277 for(double phi=0; phi<=twopi/frac;phi+=dphi){ 295 278 296 FROG_Element_Primitive_CustomSurface* trackerCone1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,279 Prim_CustomSurface* trackerCone1 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, 297 280 rayCone*sin(phi) ,rayCone*cos(phi) ,-Lenght_Tracker/2, 298 281 rayCone*sin(phi+dphi) ,rayCone*cos(phi+dphi) ,-Lenght_Tracker/2, … … 301 284 Tracker->addDaughter(trackerCone1); DetIdCountTracker++; 302 285 303 FROG_Element_Primitive_CustomSurface* trackerCone2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,286 Prim_CustomSurface* trackerCone2 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, 304 287 0 , 0 ,0, 305 288 0 , 0 ,0, … … 309 292 310 293 311 FROG_Element_Primitive_CustomSurface* trackerB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,294 Prim_CustomSurface* trackerB = new Prim_CustomSurface(9100000+DetIdCountTracker*10, 312 295 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Tracker*0.5, 313 296 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Tracker*0.5, … … 316 299 Tracker->addDaughter(trackerB); DetIdCountTracker++; 317 300 318 FROG_Element_Primitive_CustomSurface* trackerEndCap1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,301 Prim_CustomSurface* trackerEndCap1 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, 319 302 rayCone*sin(phi) , rayCone*cos(phi) , -(Lenght_Tracker)/2, 320 303 rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , -(Lenght_Tracker)/2, … … 323 306 Tracker->addDaughter(trackerEndCap1); DetIdCountTracker++; 324 307 325 FROG_Element_Primitive_CustomSurface* trackerEndCap2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,308 Prim_CustomSurface* trackerEndCap2 = new Prim_CustomSurface(9100000+DetIdCountTracker*10, 326 309 rayCone*sin(phi) , rayCone*cos(phi) , (Lenght_Tracker)/2, 327 310 rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , (Lenght_Tracker)/2, … … 337 320 //******************************************************************************************************** 338 321 339 FROG_Element_Base_With_DetId_And_Name* CALO = new FROG_Element_Base_With_DetId_And_Name(920000000,"Calo");322 BaseColl_Name* CALO = new BaseColl_Name(920000000,"Calo"); 340 323 detector->addDaughter(CALO); 341 324 unsigned int DetIdCountCalo = 1; … … 351 334 352 335 //BARREL 353 FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountCalo*10,336 Prim_CustomSurface* caloB = new Prim_CustomSurface(9100000+DetIdCountCalo*10, 354 337 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Calo*0.5, 355 338 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Calo*0.5, … … 359 342 360 343 //Partial cone + side 361 FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,344 Prim_CustomSurface* caloEndCap1a = new Prim_CustomSurface(9200000+DetIdCountCalo*10, 362 345 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Tracker)/2, 363 346 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Tracker)/2, … … 367 350 368 351 //Close Endcap + side 369 FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,352 Prim_CustomSurface* caloEndCap1b = new Prim_CustomSurface(9200000+DetIdCountTracker*10, 370 353 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2, 371 354 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2, … … 375 358 376 359 //Partial cone - side 377 FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,360 Prim_CustomSurface* caloEndCap2a = new Prim_CustomSurface(9200000+DetIdCountCalo*10, 378 361 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Tracker)/2, 379 362 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Tracker)/2, … … 383 366 384 367 //Close Endcap - side 385 FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,368 Prim_CustomSurface* caloEndCap2b = new Prim_CustomSurface(9200000+DetIdCountTracker*10, 386 369 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2, 387 370 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2, … … 397 380 //******************************************************************************************************** 398 381 399 FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(930000000,"Muon");382 BaseColl_Name* MUON = new BaseColl_Name(930000000,"Muon"); 400 383 detector->addDaughter(MUON); 401 384 unsigned int DetIdCountMuon = 1; … … 409 392 410 393 //BARREL 411 FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,394 Prim_CustomSurface* muonB = new Prim_CustomSurface(9300000+DetIdCountMuon*10, 412 395 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Muon*0.5, 413 396 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Muon*0.5, … … 417 400 418 401 //Partial cone + side 419 FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,402 Prim_CustomSurface* muonEndCap1a = new Prim_CustomSurface(9300000+DetIdCountMuon*10, 420 403 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Calo)/2, 421 404 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Calo)/2, … … 425 408 426 409 //Close Endcap + side 427 FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,410 Prim_CustomSurface* muonEndCap1b = new Prim_CustomSurface(9300000+DetIdCountMuon*10, 428 411 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2, 429 412 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2, … … 433 416 434 417 //Partial cone - side 435 FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,418 Prim_CustomSurface* muonEndCap2a = new Prim_CustomSurface(9300000+DetIdCountMuon*10, 436 419 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Calo)/2, 437 420 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Calo)/2, … … 441 424 442 425 //Close Endcap - side 443 FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,426 Prim_CustomSurface* muonEndCap2b = new Prim_CustomSurface(9300000+DetIdCountMuon*10, 444 427 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2, 445 428 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2, … … 453 436 //******************************************************************************************************** 454 437 455 FROG_Element_Base_With_DetId_And_Name* CALOFWD = new FROG_Element_Base_With_DetId_And_Name(940000000,"CaloFwd");438 BaseColl_Name* CALOFWD = new BaseColl_Name(940000000,"CaloFwd"); 456 439 detector->addDaughter(CALOFWD); 457 440 unsigned int DetIdCountCaloFwd = 1; … … 465 448 466 449 //Partial cone + side 467 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,450 Prim_CustomSurface* caloFWDEndCap1a = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, 468 451 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Muon)/2, 469 452 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Muon)/2, … … 473 456 474 457 //Close Endcap + side 475 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,458 Prim_CustomSurface* caloFWDEndCap1b = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, 476 459 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2, 477 460 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2, … … 481 464 482 465 //BARREL 483 FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,466 Prim_CustomSurface* caloFWDB1 = new Prim_CustomSurface(9400000+DetIdCountMuon*10, 484 467 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5, 485 468 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5, … … 489 472 490 473 //Partial cone - side 491 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,474 Prim_CustomSurface* caloFWDEndCap2a = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, 492 475 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Muon)/2, 493 476 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Muon)/2, … … 497 480 498 481 //Close Endcap - side 499 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,482 Prim_CustomSurface* caloFWDEndCap2b = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10, 500 483 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2, 501 484 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2, … … 505 488 506 489 //BARREL 507 FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,490 Prim_CustomSurface* caloFWDB2 = new Prim_CustomSurface(9400000+DetIdCountMuon*10, 508 491 ray*sin(phi) ,ray*cos(phi) , -Lenght_Muon*0.5, 509 492 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_Muon*0.5, … … 512 495 CALOFWD->addDaughter(caloFWDB2); DetIdCountCaloFwd++; 513 496 } 514 515 FROG_Geometry* CustomGeom = new FROG_Geometry(prim); 516 CustomGeom->Save("DelphesToFrog.geom"); 497 prim->save("DelphesToFrog.geom"); 517 498 518 499 delete prim; 519 delete CustomGeom;520 500 521 501 /* pointer hierarchy … … 531 511 532 512 533 //FROG_ELEMENT::PrintTree(prim);534 513 return; 535 514
Note:
See TracChangeset
for help on using the changeset viewer.