Changeset a0b6d15 in git
- Timestamp:
- Sep 28, 2014, 10:16:15 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 1d42548
- Parents:
- bf6ed57
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/geometry.C
rbf6ed57 ra0b6d15 27 27 ~Delphes3DGeometry() {} 28 28 29 void readFile(const char* filename); 29 void readFile(const char* filename, const char* ParticlePropagator="ParticlePropagator", 30 const char* TrackingEfficiency="ChargedHadronTrackingEfficiency", 31 const char* MuonEfficiency="MuonEfficiency", 32 const char* Calorimeters="Calorimeter"); 30 33 31 34 void setContingency(Double_t contingency) { contingency_ = contingency; } … … 57 60 Double_t tk_radius_; 58 61 Double_t tk_length_; 62 Double_t tk_etamax_; 59 63 Double_t calo_endcap_etamax_; 60 64 Double_t muonSystem_etamax_; … … 98 102 tk_radius_ = 120.; 99 103 tk_length_ = 150.; 104 tk_etamax_ = 3.0; 100 105 calo_endcap_etamax_ = 2.6; 101 106 muonSystem_etamax_ = 2.4; 102 107 } 103 108 104 void Delphes3DGeometry::readFile(const char *configFile) { 109 void Delphes3DGeometry::readFile(const char *configFile, 110 const char* ParticlePropagator, const char* TrackingEfficiency, 111 const char* MuonEfficiency, const char* Calorimeters) { 105 112 106 113 ExRootConfReader *confReader = new ExRootConfReader; 107 114 confReader->ReadFile(configFile); 108 115 109 tk_radius_ = confReader->GetDouble("ParticlePropagator::Radius", 1.0)*100; // tk_radius 110 tk_length_ = confReader->GetDouble("ParticlePropagator::HalfLength", 3.0)*100; // tk_length 111 112 TString muonEffFormula = confReader->GetString("MuonEfficiency::EfficiencyFormula","abs(eta)<2.0"); 116 tk_radius_ = confReader->GetDouble(Form("%s::Radius",ParticlePropagator), 1.0)*100; // tk_radius 117 tk_length_ = confReader->GetDouble(Form("%s::HalfLength",ParticlePropagator), 3.0)*100; // tk_length 118 119 { 120 TString tkEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",TrackingEfficiency),"abs(eta)<3.0"); 121 tkEffFormula.ReplaceAll("pt","x"); 122 tkEffFormula.ReplaceAll("eta","y"); 123 tkEffFormula.ReplaceAll("phi","0."); 124 TF2* tkEffFunction = new TF2("tkEff",tkEffFormula,0,1000,-10,10); 125 TH1F etaHisto("eta","eta",100,5.,-5.); 126 Double_t pt,eta; 127 for(int i=0;i<1000;++i) { 128 tkEffFunction->GetRandom2(pt,eta); 129 etaHisto.Fill(eta); 130 } 131 Int_t bin = -1; 132 bin = etaHisto.FindFirstBinAbove(0.5); 133 Double_t etamin = (bin>-1) ? etaHisto.GetBinLowEdge(bin) : -10.; 134 bin = etaHisto.FindLastBinAbove(0.5); 135 Double_t etamax = (bin>-1) ? etaHisto.GetBinLowEdge(bin+1) : -10.; 136 tk_etamax_ = TMath::Max(fabs(etamin),fabs(etamax)); // tk_etamax 137 delete tkEffFunction; 138 } 139 140 { 141 TString muonEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",MuonEfficiency),"abs(eta)<2.0"); 113 142 muonEffFormula.ReplaceAll("pt","x"); 114 143 muonEffFormula.ReplaceAll("eta","y"); 115 144 muonEffFormula.ReplaceAll("phi","0."); 116 145 TF2* muEffFunction = new TF2("muEff",muonEffFormula,0,1000,-10,10); 117 TH1F etaHisto("eta ","eta",100,5.,-5.);146 TH1F etaHisto("eta2","eta2",100,5.,-5.); 118 147 Double_t pt,eta; 119 148 for(int i=0;i<1000;++i) { … … 128 157 muonSystem_etamax_ = TMath::Max(fabs(etamin),fabs(etamax)); // muonSystem_etamax 129 158 delete muEffFunction; 159 } 130 160 131 161 caloBinning_.clear(); // calo binning 132 162 ExRootConfParam paramEtaBins, paramPhiBins; 133 ExRootConfParam param = confReader->GetParam( "Calorimeter::EtaPhiBins");163 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins",Calorimeters)); 134 164 Int_t size = param.GetSize(); 135 165 for(int i = 0; i < size/2; ++i) { … … 140 170 } 141 171 142 calo_endcap_etamax_ = TMath::Max(fabs(caloBinning_.begin()->first),fabs(caloBinning_.rbegin()->first)); // calo_endcap_etamax_143 172 if (size>0) calo_endcap_etamax_ = TMath::Max(fabs(caloBinning_.begin()->first),fabs(caloBinning_.rbegin()->first)); // calo_endcap_etamax_ 173 144 174 delete confReader; 145 175 … … 157 187 TGeoVolume *top = geom_->MakeBox("Delphes3DGeometry", vacuum_, 1500, 1500, 2300); // determine the size from what we know about the detector TODO 158 188 addTracker(top); 159 addCalorimeters(top); 189 addCalorimeters(top); // TODO: allow for more than one calo 160 190 addMuonDets(top); 161 191 if (withTowers) { … … 165 195 } 166 196 197 //TODO: there should be a cut by two cones to limit the acceptance in eta 198 //typically from ChargedHadronTrackingEfficiency 167 199 void Delphes3DGeometry::addTracker(TGeoVolume *top) { 168 200 // tracker: a cylinder … … 311 343 } 312 344 313 void geometry(const char* filename = "delphes_card_CMS.tcl") 345 void geometry(const char* filename = "delphes_card_CMS.tcl", const char* ParticlePropagator="ParticlePropagator", 346 const char* TrackingEfficiency="ChargedHadronTrackingEfficiency", 347 const char* MuonEfficiency="MuonEfficiency", 348 const char* Calorimeters="Calorimeter") 314 349 { 315 350 gSystem->Load("libGeom"); … … 323 358 // build the detector 324 359 Delphes3DGeometry det3D; 325 det3D.readFile(filename );360 det3D.readFile(filename,ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters); 326 361 top->AddNode(det3D.getDetector(true),1); 327 362
Note:
See TracChangeset
for help on using the changeset viewer.