00001 #ifndef writeESD_h 00002 #define writeESD_h 1 00003 00004 #include <XANADOO/XANAClusters/interface/XANACaloRecHit.h> 00005 00006 #include <CARF/G3Event/interface/G3EventProxy.h> 00007 #include <CARF/Reco/interface/RecCollection.h> 00008 00009 #include <TrackerReco/TkEvent/interface/TkEventPreselectorByTracks.h> 00010 #include <Calorimetry/CaloDetector/interface/CellID.h> 00011 00012 #include <Utilities/Notification/interface/Observer.h> 00013 #include <Utilities/UI/interface/SimpleConfigurable.h> 00014 00015 #include <XANADOO/XANATracks/interface/XANAGSUtil.h> 00016 00017 #include <string> 00018 #include <iostream> 00019 #include <iomanip> 00020 #include <map> 00021 00022 class TFile; 00023 class TTree; 00024 class TBranch; 00025 class TClonesArray; 00026 class XANAEsdEvent; 00027 class XANAGeantEvent; 00028 class XANAGeneratorEvent; 00029 class XANAMemLog; 00030 class XANAElectronTrack; 00031 class IsoCalculator; 00032 00033 class EgammaBasicCluster; 00034 class EgammaSuperCluster; 00035 class EgammaEndcapCluster; 00036 class EcalPlusHcalTower; 00037 class TTrack; 00038 class RecoVertex; 00039 class RecMuon; 00040 class ConcreteRecTrack; 00041 class ElectronCandidate; 00042 class HighLevelTriggerResult; 00043 class RecJet; 00044 class RecMET; 00045 00046 00047 class TrajectoryStateOnSurface; 00048 class TrajectoryMeasurement; 00049 00050 // for GSF tracks 00051 00052 class RegionalTrackFinder; 00053 00054 00055 class XANAEsdBuilder : public Observer<G3EventProxy *>, public Observer<G3SetUp *> 00056 { 00057 00058 public: 00059 00060 // configuration 00061 // general 00062 SimpleConfigurable<bool> writeTree_; 00063 SimpleConfigurable<bool> memlog_; 00064 SimpleConfigurable<std::string> fileName_; 00065 SimpleConfigurable<std::string> treeName_; 00066 SimpleConfigurable<int> autosave_; 00067 SimpleConfigurable<bool> writeCaloRecHits_; 00068 SimpleConfigurable<int> compressionLevel_; 00069 SimpleConfigurable<int> bufferSize_; 00070 SimpleConfigurable<int> splitMode_; 00071 SimpleConfigurable<bool> writeTrackHits_; 00072 SimpleConfigurable<bool> writeAllTrackHits_; 00073 SimpleConfigurable<bool> writeEleTrackHits_; 00074 00075 // cluster options 00076 SimpleConfigurable<std::string> clusterizerName_; 00077 SimpleConfigurable<std::string> superClusterizerName_; 00078 SimpleConfigurable<std::string> endcapSuperClusterizerName_; 00079 SimpleConfigurable<std::string> hcalClusterizerName_; 00080 SimpleConfigurable<std::string> trackReconstructorName_; 00081 SimpleConfigurable<std::string> vertexReconstructorName_; 00082 SimpleConfigurable<std::string> muonReconstructorName_; 00083 SimpleConfigurable<std::string> electronReconstructorName_; 00084 00085 // electron tracking 00086 SimpleConfigurable<std::string> gsfForwardFit_; 00087 00088 // jets +MET options 00089 SimpleConfigurable<bool> jetsFromTrueInformation_; 00090 SimpleConfigurable<bool> metsFromTrueInformation_; 00091 00092 // trigger 00093 SimpleConfigurable<std::string> l1Menu_; 00094 SimpleConfigurable<std::string> hltMenu_; 00095 00096 protected: 00097 00098 typedef RecCollection<TTrack> Collection; 00099 00100 Collection* theCollection; 00101 00102 RecCollection<EgammaBasicCluster>* clusters; 00103 RecCollection<EgammaSuperCluster>* superClusters; 00104 RecCollection<EgammaEndcapCluster>* endcapSuperClusters; 00105 RecCollection<EcalPlusHcalTower>* towers; 00106 RecCollection<TTrack>* tracks; 00107 RecCollection<RecoVertex>* vertices; 00108 RecCollection<RecMuon>* muons; 00109 RecCollection<ElectronCandidate>* electrons; 00110 // RecCollection<ConcreteRecTrack>* eltracks; 00111 RecCollection<TTrack>* eltracks; 00112 RecCollection<RecJet>* jets; 00113 RecCollection<RecMET>* mets; 00114 RecCollection<HighLevelTriggerResult>* hlt; 00115 00116 TTree *xanaEsdTree_; 00117 TBranch *xanaEsdEventBranch_; 00118 TFile *xanaEsdFile_; 00119 XANAEsdEvent *xanaEsdEvent_; 00120 00121 TBranch *xanaGenEventBranch_; 00122 XANAGeneratorEvent *xanaGenEvent_; 00123 TBranch *xanaGeantEventBranch_; 00124 XANAGeantEvent *xanaGeantEvent_; 00125 00126 IsoCalculator *ciso_; 00127 00128 XANAMemLog *xanamemlog_; 00129 00130 int nbClusters_, nbTracks_, nbElectrons_; 00131 00132 map<CellID, XANACaloRecHit, less<CellID> > allCaloRecHits_; 00133 map<CellID, XANACaloRecHit, less<CellID> > clusterizedCaloRecHits_; 00134 vector<CellID> allCells_; 00135 vector<CellID> clusterizedCells_; 00136 00137 // for GSF tracks 00138 RegionalTrackFinder* theRegionalTrackFinder; 00139 00140 public: 00141 00142 XANAEsdBuilder(); 00143 ~XANAEsdBuilder(); 00144 00145 protected: 00146 00147 virtual void upDate( G3EventProxy * ); 00148 void upDate( G3SetUp * ); 00149 00151 // virtual void initSetUp(); 00152 00153 void setHeader( G3EventProxy * ); 00154 void setCaloRecHits( G3EventProxy * ); 00155 void setEmClusters( G3EventProxy * ); 00156 void setSuperClusters( G3EventProxy * ); 00157 void setEndcapClusters( G3EventProxy * ); 00158 void setHadClusters( G3EventProxy * ); 00159 void setTracks( G3EventProxy * ); 00160 void setVertices( G3EventProxy * ); 00161 void setJets( G3EventProxy * ); 00162 void setMet( G3EventProxy * ); 00163 void setMuons( G3EventProxy * ); 00164 void setElectrons( G3EventProxy * ); 00165 void setElectronsGSF( G3EventProxy * ); 00166 virtual void setMcTruth( G3EventProxy * ); 00167 void setTriggerInfo( G3EventProxy * ); 00168 void setAllTrackHits( G3EventProxy * ); 00169 void setElectronTracks(G3EventProxy * ); 00170 00171 // secondary methods (called from the others) 00172 void setEleTrackHits(std::vector<TrajectoryMeasurement>, XANAElectronTrack *); 00173 00174 void writeTree(); 00175 00176 std::string getAlgoName(int); 00177 00178 } ; 00179 00180 #endif