├── README.md ├── simplecpp.cpp ├── Hists.cpp ├── prelim_functions.cpp ├── doc1.cpp ├── ZeetimeAnalysis.cpp └── ZeetimeAnalysis_Asad.cpp /README.md: -------------------------------------------------------------------------------- 1 | # ZeeTimingWithAsad 2 | -------------------------------------------------------------------------------- /simplecpp.cpp: -------------------------------------------------------------------------------- 1 | /*Simple C++ program for learning stuff*/ 2 | 3 | //#include 4 | #include 5 | //#include 6 | //#include "stdlib.h" 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | 12 | void myfuncPrint(int num1, int num2); 13 | void thisf(); 14 | 15 | /* This is where program runs */ 16 | int main( int argc, char** argv ) 17 | { 18 | 19 | int number1 = atoi(argv[1]); 20 | int number2 = atoi(argv[2]); 21 | 22 | int numb1 = 0; 23 | int numb2 = 0; 24 | 25 | /* 26 | for(int i=0; i < argc; i++) 27 | { number1 = argv[i]; 28 | number2 = argv[i+1]; 29 | 30 | // } 31 | */ 32 | 33 | myfuncPrint(number1, number2); 34 | thisf(); 35 | 36 | return 0; 37 | } 38 | 39 | 40 | 41 | void myfuncPrint(int n1, int n2) 42 | { 43 | std::cout <<"This is C++ " << std::endl; 44 | std::cout <<" I really Love it\n" << std::endl; 45 | 46 | std::cout <<" The Sum of Numbers \t" << n1 << " and\t" << n2 << " is \n" << std::endl; 47 | 48 | std::cout <<"Sum = " << n1 + n2 << std::endl; 49 | } 50 | 51 | void thisf() 52 | { 53 | 54 | std::cout <<" This funxtion is really nice can I change it!! " << std::endl; 55 | } 56 | -------------------------------------------------------------------------------- /Hists.cpp: -------------------------------------------------------------------------------- 1 | struct HistSet{ 2 | //book histogram set w/ common suffix inside the provided TFileDirectory 3 | //void book(edm::Service& td,const std::string&); 4 | void book(TFileDirectory subDir,const std::string&); 5 | // fill all histos of the set with the two electron candidates 6 | void fill(int sc1, int sc2, int cl1, int cl2); 7 | 8 | 9 | TH1F* eta1_; 10 | TH1F* phi1_; 11 | TH1F* eta2_; 12 | TH1F* phi2_; 13 | TH1F* e1pt_; 14 | TH1F* e2pt_; 15 | TH1F* e1eta_; 16 | TH1F* e2eta_; 17 | TH1F* e1phi_; 18 | TH1F* e2phi_; 19 | TH1F* e1E_; 20 | TH1F* e2E_; 21 | 22 | } theHists; 23 | 24 | 25 | 26 | 27 | void HistSet::book(TFileDirectory subDir, const std::string& post) { 28 | 29 | eta1_ =(TH1F*) subDir.make("eta","eta",100,eta_max,eta_min); 30 | phi1_ =(TH1F*) subDir.make("phi","phi",100,phi_max,phi_min); 31 | . 32 | . 33 | . 34 | } 35 | 36 | 37 | void HistSet::fill(int sc1, int sc2, int bc1, int bc2 ){ 38 | 39 | float et1 = treeVars_.superClusterRawEnergy[sc1]/cosh( treeVars_.superClusterEta[sc1] ); 40 | float phi1 = treeVars_.superClusterPhi[sc1]; 41 | 42 | math::PtEtaPhiELorentzVectorD el1(et1 , 43 | treeVars_.superClusterEta[sc1], 44 | treeVars_.superClusterPhi[sc1], 45 | treeVars_.superClusterRawEnergy[sc1] ); 46 | 47 | 48 | float et2 = treeVars_.superClusterRawEnergy[sc2]/cosh( treeVars_.superClusterEta[sc2] ); 49 | float phi2 = treeVars_.superClusterPhi[sc1]; 50 | 51 | math::PtEtaPhiELorentzVectorD el2(et2 , 52 | treeVars_.superClusterEta[sc2], 53 | treeVars_.superClusterPhi[sc2], 54 | treeVars_.superClusterRawEnergy[sc2] ); 55 | 56 | 57 | math::PtEtaPhiELorentzVectorD diEle = el1; 58 | diEle += el2; 59 | 60 | 61 | 62 | eta1_ ->Fill(et1); 63 | phi1_ ->Fill(phi1); 64 | 65 | e1E_ ->Fill(treeVars_.superClusterRawEnergy[sc1]) 66 | . 67 | . 68 | . 69 | 70 | }s 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /prelim_functions.cpp: -------------------------------------------------------------------------------- 1 | void func1( int sc1, int sc2, int eta1_min, int phi1_min, int eta1_max, int phi1_max, int eta2_min, int phi2_min, int eta2_max, int phi2_max ) 2 | { 3 | int eventCounter = 0; 4 | for (int entry = 0 ; (entry < nEntries && eventCounter < numEvents_); ++entry) 5 | { 6 | chain->GetEntry (entry) ; 7 | // Keep the event? 8 | bool keepEvent = includeEvent(treeVars_.l1ActiveTriggers, 9 | treeVars_.l1NActiveTriggers,trigIncludeVector,trigExcludeVector) 10 | && includeEvent(treeVars_.l1ActiveTechTriggers, 11 | treeVars_.l1NActiveTechTriggers,ttrigIncludeVector,ttrigExcludeVector); 12 | if(!keepEvent) 13 | continue; 14 | // do analysis if the run is in the desired range 15 | if( treeVars_.runId0 && count==treeVars_.nVertices ) verticesAreOnlyNextToNominalIP = true; 23 | else verticesAreOnlyNextToNominalIP = false; 24 | // --vertex: require vertex@IP (1), veto it (2) or either (0, or unset) 25 | if (flagOneVertex_ ==1 && (!verticesAreOnlyNextToNominalIP) ) continue; 26 | if (flagOneVertex_ ==2 && (verticesAreOnlyNextToNominalIP) ) continue; 27 | 28 | // if evet being actually processed, increment counter of analyzed events 29 | eventCounter++; 30 | speak_=false; 31 | if (entry<10 || entry%10000==0) speak_=true; 32 | if (speak_) std::cout << "\n\n------> reading entry " << entry << "\tLS: " << treeVars_.lumiSection << " <------\n" ; 33 | if (speak_) std::cout << " found " << treeVars_.nSuperClusters << " superclusters" << std::endl ; 34 | if (speak_) std::cout << " found " << treeVars_.nClusters << " basic clusters" << std::endl ; 35 | 36 | 37 | //New Code 38 | 39 | float et1 = treeVars_.superClusterRawEnergy[sc1]/cosh( treeVars_.superClusterEta[sc1] ); 40 | if (et1 < eta1_min || eta1 > eta1_max) continue; //.................... CHECK IF ETA1 IS WITHIN THE SPECIFIED RANGE ...........................\\ 41 | 42 | float phi1 = treeVars_.superClusterPhi[sc1]; 43 | if (phi1 < phi1_min || phi1 > phi1_max) continue //.................... CHECK IF PHI1 IS WITHIN THE SPECIFIED RANGE ...........................\\ 44 | 45 | math::PtEtaPhiELorentzVectorD el1(et1 , 46 | treeVars_.superClusterEta[sc1], 47 | treeVars_.superClusterPhi[sc1], 48 | treeVars_.superClusterRawEnergy[sc1] ); 49 | 50 | 51 | float et2 = treeVars_.superClusterRawEnergy[sc2]/cosh( treeVars_.superClusterEta[sc2] ); 52 | if (et2 < eta2_min || eta2 > eta2_max) continue; //.................... CHECK IF ETA2 IS WITHIN THE SPECIFIED RANGE ...........................\\ 53 | 54 | float phi2 = treeVars_.superClusterPhi[sc1]; 55 | if (phi2 < phi2_min || phi2 > phi2_max) continue //.................... CHECK IF PHI2 IS WITHIN THE SPECIFIED RANGE ...........................\\ 56 | 57 | math::PtEtaPhiELorentzVectorD el2(et2 , 58 | treeVars_.superClusterEta[sc2], 59 | treeVars_.superClusterPhi[sc2], 60 | treeVars_.superClusterRawEnergy[sc2] ); 61 | 62 | 63 | float dvertex = pow(treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2],2); 64 | dvertex = sqrt(dvertex); 65 | 66 | math::PtEtaPhiELorentzVectorD diEle = el1; 67 | diEle += el2; 68 | 69 | // //////////////////////// 70 | mass_ ->Fill(diEle.M()); 71 | dZvertices_->Fill(dvertex); 72 | Zvertices_->Fill( (treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2])/2 ); 73 | nVertices_->Fill(treeVars_.nVertices); 74 | 75 | // require invariant mass 76 | if( fabs( diEle.M() - 91 ) > 40 ) continue; 77 | // require two electrons from the same vertex 78 | if ( dvertex > 0.1 ) continue; 79 | 80 | 81 | 82 | 83 | 84 | // at this stage I have a suitable di-electron system for time studies 85 | float tmpEne=-9999; 86 | // loop on BC and match to sc1 =============== 87 | int bc1=-1; 88 | for (int bc=0; bctmpEne) { 91 | tmpEne=treeVars_.clusterEnergy[bc]; 92 | bc1=bc; 93 | }// end - if good bc candidate 94 | }// end - loop over BC 95 | tmpEne=-9999; 96 | // loop on BC and match to sc2 ============== 97 | int bc2=-1; 98 | for (int bc=0; bctmpEne) { 101 | tmpEne=treeVars_.clusterEnergy[bc]; 102 | bc2=bc; 103 | }// end - if good bc candidate 104 | }// end - loop over BC 105 | // protect in case of no matching 106 | if(bc1==-1 || bc2==-1) continue; 107 | if(0) { 108 | std::cout << "\n\nsc1 : " << treeVars_.superClusterEta[sc1] << " " << treeVars_.superClusterPhi[sc1] << " " << treeVars_.superClusterRawEnergy[sc1] << std::endl; 109 | std::cout << "bc1 : " << treeVars_.clusterEta[bc1] << " " << treeVars_.clusterPhi[bc1] << " " << treeVars_.clusterEnergy[bc1] << "\n"<< std::endl; 110 | std::cout << "sc2 : " << treeVars_.superClusterEta[sc2] << " " << treeVars_.superClusterPhi[sc2] << " " << treeVars_.superClusterRawEnergy[sc2] << std::endl; 111 | std::cout << "bc2 : " << treeVars_.clusterEta[bc2] << " " << treeVars_.clusterPhi[bc2] << " " << treeVars_.clusterEnergy[bc2] << std::endl; 112 | } 113 | ClusterTime bcTime1 = timeAndUncertSingleCluster(bc1,treeVars_); 114 | ClusterTime bcTime2 = timeAndUncertSingleCluster(bc2,treeVars_); 115 | if(! (bcTime1.isvalid && bcTime2.isvalid) ) continue; 116 | // fill the structures which hold all the plots 117 | plotsECALECAL.fill(sc1,sc2, bc1,bc2); 118 | if ( fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])<1.4 ){ 119 | plotsEBEB.fill(sc1,sc2, bc1,bc2); 120 | float energyRatio1 = treeVars_.xtalInBCEnergy[bc1][bcTime1.seed]; 121 | if(bcTime1.second>-1) {energyRatio1 /= treeVars_.xtalInBCEnergy[bc1][bcTime1.second]; } 122 | else { energyRatio1 /= 99999; } 123 | float energyRatio2 = treeVars_.xtalInBCEnergy[bc2][bcTime2.seed]; 124 | if(bcTime2.second>-1) {energyRatio2 /= treeVars_.xtalInBCEnergy[bc2][bcTime2.second]; } 125 | else { energyRatio2 /= 99999; } 126 | float minRatio = 0.7; float maxRatio = 1.3; 127 | if(minRatio1.5 && fabs(treeVars_.clusterEta[bc2])>1.5 ) plotsEEEE.fill(sc1,sc2, bc1,bc2); 132 | else if ( (fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])>1.5) || 133 | (fabs(treeVars_.clusterEta[bc1])>1.5 && fabs(treeVars_.clusterEta[bc2])<1.4) ) plotsEBEE.fill(sc1,sc2, bc1,bc2); 134 | // if I've found a pair of supercluster, bail out of loop to repeat using twice the same supercluster 135 | break; 136 | 137 | 138 | 139 | 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /doc1.cpp: -------------------------------------------------------------------------------- 1 | //! main program 2 | int main (int argc, char** argv) 3 | { 4 | // First parse arguments 5 | parseArguments(argc, argv); 6 | if (listOfFiles_.size()==0){ 7 | std::cout << "\tno input file found" << std::endl; 8 | return(1); 9 | } 10 | else{ 11 | std::cout << "\tfound " << listOfFiles_.size() << " input files: " << std::endl; 12 | for(std::vector::const_iterator file_itr=listOfFiles_.begin(); file_itr!=listOfFiles_.end(); file_itr++){ 13 | std::cout << "\t" << (*file_itr) << std::endl; 14 | } 15 | } 16 | 17 | 18 | 19 | // Tree construction 20 | // FIX should turn this string into a configurable 21 | TChain * chain = new TChain ("EcalTimeAnalysis") ; // ntuple producer in CMSSW CVS 22 | //TChain * chain = new TChain ("EcalTimePi0Analysis") ; // ntuple producer in UserCode/UMN space 23 | std::vector::const_iterator file_itr; 24 | for(file_itr=listOfFiles_.begin(); file_itr!=listOfFiles_.end(); file_itr++){ 25 | chain->Add( (*file_itr).c_str() ); 26 | } 27 | int nEntries = chain->GetEntries () ; 28 | if (numEvents_==-1) numEvents_ = nEntries; 29 | std::cout << "\n\tFOUND " << listOfFiles_.size() << " input files" << std::endl ; 30 | std::cout << "\n\tFOUND " << nEntries << " events" << std::endl ; 31 | std::cout << "\tWILL run on: " << numEvents_ << " events" << std::endl; 32 | std::cout << "\tOutput file: " << outputRootName_ << std::endl; 33 | std::cout << "\tminAOverSigma: " << minAmpliOverSigma_ << std::endl; 34 | std::cout << "\teTGammaMinEB: " << eTGammaMinEB_ << std::endl; 35 | std::cout << "\ts4s9GammaMinEB: " << s4s9GammaMinEB_ << std::endl; 36 | std::cout << "\teTPi0MinEB: " << eTPi0MinEB_ << std::endl; 37 | std::cout << "\teTGammaMinEE: " << eTGammaMinEE_ << std::endl; 38 | std::cout << "\ts4s9GammaMinEE: " << s4s9GammaMinEE_ << std::endl; 39 | std::cout << "\teTPi0MinEE: " << eTPi0MinEE_ << std::endl; 40 | std::cout << "\tminRun: " << minRun_ << std::endl; 41 | std::cout << "\tmaxRun: " << maxRun_ << std::endl; 42 | std::cout << "\tminLS: " << minLS_ << std::endl; 43 | std::cout << "\tmaxLS: " << maxLS_ << std::endl; 44 | setBranchAddresses (chain, treeVars_); 45 | // setting up the TFileService in the ServiceRegistry; 46 | edmplugin::PluginManager::Config config; 47 | edmplugin::PluginManager::configure(edmplugin::standard::config()); 48 | std::vector psets; 49 | edm::ParameterSet pSet; 50 | pSet.addParameter("@service_type",std::string("TFileService")); 51 | pSet.addParameter("fileName",std::string("TimePerf-plots.root")); // this is the file TFileService will write into 52 | psets.push_back(pSet); 53 | static edm::ServiceToken services(edm::ServiceRegistry::createSet(psets)); 54 | static edm::ServiceRegistry::Operate operate(services); 55 | edm::Service fs; 56 | TFileDirectory subDirECALECAL=fs->mkdir("ECALECAL"); 57 | HistSet plotsECALECAL; 58 | plotsECALECAL.book(subDirECALECAL,std::string("ECALECAL")); 59 | TFileDirectory subDirEBEB=fs->mkdir("EBEB"); 60 | HistSet plotsEBEB; 61 | plotsEBEB.book(subDirEBEB,std::string("EBEB")); 62 | TFileDirectory subDirEEEE=fs->mkdir("EEEE"); 63 | HistSet plotsEEEE; 64 | plotsEEEE.book(subDirEEEE,std::string("EEEE")); 65 | TFileDirectory subDirEBEE=fs->mkdir("EBEE"); 66 | HistSet plotsEBEE; 67 | plotsEBEE.book(subDirEBEE,std::string("EBEE")); 68 | TFileDirectory subDirEBEBequalShare=fs->mkdir("EBEBequalShare"); 69 | HistSet plotsEBEBequalShare; 70 | plotsEBEBequalShare.book(subDirEBEBequalShare,std::string("EBEBequalShare")); 71 | TFileDirectory subDirEBEBunevenShare=fs->mkdir("EBEBunevenShare"); 72 | HistSet plotsEBEBunevenShare; 73 | plotsEBEBunevenShare.book(subDirEBEBunevenShare,std::string("EBEBunevenShare")); 74 | timeCorrector theCorr; 75 | std::cout << "\ncreated object theCorr to be used for timeVsAmpliCorrections" << std::endl; 76 | std::cout << "\ninitializing theCorr" << std::endl; 77 | //theCorr.initEB( std::string("EBmod4") ); 78 | //theCorr.initEE( std::string("EElow") ); 79 | theCorr.initEB( "EB" ); 80 | theCorr.initEE( "EE" ); 81 | //Initialize output root file 82 | //saving_ = new TFile(outputRootName_.c_str (),"recreate"); 83 | // Initialize the histograms 84 | TFileDirectory subDirGeneral=fs->mkdir("General"); 85 | initializeHists(subDirGeneral); 86 | int eventCounter = 0; 87 | 88 | 89 | 90 | 91 | ///////////////////////////////////////////////////// 92 | // Main loop over entries 93 | for (int entry = 0 ; (entry < nEntries && eventCounter < numEvents_); ++entry) 94 | { 95 | chain->GetEntry (entry) ; 96 | // Keep the event? 97 | bool keepEvent = includeEvent(treeVars_.l1ActiveTriggers, 98 | treeVars_.l1NActiveTriggers,trigIncludeVector,trigExcludeVector) 99 | && includeEvent(treeVars_.l1ActiveTechTriggers, 100 | treeVars_.l1NActiveTechTriggers,ttrigIncludeVector,ttrigExcludeVector); 101 | if(!keepEvent) 102 | continue; 103 | // do analysis if the run is in the desired range 104 | if( treeVars_.runId0 && count==treeVars_.nVertices ) verticesAreOnlyNextToNominalIP = true; 112 | else verticesAreOnlyNextToNominalIP = false; 113 | // --vertex: require vertex@IP (1), veto it (2) or either (0, or unset) 114 | if (flagOneVertex_ ==1 && (!verticesAreOnlyNextToNominalIP) ) continue; 115 | if (flagOneVertex_ ==2 && (verticesAreOnlyNextToNominalIP) ) continue; 116 | // if evet being actually processed, increment counter of analyzed events 117 | eventCounter++; 118 | speak_=false; 119 | if (entry<10 || entry%10000==0) speak_=true; 120 | if (speak_) std::cout << "\n\n------> reading entry " << entry << "\tLS: " << treeVars_.lumiSection << " <------\n" ; 121 | if (speak_) std::cout << " found " << treeVars_.nSuperClusters << " superclusters" << std::endl ; 122 | if (speak_) std::cout << " found " << treeVars_.nClusters << " basic clusters" << std::endl ; 123 | /////////////////////////////////////////////////////////////////////// 124 | // outer loop on supercluster 125 | for (int sc1=0; sc1Fill(diEle.M()); 150 | dZvertices_->Fill(dvertex); 151 | Zvertices_->Fill( (treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2])/2 ); 152 | nVertices_->Fill(treeVars_.nVertices); 153 | // require invariant mass 154 | //if( fabs( diEle.M() - 91 ) > 20 ) continue; 155 | if( fabs( diEle.M() - 91 ) > 40 ) continue; 156 | // require two electrons from the same vertex 157 | //if ( dvertex > 0.01 ) continue; 158 | if ( dvertex > 0.1 ) continue; 159 | if(0) std::cout << "di-electron system mass: " << diEle.M() << " vertex distance: " << dvertex << std::endl; 160 | // at this stage I have a suitable di-electron system for time studies 161 | float tmpEne=-9999; 162 | // loop on BC and match to sc1 =============== 163 | int bc1=-1; 164 | for (int bc=0; bctmpEne) { 167 | tmpEne=treeVars_.clusterEnergy[bc]; 168 | bc1=bc; 169 | }// end - if good bc candidate 170 | }// end - loop over BC 171 | tmpEne=-9999; 172 | // loop on BC and match to sc2 ============== 173 | int bc2=-1; 174 | for (int bc=0; bctmpEne) { 177 | tmpEne=treeVars_.clusterEnergy[bc]; 178 | bc2=bc; 179 | }// end - if good bc candidate 180 | }// end - loop over BC 181 | // protect in case of no matching 182 | if(bc1==-1 || bc2==-1) continue; 183 | if(0) { 184 | std::cout << "\n\nsc1 : " << treeVars_.superClusterEta[sc1] << " " << treeVars_.superClusterPhi[sc1] << " " << treeVars_.superClusterRawEnergy[sc1] << std::endl; 185 | std::cout << "bc1 : " << treeVars_.clusterEta[bc1] << " " << treeVars_.clusterPhi[bc1] << " " << treeVars_.clusterEnergy[bc1] << "\n"<< std::endl; 186 | std::cout << "sc2 : " << treeVars_.superClusterEta[sc2] << " " << treeVars_.superClusterPhi[sc2] << " " << treeVars_.superClusterRawEnergy[sc2] << std::endl; 187 | std::cout << "bc2 : " << treeVars_.clusterEta[bc2] << " " << treeVars_.clusterPhi[bc2] << " " << treeVars_.clusterEnergy[bc2] << std::endl; 188 | } 189 | ClusterTime bcTime1 = timeAndUncertSingleCluster(bc1,treeVars_); 190 | ClusterTime bcTime2 = timeAndUncertSingleCluster(bc2,treeVars_); 191 | if(! (bcTime1.isvalid && bcTime2.isvalid) ) continue; 192 | // fill the structures which hold all the plots 193 | plotsECALECAL.fill(sc1,sc2, bc1,bc2); 194 | if ( fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])<1.4 ){ 195 | plotsEBEB.fill(sc1,sc2, bc1,bc2); 196 | float energyRatio1 = treeVars_.xtalInBCEnergy[bc1][bcTime1.seed]; 197 | if(bcTime1.second>-1) {energyRatio1 /= treeVars_.xtalInBCEnergy[bc1][bcTime1.second]; } 198 | else { energyRatio1 /= 99999; } 199 | float energyRatio2 = treeVars_.xtalInBCEnergy[bc2][bcTime2.seed]; 200 | if(bcTime2.second>-1) {energyRatio2 /= treeVars_.xtalInBCEnergy[bc2][bcTime2.second]; } 201 | else { energyRatio2 /= 99999; } 202 | float minRatio = 0.7; float maxRatio = 1.3; 203 | if(minRatio1.5 && fabs(treeVars_.clusterEta[bc2])>1.5 ) plotsEEEE.fill(sc1,sc2, bc1,bc2); 208 | else if ( (fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])>1.5) || 209 | (fabs(treeVars_.clusterEta[bc1])>1.5 && fabs(treeVars_.clusterEta[bc2])<1.4) ) plotsEBEE.fill(sc1,sc2, bc1,bc2); 210 | // if I've found a pair of supercluster, bail out of loop to repeat using twice the same supercluster 211 | break; 212 | }// end loop sc2 213 | }// end loop sc1 214 | } // end of loop over entries 215 | delete chain ; 216 | return 0 ; 217 | } 218 | -------------------------------------------------------------------------------- /ZeetimeAnalysis.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "FWCore/PluginManager/interface/PluginManager.h" 16 | #include "FWCore/PluginManager/interface/standard.h" 17 | 18 | #include "FWCore/ServiceRegistry/interface/Service.h" 19 | #include "CommonTools/UtilAlgos/interface/TFileService.h" 20 | 21 | #include "DataFormats/Math/interface/LorentzVector.h" 22 | 23 | #include "CalibCalorimetry/EcalTiming/interface/EcalTimeTreeContent.h" 24 | #include "ECALTime/EcalTimePi0/interface/timeVsAmpliCorrector.h" 25 | #include "ECALTime/EcalTimePi0/interface/EcalObjectTimeCalibCalorimetryTree.h" 26 | 27 | #include "TChain.h" 28 | #include "TH1.h" 29 | #include "TH2.h" 30 | #include "TProfile.h" 31 | #include "TGraphErrors.h" 32 | #include "TF1.h" 33 | 34 | 35 | typedef std::set > SetOfIntPairs; 36 | 37 | // authors: S. Cooper and G. Franzoni (UMN) 38 | // Maitained by Author: Tambe E. Norbert (UMN) 39 | #define BarrelLimit 1.479 40 | #define EndcapLimit 3.0 41 | 42 | #define ADCtoGeVEB 0.039 43 | #define ADCtoGeVEE 0.063 44 | 45 | #define numAeffBins 35 46 | #define numAoSigmaBins 25 47 | 48 | #define NSlices 54 // # of slices in log(A) 49 | #define LogStep 0.05 // size of Slices log(A) 50 | 51 | #define lightSpeed 299792458 52 | 53 | 54 | 55 | // -------- Globals ---------------------------------------- 56 | EcalTimeTreeContent treeVars_; 57 | TFile* saving_; 58 | std::vector listOfFiles_; 59 | bool speak_=false; 60 | char buffer_ [75]; 61 | std::string bufferTitle_; 62 | // default settings 63 | std::string outputRootName_ = "outputHistos.root"; 64 | int numEvents_ = -1; 65 | unsigned int minRun_ = 0; 66 | unsigned int maxRun_ = 9999999; 67 | unsigned int minLS_ = 0; 68 | unsigned int maxLS_ = 9999999; 69 | float eTGammaMinEB_ = 0.2; 70 | float s4s9GammaMinEB_ = 0.85; 71 | float eTPi0MinEB_ = 0.65; 72 | float eTGammaMinEE_ = 0.250; 73 | float s4s9GammaMinEE_ = 0.85; 74 | float eTPi0MinEE_ = 0.800; 75 | float swissCrossMaxEB_ = 0.95; // 1-E4/E1 76 | float swissCrossMaxEE_ = 0.95; // 1-E4/E1 77 | // based on range and bins, the bin width is 50 ps 78 | float rangeTDistro_ = 10; 79 | int binsTDistro_ = 120; 80 | std::vector > trigIncludeVector; 81 | std::vector > trigExcludeVector; 82 | std::vector > ttrigIncludeVector; 83 | std::vector > ttrigExcludeVector; 84 | 85 | 86 | 87 | int minEntriesForFit_ = 7; 88 | int flagOneVertex_ = 0; 89 | bool limitFit_(true); 90 | //std::string fitOption_(""); // default: use chi2 method 91 | std::string fitOption_("L"); // use likelihood method 92 | 93 | // Ao dependent timing corrections 94 | // By the definition of these corrections, the timing should be zero for the hits in Module 1 95 | // or Low eta EE within the valid A/sigma ranges. Earlier data will have positive time due 96 | // to the graduate timing shifts in the positive direction. 97 | TF1* timeCorrectionEB_ = new TF1("timeCorrectionEB_","pol4(0)",0,1.2); 98 | TF1* timeCorrectionEE_ = new TF1("timeCorrectionEE_","pol4(0)",0,1.2); 99 | 100 | 101 | // -------- Histograms ------------------------------------- 102 | TH1 * nVertices_; 103 | TH1F* mass_; 104 | TH1F* dZvertices_; 105 | TH1F* Zvertices_; 106 | 107 | 108 | // --------------------------------------------------------------------------------------- 109 | // - Function to decide to include/exclude event based on the vectors passed for triggers 110 | bool includeEvent(int* triggers, 111 | int numTriggers, 112 | std::vector > includeVector, 113 | std::vector > excludeVector) 114 | { 115 | bool keepEvent = false; 116 | if(includeVector.size()==0) keepEvent = true; 117 | for (int ti = 0; ti < numTriggers; ++ti) { 118 | for(uint i=0; i!=includeVector.size();++i){ 119 | if(includeVector[i].size()==1 && triggers[ti]==includeVector[i][0]) keepEvent=true; 120 | else if(includeVector[i].size()==2 && (triggers[ti]>=includeVector[i][0] && triggers[ti]<=includeVector[i][1])) keepEvent=true; 121 | } 122 | } 123 | if(!keepEvent) 124 | return false; 125 | 126 | keepEvent = true; 127 | for (int ti = 0; ti < numTriggers; ++ti) { 128 | for(uint i=0; i!=excludeVector.size();++i){ 129 | if(excludeVector[i].size()==1 && triggers[ti]==excludeVector[i][0]) keepEvent=false; 130 | else if(excludeVector[i].size()==2 && (triggers[ti]>=excludeVector[i][0] && triggers[ti]<=excludeVector[i][1])) keepEvent=false; 131 | } 132 | } 133 | 134 | return keepEvent; 135 | } 136 | 137 | // --------------------------------------------------------------------------------------- 138 | // ------- Function to decide to include/exclude event based on the vectors passed ------- 139 | bool includeEvent(double eventParameter, 140 | std::vector > includeVector, 141 | std::vector > excludeVector) 142 | { 143 | bool keepEvent = false; 144 | if(includeVector.size()==0) keepEvent = true; 145 | for(uint i=0; i!=includeVector.size();++i){ 146 | if(includeVector[i].size()==1 && eventParameter==includeVector[i][0]) 147 | keepEvent=true; 148 | else if(includeVector[i].size()==2 && (eventParameter>=includeVector[i][0] && eventParameter<=includeVector[i][1])) 149 | keepEvent=true; 150 | } 151 | if(!keepEvent) // if it's not in our include list, skip it 152 | return false; 153 | 154 | keepEvent = true; 155 | for(uint i=0; i!=excludeVector.size();++i){ 156 | if(excludeVector[i].size()==1 && eventParameter==excludeVector[i][0]) 157 | keepEvent=false; 158 | else if(excludeVector[i].size()==2 && (eventParameter>=excludeVector[i][0] && eventParameter<=excludeVector[i][1])) 159 | keepEvent=false; 160 | } 161 | 162 | return keepEvent; // if someone includes and excludes, exseedion will overrule 163 | 164 | } 165 | 166 | 167 | 168 | // --------------------------------------------------------------------------------------- 169 | // ------------------ Function to split arg input lists by comma ------------------------- 170 | std::vector split(std::string msg, std::string separator) 171 | { 172 | boost::char_separator sep(separator.c_str()); 173 | boost::tokenizer > tok(msg, sep ); 174 | std::vector token; 175 | for ( boost::tokenizer >::const_iterator i = tok.begin(); i != tok.end(); ++i ) { 176 | token.push_back(std::string(*i)); 177 | } 178 | return token; 179 | } 180 | 181 | 182 | // --------------------------------------------------------------------------------------- 183 | // ------------------ Function to generate include/exclude vectors ----------------------- 184 | void genIncludeExcludeVectors(std::string optionString, 185 | std::vector >& includeVector, 186 | std::vector >& excludeVector) 187 | { 188 | std::vector rangeStringVector; 189 | std::vector rangeIntVector; 190 | 191 | if(optionString != "-1"){ 192 | std::vector stringVector = split(optionString,",") ; 193 | 194 | for (uint i=0 ; i list of input files" << std::endl ; 255 | std::cout << " --eTGammaMinEB: min eT for EB gammas" << std::endl; 256 | std::cout << " --s4s9GammaMinEB: min EB shower shape" << std::endl; 257 | std::cout << " --eTPi0MinEB min eT for EB pi0 candidate" << std::endl; 258 | std::cout << " --eTGammaMinEE: min eT for EE gammas" << std::endl; 259 | std::cout << " --s4s9GammaMinEE: min EE shower shape" << std::endl; 260 | std::cout << " --eTPi0MinEE: min eT for EE pi0 candidate" << std::endl; 261 | std::cout << " --minAOverSigma: min ampli considered for time" << std::endl; 262 | std::cout << " --minRun: lowest run number considered" << std::endl; 263 | std::cout << " --maxRun: highest run number considered" << std::endl; 264 | std::cout << " --minLS: lowest lumi section number considered" << std::endl; 265 | std::cout << " --maxLS: highest lumi section number considered" << std::endl; 266 | std::cout << " --vertex: require vertex@IP (1), veto it (2) or either (0, or unset)" << std::endl; 267 | std::cout << " --trig: L1 triggers to include (exclude with x)" << std::endl; 268 | std::cout << " --techTrig: L1 technical triggers to include (exclude with x)" << std::endl; 269 | exit(1); } 270 | 271 | 272 | else if (argv[v] == stringNumEvents) { // set number of events 273 | std::cout << "events number" << std::endl; 274 | numEvents_=atoi(argv[v+1]); 275 | v++; 276 | } 277 | else if (argv[v] == stringMaxLS) { // set last LS of interval to be considered 278 | std::cout << "max LS number" << std::endl; 279 | maxLS_=atoi(argv[v+1]); 280 | v++; 281 | } 282 | else if (argv[v] == stringMinLS) { // set first LS of interval to be considered 283 | std::cout << "min LS number" << std::endl; 284 | minLS_=atoi(argv[v+1]); 285 | v++; 286 | } 287 | else if (argv[v] == stringMaxRun) { // set last run of interval to be considered 288 | std::cout << "max LS number" << std::endl; 289 | maxRun_=atoi(argv[v+1]); 290 | v++; 291 | } 292 | else if (argv[v] == stringMinRun) { // set first run of interval to be considered 293 | std::cout << "min run number" << std::endl; 294 | minRun_=atoi(argv[v+1]); 295 | v++; 296 | } 297 | else if (argv[v] == stringETGammaMinEB) { // choose et cut for EB single cluster 298 | eTGammaMinEB_ = atof(argv[v+1]); 299 | v++; 300 | } 301 | else if (argv[v] == strings4s9GammaMinEB) { // choose cut for EB shower shape 302 | s4s9GammaMinEB_ = atof(argv[v+1]); 303 | v++; 304 | } 305 | else if (argv[v] == stringeTPi0MinEB) { // choose et cut for EB pi0 candidate 306 | eTPi0MinEB_ = atof(argv[v+1]); 307 | v++; 308 | } 309 | else if (argv[v] == stringETGammaMinEE) { // choose et cut for EE single cluster 310 | eTGammaMinEE_ = atof(argv[v+1]); 311 | v++; 312 | } 313 | else if (argv[v] == strings4s9GammaMinEE) { // choose cut for EE shower shape 314 | s4s9GammaMinEE_ = atof(argv[v+1]); 315 | v++; 316 | } 317 | else if (argv[v] == stringeTPi0MinEE) { // choose et cut for EE pi0 candidate 318 | eTPi0MinEE_ = atof(argv[v+1]); 319 | v++; 320 | } 321 | else if (argv[v] == stringOutFileName) { // set output file 322 | outputRootName_ = argv[v+1]; 323 | v++; 324 | } 325 | else if (argv[v] == stringminAmpliOverSigma) { // set min amplitude considered for time measurement 326 | /* 327 | * minAmpliOverSigma_ = atof(argv[v+1]); 328 | */ 329 | v++ ; 330 | } 331 | else if (argv[v] == vertex) { // collect requirement for one vertex only or not 332 | flagOneVertex_ = atof(argv[v+1]); 333 | if (flagOneVertex_!=0 && flagOneVertex_!=1 && flagOneVertex_!=2){ 334 | std::cout << "Not a valid value for flagOneVertex_ (0,1,2). Returning." << std::endl; 335 | exit (1);} 336 | v++; 337 | } 338 | else if (argv[v] == stringTriggers) { // set L1 triggers to include/exclude 339 | genIncludeExcludeVectors(std::string(argv[v+1]),trigIncludeVector,trigExcludeVector); 340 | v++; 341 | } 342 | else if (argv[v] == stringTechTriggers) { // set L1 technical triggers to include/exclude 343 | genIncludeExcludeVectors(std::string(argv[v+1]),ttrigIncludeVector,ttrigExcludeVector); 344 | v++; 345 | } 346 | // handle here the case of multiple arguments for input files 347 | else if (argv[v] == stringInputFileName){// && v<(argc-1) ) 348 | 349 | for (int u=v+1; u& td,const std::string&); 379 | void book(TFileDirectory subDir,const std::string&); 380 | 381 | // fill all histos of the set with the two electron candidates 382 | void fill(int sc1, int sc2, int cl1, int cl2); 383 | 384 | TH1 * nVertices_; 385 | TH1F* mass_; 386 | TH1F* dZvertices_; 387 | TH1F* Zvertices_; 388 | TH1F* chi2_; 389 | TH1F* seedTime_; 390 | TH1F* secondTime_; 391 | TH1F* clusterTime_; 392 | TH1F* seedTimeDiffHist_; 393 | TH1F* TOFcorrections_; 394 | TH2F* TOFcorrectionsVSdeltaEta_; 395 | TH2F* clusTimeDiffHistTOFVSdeltaEtaRightVertex_, *clusTimeDiffHistTOFVSdeltaEtaWrongVertex_; 396 | TH1F* tColl_; 397 | TH2F* tCollVSdeltaEtaRightVertex_, * tCollVStimeDiffHistTOF_; 398 | TH1F* seedTimeDiffHistTOF_; 399 | TH1F* secondTimeDiffHist_; 400 | TH1F* secondTimeDiffHistTOF_; 401 | TH1F* clusTimeDiffHist_; 402 | TH1F* clusTimeDiffHistTOF_, *clusTimeDiffHistTOFwrongVertex_; 403 | TH1F* numCryBC1, *numCryBC2; 404 | TH2F* timeVsEtaLead_, *timeVsEtaSub_, *timeVsEta_, *outliersVsEtaPhi_,*timeVsPhi_; 405 | TH1F* seedAmpli_; 406 | TH1F* secondAmpli_; 407 | TH1F* diffSeedOther_, *diffSeedOtherOverErr_; 408 | TH1F* diffSeedSecond_, *diffSeedSecondOverErr_; 409 | TH2F* seedVSSecond_; 410 | 411 | } theHists; 412 | 413 | 414 | void HistSet::book(TFileDirectory subDir, const std::string& post) { 415 | 416 | nVertices_=subDir.make("num vertices","num vertices; num vertices",41,-0.5,40.5); 417 | mass_ =(TH1F*) subDir.make("mass","mass; m(ele,ele) [GeV]",80,50,130); 418 | dZvertices_ =(TH1F*) subDir.make("dZvertices","dZvertices; #DeltaZ(ele_{1},ele_{2}) [cm]",250,0,25); 419 | Zvertices_ =(TH1F*) subDir.make("Zvertices","Zvertices; z vertex [cm]",250,-25,25); 420 | 421 | // Initialize histograms -- xtals 422 | chi2_ =(TH1F*) subDir.make("cluster chi2 ","cluster chi2 ; #chi^{2}",100,0,10); 423 | 424 | seedTime_ =(TH1F*) subDir.make("seed time","seed time; t_{seed} [ns]; num. seeds/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 425 | secondTime_ =(TH1F*) subDir.make("second time","second time; t_{second} [ns]; num. secs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 426 | clusterTime_ =(TH1F*) subDir.make("cluster time","cluster time; t_{cluster} [ns]; num. clusters/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 427 | 428 | 429 | TOFcorrections_ = (TH1F*) subDir.make("TOF difference","TOF difference; #Delta TOF [ns]; num. seeds/0.05ns",binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 430 | TOFcorrectionsVSdeltaEta_=(TH2F*) subDir.make("TOF corrections VS #Delta#eta","TOF corrections VS #Delta#eta; #Delta#eta; #Delta TOF [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 431 | clusTimeDiffHistTOFVSdeltaEtaRightVertex_=(TH2F*) subDir.make("TOF-corr cluster time difference VS #Delta#eta RightVertex","TOF-corr cluster time difference VS #Delta#eta RightVertex; |#Delta#eta|; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 432 | clusTimeDiffHistTOFVSdeltaEtaWrongVertex_=(TH2F*) subDir.make("TOF-corr cluster time difference VS #Delta#eta WrongVertex","TOF-corr cluster time difference VS #Delta#eta WrongVertex; |#Delta#eta|; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 433 | 434 | tCollVSdeltaEtaRightVertex_=(TH2F*) subDir.make("t_{coll} VS #Delta#eta RightVertex","t_{coll} VS #Delta#eta RightVertex; |#Delta#eta|; t_{coll} [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/4.,rangeTDistro_/4.); 435 | tCollVStimeDiffHistTOF_=(TH2F*) subDir.make("TOF-corrected: (t_{clus1} + t_{clus2})/2 VS (t_{clus1} - t_{clus2})/2","TOF-corrected: (t_{clus1} + t_{clus2})/2 VS (t_{clus1} - t_{clus2})/2 [ns]; (t_{clus1} - t_{clus2})/2 ; (t_{clus1} + t_{clus2})/2 VS [ns]; ",binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 436 | 437 | 438 | seedTimeDiffHist_ =(TH1F*) subDir.make("time difference of seeds","seeds time difference; t_{seed1} - t_{seed2} [ns]; num. seed pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 439 | seedTimeDiffHistTOF_ =(TH1F*) subDir.make("TOF-corr time difference of seeds","TOF-corr seed time difference; (t_{seed1} - t_{seed2}) TOF-corrected [ns]; num. seed pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 440 | 441 | secondTimeDiffHist_ =(TH1F*) subDir.make("time difference of seconds","second time difference; t_{second1} - t_{second2} [ns]; num. seed pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_);//GF new 442 | secondTimeDiffHistTOF_ =(TH1F*) subDir.make("TOF-corr time difference of seconds","TOF-corr seconds time difference; (t_{second1} - t_{second2}) TOF-corrected [ns]; num. sec pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 443 | 444 | clusTimeDiffHist_ =(TH1F*) subDir.make("cluster time difference","cluster time difference; t_{clus1} - t_{clus2} [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 445 | clusTimeDiffHistTOF_ =(TH1F*) subDir.make("TOF-corr cluster time difference","TOF-corr cluster time difference; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 446 | // clusTimeDiffHistTOFwrongVertex_ =(TH1F*) subDir.make("TOF-corr cluster time difference","TOF-corr cluster time difference; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 447 | clusTimeDiffHistTOFwrongVertex_=(TH1F*) subDir.make("TOF-corr cluster time difference wrong vertex","TOF-corr cluster time difference wronge vertex; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 448 | 449 | tColl_=(TH1F*) subDir.make("t_{coll}","t_{coll} [ns]; (t_{clus1} + t_{clus2})/2 [ns]",binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 450 | 451 | 452 | numCryBC1 =(TH1F*) subDir.make("num cry in bc1","num cry in bc1; num cry",25,0,25); 453 | numCryBC2 =(TH1F*) subDir.make("num cry in bc2","num cry in bc2; num cry",25,0,25); 454 | timeVsEta_ =(TH2F*) subDir.make("timeVsEta","timeVsEta;#eta; time [ns]",100,-3.5,3.5,100,-10.0,10.0); 455 | timeVsEtaLead_ =(TH2F*) subDir.make("timeVsEtaLead","timeVsEtaLead;#eta_{lead}; t [ns]",50,-2.5,2.5,150,-1.5,1.5); 456 | timeVsEtaSub_ =(TH2F*) subDir.make("timeVsEtaSub","timeVsEtaSub; #eta_{sublead}; t [ns]",50,-2.5,2.5,150,-1.5,1.5); 457 | outliersVsEtaPhi_ =(TH2F*) subDir.make("outliersVsEtaPhi","outliersVsEtaPhi; #eta; #phi",50,-2.5,2.5,72,-3.14,3.14); 458 | timeVsPhi_ =(TH2F*) subDir.make("timeVsPhi","timeVsPhi; #phi; time [ns]",100,-3.5,3.5,100,-10.0,10.0); 459 | seedAmpli_ =(TH1F*) subDir.make("E(seed) ","E(seed) ; E [GeV]",130,0,130); 460 | secondAmpli_ =(TH1F*) subDir.make("E(second) ","E(second) ; E [GeV]",130,0,130); 461 | diffSeedOther_ =(TH1F*) subDir.make("t_{seed}-t_{others}","t_{seed}-t_{others}; t_{seed}-t_{others} [ns]; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 462 | diffSeedOtherOverErr_ =(TH1F*) subDir.make("(t_{seed}-t_{others})/#sigma","(t_{seed}-t_{others})/#sigma; (t_{seed}-t_{others})/#sigma; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 463 | 464 | diffSeedSecond_ =(TH1F*) subDir.make("t_{seed}-t_{second}","t_{seed}-t_{second}; t_{seed}-t_{second} [ns]; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 465 | diffSeedSecondOverErr_ =(TH1F*) subDir.make("(t_{seed}-t_{second})/#sigma","(t_{seed}-t_{second})/#sigma; (t_{seed}-t_{second})/#sigma; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 466 | seedVSSecond_ =(TH2F*) subDir.make("t_{seed} VS t_{second}","t_{seed} VS t_{second}; t_{seed} [ns]; t_{second} [ns]",75,-1.5,1.5,75,-1.5,1.5); 467 | 468 | } 469 | 470 | void HistSet::fill(int sc1, int sc2, int bc1, int bc2 ){ 471 | 472 | float et1 = treeVars_.superClusterRawEnergy[sc1]/cosh( treeVars_.superClusterEta[sc1] ); 473 | math::PtEtaPhiELorentzVectorD el1(et1 , 474 | treeVars_.superClusterEta[sc1], 475 | treeVars_.superClusterPhi[sc1], 476 | treeVars_.superClusterRawEnergy[sc1] ); 477 | float et2 = treeVars_.superClusterRawEnergy[sc2]/cosh( treeVars_.superClusterEta[sc2] ); 478 | math::PtEtaPhiELorentzVectorD el2(et2 , 479 | treeVars_.superClusterEta[sc2], 480 | treeVars_.superClusterPhi[sc2], 481 | treeVars_.superClusterRawEnergy[sc2] ); 482 | math::PtEtaPhiELorentzVectorD diEle = el1; 483 | diEle += el2; 484 | 485 | // //////////////////////// 486 | mass_ ->Fill(diEle.M()); 487 | float dvertex = pow(treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2],2); 488 | //dvertex += pow(treeVars_.superClusterVertexY[sc1]-treeVars_.superClusterVertexY[sc2],2); 489 | //dvertex += pow(treeVars_.superClusterVertexX[sc1]-treeVars_.superClusterVertexX[sc2],2); 490 | dvertex = sqrt(dvertex); 491 | dZvertices_->Fill(dvertex); 492 | Zvertices_->Fill( (treeVars_.superClusterVertexZ[sc1]+treeVars_.superClusterVertexZ[sc2])/2 ); 493 | nVertices_->Fill(treeVars_.nVertices); 494 | 495 | ClusterTime bcTime1 = timeAndUncertSingleCluster(bc1,treeVars_); 496 | ClusterTime bcTime2 = timeAndUncertSingleCluster(bc2,treeVars_); 497 | 498 | TOFcorrections_ -> Fill(extraTravelTime(sc2,treeVars_) - extraTravelTime(sc1,treeVars_) ); 499 | TOFcorrectionsVSdeltaEta_ -> Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , extraTravelTime(sc2,treeVars_) - extraTravelTime(sc1,treeVars_) ); 500 | 501 | int vtxOfThisEle=-99; 502 | // look for the vertex which electrons are attached to: 503 | for(int u=0; u-99){ 510 | 511 | for(int u=0; u Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , 514 | (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) 515 | //(bcTime1.time-extraTravelTime(sc1,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,treeVars_)) 516 | ); 517 | 518 | tCollVSdeltaEtaRightVertex_-> Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , 519 | ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) + (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. 520 | ); 521 | tCollVStimeDiffHistTOF_ -> Fill( ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. , 522 | ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) + (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. 523 | ); 524 | tColl_ -> Fill( ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) + (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. ); 525 | 526 | }// if correct vertex 527 | else { 528 | clusTimeDiffHistTOFVSdeltaEtaWrongVertex_ -> Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , 529 | (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) 530 | //(bcTime1.time-extraTravelTime(sc1,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,treeVars_)) 531 | ); 532 | clusTimeDiffHistTOFwrongVertex_ -> Fill( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_) )); 533 | }// if wrong vertex 534 | }//loop on vertices 535 | 536 | } // if vertex matching succeeded 537 | // else std::cout << "vertex was not found which matches electrons track... " << std::endl; 538 | 539 | chi2_->Fill(bcTime1.chi2); chi2_->Fill(bcTime2.chi2); 540 | 541 | // take care of the seeds 542 | seedTime_ -> Fill(bcTime1.seedtime); seedTime_->Fill(bcTime2.seedtime); 543 | seedTimeDiffHist_ -> Fill( bcTime1.seedtime - bcTime2.seedtime ); 544 | seedTimeDiffHistTOF_ -> Fill( (bcTime1.seedtime-extraTravelTime(sc1,treeVars_)) - (bcTime2.seedtime-extraTravelTime(sc2,treeVars_)) ); 545 | 546 | // take care of the second-highest amplitude crystal 547 | if(bcTime1.second>-1) secondAmpli_->Fill(treeVars_.xtalInBCEnergy[bc1][bcTime1.second]); // check that there's crystals beyond seed 548 | else secondAmpli_->Fill(0); 549 | if(bcTime2.second>-1) secondAmpli_->Fill(treeVars_.xtalInBCEnergy[bc2][bcTime2.second]); 550 | else secondAmpli_->Fill(0); 551 | if(bcTime1.second>-1 && bcTime2.second>-1){ 552 | secondTime_ -> Fill( bcTime1.secondtime); secondTime_->Fill(bcTime2.secondtime); 553 | secondTimeDiffHist_ -> Fill( bcTime1.secondtime - bcTime2.secondtime ); 554 | secondTimeDiffHistTOF_ -> Fill( (bcTime1.secondtime-extraTravelTime(sc1,treeVars_)) - (bcTime2.secondtime-extraTravelTime(sc2,treeVars_)) ); 555 | } 556 | 557 | 558 | clusterTime_ -> Fill(bcTime1.time); clusterTime_ ->Fill(bcTime2.time); 559 | clusTimeDiffHist_ -> Fill(bcTime1.time - bcTime2.time ); 560 | clusTimeDiffHistTOF_ -> Fill( (bcTime1.time - extraTravelTime(sc1,treeVars_) ) - (bcTime2.time -extraTravelTime(sc2,treeVars_)) ); 561 | 562 | seedAmpli_->Fill(treeVars_.xtalInBCEnergy[bc1][bcTime1.seed]); 563 | seedAmpli_->Fill(treeVars_.xtalInBCEnergy[bc2][bcTime2.seed]); 564 | 565 | // std::cout << "otherstime: " << bcTime1.otherstime << "\t" << bcTime2.otherstime << std::endl; 566 | // std::cout << "seedtime: " << bcTime1.seedtime << "\t" << bcTime2.seedtime << std::endl; 567 | if(bcTime1.otherstime>-999) // check that there's crystals beyond seed 568 | { 569 | diffSeedOther_ -> Fill(bcTime1.seedtime-bcTime1.otherstime); 570 | diffSeedOtherOverErr_->Fill( (bcTime1.seedtime-bcTime1.otherstime) / sqrt( pow(treeVars_.xtalInBCTimeErr[bc1][bcTime1.seed],2) -0.6*0.6+timingResParamConstEB*timingResParamConstEB + pow(bcTime1.otherstimeErr,2)) ); 571 | diffSeedSecond_ -> Fill(bcTime1.seedtime-treeVars_.xtalInBCTime[bc1][bcTime1.second]); 572 | seedVSSecond_ -> Fill(treeVars_.xtalInBCTime[bc1][bcTime1.second],bcTime1.seedtime); 573 | diffSeedSecondOverErr_ -> Fill( (bcTime1.seedtime-treeVars_.xtalInBCTime[bc1][bcTime1.second]) 574 | / sqrt( pow(treeVars_.xtalInBCTimeErr[bc1][bcTime1.seed],2) 575 | + pow(treeVars_.xtalInBCTimeErr[bc1][bcTime1.second],2) 576 | - 2* 0.6*0.6 + 2*timingResParamConstEB*timingResParamConstEB 577 | ) 578 | ); 579 | } 580 | if(bcTime2.otherstime>-999) // check that there's crystals beyond seed 581 | { 582 | diffSeedOther_ -> Fill(bcTime2.seedtime-bcTime2.otherstime); 583 | diffSeedOtherOverErr_ ->Fill( (bcTime2.seedtime-bcTime2.otherstime) / sqrt( pow(treeVars_.xtalInBCTime[bc2][bcTime2.seed],2) -0.6*0.6+timingResParamConstEB*timingResParamConstEB + pow(bcTime2.otherstimeErr,2)) ); 584 | diffSeedSecond_ -> Fill(bcTime2.seedtime-treeVars_.xtalInBCTime[bc2][bcTime2.second]); 585 | diffSeedSecondOverErr_ -> Fill( (bcTime2.seedtime-treeVars_.xtalInBCTime[bc2][bcTime2.second]) 586 | / sqrt( pow(treeVars_.xtalInBCTimeErr[bc2][bcTime2.seed],2) 587 | + pow(treeVars_.xtalInBCTimeErr[bc2][bcTime2.second],2) 588 | - 2* 0.6*0.6 + 2*timingResParamConstEB*timingResParamConstEB 589 | ) 590 | ); 591 | } 592 | 593 | numCryBC1->Fill(bcTime1.numCry); 594 | numCryBC2->Fill(bcTime2.numCry); 595 | timeVsEta_ -> Fill( treeVars_.superClusterEta[sc1] , (bcTime1.time - extraTravelTime(sc1,treeVars_) ) ); 596 | 597 | timeVsPhi_ -> Fill( treeVars_.superClusterPhi[sc1] , (bcTime1.time - extraTravelTime(sc1,treeVars_) ) ); 598 | 599 | timeVsEtaLead_ -> Fill( treeVars_.superClusterEta[sc1] , (bcTime1.time - extraTravelTime(sc1,treeVars_) ) ); 600 | timeVsEtaSub_ -> Fill( treeVars_.superClusterEta[sc2] , (bcTime2.time - extraTravelTime(sc2,treeVars_) ) ); 601 | // catch location of time outliers 602 | if ( fabs( (bcTime1.seedtime - extraTravelTime(sc1,treeVars_)) )>1.5 ) outliersVsEtaPhi_ -> Fill( treeVars_.superClusterEta[sc1] , treeVars_.superClusterPhi[sc1]); 603 | if ( fabs( (bcTime2.seedtime - extraTravelTime(sc2,treeVars_)) )>1.5 ) outliersVsEtaPhi_ -> Fill( treeVars_.superClusterEta[sc2] , treeVars_.superClusterPhi[sc2]); 604 | 605 | } 606 | // end HistSet::fill 607 | 608 | 609 | // --------------------------------------------------------------------------------------- 610 | // ------------------ Function to initialize the histograms ------------------------------ 611 | void initializeHists(TFileDirectory subDir){ 612 | 613 | mass_ = subDir.make("mass global","mass (global); m(ele,ele) [GeV]",80,50,130); 614 | dZvertices_ = subDir.make("dZvertices global","dZvertices (global); #DeltaZ(ele_{1},ele_{2}) [cm]",250,0,25); 615 | Zvertices_ = subDir.make("Zvertices global","Zvertices (global); z vertex [cm]",250,-25,25); 616 | nVertices_=subDir.make("num vertices global","num vertices (global); num vertices",41,-0.5,40.5); 617 | 618 | }//end initializeHists 619 | 620 | 621 | 622 | 623 | // --------------------------------------------------------------------------------------- 624 | //! main program 625 | int main (int argc, char** argv) 626 | { 627 | // First parse arguments 628 | parseArguments(argc, argv); 629 | 630 | if (listOfFiles_.size()==0){ 631 | std::cout << "\tno input file found" << std::endl; 632 | return(1); 633 | } 634 | else{ 635 | std::cout << "\tfound " << listOfFiles_.size() << " input files: " << std::endl; 636 | for(std::vector::const_iterator file_itr=listOfFiles_.begin(); file_itr!=listOfFiles_.end(); file_itr++){ 637 | std::cout << "\t" << (*file_itr) << std::endl; 638 | } 639 | } 640 | 641 | // Tree construction 642 | // FIX should turn this string into a configurable 643 | TChain * chain = new TChain ("EcalTimeAnalysis") ; // ntuple producer in CMSSW CVS 644 | //TChain * chain = new TChain ("EcalTimePi0Analysis") ; // ntuple producer in UserCode/UMN space 645 | std::vector::const_iterator file_itr; 646 | for(file_itr=listOfFiles_.begin(); file_itr!=listOfFiles_.end(); file_itr++){ 647 | chain->Add( (*file_itr).c_str() ); 648 | } 649 | int nEntries = chain->GetEntries () ; 650 | if (numEvents_==-1) numEvents_ = nEntries; 651 | std::cout << "\n\tFOUND " << listOfFiles_.size() << " input files" << std::endl ; 652 | std::cout << "\n\tFOUND " << nEntries << " events" << std::endl ; 653 | std::cout << "\tWILL run on: " << numEvents_ << " events" << std::endl; 654 | std::cout << "\tOutput file: " << outputRootName_ << std::endl; 655 | std::cout << "\tminAOverSigma: " << minAmpliOverSigma_ << std::endl; 656 | std::cout << "\teTGammaMinEB: " << eTGammaMinEB_ << std::endl; 657 | std::cout << "\ts4s9GammaMinEB: " << s4s9GammaMinEB_ << std::endl; 658 | std::cout << "\teTPi0MinEB: " << eTPi0MinEB_ << std::endl; 659 | std::cout << "\teTGammaMinEE: " << eTGammaMinEE_ << std::endl; 660 | std::cout << "\ts4s9GammaMinEE: " << s4s9GammaMinEE_ << std::endl; 661 | std::cout << "\teTPi0MinEE: " << eTPi0MinEE_ << std::endl; 662 | std::cout << "\tminRun: " << minRun_ << std::endl; 663 | std::cout << "\tmaxRun: " << maxRun_ << std::endl; 664 | std::cout << "\tminLS: " << minLS_ << std::endl; 665 | std::cout << "\tmaxLS: " << maxLS_ << std::endl; 666 | 667 | setBranchAddresses (chain, treeVars_); 668 | 669 | // setting up the TFileService in the ServiceRegistry; 670 | edmplugin::PluginManager::Config config; 671 | edmplugin::PluginManager::configure(edmplugin::standard::config()); 672 | std::vector psets; 673 | edm::ParameterSet pSet; 674 | pSet.addParameter("@service_type",std::string("TFileService")); 675 | pSet.addParameter("fileName",std::string("TimePerf-plots.root")); // this is the file TFileService will write into 676 | psets.push_back(pSet); 677 | static edm::ServiceToken services(edm::ServiceRegistry::createSet(psets)); 678 | static edm::ServiceRegistry::Operate operate(services); 679 | edm::Service fs; 680 | 681 | TFileDirectory subDirECALECAL=fs->mkdir("ECALECAL"); 682 | HistSet plotsECALECAL; 683 | plotsECALECAL.book(subDirECALECAL,std::string("ECALECAL")); 684 | 685 | TFileDirectory subDirEBEB=fs->mkdir("EBEB"); 686 | HistSet plotsEBEB; 687 | plotsEBEB.book(subDirEBEB,std::string("EBEB")); 688 | 689 | TFileDirectory subDirEEEE=fs->mkdir("EEEE"); 690 | HistSet plotsEEEE; 691 | plotsEEEE.book(subDirEEEE,std::string("EEEE")); 692 | 693 | TFileDirectory subDirEBEE=fs->mkdir("EBEE"); 694 | HistSet plotsEBEE; 695 | plotsEBEE.book(subDirEBEE,std::string("EBEE")); 696 | 697 | TFileDirectory subDirEBEBequalShare=fs->mkdir("EBEBequalShare"); 698 | HistSet plotsEBEBequalShare; 699 | plotsEBEBequalShare.book(subDirEBEBequalShare,std::string("EBEBequalShare")); 700 | 701 | TFileDirectory subDirEBEBunevenShare=fs->mkdir("EBEBunevenShare"); 702 | HistSet plotsEBEBunevenShare; 703 | plotsEBEBunevenShare.book(subDirEBEBunevenShare,std::string("EBEBunevenShare")); 704 | 705 | timeCorrector theCorr; 706 | std::cout << "\ncreated object theCorr to be used for timeVsAmpliCorrections" << std::endl; 707 | std::cout << "\ninitializing theCorr" << std::endl; 708 | //theCorr.initEB( std::string("EBmod4") ); 709 | //theCorr.initEE( std::string("EElow") ); 710 | theCorr.initEB( "EB" ); 711 | theCorr.initEE( "EE" ); 712 | 713 | 714 | //Initialize output root file 715 | //saving_ = new TFile(outputRootName_.c_str (),"recreate"); 716 | 717 | // Initialize the histograms 718 | TFileDirectory subDirGeneral=fs->mkdir("General"); 719 | initializeHists(subDirGeneral); 720 | 721 | int eventCounter = 0; 722 | ///////////////////////////////////////////////////// 723 | // Main loop over entries 724 | for (int entry = 0 ; (entry < nEntries && eventCounter < numEvents_); ++entry) 725 | { 726 | chain->GetEntry (entry) ; 727 | // Keep the event? 728 | bool keepEvent = includeEvent(treeVars_.l1ActiveTriggers, 729 | treeVars_.l1NActiveTriggers,trigIncludeVector,trigExcludeVector) 730 | && includeEvent(treeVars_.l1ActiveTechTriggers, 731 | treeVars_.l1NActiveTechTriggers,ttrigIncludeVector,ttrigExcludeVector); 732 | if(!keepEvent) 733 | continue; 734 | 735 | 736 | // do analysis if the run is in the desired range 737 | if( treeVars_.runId0 && count==treeVars_.nVertices ) verticesAreOnlyNextToNominalIP = true; 749 | else verticesAreOnlyNextToNominalIP = false; 750 | 751 | // --vertex: require vertex@IP (1), veto it (2) or either (0, or unset) 752 | if (flagOneVertex_ ==1 && (!verticesAreOnlyNextToNominalIP) ) continue; 753 | if (flagOneVertex_ ==2 && (verticesAreOnlyNextToNominalIP) ) continue; 754 | 755 | // if evet being actually processed, increment counter of analyzed events 756 | eventCounter++; 757 | 758 | speak_=false; 759 | if (entry<10 || entry%10000==0) speak_=true; 760 | 761 | if (speak_) std::cout << "\n\n------> reading entry " << entry << "\tLS: " << treeVars_.lumiSection << " <------\n" ; 762 | if (speak_) std::cout << " found " << treeVars_.nSuperClusters << " superclusters" << std::endl ; 763 | if (speak_) std::cout << " found " << treeVars_.nClusters << " basic clusters" << std::endl ; 764 | 765 | 766 | /////////////////////////////////////////////////////////////////////// 767 | // outer loop on supercluster 768 | for (int sc1=0; sc1Fill(diEle.M()); 801 | dZvertices_->Fill(dvertex); 802 | Zvertices_->Fill( (treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2])/2 ); 803 | nVertices_->Fill(treeVars_.nVertices); 804 | 805 | // require invariant mass 806 | //if( fabs( diEle.M() - 91 ) > 20 ) continue; 807 | if( fabs( diEle.M() - 91 ) > 40 ) continue; 808 | // require two electrons from the same vertex 809 | //if ( dvertex > 0.01 ) continue; 810 | if ( dvertex > 0.1 ) continue; 811 | 812 | if(0) std::cout << "di-electron system mass: " << diEle.M() << " vertex distance: " << dvertex << std::endl; 813 | 814 | // at this stage I have a suitable di-electron system for time studies 815 | 816 | float tmpEne=-9999; 817 | // loop on BC and match to sc1 =============== 818 | int bc1=-1; 819 | for (int bc=0; bctmpEne) { 822 | tmpEne=treeVars_.clusterEnergy[bc]; 823 | bc1=bc; 824 | }// end - if good bc candidate 825 | }// end - loop over BC 826 | 827 | 828 | tmpEne=-9999; 829 | // loop on BC and match to sc2 ============== 830 | int bc2=-1; 831 | for (int bc=0; bctmpEne) { 834 | tmpEne=treeVars_.clusterEnergy[bc]; 835 | bc2=bc; 836 | }// end - if good bc candidate 837 | }// end - loop over BC 838 | 839 | // protect in case of no matching 840 | if(bc1==-1 || bc2==-1) continue; 841 | if(0) { 842 | std::cout << "\n\nsc1 : " << treeVars_.superClusterEta[sc1] << " " << treeVars_.superClusterPhi[sc1] << " " << treeVars_.superClusterRawEnergy[sc1] << std::endl; 843 | std::cout << "bc1 : " << treeVars_.clusterEta[bc1] << " " << treeVars_.clusterPhi[bc1] << " " << treeVars_.clusterEnergy[bc1] << "\n"<< std::endl; 844 | std::cout << "sc2 : " << treeVars_.superClusterEta[sc2] << " " << treeVars_.superClusterPhi[sc2] << " " << treeVars_.superClusterRawEnergy[sc2] << std::endl; 845 | std::cout << "bc2 : " << treeVars_.clusterEta[bc2] << " " << treeVars_.clusterPhi[bc2] << " " << treeVars_.clusterEnergy[bc2] << std::endl; 846 | } 847 | 848 | ClusterTime bcTime1 = timeAndUncertSingleCluster(bc1,treeVars_); 849 | ClusterTime bcTime2 = timeAndUncertSingleCluster(bc2,treeVars_); 850 | 851 | if(! (bcTime1.isvalid && bcTime2.isvalid) ) continue; 852 | 853 | // fill the structures which hold all the plots 854 | plotsECALECAL.fill(sc1,sc2, bc1,bc2); 855 | if ( fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])<1.4 ){ 856 | plotsEBEB.fill(sc1,sc2, bc1,bc2); 857 | 858 | float energyRatio1 = treeVars_.xtalInBCEnergy[bc1][bcTime1.seed]; 859 | if(bcTime1.second>-1) {energyRatio1 /= treeVars_.xtalInBCEnergy[bc1][bcTime1.second]; } 860 | else { energyRatio1 /= 99999; } 861 | float energyRatio2 = treeVars_.xtalInBCEnergy[bc2][bcTime2.seed]; 862 | if(bcTime2.second>-1) {energyRatio2 /= treeVars_.xtalInBCEnergy[bc2][bcTime2.second]; } 863 | else { energyRatio2 /= 99999; } 864 | 865 | float minRatio = 0.7; float maxRatio = 1.3; 866 | if(minRatio1.5 && fabs(treeVars_.clusterEta[bc2])>1.5 ) plotsEEEE.fill(sc1,sc2, bc1,bc2); 873 | else if ( (fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])>1.5) || 874 | (fabs(treeVars_.clusterEta[bc1])>1.5 && fabs(treeVars_.clusterEta[bc2])<1.4) ) plotsEBEE.fill(sc1,sc2, bc1,bc2); 875 | 876 | // if I've found a pair of supercluster, bail out of loop to repeat using twice the same supercluster 877 | break; 878 | 879 | }// end loop sc2 880 | }// end loop sc1 881 | 882 | } // end of loop over entries 883 | 884 | 885 | delete chain ; 886 | 887 | return 0 ; 888 | } 889 | -------------------------------------------------------------------------------- /ZeetimeAnalysis_Asad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "FWCore/PluginManager/interface/PluginManager.h" 16 | #include "FWCore/PluginManager/interface/standard.h" 17 | 18 | #include "FWCore/ServiceRegistry/interface/Service.h" 19 | #include "CommonTools/UtilAlgos/interface/TFileService.h" 20 | 21 | #include "DataFormats/Math/interface/LorentzVector.h" 22 | 23 | #include "CalibCalorimetry/EcalTiming/interface/EcalTimeTreeContent.h" 24 | #include "ECALTime/EcalTimePi0/interface/timeVsAmpliCorrector.h" 25 | #include "ECALTime/EcalTimePi0/interface/EcalObjectTimeCalibCalorimetryTree.h" 26 | 27 | #include "TChain.h" 28 | #include "TH1.h" 29 | #include "TH2.h" 30 | #include "TProfile.h" 31 | #include "TGraphErrors.h" 32 | #include "TF1.h" 33 | 34 | 35 | typedef std::set > SetOfIntPairs; 36 | 37 | // authors: S. Cooper and G. Franzoni (UMN) 38 | // Maitained by Author: Tambe E. Norbert (UMN) 39 | #define BarrelLimit 1.479 40 | #define EndcapLimit 3.0 41 | 42 | #define ADCtoGeVEB 0.039 43 | #define ADCtoGeVEE 0.063 44 | 45 | #define numAeffBins 35 46 | #define numAoSigmaBins 25 47 | 48 | #define NSlices 54 // # of slices in log(A) 49 | #define LogStep 0.05 // size of Slices log(A) 50 | 51 | #define lightSpeed 299792458 52 | 53 | 54 | 55 | // -------- Globals ---------------------------------------- 56 | EcalTimeTreeContent treeVars_; 57 | TFile* saving_; 58 | std::vector listOfFiles_; 59 | bool speak_=false; 60 | char buffer_ [75]; 61 | std::string bufferTitle_; 62 | // default settings 63 | std::string outputRootName_ = "outputHistos.root"; 64 | int numEvents_ = -1; 65 | unsigned int minRun_ = 0; 66 | unsigned int maxRun_ = 9999999; 67 | unsigned int minLS_ = 0; 68 | unsigned int maxLS_ = 9999999; 69 | float eTGammaMinEB_ = 0.2; 70 | float s4s9GammaMinEB_ = 0.85; 71 | float eTPi0MinEB_ = 0.65; 72 | float eTGammaMinEE_ = 0.250; 73 | float s4s9GammaMinEE_ = 0.85; 74 | float eTPi0MinEE_ = 0.800; 75 | float swissCrossMaxEB_ = 0.95; // 1-E4/E1 76 | float swissCrossMaxEE_ = 0.95; // 1-E4/E1 77 | // based on range and bins, the bin width is 50 ps 78 | float rangeTDistro_ = 10; 79 | int binsTDistro_ = 120; 80 | std::vector > trigIncludeVector; 81 | std::vector > trigExcludeVector; 82 | std::vector > ttrigIncludeVector; 83 | std::vector > ttrigExcludeVector; 84 | // For new code 85 | int sc1 = 1; 86 | int sc2 = 2; 87 | int eta1_min = 1; 88 | int eta1_max = 100; 89 | int phi1_min = 0; 90 | int phi1_max = 360; 91 | int eta2_min = 1; 92 | int eta2_max = 100; 93 | int phi2_min = 0; 94 | int phi2_max = 360; 95 | 96 | 97 | int minEntriesForFit_ = 7; 98 | int flagOneVertex_ = 0; 99 | bool limitFit_(true); 100 | //std::string fitOption_(""); // default: use chi2 method 101 | std::string fitOption_("L"); // use likelihood method 102 | 103 | // Ao dependent timing corrections 104 | // By the definition of these corrections, the timing should be zero for the hits in Module 1 105 | // or Low eta EE within the valid A/sigma ranges. Earlier data will have positive time due 106 | // to the graduate timing shifts in the positive direction. 107 | TF1* timeCorrectionEB_ = new TF1("timeCorrectionEB_","pol4(0)",0,1.2); 108 | TF1* timeCorrectionEE_ = new TF1("timeCorrectionEE_","pol4(0)",0,1.2); 109 | 110 | 111 | // -------- Histograms ------------------------------------- 112 | TH1 * nVertices_; 113 | TH1F* mass_; 114 | TH1F* dZvertices_; 115 | TH1F* Zvertices_; 116 | 117 | 118 | // --------------------------------------------------------------------------------------- 119 | // - Function to decide to include/exclude event based on the vectors passed for triggers 120 | bool includeEvent(int* triggers, 121 | int numTriggers, 122 | std::vector > includeVector, 123 | std::vector > excludeVector) 124 | { 125 | bool keepEvent = false; 126 | if(includeVector.size()==0) keepEvent = true; 127 | for (int ti = 0; ti < numTriggers; ++ti) { 128 | for(uint i=0; i!=includeVector.size();++i){ 129 | if(includeVector[i].size()==1 && triggers[ti]==includeVector[i][0]) keepEvent=true; 130 | else if(includeVector[i].size()==2 && (triggers[ti]>=includeVector[i][0] && triggers[ti]<=includeVector[i][1])) keepEvent=true; 131 | } 132 | } 133 | if(!keepEvent) 134 | return false; 135 | 136 | keepEvent = true; 137 | for (int ti = 0; ti < numTriggers; ++ti) { 138 | for(uint i=0; i!=excludeVector.size();++i){ 139 | if(excludeVector[i].size()==1 && triggers[ti]==excludeVector[i][0]) keepEvent=false; 140 | else if(excludeVector[i].size()==2 && (triggers[ti]>=excludeVector[i][0] && triggers[ti]<=excludeVector[i][1])) keepEvent=false; 141 | } 142 | } 143 | 144 | return keepEvent; 145 | } 146 | 147 | // --------------------------------------------------------------------------------------- 148 | // ------- Function to decide to include/exclude event based on the vectors passed ------- 149 | bool includeEvent(double eventParameter, 150 | std::vector > includeVector, 151 | std::vector > excludeVector) 152 | { 153 | bool keepEvent = false; 154 | if(includeVector.size()==0) keepEvent = true; 155 | for(uint i=0; i!=includeVector.size();++i){ 156 | if(includeVector[i].size()==1 && eventParameter==includeVector[i][0]) 157 | keepEvent=true; 158 | else if(includeVector[i].size()==2 && (eventParameter>=includeVector[i][0] && eventParameter<=includeVector[i][1])) 159 | keepEvent=true; 160 | } 161 | if(!keepEvent) // if it's not in our include list, skip it 162 | return false; 163 | 164 | keepEvent = true; 165 | for(uint i=0; i!=excludeVector.size();++i){ 166 | if(excludeVector[i].size()==1 && eventParameter==excludeVector[i][0]) 167 | keepEvent=false; 168 | else if(excludeVector[i].size()==2 && (eventParameter>=excludeVector[i][0] && eventParameter<=excludeVector[i][1])) 169 | keepEvent=false; 170 | } 171 | 172 | return keepEvent; // if someone includes and excludes, exseedion will overrule 173 | 174 | } 175 | 176 | 177 | 178 | // --------------------------------------------------------------------------------------- 179 | // ------------------ Function to split arg input lists by comma ------------------------- 180 | std::vector split(std::string msg, std::string separator) 181 | { 182 | boost::char_separator sep(separator.c_str()); 183 | boost::tokenizer > tok(msg, sep ); 184 | std::vector token; 185 | for ( boost::tokenizer >::const_iterator i = tok.begin(); i != tok.end(); ++i ) { 186 | token.push_back(std::string(*i)); 187 | } 188 | return token; 189 | } 190 | 191 | 192 | // --------------------------------------------------------------------------------------- 193 | // ------------------ Function to generate include/exclude vectors ----------------------- 194 | void genIncludeExcludeVectors(std::string optionString, 195 | std::vector >& includeVector, 196 | std::vector >& excludeVector) 197 | { 198 | std::vector rangeStringVector; 199 | std::vector rangeIntVector; 200 | 201 | if(optionString != "-1"){ 202 | std::vector stringVector = split(optionString,",") ; 203 | 204 | for (uint i=0 ; i list of input files" << std::endl ; 265 | std::cout << " --eTGammaMinEB: min eT for EB gammas" << std::endl; 266 | std::cout << " --s4s9GammaMinEB: min EB shower shape" << std::endl; 267 | std::cout << " --eTPi0MinEB min eT for EB pi0 candidate" << std::endl; 268 | std::cout << " --eTGammaMinEE: min eT for EE gammas" << std::endl; 269 | std::cout << " --s4s9GammaMinEE: min EE shower shape" << std::endl; 270 | std::cout << " --eTPi0MinEE: min eT for EE pi0 candidate" << std::endl; 271 | std::cout << " --minAOverSigma: min ampli considered for time" << std::endl; 272 | std::cout << " --minRun: lowest run number considered" << std::endl; 273 | std::cout << " --maxRun: highest run number considered" << std::endl; 274 | std::cout << " --minLS: lowest lumi section number considered" << std::endl; 275 | std::cout << " --maxLS: highest lumi section number considered" << std::endl; 276 | std::cout << " --vertex: require vertex@IP (1), veto it (2) or either (0, or unset)" << std::endl; 277 | std::cout << " --trig: L1 triggers to include (exclude with x)" << std::endl; 278 | std::cout << " --techTrig: L1 technical triggers to include (exclude with x)" << std::endl; 279 | exit(1); } 280 | 281 | 282 | else if (argv[v] == stringNumEvents) { // set number of events 283 | std::cout << "events number" << std::endl; 284 | numEvents_=atoi(argv[v+1]); 285 | v++; 286 | } 287 | else if (argv[v] == stringMaxLS) { // set last LS of interval to be considered 288 | std::cout << "max LS number" << std::endl; 289 | maxLS_=atoi(argv[v+1]); 290 | v++; 291 | } 292 | else if (argv[v] == stringMinLS) { // set first LS of interval to be considered 293 | std::cout << "min LS number" << std::endl; 294 | minLS_=atoi(argv[v+1]); 295 | v++; 296 | } 297 | else if (argv[v] == stringMaxRun) { // set last run of interval to be considered 298 | std::cout << "max LS number" << std::endl; 299 | maxRun_=atoi(argv[v+1]); 300 | v++; 301 | } 302 | else if (argv[v] == stringMinRun) { // set first run of interval to be considered 303 | std::cout << "min run number" << std::endl; 304 | minRun_=atoi(argv[v+1]); 305 | v++; 306 | } 307 | else if (argv[v] == stringETGammaMinEB) { // choose et cut for EB single cluster 308 | eTGammaMinEB_ = atof(argv[v+1]); 309 | v++; 310 | } 311 | else if (argv[v] == strings4s9GammaMinEB) { // choose cut for EB shower shape 312 | s4s9GammaMinEB_ = atof(argv[v+1]); 313 | v++; 314 | } 315 | else if (argv[v] == stringeTPi0MinEB) { // choose et cut for EB pi0 candidate 316 | eTPi0MinEB_ = atof(argv[v+1]); 317 | v++; 318 | } 319 | else if (argv[v] == stringETGammaMinEE) { // choose et cut for EE single cluster 320 | eTGammaMinEE_ = atof(argv[v+1]); 321 | v++; 322 | } 323 | else if (argv[v] == strings4s9GammaMinEE) { // choose cut for EE shower shape 324 | s4s9GammaMinEE_ = atof(argv[v+1]); 325 | v++; 326 | } 327 | else if (argv[v] == stringeTPi0MinEE) { // choose et cut for EE pi0 candidate 328 | eTPi0MinEE_ = atof(argv[v+1]); 329 | v++; 330 | } 331 | else if (argv[v] == stringOutFileName) { // set output file 332 | outputRootName_ = argv[v+1]; 333 | v++; 334 | } 335 | else if (argv[v] == stringminAmpliOverSigma) { // set min amplitude considered for time measurement 336 | /* 337 | * minAmpliOverSigma_ = atof(argv[v+1]); 338 | */ 339 | v++ ; 340 | } 341 | else if (argv[v] == vertex) { // collect requirement for one vertex only or not 342 | flagOneVertex_ = atof(argv[v+1]); 343 | if (flagOneVertex_!=0 && flagOneVertex_!=1 && flagOneVertex_!=2){ 344 | std::cout << "Not a valid value for flagOneVertex_ (0,1,2). Returning." << std::endl; 345 | exit (1);} 346 | v++; 347 | } 348 | else if (argv[v] == stringTriggers) { // set L1 triggers to include/exclude 349 | genIncludeExcludeVectors(std::string(argv[v+1]),trigIncludeVector,trigExcludeVector); 350 | v++; 351 | } 352 | else if (argv[v] == stringTechTriggers) { // set L1 technical triggers to include/exclude 353 | genIncludeExcludeVectors(std::string(argv[v+1]),ttrigIncludeVector,ttrigExcludeVector); 354 | v++; 355 | } 356 | // handle here the case of multiple arguments for input files 357 | else if (argv[v] == stringInputFileName){// && v<(argc-1) ) 358 | 359 | for (int u=v+1; u& td,const std::string&); 389 | void book(TFileDirectory subDir,const std::string&); 390 | 391 | // fill all histos of the set with the two electron candidates 392 | void fill(int sc1, int sc2, int cl1, int cl2); 393 | 394 | TH1 * nVertices_; 395 | TH1F* mass_; 396 | TH1F* dZvertices_; 397 | TH1F* Zvertices_; 398 | TH1F* chi2_; 399 | TH1F* seedTime_; 400 | TH1F* secondTime_; 401 | TH1F* clusterTime_; 402 | TH1F* seedTimeDiffHist_; 403 | TH1F* TOFcorrections_; 404 | TH2F* TOFcorrectionsVSdeltaEta_; 405 | TH2F* clusTimeDiffHistTOFVSdeltaEtaRightVertex_, *clusTimeDiffHistTOFVSdeltaEtaWrongVertex_; 406 | TH1F* tColl_; 407 | TH2F* tCollVSdeltaEtaRightVertex_, * tCollVStimeDiffHistTOF_; 408 | TH1F* seedTimeDiffHistTOF_; 409 | TH1F* secondTimeDiffHist_; 410 | TH1F* secondTimeDiffHistTOF_; 411 | TH1F* clusTimeDiffHist_; 412 | TH1F* clusTimeDiffHistTOF_, *clusTimeDiffHistTOFwrongVertex_; 413 | TH1F* numCryBC1, *numCryBC2; 414 | TH2F* timeVsEtaLead_, *timeVsEtaSub_, *timeVsEta_, *outliersVsEtaPhi_,*timeVsPhi_; 415 | TH1F* seedAmpli_; 416 | TH1F* secondAmpli_; 417 | TH1F* diffSeedOther_, *diffSeedOtherOverErr_; 418 | TH1F* diffSeedSecond_, *diffSeedSecondOverErr_; 419 | TH2F* seedVSSecond_; 420 | 421 | TH1F* eta1_; 422 | TH1F* phi1_; 423 | TH1F* eta2_; 424 | TH1F* phi2_; 425 | TH1F* e1pt_; 426 | TH1F* e2pt_; 427 | TH1F* e1E_; 428 | TH1F* e2E_; 429 | 430 | } theHists; 431 | 432 | 433 | void HistSet::book(TFileDirectory subDir, const std::string& post) { 434 | 435 | 436 | eta1_ =(TH1F*) subDir.make("eta1","eta1",100, eta1_max, eta1_min); 437 | phi1_ =(TH1F*) subDir.make("phi1","phi1",100,phi1_max,phi1_min); 438 | eta2_ =(TH1F*) subDir.make("eta2","eta2",100, eta2_max, eta2_min); 439 | phi2_ =(TH1F*) subDir.make("phi2","phi2",100,phi2_max,phi2_min); 440 | e1pt_ =(TH1F*) subDir.make("e1pt","e1pt", 120, 0, 120); 441 | e2pt_ =(TH1F*) subDir.make("e2pt","e2pt", 120, 0, 120); 442 | e1E_ =(TH1F*) subDir.make("e1E","e1E", 300, 0, 300); 443 | e2E_ =(TH1F*) subDir.make("e2E","e2E", 300, 0, 300); 444 | 445 | 446 | nVertices_=subDir.make("num vertices","num vertices; num vertices",41,-0.5,40.5); 447 | mass_ =(TH1F*) subDir.make("mass","mass; m(ele,ele) [GeV]",80,50,130); 448 | dZvertices_ =(TH1F*) subDir.make("dZvertices","dZvertices; #DeltaZ(ele_{1},ele_{2}) [cm]",250,0,25); 449 | Zvertices_ =(TH1F*) subDir.make("Zvertices","Zvertices; z vertex [cm]",250,-25,25); 450 | 451 | // Initialize histograms -- xtals 452 | chi2_ =(TH1F*) subDir.make("cluster chi2 ","cluster chi2 ; #chi^{2}",100,0,10); 453 | 454 | seedTime_ =(TH1F*) subDir.make("seed time","seed time; t_{seed} [ns]; num. seeds/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 455 | secondTime_ =(TH1F*) subDir.make("second time","second time; t_{second} [ns]; num. secs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 456 | clusterTime_ =(TH1F*) subDir.make("cluster time","cluster time; t_{cluster} [ns]; num. clusters/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 457 | 458 | 459 | TOFcorrections_ = (TH1F*) subDir.make("TOF difference","TOF difference; #Delta TOF [ns]; num. seeds/0.05ns",binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 460 | TOFcorrectionsVSdeltaEta_=(TH2F*) subDir.make("TOF corrections VS #Delta#eta","TOF corrections VS #Delta#eta; #Delta#eta; #Delta TOF [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 461 | clusTimeDiffHistTOFVSdeltaEtaRightVertex_=(TH2F*) subDir.make("TOF-corr cluster time difference VS #Delta#eta RightVertex","TOF-corr cluster time difference VS #Delta#eta RightVertex; |#Delta#eta|; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 462 | clusTimeDiffHistTOFVSdeltaEtaWrongVertex_=(TH2F*) subDir.make("TOF-corr cluster time difference VS #Delta#eta WrongVertex","TOF-corr cluster time difference VS #Delta#eta WrongVertex; |#Delta#eta|; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 463 | 464 | tCollVSdeltaEtaRightVertex_=(TH2F*) subDir.make("t_{coll} VS #Delta#eta RightVertex","t_{coll} VS #Delta#eta RightVertex; |#Delta#eta|; t_{coll} [ns]; ",30,0,3.,binsTDistro_,-rangeTDistro_/4.,rangeTDistro_/4.); 465 | tCollVStimeDiffHistTOF_=(TH2F*) subDir.make("TOF-corrected: (t_{clus1} + t_{clus2})/2 VS (t_{clus1} - t_{clus2})/2","TOF-corrected: (t_{clus1} + t_{clus2})/2 VS (t_{clus1} - t_{clus2})/2 [ns]; (t_{clus1} - t_{clus2})/2 ; (t_{clus1} + t_{clus2})/2 VS [ns]; ",binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.,binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 466 | 467 | 468 | seedTimeDiffHist_ =(TH1F*) subDir.make("time difference of seeds","seeds time difference; t_{seed1} - t_{seed2} [ns]; num. seed pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 469 | seedTimeDiffHistTOF_ =(TH1F*) subDir.make("TOF-corr time difference of seeds","TOF-corr seed time difference; (t_{seed1} - t_{seed2}) TOF-corrected [ns]; num. seed pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 470 | 471 | secondTimeDiffHist_ =(TH1F*) subDir.make("time difference of seconds","second time difference; t_{second1} - t_{second2} [ns]; num. seed pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_);//GF new 472 | secondTimeDiffHistTOF_ =(TH1F*) subDir.make("TOF-corr time difference of seconds","TOF-corr seconds time difference; (t_{second1} - t_{second2}) TOF-corrected [ns]; num. sec pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 473 | 474 | clusTimeDiffHist_ =(TH1F*) subDir.make("cluster time difference","cluster time difference; t_{clus1} - t_{clus2} [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 475 | clusTimeDiffHistTOF_ =(TH1F*) subDir.make("TOF-corr cluster time difference","TOF-corr cluster time difference; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 476 | // clusTimeDiffHistTOFwrongVertex_ =(TH1F*) subDir.make("TOF-corr cluster time difference","TOF-corr cluster time difference; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 477 | clusTimeDiffHistTOFwrongVertex_=(TH1F*) subDir.make("TOF-corr cluster time difference wrong vertex","TOF-corr cluster time difference wronge vertex; (t_{clus1} - t_{clus2}) TOF-corrected [ns]; num. cluster pairs/0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 478 | 479 | tColl_=(TH1F*) subDir.make("t_{coll}","t_{coll} [ns]; (t_{clus1} + t_{clus2})/2 [ns]",binsTDistro_,-rangeTDistro_/2.,rangeTDistro_/2.); 480 | 481 | 482 | numCryBC1 =(TH1F*) subDir.make("num cry in bc1","num cry in bc1; num cry",25,0,25); 483 | numCryBC2 =(TH1F*) subDir.make("num cry in bc2","num cry in bc2; num cry",25,0,25); 484 | timeVsEta_ =(TH2F*) subDir.make("timeVsEta","timeVsEta;#eta; time [ns]",100,-3.5,3.5,100,-10.0,10.0); 485 | timeVsEtaLead_ =(TH2F*) subDir.make("timeVsEtaLead","timeVsEtaLead;#eta_{lead}; t [ns]",50,-2.5,2.5,150,-1.5,1.5); 486 | timeVsEtaSub_ =(TH2F*) subDir.make("timeVsEtaSub","timeVsEtaSub; #eta_{sublead}; t [ns]",50,-2.5,2.5,150,-1.5,1.5); 487 | outliersVsEtaPhi_ =(TH2F*) subDir.make("outliersVsEtaPhi","outliersVsEtaPhi; #eta; #phi",50,-2.5,2.5,72,-3.14,3.14); 488 | timeVsPhi_ =(TH2F*) subDir.make("timeVsPhi","timeVsPhi; #phi; time [ns]",100,-3.5,3.5,100,-10.0,10.0); 489 | seedAmpli_ =(TH1F*) subDir.make("E(seed) ","E(seed) ; E [GeV]",130,0,130); 490 | secondAmpli_ =(TH1F*) subDir.make("E(second) ","E(second) ; E [GeV]",130,0,130); 491 | diffSeedOther_ =(TH1F*) subDir.make("t_{seed}-t_{others}","t_{seed}-t_{others}; t_{seed}-t_{others} [ns]; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 492 | diffSeedOtherOverErr_ =(TH1F*) subDir.make("(t_{seed}-t_{others})/#sigma","(t_{seed}-t_{others})/#sigma; (t_{seed}-t_{others})/#sigma; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 493 | 494 | diffSeedSecond_ =(TH1F*) subDir.make("t_{seed}-t_{second}","t_{seed}-t_{second}; t_{seed}-t_{second} [ns]; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 495 | diffSeedSecondOverErr_ =(TH1F*) subDir.make("(t_{seed}-t_{second})/#sigma","(t_{seed}-t_{second})/#sigma; (t_{seed}-t_{second})/#sigma; num./0.05ns",binsTDistro_,-rangeTDistro_,rangeTDistro_); 496 | seedVSSecond_ =(TH2F*) subDir.make("t_{seed} VS t_{second}","t_{seed} VS t_{second}; t_{seed} [ns]; t_{second} [ns]",75,-1.5,1.5,75,-1.5,1.5); 497 | 498 | } 499 | 500 | void HistSet::fill(int sc1, int sc2, int bc1, int bc2 ){ 501 | 502 | float et1 = treeVars_.superClusterRawEnergy[sc1]/cosh( treeVars_.superClusterEta[sc1] ); 503 | math::PtEtaPhiELorentzVectorD el1(et1 , 504 | treeVars_.superClusterEta[sc1], 505 | treeVars_.superClusterPhi[sc1], 506 | treeVars_.superClusterRawEnergy[sc1] ); 507 | float et2 = treeVars_.superClusterRawEnergy[sc2]/cosh( treeVars_.superClusterEta[sc2] ); 508 | math::PtEtaPhiELorentzVectorD el2(et2 , 509 | treeVars_.superClusterEta[sc2], 510 | treeVars_.superClusterPhi[sc2], 511 | treeVars_.superClusterRawEnergy[sc2] ); 512 | math::PtEtaPhiELorentzVectorD diEle = el1; 513 | diEle += el2; 514 | 515 | 516 | /////////////////////////// 517 | 518 | eta1_ ->Fill(treeVars_.superClusterEta[sc1]); 519 | eta2_ ->Fill(treeVars_.superClusterEta[sc2]); 520 | phi1_ ->Fill(treeVars_.superClusterPhi[sc1]); 521 | phi2_ ->Fill(treeVars_.superClusterPhi[sc2]); 522 | e1pt_ ->Fill(et1); 523 | e2pt_ ->Fill(et2); 524 | e1E_ ->Fill(treeVars_.superClusterRawEnergy[sc1]); 525 | e2E_ ->Fill(treeVars_.superClusterRawEnergy[sc2]); 526 | 527 | 528 | // //////////////////////// 529 | mass_ ->Fill(diEle.M()); 530 | float dvertex = pow(treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2],2); 531 | //dvertex += pow(treeVars_.superClusterVertexY[sc1]-treeVars_.superClusterVertexY[sc2],2); 532 | //dvertex += pow(treeVars_.superClusterVertexX[sc1]-treeVars_.superClusterVertexX[sc2],2); 533 | dvertex = sqrt(dvertex); 534 | dZvertices_->Fill(dvertex); 535 | Zvertices_->Fill( (treeVars_.superClusterVertexZ[sc1]+treeVars_.superClusterVertexZ[sc2])/2 ); 536 | nVertices_->Fill(treeVars_.nVertices); 537 | 538 | ClusterTime bcTime1 = timeAndUncertSingleCluster(bc1,treeVars_); 539 | ClusterTime bcTime2 = timeAndUncertSingleCluster(bc2,treeVars_); 540 | 541 | TOFcorrections_ -> Fill(extraTravelTime(sc2,treeVars_) - extraTravelTime(sc1,treeVars_) ); 542 | TOFcorrectionsVSdeltaEta_ -> Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , extraTravelTime(sc2,treeVars_) - extraTravelTime(sc1,treeVars_) ); 543 | 544 | int vtxOfThisEle=-99; 545 | // look for the vertex which electrons are attached to: 546 | for(int u=0; u-99){ 553 | 554 | for(int u=0; u Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , 557 | (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) 558 | //(bcTime1.time-extraTravelTime(sc1,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,treeVars_)) 559 | ); 560 | 561 | tCollVSdeltaEtaRightVertex_-> Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , 562 | ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) + (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. 563 | ); 564 | tCollVStimeDiffHistTOF_ -> Fill( ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. , 565 | ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) + (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. 566 | ); 567 | tColl_ -> Fill( ( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) + (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) ) /2. ); 568 | 569 | }// if correct vertex 570 | else { 571 | clusTimeDiffHistTOFVSdeltaEtaWrongVertex_ -> Fill( fabs(treeVars_.superClusterEta[sc2]-treeVars_.superClusterEta[sc1]) , 572 | (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_)) 573 | //(bcTime1.time-extraTravelTime(sc1,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,treeVars_)) 574 | ); 575 | clusTimeDiffHistTOFwrongVertex_ -> Fill( (bcTime1.time-extraTravelTime(sc1,u,treeVars_)) - (bcTime2.time-extraTravelTime(sc2,u,treeVars_) )); 576 | }// if wrong vertex 577 | }//loop on vertices 578 | 579 | } // if vertex matching succeeded 580 | // else std::cout << "vertex was not found which matches electrons track... " << std::endl; 581 | 582 | chi2_->Fill(bcTime1.chi2); chi2_->Fill(bcTime2.chi2); 583 | 584 | // take care of the seeds 585 | seedTime_ -> Fill(bcTime1.seedtime); seedTime_->Fill(bcTime2.seedtime); 586 | seedTimeDiffHist_ -> Fill( bcTime1.seedtime - bcTime2.seedtime ); 587 | seedTimeDiffHistTOF_ -> Fill( (bcTime1.seedtime-extraTravelTime(sc1,treeVars_)) - (bcTime2.seedtime-extraTravelTime(sc2,treeVars_)) ); 588 | 589 | // take care of the second-highest amplitude crystal 590 | if(bcTime1.second>-1) secondAmpli_->Fill(treeVars_.xtalInBCEnergy[bc1][bcTime1.second]); // check that there's crystals beyond seed 591 | else secondAmpli_->Fill(0); 592 | if(bcTime2.second>-1) secondAmpli_->Fill(treeVars_.xtalInBCEnergy[bc2][bcTime2.second]); 593 | else secondAmpli_->Fill(0); 594 | if(bcTime1.second>-1 && bcTime2.second>-1){ 595 | secondTime_ -> Fill( bcTime1.secondtime); secondTime_->Fill(bcTime2.secondtime); 596 | secondTimeDiffHist_ -> Fill( bcTime1.secondtime - bcTime2.secondtime ); 597 | secondTimeDiffHistTOF_ -> Fill( (bcTime1.secondtime-extraTravelTime(sc1,treeVars_)) - (bcTime2.secondtime-extraTravelTime(sc2,treeVars_)) ); 598 | } 599 | 600 | 601 | clusterTime_ -> Fill(bcTime1.time); clusterTime_ ->Fill(bcTime2.time); 602 | clusTimeDiffHist_ -> Fill(bcTime1.time - bcTime2.time ); 603 | clusTimeDiffHistTOF_ -> Fill( (bcTime1.time - extraTravelTime(sc1,treeVars_) ) - (bcTime2.time -extraTravelTime(sc2,treeVars_)) ); 604 | 605 | seedAmpli_->Fill(treeVars_.xtalInBCEnergy[bc1][bcTime1.seed]); 606 | seedAmpli_->Fill(treeVars_.xtalInBCEnergy[bc2][bcTime2.seed]); 607 | 608 | // std::cout << "otherstime: " << bcTime1.otherstime << "\t" << bcTime2.otherstime << std::endl; 609 | // std::cout << "seedtime: " << bcTime1.seedtime << "\t" << bcTime2.seedtime << std::endl; 610 | if(bcTime1.otherstime>-999) // check that there's crystals beyond seed 611 | { 612 | diffSeedOther_ -> Fill(bcTime1.seedtime-bcTime1.otherstime); 613 | diffSeedOtherOverErr_->Fill( (bcTime1.seedtime-bcTime1.otherstime) / sqrt( pow(treeVars_.xtalInBCTimeErr[bc1][bcTime1.seed],2) -0.6*0.6+timingResParamConstEB*timingResParamConstEB + pow(bcTime1.otherstimeErr,2)) ); 614 | diffSeedSecond_ -> Fill(bcTime1.seedtime-treeVars_.xtalInBCTime[bc1][bcTime1.second]); 615 | seedVSSecond_ -> Fill(treeVars_.xtalInBCTime[bc1][bcTime1.second],bcTime1.seedtime); 616 | diffSeedSecondOverErr_ -> Fill( (bcTime1.seedtime-treeVars_.xtalInBCTime[bc1][bcTime1.second]) 617 | / sqrt( pow(treeVars_.xtalInBCTimeErr[bc1][bcTime1.seed],2) 618 | + pow(treeVars_.xtalInBCTimeErr[bc1][bcTime1.second],2) 619 | - 2* 0.6*0.6 + 2*timingResParamConstEB*timingResParamConstEB 620 | ) 621 | ); 622 | } 623 | if(bcTime2.otherstime>-999) // check that there's crystals beyond seed 624 | { 625 | diffSeedOther_ -> Fill(bcTime2.seedtime-bcTime2.otherstime); 626 | diffSeedOtherOverErr_ ->Fill( (bcTime2.seedtime-bcTime2.otherstime) / sqrt( pow(treeVars_.xtalInBCTime[bc2][bcTime2.seed],2) -0.6*0.6+timingResParamConstEB*timingResParamConstEB + pow(bcTime2.otherstimeErr,2)) ); 627 | diffSeedSecond_ -> Fill(bcTime2.seedtime-treeVars_.xtalInBCTime[bc2][bcTime2.second]); 628 | diffSeedSecondOverErr_ -> Fill( (bcTime2.seedtime-treeVars_.xtalInBCTime[bc2][bcTime2.second]) 629 | / sqrt( pow(treeVars_.xtalInBCTimeErr[bc2][bcTime2.seed],2) 630 | + pow(treeVars_.xtalInBCTimeErr[bc2][bcTime2.second],2) 631 | - 2* 0.6*0.6 + 2*timingResParamConstEB*timingResParamConstEB 632 | ) 633 | ); 634 | } 635 | 636 | numCryBC1->Fill(bcTime1.numCry); 637 | numCryBC2->Fill(bcTime2.numCry); 638 | timeVsEta_ -> Fill( treeVars_.superClusterEta[sc1] , (bcTime1.time - extraTravelTime(sc1,treeVars_) ) ); 639 | 640 | timeVsPhi_ -> Fill( treeVars_.superClusterPhi[sc1] , (bcTime1.time - extraTravelTime(sc1,treeVars_) ) ); 641 | 642 | timeVsEtaLead_ -> Fill( treeVars_.superClusterEta[sc1] , (bcTime1.time - extraTravelTime(sc1,treeVars_) ) ); 643 | timeVsEtaSub_ -> Fill( treeVars_.superClusterEta[sc2] , (bcTime2.time - extraTravelTime(sc2,treeVars_) ) ); 644 | // catch location of time outliers 645 | if ( fabs( (bcTime1.seedtime - extraTravelTime(sc1,treeVars_)) )>1.5 ) outliersVsEtaPhi_ -> Fill( treeVars_.superClusterEta[sc1] , treeVars_.superClusterPhi[sc1]); 646 | if ( fabs( (bcTime2.seedtime - extraTravelTime(sc2,treeVars_)) )>1.5 ) outliersVsEtaPhi_ -> Fill( treeVars_.superClusterEta[sc2] , treeVars_.superClusterPhi[sc2]); 647 | 648 | } 649 | // end HistSet::fill 650 | 651 | 652 | // --------------------------------------------------------------------------------------- 653 | // ------------------ Function to initialize the histograms ------------------------------ 654 | void initializeHists(TFileDirectory subDir){ 655 | 656 | mass_ = subDir.make("mass global","mass (global); m(ele,ele) [GeV]",80,50,130); 657 | dZvertices_ = subDir.make("dZvertices global","dZvertices (global); #DeltaZ(ele_{1},ele_{2}) [cm]",250,0,25); 658 | Zvertices_ = subDir.make("Zvertices global","Zvertices (global); z vertex [cm]",250,-25,25); 659 | nVertices_=subDir.make("num vertices global","num vertices (global); num vertices",41,-0.5,40.5); 660 | 661 | }//end initializeHists 662 | 663 | 664 | 665 | // --------------------------------------------------------------------------------------- 666 | // ------------------ func1 inside main ------------------------------ 667 | 668 | bool Within_Eta_Phi( int sc, int eta_min, int phi_min, int eta_max, int phi_max ) 669 | { 670 | bool event_selected = true; 671 | 672 | float eta = treeVars_.superClusterEta[sc]; 673 | if (eta < eta_min || eta > eta_max) event_selected = false; //... CHECK IF ETA IS WITHIN THE SPECIFIED RANGE ...\\ 674 | 675 | float phi = treeVars_.superClusterEta[sc]; 676 | if (phi < phi_min || phi > phi_max) event_selected = false; //... CHECK IF PHI IS WITHIN THE SPECIFIED RANGE ...\\ 677 | 678 | return event_selected; 679 | } 680 | 681 | //end func1 682 | 683 | 684 | 685 | // --------------------------------------------------------------------------------------- 686 | //! main program 687 | int main (int argc, char** argv) 688 | { 689 | // First parse arguments 690 | parseArguments(argc, argv); 691 | 692 | if (listOfFiles_.size()==0){ 693 | std::cout << "\tno input file found" << std::endl; 694 | return(1); 695 | } 696 | else{ 697 | std::cout << "\tfound " << listOfFiles_.size() << " input files: " << std::endl; 698 | for(std::vector::const_iterator file_itr=listOfFiles_.begin(); file_itr!=listOfFiles_.end(); file_itr++){ 699 | std::cout << "\t" << (*file_itr) << std::endl; 700 | } 701 | } 702 | 703 | // Tree construction 704 | // FIX should turn this string into a configurable 705 | TChain * chain = new TChain ("EcalTimeAnalysis") ; // ntuple producer in CMSSW CVS 706 | //TChain * chain = new TChain ("EcalTimePi0Analysis") ; // ntuple producer in UserCode/UMN space 707 | std::vector::const_iterator file_itr; 708 | for(file_itr=listOfFiles_.begin(); file_itr!=listOfFiles_.end(); file_itr++){ 709 | chain->Add( (*file_itr).c_str() ); 710 | } 711 | int nEntries = chain->GetEntries () ; 712 | if (numEvents_==-1) numEvents_ = nEntries; 713 | std::cout << "\n\tFOUND " << listOfFiles_.size() << " input files" << std::endl ; 714 | std::cout << "\n\tFOUND " << nEntries << " events" << std::endl ; 715 | std::cout << "\tWILL run on: " << numEvents_ << " events" << std::endl; 716 | std::cout << "\tOutput file: " << outputRootName_ << std::endl; 717 | std::cout << "\tminAOverSigma: " << minAmpliOverSigma_ << std::endl; 718 | std::cout << "\teTGammaMinEB: " << eTGammaMinEB_ << std::endl; 719 | std::cout << "\ts4s9GammaMinEB: " << s4s9GammaMinEB_ << std::endl; 720 | std::cout << "\teTPi0MinEB: " << eTPi0MinEB_ << std::endl; 721 | std::cout << "\teTGammaMinEE: " << eTGammaMinEE_ << std::endl; 722 | std::cout << "\ts4s9GammaMinEE: " << s4s9GammaMinEE_ << std::endl; 723 | std::cout << "\teTPi0MinEE: " << eTPi0MinEE_ << std::endl; 724 | std::cout << "\tminRun: " << minRun_ << std::endl; 725 | std::cout << "\tmaxRun: " << maxRun_ << std::endl; 726 | std::cout << "\tminLS: " << minLS_ << std::endl; 727 | std::cout << "\tmaxLS: " << maxLS_ << std::endl; 728 | 729 | setBranchAddresses (chain, treeVars_); 730 | 731 | // setting up the TFileService in the ServiceRegistry; 732 | edmplugin::PluginManager::Config config; 733 | edmplugin::PluginManager::configure(edmplugin::standard::config()); 734 | std::vector psets; 735 | edm::ParameterSet pSet; 736 | pSet.addParameter("@service_type",std::string("TFileService")); 737 | pSet.addParameter("fileName",std::string("TimePerf-plots.root")); // this is the file TFileService will write into 738 | psets.push_back(pSet); 739 | static edm::ServiceToken services(edm::ServiceRegistry::createSet(psets)); 740 | static edm::ServiceRegistry::Operate operate(services); 741 | edm::Service fs; 742 | 743 | TFileDirectory subDirECALECAL=fs->mkdir("ECALECAL"); 744 | HistSet plotsECALECAL; 745 | plotsECALECAL.book(subDirECALECAL,std::string("ECALECAL")); 746 | 747 | TFileDirectory subDirEBEB=fs->mkdir("EBEB"); 748 | HistSet plotsEBEB; 749 | plotsEBEB.book(subDirEBEB,std::string("EBEB")); 750 | 751 | TFileDirectory subDirEEEE=fs->mkdir("EEEE"); 752 | HistSet plotsEEEE; 753 | plotsEEEE.book(subDirEEEE,std::string("EEEE")); 754 | 755 | TFileDirectory subDirEBEE=fs->mkdir("EBEE"); 756 | HistSet plotsEBEE; 757 | plotsEBEE.book(subDirEBEE,std::string("EBEE")); 758 | 759 | TFileDirectory subDirEBEBequalShare=fs->mkdir("EBEBequalShare"); 760 | HistSet plotsEBEBequalShare; 761 | plotsEBEBequalShare.book(subDirEBEBequalShare,std::string("EBEBequalShare")); 762 | 763 | TFileDirectory subDirEBEBunevenShare=fs->mkdir("EBEBunevenShare"); 764 | HistSet plotsEBEBunevenShare; 765 | plotsEBEBunevenShare.book(subDirEBEBunevenShare,std::string("EBEBunevenShare")); 766 | 767 | timeCorrector theCorr; 768 | std::cout << "\ncreated object theCorr to be used for timeVsAmpliCorrections" << std::endl; 769 | std::cout << "\ninitializing theCorr" << std::endl; 770 | //theCorr.initEB( std::string("EBmod4") ); 771 | //theCorr.initEE( std::string("EElow") ); 772 | theCorr.initEB( "EB" ); 773 | theCorr.initEE( "EE" ); 774 | 775 | 776 | //Initialize output root file 777 | //saving_ = new TFile(outputRootName_.c_str (),"recreate"); 778 | 779 | // Initialize the histograms 780 | TFileDirectory subDirGeneral=fs->mkdir("General"); 781 | initializeHists(subDirGeneral); 782 | 783 | int eventCounter = 0; 784 | ///////////////////////////////////////////////////// 785 | // Main loop over entries 786 | for (int entry = 0 ; (entry < nEntries && eventCounter < numEvents_); ++entry) 787 | { 788 | chain->GetEntry (entry) ; 789 | // Keep the event? 790 | bool keepEvent = includeEvent(treeVars_.l1ActiveTriggers, 791 | treeVars_.l1NActiveTriggers,trigIncludeVector,trigExcludeVector) 792 | && includeEvent(treeVars_.l1ActiveTechTriggers, 793 | treeVars_.l1NActiveTechTriggers,ttrigIncludeVector,ttrigExcludeVector); 794 | if(!keepEvent) 795 | continue; 796 | 797 | 798 | // do analysis if the run is in the desired range 799 | if( treeVars_.runId0 && count==treeVars_.nVertices ) verticesAreOnlyNextToNominalIP = true; 811 | else verticesAreOnlyNextToNominalIP = false; 812 | 813 | // --vertex: require vertex@IP (1), veto it (2) or either (0, or unset) 814 | if (flagOneVertex_ ==1 && (!verticesAreOnlyNextToNominalIP) ) continue; 815 | if (flagOneVertex_ ==2 && (verticesAreOnlyNextToNominalIP) ) continue; 816 | 817 | // if evet being actually processed, increment counter of analyzed events 818 | eventCounter++; 819 | 820 | speak_=false; 821 | if (entry<10 || entry%10000==0) speak_=true; 822 | 823 | if (speak_) std::cout << "\n\n------> reading entry " << entry << "\tLS: " << treeVars_.lumiSection << " <------\n" ; 824 | if (speak_) std::cout << " found " << treeVars_.nSuperClusters << " superclusters" << std::endl ; 825 | if (speak_) std::cout << " found " << treeVars_.nClusters << " basic clusters" << std::endl ; 826 | 827 | 828 | /////////////////////////////////////////////////////////////////////// 829 | // outer loop on supercluster 830 | for (int sc1=0; sc1Fill(diEle.M()); 867 | dZvertices_->Fill(dvertex); 868 | Zvertices_->Fill( (treeVars_.superClusterVertexZ[sc1]-treeVars_.superClusterVertexZ[sc2])/2 ); 869 | nVertices_->Fill(treeVars_.nVertices); 870 | 871 | // require invariant mass 872 | //if( fabs( diEle.M() - 91 ) > 20 ) continue; 873 | if( fabs( diEle.M() - 91 ) > 40 ) continue; 874 | // require two electrons from the same vertex 875 | //if ( dvertex > 0.01 ) continue; 876 | if ( dvertex > 0.1 ) continue; 877 | 878 | if(0) std::cout << "di-electron system mass: " << diEle.M() << " vertex distance: " << dvertex << std::endl; 879 | 880 | // at this stage I have a suitable di-electron system for time studies 881 | 882 | float tmpEne=-9999; 883 | // loop on BC and match to sc1 =============== 884 | int bc1=-1; 885 | for (int bc=0; bctmpEne) { 888 | tmpEne=treeVars_.clusterEnergy[bc]; 889 | bc1=bc; 890 | }// end - if good bc candidate 891 | }// end - loop over BC 892 | 893 | 894 | tmpEne=-9999; 895 | // loop on BC and match to sc2 ============== 896 | int bc2=-1; 897 | for (int bc=0; bctmpEne) { 900 | tmpEne=treeVars_.clusterEnergy[bc]; 901 | bc2=bc; 902 | }// end - if good bc candidate 903 | }// end - loop over BC 904 | 905 | // protect in case of no matching 906 | if(bc1==-1 || bc2==-1) continue; 907 | if(0) { 908 | std::cout << "\n\nsc1 : " << treeVars_.superClusterEta[sc1] << " " << treeVars_.superClusterPhi[sc1] << " " << treeVars_.superClusterRawEnergy[sc1] << std::endl; 909 | std::cout << "bc1 : " << treeVars_.clusterEta[bc1] << " " << treeVars_.clusterPhi[bc1] << " " << treeVars_.clusterEnergy[bc1] << "\n"<< std::endl; 910 | std::cout << "sc2 : " << treeVars_.superClusterEta[sc2] << " " << treeVars_.superClusterPhi[sc2] << " " << treeVars_.superClusterRawEnergy[sc2] << std::endl; 911 | std::cout << "bc2 : " << treeVars_.clusterEta[bc2] << " " << treeVars_.clusterPhi[bc2] << " " << treeVars_.clusterEnergy[bc2] << std::endl; 912 | } 913 | 914 | ClusterTime bcTime1 = timeAndUncertSingleCluster(bc1,treeVars_); 915 | ClusterTime bcTime2 = timeAndUncertSingleCluster(bc2,treeVars_); 916 | 917 | if(! (bcTime1.isvalid && bcTime2.isvalid) ) continue; 918 | 919 | // fill the structures which hold all the plots 920 | plotsECALECAL.fill(sc1,sc2, bc1,bc2); 921 | if ( fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])<1.4 ){ 922 | plotsEBEB.fill(sc1,sc2, bc1,bc2); 923 | 924 | float energyRatio1 = treeVars_.xtalInBCEnergy[bc1][bcTime1.seed]; 925 | if(bcTime1.second>-1) {energyRatio1 /= treeVars_.xtalInBCEnergy[bc1][bcTime1.second]; } 926 | else { energyRatio1 /= 99999; } 927 | float energyRatio2 = treeVars_.xtalInBCEnergy[bc2][bcTime2.seed]; 928 | if(bcTime2.second>-1) {energyRatio2 /= treeVars_.xtalInBCEnergy[bc2][bcTime2.second]; } 929 | else { energyRatio2 /= 99999; } 930 | 931 | float minRatio = 0.7; float maxRatio = 1.3; 932 | if(minRatio1.5 && fabs(treeVars_.clusterEta[bc2])>1.5 ) plotsEEEE.fill(sc1,sc2, bc1,bc2); 939 | else if ( (fabs(treeVars_.clusterEta[bc1])<1.4 && fabs(treeVars_.clusterEta[bc2])>1.5) || 940 | (fabs(treeVars_.clusterEta[bc1])>1.5 && fabs(treeVars_.clusterEta[bc2])<1.4) ) plotsEBEE.fill(sc1,sc2, bc1,bc2); 941 | 942 | // if I've found a pair of supercluster, bail out of loop to repeat using twice the same supercluster 943 | break; 944 | 945 | }// end loop sc2 946 | }// end loop sc1 947 | 948 | } // end of loop over entries 949 | 950 | 951 | delete chain ; 952 | 953 | return 0 ; 954 | } 955 | --------------------------------------------------------------------------------