1 |
lethuill |
1.3 |
#include "../interface/ClusterAnalyzer.h"
|
2 |
mlethuil |
1.1 |
|
3 |
|
|
using namespace std;
|
4 |
|
|
using namespace reco;
|
5 |
|
|
using namespace edm;
|
6 |
|
|
|
7 |
lethuill |
1.4 |
ClusterAnalyzer::ClusterAnalyzer(const edm::ParameterSet& producersNames, int verbosity):verbosity_(verbosity), iClus_(0)
|
8 |
mlethuil |
1.1 |
{
|
9 |
lethuill |
1.5 |
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
|
10 |
|
|
allowMissingCollection_ = producersNames.getUntrackedParameter<bool>("allowMissingCollection", false);
|
11 |
mlethuil |
1.1 |
}
|
12 |
lethuill |
1.4 |
|
13 |
|
|
|
14 |
mlethuil |
1.1 |
ClusterAnalyzer::~ClusterAnalyzer()
|
15 |
|
|
{
|
16 |
|
|
}
|
17 |
|
|
|
18 |
lethuill |
1.4 |
|
19 |
lethuill |
1.5 |
bool ClusterAnalyzer::process(const edm::Event& iEvent, TRootEvent* rootEvent, EcalClusterLazyTools* lazyTools, TClonesArray* rootClusters, const string moduleLabel, const string instanceName, const int clusterType)
|
20 |
mlethuil |
1.1 |
{
|
21 |
lethuill |
1.5 |
|
22 |
|
|
unsigned int nBasicClusters=0;
|
23 |
|
|
|
24 |
|
|
edm::Handle<reco::BasicClusterCollection> basicClustersHandle;
|
25 |
|
|
const reco::BasicClusterCollection *basicClusters = 0;
|
26 |
|
|
try
|
27 |
|
|
{
|
28 |
|
|
iEvent.getByLabel(moduleLabel, instanceName, basicClustersHandle);
|
29 |
|
|
nBasicClusters = basicClustersHandle->size();
|
30 |
|
|
basicClusters = basicClustersHandle.product();
|
31 |
|
|
}
|
32 |
|
|
catch (cms::Exception& exception)
|
33 |
|
|
{
|
34 |
|
|
if ( !allowMissingCollection_ )
|
35 |
|
|
{
|
36 |
lethuill |
1.7 |
if(verbosity_>1) cout << endl << " ##### ERROR IN ClusterAnalyzer::process => reco::BasicCluster collection is missing for Producer: " << moduleLabel << " : " << instanceName << " #####" << endl;
|
37 |
lethuill |
1.5 |
throw exception;
|
38 |
|
|
}
|
39 |
lethuill |
1.7 |
if(verbosity_>1) cout << endl << " ===> No reco::BasicCluster collection for Producer: " << moduleLabel << " : " << instanceName << " , skip basic clusters info" << endl;
|
40 |
lethuill |
1.5 |
return false;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
if(verbosity_>1) cout << endl << " Producer: " << moduleLabel << " : " << instanceName << " - Number of BasicClusters (type " << clusterType << ") = " << nBasicClusters << std::endl;
|
45 |
|
|
|
46 |
|
|
Int_t iClusType=0;
|
47 |
|
|
|
48 |
|
|
for( reco::BasicClusterCollection::const_iterator aClus = basicClusters->begin(); aClus != basicClusters->end(); aClus++)
|
49 |
|
|
{
|
50 |
|
|
TRootCluster localClus( aClus->energy(), aClus->eta(), aClus->phi(), aClus->x(), aClus->y(), aClus->z(), clusterType);
|
51 |
|
|
localClus.setE3x3( lazyTools->e3x3(*aClus) );
|
52 |
|
|
localClus.setE5x5( lazyTools->e5x5(*aClus) );
|
53 |
|
|
localClus.setEmax( lazyTools->eMax(*aClus) );
|
54 |
|
|
localClus.setE2nd( lazyTools->e2nd(*aClus) );
|
55 |
lethuill |
1.6 |
localClus.setNxtals( (aClus->hitsAndFractions()).size() );
|
56 |
|
|
if ( (aClus->hitsAndFractions()).size()>0 ) localClus.setUid( (aClus->hitsAndFractions()).at(0).first() );
|
57 |
lethuill |
1.5 |
|
58 |
|
|
new( (*rootClusters)[iClus_] ) TRootCluster(localClus);
|
59 |
|
|
if(verbosity_>3) cout << " ["<< setw(3) << iClus_ << "] " << localClus << endl;
|
60 |
lethuill |
1.6 |
//if(verbosity_>3) cout << "====> seed=" << aClus->seed() << " caloID=" << aClus->caloID() << "first hit ID=" << (aClus->hitsAndFractions()).at(0).first() << endl;
|
61 |
|
|
|
62 |
lethuill |
1.5 |
iClus_++;
|
63 |
|
|
iClusType++;
|
64 |
|
|
}
|
65 |
|
|
rootEvent->setNBasicClusters(clusterType,iClusType);
|
66 |
|
|
return true;
|
67 |
mlethuil |
1.1 |
}
|