Index: modules/CscClusterEfficiency.cc
===================================================================
--- modules/CscClusterEfficiency.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
+++ modules/CscClusterEfficiency.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -0,0 +1,115 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \class CscClusterEfficiency
+ *
+ *  Selects candidates from the InputArray according to the CscClusterEfficiency formula.
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "modules/CscClusterEfficiency.h"
+
+#include "classes/DelphesClasses.h"
+#include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
+
+#include "ExRootAnalysis/ExRootClassifier.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootResult.h"
+
+#include "TDatabasePDG.h"
+#include "TFormula.h"
+#include "TLorentzVector.h"
+#include "TMath.h"
+#include "TObjArray.h"
+#include "TRandom3.h"
+#include "TString.h"
+
+#include <algorithm>
+#include <iostream>
+#include <sstream>
+#include <stdexcept>
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+
+CscClusterEfficiency::CscClusterEfficiency() :
+  fFormula(0), fItInputArray(0)
+{
+  fFormula = new DelphesFormula;
+}
+
+//------------------------------------------------------------------------------
+
+CscClusterEfficiency::~CscClusterEfficiency()
+{
+  if(fFormula) delete fFormula;
+}
+
+//------------------------------------------------------------------------------
+
+void CscClusterEfficiency::Init()
+{
+  // read CscClusterEfficiency formula
+
+  fFormula->Compile(GetString("EfficiencyFormula", "1.0"));
+
+  // import input array
+
+  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
+  fItInputArray = fInputArray->MakeIterator();
+
+  // create output array
+
+  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
+}
+
+//------------------------------------------------------------------------------
+
+void CscClusterEfficiency::Finish()
+{
+  if(fItInputArray) delete fItInputArray;
+}
+
+//------------------------------------------------------------------------------
+
+void CscClusterEfficiency::Process()
+{
+  Candidate *candidate;
+  Double_t Ehad, Eem, decayR, decayZ;
+
+  fItInputArray->Reset();
+  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  {
+    const TLorentzVector &candidateDecayPosition = candidate->DecayPosition;
+    decayZ = abs(candidateDecayPosition.Z());
+    decayR = sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2));
+    Ehad = candidate->Ehad;
+    Eem = candidate->Eem;
+    // apply an efficency formula
+    //pt, eta, phi, energy
+    if(gRandom->Uniform() > fFormula->Eval(decayR, decayZ, Ehad, Eem)) continue;
+
+    fOutputArray->Add(candidate);
+  }
+}
+
+//------------------------------------------------------------------------------
Index: modules/CscClusterEfficiency.h
===================================================================
--- modules/CscClusterEfficiency.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
+++ modules/CscClusterEfficiency.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -0,0 +1,58 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CscClusterEfficiency_h
+#define CscClusterEfficiency_h
+
+/** \class CscClusterEfficiency
+ *
+ *  Selects candidates from the InputArray according to the CscClusterEfficiency formula.
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "classes/DelphesModule.h"
+
+class TIterator;
+class TObjArray;
+class DelphesFormula;
+
+class CscClusterEfficiency: public DelphesModule
+{
+public:
+  CscClusterEfficiency();
+  ~CscClusterEfficiency();
+
+  void Init();
+  void Process();
+  void Finish();
+
+private:
+  DelphesFormula *fFormula; //!
+
+  TIterator *fItInputArray; //!
+
+  const TObjArray *fInputArray; //!
+
+  TObjArray *fOutputArray; //!
+
+  ClassDef(CscClusterEfficiency, 1)
+};
+
+#endif
Index: modules/CscClusterId.cc
===================================================================
--- modules/CscClusterId.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
+++ modules/CscClusterId.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -0,0 +1,135 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \claCscClusterIdncy
+ *
+ *  Selects candidates from the InputArray according to the efficiency formula.
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "modules/CscClusterId.h"
+
+#include "classes/DelphesClasses.h"
+#include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
+
+#include "ExRootAnalysis/ExRootClassifier.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootResult.h"
+
+#include "TDatabasePDG.h"
+#include "TFormula.h"
+#include "TLorentzVector.h"
+#include "TMath.h"
+#include "TObjArray.h"
+#include "TRandom3.h"
+#include "TString.h"
+
+#include <algorithm>
+#include <iostream>
+#include <sstream>
+#include <stdexcept>
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+
+CscClusterId::CscClusterId() :
+  fFormula(0), fItInputArray(0)
+{
+  fFormula = new DelphesFormula;
+}
+
+//------------------------------------------------------------------------------
+
+CscClusterId::~CscClusterId()
+{
+  if(fFormula) delete fFormula;
+}
+
+//------------------------------------------------------------------------------
+
+void CscClusterId::Init()
+{
+  // read efficiency formula
+
+  fFormula->Compile(GetString("EfficiencyFormula", "1.0"));
+
+  // import input array
+
+  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
+  fItInputArray = fInputArray->MakeIterator();
+
+  // create output array
+
+  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
+}
+
+//------------------------------------------------------------------------------
+
+void CscClusterId::Finish()
+{
+  if(fItInputArray) delete fItInputArray;
+}
+
+//------------------------------------------------------------------------------
+
+void CscClusterId::Process()
+{
+  Candidate *candidate;
+  Double_t Ehad, Eem, decayR, decayZ, NStationEff, eta, eta_cut;
+  Int_t avgStation;
+  Double_t signPz, cosTheta;
+
+  fItInputArray->Reset();
+  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
+    const TLorentzVector &candidateDecayPosition = candidate->DecayPosition;
+    decayZ = abs(candidateDecayPosition.Z());
+    decayR = sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2));
+    Ehad = candidate->Ehad;
+    Eem = candidate->Eem;
+
+    cosTheta = TMath::Abs(momentum.CosTheta());
+    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
+    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
+
+    NStationEff = fFormula->Eval(decayR, decayZ, Ehad); //pt is used as argument in DelphesFormula
+
+    // assign average station for the cluster
+    if (decayZ < 6320) avgStation = 1;
+    else if (decayZ < 7240 && decayR > 2750)avgStation = 1;
+    else if (decayZ < 8500) avgStation = 2;
+    else if (decayZ < 9700) avgStation = 3;
+    else avgStation = 4;
+
+    // if NStation == 1, different eta cut is applied
+    if (avgStation == 1) eta_cut = 1.8;
+    else if (avgStation == 2) eta_cut = 1.6;
+    else if (avgStation == 3) eta_cut = 1.6;
+    else if (avgStation == 4) eta_cut = 1.8;
+    if(gRandom->Uniform() > NStationEff*(abs(eta)<1.9)+(1.0-NStationEff)*(abs(eta)<eta_cut)) continue;
+
+    fOutputArray->Add(candidate);
+  }
+}
+
+//------------------------------------------------------------------------------
Index: modules/CscClusterId.h
===================================================================
--- modules/CscClusterId.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
+++ modules/CscClusterId.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -0,0 +1,58 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CscClusterId_h
+#define CscClusterId_h
+
+/** \class CscClusterId
+ *
+ *  Selects candidates from the InputArray according to the CscClusterId formula.
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "classes/DelphesModule.h"
+
+class TIterator;
+class TObjArray;
+class DelphesFormula;
+
+class CscClusterId: public DelphesModule
+{
+public:
+  CscClusterId();
+  ~CscClusterId();
+
+  void Init();
+  void Process();
+  void Finish();
+
+private:
+  DelphesFormula *fFormula; //!
+
+  TIterator *fItInputArray; //!
+
+  const TObjArray *fInputArray; //!
+
+  TObjArray *fOutputArray; //!
+
+  ClassDef(CscClusterId, 1)
+};
+
+#endif
Index: modules/LLPFilter.cc
===================================================================
--- modules/LLPFilter.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
+++ modules/LLPFilter.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -0,0 +1,227 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \class LLPFilter
+ *
+ *  Removes particles with specific PDG codes
+ *
+ *  \author M. Selvaggi
+ *
+ */
+
+#include "modules/LLPFilter.h"
+
+#include "classes/DelphesClasses.h"
+#include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
+
+#include "ExRootAnalysis/ExRootClassifier.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootResult.h"
+
+#include "TDatabasePDG.h"
+#include "TFormula.h"
+#include "TLorentzVector.h"
+#include "TMath.h"
+#include "TObjArray.h"
+#include "TRandom3.h"
+#include "TString.h"
+
+#include <algorithm>
+#include <iostream>
+#include <sstream>
+#include <stdexcept>
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+
+LLPFilter::LLPFilter() :
+  fItInputArray(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+LLPFilter::~LLPFilter()
+{
+}
+
+//------------------------------------------------------------------------------
+
+void LLPFilter::Init()
+{
+
+  ExRootConfParam param;
+  Size_t i, size;
+
+  // PT threshold
+  fPTMin = GetDouble("PTMin", 0.0);
+
+  fInvert = GetBool("Invert", false);
+  fDecayRegion = GetInt("DecayRegion", 0);
+  fDaughterNumber = GetInt("DaughterNumber", 0);
+
+
+
+  // no pileup
+  fRequireNotPileup = GetBool("RequireNotPileup", false);
+
+  fRequireStatus = GetBool("RequireStatus", false);
+  fStatus = GetInt("Status", 1);
+
+  fRequireCharge = GetBool("RequireCharge", false);
+  fCharge = GetInt("Charge", 1);
+
+  // import input array
+  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
+  fItInputArray = fInputArray->MakeIterator();
+
+  fParticleInputArray =  ImportArray(GetString("InputArray", "Delphes/allParticles"));
+  fItParticleInputArray = fParticleInputArray->MakeIterator();
+
+
+  param = GetParam("PdgCode");
+  size = param.GetSize();
+
+  // read PdgCodes to be filtered out from the data card
+
+  fPdgCodes.clear();
+  for(i = 0; i < size; ++i)
+  {
+    fPdgCodes.push_back(param[i].GetInt());
+  }
+
+  // create output array
+  fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles"));
+}
+
+//------------------------------------------------------------------------------
+
+void LLPFilter::Finish()
+{
+  if(fItInputArray) delete fItInputArray;
+}
+
+//------------------------------------------------------------------------------
+
+void LLPFilter::Process()
+{
+
+  Candidate *candidate;
+  Int_t pdgCode;
+  Bool_t pass;
+  Double_t pt, eta;
+  Candidate *tempCandidate;
+
+  Candidate *daughter;
+  Int_t daughterPdg;
+
+
+  // loop over particles to find LLP
+  fItInputArray->Reset();
+  int index = -1;
+  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  {
+    index++;
+
+    //all distance units are in mm
+    pdgCode = candidate->PID;
+    const TLorentzVector &candidateMomentum = candidate->Momentum;
+    const TLorentzVector &candidateProdPosition = candidate->Position;
+    const TLorentzVector &candidateDecayPosition = candidate->DecayPosition;
+    pt = candidateMomentum.Pt();
+    eta = candidateMomentum.Eta();
+    if(pt < fPTMin) continue;
+    if (fDaughterNumber > 0)
+    {
+      if (candidate->D2-candidate->D1 != fDaughterNumber) continue;//require 3 daughters
+
+    }
+    if(find(fPdgCodes.begin(), fPdgCodes.end(), pdgCode) == fPdgCodes.end()) continue; //require pdgID is one of the LLP id
+    if(fRequireStatus && (candidate->Status != fStatus)) continue;
+
+    // loop over particles to find LLP daughters and assign EM and hadronic energy
+    candidate->Eem = 0.0;
+    candidate->Ehad = 0.0;
+
+    fItParticleInputArray->Reset();
+
+    while((daughter = static_cast<Candidate *>(fItParticleInputArray->Next())))
+    {
+
+      // check mother is LLP
+      //check ID is 123456 or neutrinos or charged leptons
+      daughterPdg = daughter->PID;
+      if (daughter->Status != 1)continue;
+
+      if (daughter->IsPU)continue;
+
+      if (abs(daughterPdg)==12 || abs(daughterPdg)==14 || abs(daughterPdg)==16 || abs(daughterPdg)==13)continue; // ignore neutrinos and muons
+
+
+      if (abs(daughterPdg) > 1000000) continue;//ignore BSM particles
+      const TLorentzVector &daughterProdPosition = daughter->Position;
+      const TLorentzVector &daughterMomentum = daughter->Momentum;
+
+      const TLorentzVector distance = daughterProdPosition - candidateDecayPosition;
+
+      if (sqrt(pow(distance.X(), 2) + pow(distance.Y(), 2) + pow(distance.Z(), 2))>100) continue; //if vertices are close, then matched, this 1 m only works for those decay in muon system, would be too large for tracker related
+      tempCandidate = daughter;
+      while(tempCandidate->M1 != -1 && tempCandidate->M1 != index)
+      {
+        tempCandidate  = static_cast<Candidate *>(fParticleInputArray->At(tempCandidate->M1));
+        // if (tempCandidate->PID == pdgCode)break;
+
+      }
+      if (tempCandidate->M1 == -1) continue;
+
+      if (abs(daughterPdg)==11 || abs(daughterPdg)==22 || abs(daughterPdg)==111)candidate->Eem += daughterMomentum.E();
+      else candidate->Ehad += daughterMomentum.E();
+
+
+    }
+
+
+
+    // used detector geometry in Figure 4.1.1, page141 from CERN-LHCC-97-032: https://cds.cern.ch/record/343814?ln=en
+    // decayRegion = 0: no cuts on decay region
+    // decayRegion = 1: select LLP that decays in CSC volume
+    // decayRegion = 2: select LLP that decays outside of calorimeters
+    if (fDecayRegion == 1)
+    {
+      if (abs(eta) < 2
+         && abs(candidateDecayPosition.Z())<11000 && abs(candidateDecayPosition.Z())>4000
+         && sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2)) < 6955)
+      {
+        fOutputArray->Add(candidate);
+      }
+
+    }
+    else if(fDecayRegion == 2)
+    {
+      if (abs(candidateDecayPosition.Z()) > 5680 && sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2)) > 3000)
+      {
+        fOutputArray->Add(candidate);
+      }
+    }
+    else{
+      fOutputArray->Add(candidate);
+    }
+  }//end of while loop
+}
Index: modules/LLPFilter.h
===================================================================
--- modules/LLPFilter.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
+++ modules/LLPFilter.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -0,0 +1,73 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//------------------------------------------------------------------------------
+
+#ifndef LLPFilter_h
+#define LLPFilter_h
+
+/** \class LLPFilter
+ *
+ *  Removes particles with specific PDG codes
+ *
+ *  \author M. Selvaggi
+ *
+ */
+
+#include "classes/DelphesModule.h"
+#include <vector>
+
+class TIterator;
+class TObjArray;
+
+class LLPFilter: public DelphesModule
+{
+public:
+  LLPFilter();
+  ~LLPFilter();
+
+  void Init();
+  void Process();
+  void Finish();
+
+private:
+  Double_t fPTMin; //!
+  Int_t fDecayRegion;
+  Int_t fDaughterNumber;
+  Bool_t fInvert; //!
+  Bool_t fRequireStatus; //!
+  Int_t fStatus; //!
+  Bool_t fRequireCharge; //!
+  Int_t fCharge; //!
+  Bool_t fRequireNotPileup; //!
+
+  std::vector<Int_t> fPdgCodes;
+
+  TIterator *fItInputArray; //!
+
+  const TObjArray *fInputArray; //!
+
+  TIterator *fItParticleInputArray;
+  const TObjArray *fParticleInputArray;
+
+  TObjArray *fOutputArray; //!
+
+  ClassDef(LLPFilter, 1)
+};
+
+#endif
Index: modules/ModulesLinkDef.h
===================================================================
--- modules/ModulesLinkDef.h	(revision 0e7d64ae98dc8ff4ace426b891893da9227f56c8)
+++ modules/ModulesLinkDef.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -73,4 +73,7 @@
 #include "modules/VertexFinderDA4D.h"
 #include "modules/ExampleModule.h"
+#include "modules/LLPFilter.h"
+#include "modules/CscClusterEfficiency.h"
+#include "modules/CscClusterId.h"
 
 #ifdef __CINT__
@@ -127,4 +130,7 @@
 #pragma link C++ class VertexFinderDA4D+;
 #pragma link C++ class ExampleModule+;
+#pragma link C++ class LLPFilter+;
+#pragma link C++ class CscClusterEfficiency+;
+#pragma link C++ class CscClusterId+;
 
 #endif
Index: modules/TreeWriter.cc
===================================================================
--- modules/TreeWriter.cc	(revision 0e7d64ae98dc8ff4ace426b891893da9227f56c8)
+++ modules/TreeWriter.cc	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -75,4 +75,5 @@
   fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons;
   fClassMap[Muon::Class()] = &TreeWriter::ProcessMuons;
+  fClassMap[CscCluster::Class()] = &TreeWriter::ProcessCscCluster;
   fClassMap[Jet::Class()] = &TreeWriter::ProcessJets;
   fClassMap[MissingET::Class()] = &TreeWriter::ProcessMissingET;
@@ -182,4 +183,5 @@
     const TLorentzVector &momentum = candidate->Momentum;
     const TLorentzVector &position = candidate->Position;
+    const TLorentzVector &DecayPosition = candidate->DecayPosition;
 
     entry = static_cast<GenParticle *>(branch->NewEntry());
@@ -215,5 +217,5 @@
     entry->D0 = candidate->D0;
     entry->DZ = candidate->DZ;
-    entry->P = candidate->P;
+    entry->P = momentum.P();
     entry->PT = candidate->PT;
     entry->CtgTheta = candidate->CtgTheta;
@@ -230,4 +232,12 @@
     entry->Z = position.Z();
     entry->T = position.T() * 1.0E-3 / c_light;
+
+    entry->decayX = DecayPosition.X();
+    entry->decayY = DecayPosition.Y();
+    entry->decayZ = DecayPosition.Z();
+    entry->decayT = DecayPosition.T()* 1.0E-3 / c_light;
+    float beta = entry->P/momentum.E();
+    float gamma = 1./sqrt(1-beta*beta);
+    entry->ctau = sqrt(pow(entry->decayX-entry->X,2)+pow(entry->decayY-entry->Y,2)+pow(entry->decayZ-entry->Z,2))/(beta*gamma);// in millimeter
   }
 }
@@ -730,4 +740,65 @@
   }
 }
+//------------------------------------------------------------------------------
+
+void TreeWriter::ProcessCscCluster(ExRootTreeBranch *branch, TObjArray *array)
+{
+  TIter iterator(array);
+  Candidate *candidate = 0;
+  CscCluster *entry = 0;
+  Double_t pt, signPz, cosTheta, eta, rapidity;
+
+  const Double_t c_light = 2.99792458E8; // in unit of m/s
+
+  array->Sort();
+
+
+  // loop over all clusters
+  iterator.Reset();
+  while((candidate = static_cast<Candidate *>(iterator.Next())))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
+    const TLorentzVector &position = candidate->DecayPosition;
+
+    pt = momentum.Pt();
+    cosTheta = TMath::Abs(momentum.CosTheta());
+    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
+    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
+
+    entry = static_cast<CscCluster *>(branch->NewEntry());
+
+    entry->SetBit(kIsReferenced);
+    entry->SetUniqueID(candidate->GetUniqueID());
+
+    entry->Eta = eta;
+    entry->Phi = momentum.Phi();
+
+
+    // entry->Eta = position.Eta();
+    // entry->Phi = position.Phi();
+
+    entry->PT = momentum.Pt(); // pt of LLP
+    entry->Px = momentum.Px();// px of LLP
+    entry->Py = momentum.Py();// py of LLP
+    entry->Pz = momentum.Pz();// pz of LLP
+    entry->E = momentum.E(); // E of LLP
+    entry->pid = candidate->PID; // LLP pid
+    entry->Eem = candidate->Eem; // LLP pid
+    entry->Ehad = candidate->Ehad; // LLP pid
+    Double_t beta = momentum.P()/momentum.E();
+    Double_t gamma = 1.0/sqrt(1-beta*beta);
+    Double_t decayDistance = sqrt(pow(position.X(),2)+pow(position.Y(),2)+pow(position.Z(),2)); // mm
+    entry->beta = beta; // LLP pid
+    entry->ctau = decayDistance/(beta * gamma);; // LLP pid
+
+    // entry->T = (position.T()-sqrt(pow(position.X(),2)+pow(position.Y(),2)+pow(position.Z(),2)))* 1.0E-3 / c_light; // LLP decay time-photon travel time
+
+    entry->T = decayDistance*(1./beta-1)* 1.0E-3/c_light*1e9; // ns
+    entry->X = position.X(); // LLP decay x
+    entry->Y = position.Y(); //  LLP decay y
+    entry->Z = position.Z(); //  LLP decay z
+    // entry->Size = 100;
+  }
+}
 
 //------------------------------------------------------------------------------
Index: modules/TreeWriter.h
===================================================================
--- modules/TreeWriter.h	(revision 0e7d64ae98dc8ff4ace426b891893da9227f56c8)
+++ modules/TreeWriter.h	(revision a5af1df1cf2ca5a488fc610ab546c762b7cdb5f2)
@@ -59,4 +59,5 @@
   void ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessMuons(ExRootTreeBranch *branch, TObjArray *array);
+  void ProcessCscCluster(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessTauJets(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessJets(ExRootTreeBranch *branch, TObjArray *array);
@@ -66,4 +67,5 @@
   void ProcessWeight(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array);
+
 
 #if !defined(__CINT__) && !defined(__CLING__)
