Fork me on GitHub

Changeset df634866 in git for examples


Ignore:
Timestamp:
Sep 30, 2014, 5:41:37 PM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
d2ac201
Parents:
1d42548
Message:

Generalized for >1 calorimeters

Now works as expected with the FCC geometry.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/geometry.C

    r1d42548 rdf634866  
    33#include <utility>
    44#include <vector>
     5#include <algorithm>
    56#include "TGeoManager.h"
    67#include "TGeoVolume.h"
     
    3940
    4041   private:
    41      void addTracker(TGeoVolume *top);
    42      void addCalorimeters(TGeoVolume *top);
    43      void addMuonDets(TGeoVolume *top);
    44      void addCaloTowers(TGeoVolume *top);
     42     std::pair<Double_t, Double_t> addTracker(TGeoVolume *top);
     43     std::pair<Double_t, Double_t> addCalorimeter(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning);
     44     std::pair<Double_t, Double_t> addMuonDets(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength);
     45     void addCaloTowers(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning);
    4546
    4647   private:
     
    6061     Double_t tk_length_;
    6162     Double_t tk_etamax_;
    62      Double_t calo_endcap_etamax_;
    63      Double_t muonSystem_etamax_;
    64      Double_t calo_barrel_innerRadius_;
    65      Double_t calo_endcap_etamin_;
    66      Double_t calo_endcap_innerRadius1_;
    67      Double_t calo_endcap_innerRadius2_;
    68      Double_t calo_endcap_outerRadius1_;
    69      Double_t calo_endcap_outerRadius2_;
    70      Double_t calo_endcap_coneThickness_;
    71      Double_t calo_endcap_diskThickness_;
    72 
    73      set< pair<Double_t, Int_t> > caloBinning_;
     63
     64     std::vector<std::string> calorimeters_;
     65     std::vector<std::string> muondets_;
     66
     67     std::map<std::string, Double_t> muonSystem_etamax_;
     68     std::map<std::string, set< pair<Double_t, Int_t> > > caloBinning_;
    7469     
    7570};
     
    9691   calo_barrel_thickness_ = 50.;
    9792   calo_endcap_thickness_ = 75.;
    98    muonSystem_thickn_ = contingency_;
     93   muonSystem_thickn_ = 10.;
    9994
    10095   // read these parameters from the Delphes Card (with default values)
     
    10297   tk_length_ = 150.;
    10398   tk_etamax_ = 3.0;
    104    calo_endcap_etamax_ = 2.6;
    105    muonSystem_etamax_  = 2.4;
    10699}
    107100
     
    138131
    139132   {
     133   muondets_.push_back("muons");
    140134   TString muonEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",MuonEfficiency),"abs(eta)<2.0");
    141135   muonEffFormula.ReplaceAll("pt","x");
     
    154148   bin = etaHisto.FindLastBinAbove(0.5);
    155149   Double_t etamax = (bin>-1) ? etaHisto.GetBinLowEdge(bin+1) : -10.;
    156    muonSystem_etamax_ = TMath::Max(fabs(etamin),fabs(etamax));                          // muonSystem_etamax
     150   muonSystem_etamax_["muons"] = TMath::Max(fabs(etamin),fabs(etamax));                 // muonSystem_etamax
    157151   delete muEffFunction;
    158152   }
    159        
     153
     154   std::string s(Calorimeters);
     155   std::replace( s.begin(), s.end(), ',', ' ' );
     156   std::istringstream stream( s );
     157   std::string word;
     158   while (stream >> word) calorimeters_.push_back(word);
     159
    160160   caloBinning_.clear();                                                                // calo binning
    161    ExRootConfParam paramEtaBins, paramPhiBins;
    162    ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins",Calorimeters));
    163    Int_t size = param.GetSize();
    164    for(int i = 0; i < size/2; ++i) {
    165      paramEtaBins = param[i*2];
    166      paramPhiBins = param[i*2+1];
    167      assert(paramEtaBins.GetSize()==1);
    168      caloBinning_.insert(std::make_pair(paramEtaBins[0].GetDouble(),paramPhiBins.GetSize()-1));
    169    }
    170 
    171    if (size>0) calo_endcap_etamax_ = TMath::Max(fabs(caloBinning_.begin()->first),fabs(caloBinning_.rbegin()->first)); // calo_endcap_etamax_
     161   for(std::vector<std::string>::const_iterator calo=calorimeters_.begin();calo!=calorimeters_.end(); ++calo) {
     162     set< pair<Double_t, Int_t> > caloBinning;
     163     ExRootConfParam paramEtaBins, paramPhiBins;
     164     ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins",calo->c_str()));
     165     Int_t size = param.GetSize();
     166     for(int i = 0; i < size/2; ++i) {
     167       paramEtaBins = param[i*2];
     168       paramPhiBins = param[i*2+1];
     169       assert(paramEtaBins.GetSize()==1);
     170       caloBinning.insert(std::make_pair(paramEtaBins[0].GetDouble(),paramPhiBins.GetSize()-1));
     171     }
     172     caloBinning_[*calo] = caloBinning;
     173   }
    172174
    173175   delete confReader;
    174176
    175    calo_barrel_innerRadius_   = tk_radius_+contingency_;
    176    calo_endcap_etamin_        = -log(tk_radius_/(2*tk_length_));
    177    calo_endcap_innerRadius1_  = tk_length_*2.*exp(-calo_endcap_etamax_)/(1-exp(-2.*calo_endcap_etamax_));
    178    calo_endcap_innerRadius2_  = (tk_length_+calo_endcap_thickness_)*2.*exp(-calo_endcap_etamax_)/(1-exp(-2.*calo_endcap_etamax_));
    179    calo_endcap_outerRadius1_  = tk_radius_;
    180    calo_endcap_outerRadius2_  = tk_radius_+calo_barrel_thickness_;
    181    calo_endcap_coneThickness_ = calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin_)) / (2.*exp(-calo_endcap_etamin_));
    182    calo_endcap_diskThickness_ = TMath::Max(0.,calo_endcap_thickness_-calo_endcap_coneThickness_);
    183177}
    184178
     
    186180   // compute the envelope
    187181   Double_t system_radius = tk_radius_+calo_barrel_thickness_+3*contingency_;
    188    Double_t system_length = tk_length_+TMath::Max(calo_endcap_coneThickness_,calo_endcap_thickness_)+3*contingency_;
     182   Double_t system_length = tk_length_+contingency_+(contingency_+calo_endcap_thickness_)*calorimeters_.size()+contingency_;
    189183   // the detector volume
    190184   TGeoVolume *top = geom_->MakeBox("Delphes3DGeometry", vacuum_, system_radius, system_radius, system_length);
    191185   // build the detector
    192    addTracker(top);
    193    addCalorimeters(top); // TODO: allow for more than one calo
    194    addMuonDets(top);
    195    if (withTowers) {
    196      addCaloTowers(top);
     186   std::pair<Double_t, Double_t> limits = addTracker(top);
     187   Double_t radius = limits.first;
     188   Double_t length = limits.second;
     189   for(std::vector<std::string>::const_iterator calo = calorimeters_.begin(); calo != calorimeters_.end(); ++calo) {
     190     limits = addCalorimeter(top,calo->c_str(),radius,length,caloBinning_[*calo]);
     191     if (withTowers) {
     192       addCaloTowers(top,calo->c_str(),radius,length,caloBinning_[*calo]);
     193     }
     194     radius = limits.first;
     195     length = limits.second;
     196   }
     197   for(std::vector<std::string>::const_iterator muon = muondets_.begin(); muon != muondets_.end(); ++muon) {
     198     limits = addMuonDets(top, muon->c_str(), radius, length);
     199     radius = limits.first;
     200     length = limits.second;
    197201   }
    198202   // return the result
     
    200204}
    201205
    202 //typically from ChargedHadronTrackingEfficiency
    203 void Delphes3DGeometry::addTracker(TGeoVolume *top) {
     206std::pair<Double_t, Double_t> Delphes3DGeometry::addTracker(TGeoVolume *top) {
    204207   // tracker: a cylinder with two cones substracted
    205208   TGeoCone* forwardCone = new TGeoCone("forwardTkAcceptance",(tk_length_/2.+0.05),0.,tk_radius_,(tk_length_)*2.*exp(-tk_etamax_)/(1-exp(-2.*tk_etamax_)),tk_radius_);
     
    214217   tracker->SetLineColor(kYellow);
    215218   top->AddNode(tracker,1);
    216 }
    217 
    218 void Delphes3DGeometry::addCalorimeters(TGeoVolume *top) {
     219   return std::make_pair(tk_radius_,tk_length_);
     220}
     221
     222std::pair<Double_t, Double_t> Delphes3DGeometry::addCalorimeter(TGeoVolume *top, const char* name,
     223                                                                Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning) {
     224   // parameters derived from the inputs
     225   Double_t calo_endcap_etamax        = TMath::Max(fabs(caloBinning.begin()->first),fabs(caloBinning.rbegin()->first));
     226   Double_t calo_barrel_innerRadius   = innerBarrelRadius+contingency_;
     227   Double_t calo_barrel_length        = innerBarrelLength + calo_barrel_thickness_;
     228   Double_t calo_endcap_etamin        = -log(innerBarrelRadius/(2*innerBarrelLength));
     229   Double_t calo_endcap_innerRadius1  = innerBarrelLength*2.*exp(-calo_endcap_etamax)/(1-exp(-2.*calo_endcap_etamax));
     230   Double_t calo_endcap_innerRadius2  = (innerBarrelLength+calo_endcap_thickness_)*2.*exp(-calo_endcap_etamax)/(1-exp(-2.*calo_endcap_etamax));
     231   Double_t calo_endcap_outerRadius1  = innerBarrelRadius;
     232   Double_t calo_endcap_outerRadius2  = innerBarrelRadius+calo_barrel_thickness_;
     233   Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin)) / (2.*exp(-calo_endcap_etamin)), calo_endcap_thickness_);
     234   Double_t calo_endcap_diskThickness = TMath::Max(0.,calo_endcap_thickness_-calo_endcap_coneThickness);
     235
    219236   // calorimeters: tube truncated in eta + cones
    220    
    221    /*TGeoTube *calo_barrel_cylinder =*/ new TGeoTube("calo_barrel_cylinder",calo_barrel_innerRadius_,tk_radius_+calo_barrel_thickness_+contingency_,tk_length_+calo_barrel_thickness_);
    222    /*TGeoCone *calo_endcap_cone =*/ new TGeoCone("calo_endcap_cone",calo_endcap_coneThickness_/2.,calo_endcap_innerRadius1_,calo_endcap_outerRadius1_,calo_endcap_innerRadius2_,calo_endcap_outerRadius2_);
    223    /*TGeoTube *calo_endcap_disk =*/ new TGeoTube("calo_endcap_disk",calo_endcap_innerRadius2_,tk_radius_+calo_barrel_thickness_,calo_endcap_diskThickness_/2.);
    224    TGeoTranslation *tr1 = new TGeoTranslation("tr1",0., 0., (calo_endcap_coneThickness_+calo_endcap_diskThickness_)/2.);
     237   new TGeoTube(Form("%s_barrel_cylinder",name),calo_barrel_innerRadius,calo_barrel_innerRadius+calo_barrel_thickness_,calo_barrel_length);
     238   new TGeoCone(Form("%s_endcap_cone",name),calo_endcap_coneThickness/2.,calo_endcap_innerRadius1,calo_endcap_outerRadius1,calo_endcap_innerRadius2,calo_endcap_outerRadius2);
     239   new TGeoTube(Form("%s_endcap_disk",name),calo_endcap_innerRadius2,tk_radius_+calo_barrel_thickness_,calo_endcap_diskThickness/2.);
     240   TGeoTranslation *tr1 = new TGeoTranslation(Form("%s_tr1",name),0., 0., (calo_endcap_coneThickness+calo_endcap_diskThickness)/2.);
    225241   tr1->RegisterYourself();
    226    TGeoCompositeShape *calo_endcap_cs = new TGeoCompositeShape("calo_endcap_cs","calo_endcap_cone+calo_endcap_disk:tr1");
    227    TGeoTranslation *trc1 = new TGeoTranslation("calo_endcap1_position",0.,0., tk_length_+calo_endcap_coneThickness_/2.);
     242   TGeoCompositeShape *calo_endcap_cs = new TGeoCompositeShape(Form("%s_endcap_cs",name),Form("%s_endcap_cone+%s_endcap_disk:%s_tr1",name,name,name));
     243   TGeoTranslation *trc1 = new TGeoTranslation(Form("%s_endcap1_position",name),0.,0., innerBarrelLength+calo_endcap_coneThickness/2.);
    228244   trc1->RegisterYourself();
    229    TGeoRotation *negz = new TGeoRotation("negz",0,180,0);
    230    TGeoCombiTrans  *trc2 = new TGeoCombiTrans("calo_endcap2_position",0.,0.,-(tk_length_+calo_endcap_coneThickness_/2.),negz);
     245   TGeoRotation *negz = new TGeoRotation(Form("%s_negz",name),0,180,0);
     246   TGeoCombiTrans  *trc2 = new TGeoCombiTrans(Form("%s_endcap2_position",name),0.,0.,-(innerBarrelLength+calo_endcap_coneThickness/2.),negz);
    231247   trc2->RegisterYourself();
    232    TGeoTranslation *trc1c = new TGeoTranslation("calo_endcap1_position_cont",0.,0., tk_length_+calo_endcap_coneThickness_/2.+contingency_);
     248   TGeoTranslation *trc1c = new TGeoTranslation(Form("%s_endcap1_position_cont",name),0.,0., innerBarrelLength+calo_endcap_coneThickness/2.+contingency_);
    233249   trc1c->RegisterYourself();
    234    TGeoCombiTrans  *trc2c = new TGeoCombiTrans("calo_endcap2_position_cont",0.,0.,-(tk_length_+calo_endcap_coneThickness_/2.)-contingency_,negz);
     250   TGeoCombiTrans  *trc2c = new TGeoCombiTrans(Form("%s_endcap2_position_cont",name),0.,0.,-(innerBarrelLength+calo_endcap_coneThickness/2.)-contingency_,negz);
    235251   trc2c->RegisterYourself();
    236    TGeoVolume *calo_endcap = new TGeoVolume("calo_endcap",calo_endcap_cs,calomed_);
    237    TGeoCompositeShape *calo_barrel_cs = new TGeoCompositeShape("calo_barrel_cs","calo_barrel_cylinder-calo_endcap_cs:calo_endcap1_position-calo_endcap_cs:calo_endcap2_position");
    238    TGeoVolume *calo_barrel = new TGeoVolume("calo_barrel",calo_barrel_cs,calomed_);
     252   TGeoVolume *calo_endcap = new TGeoVolume(Form("%s_endcap",name),calo_endcap_cs,calomed_);
     253   TGeoCompositeShape *calo_barrel_cs = new TGeoCompositeShape(Form("%s_barrel_cs",name),
     254                                                               Form("%s_barrel_cylinder-%s_endcap_cs:%s_endcap1_position-%s_endcap_cs:%s_endcap2_position",name,name,name,name,name));
     255   TGeoVolume *calo_barrel = new TGeoVolume(Form("%s_barrel",name),calo_barrel_cs,calomed_);
    239256   calo_endcap->SetLineColor(kViolet);
    240257   calo_endcap->SetFillColor(kViolet);
     
    243260   top->AddNode(calo_endcap,2,trc2c);
    244261   top->AddNode(calo_barrel,1);
    245 }
    246 
    247 void Delphes3DGeometry::addMuonDets(TGeoVolume *top) {
    248 
     262   return std::make_pair(calo_barrel_innerRadius+calo_barrel_thickness_,innerBarrelLength+calo_endcap_thickness_+contingency_);
     263}
     264
     265std::pair<Double_t, Double_t> Delphes3DGeometry::addMuonDets(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength) {
    249266   // muon system: tube + disks
    250    Double_t muonSystem_radius = tk_radius_+calo_barrel_thickness_+2*contingency_;
    251    Double_t muonSystem_length = tk_length_+TMath::Max(calo_endcap_coneThickness_,calo_endcap_thickness_)+2*contingency_;
    252    Double_t muonSystem_rmin   = muonSystem_length*2.*exp(-muonSystem_etamax_)/(1-exp(-2.*muonSystem_etamax_));
    253    TGeoVolume *muon_barrel = geom_->MakeTube("muon_barrel",mudetmed_,muonSystem_radius,muonSystem_radius+muonSystem_thickn_,muonSystem_length);
     267   Double_t muonSystem_radius = innerBarrelRadius + contingency_;
     268   Double_t muonSystem_length = innerBarrelLength + contingency_;
     269   Double_t muonSystem_rmin   = muonSystem_length*2.*exp(-muonSystem_etamax_[name])/(1-exp(-2.*muonSystem_etamax_[name]));
     270   TGeoVolume *muon_barrel = geom_->MakeTube(Form("%s_barrel",name),mudetmed_,muonSystem_radius,muonSystem_radius+muonSystem_thickn_,muonSystem_length);
    254271   muon_barrel->SetLineColor(kBlue);
    255272   top->AddNode(muon_barrel,1);
    256    TGeoVolume *muon_endcap = geom_->MakeTube("muon_endcap",mudetmed_,muonSystem_rmin,muonSystem_radius+muonSystem_thickn_,muonSystem_thickn_/2.);
     273   TGeoVolume *muon_endcap = geom_->MakeTube(Form("%s_endcap",name),mudetmed_,muonSystem_rmin,muonSystem_radius+muonSystem_thickn_,muonSystem_thickn_/2.);
    257274   muon_endcap->SetLineColor(kBlue);
    258    TGeoTranslation *trm1 = new TGeoTranslation("muonEndcap1_position",0.,0.,muonSystem_length);
     275   TGeoTranslation *trm1 = new TGeoTranslation(Form("%sEndcap1_position",name),0.,0.,muonSystem_length);
    259276   trm1->RegisterYourself();
    260    TGeoTranslation *trm2 = new TGeoTranslation("muonEndcap2_position",0.,0.,-muonSystem_length);
     277   TGeoTranslation *trm2 = new TGeoTranslation(Form("%sEndcap2_position",name),0.,0.,-muonSystem_length);
    261278   trm1->RegisterYourself();
    262279   top->AddNode(muon_endcap,1,trm1);
    263280   top->AddNode(muon_endcap,1,trm2);
    264 }
    265 
    266 void Delphes3DGeometry::addCaloTowers(TGeoVolume *top) {
    267 
    268    TGeoVolume* calo_endcap = top->GetNode("calo_endcap_1")->GetVolume();
    269    TGeoVolume* calo_barrel = top->GetNode("calo_barrel_1")->GetVolume();
     281   return std::make_pair(muonSystem_radius,muonSystem_length);
     282}
     283
     284void Delphes3DGeometry::addCaloTowers(TGeoVolume *top, const char* name,
     285                                                       Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning) {
     286
     287   TGeoVolume* calo_endcap = top->GetNode(Form("%s_endcap_1",name))->GetVolume();
     288   TGeoVolume* calo_barrel = top->GetNode(Form("%s_barrel_1",name))->GetVolume();
     289   Double_t calo_endcap_etamin = -log(innerBarrelRadius/(2*innerBarrelLength));
     290   Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin)) / (2.*exp(-calo_endcap_etamin)), calo_endcap_thickness_);
    270291
    271292   // calo towers in the barrel
    272293   Double_t vertices[16] = {0.,0.,0.,0.,0.,0.,0.,0.}; // summit of the pyramid
    273    Double_t R  = tk_radius_+calo_barrel_thickness_+2*contingency_; // radius of the muons system = height of the pyramid
    274    Int_t nEtaBins = caloBinning_.size();
     294   Double_t R  = tk_radius_ + contingency_+(contingency_+calo_barrel_thickness_)*calorimeters_.size(); // radius of the muons system = height of the pyramid
     295   Int_t nEtaBins = caloBinning.size();
    275296   // this rotation is to make the tower point "up"
    276    TGeoRotation* initTowerRot = new TGeoRotation("initTowerRot",0.,90.,0.);
    277    TGeoCombiTrans* initTower  = new TGeoCombiTrans("initTower",0.,-R/2.,0.,initTowerRot);
     297   TGeoRotation* initTowerRot = new TGeoRotation(Form("%s_initTowerRot",name),0.,90.,0.);
     298   TGeoCombiTrans* initTower  = new TGeoCombiTrans(Form("%s_initTower",name),0.,-R/2.,0.,initTowerRot);
    278299   initTower->RegisterYourself();
    279300   // eta bins... we build one pyramid per eta slice and then translate it nphi times.
     
    284305   Int_t etaslice = 0;
    285306   std::map<std::pair<int,int>, TGeoRotation*> phirotations;
    286    for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning_.begin(); bin!=caloBinning_.end();++bin) {
    287      if(abs(bin->first)>calo_endcap_etamin_) continue; // only in the barrel
     307   for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning.begin(); bin!=caloBinning.end();++bin) {
     308     if(abs(bin->first)>calo_endcap_etamin) continue; // only in the barrel
    288309     nphi[etaslice] = bin->second;
    289310     y[etaslice] = 0.5*R*(1-exp(-2*bin->first))/exp(-bin->first);
     
    291312     dx[etaslice] = R*tan(TMath::Pi()*phiRotationAngle/360.);
    292313     for(int phislice=0;phislice<nphi[etaslice];++phislice) {
    293        phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("phi%d_%d",etaslice,phislice),phiRotationAngle*phislice,0.,0.);
     314       phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("%s_phi%d_%d",name,etaslice,phislice),phiRotationAngle*phislice,0.,0.);
    294315       phirotations[make_pair(etaslice,phislice)]->RegisterYourself();
    295316     }
     
    302323     vertices[12] =  dx[i]; vertices[13] = y[i+1];
    303324     vertices[14] =  dx[i]; vertices[15] = y[i];
    304      /*TGeoArb8 *tower =*/ new TGeoArb8(Form("tower%d",i),R/2., vertices); // tower in the proper eta slice, at phi=0
     325     new TGeoArb8(Form("%s_tower%d",name,i),R/2., vertices); // tower in the proper eta slice, at phi=0
    305326     // intersection between the tower and the calo_barrel
    306      TGeoCompositeShape *finaltower_cs = new TGeoCompositeShape(Form("ftower%d_cs",i),Form("tower%d:initTower*calo_barrel_cs",i));
    307      TGeoVolume *finaltower = new TGeoVolume(Form("ftower%d",i),finaltower_cs,calomed_);
     327     TGeoCompositeShape *finaltower_cs = new TGeoCompositeShape(Form("%s_ftower%d_cs",name,i),Form("%s_tower%d:%s_initTower*%s_barrel_cs",name,i,name,name));
     328     TGeoVolume *finaltower = new TGeoVolume(Form("%s_ftower%d",name,i),finaltower_cs,calomed_);
    308329     finaltower->SetLineColor(kRed);
    309330     for(int j=0;j<nphi[i];++j) { // loop on the phi slices
     
    315336   delete[] nphi;
    316337   //the towers in the forward region
    317    R  = tk_length_+calo_endcap_thickness_+3*contingency_; // Z of the muons system = height of the pyramid
    318    nEtaBins = caloBinning_.size();
    319    // translation to bring the origin of the tower to (0,0,0)
    320    TGeoTranslation* towerdz = new TGeoTranslation("towerdz",0.,0.,R/2.-(tk_length_+calo_endcap_coneThickness_/2.));
     338   R  = tk_length_+contingency_+(contingency_+calo_endcap_thickness_)*calorimeters_.size(); // Z of the muons system = height of the pyramid
     339   nEtaBins = caloBinning.size();
     340   // translation to bring the origin of the tower to (0,0,0) (well, not really as the endcap is not yet in place)
     341   TGeoTranslation* towerdz = new TGeoTranslation(Form("%s_towerdz",name),0.,0.,R/2.-(innerBarrelLength+calo_endcap_coneThickness/2.));
    321342   towerdz->RegisterYourself();
    322343   // eta bins... we build one pyramid per eta slice and then translate it nphi times.
     
    325346   etaslice = 0;
    326347   phirotations.clear();
    327    for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning_.begin(); bin!=caloBinning_.end();++bin) {
    328      if(bin->first<calo_endcap_etamin_) continue; // only in the + endcap
     348   for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning.begin(); bin!=caloBinning.end();++bin) {
     349     if(bin->first<calo_endcap_etamin) continue; // only in the + endcap
    329350     r[etaslice] = R*2*exp(-bin->first)/(1-exp(-2*bin->first));
    330351     nphi[etaslice] = bin->second;
    331352     Double_t phiRotationAngle = 360./nphi[etaslice];
    332353     for(int phislice=0;phislice<nphi[etaslice];++phislice) {
    333        phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("forward_phi%d_%d",etaslice,phislice),phiRotationAngle*phislice,0.,0.);
     354       phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("%s_forward_phi%d_%d",name,etaslice,phislice),phiRotationAngle*phislice,0.,0.);
    334355       phirotations[make_pair(etaslice,phislice)]->RegisterYourself();
    335356     }
     
    342363     vertices[12] =  r[i]*sin(TMath::Pi()/20.);   vertices[13] = r[i]*cos(TMath::Pi()/20.);
    343364     vertices[14] =  r[i+1]*sin(TMath::Pi()/20.); vertices[15] = r[i+1]*cos(TMath::Pi()/20.);
    344      /*TGeoArb8 *fwdtower =*/ new TGeoArb8(Form("fwdtower%d",i),R/2., vertices); // tower in the proper eta slice, at phi=0
     365     new TGeoArb8(Form("%sfwdtower%d",name,i),R/2., vertices); // tower in the proper eta slice, at phi=0
    345366     // intersection between the tower and the calo_endcap
    346      TGeoCompositeShape *finalfwdtower_cs = new TGeoCompositeShape(Form("ffwdtower%d_cs",i),Form("fwdtower%d:towerdz*calo_endcap_cs",i));
    347      TGeoVolume *finalfwdtower = new TGeoVolume(Form("ffwdtower%d",i),finalfwdtower_cs,calomed_);
     367     TGeoCompositeShape *finalfwdtower_cs = new TGeoCompositeShape(Form("%sffwdtower%d_cs",name,i),Form("%sfwdtower%d:%s_towerdz*%s_endcap_cs",name,i,name,name));
     368     TGeoVolume *finalfwdtower = new TGeoVolume(Form("%sffwdtower%d",name,i),finalfwdtower_cs,calomed_);
    348369     finalfwdtower->SetLineColor(kViolet);
    349370     for(int j=0;j<nphi[i];++j) { // loop on the phi slices
Note: See TracChangeset for help on using the changeset viewer.