ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/src/ClusterAnalyzer.cc
Revision: 1.1
Committed: Mon May 19 16:12:28 2008 UTC (16 years, 11 months ago) by mlethuil
Content type: text/plain
Branch: MAIN
CVS Tags: cmssw_1_6_12
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 mlethuil 1.1 #include "UserCode/Morgan/interface/ClusterAnalyzer.h"
2    
3     using namespace std;
4     using namespace reco;
5     using namespace edm;
6    
7     ClusterAnalyzer::ClusterAnalyzer():verbosity(0),iClus(0)
8     {
9     }
10     ClusterAnalyzer::~ClusterAnalyzer()
11     {
12     }
13    
14     void ClusterAnalyzer::Process(const edm::Event& iEvent, TRootEvent* rootEvent, TClonesArray* rootClusters, const string moduleLabel, const string instanceName, const string shapesName, const int clusterType)
15     {
16    
17     if(verbosity>1) cout << "ClusterAnalyzer Collection name: " << moduleLabel << " : " << instanceName << " using shapes:" << shapesName << endl;
18    
19     edm::Handle<reco::BasicClusterCollection> basicClustersHandle;
20     iEvent.getByLabel(moduleLabel, instanceName, basicClustersHandle);
21     const reco::BasicClusterCollection basicClusters = *(basicClustersHandle.product());
22    
23     edm::Handle<reco::ClusterShapeCollection> basicClustersShapesHandle;
24     iEvent.getByLabel(moduleLabel, shapesName, basicClustersShapesHandle);
25     const reco::ClusterShapeCollection basicClustersShapes = *(basicClustersShapesHandle.product());
26    
27     //edm::Handle<reco::BasicClusterShapeAssociationCollection> bcShapesHandle;
28     //iEvent.getByLabel("islandBasicClusters:islandEndcapShapeAssoc", bcShapesHandle);
29     //reco::BasicClusterShapeAssociationCollection::const_iterator seedShpItr;
30    
31     if(verbosity>1) std::cout << "Number of BasicClusters of type " << clusterType << " in the event: " << basicClusters.size() << std::endl;
32    
33     Int_t iClusType=0;
34    
35     for( reco::BasicClusterCollection::const_iterator aClus = basicClusters.begin(); aClus != basicClusters.end(); aClus++)
36     {
37     //reco::BasicCluster localClus(*aClus);
38     TRootCluster localClus( aClus->energy(), aClus->eta(), aClus->phi(), aClus->x(), aClus->y(), aClus->z(), clusterType);
39     localClus.setE3x3( basicClustersShapes[iClusType].e3x3() );
40     localClus.setE5x5( basicClustersShapes[iClusType].e5x5() );
41     localClus.setEmax( basicClustersShapes[iClusType].eMax() );
42     localClus.setE2nd( basicClustersShapes[iClusType].e2nd() );
43     localClus.setNxtals( (aClus->getHitsByDetId()).size() );
44     localClus.setUid( (aClus->getHitsByDetId())[0] );
45    
46     //cout << "***" << localClus << endl;
47     //seedShpItr = bcShapesHandle->find(&aClus);
48     //const reco::ClusterShapeRef& seedShapeRef = seedShpItr->val;
49     //cout << "seedShapeRef->e3x3()=" << seedShapeRef->e3x3() << endl;
50    
51     if(verbosity>2) cout << localClus << endl;
52     new( (*rootClusters)[iClus] ) TRootCluster(localClus);
53    
54     iClus++;
55     iClusType++;
56     }
57     rootEvent->setNBasicClusters(clusterType,iClusType);
58    
59     }