Browse Source

Small fix for CreateExtendedAT.C (29)

ParfenovPeter 2 months ago
parent
commit
6ad422a20c
3 changed files with 6 additions and 73 deletions
  1. 6 11
      mpd-analysis-config-reco.yml
  2. 0 58
      preprocessing/UserTaskWrite.cpp
  3. 0 4
      preprocessing/UserTaskWrite.hpp

+ 6 - 11
mpd-analysis-config-reco.yml

@@ -17,7 +17,6 @@ _axes:
 test_reco:
   event-variables:
     - RecoEventExt/bcent
-    - McEvent/PhiRp
   axes:
     - { name: RecoEventExt/bcent, bin-edges: [0., 10., 20., 30., 40., 50., 60., 70., 80., 100.] }
   q-vectors:
@@ -98,29 +97,25 @@ test_reco:
       - recentering
       - twist-and-rescale
     qa:
-      - {name: FHCalModulesExt/phi, nb: 100, lo: -4., hi: 4.}
-      - {name: FHCalModulesExt/signal, nb: 100, lo: 0., hi: 100.}
+      - {name: FHCalModules/phi, nb: 100, lo: -4., hi: 4.}
+      - {name: FHCalModules/signal, nb: 100, lo: 0., hi: 100.}
     channel-ids: *layout_mpd_fhcal_l
   - name: reco_FHCal_R
     type: channel
-    phi:  FHCalModulesExt/phi
-    weight: FHCalModulesExt/signal
+    phi:  FHCalModules/phi
+    weight: FHCalModules/signal
     norm: m
     corrections:
       - recentering
       - twist-and-rescale
     qa:
-      - {name: FHCalModulesExt/phi, nb: 100, lo: -4., hi: 4.}
-      - {name: FHCalModulesExt/signal, nb: 100, lo: 0., hi: 100.}
+      - {name: FHCalModules/phi, nb: 100, lo: -4., hi: 4.}
+      - {name: FHCalModules/signal, nb: 100, lo: 0., hi: 100.}
     channel-ids: *layout_mpd_fhcal_r
   - name: reco_RP
     type: psi
     phi: McEvent/PhiRp
     weight: Ones
     norm: m
-    corrections:
-      - recentering
-      - twist-and-rescale
-    cuts:
     qa:
       - {name: McEvent/PhiRp, nb: 360, lo: -3.14, hi: 3.14}

+ 0 - 58
preprocessing/UserTaskWrite.cpp

@@ -25,10 +25,6 @@ void UserTaskWrite::Init() { // Preparations before reading events
   particles_ = chain->GetBranch("McTracks");
   particles_.Freeze();
 
-  AddInputBranch("FHCalModules");
-  fhcal_mods_ = chain->GetBranch("FHCalModules");
-  fhcal_mods_.Freeze();
-
   match_ = chain->GetMatching("TpcTracks", "McTracks");
 
   // Set up branch configurations (copy them from the input and then modify)
@@ -47,10 +43,6 @@ void UserTaskWrite::Init() { // Preparations before reading events
   new_conf_particles.AddFields<bool>({"is_charged"}, "Extended parameter");
   new_conf_particles.AddFields<int>({"eta_sign"}, "Extended parameter");
 
-  auto br_conf_fhcal_mods = chain->GetConfiguration()->GetBranchConfig("FHCalModules");
-  auto new_conf_fhcal_mods = br_conf_fhcal_mods.Clone("FHCalModulesExt", DetType::kModule);
-  new_conf_fhcal_mods.AddFields<float>({"phi", "signal_eta_signed"}, "Extended parameter");
-
   // Prepare output branches and then add them to the output file via task manager
   new_reco_evt_ = Branch(new_conf_reco_evt);
   new_reco_evt_.SetMutable();
@@ -58,13 +50,10 @@ void UserTaskWrite::Init() { // Preparations before reading events
   new_tracks_.SetMutable();
   new_particles_ = Branch(new_conf_particles);
   new_particles_.SetMutable();
-  new_fhcal_mods_ = Branch(new_conf_fhcal_mods);
-  new_fhcal_mods_.SetMutable();
 
   man->AddBranch(&new_reco_evt_);
   man->AddBranch(&new_tracks_);
   man->AddBranch(&new_particles_);
-  man->AddBranch(&new_fhcal_mods_);
 }
 
 void UserTaskWrite::Exec() { // Procedures to do iside loop over events
@@ -99,12 +88,6 @@ void UserTaskWrite::Exec() { // Procedures to do iside loop over events
   auto imc_particle_is_charged = new_particles_.GetField("is_charged");
   auto imc_particle_eta_sign   = new_particles_.GetField("eta_sign");
 
-  // Get links to variables from the input and output FHCal modules
-  auto ifhcal_signal = fhcal_mods_.GetField("signal");
-  auto ifhcal_number = fhcal_mods_.GetField("number");
-  auto ifhcal_mods_phi               = new_fhcal_mods_.GetField("phi");
-  auto ifhcal_mods_signal_eta_signed = new_fhcal_mods_.GetField("signal_eta_signed");
-
   // Processing reco & mc event
   for(size_t i=0; i<1; ++i){
     auto mc_evt_var = mc_evt_[i];
@@ -157,27 +140,12 @@ void UserTaskWrite::Exec() { // Procedures to do iside loop over events
     new_particle.SetValue(imc_particle_eta_sign, mc_eta_sign);
     new_particle.SetValue(imc_particle_is_charged, is_charged);
   }
-
-  // Processing FHCal modules
-  new_fhcal_mods_.ClearChannels();
-  for(size_t i=0; i<fhcal_mods_.size(); ++i){ // Loop over FHCal modules
-    auto fhcal_mod = fhcal_mods_[i];
-    auto new_fhcal_mod = new_fhcal_mods_.NewChannel();
-    new_fhcal_mod.CopyContent(fhcal_mod);
-
-    double phi_mod = GetFHCalPhi((int)fhcal_mod.Value(ifhcal_number));
-    new_fhcal_mod.SetValue(ifhcal_mods_phi, phi_mod);
-
-    float fhcal_sign = ((int)fhcal_mod.Value(ifhcal_number) < 45) ? -1. : 1.;
-    new_fhcal_mod.SetValue(ifhcal_mods_signal_eta_signed, fhcal_sign*fhcal_mod.Value(ifhcal_signal));
-  }
 }
 
 UserTaskWrite::~UserTaskWrite() { // Destructor. Make sure to delete branch pointers for each output branch
   delete new_reco_evt_ptr_;
   delete new_particles_ptr_;
   delete new_tracks_ptr_;
-  delete new_fhcal_mods_ptr_;
 }
 
 bool UserTaskWrite::IsCharged(Int_t pdg) { // Additional function returning bool value wheather the particle is charged or not
@@ -217,29 +185,3 @@ float UserTaskWrite::GetBCent(Float_t bimp) { // Additional function returning c
   }
   return cent;
 }
-
-float UserTaskWrite::GetFHCalPhi(int iModule) { // Additional function returning azimuthal angle of the center of i-th FHCal module
-  const int Nmodules = 45;
-  int xAxisSwitch = (iModule < Nmodules) ? 1 : -1;
-  int module = (iModule < Nmodules) ? iModule : iModule - Nmodules;
-  float x, y, phi = -999.;
-  if (module >= 0 && module <= 4)
-  {
-    y = 45.;
-    x = (module - 2) * 15.;
-    phi = TMath::ATan2(y, x * xAxisSwitch);
-  }
-  else if ((module >= 5) && (module <= 39))
-  {
-    y = (3 - (module + 2) / 7) * 15.;
-    x = (3 - (module + 2) % 7) * 15.;
-    phi = TMath::ATan2(y, x * xAxisSwitch);
-  }
-  else if ((module >= 40) && (module <= 44))
-  {
-    y = -45.;
-    x = (module - 42) * 15.;
-    phi = TMath::ATan2(y, x * xAxisSwitch);
-  }
-  return phi;
-}

+ 0 - 4
preprocessing/UserTaskWrite.hpp

@@ -29,14 +29,11 @@ class UserTaskWrite : public AnalysisTree::Task {
   AnalysisTree::Branch new_particles_;
   AnalysisTree::Branch tracks_;
   AnalysisTree::Branch new_tracks_;
-  AnalysisTree::Branch fhcal_mods_;
-  AnalysisTree::Branch new_fhcal_mods_;
 
   // Branch pointers for output branches - make sure to delete them in the destructor
   AnalysisTree::EventHeader* new_reco_evt_ptr_{nullptr};
   AnalysisTree::Particles* new_particles_ptr_{nullptr};
   AnalysisTree::Track* new_tracks_ptr_{nullptr};
-  AnalysisTree::Track* new_fhcal_mods_ptr_{nullptr};
 
   AnalysisTree::Matching* match_{nullptr};
 
@@ -44,6 +41,5 @@ class UserTaskWrite : public AnalysisTree::Task {
   bool  IsCharged(Int_t pdg);
   float GetRapidityPDG(Float_t p, Float_t pz, Int_t pdg);
   float GetBCent(Float_t bimp);
-  float GetFHCalPhi(int iModule);
 };
 #endif//ANALYSISTREE_EXAMPLES_USERTASKWRITE_HPP_